From 661078ddbde3ce0f3b06e95642fbb9b5fef7dca1 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sat, 28 Feb 1998 23:21:12 -0500 Subject: [PATCH] ncurses 4.2 --- ANNOUNCE | 112 +- Ada95/Makefile.in | 77 +- Ada95/README | 42 +- Ada95/ada_include/Makefile.in | 429 ++- .../terminal_interface-curses-aux.adb | 59 +- .../terminal_interface-curses-aux.ads | 42 +- ...erface-curses-forms-choice_field_types.adb | 88 - ...erface-curses-forms-choice_field_types.ads | 46 - ...terface-curses-forms-field_types-alpha.adb | 68 + ...terface-curses-forms-field_types-alpha.ads | 53 + ...-curses-forms-field_types-alphanumeric.adb | 68 + ...-curses-forms-field_types-alphanumeric.ads | 53 + ...rses-forms-field_types-enumeration-ada.adb | 80 + ...rses-forms-field_types-enumeration-ada.ads | 58 + ...e-curses-forms-field_types-enumeration.adb | 119 + ...e-curses-forms-field_types-enumeration.ads | 97 + ...face-curses-forms-field_types-intfield.adb | 72 + ...face-curses-forms-field_types-intfield.ads | 55 + ...-curses-forms-field_types-ipv4_address.adb | 68 + ...-curses-forms-field_types-ipv4_address.ads | 50 + ...rface-curses-forms-field_types-numeric.adb | 74 + ...rface-curses-forms-field_types-numeric.ads | 55 + ...erface-curses-forms-field_types-regexp.adb | 71 + ...erface-curses-forms-field_types-regexp.ads | 55 + ...e-curses-forms-field_types-user-choice.adb | 109 + ...e-curses-forms-field_types-user-choice.ads | 93 + ...nterface-curses-forms-field_types-user.adb | 131 + ...nterface-curses-forms-field_types-user.ads | 96 + ...nal_interface-curses-forms-field_types.adb | 349 +- ...nal_interface-curses-forms-field_types.ads | 50 - ...interface-curses-forms-field_user_data.adb | 88 +- ..._interface-curses-forms-form_user_data.adb | 78 +- .../terminal_interface-curses-forms.adb | 702 +--- ..._interface-curses-menus-item_user_data.adb | 50 +- ..._interface-curses-menus-menu_user_data.adb | 77 +- .../terminal_interface-curses-menus.adb | 252 +- .../terminal_interface-curses-mouse.adb | 61 +- ...inal_interface-curses-panels-user_data.adb | 50 +- .../terminal_interface-curses-panels.adb | 38 +- .../terminal_interface-curses-text_io-aux.adb | 38 +- .../terminal_interface-curses-text_io-aux.ads | 39 +- ...al_interface-curses-text_io-complex_io.adb | 38 +- ...al_interface-curses-text_io-complex_io.ads | 40 +- ...al_interface-curses-text_io-decimal_io.adb | 38 +- ...al_interface-curses-text_io-decimal_io.ads | 38 +- ...nterface-curses-text_io-enumeration_io.adb | 38 +- ...nterface-curses-text_io-enumeration_io.ads | 38 +- ...inal_interface-curses-text_io-fixed_io.adb | 38 +- ...inal_interface-curses-text_io-fixed_io.ads | 38 +- ...inal_interface-curses-text_io-float_io.adb | 38 +- ...inal_interface-curses-text_io-float_io.ads | 38 +- ...al_interface-curses-text_io-integer_io.adb | 38 +- ...al_interface-curses-text_io-integer_io.ads | 38 +- ...al_interface-curses-text_io-modular_io.adb | 38 +- ...al_interface-curses-text_io-modular_io.ads | 38 +- .../terminal_interface-curses-text_io.adb | 43 +- .../terminal_interface-curses-text_io.ads | 38 +- .../ada_include/terminal_interface-curses.adb | 160 +- Ada95/ada_include/terminal_interface.ads | 41 +- Ada95/gen/Makefile.in | 122 +- Ada95/gen/gen.c | 215 +- ..._interface-curses-forms-field_types.ads.m4 | 238 ++ ...erface-curses-forms-field_user_data.ads.m4 | 57 +- ...terface-curses-forms-form_user_data.ads.m4 | 58 +- .../terminal_interface-curses-forms.ads.m4 | 340 +- ...terface-curses-menus-item_user_data.ads.m4 | 49 +- ...terface-curses-menus-menu_user_data.ads.m4 | 57 +- .../terminal_interface-curses-menus.ads.m4 | 156 +- .../terminal_interface-curses-mouse.ads.m4 | 51 +- ...l_interface-curses-panels-user_data.ads.m4 | 48 +- .../terminal_interface-curses-panels.ads.m4 | 52 +- Ada95/gen/terminal_interface-curses.ads.m4 | 230 +- Ada95/html/Makefile | 19 - Ada95/html/curs_addch.3x.html | 6 +- Ada95/html/curs_attr.3x.html | 2 +- Ada95/html/curs_color.3x.html | 2 +- Ada95/html/curs_getch.3x.html | 100 +- Ada95/html/curs_inch.3x.html | 6 +- Ada95/html/curs_kernel.3x.html | 2 +- Ada95/html/curs_mouse.3x.html | 54 +- Ada95/html/curs_outopts.3x.html | 8 +- Ada95/html/curs_print.3x.html | 2 +- Ada95/html/curs_refresh.3x.html | 26 +- Ada95/html/curs_scanw.3x.html | 2 +- Ada95/html/curs_termcap.3x.html | 2 +- Ada95/html/curs_terminfo.3x.html | 104 +- Ada95/html/define_key.3x.html | 70 + Ada95/html/dft_fgbg.3x.html | 6 +- Ada95/html/form.3x.html | 124 +- Ada95/html/form_driver.3x.html | 2 +- Ada95/html/form_field_buffer.3x.html | 2 +- Ada95/html/form_field_new.3x.html | 2 +- Ada95/html/form_field_opts.3x.html | 22 +- Ada95/html/form_field_userptr.3x.html | 4 +- Ada95/html/form_field_validation.3x.html | 2 +- Ada95/html/form_fieldtype.3x.html | 14 +- Ada95/html/form_userptr.3x.html | 4 +- Ada95/html/index.html | 57 +- Ada95/html/keyok.3x.html | 70 + Ada95/html/menu.3x.html | 96 +- Ada95/html/menu_driver.3x.html | 2 +- Ada95/html/menu_format.3x.html | 76 +- Ada95/html/menu_pattern.3x.html | 2 +- Ada95/html/menu_post.3x.html | 14 +- Ada95/html/menu_userptr.3x.html | 4 +- Ada95/html/mitem_new.3x.html | 20 +- Ada95/html/mitem_userptr.3x.html | 4 +- Ada95/html/mitem_value.3x.html | 2 +- Ada95/html/ncurses.3x.html | 18 +- Ada95/html/panel.3x.html | 2 +- Ada95/html/resizeterm.3x.html | 16 +- Ada95/html/table.html | 58 +- ...ace-curses-forms-choice_field_types_s.html | 64 - ...face-curses-forms-field_types-alpha_s.html | 68 + ...rses-forms-field_types-alphanumeric_s.html | 68 + ...s-forms-field_types-enumeration-ada_s.html | 74 + ...urses-forms-field_types-enumeration_s.html | 112 + ...e-curses-forms-field_types-intfield_s.html | 70 + ...rses-forms-field_types-ipv4_address_s.html | 65 + ...ce-curses-forms-field_types-numeric_s.html | 70 + ...ace-curses-forms-field_types-regexp_s.html | 70 + ...urses-forms-field_types-user-choice_s.html | 107 + ...rface-curses-forms-field_types-user_s.html | 110 + ..._interface-curses-forms-field_types_s.html | 244 +- ...erface-curses-forms-field_user_data_s.html | 50 +- ...terface-curses-forms-form_user_data_s.html | 50 +- .../terminal_interface-curses-forms_s.html | 278 +- ...terface-curses-menus-item_user_data_s.html | 41 +- ...terface-curses-menus-menu_user_data_s.html | 50 +- .../terminal_interface-curses-menus_s.html | 89 +- .../terminal_interface-curses-mouse_s.html | 43 +- ...l_interface-curses-panels-user_data_s.html | 37 +- .../terminal_interface-curses-panels_s.html | 37 +- ...interface-curses-text_io-complex_io_s.html | 37 +- ...interface-curses-text_io-decimal_io_s.html | 37 +- ...rface-curses-text_io-enumeration_io_s.html | 37 +- ...l_interface-curses-text_io-fixed_io_s.html | 37 +- ...l_interface-curses-text_io-float_io_s.html | 37 +- ...interface-curses-text_io-integer_io_s.html | 37 +- ...interface-curses-text_io-modular_io_s.html | 37 +- .../terminal_interface-curses-text_io_s.html | 37 +- Ada95/html/terminal_interface-curses_s.html | 112 +- Ada95/html/terminal_interface_s.html | 37 +- Ada95/html/wresize.3x.html | 2 +- Ada95/samples/Makefile.in | 87 +- Ada95/samples/explain.txt | 29 +- Ada95/samples/rain.adb | 161 + Ada95/samples/rain.ads | 42 + .../samples/sample-curses_demo-attributes.adb | 38 +- .../samples/sample-curses_demo-attributes.ads | 38 +- Ada95/samples/sample-curses_demo-mouse.adb | 38 +- Ada95/samples/sample-curses_demo-mouse.ads | 38 +- Ada95/samples/sample-curses_demo.adb | 67 +- Ada95/samples/sample-curses_demo.ads | 38 +- Ada95/samples/sample-explanation.adb | 38 +- Ada95/samples/sample-explanation.ads | 38 +- Ada95/samples/sample-form_demo-aux.adb | 90 +- Ada95/samples/sample-form_demo-aux.ads | 38 +- Ada95/samples/sample-form_demo-handler.adb | 38 +- Ada95/samples/sample-form_demo-handler.ads | 38 +- Ada95/samples/sample-form_demo.adb | 92 +- Ada95/samples/sample-form_demo.ads | 38 +- Ada95/samples/sample-function_key_setting.adb | 38 +- Ada95/samples/sample-function_key_setting.ads | 38 +- Ada95/samples/sample-header_handler.adb | 38 +- Ada95/samples/sample-header_handler.ads | 38 +- Ada95/samples/sample-helpers.adb | 38 +- Ada95/samples/sample-helpers.ads | 38 +- Ada95/samples/sample-keyboard_handler.adb | 56 +- Ada95/samples/sample-keyboard_handler.ads | 38 +- Ada95/samples/sample-manifest.ads | 38 +- Ada95/samples/sample-menu_demo-aux.adb | 50 +- Ada95/samples/sample-menu_demo-aux.ads | 38 +- Ada95/samples/sample-menu_demo-handler.adb | 55 +- Ada95/samples/sample-menu_demo-handler.ads | 38 +- Ada95/samples/sample-menu_demo.adb | 84 +- Ada95/samples/sample-menu_demo.ads | 38 +- Ada95/samples/sample-my_field_type.adb | 50 +- Ada95/samples/sample-my_field_type.ads | 55 +- Ada95/samples/sample-text_io_demo.adb | 39 +- Ada95/samples/sample-text_io_demo.ads | 38 +- Ada95/samples/sample.adb | 46 +- Ada95/samples/sample.ads | 38 +- Ada95/samples/status.adb | 56 + Ada95/samples/status.ads | 55 + Ada95/samples/tour.adb | 38 +- Ada95/samples/tour.ads | 38 +- INSTALL | 31 +- MANIFEST | 150 +- Makefile.glibc | 301 +- Makefile.in | 55 +- NEWS | 1068 +++++- README | 95 +- TO-DO | 52 +- aclocal.m4 | 1429 +++++--- announce.html | 166 +- announce.html.in | 162 +- c++/Makefile.in | 176 +- c++/NEWS | 25 +- c++/PROBLEMS | 7 +- c++/README-first | 39 +- c++/cursesapp.cc | 146 + c++/cursesapp.h | 163 + c++/cursesf.cc | 423 +++ c++/cursesf.h | 823 +++++ c++/cursesm.cc | 335 +- c++/cursesm.h | 477 ++- c++/cursesmain.cc | 51 + c++/cursesp.cc | 87 +- c++/cursesp.h | 142 +- c++/cursesw.cc | 148 +- c++/cursesw.h | 770 ++++- c++/cursslk.cc | 121 + c++/cursslk.h | 200 ++ c++/demo.cc | 301 +- c++/edit_cfg.sh | 59 + c++/etip.h | 148 - c++/etip.h.in | 232 ++ c++/headers | 39 + c++/internal.h | 39 +- c++/modules | 64 +- config.guess | 696 ++++ config.sub | 927 +++++ configure | 3031 ++++++++++++----- configure.in | 676 ++-- dist.mk | 12 +- form/Makefile.in | 73 +- form/READ.ME | 8 +- form/fld_arg.c | 91 + form/fld_attr.c | 111 + form/fld_current.c | 124 + form/fld_def.c | 473 +-- form/fld_dup.c | 97 + form/fld_ftchoice.c | 62 + form/fld_ftlink.c | 83 + form/fld_info.c | 91 + form/fld_just.c | 81 + form/fld_link.c | 90 + form/fld_max.c | 74 + form/fld_move.c | 62 + form/fld_newftyp.c | 125 + form/fld_opts.c | 121 + form/fld_pad.c | 78 + form/fld_page.c | 76 + form/fld_stat.c | 54 +- form/fld_type.c | 256 +- form/fld_user.c | 58 +- form/form.h | 66 +- form/form.priv.h | 76 +- form/frm_adabind.c | 70 +- form/frm_cursor.c | 66 + form/frm_data.c | 54 +- form/frm_def.c | 113 +- form/frm_driver.c | 774 +---- form/frm_hook.c | 54 +- form/frm_opts.c | 54 +- form/frm_page.c | 100 + form/frm_post.c | 117 + form/frm_req_name.c | 54 +- form/frm_scale.c | 63 + form/frm_sub.c | 69 + form/frm_user.c | 58 +- form/frm_win.c | 87 +- form/fty_alnum.c | 10 +- form/fty_alpha.c | 10 +- form/fty_enum.c | 26 +- form/fty_int.c | 12 +- form/fty_num.c | 14 +- form/fty_regex.c | 32 +- form/headers | 49 +- form/llib-lform | 999 +++--- form/modules | 106 +- include/Caps | 53 +- include/MKparametrized.sh | 2 +- include/MKterm.h.awk.in | 122 +- include/Makefile.in | 59 +- include/capdefaults.c | 57 +- include/config_h.in | 26 - include/curses.h.in | 276 +- include/edit_cfg.sh | 71 +- include/headers | 49 +- include/nc_alloc.h | 52 +- include/nc_panel.h | 66 + include/ncurses_cfg.hin | 56 + include/term_entry.h | 50 +- include/termcap.h.in | 55 +- include/tic.h | 94 +- include/unctrl.h.in | 59 +- install-sh | 2 +- man/Makefile.in | 64 +- man/curs_addch.3x | 11 +- man/curs_attr.3x | 5 +- man/curs_color.3x | 4 +- man/curs_getch.3x | 13 +- man/curs_inch.3x | 5 +- man/curs_inchstr.3x | 2 +- man/curs_inopts.3x | 7 +- man/curs_kernel.3x | 4 +- man/curs_mouse.3x | 25 +- man/curs_outopts.3x | 5 + man/curs_print.3x | 3 +- man/curs_refresh.3x | 8 +- man/curs_scanw.3x | 3 +- man/curs_termcap.3x | 4 +- man/curs_terminfo.3x | 8 +- man/define_key.3x | 69 + man/dft_fgbg.3x | 57 +- man/form.3x | 155 +- man/form_driver.3x | 4 +- man/form_field_buffer.3x | 2 +- man/form_field_new.3x | 3 +- man/form_field_opts.3x | 3 +- man/form_field_userptr.3x | 4 +- man/form_field_validation.3x | 4 +- man/form_fieldtype.3x | 5 +- man/form_userptr.3x | 4 +- man/infocmp.1m | 8 +- man/keyok.3x | 70 + man/make_sed.sh | 83 + man/man_db.renames | 19 +- man/menu.3x | 142 +- man/menu_driver.3x | 4 +- man/menu_format.3x | 5 +- man/menu_pattern.3x | 4 +- man/menu_post.3x | 3 +- man/menu_userptr.3x | 4 +- man/mitem_new.3x | 9 +- man/mitem_userptr.3x | 4 +- man/mitem_value.3x | 4 +- man/ncurses.3x | 548 +-- man/panel.3x | 11 +- man/resizeterm.3x | 61 +- man/term.5 | 2 +- man/term.7 | 3 +- man/terminfo.head | 8 +- man/terminfo.tail | 6 +- man/tic.1m | 12 +- man/toe.1m | 3 +- man/tset.1 | 2 +- man/wresize.3x | 53 +- menu/Makefile.in | 83 +- menu/READ.ME | 8 +- menu/eti.h | 52 +- menu/headers | 49 +- menu/llib-lmenu | 207 +- menu/m_adabind.c | 69 +- menu/m_attribs.c | 97 +- menu/m_cursor.c | 56 +- menu/m_driver.c | 143 +- menu/m_format.c | 56 +- menu/m_global.c | 56 +- menu/m_hook.c | 56 +- menu/m_item_cur.c | 116 +- menu/m_item_nam.c | 56 +- menu/m_item_new.c | 90 +- menu/m_item_opt.c | 56 +- menu/m_item_top.c | 102 + menu/m_item_use.c | 64 +- menu/m_item_val.c | 56 +- menu/m_item_vis.c | 56 +- menu/m_items.c | 56 +- menu/m_new.c | 56 +- menu/m_opts.c | 56 +- menu/m_pad.c | 90 + menu/m_pattern.c | 117 + menu/m_post.c | 56 +- menu/m_req_name.c | 56 +- menu/m_scale.c | 71 + menu/m_spacing.c | 56 +- menu/m_sub.c | 80 + menu/m_userptr.c | 64 +- menu/m_win.c | 124 +- menu/menu.h | 68 +- menu/menu.priv.h | 53 +- menu/mf_common.h | 60 +- menu/modules | 59 +- misc/Makefile.in | 71 +- misc/emx.src | 810 +++++ misc/hackguide.doc | 7 +- misc/hackguide.html | 8 +- misc/makellib | 51 +- misc/ncurses-intro.doc | 22 +- misc/ncurses-intro.html | 21 +- misc/run_tic.sh | 51 +- misc/shlib | 51 +- misc/tdlint | 51 +- misc/terminfo.src | 1784 ++++++++-- mk-0th.awk | 63 +- mk-1st.awk | 188 +- mk-2nd.awk | 130 +- mkinstalldirs | 3 +- ncurses.lsm | 30 - ncurses/MKcaptab.awk | 3 +- ncurses/MKexpanded.sh | 57 +- ncurses/MKkeyname.awk | 34 +- ncurses/MKkeys.awk | 1 - ncurses/MKlib_gen.sh | 124 +- ncurses/MKnames.awk | 6 +- ncurses/MKunctrl.awk | 53 +- ncurses/Makefile.in | 123 +- ncurses/SigAction.h | 72 +- ncurses/alloc_entry.c | 54 +- ncurses/captoinfo.c | 82 +- ncurses/comp_error.c | 60 +- ncurses/comp_expand.c | 137 + ncurses/comp_hash.c | 54 +- ncurses/comp_parse.c | 76 +- ncurses/comp_scan.c | 109 +- ncurses/curses.priv.h | 373 +- ncurses/define_key.c | 54 + ncurses/fifo_defs.h | 59 + ncurses/hardscroll.c | 321 +- ncurses/hashmap.c | 407 ++- ncurses/keyok.c | 69 + ncurses/keys.list | 308 +- ncurses/lib_acs.c | 59 +- ncurses/lib_adabind.c | 112 +- ncurses/lib_addch.c | 214 +- ncurses/lib_addstr.c | 123 +- ncurses/lib_baudrate.c | 81 +- ncurses/lib_beep.c | 78 +- ncurses/lib_bkgd.c | 122 +- ncurses/lib_box.c | 124 +- ncurses/lib_chgat.c | 62 + ncurses/lib_clear.c | 65 +- ncurses/lib_clearok.c | 56 + ncurses/lib_clrbot.c | 113 +- ncurses/lib_clreol.c | 127 +- ncurses/lib_color.c | 138 +- ncurses/lib_cur_term.c | 81 + ncurses/lib_data.c | 71 +- ncurses/lib_delch.c | 86 +- ncurses/lib_delwin.c | 52 +- ncurses/lib_dft_fgbg.c | 52 +- ncurses/lib_doupdate.c | 911 ++++- ncurses/lib_echo.c | 61 + ncurses/lib_endwin.c | 86 +- ncurses/lib_erase.c | 99 +- ncurses/lib_flash.c | 69 + ncurses/lib_freeall.c | 56 +- ncurses/lib_getch.c | 324 +- ncurses/lib_getstr.c | 90 +- ncurses/lib_hline.c | 81 + ncurses/lib_immedok.c | 54 + ncurses/lib_inchstr.c | 63 +- ncurses/lib_initscr.c | 90 +- ncurses/lib_insch.c | 78 +- ncurses/lib_insdel.c | 72 +- ncurses/lib_insstr.c | 108 +- ncurses/lib_instr.c | 81 +- ncurses/lib_isendwin.c | 52 +- ncurses/lib_kernel.c | 137 +- ncurses/lib_leaveok.c | 60 + ncurses/lib_longname.c | 54 +- ncurses/lib_mouse.c | 236 +- ncurses/lib_move.c | 59 +- ncurses/lib_mvcur.c | 487 +-- ncurses/lib_mvwin.c | 96 +- ncurses/lib_napms.c | 88 + ncurses/lib_newterm.c | 134 +- ncurses/lib_newwin.c | 56 +- ncurses/lib_nl.c | 80 + ncurses/lib_options.c | 344 +- ncurses/lib_overlay.c | 66 +- ncurses/lib_pad.c | 104 +- ncurses/lib_print.c | 52 +- ncurses/lib_printw.c | 125 +- ncurses/lib_raw.c | 293 +- ncurses/lib_redrawln.c | 67 + ncurses/lib_refresh.c | 76 +- ncurses/lib_restart.c | 91 +- ncurses/lib_scanw.c | 60 +- ncurses/lib_screen.c | 139 +- ncurses/lib_scroll.c | 75 +- ncurses/lib_scrollok.c | 56 + ncurses/lib_scrreg.c | 75 +- ncurses/lib_set_term.c | 155 +- ncurses/lib_setup.c | 180 +- ncurses/lib_slk.c | 414 +-- ncurses/lib_slkatrof.c | 55 + ncurses/lib_slkatron.c | 55 + ncurses/lib_slkatrset.c | 55 + ncurses/lib_slkattr.c | 54 + ncurses/lib_slkclear.c | 58 + ncurses/lib_slkinit.c | 51 + ncurses/lib_slklab.c | 51 + ncurses/lib_slkrefr.c | 126 + ncurses/lib_slkset.c | 95 + ncurses/lib_slktouch.c | 53 + ncurses/lib_termcap.c | 88 +- ncurses/lib_ti.c | 75 +- ncurses/lib_touch.c | 65 +- ncurses/lib_tparm.c | 83 +- ncurses/lib_tputs.c | 140 +- ncurses/lib_trace.c | 56 +- ncurses/lib_traceatr.c | 97 +- ncurses/lib_tracechr.c | 50 +- ncurses/lib_tracedmp.c | 58 +- ncurses/lib_tracemse.c | 52 +- ncurses/lib_tstp.c | 133 +- ncurses/lib_twait.c | 138 +- ncurses/lib_ungetch.c | 74 + ncurses/lib_vidattr.c | 120 +- ncurses/lib_vline.c | 81 + ncurses/lib_wattroff.c | 55 + ncurses/lib_wattron.c | 55 + ncurses/lib_window.c | 79 +- ncurses/llib-lncurses | 1755 +++++----- ncurses/make_keys.c | 134 + ncurses/modules | 148 +- ncurses/name_match.c | 85 + ncurses/nc_panel.c | 41 + ncurses/parse_entry.c | 71 +- ncurses/read_entry.c | 113 +- ncurses/read_termcap.c | 503 ++- ncurses/resizeterm.c | 59 +- ncurses/safe_sprintf.c | 241 ++ ncurses/sigaction.c | 52 +- ncurses/softscroll.c | 257 ++ ncurses/trace_buf.c | 79 + ncurses/tries.c | 185 + ncurses/wresize.c | 81 +- ncurses/write_entry.c | 100 +- panel/Makefile.in | 73 +- panel/headers | 49 +- panel/llib-lpanel | 187 +- panel/modules | 66 +- panel/p_above.c | 51 + panel/p_below.c | 53 + panel/p_bottom.c | 53 + panel/p_delete.c | 53 + panel/p_hidden.c | 47 + panel/p_hide.c | 99 + panel/p_move.c | 59 + panel/p_new.c | 99 + panel/p_replace.c | 52 + panel/p_show.c | 76 + panel/p_top.c | 45 + panel/p_update.c | 61 + panel/p_user.c | 55 + panel/p_win.c | 49 + panel/panel.c | 552 +-- panel/panel.h | 58 +- panel/panel.priv.h | 59 +- progs/Makefile.in | 171 +- progs/capconvert | 133 +- progs/clear.c | 54 +- progs/dump_entry.c | 231 +- progs/dump_entry.h | 53 +- progs/infocmp.c | 97 +- progs/modules | 51 +- progs/progs.priv.h | 71 +- progs/tic.c | 85 +- progs/toe.c | 63 +- progs/tput.c | 83 +- progs/tset.c | 269 +- shlib-versions | 4 + sysdeps/unix/sysv/linux/alpha/configure | 2 + sysdeps/unix/sysv/linux/configure | 315 +- sysdeps/unix/sysv/linux/edit_man.sh | 0 sysdeps/unix/sysv/linux/run_tic.sh | 51 +- tack/Makefile.in | 167 + tack/modules | 47 + tar-copy.sh | 70 + test/Makefile.in | 208 +- test/bs.c | 56 +- test/configure.in | 189 +- test/firework.c | 4 +- test/firstlast.c | 89 + test/gdc.c | 74 +- test/hanoi.c | 16 +- test/hashtest.c | 56 +- test/keynames.c | 14 + test/knight.c | 4 +- test/lrtest.c | 4 +- test/modules | 56 +- test/ncurses.c | 281 +- test/ncurses_tst.hin | 56 + test/newdemo.c | 55 +- test/rain.c | 123 +- test/tclock.c | 43 +- test/test.priv.h | 54 +- test/testaddch.c | 60 + test/testcurs.c | 329 +- test/testscanw.c | 38 + test/view.c | 185 +- test/worm.c | 16 +- test/xmas.c | 121 +- 588 files changed, 43616 insertions(+), 19301 deletions(-) delete mode 100644 Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.adb delete mode 100644 Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.ads create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-alpha.adb create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-alpha.ads create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-alphanumeric.adb create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-alphanumeric.ads create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration-ada.adb create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration-ada.ads create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration.adb create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration.ads create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-intfield.adb create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-intfield.ads create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-ipv4_address.adb create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-ipv4_address.ads create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-numeric.adb create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-numeric.ads create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-regexp.adb create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-regexp.ads create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-user-choice.adb create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-user-choice.ads create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-user.adb create mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types-user.ads delete mode 100644 Ada95/ada_include/terminal_interface-curses-forms-field_types.ads create mode 100644 Ada95/gen/terminal_interface-curses-forms-field_types.ads.m4 delete mode 100644 Ada95/html/Makefile create mode 100644 Ada95/html/define_key.3x.html create mode 100644 Ada95/html/keyok.3x.html delete mode 100644 Ada95/html/terminal_interface-curses-forms-choice_field_types_s.html create mode 100644 Ada95/html/terminal_interface-curses-forms-field_types-alpha_s.html create mode 100644 Ada95/html/terminal_interface-curses-forms-field_types-alphanumeric_s.html create mode 100644 Ada95/html/terminal_interface-curses-forms-field_types-enumeration-ada_s.html create mode 100644 Ada95/html/terminal_interface-curses-forms-field_types-enumeration_s.html create mode 100644 Ada95/html/terminal_interface-curses-forms-field_types-intfield_s.html create mode 100644 Ada95/html/terminal_interface-curses-forms-field_types-ipv4_address_s.html create mode 100644 Ada95/html/terminal_interface-curses-forms-field_types-numeric_s.html create mode 100644 Ada95/html/terminal_interface-curses-forms-field_types-regexp_s.html create mode 100644 Ada95/html/terminal_interface-curses-forms-field_types-user-choice_s.html create mode 100644 Ada95/html/terminal_interface-curses-forms-field_types-user_s.html create mode 100644 Ada95/samples/rain.adb create mode 100644 Ada95/samples/rain.ads create mode 100644 Ada95/samples/status.adb create mode 100644 Ada95/samples/status.ads create mode 100644 c++/cursesapp.cc create mode 100644 c++/cursesapp.h create mode 100644 c++/cursesf.cc create mode 100644 c++/cursesf.h create mode 100644 c++/cursesmain.cc create mode 100644 c++/cursslk.cc create mode 100644 c++/cursslk.h create mode 100755 c++/edit_cfg.sh delete mode 100644 c++/etip.h create mode 100644 c++/etip.h.in create mode 100644 c++/headers create mode 100755 config.guess create mode 100755 config.sub create mode 100644 form/fld_arg.c create mode 100644 form/fld_attr.c create mode 100644 form/fld_current.c create mode 100644 form/fld_dup.c create mode 100644 form/fld_ftchoice.c create mode 100644 form/fld_ftlink.c create mode 100644 form/fld_info.c create mode 100644 form/fld_just.c create mode 100644 form/fld_link.c create mode 100644 form/fld_max.c create mode 100644 form/fld_move.c create mode 100644 form/fld_newftyp.c create mode 100644 form/fld_opts.c create mode 100644 form/fld_pad.c create mode 100644 form/fld_page.c create mode 100644 form/frm_cursor.c create mode 100644 form/frm_page.c create mode 100644 form/frm_post.c create mode 100644 form/frm_scale.c create mode 100644 form/frm_sub.c delete mode 100644 include/config_h.in create mode 100644 include/nc_panel.h create mode 100644 include/ncurses_cfg.hin create mode 100644 man/define_key.3x create mode 100644 man/keyok.3x create mode 100755 man/make_sed.sh create mode 100644 menu/m_item_top.c create mode 100644 menu/m_pad.c create mode 100644 menu/m_pattern.c create mode 100644 menu/m_scale.c create mode 100644 menu/m_sub.c create mode 100644 misc/emx.src delete mode 100644 ncurses.lsm delete mode 100644 ncurses/MKkeys.awk create mode 100644 ncurses/comp_expand.c create mode 100644 ncurses/define_key.c create mode 100644 ncurses/fifo_defs.h create mode 100644 ncurses/keyok.c create mode 100644 ncurses/lib_chgat.c create mode 100644 ncurses/lib_clearok.c create mode 100644 ncurses/lib_cur_term.c create mode 100644 ncurses/lib_echo.c create mode 100644 ncurses/lib_flash.c create mode 100644 ncurses/lib_hline.c create mode 100644 ncurses/lib_immedok.c create mode 100644 ncurses/lib_leaveok.c create mode 100644 ncurses/lib_napms.c create mode 100644 ncurses/lib_nl.c create mode 100644 ncurses/lib_redrawln.c create mode 100644 ncurses/lib_scrollok.c create mode 100644 ncurses/lib_slkatrof.c create mode 100644 ncurses/lib_slkatron.c create mode 100644 ncurses/lib_slkatrset.c create mode 100644 ncurses/lib_slkattr.c create mode 100644 ncurses/lib_slkclear.c create mode 100644 ncurses/lib_slkinit.c create mode 100644 ncurses/lib_slklab.c create mode 100644 ncurses/lib_slkrefr.c create mode 100644 ncurses/lib_slkset.c create mode 100644 ncurses/lib_slktouch.c create mode 100644 ncurses/lib_ungetch.c create mode 100644 ncurses/lib_vline.c create mode 100644 ncurses/lib_wattroff.c create mode 100644 ncurses/lib_wattron.c create mode 100644 ncurses/make_keys.c create mode 100644 ncurses/name_match.c create mode 100644 ncurses/nc_panel.c create mode 100644 ncurses/safe_sprintf.c create mode 100644 ncurses/softscroll.c create mode 100644 ncurses/trace_buf.c create mode 100644 ncurses/tries.c create mode 100644 panel/p_above.c create mode 100644 panel/p_below.c create mode 100644 panel/p_bottom.c create mode 100644 panel/p_delete.c create mode 100644 panel/p_hidden.c create mode 100644 panel/p_hide.c create mode 100644 panel/p_move.c create mode 100644 panel/p_new.c create mode 100644 panel/p_replace.c create mode 100644 panel/p_show.c create mode 100644 panel/p_top.c create mode 100644 panel/p_update.c create mode 100644 panel/p_user.c create mode 100644 panel/p_win.c create mode 100644 shlib-versions create mode 100755 sysdeps/unix/sysv/linux/alpha/configure mode change 100644 => 100755 sysdeps/unix/sysv/linux/configure mode change 100644 => 100755 sysdeps/unix/sysv/linux/edit_man.sh create mode 100644 tack/Makefile.in create mode 100644 tack/modules create mode 100755 tar-copy.sh create mode 100644 test/firstlast.c create mode 100644 test/keynames.c create mode 100644 test/ncurses_tst.hin create mode 100644 test/testaddch.c create mode 100644 test/testscanw.c diff --git a/ANNOUNCE b/ANNOUNCE index 95ae5be2..3383dedd 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ - Announcing ncurses 4.1 + Announcing ncurses 4.2 The ncurses (new curses) library is a freeware emulation of System V Release 4.0 curses. It uses terminfo format, supports pads and color @@ -19,26 +19,26 @@ tput(1), tset(1), and a termcap conversion tool captoinfo(1). Full manual pages are provided for the library and tools. - The ncurses distribution is available via anonymous FTP at: - [1]ftp://ftp.clark.net/pub/dickey/ncurses. and - [2]ftp://ftp.netcom.com/pub/zm/zmbenhal/ncurses. It is also carried on - the GNU distribution site at [3]ftp://prep.ai.mit.edu/pub/gnu. + The ncurses distribution is available via anonymous FTP at the GNU + distribution site [1]ftp://prep.ai.mit.edu/pub/gnu. It is also + available at [2]ftp://ftp.clark.net/pub/dickey/ncurses. Features of ncurses - The ncurses package is fully compatible with SVr4 curses: + The ncurses package is fully compatible with SVr4 (System V Release 4) + curses: * All 257 of the SVr4 calls have been implemented (and are documented). * Full support for SVr4 curses features including keyboard mapping, color, forms-drawing with ACS characters, and automatic recognition of keypad and function keys. - * An emulation of the System V Release 4 panels library, supporting - a stack of windows with backing store, is included. - * An emulation of the System V Release 4 menus library, supporting a - uniform but flexible interface for menu programming, is included. - * An emulation of the System V Release 4 form library, supporting - data collection through on-screen forms, is included. + * An emulation of the SVr4 panels library, supporting a stack of + windows with backing store, is included. + * An emulation of the SVr4 menus library, supporting a uniform but + flexible interface for menu programming, is included. + * An emulation of the SVr4 form library, supporting data collection + through on-screen forms, is included. * Binary terminfo entries generated by the ncurses tic(1) implementation are bit-for-bit-compatible with the entry format SVr4 curses uses. @@ -60,9 +60,19 @@ capability. * (PC-clone boxes only) Support for access to the IBM PC ROM characters 0-32 through the highlight A_ALTCHARSET. + * Ada95 and C++ bindings. * Support for mouse event reporting under xterm. + * Extended mouse support via Alessandro Rubini's gpm package. * The function wresize() allows you to resize windows, preserving their data. + * The function use_default_colors() allows you to use the terminal's + default colors for the default color pair, achieving the effect of + transparent colors. + * The functions keyok() and define_key() allow you to better control + the use of function keys, e.g., disabling the ncurses KEY_MOUSE, + or by defining more than one control sequence to map to a given + key code. + * Support for 16-color terminals, such as aixterm and XFree86 xterm. * Better cursor-movement optimization. The package now features a cursor-local-movement computation more efficient than either BSD's or System V's. @@ -132,7 +142,7 @@ including: ded - directory-editor [4]ftp://ftp.clark.net/pub/dickey/ded. + directory-editor [3]ftp://ftp.clark.net/pub/dickey/ded. dialog the underlying application used in Slackware's setup, and the @@ -141,6 +151,12 @@ lynx-2.7 the character-screen WWW browser + Midnight Commander 4.1 + file manager + + mutt 0.88 + mail utility + ncftp 2.0 file-transfer utility @@ -160,38 +176,35 @@ terminal emulator tin-unoff - tin (unofficial) newsreader, supporting color, MIME - [5]ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff. + tin 1.4 newsreader, supporting color, MIME + [4]ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff. vile - vi-like-emacs [6]ftp://ftp.clark.net/pub/dickey/vile. + vi-like-emacs [5]ftp://ftp.clark.net/pub/dickey/vile. The ncurses distribution includes a selection of test programs (including a few games). Who's Who and What's What - The original maintainer of ncurses is [7]Zeyd Ben-Halim. - Unfortunately, he can only work on the package part time. As a result, - since 1.8.1, much of the enhancement work and documentation has been - done by [8]Eric S. Raymond. The current primary maintainers are - [9]Thomas Dickey and [10]Juergen Pfeifer. - - There is an ncurses mailing list. It is a majordomo list; to join, - write to ncurses-request@mailgate.bsdi.com with a message containing - the line: - + The original developers of ncurses are [6]Zeyd Ben-Halim and [7]Eric + S. Raymond. Ongoing work is being done by [8]Thomas Dickey and + [9]Jürgen Pfeifer. [10]Florian La Roche acts as the maintainer for the + Free Software Foundation, which holds the copyright on ncurses. + Contact the current maintainers at [11]bug-ncurses@gnu.org. + + To join the ncurses mailing list, please write email to + bug-ncurses-request@gnu.org containing the line: subscribe @ This list is open to anyone interested in helping with the development and testing of this package. Beta versions of ncurses and patches to the current release are made - available at [11]ftp://ftp.clark.net/pub/dickey/ncurses. + available at [12]ftp://ftp.clark.net/pub/dickey/ncurses. Future Plans - * Extended mouse support via Alessandro Rubini's gpm package. * Extended-level XPG4 conformance, with internationalization support. * Ports to more systems, including DOS and Windows. @@ -199,33 +212,28 @@ Future Plans We need people to help with these projects. If you are interested in working on them, please join the ncurses list. -The terminfo/termcap Database - - The distribution includes and uses a copy of the terminfo-format - terminal description file maintained by Eric Raymond. You can download - either the [12]termcap or [13]terminfo versions of the terminal-type - database from Eric's ncurses page, - [14]http://www.ccil.org/~esr/ncurses.html. - Other Related Resources + The distribution includes and uses a version of the terminfo-format + terminal description file maintained by Eric Raymond. + [13]http://earthspace.net/~esr/terminfo. + You can find lots of information on terminal-related topics not - covered in the terminfo file at [15]Richard Shuford's archive. + covered in the terminfo file at [14]Richard Shuford's archive. References - 1. ftp://ftp.clark.net/pub/dickey/ncurses - 2. ftp://ftp.netcom.com/pub/zm/zmbenhal/ncurses - 3. ftp://prep.ai.mit.edu/pub/gnu - 4. ftp://ftp.clark.net/pub/dickey/ded - 5. ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff - 6. ftp://ftp.clark.net/pub/dickey/vile - 7. mailto:zmbenhal@netcom.com - 8. http://www.ccil.org/~esr/home.html - 9. mailto:dickey@clark.net - 10. mailto:Juergen.Pfeifer@T-Online.de - 11. ftp://ftp.clark.net/pub/dickey/ncurses - 12. http://www.ccil.org/~esr/terminfo/termtypes.tc.gz - 13. http://www.ccil.org/~esr/terminfo/termtypes.ti.gz - 14. http://www.ccil.org/~esr/ncurses.html - 15. http://www.cs.utk.edu/~shuford/terminal_index.html + 1. ftp://prep.ai.mit.edu/pub/gnu + 2. ftp://ftp.clark.net/pub/dickey/ncurses + 3. ftp://ftp.clark.net/pub/dickey/ded + 4. ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff + 5. ftp://ftp.clark.net/pub/dickey/vile + 6. mailto:zmbenhal@netcom.com + 7. http://www.ccil.org/~esr/home.html + 8. mailto:dickey@clark.net + 9. mailto:Juergen.Pfeifer@T-Online.de + 10. mailto:florian@gnu.org + 11. mailto:bug-ncurses@gnu.org + 12. ftp://ftp.clark.net/pub/dickey/ncurses + 13. http://earthspace.net/~esr/terminfo + 14. http://www.cs.utk.edu/~shuford/terminal_index.html diff --git a/Ada95/Makefile.in b/Ada95/Makefile.in index f4f6a816..49bbb602 100644 --- a/Ada95/Makefile.in +++ b/Ada95/Makefile.in @@ -1,56 +1,63 @@ -#---------------------------------------------------------------------------- -# -- -# GNAT ncurses Binding -- -# Makefile -- -# -- -# Version 00.92 -- -# -- -# The ncurses Ada95 binding is copyrighted 1996 by -- -# Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- -# -- -# Permission is hereby granted to reproduce and distribute this -- -# binding by any means and for any fee, whether alone or as part -- -# of a larger distribution, in source or in binary form, PROVIDED -- -# this notice is included with any such distribution, and is not -- -# removed from any of its header files. Mention of ncurses and the -- -# author of this binding in any applications linked with it is -- -# highly appreciated. -- -# -- -# This binding comes AS IS with no warranty, implied or expressed. -- -#---------------------------------------------------------------------------- +############################################################################## +# Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +# # Version Control -# $Revision: 1.3 $ +# $Revision: 1.10 $ # SHELL = /bin/sh THIS = Makefile SUBDIRS = @ADA_SUBDIRS@ -all :: +all \ +sources \ +install \ +install.libs \ +uninstall \ +uninstall.libs :: for d in $(SUBDIRS); do \ (cd $$d ; $(MAKE) $@) ;\ done -clean :: +clean \ +mostlyclean :: for d in $(SUBDIRS); do \ (cd $$d ; $(MAKE) $@) ;\ done -distclean :: - for d in $(SUBDIRS); do \ - (cd $$d ; $(MAKE) $@) ;\ - done - rm -f Makefile - +distclean \ realclean :: for d in $(SUBDIRS); do \ (cd $$d ; $(MAKE) $@) ;\ done rm -f Makefile -mostlyclean :: - for d in $(SUBDIRS); do \ - (cd $$d ; $(MAKE) $@) ;\ - done - -install :: +install.data : + @ diff --git a/Ada95/README b/Ada95/README index 6a5362df..28836a2f 100644 --- a/Ada95/README +++ b/Ada95/README @@ -1,16 +1,32 @@ -The ncurses Ada95 binding is copyrighted 1996 by Juergen Pfeifer -Email: Juergen.Pfeifer@T-Online.de - -Permission is hereby granted to reproduce and distribute this -binding by any means and for any fee, whether alone or as part -of a larger distribution, in source or in binary form, PROVIDED -this notice is included with any such distribution, and is not -removed from any of its header files. Mention of ncurses and the -author of this binding in any applications linked with it is -highly appreciated. - -This binding comes AS IS with no warranty, implied or expressed. ----------------------------------------------------------------------- +------------------------------------------------------------------------------- +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 Caveats: This is the first delivery of this binding. It has not been diff --git a/Ada95/ada_include/Makefile.in b/Ada95/ada_include/Makefile.in index 7cb92304..3bc6c06f 100644 --- a/Ada95/ada_include/Makefile.in +++ b/Ada95/ada_include/Makefile.in @@ -1,25 +1,35 @@ -#---------------------------------------------------------------------------- -# -- -# GNAT ncurses Binding -- -# src/Makefile -- -# -- -# Version 00.92 -- -# -- -# The ncurses Ada95 binding is copyrighted 1996 by -- -# Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- -# -- -# Permission is hereby granted to reproduce and distribute this -- -# binding by any means and for any fee, whether alone or as part -- -# of a larger distribution, in source or in binary form, PROVIDED -- -# this notice is included with any such distribution, and is not -- -# removed from any of its header files. Mention of ncurses and the -- -# author of this binding in any applications linked with it is -- -# highly appreciated. -- -# -- -# This binding comes AS IS with no warranty, implied or expressed. -- -#---------------------------------------------------------------------------- +############################################################################## +# Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +# # Version Control -# $Revision: 1.6 $ +# $Revision: 1.13 $ # .SUFFIXES: @@ -34,6 +44,7 @@ libdir = @libdir@ includedir = @includedir@ datadir = @datadir@ ticdir = $(datadir)/terminfo +ADA_INCLUDE = @ADA_INCLUDE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -61,52 +72,115 @@ LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ RANLIB = @RANLIB@ ################################################################################ -ADA = @nc_ada_compiler@ +ADA = @cf_ada_compiler@ ADAFLAGS = @ADAFLAGS@ -I. -I$(srcdir) -ADAMAKE = @nc_ada_make@ +ADAMAKE = @cf_ada_make@ ADAMAKEFLAGS = CARGS = -cargs $(ADAFLAGS) LARGS = -ALIB = @nc_ada_package@ +ALIB = @cf_ada_package@ ABASE = $(ALIB)-curses ADA_OBJDIR = ../ada_objects OBJDIR = ../objects -LIBALIS=$(ADA_OBJDIR)/$(ALIB).ali \ - $(ADA_OBJDIR)/$(ABASE)-aux.ali \ - $(ADA_OBJDIR)/$(ABASE).ali \ - $(ADA_OBJDIR)/$(ABASE)-mouse.ali \ - $(ADA_OBJDIR)/$(ABASE)-panels.ali \ - $(ADA_OBJDIR)/$(ABASE)-menus.ali \ - $(ADA_OBJDIR)/$(ABASE)-forms.ali \ - $(ADA_OBJDIR)/$(ABASE)-text_io.ali \ +LIBALIS=$(ADA_OBJDIR)/$(ALIB).ali \ + $(ADA_OBJDIR)/$(ABASE)-aux.ali \ + $(ADA_OBJDIR)/$(ABASE).ali \ + $(ADA_OBJDIR)/$(ABASE)-mouse.ali \ + $(ADA_OBJDIR)/$(ABASE)-panels.ali \ + $(ADA_OBJDIR)/$(ABASE)-menus.ali \ + $(ADA_OBJDIR)/$(ABASE)-forms.ali \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types.ali \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-alpha.ali \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-alphanumeric.ali \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-intfield.ali \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-numeric.ali \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-regexp.ali \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration.ali \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-ipv4_address.ali \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-user.ali \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-user-choice.ali \ + $(ADA_OBJDIR)/$(ABASE)-text_io.ali \ $(ADA_OBJDIR)/$(ABASE)-text_io-aux.ali -LIBOBJS=$(ADA_OBJDIR)/$(ALIB).o \ - $(ADA_OBJDIR)/$(ABASE)-aux.o \ - $(ADA_OBJDIR)/$(ABASE).o \ - $(ADA_OBJDIR)/$(ABASE)-mouse.o \ - $(ADA_OBJDIR)/$(ABASE)-panels.o \ - $(ADA_OBJDIR)/$(ABASE)-menus.o \ - $(ADA_OBJDIR)/$(ABASE)-forms.o \ - $(ADA_OBJDIR)/$(ABASE)-text_io.o \ +# Ada Library files for generic packages. Since gnat 3.10 they are +# also compiled +GENALIS=$(ADA_OBJDIR)/$(ABASE)-menus-menu_user_data.ali \ + $(ADA_OBJDIR)/$(ABASE)-menus-item_user_data.ali \ + $(ADA_OBJDIR)/$(ABASE)-forms-form_user_data.ali \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_user_data.ali \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration-ada.ali \ + $(ADA_OBJDIR)/$(ABASE)-panels-user_data.ali \ + $(ADA_OBJDIR)/$(ABASE)-text_io-integer_io.ali \ + $(ADA_OBJDIR)/$(ABASE)-text_io-float_io.ali \ + $(ADA_OBJDIR)/$(ABASE)-text_io-fixed_io.ali \ + $(ADA_OBJDIR)/$(ABASE)-text_io-decimal_io.ali \ + $(ADA_OBJDIR)/$(ABASE)-text_io-enumeration_io.ali \ + $(ADA_OBJDIR)/$(ABASE)-text_io-modular_io.ali \ + $(ADA_OBJDIR)/$(ABASE)-text_io-complex_io.ali + +LIBOBJS=$(ADA_OBJDIR)/$(ALIB).o \ + $(ADA_OBJDIR)/$(ABASE)-aux.o \ + $(ADA_OBJDIR)/$(ABASE).o \ + $(ADA_OBJDIR)/$(ABASE)-mouse.o \ + $(ADA_OBJDIR)/$(ABASE)-panels.o \ + $(ADA_OBJDIR)/$(ABASE)-menus.o \ + $(ADA_OBJDIR)/$(ABASE)-forms.o \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types.o \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-alpha.o \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-alphanumeric.o \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-intfield.o \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-numeric.o \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-regexp.o \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration.o \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-ipv4_address.o \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-user.o \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-user-choice.o \ + $(ADA_OBJDIR)/$(ABASE)-text_io.o \ $(ADA_OBJDIR)/$(ABASE)-text_io-aux.o - -all :: $(LIBALIS) +# Ada object files for generic packages. Since gnat 3.10 they are +# also compiled +GENOBJS=$(ADA_OBJDIR)/$(ABASE)-menus-menu_user_data.o \ + $(ADA_OBJDIR)/$(ABASE)-menus-item_user_data.o \ + $(ADA_OBJDIR)/$(ABASE)-forms-form_user_data.o \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_user_data.o \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration-ada.o \ + $(ADA_OBJDIR)/$(ABASE)-panels-user_data.o \ + $(ADA_OBJDIR)/$(ABASE)-text_io-integer_io.o \ + $(ADA_OBJDIR)/$(ABASE)-text_io-float_io.o \ + $(ADA_OBJDIR)/$(ABASE)-text_io-fixed_io.o \ + $(ADA_OBJDIR)/$(ABASE)-text_io-decimal_io.o \ + $(ADA_OBJDIR)/$(ABASE)-text_io-enumeration_io.o \ + $(ADA_OBJDIR)/$(ABASE)-text_io-modular_io.o \ + $(ADA_OBJDIR)/$(ABASE)-text_io-complex_io.o + + +all :: $(LIBALIS) @cf_compile_generics@ @echo done -clean :: +sources : + @ + +install :: +install.libs :: +uninstall :: +uninstall.libs :: + +generics: $(GENALIS) + @ + +mostlyclean :: rm -f *.o *.ali b_t*.* *.s $(PROGS) a.out core b_*_test.c *.xr[bs] *.a -mostlyclean :: clean +clean :: mostlyclean rm -f $(LIBALIS) $(LIBOBJS) -distclean :: mostlyclean +distclean :: clean rm -f Makefile realclean :: distclean @@ -184,6 +258,115 @@ $(ADA_OBJDIR)/$(ABASE)-forms.ali: $(ADA_OBJDIR)/$(ABASE)-forms.o rm -f $(ABASE)-forms.ali ;\ fi +$(ADA_OBJDIR)/$(ABASE)-forms-field_types.o: \ + $(ABASE)-forms-field_types.ads \ + $(srcdir)/$(ABASE)-forms-field_types.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types.adb + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types.o + if [ -f $(ABASE)-forms-field_types.ali ]; then \ + ln -f $(ABASE)-forms-field_types.ali $@ ;\ + rm -f $(ABASE)-forms-field_types.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-alpha.o: \ + $(srcdir)/$(ABASE)-forms-field_types-alpha.ads \ + $(srcdir)/$(ABASE)-forms-field_types-alpha.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-alpha.adb + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-alpha.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-alpha.o + if [ -f $(ABASE)-forms-field_types-alpha.ali ]; then \ + ln -f $(ABASE)-forms-field_types-alpha.ali $@ ;\ + rm -f $(ABASE)-forms-field_types-alpha.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-alphanumeric.o: \ + $(srcdir)/$(ABASE)-forms-field_types-alphanumeric.ads \ + $(srcdir)/$(ABASE)-forms-field_types-alphanumeric.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-alphanumeric.adb + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-alphanumeric.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-alphanumeric.o + if [ -f $(ABASE)-forms-field_types-alphanumeric.ali ]; then \ + ln -f $(ABASE)-forms-field_types-alphanumeric.ali $@ ;\ + rm -f $(ABASE)-forms-field_types-alphanumeric.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-intfield.o: \ + $(srcdir)/$(ABASE)-forms-field_types-intfield.ads \ + $(srcdir)/$(ABASE)-forms-field_types-intfield.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-intfield.adb + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-intfield.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-intfield.o + if [ -f $(ABASE)-forms-field_types-intfield.ali ]; then \ + ln -f $(ABASE)-forms-field_types-intfield.ali $@ ;\ + rm -f $(ABASE)-forms-field_types-intfield.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-numeric.o: \ + $(srcdir)/$(ABASE)-forms-field_types-numeric.ads \ + $(srcdir)/$(ABASE)-forms-field_types-numeric.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-numeric.adb + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-numeric.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-numeric.o + if [ -f $(ABASE)-forms-field_types-numeric.ali ]; then \ + ln -f $(ABASE)-forms-field_types-numeric.ali $@ ;\ + rm -f $(ABASE)-forms-field_types-numeric.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-regexp.o: \ + $(srcdir)/$(ABASE)-forms-field_types-regexp.ads \ + $(srcdir)/$(ABASE)-forms-field_types-regexp.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-regexp.adb + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-regexp.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-regexp.o + if [ -f $(ABASE)-forms-field_types-regexp.ali ]; then \ + ln -f $(ABASE)-forms-field_types-regexp.ali $@ ;\ + rm -f $(ABASE)-forms-field_types-regexp.ali ;\ + fi +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration.o: \ + $(srcdir)/$(ABASE)-forms-field_types-enumeration.ads \ + $(srcdir)/$(ABASE)-forms-field_types-enumeration.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-enumeration.adb + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration.o + if [ -f $(ABASE)-forms-field_types-enumeration.ali ]; then \ + ln -f $(ABASE)-forms-field_types-enumeration.ali $@ ;\ + rm -f $(ABASE)-forms-field_types-enumeration.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-ipv4_address.o: \ + $(srcdir)/$(ABASE)-forms-field_types-ipv4_address.ads \ + $(srcdir)/$(ABASE)-forms-field_types-ipv4_address.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-ipv4_address.adb + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-ipv4_address.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-ipv4_address.o + if [ -f $(ABASE)-forms-field_types-ipv4_address.ali ]; then \ + ln -f $(ABASE)-forms-field_types-ipv4_address.ali $@ ;\ + rm -f $(ABASE)-forms-field_types-ipv4_address.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-user.o: \ + $(srcdir)/$(ABASE)-forms-field_types-user.ads \ + $(srcdir)/$(ABASE)-forms-field_types-user.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-user.adb + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-user.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-user.o + if [ -f $(ABASE)-forms-field_types-user.ali ]; then \ + ln -f $(ABASE)-forms-field_types-user.ali $@ ;\ + rm -f $(ABASE)-forms-field_types-user.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-user-choice.o: \ + $(srcdir)/$(ABASE)-forms-field_types-user-choice.ads \ + $(srcdir)/$(ABASE)-forms-field_types-user-choice.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-user-choice.adb + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-user-choice.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-user-choice.o + if [ -f $(ABASE)-forms-field_types-user-choice.ali ]; then \ + ln -f $(ABASE)-forms-field_types-user-choice.ali $@ ;\ + rm -f $(ABASE)-forms-field_types-user-choice.ali ;\ + fi + $(ADA_OBJDIR)/$(ABASE)-text_io.o: \ $(srcdir)/$(ABASE)-text_io.ads \ $(srcdir)/$(ABASE)-text_io.adb $(BASEDEPS) @@ -205,3 +388,159 @@ $(ADA_OBJDIR)/$(ABASE)-text_io-aux.ali: $(ADA_OBJDIR)/$(ABASE)-text_io-aux.o ln -f $(ABASE)-text_io-aux.ali $@ ;\ rm -f $(ABASE)-text_io-aux.ali ;\ fi + +$(ADA_OBJDIR)/$(ABASE)-menus-menu_user_data.o: \ + $(ABASE)-menus-menu_user_data.ads \ + $(srcdir)/$(ABASE)-menus-menu_user_data.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-menus-menu_user_data.adb + +$(ADA_OBJDIR)/$(ABASE)-menus-menu_user_data.ali: \ + $(ADA_OBJDIR)/$(ABASE)-menus-menu_user_data.o + if [ -f $(ABASE)-menus-menu_user_data.ali ]; then \ + ln -f $(ABASE)-menus-menu_user_data.ali $@ ;\ + rm -f $(ABASE)-menus-menu_user_data.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-menus-item_user_data.o: \ + $(ABASE)-menus-item_user_data.ads \ + $(srcdir)/$(ABASE)-menus-item_user_data.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-menus-item_user_data.adb + +$(ADA_OBJDIR)/$(ABASE)-menus-item_user_data.ali: \ + $(ADA_OBJDIR)/$(ABASE)-menus-item_user_data.o + if [ -f $(ABASE)-menus-item_user_data.ali ]; then \ + ln -f $(ABASE)-menus-item_user_data.ali $@ ;\ + rm -f $(ABASE)-menus-item_user_data.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-forms-form_user_data.o: \ + $(ABASE)-forms-form_user_data.ads \ + $(srcdir)/$(ABASE)-forms-form_user_data.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-form_user_data.adb + +$(ADA_OBJDIR)/$(ABASE)-forms-form_user_data.ali: \ + $(ADA_OBJDIR)/$(ABASE)-forms-form_user_data.o + if [ -f $(ABASE)-forms-form_user_data.ali ]; then \ + ln -f $(ABASE)-forms-form_user_data.ali $@ ;\ + rm -f $(ABASE)-forms-form_user_data.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-forms-field_user_data.o: \ + $(ABASE)-forms-field_user_data.ads \ + $(srcdir)/$(ABASE)-forms-field_user_data.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_user_data.adb + +$(ADA_OBJDIR)/$(ABASE)-forms-field_user_data.ali: \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_user_data.o + if [ -f $(ABASE)-forms-field_user_data.ali ]; then \ + ln -f $(ABASE)-forms-field_user_data.ali $@ ;\ + rm -f $(ABASE)-forms-field_user_data.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration-ada.o: \ + $(srcdir)/$(ABASE)-forms-field_types-enumeration-ada.ads \ + $(srcdir)/$(ABASE)-forms-field_types-enumeration-ada.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-enumeration-ada.adb + +$(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration-ada.ali: \ + $(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration-ada.o + if [ -f $(ABASE)-forms-field_types-enumeration-ada.ali ]; then \ + ln -f $(ABASE)-forms-field_types-enumeration-ada.ali $@ ;\ + rm -f $(ABASE)-forms-field_types-enumeration-ada.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-panels-user_data.o: \ + $(ABASE)-panels-user_data.ads \ + $(srcdir)/$(ABASE)-panels-user_data.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-panels-user_data.adb + +$(ADA_OBJDIR)/$(ABASE)-panels-user_data.ali: \ + $(ADA_OBJDIR)/$(ABASE)-panels-user_data.o + if [ -f $(ABASE)-panels-user_data.ali ]; then \ + ln -f $(ABASE)-panels-user_data.ali $@ ;\ + rm -f $(ABASE)-panels-user_data.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-text_io-integer_io.o: \ + $(srcdir)/$(ABASE)-text_io-integer_io.ads \ + $(srcdir)/$(ABASE)-text_io-integer_io.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-text_io-integer_io.adb + +$(ADA_OBJDIR)/$(ABASE)-text_io-integer_io.ali: \ + $(ADA_OBJDIR)/$(ABASE)-text_io-integer_io.o + if [ -f $(ABASE)-text_io-integer_io.ali ]; then \ + ln -f $(ABASE)-text_io-integer_io.ali $@ ;\ + rm -f $(ABASE)-text_io-integer_io.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-text_io-float_io.o: \ + $(srcdir)/$(ABASE)-text_io-float_io.ads \ + $(srcdir)/$(ABASE)-text_io-float_io.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-text_io-float_io.adb + +$(ADA_OBJDIR)/$(ABASE)-text_io-float_io.ali: \ + $(ADA_OBJDIR)/$(ABASE)-text_io-float_io.o + if [ -f $(ABASE)-text_io-float_io.ali ]; then \ + ln -f $(ABASE)-text_io-float_io.ali $@ ;\ + rm -f $(ABASE)-text_io-float_io.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-text_io-fixed_io.o: \ + $(srcdir)/$(ABASE)-text_io-fixed_io.ads \ + $(srcdir)/$(ABASE)-text_io-fixed_io.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-text_io-fixed_io.adb + +$(ADA_OBJDIR)/$(ABASE)-text_io-fixed_io.ali: \ + $(ADA_OBJDIR)/$(ABASE)-text_io-fixed_io.o + if [ -f $(ABASE)-text_io-fixed_io.ali ]; then \ + ln -f $(ABASE)-text_io-fixed_io.ali $@ ;\ + rm -f $(ABASE)-text_io-fixed_io.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-text_io-decimal_io.o: \ + $(srcdir)/$(ABASE)-text_io-decimal_io.ads \ + $(srcdir)/$(ABASE)-text_io-decimal_io.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-text_io-decimal_io.adb + +$(ADA_OBJDIR)/$(ABASE)-text_io-decimal_io.ali: \ + $(ADA_OBJDIR)/$(ABASE)-text_io-decimal_io.o + if [ -f $(ABASE)-text_io-decimal_io.ali ]; then \ + ln -f $(ABASE)-text_io-decimal_io.ali $@ ;\ + rm -f $(ABASE)-text_io-decimal_io.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-text_io-enumeration_io.o: \ + $(srcdir)/$(ABASE)-text_io-enumeration_io.ads \ + $(srcdir)/$(ABASE)-text_io-enumeration_io.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-text_io-enumeration_io.adb + +$(ADA_OBJDIR)/$(ABASE)-text_io-enumeration_io.ali: \ + $(ADA_OBJDIR)/$(ABASE)-text_io-enumeration_io.o + if [ -f $(ABASE)-text_io-enumeration_io.ali ]; then \ + ln -f $(ABASE)-text_io-enumeration_io.ali $@ ;\ + rm -f $(ABASE)-text_io-enumeration_io.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-text_io-modular_io.o: \ + $(srcdir)/$(ABASE)-text_io-modular_io.ads \ + $(srcdir)/$(ABASE)-text_io-modular_io.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-text_io-modular_io.adb + +$(ADA_OBJDIR)/$(ABASE)-text_io-modular_io.ali: \ + $(ADA_OBJDIR)/$(ABASE)-text_io-modular_io.o + if [ -f $(ABASE)-text_io-modular_io.ali ]; then \ + ln -f $(ABASE)-text_io-modular_io.ali $@ ;\ + rm -f $(ABASE)-text_io-modular_io.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-text_io-complex_io.o: \ + $(srcdir)/$(ABASE)-text_io-complex_io.ads \ + $(srcdir)/$(ABASE)-text_io-complex_io.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-text_io-complex_io.adb + +$(ADA_OBJDIR)/$(ABASE)-text_io-complex_io.ali: \ + $(ADA_OBJDIR)/$(ABASE)-text_io-complex_io.o + if [ -f $(ABASE)-text_io-complex_io.ali ]; then \ + ln -f $(ABASE)-text_io-complex_io.ali $@ ;\ + rm -f $(ABASE)-text_io-complex_io.ali ;\ + fi diff --git a/Ada95/ada_include/terminal_interface-curses-aux.adb b/Ada95/ada_include/terminal_interface-curses-aux.adb index e6fac3b9..c6827a40 100644 --- a/Ada95/ada_include/terminal_interface-curses-aux.adb +++ b/Ada95/ada_include/terminal_interface-curses-aux.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.6 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ package body Terminal_Interface.Curses.Aux is -- @@ -56,6 +70,27 @@ package body Terminal_Interface.Curses.Aux is end Fill_String; + function Fill_String (Cp : chars_ptr) return String + is + Len : Natural; + begin + if Cp /= Null_Ptr then + Len := Natural (Strlen (Cp)); + if Len = 0 then + return ""; + else + declare + S : String (1 .. Len); + begin + Fill_String (Cp, S); + return S; + end; + end if; + else + return ""; + end if; + end Fill_String; + procedure Eti_Exception (Code : Eti_Error) is begin diff --git a/Ada95/ada_include/terminal_interface-curses-aux.ads b/Ada95/ada_include/terminal_interface-curses-aux.ads index 834ad7dc..1221b2e5 100644 --- a/Ada95/ada_include/terminal_interface-curses-aux.ads +++ b/Ada95/ada_include/terminal_interface-curses-aux.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.4 $ +-- $Revision: 1.8 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with System; with Interfaces.C; @@ -30,6 +44,7 @@ with Interfaces.C.Strings; use Interfaces.C.Strings; with Unchecked_Conversion; package Terminal_Interface.Curses.Aux is + pragma Preelaborate (Aux); use type Interfaces.C.Int; @@ -87,4 +102,7 @@ package Terminal_Interface.Curses.Aux is -- Fill the Str parameter with the string denoted by the chars_ptr -- C-Style string. + function Fill_String (Cp : chars_ptr) return String; + -- Same but as function. + end Terminal_Interface.Curses.Aux; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.adb b/Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.adb deleted file mode 100644 index 396287ec..00000000 --- a/Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.adb +++ /dev/null @@ -1,88 +0,0 @@ ------------------------------------------------------------------------------- --- -- --- GNAT ncurses Binding -- --- -- --- Terminal_Interface.Curses.Forms.Choice_Field_Types -- --- -- --- B O D Y -- --- -- --- Version 00.92 -- --- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- --- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- --- -- --- This binding comes AS IS with no warranty, implied or expressed. -- ------------------------------------------------------------------------------- --- Version Control: --- $Revision: 1.5 $ ------------------------------------------------------------------------------- -with Interfaces.C; -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -with Terminal_Interface.Curses.Forms.Field_Types; - --- | --- |===================================================================== --- | man page form_fieldtype.3x --- |===================================================================== --- | -package body Terminal_Interface.Curses.Forms.Choice_Field_Types is - - use type Interfaces.C.int; - - package Ft is new Terminal_Interface.Curses.Forms.Field_Types - (User, User_Access, Field_Check, Character_Check); - - type N_Check is access - function (Fld : Field; Info : User_Access) return Boolean; - pragma Convention (C, N_Check); - - type P_Check is access - function (Fld : Field; Info : User_Access) return Boolean; - pragma Convention (C, P_Check); - - function Nc (Fld : Field; Info : User_Access) return Boolean; - pragma Convention (C, Nc); - - function Pc (Fld : Field; Info : User_Access) return Boolean; - pragma Convention (C, Pc); - - function Nc (Fld : Field; Info : User_Access) return Boolean - is - begin - return Next_Choice (Fld, Info); - end Nc; - - function Pc (Fld : Field; Info : User_Access) return Boolean - is - begin - return Prev_Choice (Fld, Info); - end Pc; - -- | - -- | - -- | - function Set_Choice (Ft : C_Field_Type; - Nc : N_Check; - Pc : P_Check) return C_Int; - pragma Import (C, Set_Choice, "set_fieldtype_choice"); - - procedure Define_Choices - is - R : Eti_Error; - begin - R := Set_Choice (Search_Type (User'Tag), Nc'Access, Pc'Access); - if (R /= E_OK) then - Eti_Exception (R); - end if; - end Define_Choices; - -begin - Define_Choices; -end Terminal_Interface.Curses.Forms.Choice_Field_Types; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.ads b/Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.ads deleted file mode 100644 index 24a9375f..00000000 --- a/Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.ads +++ /dev/null @@ -1,46 +0,0 @@ ------------------------------------------------------------------------------- --- -- --- GNAT ncurses Binding -- --- -- --- Terminal_Interface.Curses.Forms.Choice_Field_Types -- --- -- --- S P E C -- --- -- --- Version 00.92 -- --- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- --- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- --- -- --- This binding comes AS IS with no warranty, implied or expressed. -- ------------------------------------------------------------------------------- --- Version Control: --- $Revision: 1.6 $ ------------------------------------------------------------------------------- --- You must instantiate this package for any user defined field type --- to make it visible to the runtime. --- -generic - type User is new Ada_Defined_Field_Type with private; - type User_Access is access User; - with function Field_Check (Fld : Field; - Info : User_Access) return Boolean; - with function Character_Check (Ch : Character; - Info : User_Access) return Boolean; - with function Next_Choice (Fld : Field; - Info : User_Access) return Boolean; - with function Prev_Choice (Fld : Field; - Info : User_Access) return Boolean; -package Terminal_Interface.Curses.Forms.Choice_Field_Types is --- --- Nothing public. --- But we need the body. - pragma Elaborate_Body; -end Terminal_Interface.Curses.Forms.Choice_Field_Types; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-alpha.adb b/Ada95/ada_include/terminal_interface-curses-forms-field_types-alpha.adb new file mode 100644 index 00000000..8c124159 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-alpha.adb @@ -0,0 +1,68 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.Alpha -- +-- -- +-- B O D Y -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.3 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; + +package body Terminal_Interface.Curses.Forms.Field_Types.Alpha is + + use type Interfaces.C.Int; + + 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"); + + 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; + begin + 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; + +end Terminal_Interface.Curses.Forms.Field_Types.Alpha; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-alpha.ads b/Ada95/ada_include/terminal_interface-curses-forms-field_types-alpha.ads new file mode 100644 index 00000000..e1ea0666 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-alpha.ads @@ -0,0 +1,53 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.Alpha -- +-- -- +-- S P E C -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.5 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +package Terminal_Interface.Curses.Forms.Field_Types.Alpha is + pragma Preelaborate (Alpha); + + type Alpha_Field is new Field_Type + with record + Minimum_Field_Width : Natural := 0; + end record; + + procedure Set_Field_Type (Fld : in Field; + Typ : in Alpha_Field); + pragma Inline (Set_Field_Type); + +end Terminal_Interface.Curses.Forms.Field_Types.Alpha; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-alphanumeric.adb b/Ada95/ada_include/terminal_interface-curses-forms-field_types-alphanumeric.adb new file mode 100644 index 00000000..6d7eb3ad --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-alphanumeric.adb @@ -0,0 +1,68 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric -- +-- -- +-- B O D Y -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.3 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; + +package body Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric is + + use type Interfaces.C.Int; + + 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"); + + 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; + begin + 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; + +end Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-alphanumeric.ads b/Ada95/ada_include/terminal_interface-curses-forms-field_types-alphanumeric.ads new file mode 100644 index 00000000..20ec1559 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-alphanumeric.ads @@ -0,0 +1,53 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric -- +-- -- +-- S P E C -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.5 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +package Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric is + pragma Preelaborate (AlphaNumeric); + + type AlphaNumeric_Field is new Field_Type + with record + Minimum_Field_Width : Natural := 0; + end record; + + procedure Set_Field_Type (Fld : in Field; + Typ : in AlphaNumeric_Field); + pragma Inline (Set_Field_Type); + +end Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration-ada.adb b/Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration-ada.adb new file mode 100644 index 00000000..7ddbac49 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration-ada.adb @@ -0,0 +1,80 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada -- +-- -- +-- B O D Y -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.3 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +with Ada.Characters.Handling; use Ada.Characters.Handling; + +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 + is + 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; + + for E in T'Range loop + I.Names (J) := new String'(T'Image (T (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)); + end if; + end if; + J := J + 1; + end loop; + + return Create (I, True); + end Create; + + function Value (Fld : Field; + Buf : Buffer_Number := Buffer_Number'First) return T + is + begin + return T'Value (Get_Buffer (Fld, Buf)); + end Value; + +end Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration-ada.ads b/Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration-ada.ads new file mode 100644 index 00000000..e867b9e3 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration-ada.ads @@ -0,0 +1,58 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada -- +-- -- +-- S P E C -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.4 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +generic + type T is (<>); + +package Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada is + pragma Preelaborate (Enumeration.Ada); + + 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; + -- 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; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration.adb b/Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration.adb new file mode 100644 index 00000000..6fa8daec --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration.adb @@ -0,0 +1,119 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration -- +-- -- +-- B O D Y -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.3 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +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; + +package body Terminal_Interface.Curses.Forms.Field_Types.Enumeration is + + function Create (Info : Enumeration_Info; + Auto_Release_Names : Boolean := False) + return Enumeration_Field + 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; + 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; + 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); + end if; + end loop; + E.Arr (L) := Null_Ptr; + return E; + end Create; + + procedure Release (Enum : in out Enumeration_Field) + is + 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; + end loop; + Enum.Arr := null; + end Release; + + 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"); + + 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; + begin + 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); + end if; + Wrap_Builtin (Fld, Typ, C_Choice_Router); + end Set_Field_Type; + +end Terminal_Interface.Curses.Forms.Field_Types.Enumeration; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration.ads b/Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration.ads new file mode 100644 index 00000000..55309b60 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration.ads @@ -0,0 +1,97 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration -- +-- -- +-- S P E C -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.5 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +with Interfaces.C.Strings; + +package Terminal_Interface.Curses.Forms.Field_Types.Enumeration is + pragma Preelaborate (Enumeration); + + 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 Enum_Array is array (Positive range <>) + of String_Access; + + type Enumeration_Info (C : Positive) is + 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; + + 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; + + 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); + pragma Inline (Set_Field_Type); + +private + type CPA_Access is access Interfaces.C.Strings.chars_ptr_array; + + type Enumeration_Field is new Field_Type with + record + Case_Sensitive : Boolean := False; + Match_Must_Be_Unique : Boolean := False; + Arr : CPA_Access := null; + end record; + +end Terminal_Interface.Curses.Forms.Field_Types.Enumeration; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-intfield.adb b/Ada95/ada_include/terminal_interface-curses-forms-field_types-intfield.adb new file mode 100644 index 00000000..e5742011 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-intfield.adb @@ -0,0 +1,72 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.IntField -- +-- -- +-- B O D Y -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.3 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; + +package body Terminal_Interface.Curses.Forms.Field_Types.IntField is + + use type Interfaces.C.Int; + + 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"); + + 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; + 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); + end if; + Wrap_Builtin (Fld, Typ); + end Set_Field_Type; + +end Terminal_Interface.Curses.Forms.Field_Types.IntField; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-intfield.ads b/Ada95/ada_include/terminal_interface-curses-forms-field_types-intfield.ads new file mode 100644 index 00000000..f7f8f2b4 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-intfield.ads @@ -0,0 +1,55 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.IntField -- +-- -- +-- S P E C -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.5 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +package Terminal_Interface.Curses.Forms.Field_Types.IntField is + pragma Preelaborate (IntField); + + type Integer_Field is new Field_Type with + record + Precision : Natural; + Lower_Limit : Integer; + Upper_Limit : Integer; + end record; + + procedure Set_Field_Type (Fld : in Field; + Typ : in Integer_Field); + pragma Inline (Set_Field_Type); + +end Terminal_Interface.Curses.Forms.Field_Types.IntField; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-ipv4_address.adb b/Ada95/ada_include/terminal_interface-curses-forms-field_types-ipv4_address.adb new file mode 100644 index 00000000..1cf79879 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-ipv4_address.adb @@ -0,0 +1,68 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address -- +-- -- +-- B O D Y -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.3 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; + +package body Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address is + + use type Interfaces.C.Int; + + 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"); + + 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; + begin + Res := Set_Fld_Type; + if Res /= E_Ok then + Eti_Exception (Res); + end if; + Wrap_Builtin (Fld, Typ); + end Set_Field_Type; + +end Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-ipv4_address.ads b/Ada95/ada_include/terminal_interface-curses-forms-field_types-ipv4_address.ads new file mode 100644 index 00000000..eb057f26 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-ipv4_address.ads @@ -0,0 +1,50 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address -- +-- -- +-- S P E C -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.5 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +package Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address is + pragma Preelaborate (IPV4_Address); + + 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); + pragma Inline (Set_Field_Type); + +end Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-numeric.adb b/Ada95/ada_include/terminal_interface-curses-forms-field_types-numeric.adb new file mode 100644 index 00000000..0a8ae72c --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-numeric.adb @@ -0,0 +1,74 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.Numeric -- +-- -- +-- B O D Y -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.3 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; + +package body Terminal_Interface.Curses.Forms.Field_Types.Numeric is + + use type Interfaces.C.Int; + + procedure Set_Field_Type (Fld : in Field; + Typ : in Numeric_Field) + is + type Double is new Interfaces.C.double; + + 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"); + + 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); + end if; + Wrap_Builtin (Fld, Typ); + end Set_Field_Type; + +end Terminal_Interface.Curses.Forms.Field_Types.Numeric; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-numeric.ads b/Ada95/ada_include/terminal_interface-curses-forms-field_types-numeric.ads new file mode 100644 index 00000000..28844622 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-numeric.ads @@ -0,0 +1,55 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.Numeric -- +-- -- +-- S P E C -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.5 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +package Terminal_Interface.Curses.Forms.Field_Types.Numeric is + pragma Preelaborate (Numeric); + + type Numeric_Field is new Field_Type with + record + Precision : Natural; + Lower_Limit : Float; + Upper_Limit : Float; + end record; + + procedure Set_Field_Type (Fld : in Field; + Typ : in Numeric_Field); + pragma Inline (Set_Field_Type); + +end Terminal_Interface.Curses.Forms.Field_Types.Numeric; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-regexp.adb b/Ada95/ada_include/terminal_interface-curses-forms-field_types-regexp.adb new file mode 100644 index 00000000..e8940035 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-regexp.adb @@ -0,0 +1,71 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.RegExp -- +-- -- +-- B O D Y -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.3 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +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 + + procedure Set_Field_Type (Fld : in Field; + Typ : in Regular_Expression_Field) + is + 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"); + + 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; + 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); + end if; + Wrap_Builtin (Fld, Typ); + end Set_Field_Type; + +end Terminal_Interface.Curses.Forms.Field_Types.RegExp; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-regexp.ads b/Ada95/ada_include/terminal_interface-curses-forms-field_types-regexp.ads new file mode 100644 index 00000000..20f7c5eb --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-regexp.ads @@ -0,0 +1,55 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.RegExp -- +-- -- +-- S P E C -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.5 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +package Terminal_Interface.Curses.Forms.Field_Types.RegExp is + pragma Preelaborate (RegExp); + + type String_Access is access String; + + type Regular_Expression_Field is new Field_Type with + record + Regular_Expression : String_Access; + end record; + + 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; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-user-choice.adb b/Ada95/ada_include/terminal_interface-curses-forms-field_types-user-choice.adb new file mode 100644 index 00000000..1606eb5d --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-user-choice.adb @@ -0,0 +1,109 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.User.Choice -- +-- -- +-- B O D Y -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.4 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +with Ada.Unchecked_Conversion; +with Interfaces.C; + +package body Terminal_Interface.Curses.Forms.Field_Types.User.Choice is + + use type Interfaces.C.Int; + + function To_Argument_Access is new Ada.Unchecked_Conversion + (System.Address, Argument_Access); + + 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); + begin + 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 + is + Result : Boolean; + Udf : 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; + + -- ----------------------------------------------------------------------- + -- + function C_Generic_Choice return C_Field_Type + is + 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; + else + 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); + end if; + end if; + M_Generic_Choice := T; + end if; + 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; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-user-choice.ads b/Ada95/ada_include/terminal_interface-curses-forms-field_types-user-choice.ads new file mode 100644 index 00000000..ced81fe8 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-user-choice.ads @@ -0,0 +1,93 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.User.Choice -- +-- -- +-- S P E C -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.4 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +with Ada.Unchecked_Deallocation; +with Terminal_Interface.Curses.Aux; + +package Terminal_Interface.Curses.Forms.Field_Types.User.Choice is + pragma Preelaborate (Choice); + + 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; + + 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 + is abstract; + -- If True is returned, the function successfully generated a previous + -- value into the fields buffer. + + -- +---------------------------------------------------------------------- + -- | Private Part. + -- | +private + use type Interfaces.C.Int; + + function C_Generic_Choice return C_Field_Type; + + 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); + -- 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; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-user.adb b/Ada95/ada_include/terminal_interface-curses-forms-field_types-user.adb new file mode 100644 index 00000000..e5ce433c --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-user.adb @@ -0,0 +1,131 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.User -- +-- -- +-- B O D Y -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.4 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +with Ada.Unchecked_Conversion; +with Interfaces.C; + +package body Terminal_Interface.Curses.Forms.Field_Types.User is + + use type Interfaces.C.Int; + + 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 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; + + function Allocate_Arg (T : User_Defined_Field_Type'Class) + return Argument_Access + is + Ptr : 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; + + begin + Res := Set_Fld_Type (Arg1 => Allocate_Arg (Typ)); + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Field_Type; + + 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 + is + Result : Boolean; + Udf : 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; + + 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); + begin + 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 + is + 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; + else + 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; + end if; + pragma Assert (M_Generic_Type /= Null_Field_Type); + return M_Generic_Type; + end C_Generic_Type; + +end Terminal_Interface.Curses.Forms.Field_Types.User; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types-user.ads b/Ada95/ada_include/terminal_interface-curses-forms-field_types-user.ads new file mode 100644 index 00000000..f06459b8 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types-user.ads @@ -0,0 +1,96 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types.User -- +-- -- +-- S P E C -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.4 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +with Ada.Unchecked_Deallocation; +with Terminal_Interface.Curses.Aux; + +package Terminal_Interface.Curses.Forms.Field_Types.User is + pragma Preelaborate (User); + + 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; + + 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 + 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); + -- This should work for all types derived from User_Defined_Field_Type. + -- No need to reimplement it for your derived type. + + -- +---------------------------------------------------------------------- + -- | Private Part. + -- | Used by the Choice child package. +private + use type Interfaces.C.Int; + + 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); + -- 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); + -- 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; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types.adb b/Ada95/ada_include/terminal_interface-curses-forms-field_types.adb index 13d2885f..60e1ff38 100644 --- a/Ada95/ada_include/terminal_interface-curses-forms-field_types.adb +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types.adb @@ -6,28 +6,44 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.4 $ +-- $Revision: 1.8 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Interfaces.C; with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -with Unchecked_Deallocation; - +with Ada.Unchecked_Deallocation; +with Ada.Unchecked_Conversion; +with Terminal_Interface.Curses.Forms.Field_Types.User; +with Terminal_Interface.Curses.Forms.Field_Types.User.Choice; -- | -- |===================================================================== -- | man page form_fieldtype.3x @@ -36,147 +52,238 @@ with Unchecked_Deallocation; package body Terminal_Interface.Curses.Forms.Field_Types is use type Interfaces.C.int; + use type System.Address; - type F_Check is access - function (Fld : Field; Info : User_Access) return C_Int; - pragma Convention (C, F_Check); - - type C_Check is access - function (Ch : Character; Info : User_Access) return C_Int; - pragma Convention (C, C_Check); + function To_Argument_Access is new Ada.Unchecked_Conversion + (System.Address, Argument_Access); - procedure Free is new - Unchecked_Deallocation (User, User_Access); + function Get_Fieldtype (F : Field) return C_Field_Type; + pragma Import (C, Get_Fieldtype, "field_type"); - -- Forward decls. - procedure Register_Field_Type; - procedure Unregister_Field_Type; - - procedure Initialize (Obj : in out Tracker) + function Get_Arg (F : Field) return System.Address; + pragma Import (C, Get_Arg, "field_arg"); + -- | + -- |===================================================================== + -- | man page form_field_validation.3x + -- |===================================================================== + -- | + -- | + -- | + function Get_Type (Fld : in Field) return Field_Type_Access is + Low_Level : constant C_Field_Type := Get_Fieldtype (Fld); + Arg : Argument_Access; begin - Register_Field_Type; - end Initialize; + 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; + else + return Arg.Typ; + end if; + else + raise Form_Exception; + end if; + end if; + end Get_Type; - procedure Finalize (Obj : in out Tracker) + function Make_Arg (Args : System.Address) return System.Address is + function Getarg (Arg : System.Address := Args) + return System.Address; + pragma Import (C, Getarg, "_nc_ada_getvarg"); begin - Unregister_Field_Type; - end Finalize; - - function Fc (Fld : Field; Info : User_Access) return C_Int; - pragma Convention (C, Fc); - - function Cc (Ch : Character; Info : User_Access) return C_Int; - pragma Convention (C, Cc); + return Getarg; + end Make_Arg; - function Make_Arg (U : User_Access) return User_Access; - pragma Convention (C, Make_Arg); + function Copy_Arg (Usr : System.Address) return System.Address + is + begin + return Usr; + end Copy_Arg; - function Copy_Arg (U : User_Access) return User_Access; - pragma Convention (C, Copy_Arg); + 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_Arg (U : User_Access); - pragma Convention (C, Free_Arg); + 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); + end if; + end if; + if To_Be_Free.Typ /= null then + Free_Type (To_Be_Free.Typ); + end if; + Freeargs (To_Be_Free); + end if; + end Free_Arg; - function New_Fieldtype (Fc : F_Check; - Cc : C_Check) return C_Field_Type; - pragma Import (C, New_Fieldtype, "new_fieldtype"); - function Fc (Fld : Field; Info : User_Access) return C_Int + 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"); + begin - return C_Int (Boolean'Pos (Field_Check (Fld, Info))); - end Fc; + 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); + else + Arg.Usr := Usr_Arg; + end if; + end if; - function Cc (Ch : Character; Info : User_Access) return C_Int + Res := Set_Fld_Type (Arg1 => Arg); + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end if; + end Wrap_Builtin; + + function Field_Check_Router (Fld : Field; + Usr : System.Address) return C_Int is + Arg : constant Argument_Access := To_Argument_Access (Usr); begin - return C_Int (Boolean'Pos (Character_Check (Ch, Info))); - end Cc; + 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; - function Make_Arg (U : User_Access) return User_Access + function Char_Check_Router (Ch : C_Int; + Usr : System.Address) return C_Int is - function Fixme (U : User_Access) return User_Access; - pragma Import (C, Fixme, "_nc_ada_getvarg"); - V : constant User_Access := Fixme (U); - I : constant User_Access := new User'(V.all); + Arg : constant Argument_Access := To_Argument_Access (Usr); begin - return I; - end Make_Arg; + 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; - function Copy_Arg (U : User_Access) return User_Access + function Next_Router (Fld : Field; + Usr : System.Address) return C_Int is - I : constant User_Access := new User'(U.all); + Arg : constant Argument_Access := To_Argument_Access (Usr); begin - return I; - end Copy_Arg; + 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; - procedure Free_Arg (U : User_Access) + function Prev_Router (Fld : Field; + Usr : System.Address) return C_Int is + Arg : constant Argument_Access := To_Argument_Access (Usr); begin - null; - end Free_Arg; - - type M_Arg is access function (U : User_Access) return User_Access; - pragma Convention (C, M_Arg); - - type C_Arg is access function (U : User_Access) return User_Access; - pragma Convention (C, C_Arg); - - type F_Arg is access procedure (U : User_Access); - pragma Convention (C, F_Arg); - - function Set_Fieldtype_Arg (Typ : C_Field_Type; - Ma : M_Arg; - Ca : C_Arg; - Fa : F_Arg) return C_Int; - pragma Import (C, Set_Fieldtype_Arg, "set_fieldtype_arg"); - -- | - -- | - -- | + 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; - procedure Register_Field_Type + -- ----------------------------------------------------------------------- + -- + function C_Builtin_Router return C_Field_Type is Res : Eti_Error; - Cft : C_Field_Type; - P : User_Access := new User; - -- we need an instance to call - -- the Register_Type procedure + T : C_Field_Type; begin - Cft := New_Fieldtype (Fc'Access, - Cc'Access); - if Cft = Null_Field_Type then - raise Form_Exception; - end if; - Res := Set_Fieldtype_Arg (Cft, - Make_Arg'Access, - Copy_Arg'Access, - Free_Arg'Access); - if Res /= E_Ok then - Eti_Exception (Res); + 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); + end if; + end if; + M_Builtin_Router := T; end if; + pragma Assert (M_Builtin_Router /= Null_Field_Type); + return M_Builtin_Router; + end C_Builtin_Router; - Register_Type (P.all, Cft); - Free (P); - end Register_Field_Type; - -- | - -- | - -- | - procedure Unregister_Field_Type + -- ----------------------------------------------------------------------- + -- + function C_Choice_Router return C_Field_Type is - P : User_Access := new User; - -- we need an instance to call - -- the Unregister_Type procedure + Res : Eti_Error; + T : C_Field_Type; begin - Unregister_Type (P.all); - Free (P); - end Unregister_Field_Type; - - Hook : Tracker; -end Terminal_Interface.Curses.Forms.Field_Types; - - - + 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); + end if; + 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; + end if; + pragma Assert (M_Choice_Router /= Null_Field_Type); + return M_Choice_Router; + end C_Choice_Router; +end Terminal_Interface.Curses.Forms.Field_Types; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types.ads b/Ada95/ada_include/terminal_interface-curses-forms-field_types.ads deleted file mode 100644 index 70589948..00000000 --- a/Ada95/ada_include/terminal_interface-curses-forms-field_types.ads +++ /dev/null @@ -1,50 +0,0 @@ ------------------------------------------------------------------------------- --- -- --- GNAT ncurses Binding -- --- -- --- Terminal_Interface.Curses.Forms.Field_Types -- --- -- --- S P E C -- --- -- --- Version 00.92 -- --- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- --- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- --- -- --- This binding comes AS IS with no warranty, implied or expressed. -- ------------------------------------------------------------------------------- --- Version Control: --- $Revision: 1.3 $ ------------------------------------------------------------------------------- -with Ada.Finalization; use Ada.Finalization; - --- You must instantiate this package for any user defined field type --- to make it visible to the runtime. --- -generic - type User is new Ada_Defined_Field_Type with private; - type User_Access is access User; - with function Field_Check (Fld : Field; - Info : User_Access) return Boolean; - with function Character_Check (Ch : Character; - Info : User_Access) return Boolean; -package Terminal_Interface.Curses.Forms.Field_Types is --- --- Nothing public. All happens magically. --- -private - type Tracker is new Limited_Controlled with null record; - - procedure Initialize (Obj : in out Tracker); - procedure Finalize (Obj : in out Tracker); - -end Terminal_Interface.Curses.Forms.Field_Types; - diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_user_data.adb b/Ada95/ada_include/terminal_interface-curses-forms-field_user_data.adb index dd8aba56..a5729d40 100644 --- a/Ada95/ada_include/terminal_interface-curses-forms-field_user_data.adb +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_user_data.adb @@ -6,27 +6,39 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ -with Unchecked_Conversion; -with Terminal_Interface.Curses.Aux; -use Terminal_Interface.Curses.Aux; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -- | -- |===================================================================== @@ -34,48 +46,40 @@ use Terminal_Interface.Curses.Aux; -- |===================================================================== -- | package body Terminal_Interface.Curses.Forms.Field_User_Data is - - function To_Address is new Unchecked_Conversion (User_Access, - System.Address); - function To_Pointer is new Unchecked_Conversion (System.Address, - User_Access); -- | -- | -- | + use type Interfaces.C.Int; + procedure Set_User_Data (Fld : in Field; Data : in User_Access) is - A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); - B : Field_User_Wrapper_Access; - R : C_Int; + 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); begin - if A = null then - raise Form_Exception; - else - if A.N > 1 then - B := new Field_User_Wrapper'(T => A.T, - N => 1, - U => To_Address (Data)); - R := Set_Field_Userptr (Fld, B); - A.N := A.N - 1; - else - A.U := To_Address (Data); - end if; + if Res /= E_Ok then + Eti_Exception (Res); end if; end Set_User_Data; -- | -- | -- | + 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"); + begin + return Field_Userptr (Fld); + end Get_User_Data; + procedure Get_User_Data (Fld : in Field; Data : out User_Access) is - A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); begin - if A = null then - raise Form_Exception; - else - Data := To_Pointer (A.U); - end if; + Data := Get_User_Data (Fld); end Get_User_Data; - + end Terminal_Interface.Curses.Forms.Field_User_Data; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-form_user_data.adb b/Ada95/ada_include/terminal_interface-curses-forms-form_user_data.adb index 9022a044..4c6f34cc 100644 --- a/Ada95/ada_include/terminal_interface-curses-forms-form_user_data.adb +++ b/Ada95/ada_include/terminal_interface-curses-forms-form_user_data.adb @@ -6,63 +6,81 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ -with Unchecked_Conversion; -- | -- |===================================================================== -- | man page form__userptr.3x -- |===================================================================== -- | +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; + package body Terminal_Interface.Curses.Forms.Form_User_Data is - - function To_Address is new Unchecked_Conversion (User_Access, - System.Address); - function To_Pointer is new Unchecked_Conversion (System.Address, - User_Access); + + use type Interfaces.C.Int; + -- | -- | -- | procedure Set_User_Data (Frm : in Form; Data : in User_Access) is - A : constant Form_User_Wrapper_Access := Form_Userptr (Frm); + 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); begin - if A = null then - raise Form_Exception; - else - A.U := To_Address (Data); + if Res /= E_Ok then + Eti_Exception (Res); end if; end Set_User_Data; -- | -- | -- | + 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"); + begin + return Form_Userptr (Frm); + end Get_User_Data; + procedure Get_User_Data (Frm : in Form; Data : out User_Access) is - A : constant Form_User_Wrapper_Access := Form_Userptr (Frm); begin - if A = null then - raise Form_Exception; - else - Data := To_Pointer (A.U); - end if; + Data := Get_User_Data (Frm); end Get_User_Data; - + end Terminal_Interface.Curses.Forms.Form_User_Data; diff --git a/Ada95/ada_include/terminal_interface-curses-forms.adb b/Ada95/ada_include/terminal_interface-curses-forms.adb index 059ae238..fbb43b7f 100644 --- a/Ada95/ada_include/terminal_interface-curses-forms.adb +++ b/Ada95/ada_include/terminal_interface-curses-forms.adb @@ -6,25 +6,38 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.9 $ +-- $Revision: 1.13 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ -with Ada.Tags; use Ada.Tags; with Ada.Unchecked_Deallocation; with Unchecked_Conversion; @@ -32,7 +45,6 @@ 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 GNAT.Htable; package body Terminal_Interface.Curses.Forms is @@ -66,34 +78,15 @@ package body Terminal_Interface.Curses.Forms is begin Fill_String (Form_Request_Name (C_Int (Key)), Name); end Request_Name; ------------------------------------------------------------------------------- - procedure Free_Field_User_Wrapper is - new Ada.Unchecked_Deallocation (Field_User_Wrapper, - Field_User_Wrapper_Access); - - procedure Release_User_Wrapper (A : in out Field_User_Wrapper_Access); - procedure Dup_User_Wrapper (A : in out Field_User_Wrapper_Access); - - procedure Release_User_Wrapper (A : in out Field_User_Wrapper_Access) - is - begin - A.N := A.N - 1; - if A.N = 0 then - Free_Field_User_Wrapper (A); - end if; - end Release_User_Wrapper; - pragma Inline (Release_User_Wrapper); - procedure Dup_User_Wrapper (A : in out Field_User_Wrapper_Access) + 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"); begin - A.N := A.N + 1; - end Dup_User_Wrapper; - pragma Inline (Dup_User_Wrapper); + return Fill_String (Form_Request_Name (C_Int (Key))); + end Request_Name; ------------------------------------------------------------------------------ - procedure Free_Form_User_Wrapper is - new Ada.Unchecked_Deallocation (Form_User_Wrapper, - Form_User_Wrapper_Access); -- | -- | -- | @@ -118,21 +111,9 @@ package body Terminal_Interface.Curses.Forms is C_Int (Top), C_Int (Left), C_Int (Off_Screen), C_Int (More_Buffers)); - - A : Field_User_Wrapper_Access; - Res : Eti_Error; begin if Fld = Null_Field then raise Form_Exception; - else - A := new Field_User_Wrapper'(U => System.Null_Address, - T => null, - N => 1); - Res := Set_Field_Userptr (Fld, A); - if Res /= E_Ok then - Free_Field_User_Wrapper (A); - Eti_Exception (Res); - end if; end if; return Fld; end Create; @@ -143,19 +124,9 @@ package body Terminal_Interface.Curses.Forms is is function Free_Field (Fld : Field) return C_Int; pragma Import (C, Free_Field, "free_field"); - procedure Free_Field_Type is - new Ada.Unchecked_Deallocation (Field_Type'Class, - Field_Type_Access); - A : Field_User_Wrapper_Access := Field_Userptr (Fld); Res : Eti_Error; begin - if A /= null then - if A.T /= null then - Free_Field_Type (A.T); - end if; - Release_User_Wrapper (A); - end if; Res := Free_Field (Fld); if Res /= E_Ok then Eti_Exception (Res); @@ -174,15 +145,12 @@ package body Terminal_Interface.Curses.Forms is Left : C_Int) return Field; pragma Import (C, Dup_Field, "dup_field"); - A : Field_User_Wrapper_Access := Field_Userptr (Fld); F : constant Field := Dup_Field (Fld, C_Int (Top), C_Int (Left)); begin if F = Null_Field then raise Form_Exception; - else - Dup_User_Wrapper (A); end if; return F; end Duplicate; @@ -198,15 +166,12 @@ package body Terminal_Interface.Curses.Forms is Left : C_Int) return Field; pragma Import (C, Lnk_Field, "link_field"); - A : Field_User_Wrapper_Access := Field_Userptr (Fld); F : constant Field := Lnk_Field (Fld, C_Int (Top), C_Int (Left)); begin if F = Null_Field then raise Form_Exception; - else - Dup_User_Wrapper (A); end if; return F; end Link; @@ -285,6 +250,17 @@ package body Terminal_Interface.Curses.Forms is begin 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 + is + 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; -- | -- | -- | @@ -747,57 +723,39 @@ package body Terminal_Interface.Curses.Forms is -- | -- | -- | - procedure Free_Allocated_Fields is - new Ada.Unchecked_Deallocation (Field_Array, Field_Array_Access); - -- | - -- | - -- | - -- This is a bit delicate if we want to manipulate an Ada created form - -- from C routines or vice versa. - -- In Ada created forms we use the low level user pointer to maintain - -- binding internal additional informations about the form. This - -- internal information contains a hook for the Ada provided user pointer. - -- Unless you understand this implementation, the safest way in mixed - -- language programs to deal with user pointers is, that only the language - -- that created the form should also manipulate the user pointer for that - -- form. procedure Redefine (Frm : in Form; - Flds : in Field_Array) + Flds : in Field_Array_Access) is function Set_Frm_Fields (Frm : Form; - Items : Field_Array) return C_Int; + Items : System.Address) return C_Int; pragma Import (C, Set_Frm_Fields, "set_form_fields"); - A : constant Form_User_Wrapper_Access := Form_Userptr (Frm); - I : Field_Array_Access; Res : Eti_Error; begin - if A = null or else A.I = null then raise Form_Exception; + pragma Assert (Flds (Flds'Last) = Null_Field); + if Flds (Flds'Last) /= Null_Field then + raise Form_Exception; else - I := new Field_Array (1 .. (Flds'Length + 1)); - I.all (1 .. Flds'Length) := Flds (Flds'First .. Flds'Last); - I.all (Flds'Length + 1) := Null_Field; - Res := Set_Frm_Fields (Frm, I.all); + Res := Set_Frm_Fields (Frm, Flds (Flds'First)'Address); if Res /= E_Ok then - Free_Allocated_Fields (I); Eti_Exception (Res); - else - Free_Allocated_Fields (A.I); - A.I := I; end if; end if; end Redefine; -- | -- | -- | - function Fields (Frm : Form) return Field_Array_Access + function Fields (Frm : Form; + Index : Positive) return Field is - A : constant Form_User_Wrapper_Access := Form_Userptr (Frm); + function F_Fields (Frm : Form; + Idx : C_Int) return Field; + pragma Import (C, F_Fields, "_nc_get_field"); begin - if A = null or else A.I = null then + if Frm = Null_Form or else Index not in 1 .. Field_Count (Frm) then raise Form_Exception; else - return A.I; + return F_Fields (Frm, C_Int (Index) - 1); end if; end Fields; -- | @@ -833,32 +791,23 @@ package body Terminal_Interface.Curses.Forms is -- | -- | -- | - function Create (Fields : Field_Array) return Form + function Create (Fields : Field_Array_Access) return Form is - function NewForm (Fields : Field_Array) return Form; + function NewForm (Fields : System.Address) return Form; pragma Import (C, NewForm, "new_form"); M : Form; - I : Field_Array_Access; - U : Form_User_Wrapper_Access; - Res : Eti_Error; begin - I := new Field_Array (1 .. (Fields'Length + 1)); - I.all (1 .. Fields'Length) := Fields (Fields'First .. Fields'Last); - I.all (Fields'Length + 1) := Null_Field; - M := NewForm (I.all); - if M = Null_Form then - Free_Allocated_Fields (I); + 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; + end if; + return M; end if; - U := new Form_User_Wrapper'(U => System.Null_Address, I => I); - Res := Set_Form_Userptr (M, U); - if Res /= E_Ok then - Free_Allocated_Fields (I); - Free_Form_User_Wrapper (U); - Eti_Exception (Res); - end if; - return M; end Create; -- | -- | @@ -868,17 +817,11 @@ package body Terminal_Interface.Curses.Forms is function Free (Frm : Form) return C_Int; pragma Import (C, Free, "free_form"); - U : Form_User_Wrapper_Access := Form_Userptr (Frm); Res : constant Eti_Error := Free (Frm); begin if Res /= E_Ok then Eti_Exception (Res); end if; - if U = null or else U.I = null then - raise Form_Exception; - end if; - Free_Allocated_Fields (U.I); - Free_Form_User_Wrapper (U); Frm := Null_Form; end Delete; -- | @@ -1183,511 +1126,34 @@ package body Terminal_Interface.Curses.Forms is end if; end Is_New_Page; ------------------------------------------------------------------------------- - -- We use a GNAT internal hash table mechanism to create an association - -- between an Ada_Defined_Field_Type and it's low level C_Field_Type - -- peer. - -- It shouldn´t be too complicated to reimplent this hashing mechanism - -- for other compilers. - -- - type Tag_Type_Pair; - type Tag_Pair_Access is access all Tag_Type_Pair; - pragma Controlled (Tag_Pair_Access); - - Null_Tag_Pair : constant Tag_Pair_Access := Tag_Pair_Access'(null); - - type Tag_Type_Pair is - record - Ada_Tag : Tag; - Cft : C_Field_Type; - Next : Tag_Pair_Access; - end record; - - type Htable_Headers is range 1 .. 31; - procedure Free_Tag_Type_Pair is - new Ada.Unchecked_Deallocation (Tag_Type_Pair, Tag_Pair_Access); - - procedure Set_Pair_Link (T : Tag_Pair_Access; Next : Tag_Pair_Access); - function Get_Pair_Link (T : Tag_Pair_Access) return Tag_Pair_Access; - function Get_Pair_Tag (T : Tag_Pair_Access) return Tag; - - function Hash (T : Tag) return Htable_Headers; - function Equal (A, B : Tag) return Boolean; - - package External_Pair_Htable is new GNAT.Htable.Static_Htable - (Header_Num => Htable_Headers, - Element => Tag_Type_Pair, - Elmt_Ptr => Tag_Pair_Access, - Null_Ptr => Null_Tag_Pair, - Set_Next => Set_Pair_Link, - Next => Get_Pair_Link, - Key => Tag, - Get_Key => Get_Pair_Tag, - Hash => Hash, - Equal => Equal); - - procedure Set_Pair_Link (T : Tag_Pair_Access; Next : Tag_Pair_Access) - is - begin - T.all.Next := Next; - end Set_Pair_Link; - - function Get_Pair_Link (T : Tag_Pair_Access) return Tag_Pair_Access - is - begin - return T.all.Next; - end Get_Pair_Link; - - function Get_Pair_Tag (T : Tag_Pair_Access) return Tag - is - begin - return T.all.Ada_Tag; - end Get_Pair_Tag; - - function Equal (A, B : Tag) return Boolean - is - begin - return A = B; - end Equal; - - function Hash (T : Tag) return Htable_Headers + procedure Free (FA : in out Field_Array_Access; + Free_Fields : in Boolean := False) is - function H is new GNAT.Htable.Hash (Htable_Headers); + procedure Release is new Ada.Unchecked_Deallocation + (Field_Array, Field_Array_Access); begin - return H (External_Tag (T)); - end Hash; - - function Search_Type (T : Ada_Defined_Field_Type'Class) - return C_Field_Type - is - P : Tag_Pair_Access := External_Pair_Htable.Get (T'Tag); - begin - if P /= null then - return P.Cft; - else - return Null_Field_Type; - end if; - end Search_Type; - - -- Register an Ada_Defined_Field_Type given by its Tag - -- with it's associated C_Field_Type. - procedure Register_Type (T : in Ada_Defined_Field_Type'Class; - Cft : in C_Field_Type) - is - C : C_Field_Type := Search_Type (T); - P : Tag_Pair_Access; - begin - if C /= Null_Field_Type then - raise Form_Exception; - else - P := new Tag_Type_Pair'(T'Tag, Cft, null); - External_Pair_Htable.Set (P); + 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; - end Register_Type; - - -- Unregister an Ada_Defined_Field_Type given by it's tag - procedure Unregister_Type (T : in Ada_Defined_Field_Type'Class) - is - function Free_Fieldtype (Ft : C_Field_Type) return C_Int; - pragma Import (C, Free_Fieldtype, "free_fieldtype"); - - P : Tag_Pair_Access := External_Pair_Htable.Get (T'Tag); - Ft : C_Field_Type; - Res : C_Int; - begin - if P = null then - raise Form_Exception; - else - Ft := P.Cft; - External_Pair_Htable.Remove (T'Tag); - Free_Tag_Type_Pair (P); - Res := Free_Fieldtype (Ft); - if Res /= E_Ok then - Eti_Exception (Res); - end if; - end if; - end Unregister_Type; - ----------------------------------------------------------------------------- - -- | - -- | - -- | - procedure Set_Type (Fld : Field; - Fld_Type : Ada_Defined_Field_Type) - is - function Set_Fld_Type (F : Field := Fld; - Ct : C_Field_Type; - Arg1 : Ada_Defined_Field_Type'Class) - return C_Int; - pragma Import (C, Set_Fld_Type, "set_field_type"); - function Field_Userptr (Fld : Field) - return Field_User_Wrapper_Access; - pragma Import (C, Field_Userptr, "field_userptr"); - - Res : Eti_Error; - C : constant C_Field_Type := Search_Type (Fld_Type); - begin - if C = Null_Field_Type then - raise Form_Exception; - else - Res := Set_Fld_Type (Fld, C, Fld_Type); - if Res /= E_Ok then - Eti_Exception (Res); - end if; - end if; - end Set_Type; - -- | - -- | - -- | - function Native_Type (Ftype : Ada_Defined_Field_Type) - return C_Field_Type - is - C : constant C_Field_Type := Search_Type (Ftype); - begin - if C = Null_Field_Type then - raise Form_Exception; - else - return C; - end if; - end Native_Type; - -- | - -- | - -- | - function Native_Type (Ftype : Alpha_Field) - return C_Field_Type - is - C_Alpha_Field_Type : C_Field_Type; - pragma Import (C, C_Alpha_Field_Type, "TYPE_ALPHA"); - begin - return C_Alpha_Field_Type; - end Native_Type; - pragma Inline (Native_Type); - -- | - -- | - -- | - procedure Set_Type (Fld : in Field; - Fld_Type : in Alpha_Field) - is - function Set_Fld_Type (F : Field := Fld; - Cft : C_Field_Type := Native_Type (Fld_Type); - Arg1 : C_Int) return C_Int; - pragma Import (C, Set_Fld_Type, "set_field_type"); - function Field_Userptr (Fld : Field) - return Field_User_Wrapper_Access; - pragma Import (C, Field_Userptr, "field_userptr"); - - A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); - Res : Eti_Error; - begin - Res := Set_Fld_Type (Arg1 => C_Int (Fld_Type.Minimum_Field_Width)); - if Res /= E_Ok then - Eti_Exception (Res); - else - A.T := new Alpha_Field'(Fld_Type); - end if; - end Set_Type; - -- | - -- | - -- | - function Native_Type (Ftype : Alpha_Numeric_Field) - return C_Field_Type - is - C_Alpha_Numeric_Field_Type : C_Field_Type; - pragma Import (C, C_Alpha_Numeric_Field_Type, "TYPE_ALNUM"); - begin - return C_Alpha_Numeric_Field_Type; - end Native_Type; - pragma Inline (Native_Type); - -- | - -- | - -- | - procedure Set_Type (Fld : in Field; - Fld_Type : in Alpha_Numeric_Field) - is - function Set_Fld_Type (F : Field := Fld; - Cft : C_Field_Type := Native_Type (Fld_Type); - Arg1 : C_Int) return C_Int; - pragma Import (C, Set_Fld_Type, "set_field_type"); - function Field_Userptr (Fld : Field) - return Field_User_Wrapper_Access; - pragma Import (C, Field_Userptr, "field_userptr"); - - A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); - Res : Eti_Error; - begin - Res := Set_Fld_Type (Arg1 => C_Int (Fld_Type.Minimum_Field_Width)); - if Res /= E_Ok then - Eti_Exception (Res); - else - A.T := new Alpha_Numeric_Field'(Fld_Type); - end if; - end Set_Type; - -- | - -- | - -- | - function Native_Type (Ftype : Integer_Field) - return C_Field_Type - is - C_Integer_Field_Type : C_Field_Type; - pragma Import (C, C_Integer_Field_Type, "TYPE_INTEGER"); - begin - return C_Integer_Field_Type; - end Native_Type; - pragma Inline (Native_Type); - -- | - -- | - -- | - procedure Set_Type (Fld : in Field; - Fld_Type : in Integer_Field) - is - function Set_Fld_Type (F : Field := Fld; - Cft : C_Field_Type := Native_Type (Fld_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 Field_Userptr (Fld : Field) - return Field_User_Wrapper_Access; - pragma Import (C, Field_Userptr, "field_userptr"); - - A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); - Res : Eti_Error; - begin - Res := Set_Fld_Type (Arg1 => C_Int (Fld_Type.Precision), - Arg2 => C_Long_Int (Fld_Type.Lower_Limit), - Arg3 => C_Long_Int (Fld_Type.Upper_Limit)); - if Res /= E_Ok then - Eti_Exception (Res); - else - A.T := new Integer_Field'(Fld_Type); - end if; - end Set_Type; - -- | - -- | - -- | - function Native_Type (Ftype : Numeric_Field) - return C_Field_Type - is - C_Numeric_Field_Type : C_Field_Type; - pragma Import (C, C_Numeric_Field_Type, "TYPE_NUMERIC"); - begin - return C_Numeric_Field_Type; - end Native_Type; - pragma Inline (Native_Type); - -- | - -- | - -- | - procedure Set_Type (Fld : in Field; - Fld_Type : in Numeric_Field) - is - type Double is new Interfaces.C.double; - - function Set_Fld_Type (F : Field := Fld; - Cft : C_Field_Type := Native_Type (Fld_Type); - Arg1 : Double; - Arg2 : Double; - Arg3 : Double) return C_Int; - pragma Import (C, Set_Fld_Type, "set_field_type"); - function Field_Userptr (Fld : Field) - return Field_User_Wrapper_Access; - pragma Import (C, Field_Userptr, "field_userptr"); - - A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); - Res : Eti_Error; - begin - Res := Set_Fld_Type (Arg1 => Double (Fld_Type.Precision), - Arg2 => Double (Fld_Type.Lower_Limit), - Arg3 => Double (Fld_Type.Upper_Limit)); - if Res /= E_Ok then - Eti_Exception (Res); - else - A.T := new Numeric_Field'(Fld_Type); - end if; - end Set_Type; - -- | - -- | - -- | - function Native_Type (Ftype : Regular_Expression_Field) - return C_Field_Type - is - C_Regexp_Field_Type : C_Field_Type; - pragma Import (C, C_Regexp_Field_Type, "TYPE_REGEXP"); - begin - return C_Regexp_Field_Type; - end Native_Type; - pragma Inline (Native_Type); - -- | - -- | - -- | - procedure Set_Type (Fld : in Field; - Fld_Type : in Regular_Expression_Field) - is - type Char_Ptr is access all Interfaces.C.Char; - function Set_Fld_Type (F : Field := Fld; - Cft : C_Field_Type := Native_Type (Fld_Type); - Arg1 : Char_Ptr) return C_Int; - pragma Import (C, Set_Fld_Type, "set_field_type"); - function Field_Userptr (Fld : Field) - return Field_User_Wrapper_Access; - pragma Import (C, Field_Userptr, "field_userptr"); - - A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); - Txt : char_array (0 .. Fld_Type.Regular_Expression.all'Length); - Len : size_t; - Res : Eti_Error; - begin - To_C (Fld_Type.Regular_Expression.all, Txt, Len); - Res := Set_Fld_Type (Arg1 => Txt (Txt'First)'Access); - if Res /= E_Ok then - Eti_Exception (Res); - else - A.T := new Regular_Expression_Field'(Fld_Type); - end if; - end Set_Type; - -- | - -- | - -- | - function Native_Type (Ftype : Enumeration_Field) - return C_Field_Type - is - C_Enum_Type : C_Field_Type; - pragma Import (C, C_Enum_Type, "TYPE_ENUM"); - begin - return C_Enum_Type; - end Native_Type; - pragma Inline (Native_Type); - -- | - -- | - -- | - function Create (Info : Enumeration_Info; - Auto_Release_Names : Boolean := False) - return Enumeration_Field - 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; - 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; - 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); - end if; - end loop; - E.Arr (L) := Null_Ptr; - return E; - end Create; - - procedure Release (Enum : in out Enumeration_Field) - is - 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; - end loop; - Enum.Arr := null; - end Release; - - procedure Set_Type (Fld : in Field; - Fld_Type : in Enumeration_Field) - is - function Set_Fld_Type (F : Field := Fld; - Cft : C_Field_Type := Native_Type (Fld_Type); - Arg1 : chars_ptr_array; - Arg2 : C_Int; -- case - Arg3 : C_Int) return C_Int; - pragma Import (C, Set_Fld_Type, "set_field_type"); - function Field_Userptr (Fld : Field) - return Field_User_Wrapper_Access; - pragma Import (C, Field_Userptr, "field_userptr"); - - A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); - Res : Eti_Error; - begin - if Fld_Type.Arr = null then - raise Form_Exception; - end if; - Res := Set_Fld_Type (Arg1 => Fld_Type.Arr.all, - Arg2 => C_Int (Boolean'Pos - (Fld_Type.Case_Sensitive)), - Arg3 => - C_Int (Boolean'Pos - (Fld_Type.Match_Must_Be_Unique))); - if Res /= E_Ok then - Eti_Exception (Res); - else - A.T := new Enumeration_Field'(Fld_Type); - end if; - end Set_Type; + Release (FA); + end Free; + -- |===================================================================== - function Native_Type (Ftype : Internet_V4_Address_Field) - return C_Field_Type + function Default_Field_Options return Field_Option_Set is - C_IPV4_Field_Type : C_Field_Type; - pragma Import (C, C_IPV4_Field_Type, "TYPE_IPV4"); begin - return C_IPV4_Field_Type; - end Native_Type; - pragma Inline (Native_Type); - -- | - -- | - -- | - procedure Set_Type (Fld : in Field; - Fld_Type : in Internet_V4_Address_Field) - is - function Set_Fld_Type (F : Field := Fld; - Cft : C_Field_Type := Native_Type (Fld_Type)) - return C_Int; - pragma Import (C, Set_Fld_Type, "set_field_type"); - function Field_Userptr (Fld : Field) - return Field_User_Wrapper_Access; - pragma Import (C, Field_Userptr, "field_userptr"); - - A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); - Res : Eti_Error; - begin - Res := Set_Fld_Type; - if Res /= E_Ok then - Eti_Exception (Res); - else - A.T := new Internet_V4_Address_Field'(Fld_Type); - end if; - end Set_Type; + return Get_Options (Null_Field); + end Default_Field_Options; - -- | - -- |===================================================================== - -- | man page form_field_validation.3x - -- |===================================================================== - -- | - -- | - -- | - function Get_Type (Fld : in Field) return Field_Type_Access + function Default_Form_Options return Form_Option_Set is - A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); begin - if A = null then - return null; - else - return A.T; - end if; - end Get_Type; + return Get_Options (Null_Form); + end Default_Form_Options; -begin - Default_Field_Options := Get_Options (Null_Field); - Default_Form_Options := Get_Options (Null_Form); end Terminal_Interface.Curses.Forms; diff --git a/Ada95/ada_include/terminal_interface-curses-menus-item_user_data.adb b/Ada95/ada_include/terminal_interface-curses-menus-item_user_data.adb index 9e56187d..858e1d25 100644 --- a/Ada95/ada_include/terminal_interface-curses-menus-item_user_data.adb +++ b/Ada95/ada_include/terminal_interface-curses-menus-item_user_data.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Interfaces.C; with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; @@ -45,13 +59,19 @@ package body Terminal_Interface.Curses.Menus.Item_User_Data is end if; end Set_User_Data; - procedure Get_User_Data (Itm : in Item; - Data : out 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"); begin - Data := Item_Userptr (Itm); + return Item_Userptr (Itm); + end Get_User_Data; + + procedure Get_User_Data (Itm : in Item; + Data : out User_Access) + is + begin + Data := Get_User_Data (Itm); end Get_User_Data; end Terminal_Interface.Curses.Menus.Item_User_Data; diff --git a/Ada95/ada_include/terminal_interface-curses-menus-menu_user_data.adb b/Ada95/ada_include/terminal_interface-curses-menus-menu_user_data.adb index 98dc039d..25a4c941 100644 --- a/Ada95/ada_include/terminal_interface-curses-menus-menu_user_data.adb +++ b/Ada95/ada_include/terminal_interface-curses-menus-menu_user_data.adb @@ -6,62 +6,71 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ -with Unchecked_Conversion; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; package body Terminal_Interface.Curses.Menus.Menu_User_Data is - function To_Address is new - Unchecked_Conversion (User_Access, - System.Address); - function To_Pointer is new - Unchecked_Conversion (System.Address, - User_Access); + use type Interfaces.C.Int; procedure Set_User_Data (Men : in Menu; Data : in User_Access) is - function Menu_Userptr (Men : Menu) return Ada_User_Wrapper_Access; - pragma Import (C, Menu_Userptr, "menu_userptr"); + function Set_Menu_Userptr (Men : Menu; + Data : User_Access) return C_Int; + pragma Import (C, Set_Menu_Userptr, "set_menu_userptr"); - U : Ada_User_Wrapper_Access := Menu_Userptr (Men); + Res : constant Eti_Error := Set_Menu_Userptr (Men, Data); begin - if U = null or else U.I = null then - raise Menu_Exception; + if Res /= E_Ok then + Eti_Exception (Res); end if; - U.U := To_Address (Data); end Set_User_Data; - procedure Get_User_Data (Men : in Menu; - Data : out User_Access) + function Get_User_Data (Men : in Menu) return User_Access is - function Menu_Userptr (Men : Menu) return Ada_User_Wrapper_Access; + function Menu_Userptr (Men : Menu) return User_Access; pragma Import (C, Menu_Userptr, "menu_userptr"); + begin + return Menu_Userptr (Men); + end Get_User_Data; - U : Ada_User_Wrapper_Access := Menu_Userptr (Men); + procedure Get_User_Data (Men : in Menu; + Data : out User_Access) + is begin - if U = null then - raise Menu_Exception; - else - Data := To_Pointer (U.U); - end if; + Data := Get_User_Data (Men); end Get_User_Data; end Terminal_Interface.Curses.Menus.Menu_User_Data; diff --git a/Ada95/ada_include/terminal_interface-curses-menus.adb b/Ada95/ada_include/terminal_interface-curses-menus.adb index 33f06603..2df514ec 100644 --- a/Ada95/ada_include/terminal_interface-curses-menus.adb +++ b/Ada95/ada_include/terminal_interface-curses-menus.adb @@ -6,31 +6,45 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.7 $ +-- $Revision: 1.13 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ +with Ada.Unchecked_Deallocation; with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; with Interfaces.C; use Interfaces.C; -with Interfaces.C.Strings; +with Interfaces.C.Strings; use Interfaces.C.Strings; with Terminal_Interface.Curses; -with Ada.Unchecked_Deallocation; with Unchecked_Conversion; package body Terminal_Interface.Curses.Menus is @@ -54,17 +68,9 @@ package body Terminal_Interface.Curses.Menus is Unchecked_Conversion (C_Int, Item_Option_Set); ------------------------------------------------------------------------------- - procedure Free_Allocated_Items is - new Ada.Unchecked_Deallocation (Item_Array, Item_Array_Access); - - procedure Free_User_Wrapper is - new Ada.Unchecked_Deallocation (Ada_User_Wrapper, - Ada_User_Wrapper_Access); - ------------------------------------------------------------------------------ procedure Request_Name (Key : in Menu_Request_Code; - Name : out String) + Name : out String) is function Request_Name (Key : C_Int) return chars_ptr; pragma Import (C, Request_Name, "menu_request_name"); @@ -72,13 +78,14 @@ package body Terminal_Interface.Curses.Menus is Fill_String (Request_Name (C_Int (Key)), Name); end Request_Name; - -- !!! W A R N I N G !!! - -- If you want to port this binding to a non ncurses version of the - -- ETI, this must be rewritten. In ncurses the menu items and - -- descriptions may be automatic variables, because ncurses copies - -- the parameters into private allocated internal structures. - -- Other implementations don't do that usually, so depending on - -- scopes you may see unexpected results. + 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"); + begin + return Fill_String (Request_Name (C_Int (Key))); + end Request_Name; + function Create (Name : String; Description : String := "") return Item is @@ -86,15 +93,23 @@ package body Terminal_Interface.Curses.Menus is function Newitem (Name, Desc : Char_Ptr) return Item; pragma Import (C, Newitem, "new_item"); - Name_Str : char_array (0 .. Name'Length); - Desc_Str : char_array (0 .. Description'Length); + 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); + + Name_Str : Name_String_Ptr := new Name_String; + Desc_Str : Desc_String_Ptr := new Desc_String; Name_Len, Desc_Len : size_t; Result : Item; begin - To_C (Name, Name_Str, Name_Len); - To_C (Description, Desc_Str, Desc_Len); - Result := Newitem (Name_Str (Name_Str'First)'Access, - Desc_Str (Desc_Str'First)'Access); + 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; @@ -103,11 +118,26 @@ package body Terminal_Interface.Curses.Menus is 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 Freeitem (Itm : Item) return C_Int; pragma Import (C, Freeitem, "free_item"); - Res : constant Eti_Error := Freeitem (Itm); + Res : Eti_Error; + Ptr : chars_ptr; begin + 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); + end if; + Res := Freeitem (Itm); if Res /= E_Ok then Eti_Exception (Res); end if; @@ -227,6 +257,14 @@ package body Terminal_Interface.Curses.Menus is Fill_String (Itemname (Itm), Name); end Name; + function Name (Itm : in Item) return String + is + function Itemname (Itm : Item) return chars_ptr; + pragma Import (C, Itemname, "item_name"); + begin + return Fill_String (Itemname (Itm)); + end Name; + procedure Description (Itm : in Item; Description : out String) is @@ -235,6 +273,14 @@ package body Terminal_Interface.Curses.Menus is begin Fill_String (Descname (Itm), Description); end Description; + + function Description (Itm : in Item) return String + is + function Descname (Itm : Item) return chars_ptr; + pragma Import (C, Descname, "item_description"); + begin + return Fill_String (Descname (Itm)); + end Description; ------------------------------------------------------------------------------- procedure Set_Current (Men : in Menu; Itm : in Item) @@ -496,6 +542,14 @@ package body Terminal_Interface.Curses.Menus is Fill_String (Get_Menu_Mark (Men), Mark); end Mark; + function Mark (Men : Menu) return String + is + 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; + ------------------------------------------------------------------------------- procedure Set_Foreground (Men : in Menu; @@ -706,7 +760,7 @@ package body Terminal_Interface.Curses.Menus is end Set_Pattern; procedure Pattern (Men : in Menu; - Text : out String) + Text : out String) is function Get_Pattern (Men : Menu) return chars_ptr; pragma Import (C, Get_Pattern, "menu_pattern"); @@ -840,43 +894,22 @@ package body Terminal_Interface.Curses.Menus is return Menu_Term (Men); end Get_Menu_Term_Hook; ------------------------------------------------------------------------------- - -- This is a bit delicate if we want to manipulate an Ada created menu - -- from C routines or vice versa. - -- In Ada created menus we use the low level user pointer to maintain - -- binding internal additional informations about the menu. This - -- internal information contains a hook for the Ada provided user pointer. - -- Unless you understand this implementation, the safest way in mixed - -- language programs to deal with user pointers is, that only the language - -- that created the menu should also manipulate the user pointer for that - -- menu. procedure Redefine (Men : in Menu; - Items : in Item_Array) + Items : in Item_Array_Access) is function Set_Items (Men : Menu; - Items : Item_Array_Access) return C_Int; + Items : System.Address) return C_Int; pragma Import (C, Set_Items, "set_menu_items"); - function Menu_Userptr (Men : Menu) return Ada_User_Wrapper_Access; - pragma Import (C, Menu_Userptr, "menu_userptr"); - - U : Ada_User_Wrapper_Access := Menu_Userptr (Men); - I : Item_Array_Access; Res : Eti_Error; begin - if U = null or else U.I = null then raise Menu_Exception; + pragma Assert (Items (Items'Last) = Null_Item); + if Items (Items'Last) /= Null_Item then + raise Menu_Exception; else - -- create internally an array of items that contains an - -- additional place for the terminating null item. - I := new Item_Array (1 .. (Items'Length + 1)); - I.all (1 .. Items'Length) := Items (Items'First .. Items'Last); - I.all (Items'Length + 1) := Null_Item; - Res := Set_Items (Men, I); + Res := Set_Items (Men, Items (Items'First)'Address); if Res /= E_Ok then - Free_Allocated_Items (I); Eti_Exception (Res); - else - Free_Allocated_Items (U.I); - U.I := I; end if; end if; end Redefine; @@ -889,65 +922,51 @@ package body Terminal_Interface.Curses.Menus is return Natural (Count (Men)); end Item_Count; - function Items (Men : Menu) return Item_Array_Access + function Items (Men : Menu; + Index : Positive) return Item is - function M_Items (Men : Menu) return Item_Array_Access; - pragma Import (C, M_Items, "menu_items"); + function M_Items (Men : Menu; + Idx : C_Int) return Item; + pragma Import (C, M_Items, "_nc_get_item"); begin - return M_Items (Men); + if Men = Null_Menu or else Index not in 1 .. Item_Count (Men) then + raise Menu_Exception; + else + return M_Items (Men, C_Int (Index) - 1); + end if; end Items; ------------------------------------------------------------------------------- - function Create (Items : Item_Array) return Menu + function Create (Items : Item_Array_Access) return Menu is - function Newmenu (Items : Item_Array_Access) return Menu; + function Newmenu (Items : System.Address) return Menu; pragma Import (C, Newmenu, "new_menu"); - function Set_Menu_Userptr (Men : Menu; - Addr : Ada_User_Wrapper_Access) return C_Int; - pragma Import (C, Set_Menu_Userptr, "set_menu_userptr"); - M : Menu; I : Item_Array_Access; - U : Ada_User_Wrapper_Access; - Res : Eti_Error; begin - I := new Item_Array (1 .. (Items'Length + 1)); - I.all (1 .. Items'Length) := Items (Items'First .. Items'Last); - I.all (Items'Length + 1) := Null_Item; - M := Newmenu (I); - if M = Null_Menu then - Free_Allocated_Items (I); + pragma Assert (Items (Items'Last) = Null_Item); + if Items (Items'Last) /= Null_Item then raise Menu_Exception; + else + M := Newmenu (Items (Items'First)'Address); + if M = Null_Menu then + raise Menu_Exception; + end if; + return M; end if; - U := new Ada_User_Wrapper' (System.Null_Address, I); - Res := Set_Menu_Userptr (M, U); - if Res /= E_Ok then - Free_Allocated_Items (I); - Free_User_Wrapper (U); - Eti_Exception (Res); - end if; - return M; end Create; procedure Delete (Men : in out Menu) is function Free (Men : Menu) return C_Int; pragma Import (C, Free, "free_menu"); - function Menu_Userptr (Men : Menu) return Ada_User_Wrapper_Access; - pragma Import (C, Menu_Userptr, "menu_userptr"); - U : Ada_User_Wrapper_Access := Menu_Userptr (Men); Res : constant Eti_Error := Free (Men); begin if Res /= E_Ok then Eti_Exception (Res); end if; - if U = null or else U.I = null then - raise Menu_Exception; - end if; - Free_Allocated_Items (U.I); - Free_User_Wrapper (U); Men := Null_Menu; end Delete; @@ -973,12 +992,35 @@ package body Terminal_Interface.Curses.Menus is end if; return Menu_Ok; end Driver; + + 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); + 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)); + end if; + end loop; + end if; + Release (IA); + end Free; + +------------------------------------------------------------------------------- + function Default_Menu_Options return Menu_Option_Set + is + begin + return Get_Options (Null_Menu); + end Default_Menu_Options; + + function Default_Item_Options return Item_Option_Set + is + begin + return Get_Options (Null_Item); + end Default_Item_Options; ------------------------------------------------------------------------------- -begin - if Generation_Bit_Order /= System.Default_Bit_Order then - raise Constraint_Error; - end if; - Default_Menu_Options := Get_Options (Null_Menu); - Default_Item_Options := Get_Options (Null_Item); end Terminal_Interface.Curses.Menus; diff --git a/Ada95/ada_include/terminal_interface-curses-mouse.adb b/Ada95/ada_include/terminal_interface-curses-mouse.adb index 67aa6495..bef31643 100644 --- a/Ada95/ada_include/terminal_interface-curses-mouse.adb +++ b/Ada95/ada_include/terminal_interface-curses-mouse.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.9 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with System; @@ -44,6 +58,18 @@ package body Terminal_Interface.Curses.Mouse is Unchecked_Conversion (Source => Event_Mask, Target => C_Int); + function Has_Mouse return Boolean + is + 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 + return True; + else + return False; + end if; + end Has_Mouse; + function Get_Mouse return Mouse_Event is type Event_Access is access all Mouse_Event; @@ -93,6 +119,13 @@ package body Terminal_Interface.Curses.Mouse is return CInt_To_Mask (R); end Start_Mouse; + procedure End_Mouse + is + Old : constant Event_Mask := Start_Mouse (No_Events); + begin + null; + end End_Mouse; + procedure Get_Event (Event : in Mouse_Event; Y : out Line_Position; X : out Column_Position; @@ -145,8 +178,4 @@ package body Terminal_Interface.Curses.Mouse is return Natural (Mouseinterval (C_Int (Msec))); end Mouse_Interval; -begin - if Generation_Bit_Order /= System.Default_Bit_Order then - raise Constraint_Error; - end if; end Terminal_Interface.Curses.Mouse; diff --git a/Ada95/ada_include/terminal_interface-curses-panels-user_data.adb b/Ada95/ada_include/terminal_interface-curses-panels-user_data.adb index 5d1c7e94..287511a6 100644 --- a/Ada95/ada_include/terminal_interface-curses-panels-user_data.adb +++ b/Ada95/ada_include/terminal_interface-curses-panels-user_data.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Interfaces.C; with Terminal_Interface.Curses.Aux; @@ -46,13 +60,19 @@ package body Terminal_Interface.Curses.Panels.User_Data is end if; end Set_User_Data; - procedure Get_User_Data (Pan : in Panel; - Data : out 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"); begin - Data := Panel_Userptr (Pan); + return Panel_Userptr (Pan); + end Get_User_Data; + + procedure Get_User_Data (Pan : in Panel; + Data : out User_Access) + is + begin + Data := Get_User_Data (Pan); end Get_User_Data; end Terminal_Interface.Curses.Panels.User_Data; diff --git a/Ada95/ada_include/terminal_interface-curses-panels.adb b/Ada95/ada_include/terminal_interface-curses-panels.adb index 74f7c1bd..335668d4 100644 --- a/Ada95/ada_include/terminal_interface-curses-panels.adb +++ b/Ada95/ada_include/terminal_interface-curses-panels.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.6 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; with Interfaces.C; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-aux.adb b/Ada95/ada_include/terminal_interface-curses-text_io-aux.adb index 8be84489..abc3cab3 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io-aux.adb +++ b/Ada95/ada_include/terminal_interface-curses-text_io-aux.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.4 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ package body Terminal_Interface.Curses.Text_IO.Aux is diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-aux.ads b/Ada95/ada_include/terminal_interface-curses-text_io-aux.ads index 1582e6b0..4fad19c6 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io-aux.ads +++ b/Ada95/ada_include/terminal_interface-curses-text_io-aux.ads @@ -6,25 +6,40 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.4 $ +-- $Revision: 1.8 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ 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. diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-complex_io.adb b/Ada95/ada_include/terminal_interface-curses-text_io-complex_io.adb index a71ca20c..60cbecb4 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io-complex_io.adb +++ b/Ada95/ada_include/terminal_interface-curses-text_io-complex_io.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.6 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses.Text_IO.Float_IO; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-complex_io.ads b/Ada95/ada_include/terminal_interface-curses-text_io-complex_io.ads index dd895e97..74759845 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io-complex_io.ads +++ b/Ada95/ada_include/terminal_interface-curses-text_io-complex_io.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.6 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Ada.Numerics.Generic_Complex_Types; @@ -36,7 +50,7 @@ package Terminal_Interface.Curses.Text_IO.Complex_IO is Default_Fore : Field := 2; Default_Aft : Field := Real'Digits - 1; Default_Exp : Field := 3; - + procedure Put (Win : in Window; Item : in Complex; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-decimal_io.adb b/Ada95/ada_include/terminal_interface-curses-text_io-decimal_io.adb index 40596004..fef58a39 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io-decimal_io.adb +++ b/Ada95/ada_include/terminal_interface-curses-text_io-decimal_io.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.6 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Ada.Text_IO; with Terminal_Interface.Curses.Text_IO.Aux; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-decimal_io.ads b/Ada95/ada_include/terminal_interface-curses-text_io-decimal_io.ads index d1e92453..0d567047 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io-decimal_io.ads +++ b/Ada95/ada_include/terminal_interface-curses-text_io-decimal_io.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.4 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ generic type Num is delta <> digits <>; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-enumeration_io.adb b/Ada95/ada_include/terminal_interface-curses-text_io-enumeration_io.adb index 633c1d87..1d30946b 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io-enumeration_io.adb +++ b/Ada95/ada_include/terminal_interface-curses-text_io-enumeration_io.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.6 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Ada.Text_IO; with Ada.Characters.Handling; use Ada.Characters.Handling; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-enumeration_io.ads b/Ada95/ada_include/terminal_interface-curses-text_io-enumeration_io.ads index d715517c..08d72a8d 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io-enumeration_io.ads +++ b/Ada95/ada_include/terminal_interface-curses-text_io-enumeration_io.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.4 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ generic type Enum is (<>); diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-fixed_io.adb b/Ada95/ada_include/terminal_interface-curses-text_io-fixed_io.adb index 76703f34..e7d45af5 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io-fixed_io.adb +++ b/Ada95/ada_include/terminal_interface-curses-text_io-fixed_io.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.6 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Ada.Text_IO; with Terminal_Interface.Curses.Text_IO.Aux; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-fixed_io.ads b/Ada95/ada_include/terminal_interface-curses-text_io-fixed_io.ads index f3c12647..9a6faa74 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io-fixed_io.ads +++ b/Ada95/ada_include/terminal_interface-curses-text_io-fixed_io.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.4 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ generic type Num is delta <>; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-float_io.adb b/Ada95/ada_include/terminal_interface-curses-text_io-float_io.adb index a6403743..f6255897 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io-float_io.adb +++ b/Ada95/ada_include/terminal_interface-curses-text_io-float_io.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.6 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Ada.Text_IO; with Terminal_Interface.Curses.Text_IO.Aux; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-float_io.ads b/Ada95/ada_include/terminal_interface-curses-text_io-float_io.ads index 670407a5..f0070db1 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io-float_io.ads +++ b/Ada95/ada_include/terminal_interface-curses-text_io-float_io.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.4 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ generic type Num is digits <>; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-integer_io.adb b/Ada95/ada_include/terminal_interface-curses-text_io-integer_io.adb index 6f4ab6ee..8fe2fa03 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io-integer_io.adb +++ b/Ada95/ada_include/terminal_interface-curses-text_io-integer_io.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.6 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Ada.Text_IO; with Terminal_Interface.Curses.Text_IO.Aux; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-integer_io.ads b/Ada95/ada_include/terminal_interface-curses-text_io-integer_io.ads index 69e9661f..e21ac143 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io-integer_io.ads +++ b/Ada95/ada_include/terminal_interface-curses-text_io-integer_io.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.4 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ generic type Num is range <>; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-modular_io.adb b/Ada95/ada_include/terminal_interface-curses-text_io-modular_io.adb index d4399c4b..3125390e 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io-modular_io.adb +++ b/Ada95/ada_include/terminal_interface-curses-text_io-modular_io.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.6 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Ada.Text_IO; with Terminal_Interface.Curses.Text_IO.Aux; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-modular_io.ads b/Ada95/ada_include/terminal_interface-curses-text_io-modular_io.ads index 1f0b3467..32a687b4 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io-modular_io.ads +++ b/Ada95/ada_include/terminal_interface-curses-text_io-modular_io.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.4 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ generic type Num is mod <>; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io.adb b/Ada95/ada_include/terminal_interface-curses-text_io.adb index 794d6830..f362e40b 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io.adb +++ b/Ada95/ada_include/terminal_interface-curses-text_io.adb @@ -6,29 +6,43 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.4 $ +-- $Revision: 1.8 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with System; package body Terminal_Interface.Curses.Text_IO is - Default_Window : Window; + Default_Window : Window := Null_Window; procedure Set_Window (Win : in Window) is @@ -321,7 +335,4 @@ package body Terminal_Interface.Curses.Text_IO is Put_Line (Get_Window, Item); end Put_Line; -begin - Default_Window := Null_Window; - end Terminal_Interface.Curses.Text_IO; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io.ads b/Ada95/ada_include/terminal_interface-curses-text_io.ads index 7b057aaf..e80f33fb 100644 --- a/Ada95/ada_include/terminal_interface-curses-text_io.ads +++ b/Ada95/ada_include/terminal_interface-curses-text_io.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.5 $ +-- $Revision: 1.8 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with System; with System.Parameters; diff --git a/Ada95/ada_include/terminal_interface-curses.adb b/Ada95/ada_include/terminal_interface-curses.adb index f5d2478b..b5ce9ef2 100644 --- a/Ada95/ada_include/terminal_interface-curses.adb +++ b/Ada95/ada_include/terminal_interface-curses.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.7 $ +-- $Revision: 1.15 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with System; @@ -30,20 +44,21 @@ 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.Characters.Handling; use Ada.Characters.Handling; +with Ada.Strings.Fixed; with Unchecked_Conversion; package body Terminal_Interface.Curses is use type System.Bit_Order; + package ASF renames Ada.Strings.Fixed; + type chtype_array is array (size_t range <>) of aliased Attributed_Character; - pragma Pack (chtype_array); pragma Convention (C, chtype_array); ------------------------------------------------------------------------------ - procedure Key_Name (Key : in Real_Key_Code; - Name : out 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"); @@ -53,31 +68,49 @@ package body Terminal_Interface.Curses is if Key <= Character'Pos (Character'Last) then Ch := Character'Val (Key); if Is_Control (Ch) then - Un_Control (Attributed_Character'(Ch => Ch, - Color => Color_Pair'First, - Attr => Normal_Video), - Name); + return Un_Control (Attributed_Character'(Ch => Ch, + Color => Color_Pair'First, + Attr => Normal_Video)); elsif Is_Graphic (Ch) then - Fill_String (Null_Ptr, Name); - Name (Name'First) := Ch; + declare + S : String (1 .. 1); + begin + S (1) := Ch; + return S; + end; else - Fill_String (Null_Ptr, Name); + return ""; end if; else - Fill_String (Keyname (C_Int (Key)), Name); + return Fill_String (Keyname (C_Int (Key))); end if; end Key_Name; + + procedure Key_Name (Key : in Real_Key_Code; + Name : out String) + is + begin + ASF.Move (Key_Name (Key), Name); + end Key_Name; + ------------------------------------------------------------------------------ procedure Init_Screen is function Initscr return Window; pragma Import (C, Initscr, "initscr"); + function Check_Version (Major, Minor : C_Int) return C_Int; + pragma Import (C, Check_Version, "_nc_ada_vcheck"); + W : Window; begin - W := Initscr; - if W = Null_Window then - raise Curses_Exception; + if (Check_Version (NC_Major_Version, NC_Minor_Version) = 0) then + raise Wrong_Curses_Version; + else + W := Initscr; + if W = Null_Window then + raise Curses_Exception; + end if; end if; end Init_Screen; @@ -349,14 +382,14 @@ package body Terminal_Interface.Curses is type Char_Ptr is access all Interfaces.C.Char; function Waddnstr (Win : Window; Str : Char_Ptr; - Len : Integer := -1) return C_Int; + Len : C_Int := -1) return C_Int; pragma Import (C, Waddnstr, "waddnstr"); Txt : char_array (0 .. Str'Length); Length : size_t; begin To_C (Str, Txt, Length); - if Waddnstr (Win, Txt (Txt'First)'Access, Len) = Curses_Err then + if Waddnstr (Win, Txt (Txt'First)'Access, C_Int (Len)) = Curses_Err then raise Curses_Exception; end if; end Add; @@ -381,7 +414,7 @@ package body Terminal_Interface.Curses is type Chtype_Ptr is access all Attributed_Character; function Waddchnstr (Win : Window; Str : Chtype_Ptr; - Len : Integer := -1) return C_Int; + Len : C_Int := -1) return C_Int; pragma Import (C, Waddchnstr, "waddchnstr"); Txt : chtype_array (0 .. Str'Length); @@ -390,7 +423,9 @@ package body Terminal_Interface.Curses is Txt (Length - 1) := Str (Natural (Length)); end loop; Txt (Str'Length) := Default_Character; - if Waddchnstr (Win, Txt (Txt'First)'Access, Len) = Curses_Err then + if Waddchnstr (Win, + Txt (Txt'First)'Access, + C_Int (Len)) = Curses_Err then raise Curses_Exception; end if; end Add; @@ -1796,6 +1831,14 @@ package body Terminal_Interface.Curses is Fill_String (Slk_Label (C_Int (Label)), Text); end Get_Soft_Label_Key; + 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"); + begin + return Fill_String (Slk_Label (C_Int (Label))); + end Get_Soft_Label_Key; + procedure Clear_Soft_Label_Keys is function Slk_Clear return C_Int; @@ -1885,6 +1928,35 @@ package body Terminal_Interface.Curses is begin return CInt_To_Chtype (Attr).Color; end Get_Soft_Label_Key_Attributes; +------------------------------------------------------------------------------ + procedure Enable_Key (Key : in Special_Key_Code; + Enable : in Boolean := True) + is + function Keyok (Keycode : C_Int; + On_Off : C_Int) return C_Int; + pragma Import (C, Keyok, "keyok"); + begin + if Keyok (C_Int (Key), Boolean'Pos (Enable)) = Curses_Err then + raise Curses_Exception; + end if; + end Enable_Key; +------------------------------------------------------------------------------ + procedure Define_Key (Definition : in String; + Key : in Special_Key_Code) + is + type Char_Ptr is access all Interfaces.C.Char; + function Defkey (Def : Char_Ptr; + Key : C_Int) return C_Int; + pragma Import (C, Defkey, "define_key"); + + Txt : char_array (0 .. Definition'Length); + Length : size_t; + begin + To_C (Definition, Txt, Length); + if Defkey (Txt (Txt'First)'Access, C_Int (Key)) = Curses_Err then + raise Curses_Exception; + end if; + end Define_Key; ------------------------------------------------------------------------------ procedure Un_Control (Ch : in Attributed_Character; Str : out String) @@ -1895,6 +1967,14 @@ package body Terminal_Interface.Curses is Fill_String (Unctrl (Chtype_To_CInt (Ch)), Str); end Un_Control; + function Un_Control (Ch : in Attributed_Character) return String + is + function Unctrl (Ch : C_Int) return chars_ptr; + pragma Import (C, Unctrl, "unctrl"); + begin + return Fill_String (Unctrl (Chtype_To_CInt (Ch))); + end Un_Control; + procedure Delay_Output (Msecs : in Natural) is function Delayoutput (Msecs : C_Int) return C_Int; @@ -1981,6 +2061,14 @@ package body Terminal_Interface.Curses is Fill_String (Longname, Name); end Long_Name; + function Long_Name return String + is + function Longname return chars_ptr; + pragma Import (C, Longname, "longname"); + begin + return Fill_String (Longname); + end Long_Name; + procedure Terminal_Name (Name : out String) is function Termname return chars_ptr; @@ -1988,6 +2076,14 @@ package body Terminal_Interface.Curses is begin Fill_String (Termname, Name); end Terminal_Name; + + function Terminal_Name return String + is + function Termname return chars_ptr; + pragma Import (C, Termname, "termname"); + begin + return Fill_String (Termname); + end Terminal_Name; ------------------------------------------------------------------------------ procedure Init_Pair (Pair : in Redefinable_Color_Pair; Fore : in Color_Number; @@ -2264,8 +2360,4 @@ package body Terminal_Interface.Curses is end if; end Transform_Coordinates; -begin - if Generation_Bit_Order /= System.Default_Bit_Order then - raise Constraint_Error; - end if; end Terminal_Interface.Curses; diff --git a/Ada95/ada_include/terminal_interface.ads b/Ada95/ada_include/terminal_interface.ads index dabec0ba..18e254d0 100644 --- a/Ada95/ada_include/terminal_interface.ads +++ b/Ada95/ada_include/terminal_interface.ads @@ -6,26 +6,43 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.8 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ package Terminal_Interface is + pragma Pure (Terminal_Interface); -- -- Everything is in the child units -- end Terminal_Interface; + + diff --git a/Ada95/gen/Makefile.in b/Ada95/gen/Makefile.in index 775c344f..6ebf0c5e 100644 --- a/Ada95/gen/Makefile.in +++ b/Ada95/gen/Makefile.in @@ -1,31 +1,42 @@ -#---------------------------------------------------------------------------- -# -- -# GNAT ncurses Binding -- -# gen/Makefile -- -# -- -# Version 00.92 -- -# -- -# The ncurses Ada95 binding is copyrighted 1996 by -- -# Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- -# -- -# Permission is hereby granted to reproduce and distribute this -- -# binding by any means and for any fee, whether alone or as part -- -# of a larger distribution, in source or in binary form, PROVIDED -- -# this notice is included with any such distribution, and is not -- -# removed from any of its header files. Mention of ncurses and the -- -# author of this binding in any applications linked with it is -- -# highly appreciated. -- -# -- -# This binding comes AS IS with no warranty, implied or expressed. -- -#---------------------------------------------------------------------------- +############################################################################## +# Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +# # Version Control -# $Revision: 1.8 $ +# $Revision: 1.18 $ # .SUFFIXES: SHELL = /bin/sh THIS = Makefile +top_srcdir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -33,6 +44,8 @@ libdir = @libdir@ includedir = @includedir@ datadir = @datadir@ ticdir = $(datadir)/terminfo +ADA_INCLUDE = @ADA_INCLUDE@ +ADA_OBJECTS = @ADA_OBJECTS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -68,12 +81,11 @@ M4FLAGS = DEL_ADAMODE = sed -e '/^\-\-\ \ \-\*\-\ ada\ \-\*\-.*/d' ################################################################################ -ALIB = @nc_ada_package@ +ALIB = @cf_ada_package@ ABASE = $(ALIB)-curses ADA_SRCDIR = ../ada_include ADA_OBJDIR = ../ada_objects -OBJDIR = ../objects GEN_FILES0 = Base_Defs @@ -84,7 +96,8 @@ GEN_FILES1 = Key_Definitions \ Color_Defs \ ACS_Map \ Linker_Options \ - Base_Defs + Base_Defs \ + Version_Info GEN_FILES2 = Menu_Opt_Rep \ Menu_Base_Defs \ @@ -108,6 +121,7 @@ GEN_TARGETS = $(ADA_SRCDIR)/$(ABASE).ads \ $(ADA_SRCDIR)/$(ABASE)-menus-menu_user_data.ads \ $(ADA_SRCDIR)/$(ABASE)-menus-item_user_data.ads \ $(ADA_SRCDIR)/$(ABASE)-forms-form_user_data.ads \ + $(ADA_SRCDIR)/$(ABASE)-forms-field_types.ads \ $(ADA_SRCDIR)/$(ABASE)-forms-field_user_data.ads \ $(ADA_SRCDIR)/$(ABASE)-panels-user_data.ads @@ -119,15 +133,41 @@ GEN_SRC = $(srcdir)/$(ABASE).ads.m4 \ $(srcdir)/$(ABASE)-menus-menu_user_data.ads.m4 \ $(srcdir)/$(ABASE)-menus-item_user_data.ads.m4 \ $(srcdir)/$(ABASE)-forms-form_user_data.ads.m4 \ + $(srcdir)/$(ABASE)-forms-field_types.ads.m4 \ $(srcdir)/$(ABASE)-forms-field_user_data.ads.m4 \ $(srcdir)/$(ABASE)-panels-user_data.ads.m4 -all: $(GEN_TARGETS) dirs +all: $(ADA_OBJDIR) $(GEN_TARGETS) @ -dirs: - @-mkdir $(OBJDIR) $(ADA_OBJDIR) +sources: + +$(ADA_OBJDIR) \ +$(ADA_INCLUDE) \ +$(ADA_OBJECTS) : + $(top_srcdir)/mkinstalldirs $@ + +install \ +install.libs :: $(ADA_INCLUDE) + @echo installing package $(ABASE) in $(ADA_INCLUDE) + @$(top_srcdir)/tar-copy.sh '$(ABASE)[-.]*' $(ADA_SRCDIR) $(ADA_INCLUDE) + @test $(srcdir) != ./ && $(top_srcdir)/tar-copy.sh '$(ABASE)[-.]*' $(srcdir)/../ada_include $(ADA_INCLUDE) + +install \ +install.libs :: $(ADA_OBJECTS) + @echo installing package $(ABASE) in $(ADA_OBJECTS) + @$(top_srcdir)/tar-copy.sh '$(ABASE)[-.]*' $(ADA_OBJDIR) $(ADA_OBJECTS) + +uninstall \ +uninstall.libs :: + @echo removing package $(ABASE) from $(ADA_INCLUDE) + -@cd $(ADA_INCLUDE) && rm -f $(ABASE)[-.]* + +uninstall \ +uninstall.libs :: + @echo removing package $(ABASE) from $(ADA_OBJECTS) + -@cd $(ADA_OBJECTS) && rm -f $(ABASE)[-.]* gen: gen.o @ECHO_LINK@ $(LINK) $(CFLAGS_NORMAL) gen.o $(LD_FLAGS) -o $@ $(LIB_CURSES) @@ -159,6 +199,9 @@ AC_Rep: gen Linker_Options: gen ./gen B L >$@ +Version_Info: gen + ./gen B V >$@ + Menu_Opt_Rep: gen ./gen M R >$@ @@ -243,6 +286,13 @@ $(ADA_SRCDIR)/$(ABASE)-forms-form_user_data.ads: \ $(srcdir)/$(ABASE)-forms-form_user_data.ads.m4 |\ $(DEL_ADAMODE) >$@ +$(ADA_SRCDIR)/$(ABASE)-forms-field_types.ads: \ + $(srcdir)/$(ABASE)-forms-field_types.ads.m4 \ + $(srcdir)/normal.m4 + $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \ + $(srcdir)/$(ABASE)-forms-field_types.ads.m4 |\ + $(DEL_ADAMODE) >$@ + $(ADA_SRCDIR)/$(ABASE)-forms-field_user_data.ads: \ $(srcdir)/$(ABASE)-forms-field_user_data.ads.m4 \ $(srcdir)/normal.m4 @@ -257,10 +307,6 @@ $(ADA_SRCDIR)/$(ABASE)-panels-user_data.ads: \ $(srcdir)/$(ABASE)-panels-user_data.ads.m4 |\ $(DEL_ADAMODE) >$@ -install :: - -install.libs :: - install.progs :: tags: @@ -269,13 +315,17 @@ tags: TAGS: etags *.[ch] -clean :: - rm -f a.out core gen *.o $(GEN_FILES1) $(GEN_FILES2) $(GEN_FILES3) \ - $(GEN_FILES4) $(GEN_TARGETS) +mostlyclean :: + -rm -f a.out core gen *.o + -rm -f $(GEN_FILES1) + -rm -f $(GEN_FILES2) + -rm -f $(GEN_FILES3) + -rm -f $(GEN_FILES4) -mostlyclean :: clean +clean :: mostlyclean + -rm -f $(GEN_TARGETS) -distclean :: mostlyclean +distclean :: clean rm -f Makefile realclean :: distclean diff --git a/Ada95/gen/gen.c b/Ada95/gen/gen.c index 3a1426f4..48532947 100644 --- a/Ada95/gen/gen.c +++ b/Ada95/gen/gen.c @@ -1,28 +1,38 @@ -/*---------------------------------------------------------------------------- -// -- -// GNAT ncurses Binding -- -// -- -// gen.c -- -// -- -// B O D Y -- -// -- -// Version 00.92 -- -// -- -// The ncurses Ada95 binding is copyrighted 1996 by -- -// Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- -// -- -// Permission is hereby granted to reproduce and distribute this -- -// binding by any means and for any fee, whether alone or as part -- -// of a larger distribution, in source or in binary form, PROVIDED -- -// this notice is included with any such distribution, and is not -- -// removed from any of its header files. Mention of ncurses and the -- -// author of this binding in any applications linked with it is -- -// highly appreciated. -- -// -- -// This binding comes AS IS with no warranty, implied or expressed. -- -//---------------------------------------------------------------------------- +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 * + ****************************************************************************/ + +/* Version Control - $Revision: 1.8 $ + $Revision: 1.14 $ --------------------------------------------------------------------------*/ /* This program generates various record structures and constants from the @@ -34,7 +44,6 @@ #include #include #include -#include #include #include @@ -83,9 +92,16 @@ static int find_pos (char *s, unsigned len, int *low, int *high) return (*high >= 0 && (*low <= *high)) ? *low : -1; } -static void gen_reps ( const name_attribute_pair *nap, - const char *name, - int len) +/* + * This helper routine generates a representation clause for a + * record type defined in the binding. + * We are only dealing with record types which are of 32 or 16 + * 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 i,l,cnt = 0,low,high; int width = strlen(RES_NAME); @@ -324,6 +340,9 @@ static void gen_form_opt_rep(const char *name) gen_reps (nap, name, sizeof(int)); } +/* + * Generate the representation clause for the Field_Option_Set record + */ static void gen_field_opt_rep(const char *name) { static const name_attribute_pair nap[] = { @@ -362,12 +381,17 @@ static void gen_field_opt_rep(const char *name) gen_reps (nap, name, sizeof(int)); } +/* + * Generate a single key code constant definition. + */ static void keydef(const char *name, const char *old_name, int value, int mode) { - if (mode==0) + 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++))); if (*s || *t) @@ -375,6 +399,13 @@ static void keydef(const char *name, const char *old_name, int value, int mode) } } +/* + * Generate constants for the key codes. When called with mode==0, a + * complete list with nice constant names in proper casing style will + * be generated. Otherwise a list of old (i.e. C-style) names will be + * generated, given that the name wasn't already defined in the "nice" + * list. + */ static void gen_keydefs (int mode) { char buf[16]; @@ -665,8 +696,16 @@ static void gen_keydefs (int mode) #ifdef KEY_MOUSE keydef("Key_Mouse","KEY_MOUSE",KEY_MOUSE,mode); #endif +#ifdef KEY_RESIZE + keydef("Key_Resize","KEY_RESIZE",KEY_RESIZE,mode); +#endif } +/* + * Generate a constant with the given name. The second parameter + * 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) { int c = a - &acs_map[0]; @@ -677,7 +716,9 @@ static void acs_def (const char *name, chtype *a) printf("Character'Val (%d);\n",c); } - +/* + * Generate the constants for the ACS characters + */ static void gen_acs (void) { #ifdef ACS_ULCORNER @@ -778,16 +819,24 @@ static void gen_acs (void) #endif } +/* + * Output some comment lines indicating that the file is generated. + * The name parameter is the name of the facility to be used in + * the comment. + */ static void prologue(const char *name) { - time_t t = time(NULL); - printf("-- %s binding, generated at %s",name,ctime(&t)); + 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"); } +/* + * 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) { prologue("curses"); @@ -798,31 +847,48 @@ static void basedefs (void) #ifndef KEY_MIN # define KEY_MIN 0401 #endif - if (KEY_MIN == 256) - abort(); + 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) { prologue("menu"); } +/* + * Write out the comment lines for the form facility + */ static void form_basedefs (void) { prologue("form"); } +/* + * Write out the comment lines for the mouse facility + */ static void mouse_basedefs(void) { prologue("mouse"); } +/* + * Write the definition of a single color + */ static void color_def (const char *name, int value) { printf(" %-8s : constant Color_Number := %d;\n",name,value); } +/* + * Generate all color definitions + */ static void gen_color (void) { #ifdef COLOR_BLACK @@ -851,27 +917,57 @@ static void gen_color (void) #endif } +/* + * Generate the linker options for the base facility + */ static void gen_linkopts (void) { printf(" pragma Linker_Options (\"-lncurses\");\n"); } +/* + * Generate the linker options for the menu facility + */ static void gen_menu_linkopts (void) { printf(" pragma Linker_Options (\"-lmenu\");\n"); } +/* + * Generate the linker options for the form facility + */ static void gen_form_linkopts (void) { printf(" pragma Linker_Options (\"-lform\");\n"); } +/* + * Generate the linker options for the panel facility + */ static void gen_panel_linkopts (void) { printf(" pragma Linker_Options (\"-lpanel\");\n"); } +static void gen_version_info (void) +{ + printf(" NC_Major_Version : constant := %d; -- Major version of ncurses library\n", NCURSES_VERSION_MAJOR); + printf(" NC_Minor_Version : constant := %d; -- Minor version of ncurses library\n", NCURSES_VERSION_MINOR); + printf(" NC_Version : constant String := %c%d.%d%c; -- Version of ncurses library\n", '"',NCURSES_VERSION_MAJOR,NCURSES_VERSION_MINOR,'"'); +} +/* + * main() expects two arguments on the commandline, both single characters. + * The first character denotes the facility for which we generate output. + * Possible values are + * B - Base + * M - Menus + * F - Forms + * P - Pointer Device (Mouse) + * + * The second character then denotes the specific output that should be + * generated for the selected facility. + */ int main(int argc, char *argv[]) { int x = 0x12345678; @@ -885,85 +981,88 @@ int main(int argc, char *argv[]) switch(argv[1][0]) { - case 'B': + case 'B': /* The Base facility */ switch(argv[2][0]) { - case 'A': + case 'A': /* chtype translation into Ada95 record type */ gen_attr_set("Character_Attribute_Set"); break; - case 'K': + case 'K': /* translation of keycodes */ gen_keydefs(0); break; - case 'B': + case 'B': /* write some initial comment lines */ basedefs(); break; - case 'C': + case 'C': /* generate color constants */ gen_color(); break; - case 'M': + case 'M': /* generate constants for the ACS characters */ gen_acs(); break; - case 'L': + case 'L': /* generate the Linker_Options pragma */ gen_linkopts(); break; - case 'O': + case 'O': /* generate definitions of the old key code names */ gen_keydefs(1); break; - case 'R': + case 'R': /* generate representation clause for Attributed character */ gen_chtype_rep("Attributed_Character"); break; + case 'V': /* generate version info */ + gen_version_info(); + break; default: break; } break; - case 'M': + case 'M': /* The Menu facility */ switch(argv[2][0]) { - case 'R': + case 'R': /* generate representation clause for Menu_Option_Set */ gen_menu_opt_rep("Menu_Option_Set"); break; - case 'B': + case 'B': /* write some initial comment lines */ menu_basedefs(); break; - case 'L': + case 'L': /* generate the Linker_Options pragma */ gen_menu_linkopts(); break; - case 'I': + case 'I': /* generate representation clause for Item_Option_Set */ gen_item_opt_rep("Item_Option_Set"); break; default: break; } break; - case 'F': + case 'F': /* The Form facility */ switch(argv[2][0]) { - case 'R': + case 'R': /* generate representation clause for Form_Option_Set */ gen_form_opt_rep("Form_Option_Set"); break; - case 'B': + case 'B': /* write some initial comment lines */ form_basedefs(); break; - case 'L': + case 'L': /* generate the Linker_Options pragma */ gen_form_linkopts(); break; - case 'I': + case 'I': /* generate representation clause for Field_Option_Set */ gen_field_opt_rep("Field_Option_Set"); break; default: break; } break; - case 'P': + case 'P': /* The Pointer(=Mouse) facility */ switch(argv[2][0]) { - case 'B': + case 'B': /* write some initial comment lines */ mouse_basedefs(); break; - case 'M': + case 'M': /* generate representation clause for Mouse_Event */ gen_mrep_rep("Mouse_Event"); break; - case 'L': + case 'L': /* generate the Linker_Options pragma */ gen_panel_linkopts(); break; default: diff --git a/Ada95/gen/terminal_interface-curses-forms-field_types.ads.m4 b/Ada95/gen/terminal_interface-curses-forms-field_types.ads.m4 new file mode 100644 index 00000000..79e185a1 --- /dev/null +++ b/Ada95/gen/terminal_interface-curses-forms-field_types.ads.m4 @@ -0,0 +1,238 @@ +-- -*- ada -*- +define(`HTMLNAME',`terminal_interface-curses-forms-field_user_data_s.html')dnl +include(M4MACRO)dnl +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types -- +-- -- +-- S P E C -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control: +-- $Revision: 1.6 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +with Terminal_Interface.Curses.Aux; + +package Terminal_Interface.Curses.Forms.Field_Types is + pragma Preelaborate (Field_Types); + + -- MANPAGE(`form_fieldtype.3x') + + type Field_Type is abstract tagged null record; + -- Abstract base type for all field types. A concrete field type + -- is an extension that adds some data elements describing formats or + -- boundary values for the type and validation routines. + -- For the builtin low-level fieldtypes, the validation routines are + -- already defined by the low-level C library. + -- The builtin types like Alpha or AlphaNumeric etc. are defined in + -- child packages of this package. You may use one of them as example + -- how to create you own child packages for low-level field types that + -- you may have already written in C. + + type Field_Type_Access is access all Field_Type'Class; + + -- ANCHOR(`set_field_type()',`Set_Type') + procedure Set_Field_Type (Fld : in Field; + Fld_Type : in Field_Type) is abstract; + -- AKA + -- But: we hide the vararg mechanism of the C interface. You always + -- have to pass a single Field_Type parameter. + + -- --------------------------------------------------------------------- + + -- MANPAGE(`form_field_validation.3x') + + -- ANCHOR(`field_type()',`Get_Type') + function Get_Type (Fld : in Field) return Field_Type_Access; + -- AKA + -- ALIAS(`field_arg()') + -- In Ada95 we can combine these. If you try to retrieve the field type + -- that is not defined as extension of the abstract tagged type above, + -- you will raise a Form_Exception. + -- This is not inlined + + -- +---------------------------------------------------------------------- + -- | Private Part. + -- | Most of this is used by the implementations of the child packages. + -- | +private + use Terminal_Interface.Curses.Aux; + + type Makearg_Function is access + function (Args : System.Address) return System.Address; + pragma Convention (C, Makearg_Function); + + type Copyarg_Function is access + function (Usr : System.Address) return System.Address; + pragma Convention (C, Copyarg_Function); + + type Freearg_Function is access + procedure (Usr : System.Address); + pragma Convention (C, Freearg_Function); + + 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; + pragma Convention (C, Char_Check_Function); + + type Choice_Function is access + function (Fld : Field; Usr : System.Address) return C_Int; + pragma Convention (C, Choice_Function); + + -- +---------------------------------------------------------------------- + -- | This must be in sync with the FIELDTYPE structure in form.h + -- | + type Low_Level_Field_Type is + record + Status : C_Short; + Ref_Count : C_Long_Int; + 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); + type C_Field_Type is access all Low_Level_Field_Type; + + Null_Field_Type : constant C_Field_Type := null; + + -- +---------------------------------------------------------------------- + -- | This four low-level fieldtypes are the ones associated with + -- | 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_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_Choice_Router return C_Field_Type; + + 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 + -- conformant Field_Type object. + -- The parameter Cft must be C_Builtin_Router for regular low-level + -- fieldtypes (like TYP_ALPHA or TYP_ALNUM) and C_Choice_Router for + -- low-level fieldtypes witch choice functions (like TYP_ENUM). + -- Any other value will raise a Form_Exception. + + function Make_Arg (Args : System.Address) return System.Address; + pragma Convention (C, Make_Arg); + -- This is the Makearg_Function for the internal low-level types + -- introduced by this binding. + + 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. + + procedure Free_Arg (Usr : System.Address); + pragma Convention (C, Free_Arg); + -- 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; + 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; + 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; + 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; + 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 + -- type. It routes the call to the corresponding low-level prev_choice + -- function. + + -- 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 + Cft : C_Field_Type; -- the original low-level type + end record; + type Argument_Access is access all Argument; + + -- +---------------------------------------------------------------------- + -- | + -- | Some Imports of libform routines to deal with low-level fieldtypes. + -- | + 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) + return C_Int; + pragma Import (C, Set_Fieldtype_Arg, "set_fieldtype_arg"); + + function Set_Fieldtype_Choice (Cft : C_Field_Type; + Next, Prev : Choice_Function) + return C_Int; + pragma Import (C, Set_Fieldtype_Choice, "set_fieldtype_choice"); + +end Terminal_Interface.Curses.Forms.Field_Types; diff --git a/Ada95/gen/terminal_interface-curses-forms-field_user_data.ads.m4 b/Ada95/gen/terminal_interface-curses-forms-field_user_data.ads.m4 index 3fdeecb1..8059f184 100644 --- a/Ada95/gen/terminal_interface-curses-forms-field_user_data.ads.m4 +++ b/Ada95/gen/terminal_interface-curses-forms-field_user_data.ads.m4 @@ -9,51 +9,62 @@ include(M4MACRO)dnl -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.8 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ generic type User is limited private; type User_Access is access User; package Terminal_Interface.Curses.Forms.Field_User_Data is + pragma Preelaborate (Field_User_Data); - -- The binding uses the C level user pointer already for its own - -- internal purposes. So you can´t easily manipulate the user pointer - -- with the low level C routines for this field without taking care of - -- this special situation. If you want to read or write with C routines - -- the user pointer of this field, you should get first the low level - -- user pointer. This points to a record, that always has as its first - -- member the Ada95 user pointer for this field. You should never change - -- the low level user pointer of an Ada created field. - -- -- MANPAGE(`form_field_userptr.3x') -- ANCHOR(`set_field_userptr',`Set_User_Data') procedure Set_User_Data (Fld : in Field; Data : in User_Access); -- AKA - pragma Convention (C, Set_User_Data); + pragma Inline (Set_User_Data); -- ANCHOR(`field_userptr',`Get_User_Data') procedure Get_User_Data (Fld : in Field; Data : out User_Access); -- AKA - pragma Convention (C, Get_User_Data); + + -- ANCHOR(`field_userptr',`Get_User_Data') + function Get_User_Data (Fld : in Field) return User_Access; + -- AKA + -- Sama as function + pragma Inline (Get_User_Data); end Terminal_Interface.Curses.Forms.Field_User_Data; diff --git a/Ada95/gen/terminal_interface-curses-forms-form_user_data.ads.m4 b/Ada95/gen/terminal_interface-curses-forms-form_user_data.ads.m4 index da9b0c5f..acc0f247 100644 --- a/Ada95/gen/terminal_interface-curses-forms-form_user_data.ads.m4 +++ b/Ada95/gen/terminal_interface-curses-forms-form_user_data.ads.m4 @@ -9,52 +9,62 @@ include(M4MACRO)dnl -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.3 $ +-- $Revision: 1.8 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ generic type User is limited private; type User_Access is access User; package Terminal_Interface.Curses.Forms.Form_User_Data is + pragma Preelaborate (Form_User_Data); - -- The binding uses the C level user pointer already for its own - -- internal purposes. So you can´t easily manipulate the user pointer - -- with the low level C routines for this form without taking care of - -- this special situation. If you want to read or write with C routines - -- the user pointer of this form, you should get first the low level - -- user pointer. This points to a record, that always has as its first - -- member the Ada95 user pointer for this form. You should never change - -- the low level user pointer of an Ada created form. - -- -- MANPAGE(`form_userptr.3x') -- ANCHOR(`set_form_userptr',`Set_User_Data') procedure Set_User_Data (Frm : in Form; Data : in User_Access); -- AKA - pragma Convention (C, Set_User_Data); + pragma Inline (Set_User_Data); -- ANCHOR(`form_userptr',`Get_User_Data') procedure Get_User_Data (Frm : in Form; Data : out User_Access); -- AKA - pragma Convention (C, Get_User_Data); -end Terminal_Interface.Curses.Forms.Form_User_Data; + -- ANCHOR(`form_userptr',`Get_User_Data') + function Get_User_Data (Frm : in Form) return User_Access; + -- AKA + -- Same as function + pragma Inline (Get_User_Data); +end Terminal_Interface.Curses.Forms.Form_User_Data; diff --git a/Ada95/gen/terminal_interface-curses-forms.ads.m4 b/Ada95/gen/terminal_interface-curses-forms.ads.m4 index 998fdba1..bb4ebfd4 100644 --- a/Ada95/gen/terminal_interface-curses-forms.ads.m4 +++ b/Ada95/gen/terminal_interface-curses-forms.ads.m4 @@ -9,45 +9,54 @@ include(M4MACRO)dnl -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.9 $ +-- $Revision: 1.14 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ include(`Form_Base_Defs') with System; -with Ada.Tags; use Ada.Tags; with Ada.Characters.Latin_1; with Interfaces.C; -with Interfaces.C.Strings; package Terminal_Interface.Curses.Forms is - + pragma Preelaborate (Forms); include(`Form_Linker_Options') Space : Character renames Ada.Characters.Latin_1.Space; type Field is private; type Form is private; - type C_Field_Type is private; Null_Field : constant Field; Null_Form : constant Form; - Null_Field_Type : constant C_Field_Type; - type Field_Justification is (None, Left, @@ -56,20 +65,28 @@ include(`Form_Linker_Options') include(`Field_Rep') - Default_Field_Options : Field_Option_Set; + function Default_Field_Options return Field_Option_Set; -- The initial defaults for the field options. + pragma Inline (Default_Field_Options); include(`Form_Opt_Rep') - Default_Form_Options : Form_Option_Set; + function Default_Form_Options return Form_Option_Set; -- The initial defaults for the form options. + pragma Inline (Default_Form_Options); type Buffer_Number is new Natural; type Field_Array is array (Positive range <>) of aliased Field; pragma Convention (C, Field_Array); - type Field_Array_Access is access all Field_Array; + type Field_Array_Access is access Field_Array; + + 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 + -- the array. subtype Form_Request_Code is Key_Code range (Key_Max + 1) .. (Key_Max + 57); @@ -209,6 +226,10 @@ include(`Form_Opt_Rep') procedure Request_Name (Key : in Form_Request_Code; Name : out String); + function Request_Name (Key : Form_Request_Code) return String; + -- Same as function + pragma Inline (Request_Name); + ------------------ -- Exceptions -- ------------------ @@ -225,6 +246,7 @@ include(`Form_Opt_Rep') More_Buffers : Buffer_Number := Buffer_Number'First) return Field; -- AKA + -- An overloaded Create is defined later. Pragma Inline appears there. -- ANCHOR(`new_field()',`New_Field') function New_Field (Height : Line_Count; @@ -235,23 +257,27 @@ include(`Form_Opt_Rep') More_Buffers : Buffer_Number := Buffer_Number'First) return Field renames Create; -- AKA + pragma Inline (New_Field); -- ANCHOR(`free_field()',`Delete') procedure Delete (Fld : in out Field); -- AKA -- Reset Fld to Null_Field + -- An overloaded Delete is defined later. Pragma Inline appears there. -- ANCHOR(`dup_field()',`Duplicate') function Duplicate (Fld : Field; Top : Line_Position; Left : Column_Position) return Field; -- AKA + pragma Inline (Duplicate); -- ANCHOR(`link_field()',`Link') function Link (Fld : Field; Top : Line_Position; Left : Column_Position) return Field; -- AKA + pragma Inline (Link); -- MANPAGE(`form_field_just.3x') @@ -259,10 +285,12 @@ include(`Form_Opt_Rep') procedure Set_Justification (Fld : in Field; Just : in Field_Justification := None); -- AKA + pragma Inline (Set_Justification); -- ANCHOR(`field_just()',`Get_Justification') function Get_Justification (Fld : Field) return Field_Justification; -- AKA + pragma Inline (Get_Justification); -- MANPAGE(`form_field_buffer.3x') @@ -272,6 +300,7 @@ include(`Form_Opt_Rep') Buffer : in Buffer_Number := Buffer_Number'First; Str : in String); -- AKA + -- Not inlined -- ANCHOR(`field_buffer()',`Get_Buffer') procedure Get_Buffer @@ -280,19 +309,29 @@ include(`Form_Opt_Rep') Str : out String); -- AKA + function Get_Buffer + (Fld : in Field; + Buffer : in Buffer_Number := Buffer_Number'First) return String; + -- AKA + -- Same but as function + pragma Inline (Get_Buffer); + -- ANCHOR(`set_field_status()',`Set_Status') procedure Set_Status (Fld : in Field; Status : in Boolean := True); -- AKA + pragma Inline (Set_Status); -- ANCHOR(`field_status()',`Changed') function Changed (Fld : Field) return Boolean; -- AKA + pragma Inline (Changed); -- ANCHOR(`set_field_max()',`Set_Maximum_Size') procedure Set_Maximum_Size (Fld : in Field; Max : in Natural := 0); -- AKA + pragma Inline (Set_Maximum_Size); -- MANPAGE(`form_field_opts.3x') @@ -300,6 +339,7 @@ include(`Form_Opt_Rep') procedure Set_Options (Fld : in Field; Options : in Field_Option_Set); -- AKA + -- An overloaded version is defined later. Pragma Inline appears there -- ANCHOR(`field_opts_on()',`Switch_Options') procedure Switch_Options (Fld : in Field; @@ -307,6 +347,7 @@ include(`Form_Opt_Rep') On : Boolean := True); -- AKA -- ALIAS(`field_opts_off()') + -- An overloaded version is defined later. Pragma Inline appears there -- ANCHOR(`field_opts()',`Get_Options') procedure Get_Options (Fld : in Field; @@ -317,6 +358,7 @@ include(`Form_Opt_Rep') function Get_Options (Fld : Field := Null_Field) return Field_Option_Set; -- AKA + -- An overloaded version is defined later. Pragma Inline appears there -- MANPAGE(`form_field_attributes.3x') @@ -326,6 +368,7 @@ include(`Form_Opt_Rep') Fore : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA + pragma Inline (Set_Foreground); -- ANCHOR(`field_fore()',`Foreground') procedure Foreground (Fld : in Field; @@ -337,6 +380,7 @@ include(`Form_Opt_Rep') Fore : out Character_Attribute_Set; Color : out Color_Pair); -- AKA + pragma Inline (Foreground); -- ANCHOR(`set_field_back()',`Set_Background') procedure Set_Background @@ -344,6 +388,7 @@ include(`Form_Opt_Rep') Back : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA + pragma Inline (Set_Background); -- ANCHOR(`field_back()',`Background') procedure Background (Fld : in Field; @@ -355,16 +400,19 @@ include(`Form_Opt_Rep') Back : out Character_Attribute_Set; Color : out Color_Pair); -- AKA + pragma Inline (Background); -- ANCHOR(`set_field_pad()',`Set_Pad_Character') procedure Set_Pad_Character (Fld : in Field; Pad : in Character := Space); -- AKA + pragma Inline (Set_Pad_Character); -- ANCHOR(`field_pad()',`Pad_Character') procedure Pad_Character (Fld : in Field; Pad : out Character); -- AKA + pragma Inline (Pad_Character); -- MANPAGE(`form_field_info.3x') @@ -377,6 +425,7 @@ include(`Form_Opt_Rep') Off_Screen : out Natural; Additional_Buffers : out Buffer_Number); -- AKA + pragma Inline (Info); -- ANCHOR(`dynamic_field_info()',`Dynamic_Info') procedure Dynamic_Info (Fld : in Field; @@ -384,6 +433,7 @@ include(`Form_Opt_Rep') Columns : out Column_Count; Max : out Natural); -- AKA + pragma Inline (Dynamic_Info); -- MANPAGE(`form_win.3x') @@ -391,25 +441,30 @@ include(`Form_Opt_Rep') procedure Set_Window (Frm : in Form; Win : in Window); -- AKA + pragma Inline (Set_Window); -- ANCHOR(`form_win()',`Get_Window') function Get_Window (Frm : Form) return Window; -- AKA + pragma Inline (Get_Window); -- ANCHOR(`set_form_sub()',`Set_Sub_Window') procedure Set_Sub_Window (Frm : in Form; Win : in Window); -- AKA + pragma Inline (Set_Sub_Window); -- ANCHOR(`form_sub()',`Get_Sub_Window') function Get_Sub_Window (Frm : Form) return Window; -- AKA + pragma Inline (Get_Sub_Window); -- ANCHOR(`scale_form()',`Scale') procedure Scale (Frm : in Form; Lines : out Line_Count; Columns : out Column_Count); -- AKA + pragma Inline (Scale); -- MANPAGE(`form_hook.3x') @@ -420,21 +475,25 @@ include(`Form_Opt_Rep') procedure Set_Field_Init_Hook (Frm : in Form; Proc : in Form_Hook_Function); -- AKA + pragma Inline (Set_Field_Init_Hook); -- ANCHOR(`set_field_term()',`Set_Field_Term_Hook') procedure Set_Field_Term_Hook (Frm : in Form; Proc : in Form_Hook_Function); -- AKA + pragma Inline (Set_Field_Term_Hook); -- ANCHOR(`set_form_init()',`Set_Form_Init_Hook') procedure Set_Form_Init_Hook (Frm : in Form; Proc : in Form_Hook_Function); -- AKA + pragma Inline (Set_Form_Init_Hook); -- ANCHOR(`set_form_term()',`Set_Form_Term_Hook') procedure Set_Form_Term_Hook (Frm : in Form; Proc : in Form_Hook_Function); -- AKA + pragma Inline (Set_Form_Term_Hook); -- ANCHOR(`field_init()',`Get_Field_Init_Hook') function Get_Field_Init_Hook (Frm : Form) return Form_Hook_Function; @@ -460,44 +519,52 @@ include(`Form_Opt_Rep') -- ANCHOR(`set_form_fields()',`Redefine') procedure Redefine (Frm : in Form; - Flds : in Field_Array); + Flds : in Field_Array_Access); -- AKA - -- With a bit more comfort. You don´t need to terminate the Field_Array - -- with a null entry. This is handled internally in the binding. + pragma Inline (Redefine); -- ANCHOR(`set_form_fields()',`Set_Fields') procedure Set_Fields (Frm : in Form; - Flds : in Field_Array) renames Redefine; + Flds : in Field_Array_Access) renames Redefine; -- AKA + pragma Inline (Set_Fields); -- ANCHOR(`form_fields()',`Fields') - function Fields (Frm : Form) return Field_Array_Access; + function Fields (Frm : Form; + Index : Positive) return Field; -- AKA + pragma Inline (Fields); -- ANCHOR(`field_count()',`Field_Count') function Field_Count (Frm : Form) return Natural; -- AKA + pragma Inline (Field_Count); -- ANCHOR(`move_field()',`Move') procedure Move (Fld : in Field; Line : in Line_Position; Column : in Column_Position); -- AKA + pragma Inline (Move); -- MANPAGE(`form_new.3x') -- ANCHOR(`new_form()',`Create') - function Create (Fields : Field_Array) return Form; + function Create (Fields : Field_Array_Access) return Form; -- AKA + pragma Inline (Create); -- ANCHOR(`new_form()',`New_Form') - function New_Form (Fields : Field_Array) return Form renames Create; + function New_Form (Fields : Field_Array_Access) return Form + renames Create; -- AKA + pragma Inline (New_Form); -- ANCHOR(`free_form()',`Delete') procedure Delete (Frm : in out Form); -- AKA -- Reset Frm to Null_Form + pragma Inline (Delete); -- MANPAGE(`form_opts.3x') @@ -505,6 +572,7 @@ include(`Form_Opt_Rep') procedure Set_Options (Frm : in Form; Options : in Form_Option_Set); -- AKA + pragma Inline (Set_Options); -- ANCHOR(`form_opts_on()',`Switch_Options') procedure Switch_Options (Frm : in Form; @@ -512,6 +580,7 @@ include(`Form_Opt_Rep') On : Boolean := True); -- AKA -- ALIAS(`form_opts_off()') + pragma Inline (Switch_Options); -- ANCHOR(`form_opts()',`Get_Options') procedure Get_Options (Frm : in Form; @@ -521,6 +590,7 @@ include(`Form_Opt_Rep') -- ANCHOR(`form_opts()',`Get_Options') function Get_Options (Frm : Form := Null_Form) return Form_Option_Set; -- AKA + pragma Inline (Get_Options); -- MANPAGE(`form_post.3x') @@ -529,22 +599,26 @@ include(`Form_Opt_Rep') Post : in Boolean := True); -- AKA -- ALIAS(`unpost_form()') + pragma Inline (Post); -- MANPAGE(`form_cursor.3x') -- ANCHOR(`pos_form_cursor()',`Position_Cursor') procedure Position_Cursor (Frm : Form); -- AKA + pragma Inline (Position_Cursor); -- MANPAGE(`form_data.3x') -- ANCHOR(`data_ahead()',`Data_Ahead') function Data_Ahead (Frm : Form) return Boolean; -- AKA + pragma Inline (Data_Ahead); -- ANCHOR(`data_behind()',`Data_Behind') function Data_Behind (Frm : Form) return Boolean; -- AKA + pragma Inline (Data_Behind); -- MANPAGE(`form_driver.3x') @@ -557,6 +631,7 @@ include(`Form_Opt_Rep') function Driver (Frm : Form; Key : Key_Code) return Driver_Result; -- AKA + -- Driver not inlined -- MANPAGE(`form_page.3x') @@ -566,19 +641,23 @@ include(`Form_Opt_Rep') procedure Set_Current (Frm : in Form; Fld : in Field); -- AKA + pragma Inline (Set_Current); -- ANCHOR(`current_field()',`Current') function Current (Frm : in Form) return Field; -- AKA + pragma Inline (Current); -- ANCHOR(`set_form_page()',`Set_Page') procedure Set_Page (Frm : in Form; Page : in Page_Number := Page_Number'First); -- AKA + pragma Inline (Set_Page); -- ANCHOR(`form_page()',`Page') function Page (Frm : Form) return Page_Number; -- AKA + pragma Inline (Page); -- ANCHOR(`field_index()',`Get_Index') function Get_Index (Fld : Field) return Positive; @@ -586,6 +665,7 @@ include(`Form_Opt_Rep') -- Please note that in this binding we start the numbering of fields -- with 1. So this is number is one more than you get from the low -- level call. + pragma Inline (Get_Index); -- MANPAGE(`form_new_page.3x') @@ -593,220 +673,20 @@ include(`Form_Opt_Rep') procedure Set_New_Page (Fld : in Field; New_Page : in Boolean := True); -- AKA + pragma Inline (Set_New_Page); -- ANCHOR(`new_page()',`Is_New_Page') function Is_New_Page (Fld : Field) return Boolean; -- AKA - - -- MANPAGE(`form_fieldtype.3x') - - type Field_Type is abstract tagged null record; - type Field_Type_Access is access all Field_Type'Class; - - function Native_Type (Ftype : Field_Type) - return C_Field_Type is abstract; - -- This function returns the C libraries handle to the field type. - -- May be you need this if you want to interface to lower level - -- routines in the form library. - - -- ANCHOR(`set_field_type()',`Set_Type') - procedure Set_Type (Fld : in Field; - Fld_Type : in Field_Type) is abstract; - -- AKA - -- But: we hide the vararg mechanism of the C interface. You always - -- have to pass a single Field_Type parameter. - - type C_Defined_Field_Type is abstract new Field_Type with null record; - -- This is the root of all field typed defined in C, i.e. this are - -- the predefined field types in the form library. - - type Alpha_Field is new C_Defined_Field_Type - with record - Minimum_Field_Width : Natural := 0; - end record; - procedure Set_Type (Fld : in Field; - Fld_Type : in Alpha_Field); - function Native_Type (Ftype : Alpha_Field) - return C_Field_Type; - - type Alpha_Numeric_Field is new C_Defined_Field_Type with - record - Minimum_Field_Width : Natural := 0; - end record; - procedure Set_Type (Fld : in Field; - Fld_Type : in Alpha_Numeric_Field); - function Native_Type (Ftype : Alpha_Numeric_Field) - return C_Field_Type; - - type Integer_Field is new C_Defined_Field_Type with - record - Precision : Natural; - Lower_Limit : Integer; - Upper_Limit : Integer; - end record; - procedure Set_Type (Fld : in Field; - Fld_Type : in Integer_Field); - function Native_Type (Ftype : Integer_Field) - return C_Field_Type; - - type Numeric_Field is new C_Defined_Field_Type with - record - Precision : Natural; - Lower_Limit : Float; - Upper_Limit : Float; - end record; - procedure Set_Type (Fld : in Field; - Fld_Type : in Numeric_Field); - function Native_Type (Ftype : Numeric_Field) - return C_Field_Type; - - type String_Access is access String; - - type Regular_Expression_Field is new C_Defined_Field_Type with - record - Regular_Expression : String_Access; - end record; - procedure Set_Type (Fld : in Field; - Fld_Type : in Regular_Expression_Field); - function Native_Type (Ftype : Regular_Expression_Field) - return C_Field_Type; - - type Enum_Array is array (Positive range <>) - of String_Access; - - type Enumeration_Info (C : Positive) is - record - Names : Enum_Array (1 .. C); - Case_Sensitive : Boolean := False; - Match_Must_Be_Unique : Boolean := False; - end record; - - type Enumeration_Field is new C_Defined_Field_Type with private; - - 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; - - 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. - - procedure Set_Type (Fld : in Field; - Fld_Type : in Enumeration_Field); - function Native_Type (Ftype : Enumeration_Field) - return C_Field_Type; - - -- The next type defintions are all ncurses extensions. They are typically - -- not available in other curses implementations. - - type Internet_V4_Address_Field is new C_Defined_Field_Type - with null record; - procedure Set_Type (Fld : in Field; - Fld_Type : in Internet_V4_Address_Field); - function Native_Type (Ftype : Internet_V4_Address_Field) - return C_Field_Type; - - - type Ada_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 don't have to redefine the Set_Field_Type and - -- Native_Field_Type methods, because they work generically on this - -- class. - - procedure Set_Type (Fld : Field; - Fld_Type : Ada_Defined_Field_Type); - - function Native_Type (Ftype : Ada_Defined_Field_Type) - return C_Field_Type; - - -- MANPAGE(`form_field_validation.3x') - - -- ANCHOR(`field_type()',`Get_Type') - function Get_Type (Fld : in Field) return Field_Type_Access; - -- AKA - -- ALIAS(`field_arg()') - -- In Ada95 we can combine these + pragma Inline (Is_New_Page); ------------------------------------------------------------------------------ private type Field is new System.Address; type Form is new System.Address; - type C_Field_Type is new System.Address; Null_Field : constant Field := Field (System.Null_Address); Null_Form : constant Form := Form (System.Null_Address); - Null_Field_Type : constant C_Field_Type := - C_Field_Type (System.Null_Address); - - type CPA_Access is access Interfaces.C.Strings.chars_ptr_array; - - type Enumeration_Field is new C_Defined_Field_Type with - record - Case_Sensitive : Boolean := False; - Match_Must_Be_Unique : Boolean := False; - Arr : CPA_Access := null; - end record; - - -- In our binding we use the fields user pointer as hook to maintain - -- our own info structure about the field type. To be able to still - -- provide a user pointer, we use this wrapper. - -- - type Field_User_Wrapper is - record - U : System.Address; -- the hook we provide for the user - T : Field_Type_Access; -- may be null - N : Natural; -- use counter - end record; - pragma Convention (C, Field_User_Wrapper); - type Field_User_Wrapper_Access is access all Field_User_Wrapper; - pragma Controlled (Field_User_Wrapper_Access); - - function Set_Field_Userptr (Fld : Field; - Wrp : Field_User_Wrapper_Access) - return Interfaces.C.int; - pragma Import (C, Set_Field_Userptr, "set_field_userptr"); - - function Field_Userptr (Fld : Field) return Field_User_Wrapper_Access; - pragma Import (C, Field_Userptr, "field_userptr"); - - -- In our binding we use the forms user pointer as hook to maintain - -- our own info structure about the field association. To be able to still - -- provide a user pointer, we use this wrapper. - -- - type Form_User_Wrapper is - record - U : System.Address; -- the hook we provide for the user - I : Field_Array_Access; - end record; - pragma Convention (C, Form_User_Wrapper); - type Form_User_Wrapper_Access is access all Form_User_Wrapper; - pragma Controlled (Form_User_Wrapper_Access); - - function Set_Form_Userptr (Frm : Form; - Wrp : Form_User_Wrapper_Access) - return Interfaces.C.int; - pragma Import (C, Set_Form_Userptr, "set_form_userptr"); - - function Form_Userptr (Frm : Form) return Form_User_Wrapper_Access; - pragma Import (C, Form_Userptr, "form_userptr"); - - procedure Register_Type (T : in Ada_Defined_Field_Type'Class; - Cft : in C_Field_Type); - procedure Unregister_Type (T : in Ada_Defined_Field_Type'Class); - function Search_Type (T : Ada_Defined_Field_Type'Class) - return C_Field_Type; - - Generation_Bit_Order : constant System.Bit_Order := System.M4_BIT_ORDER; - -- This constant may be different on your system. end Terminal_Interface.Curses.Forms; diff --git a/Ada95/gen/terminal_interface-curses-menus-item_user_data.ads.m4 b/Ada95/gen/terminal_interface-curses-menus-item_user_data.ads.m4 index c32e764a..957e4437 100644 --- a/Ada95/gen/terminal_interface-curses-menus-item_user_data.ads.m4 +++ b/Ada95/gen/terminal_interface-curses-menus-item_user_data.ads.m4 @@ -9,29 +9,44 @@ include(M4MACRO)dnl -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.2 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ generic type User is limited private; type User_Access is access User; package Terminal_Interface.Curses.Menus.Item_User_Data is + pragma Preelaborate (Item_User_Data); -- The binding uses the same user pointer for menu items -- as the low level C implementation. So you can safely @@ -43,12 +58,18 @@ package Terminal_Interface.Curses.Menus.Item_User_Data is procedure Set_User_Data (Itm : in Item; Data : in User_Access); -- AKA - pragma Convention (C, Set_User_Data); + pragma Inline (Set_User_Data); -- ANCHOR(`item_userptr',`Get_User_Data') procedure Get_User_Data (Itm : in Item; Data : out User_Access); -- AKA - pragma Convention (C, Get_User_Data); + + -- ANCHOR(`item_userptr',`Get_User_Data') + function Get_User_Data (Itm : in Item) return User_Access; + -- AKA + -- Same as function + pragma Inline (Get_User_Data); end Terminal_Interface.Curses.Menus.Item_User_Data; + diff --git a/Ada95/gen/terminal_interface-curses-menus-menu_user_data.ads.m4 b/Ada95/gen/terminal_interface-curses-menus-menu_user_data.ads.m4 index 79a702b0..f7815da7 100644 --- a/Ada95/gen/terminal_interface-curses-menus-menu_user_data.ads.m4 +++ b/Ada95/gen/terminal_interface-curses-menus-menu_user_data.ads.m4 @@ -9,51 +9,62 @@ include(M4MACRO)dnl -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.2 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ generic type User is limited private; type User_Access is access User; package Terminal_Interface.Curses.Menus.Menu_User_Data is + pragma Preelaborate (Menu_User_Data); - -- The binding uses the C level user pointer already for its own - -- internal purposes. So you can´t easily manipulate the user pointer - -- with the low level C routines for this menu without taking care of - -- this special situation. If you want to read or write with C routines - -- the user pointer of this menu, you should get first the low level - -- user pointer. This points to a record, that always has as its first - -- member the Ada95 user pointer for this menu. You should never change - -- the low level user pointer of an Ada created menu. - -- -- MANPAGE(`menu_userptr.3x') -- ANCHOR(`set_menu_userptr',`Set_User_Data') procedure Set_User_Data (Men : in Menu; Data : in User_Access); -- AKA - pragma Convention (C, Set_User_Data); + pragma Inline (Set_User_Data); -- ANCHOR(`menu_userptr',`Get_User_Data') procedure Get_User_Data (Men : in Menu; Data : out User_Access); -- AKA - pragma Convention (C, Get_User_Data); + + -- ANCHOR(`menu_userptr',`Get_User_Data') + function Get_User_Data (Men : in Menu) return User_Access; + -- AKA + -- Same as function + pragma Inline (Get_User_Data); end Terminal_Interface.Curses.Menus.Menu_User_Data; diff --git a/Ada95/gen/terminal_interface-curses-menus.ads.m4 b/Ada95/gen/terminal_interface-curses-menus.ads.m4 index 2c1c42f1..d3e45920 100644 --- a/Ada95/gen/terminal_interface-curses-menus.ads.m4 +++ b/Ada95/gen/terminal_interface-curses-menus.ads.m4 @@ -9,23 +9,37 @@ include(M4MACRO)dnl -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.7 $ +-- $Revision: 1.12 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ include(`Menu_Base_Defs') with System; @@ -33,7 +47,7 @@ with Interfaces.C; with Ada.Characters.Latin_1; package Terminal_Interface.Curses.Menus is - + pragma Preelaborate (Menus); include(`Menu_Linker_Options') @@ -92,6 +106,9 @@ include(`Menu_Linker_Options') procedure Request_Name (Key : in Menu_Request_Code; Name : out String); + function Request_Name (Key : Menu_Request_Code) return String; + -- Same as function + ------------------ -- Exceptions -- ------------------ @@ -103,16 +120,17 @@ include(`Menu_Linker_Options') include(`Menu_Opt_Rep') - Default_Menu_Options : Menu_Option_Set; + function Default_Menu_Options return Menu_Option_Set; -- Initial default options for a menu. - + pragma Inline (Default_Menu_Options); -- -- Item options -- include(`Item_Rep') - Default_Item_Options : Item_Option_Set; + function Default_Item_Options return Item_Option_Set; -- Initial default options for an item. + pragma Inline (Default_Item_Options); -- -- Item Array @@ -120,7 +138,13 @@ include(`Item_Rep') type Item_Array is array (Positive range <>) of aliased Item; pragma Convention (C, Item_Array); - type Item_Array_Access is access all Item_Array; + type Item_Array_Access is access Item_Array; + + 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 + -- the array. -- MANPAGE(`mitem_new.3x') @@ -128,6 +152,7 @@ include(`Item_Rep') function Create (Name : String; Description : String := "") return Item; -- AKA + -- Not inlined. -- ANCHOR(`new_item()',`New_Item') function New_Item (Name : String; @@ -146,16 +171,19 @@ include(`Item_Rep') procedure Set_Value (Itm : in Item; Value : in Boolean := True); -- AKA + pragma Inline (Set_Value); -- ANCHOR(`item_value()',`Value') function Value (Itm : Item) return Boolean; -- AKA + pragma Inline (Value); -- MANPAGE(`mitem_visible.3x') -- ANCHOR(`item_visible()',`Visible') function Visible (Itm : Item) return Boolean; -- AKA + pragma Inline (Visible); -- MANPAGE(`mitem_opts.3x') @@ -163,6 +191,7 @@ include(`Item_Rep') procedure Set_Options (Itm : in Item; Options : in Item_Option_Set); -- AKA + -- An overloaded Set_Options is defined later. Pragma Inline appears there -- ANCHOR(`item_opts_on()',`Switch_Options') procedure Switch_Options (Itm : in Item; @@ -170,6 +199,8 @@ include(`Item_Rep') On : Boolean := True); -- AKA -- ALIAS(`item_opts_off()') + -- An overloaded Switch_Options is defined later. + -- Pragma Inline appears there -- ANCHOR(`item_opts()',`Get_Options') procedure Get_Options (Itm : in Item; @@ -179,6 +210,7 @@ include(`Item_Rep') -- ANCHOR(`item_opts()',`Get_Options') function Get_Options (Itm : Item := Null_Item) return Item_Option_Set; -- AKA + -- An overloaded Get_Options is defined later. Pragma Inline appears there -- MANPAGE(`mitem_name.3x') @@ -186,31 +218,44 @@ include(`Item_Rep') procedure Name (Itm : in Item; Name : out String); -- AKA + function Name (Itm : Item) return String; + -- AKA + -- Implemented as function + pragma Inline (Name); -- ANCHOR(`item_description();',`Description') procedure Description (Itm : in Item; Description : out String); -- AKA + function Description (Itm : Item) return String; + -- AKA + -- Implemented as function + pragma Inline (Description); + -- MANPAGE(`mitem_current.3x') -- ANCHOR(`set_current_item()',`Set_Current') procedure Set_Current (Men : in Menu; Itm : in Item); -- AKA + pragma Inline (Set_Current); -- ANCHOR(`current_item()',`Current') function Current (Men : Menu) return Item; -- AKA + pragma Inline (Current); -- ANCHOR(`set_top_row()',`Set_Top_Row') procedure Set_Top_Row (Men : in Menu; Line : in Line_Position); -- AKA + pragma Inline (Set_Top_Row); -- ANCHOR(`top_row()',`Top_Row') function Top_Row (Men : Menu) return Line_Position; -- AKA + pragma Inline (Top_Row); -- ANCHOR(`item_index()',`Get_Index') function Get_Index (Itm : Item) return Positive; @@ -218,6 +263,7 @@ include(`Item_Rep') -- Please note that in this binding we start the numbering of items -- with 1. So this is number is one more than you get from the low -- level call. + pragma Inline (Get_Index); -- MANPAGE(`menu_post.3x') @@ -226,6 +272,7 @@ include(`Item_Rep') Post : in Boolean := True); -- AKA -- ALIAS(`unpost_menu()') + pragma Inline (Post); -- MANPAGE(`menu_opts.3x') @@ -233,6 +280,7 @@ include(`Item_Rep') procedure Set_Options (Men : in Menu; Options : in Menu_Option_Set); -- AKA + pragma Inline (Set_Options); -- ANCHOR(`menu_opts_on()',`Switch_Options') procedure Switch_Options (Men : in Menu; @@ -240,6 +288,7 @@ include(`Item_Rep') On : Boolean := True); -- AKA -- ALIAS(`menu_opts_off()') + pragma Inline (Switch_Options); -- ANCHOR(`menu_opts()',`Get_Options') procedure Get_Options (Men : in Menu; @@ -249,6 +298,7 @@ include(`Item_Rep') -- ANCHOR(`menu_opts()',`Get_Options') function Get_Options (Men : Menu := Null_Menu) return Menu_Option_Set; -- AKA + pragma Inline (Get_Options); -- MANPAGE(`menu_win.3x') @@ -256,31 +306,37 @@ include(`Item_Rep') procedure Set_Window (Men : in Menu; Win : in Window); -- AKA + pragma Inline (Set_Window); -- ANCHOR(`menu_win()',`Get_Window') function Get_Window (Men : Menu) return Window; -- AKA + pragma Inline (Get_Window); -- ANCHOR(`set_menu_sub()',`Set_Sub_Window') procedure Set_Sub_Window (Men : in Menu; Win : in Window); -- AKA + pragma Inline (Set_Sub_Window); -- ANCHOR(`menu_sub()',`Get_Sub_Window') function Get_Sub_Window (Men : Menu) return Window; -- AKA + pragma Inline (Get_Sub_Window); -- ANCHOR(`scale_menu()',`Scale') procedure Scale (Men : in Menu; Lines : out Line_Count; Columns : out Column_Count); -- AKA + pragma Inline (Scale); -- MANPAGE(`menu_cursor.3x') -- ANCHOR(`pos_menu_cursor()',`Position_Cursor') procedure Position_Cursor (Men : Menu); -- AKA + pragma Inline (Position_Cursor); -- MANPAGE(`menu_mark.3x') @@ -288,12 +344,18 @@ include(`Item_Rep') procedure Set_Mark (Men : in Menu; Mark : in String); -- AKA + pragma Inline (Set_Mark); -- ANCHOR(`menu_mark()',`Mark') procedure Mark (Men : in Menu; Mark : out String); -- AKA + function Mark (Men : Menu) return String; + -- AKA + -- Implemented as function + pragma Inline (Mark); + -- MANPAGE(`menu_attribs.3x') -- ANCHOR(`set_menu_fore()',`Set_Foreground') @@ -302,6 +364,7 @@ include(`Item_Rep') Fore : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA + pragma Inline (Set_Foreground); -- ANCHOR(`menu_fore()',`Foreground') procedure Foreground (Men : in Menu; @@ -313,6 +376,7 @@ include(`Item_Rep') Fore : out Character_Attribute_Set; Color : out Color_Pair); -- AKA + pragma Inline (Foreground); -- ANCHOR(`set_menu_back()',`Set_Background') procedure Set_Background @@ -320,6 +384,7 @@ include(`Item_Rep') Back : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA + pragma Inline (Set_Background); -- ANCHOR(`menu_back()',`Background') procedure Background (Men : in Menu; @@ -331,6 +396,7 @@ include(`Item_Rep') Back : out Character_Attribute_Set; Color : out Color_Pair); -- AKA + pragma Inline (Background); -- ANCHOR(`set_menu_grey()',`Set_Grey') procedure Set_Grey @@ -338,6 +404,7 @@ include(`Item_Rep') Grey : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA + pragma Inline (Set_Grey); -- ANCHOR(`menu_grey()',`Grey') procedure Grey (Men : in Menu; @@ -350,16 +417,19 @@ include(`Item_Rep') Grey : out Character_Attribute_Set; Color : out Color_Pair); -- AKA + pragma Inline (Grey); -- ANCHOR(`set_menu_pad()',`Set_Pad_Character') procedure Set_Pad_Character (Men : in Menu; Pad : in Character := Space); -- AKA + pragma Inline (Set_Pad_Character); -- ANCHOR(`menu_pad()',`Pad_Character') procedure Pad_Character (Men : in Menu; Pad : out Character); -- AKA + pragma Inline (Pad_Character); -- MANPAGE(`menu_spacing.3x') @@ -369,6 +439,7 @@ include(`Item_Rep') Row : in Line_Position := 0; Col : in Column_Position := 0); -- AKA + pragma Inline (Set_Spacing); -- ANCHOR(`menu_spacing()',`Spacing') procedure Spacing (Men : in Menu; @@ -376,6 +447,7 @@ include(`Item_Rep') Row : out Line_Position; Col : out Column_Position); -- AKA + pragma Inline (Spacing); -- MANPAGE(`menu_pattern.3x') @@ -384,11 +456,13 @@ include(`Item_Rep') Text : String) return Boolean; -- AKA -- Return TRUE if the pattern matches, FALSE otherwise + pragma Inline (Set_Pattern); -- ANCHOR(`menu_pattern()',`Pattern') procedure Pattern (Men : in Menu; Text : out String); -- AKA + pragma Inline (Pattern); -- MANPAGE(`menu_format.3x') @@ -397,12 +471,14 @@ include(`Item_Rep') Lines : in Line_Count; Columns : in Column_Count); -- AKA + pragma Inline (Set_Format); -- ANCHOR(`menu_format()',`Format') procedure Format (Men : in Menu; Lines : out Line_Count; Columns : out Column_Count); -- AKA + pragma Inline (Format); -- MANPAGE(`menu_hook.3x') @@ -413,70 +489,83 @@ include(`Item_Rep') procedure Set_Item_Init_Hook (Men : in Menu; Proc : in Menu_Hook_Function); -- AKA + pragma Inline (Set_Item_Init_Hook); -- ANCHOR(`set_item_term()',`Set_Item_Term_Hook') procedure Set_Item_Term_Hook (Men : in Menu; Proc : in Menu_Hook_Function); -- AKA + pragma Inline (Set_Item_Term_Hook); -- ANCHOR(`set_menu_init()',`Set_Menu_Init_Hook') procedure Set_Menu_Init_Hook (Men : in Menu; Proc : in Menu_Hook_Function); -- AKA + pragma Inline (Set_Menu_Init_Hook); -- ANCHOR(`set_menu_term()',`Set_Menu_Term_Hook') procedure Set_Menu_Term_Hook (Men : in Menu; Proc : in Menu_Hook_Function); -- AKA + pragma Inline (Set_Menu_Term_Hook); -- ANCHOR(`item_init()',`Get_Item_Init_Hook') function Get_Item_Init_Hook (Men : Menu) return Menu_Hook_Function; -- AKA + pragma Inline (Get_Item_Init_Hook); -- ANCHOR(`item_term()',`Get_Item_Term_Hook') function Get_Item_Term_Hook (Men : Menu) return Menu_Hook_Function; -- AKA + pragma Inline (Get_Item_Term_Hook); -- ANCHOR(`menu_init()',`Get_Menu_Init_Hook') function Get_Menu_Init_Hook (Men : Menu) return Menu_Hook_Function; -- AKA + pragma Inline (Get_Menu_Init_Hook); -- ANCHOR(`menu_term()',`Get_Menu_Term_Hook') function Get_Menu_Term_Hook (Men : Menu) return Menu_Hook_Function; -- AKA + pragma Inline (Get_Menu_Term_Hook); -- MANPAGE(`menu_items.3x') -- ANCHOR(`set_menu_items()',`Redefine') procedure Redefine (Men : in Menu; - Items : in Item_Array); + Items : in Item_Array_Access); -- AKA - -- With a bit more comfort. You don´t need to terminate the Item_Array - -- with a null entry. This is handled internally in the binding. + pragma Inline (Redefine); procedure Set_Items (Men : in Menu; - Items : in Item_Array) renames Redefine; + Items : in Item_Array_Access) renames Redefine; + pragma Inline (Set_Items); -- ANCHOR(`menu_items()',`Items') - function Items (Men : Menu) return Item_Array_Access; + function Items (Men : Menu; + Index : Positive) return Item; -- AKA + pragma Inline (Items); -- ANCHOR(`item_count()',`Item_Count') function Item_Count (Men : Menu) return Natural; -- AKA + pragma Inline (Item_Count); -- MANPAGE(`menu_new.3x') -- ANCHOR(`new_menu()',`Create') - function Create (Items : Item_Array) return Menu; + function Create (Items : Item_Array_Access) return Menu; -- AKA + -- Not inlined - function New_Menu (Items : Item_Array) return Menu renames Create; + function New_Menu (Items : Item_Array_Access) return Menu renames Create; -- ANCHOR(`free_menu()',`Delete') procedure Delete (Men : in out Menu); -- AKA -- Reset Men to Null_Menu + -- Not inlined -- MANPAGE(`menu_new.3x') @@ -489,6 +578,7 @@ include(`Item_Rep') function Driver (Men : Menu; Key : Key_Code) return Driver_Result; -- AKA + -- Driver is not inlined ------------------------------------------------------------------------------- private @@ -498,22 +588,4 @@ private Null_Item : constant Item := Item (System.Null_Address); Null_Menu : constant Menu := Menu (System.Null_Address); - -- This binding uses the original user pointer mechanism of a menu to store - -- specific informations about a menu. This wrapper record carries this - -- specifics and contains a field to maintain a new user pointer. Please - -- note that you must take this into account if you wan't to use the user - -- pointer mechanism of a menu created with this binding in low-level C - -- routines. - type Ada_User_Wrapper is - record - U : System.Address; - I : Item_Array_Access; - end record; - pragma Convention (C, Ada_User_Wrapper); - type Ada_User_Wrapper_Access is access all Ada_User_Wrapper; - pragma Controlled (Ada_User_Wrapper_Access); - - Generation_Bit_Order : constant System.Bit_Order := System.M4_BIT_ORDER; - -- This constant may be different on your system. - end Terminal_Interface.Curses.Menus; diff --git a/Ada95/gen/terminal_interface-curses-mouse.ads.m4 b/Ada95/gen/terminal_interface-curses-mouse.ads.m4 index f4a5928f..21f88e44 100644 --- a/Ada95/gen/terminal_interface-curses-mouse.ads.m4 +++ b/Ada95/gen/terminal_interface-curses-mouse.ads.m4 @@ -9,28 +9,43 @@ include(M4MACRO)dnl -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.6 $ +-- $Revision: 1.12 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ include(`Mouse_Base_Defs') with System; package Terminal_Interface.Curses.Mouse is + pragma Preelaborate (Mouse); -- MANPAGE(`curs_mouse.3x') -- Please note, that in ncurses-1.9.9e documentation mouse support @@ -59,6 +74,9 @@ package Terminal_Interface.Curses.Mouse is -- MANPAGE(`curs_mouse.3x') + function Has_Mouse return Boolean; + -- Return true if a mouse device is supported, false otherwise. + procedure Register_Reportable_Event (B : in Mouse_Button; S : in Button_State; @@ -66,19 +84,22 @@ package Terminal_Interface.Curses.Mouse is -- 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 -- with the Empty_Mask constant + pragma Inline (Register_Reportable_Event); -- ANCHOR(`mousemask()',`Start_Mouse') function Start_Mouse (Mask : Event_Mask := All_Events) return Event_Mask; -- AKA + pragma Inline (Start_Mouse); procedure End_Mouse; - pragma Import (C, End_Mouse, "_nc_ada_unregister_mouse"); -- Terminates the mouse + pragma Inline (End_Mouse); -- ANCHOR(`getmouse()',`Get_Mouse') function Get_Mouse return Mouse_Event; -- AKA + pragma Inline (Get_Mouse); procedure Get_Event (Event : in Mouse_Event; Y : out Line_Position; @@ -87,20 +108,24 @@ package Terminal_Interface.Curses.Mouse is State : out Button_State); -- !!! Warning: X and Y are screen coordinates. Due to ripped of lines they -- may not be identical to window coordinates. + pragma Inline (Get_Event); -- ANCHOR(`ungetmouse()',`Unget_Mouse') procedure Unget_Mouse (Event : in Mouse_Event); -- AKA + pragma Inline (Unget_Mouse); -- ANCHOR(`wenclose()',`Enclosed_In_Window') function Enclosed_In_Window (Win : Window := Standard_Window; Event : Mouse_Event) return Boolean; -- AKA -- But : use event instead of screen coordinates. + pragma Inline (Enclosed_In_Window); -- ANCHOR(`mouseinterval()',`Mouse_Interval') function Mouse_Interval (Msec : Natural := 200) return Natural; -- AKA + pragma Inline (Mouse_Interval); private type Event_Mask is new Interfaces.C.int; diff --git a/Ada95/gen/terminal_interface-curses-panels-user_data.ads.m4 b/Ada95/gen/terminal_interface-curses-panels-user_data.ads.m4 index 6d68cc23..3dd3dd41 100644 --- a/Ada95/gen/terminal_interface-curses-panels-user_data.ads.m4 +++ b/Ada95/gen/terminal_interface-curses-panels-user_data.ads.m4 @@ -9,29 +9,44 @@ include(M4MACRO)dnl -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.2 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ generic type User is limited private; type User_Access is access all User; package Terminal_Interface.Curses.Panels.User_Data is + pragma Preelaborate (User_Data); -- MANPAGE(`panel.3x') @@ -39,12 +54,17 @@ package Terminal_Interface.Curses.Panels.User_Data is procedure Set_User_Data (Pan : in Panel; Data : in User_Access); -- AKA - pragma Convention (C, Set_User_Data); + pragma Inline (Set_User_Data); -- ANCHOR(`panel_userptr',`Get_User_Data') procedure Get_User_Data (Pan : in Panel; Data : out User_Access); -- AKA - pragma Convention (C, Get_User_Data); + + -- ANCHOR(`panel_userptr',`Get_User_Data') + function Get_User_Data (Pan : in Panel) return User_Access; + -- AKA + -- Same as function + pragma Inline (Get_User_Data); end Terminal_Interface.Curses.Panels.User_Data; diff --git a/Ada95/gen/terminal_interface-curses-panels.ads.m4 b/Ada95/gen/terminal_interface-curses-panels.ads.m4 index c2503b1a..f9bfb2e0 100644 --- a/Ada95/gen/terminal_interface-curses-panels.ads.m4 +++ b/Ada95/gen/terminal_interface-curses-panels.ads.m4 @@ -9,28 +9,42 @@ include(M4MACRO)dnl -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.2 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with System; package Terminal_Interface.Curses.Panels is - + pragma Preelaborate (Panels); include(`Panel_Linker_Options') type Panel is private; @@ -51,22 +65,27 @@ include(`Panel_Linker_Options') -- ANCHOR(`new_panel()',`Create') function Create (Win : Window) return Panel; -- AKA + pragma Inline (Create); -- ANCHOR(`new_panel()',`New_Panel') function New_Panel (Win : Window) return Panel renames Create; -- AKA + pragma Inline (New_Panel); -- ANCHOR(`bottom_panel()',`Bottom') procedure Bottom (Pan : in Panel); -- AKA + pragma Inline (Bottom); -- ANCHOR(`top_panel()',`Top') procedure Top (Pan : in Panel); -- AKA + pragma Inline (Top); -- ANCHOR(`show_panel()',`Show') procedure Show (Pan : in Panel); -- AKA + pragma Inline (Show); -- ANCHOR(`update_panels()',`Update_Panels') procedure Update_Panels; @@ -76,28 +95,34 @@ include(`Panel_Linker_Options') -- ANCHOR(`hide_panel()',`Hide') procedure Hide (Pan : in Panel); -- AKA + pragma Inline (Hide); -- ANCHOR(`panel_window()',`Get_Window') function Get_Window (Pan : Panel) return Window; -- AKA + pragma Inline (Get_Window); -- ANCHOR(`panel_window()',`Panel_Window') function Panel_Window (Pan : Panel) return Window renames Get_Window; + pragma Inline (Panel_Window); -- ANCHOR(`replace_panel()',`Replace') procedure Replace (Pan : in Panel; Win : in Window); -- AKA + pragma Inline (Replace); -- ANCHOR(`move_panel()',`Move') procedure Move (Pan : in Panel; Line : in Line_Position; Column : in Column_Position); -- AKA + pragma Inline (Move); -- ANCHOR(`panel_hidden()',`Is_Hidden') function Is_Hidden (Pan : Panel) return Boolean; -- AKA + pragma Inline (Is_Hidden); -- ANCHOR(`panel_above()',`Above') function Above (Pan : Panel) return Panel; @@ -112,6 +137,7 @@ include(`Panel_Linker_Options') -- ANCHOR(`del_panel()',`Delete') procedure Delete (Pan : in out Panel); -- AKA + pragma Inline (Delete); private type Panel is new System.Address; diff --git a/Ada95/gen/terminal_interface-curses.ads.m4 b/Ada95/gen/terminal_interface-curses.ads.m4 index e4f7ce9d..65bbbd75 100644 --- a/Ada95/gen/terminal_interface-curses.ads.m4 +++ b/Ada95/gen/terminal_interface-curses.ads.m4 @@ -8,31 +8,46 @@ include(M4MACRO)---------------------------------------------------------------- -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control: --- $Revision: 1.7 $ +-- $Revision: 1.15 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ include(`Base_Defs') with System; with Interfaces.C; -- We need this for some assertions. package Terminal_Interface.Curses is - + pragma Preelaborate (Curses); include(`Linker_Options') +include(`Version_Info') type Window is private; Null_Window : constant Window; @@ -127,7 +142,8 @@ include(`AC_Rep') ------------------ -- 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. @@ -195,15 +211,20 @@ include(`ACS_Map') -- ANCHOR(`initscr()',`Init_Windows') procedure Init_Windows renames Init_Screen; -- AKA + pragma Inline (Init_Screen); + pragma Inline (Init_Windows); -- ANCHOR(`endwin()',`End_Windows') procedure End_Windows; -- AKA procedure End_Screen renames End_Windows; + pragma Inline (End_Windows); + pragma Inline (End_Screen); -- ANCHOR(`isendwin()',`Is_End_Window') function Is_End_Window return Boolean; -- AKA + pragma Inline (Is_End_Window); -- MANPAGE(`curs_move.3x') @@ -212,6 +233,7 @@ include(`ACS_Map') Line : in Line_Position; Column : in Column_Position); -- AKA + pragma Inline (Move_Cursor); -- MANPAGE(`curs_addch.3x') @@ -239,6 +261,7 @@ include(`ACS_Map') 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 -- ANCHOR(`wechochar()',`Add_With_Immediate_Echo') procedure Add_With_Immediate_Echo @@ -250,6 +273,7 @@ include(`ACS_Map') (Win : in Window := Standard_Window; Ch : in Character); -- Add a character and do an immediate resfresh of the screen. + pragma Inline (Add_With_Immediate_Echo); -- MANPAGE(`curs_window.3x') @@ -260,6 +284,7 @@ include(`ACS_Map') First_Line_Position : Line_Position; First_Column_Position : Column_Position) return Window; -- AKA + pragma Inline (Create); function New_Window (Number_Of_Lines : Line_Count; @@ -267,11 +292,13 @@ include(`ACS_Map') First_Line_Position : Line_Position; First_Column_Position : Column_Position) return Window renames Create; + pragma Inline (New_Window); -- ANCHOR(`delwin()',`Delete') procedure Delete (Win : in out Window); -- AKA -- Reset Win to Null_Window + pragma Inline (Delete); -- ANCHOR(`subwin()',`Sub_Window') function Sub_Window @@ -281,6 +308,7 @@ include(`ACS_Map') First_Line_Position : Line_Position; First_Column_Position : Column_Position) return Window; -- AKA + pragma Inline (Sub_Window); -- ANCHOR(`derwin()',`Derived_Window') function Derived_Window @@ -290,22 +318,26 @@ include(`ACS_Map') First_Line_Position : Line_Position; First_Column_Position : Column_Position) return Window; -- AKA + pragma Inline (Derived_Window); -- ANCHOR(`dupwin()',`Duplicate') function Duplicate (Win : Window) return Window; -- AKA + pragma Inline (Duplicate); -- ANCHOR(`mvwin()',`Move_Window') procedure Move_Window (Win : in Window; Line : in Line_Position; Column : in Column_Position); -- AKA + pragma Inline (Move_Window); -- ANCHOR(`mvderwin()',`Move_Derived_Window') procedure Move_Derived_Window (Win : in Window; Line : in Line_Position; Column : in Column_Position); -- AKA + pragma Inline (Move_Derived_Window); -- ANCHOR(`wsyncup()',`Synchronize_Upwards') procedure Synchronize_Upwards (Win : in Window); @@ -321,6 +353,7 @@ include(`ACS_Map') procedure Set_Synch_Mode (Win : in Window := Standard_Window; Mode : in Boolean := False); -- AKA + pragma Inline (Set_Synch_Mode); -- MANPAGE(`curs_addstr.3x') @@ -357,6 +390,7 @@ include(`ACS_Map') Len : in Integer := -1); -- AKA -- ALIAS(`mvwaddchstr()') + pragma Inline (Add); -- MANPAGE(`curs_border.3x') @@ -373,6 +407,7 @@ include(`ACS_Map') Lower_Right_Corner_Symbol : in Attributed_Character := Default_Character ); -- AKA + pragma Inline (Border); -- ANCHOR(`box()',`Box') procedure Box @@ -380,6 +415,7 @@ include(`ACS_Map') Vertical_Symbol : in Attributed_Character := Default_Character; Horizontal_Symbol : in Attributed_Character := Default_Character); -- AKA + pragma Inline (Box); -- ANCHOR(`whline()',`Horizontal_Line') procedure Horizontal_Line @@ -387,6 +423,7 @@ include(`ACS_Map') Line_Size : in Natural; Line_Symbol : in Attributed_Character := Default_Character); -- AKA + pragma Inline (Horizontal_Line); -- ANCHOR(`wvline()',`Vertical_Line') procedure Vertical_Line @@ -394,6 +431,7 @@ include(`ACS_Map') Line_Size : in Natural; Line_Symbol : in Attributed_Character := Default_Character); -- AKA + pragma Inline (Vertical_Line); -- MANPAGE(`curs_getch.3x') @@ -405,19 +443,24 @@ include(`ACS_Map') -- window. -- If for any reason (i.e. a timeout) we couldn't get a character the -- returned keycode is Key_None. + pragma Inline (Get_Keystroke); -- ANCHOR(`ungetch()',`Undo_Keystroke') procedure Undo_Keystroke (Key : in Real_Key_Code); -- AKA + pragma Inline (Undo_Keystroke); -- ANCHOR(`has_key()',`Has_Key') function Has_Key (Key : Special_Key_Code) return Boolean; -- AKA + pragma Inline (Has_Key); + -- | -- | Some helper functions -- | function Is_Function_Key (Key : Special_Key_Code) return Boolean; -- Return True if the Key is a function key (i.e. one of F0 .. F63) + pragma Inline (Is_Function_Key); subtype Function_Key_Number is Integer range 0 .. 63; -- (n)curses allows for 64 function keys. @@ -425,9 +468,11 @@ include(`ACS_Map') function Function_Key (Key : Real_Key_Code) return Function_Key_Number; -- Return the number of the function key. If the code is not a -- function key, a CONSTRAINT_ERROR will be raised. + pragma Inline (Function_Key); function Function_Key_Code (Key : Function_Key_Number) return Real_Key_Code; -- Return the key code for a given functionkey number. + pragma Inline (Function_Key_Code); -- MANPAGE(`curs_attr.3x') @@ -445,8 +490,9 @@ include(`ACS_Map') Attr : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA + pragma Inline (Set_Character_Attributes); - -- ANCHOR(`wattr_get()',`Get_Character_Attribute') + -- ANCHOR(`wattr_get()',`Get_Character_Attributes') function Get_Character_Attribute (Win : in Window := Standard_Window) return Character_Attribute_Set; -- AKA @@ -455,6 +501,7 @@ include(`ACS_Map') function Get_Character_Attribute (Win : in Window := Standard_Window) return Color_Pair; -- AKA + pragma Inline (Get_Character_Attribute); -- ANCHOR(`wchgat()',`Change_Attributes') procedure Change_Attributes @@ -473,16 +520,19 @@ include(`ACS_Map') Attr : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA + pragma Inline (Change_Attributes); -- MANPAGE(`curs_beep.3x') -- ANCHOR(`beep()',`Beep') procedure Beep; -- AKA + pragma Inline (Beep); -- ANCHOR(`flash()',`Flash_Screen') procedure Flash_Screen; -- AKA + pragma Inline (Flash_Screen); -- MANPAGE(`curs_inopts.3x') @@ -492,38 +542,45 @@ include(`ACS_Map') procedure Set_Cbreak_Mode (SwitchOn : in Boolean := True); -- AKA -- ALIAS(`nocbreak()') + pragma Inline (Set_Cbreak_Mode); -- ANCHOR(`raw()',`Set_Raw_Mode') procedure Set_Raw_Mode (SwitchOn : in Boolean := True); -- AKA -- ALIAS(`noraw()') + pragma Inline (Set_Raw_Mode); -- ANCHOR(`echo()',`Set_Echo_Mode') procedure Set_Echo_Mode (SwitchOn : in Boolean := True); -- AKA -- ALIAS(`noecho()') + pragma Inline (Set_Echo_Mode); -- ANCHOR(`meta()',`Set_Meta_Mode') procedure Set_Meta_Mode (Win : in Window := Standard_Window; SwitchOn : in Boolean := True); -- AKA + pragma Inline (Set_Meta_Mode); -- ANCHOR(`keypad()',`Set_KeyPad_Mode') procedure Set_KeyPad_Mode (Win : in Window := Standard_Window; SwitchOn : in Boolean := True); -- AKA + pragma Inline (Set_KeyPad_Mode); type Half_Delay_Amount is range 1 .. 255; -- ANCHOR(`halfdelay()',`Half_Delay') procedure Half_Delay (Amount : in Half_Delay_Amount); -- AKA + pragma Inline (Half_Delay); -- ANCHOR(`intrflush()',`Set_Flush_On_Interrupt_Mode') procedure Set_Flush_On_Interrupt_Mode (Win : in Window := Standard_Window; Mode : in Boolean := True); -- AKA + pragma Inline (Set_Flush_On_Interrupt_Mode); -- ANCHOR(`qiflush()',`Set_Queue_Interrupt_Mode') procedure Set_Queue_Interrupt_Mode @@ -531,12 +588,14 @@ include(`ACS_Map') Flush : in Boolean := True); -- AKA -- ALIAS(`noqiflush()') + pragma Inline (Set_Queue_Interrupt_Mode); -- ANCHOR(`nodelay()',`Set_NoDelay_Mode') procedure Set_NoDelay_Mode (Win : in Window := Standard_Window; Mode : in Boolean := False); -- AKA + pragma Inline (Set_NoDelay_Mode); type Timeout_Mode is (Blocking, Non_Blocking, Delayed); @@ -549,12 +608,14 @@ include(`ACS_Map') -- introduce the Timeout_Mode parameter. This should improve -- readability. For Blocking and Non_Blocking, the Amount is not -- evaluated. + -- We don't inline this procedure. -- ANCHOR(`notimeout()',`Set_Escape_Time_Mode') procedure Set_Escape_Timer_Mode (Win : in Window := Standard_Window; Timer_Off : in Boolean := False); -- AKA + pragma Inline (Set_Escape_Timer_Mode); -- MANPAGE(`curs_outopts.3x') @@ -562,45 +623,53 @@ include(`ACS_Map') procedure Set_NL_Mode (SwitchOn : in Boolean := True); -- AKA -- ALIAS(`nonl()') + pragma Inline (Set_NL_Mode); -- ANCHOR(`clearok()',`Clear_On_Next_Update') procedure Clear_On_Next_Update (Win : in Window := Standard_Window; Do_Clear : in Boolean := True); -- AKA + pragma Inline (Clear_On_Next_Update); -- ANCHOR(`idlok()',`Use_Insert_Delete_Line') procedure Use_Insert_Delete_Line (Win : in Window := Standard_Window; Do_Idl : in Boolean := True); -- AKA + pragma Inline (Use_Insert_Delete_Line); -- ANCHOR(`idcok()',`Use_Insert_Delete_Character') procedure Use_Insert_Delete_Character (Win : in Window := Standard_Window; Do_Idc : in Boolean := True); -- AKA + pragma Inline (Use_Insert_Delete_Character); -- ANCHOR(`leaveok()',`Leave_Cursor_After_Update') procedure Leave_Cursor_After_Update (Win : in Window := Standard_Window; Do_Leave : in Boolean := True); -- AKA + pragma Inline (Leave_Cursor_After_Update); -- ANCHOR(`immedok()',`Immediate_Update_Mode') procedure Immediate_Update_Mode (Win : in Window := Standard_Window; Mode : in Boolean := False); -- AKA + pragma Inline (Immediate_Update_Mode); -- ANCHOR(`scrollok()',`Allow_Scrolling') procedure Allow_Scrolling (Win : in Window := Standard_Window; Mode : in Boolean := False); -- AKA + pragma Inline (Allow_Scrolling); function Scrolling_Allowed (Win : Window := Standard_Window) return Boolean; -- There is no such function in the C interface. + pragma Inline (Scrolling_Allowed); -- ANCHOR(`wsetscrreg()',`Set_Scroll_Region') procedure Set_Scroll_Region @@ -608,21 +677,27 @@ include(`ACS_Map') Top_Line : in Line_Position; Bottom_Line : in Line_Position); -- AKA + pragma Inline (Set_Scroll_Region); -- MANPAGE(`curs_refresh.3x') -- ANCHOR(`doupdate()',`Update_Screen') procedure Update_Screen; -- AKA + pragma Inline (Update_Screen); -- ANCHOR(`wrefresh()',`Refresh') procedure Refresh (Win : in Window := Standard_Window); -- AKA + -- There is an overloaded Refresh for Pads. + -- The Inline pragma appears there -- ANCHOR(`wnoutrefresh()',`Refresh_Without_Update') procedure Refresh_Without_Update (Win : in Window := Standard_Window); -- AKA + -- There is an overloaded Refresh_Without_Update for Pads. + -- The Inline pragma appears there -- ANCHOR(`redrawwin()',`Redraw') procedure Redraw (Win : in Window := Standard_Window); @@ -633,27 +708,32 @@ include(`ACS_Map') Begin_Line : in Line_Position; Line_Count : in Positive); -- AKA + pragma Inline (Redraw); -- MANPAGE(`curs_clear.3x') -- ANCHOR(`werase()',`Erase') procedure Erase (Win : in Window := Standard_Window); -- AKA + pragma Inline (Erase); -- ANCHOR(`wclear()',`Clear') procedure Clear (Win : in Window := Standard_Window); -- AKA + pragma Inline (Clear); -- ANCHOR(`wclrtobot()',`Clear_To_End_Of_Screen') procedure Clear_To_End_Of_Screen (Win : in Window := Standard_Window); -- AKA + pragma Inline (Clear_To_End_Of_Screen); -- ANCHOR(`wclrtoeol()',`Clear_To_End_Of_Line') procedure Clear_To_End_Of_Line (Win : in Window := Standard_Window); -- AKA + pragma Inline (Clear_To_End_Of_Line); -- MANPAGE(`curs_bkgd.3x') @@ -662,33 +742,38 @@ include(`ACS_Map') (Win : in Window := Standard_Window; Ch : in Attributed_Character); -- AKA + pragma Inline (Set_Background); -- ANCHOR(`wbkgd()',`Change_Background') procedure Change_Background (Win : in Window := Standard_Window; Ch : in Attributed_Character); -- AKA + pragma Inline (Change_Background); -- ANCHOR(`wbkgdget()',`Get_Background') function Get_Background (Win : Window := Standard_Window) return Attributed_Character; -- AKA + pragma Inline (Get_Background); -- MANPAGE(`curs_touch.3x') - -- ANCHOR(`touchwin()',`Touch') - procedure Touch (Win : in Window := Standard_Window); - -- AKA - -- ANCHOR(`untouchwin()',`Untouch') procedure Untouch (Win : in Window := Standard_Window); -- AKA + pragma Inline (Untouch); + + -- ANCHOR(`touchwin()',`Touch') + procedure Touch (Win : in Window := Standard_Window); + -- AKA -- ANCHOR(`touchline()',`Touch') procedure Touch (Win : in Window := Standard_Window; Start : in Line_Position; Count : in Positive); -- AKA + pragma Inline (Touch); -- ANCHOR(`wtouchln()',`Change_Line_Status') procedure Change_Lines_Status (Win : in Window := Standard_Window; @@ -696,6 +781,7 @@ include(`ACS_Map') Count : in Positive; State : in Boolean); -- AKA + pragma Inline (Change_Lines_Status); -- ANCHOR(`is_linetouched()',`Is_Touched') function Is_Touched (Win : Window := Standard_Window; @@ -705,6 +791,7 @@ include(`ACS_Map') -- ANCHOR(`is_wintouched()',`Is_Touched') function Is_Touched (Win : Window := Standard_Window) return Boolean; -- AKA + pragma Inline (Is_Touched); -- MANPAGE(`curs_overlay.3x') @@ -720,16 +807,19 @@ include(`ACS_Map') Destination_Right_Column : in Column_Position; Non_Destructive_Mode : in Boolean := True); -- AKA + pragma Inline (Copy); -- ANCHOR(`overwrite()',`Overwrite') procedure Overwrite (Source_Window : in Window; Destination_Window : in Window); -- AKA + pragma Inline (Overwrite); -- ANCHOR(`overlay()',`Overlay') procedure Overlay (Source_Window : in Window; Destination_Window : in Window); -- AKA + pragma Inline (Overlay); -- MANPAGE(`curs_deleteln.3x') @@ -738,14 +828,17 @@ include(`ACS_Map') (Win : in Window := Standard_Window; Lines : in Integer := 1); -- default is to insert one line above -- AKA + pragma Inline (Insert_Delete_Lines); -- ANCHOR(`wdeleteln()',`Delete_Line') procedure Delete_Line (Win : in Window := Standard_Window); -- AKA + pragma Inline (Delete_Line); -- ANCHOR(`winsertln()',`Insert_Line') procedure Insert_Line (Win : in Window := Standard_Window); -- AKA + pragma Inline (Insert_Line); -- MANPAGE(`curs_getyx.3x') @@ -755,6 +848,7 @@ include(`ACS_Map') Number_Of_Lines : out Line_Count; Number_Of_Columns : out Column_Count); -- AKA + pragma Inline (Get_Size); -- ANCHOR(`getbegyx()',`Get_Window_Position') procedure Get_Window_Position @@ -762,6 +856,7 @@ include(`ACS_Map') Top_Left_Line : out Line_Position; Top_Left_Column : out Column_Position); -- AKA + pragma Inline (Get_Window_Position); -- ANCHOR(`getyx()',`Get_Cursor_Position') procedure Get_Cursor_Position @@ -769,6 +864,7 @@ include(`ACS_Map') Line : out Line_Position; Column : out Column_Position); -- AKA + pragma Inline (Get_Cursor_Position); -- ANCHOR(`getparyx()',`Get_Origin_Relative_To_Parent') procedure Get_Origin_Relative_To_Parent @@ -779,6 +875,7 @@ include(`ACS_Map') -- AKA -- Instead of placing -1 in the coordinates as return, we use a boolean -- to return the info that the window has no parent. + pragma Inline (Get_Origin_Relative_To_Parent); -- MANPAGE(`curs_pad.3x') @@ -786,6 +883,7 @@ include(`ACS_Map') function New_Pad (Lines : Line_Count; Columns : Column_Count) return Window; -- AKA + pragma Inline (New_Pad); -- ANCHOR(`subpad()',`Sub_Pad') function Sub_Pad @@ -795,6 +893,7 @@ include(`ACS_Map') First_Line_Position : Line_Position; First_Column_Position : Column_Position) return Window; -- AKA + pragma Inline (Sub_Pad); -- ANCHOR(`prefresh()',`Refresh') procedure Refresh @@ -806,6 +905,7 @@ include(`ACS_Map') Destination_Bottom_Row : in Line_Position; Destination_Right_Column : in Column_Position); -- AKA + pragma Inline (Refresh); -- ANCHOR(`pnoutrefresh()',`Refresh_Without_Update') procedure Refresh_Without_Update @@ -817,6 +917,7 @@ include(`ACS_Map') Destination_Bottom_Row : in Line_Position; Destination_Right_Column : in Column_Position); -- AKA + pragma Inline (Refresh_Without_Update); -- ANCHOR(`pechochar()',`Add_Character_To_Pad_And_Echo_It') procedure Add_Character_To_Pad_And_Echo_It @@ -827,6 +928,7 @@ include(`ACS_Map') procedure Add_Character_To_Pad_And_Echo_It (Pad : in Window; Ch : in Character); + pragma Inline (Add_Character_To_Pad_And_Echo_It); -- MANPAGE(`curs_scroll.3x') @@ -834,6 +936,7 @@ include(`ACS_Map') procedure Scroll (Win : in Window := Standard_Window; Amount : in Integer := 1); -- AKA + pragma Inline (Scroll); -- MANPAGE(`curs_delch.3x') @@ -847,6 +950,7 @@ include(`ACS_Map') Line : in Line_Position; Column : in Column_Position); -- AKA + pragma Inline (Delete_Character); -- MANPAGE(`curs_inch.3x') @@ -861,6 +965,7 @@ include(`ACS_Map') Line : Line_Position; Column : Column_Position) return Attributed_Character; -- AKA + -- More Peek's follow, pragma Inline appears later. -- MANPAGE(`curs_winch.3x') @@ -893,6 +998,7 @@ include(`ACS_Map') Len : in Integer := -1); -- AKA -- ALIAS(`mvwinsstr()') + pragma Inline (Insert); -- MANPAGE(`curs_instr.3x') @@ -929,6 +1035,7 @@ include(`ACS_Map') Len : in Integer := -1); -- AKA -- ALIAS(`mvwinchstr()') + -- We don't inline the Peek procedures -- MANPAGE(`curs_getstr.3x') @@ -944,8 +1051,10 @@ include(`ACS_Map') Column : in Column_Position; Str : out String; Len : in Integer := -1); - -- AKA: not specified in ncurses, should be: mvwgetnstr() + -- AKA + -- not specified in ncurses, should be: mvwgetnstr() -- and mvwgetstr() (which exists) + -- Get is not inlined -- MANPAGE(`curs_slk.3x') @@ -960,37 +1069,50 @@ include(`ACS_Map') procedure Init_Soft_Label_Keys (Format : in Soft_Label_Key_Format := Three_Two_Three); -- AKA + pragma Inline (Init_Soft_Label_Keys); -- ANCHOR(`slk_set()',`Set_Soft_Label_Key') procedure Set_Soft_Label_Key (Label : in Label_Number; Text : in String; Fmt : in Label_Justification := Left); -- AKA + -- We don't inline this procedure -- ANCHOR(`slk_refresh()',`Refresh_Soft_Label_Key') procedure Refresh_Soft_Label_Keys; -- AKA + pragma Inline (Refresh_Soft_Label_Keys); -- ANCHOR(`slk_noutrefresh()',`Refresh_Soft_Label_Keys_Without_Update') procedure Refresh_Soft_Label_Keys_Without_Update; -- AKA + pragma Inline (Refresh_Soft_Label_Keys_Without_Update); -- ANCHOR(`slk_label()',`Get_Soft_Label_Key') procedure Get_Soft_Label_Key (Label : in Label_Number; Text : out String); -- AKA + -- ANCHOR(`slk_label()',`Get_Soft_Label_Key') + function Get_Soft_Label_Key (Label : in Label_Number) return String; + -- AKA + -- Same as function + pragma Inline (Get_Soft_Label_Key); + -- ANCHOR(`slk_clear()',`Clear_Soft_Label_Keys') procedure Clear_Soft_Label_Keys; -- AKA + pragma Inline (Clear_Soft_Label_Keys); -- ANCHOR(`slk_restore()',`Restore_Soft_Label_Keys') procedure Restore_Soft_Label_Keys; -- AKA + pragma Inline (Restore_Soft_Label_Keys); -- ANCHOR(`slk_touch()',`Touch_Soft_Label_Keys') procedure Touch_Soft_Label_Keys; -- AKA + pragma Inline (Touch_Soft_Label_Keys); -- ANCHOR(`slk_attron()',`Switch_Soft_Label_Key_Attributes') procedure Switch_Soft_Label_Key_Attributes @@ -998,12 +1120,14 @@ include(`ACS_Map') On : in Boolean := True); -- AKA -- ALIAS(`slk_attroff()') + pragma Inline (Switch_Soft_Label_Key_Attributes); -- ANCHOR(`slk_attrset()',`Set_Soft_Label_Key_Attributes') procedure Set_Soft_Label_Key_Attributes (Attr : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA + pragma Inline (Set_Soft_Label_Key_Attributes); -- ANCHOR(`slk_attr()',`Get_Soft_Label_Key_Attributes') function Get_Soft_Label_Key_Attributes return Character_Attribute_Set; @@ -1012,6 +1136,23 @@ include(`ACS_Map') -- ANCHOR(`slk_attr()',`Get_Soft_Label_Key_Attributes') function Get_Soft_Label_Key_Attributes return Color_Pair; -- AKA + pragma Inline (Get_Soft_Label_Key_Attributes); + + -- MANPAGE(`keyok.3x') + + -- ANCHOR(`keyok()',`Enable_Key') + procedure Enable_Key (Key : in Special_Key_Code; + Enable : in Boolean := True); + -- AKA + pragma Inline (Enable_Key); + + -- MANPAGE(`define_key.3x') + + -- ANCHOR(`define_key()',`Define_Key') + procedure Define_Key (Definition : in String; + Key : in Special_Key_Code); + -- AKA + pragma Inline (Define_Key); -- MANPAGE(`curs_util.3x') @@ -1023,53 +1164,85 @@ include(`ACS_Map') -- AKA -- The external name for a real keystroke. + -- ANCHOR(`keyname()',`Key_Name') + function Key_Name (Key : in Real_Key_Code) return String; + -- AKA + -- Same as function + -- We don't inline this routine + -- ANCHOR(`unctrl()',`Un_Control') procedure Un_Control (Ch : in Attributed_Character; Str : out String); -- AKA + -- ANCHOR(`unctrl()',`Un_Control') + function Un_Control (Ch : in Attributed_Character) return String; + -- AKA + -- Same as function + pragma Inline (Un_Control); + -- ANCHOR(`delay_output()',`Delay_Output') procedure Delay_Output (Msecs : in Natural); -- AKA + pragma Inline (Delay_Output); -- ANCHOR(`flushinp()',`Flush_Input') procedure Flush_Input; -- AKA + pragma Inline (Flush_Input); -- MANPAGE(`curs_termattrs.3x') -- ANCHOR(`baudrate()',`Baudrate') function Baudrate return Natural; -- AKA + pragma Inline (Baudrate); -- ANCHOR(`erasechar()',`Erase_Character') function Erase_Character return Character; -- AKA + pragma Inline (Erase_Character); -- ANCHOR(`killchar()',`Kill_Character') function Kill_Character return Character; -- AKA + pragma Inline (Kill_Character); -- ANCHOR(`has_ic()',`Has_Insert_Character') function Has_Insert_Character return Boolean; -- AKA + pragma Inline (Has_Insert_Character); -- ANCHOR(`has_il()',`Has_Insert_Line') function Has_Insert_Line return Boolean; -- AKA + pragma Inline (Has_Insert_Line); -- ANCHOR(`termattrs()',`Supported_Attributes') function Supported_Attributes return Character_Attribute_Set; -- AKA + pragma Inline (Supported_Attributes); -- ANCHOR(`longname()',`Long_Name') procedure Long_Name (Name : out String); -- AKA + -- ANCHOR(`longname()',`Long_Name') + function Long_Name return String; + -- AKA + -- Same as function + pragma Inline (Long_Name); + -- ANCHOR(`termname()',`Terminal_Name') procedure Terminal_Name (Name : out String); -- AKA + -- ANCHOR(`termname()',`Terminal_Name') + function Terminal_Name return String; + -- AKA + -- Same as function + pragma Inline (Terminal_Name); + -- MANPAGE(`curs_color.3x') -- ANCHOR(`start_clolor()',`Start_Color') @@ -1082,16 +1255,19 @@ include(`ACS_Map') Fore : in Color_Number; Back : in Color_Number); -- AKA + pragma Inline (Init_Pair); -- ANCHOR(`pair_content()',`Pair_Content') procedure Pair_Content (Pair : in Color_Pair; Fore : out Color_Number; Back : out Color_Number); -- AKA + pragma Inline (Pair_Content); -- ANCHOR(`has_colors()',`Has_Colors') function Has_Colors return Boolean; -- AKA + pragma Inline (Has_Colors); -- ANCHOR(`init_color()',`Init_Color') procedure Init_Color (Color : in Color_Number; @@ -1099,10 +1275,12 @@ include(`ACS_Map') Green : in RGB_Value; Blue : in RGB_Value); -- AKA + pragma Inline (Init_Color); -- ANCHOR(`can_change_color()',`Can_Change_Color') function Can_Change_Color return Boolean; -- AKA + pragma Inline (Can_Change_Color); -- ANCHOR(`color_content()',`Color_Content') procedure Color_Content (Color : in Color_Number; @@ -1110,6 +1288,7 @@ include(`ACS_Map') Green : out RGB_Value; Blue : out RGB_Value); -- AKA + pragma Inline (Color_Content); -- MANPAGE(`curs_kernel.3x') @@ -1121,19 +1300,23 @@ include(`ACS_Map') procedure Save_Curses_Mode (Mode : in Curses_Mode); -- AKA -- ALIAS(`def_shell_mode()') + pragma Inline (Save_Curses_Mode); -- ANCHOR(`reset_prog_mode()',`Reset_Curses_Mode') procedure Reset_Curses_Mode (Mode : in Curses_Mode); -- AKA -- ALIAS(`reset_shell_mode()') + pragma Inline (Reset_Curses_Mode); -- ANCHOR(`savetty()',`Save_Terminal_State') procedure Save_Terminal_State; -- AKA + pragma Inline (Save_Terminal_State); -- ANCHOR(`resetty();',`Reset_Terminal_State') procedure Reset_Terminal_State; -- AKA + pragma Inline (Reset_Terminal_State); type Stdscr_Init_Proc is access function (Win : Window; @@ -1151,16 +1334,19 @@ include(`ACS_Map') -- ripoffline(), in which the Lines argument absolute value is the -- number of lines to be ripped of. The official ripoffline() only -- uses the sign of Lines to rip of a single line from bottom or top. + pragma Inline (Rip_Off_Lines); type Cursor_Visibility is (Invisible, Normal, Very_Visible); -- ANCHOR(`curs_set()',`Set_Cursor_Visibility') procedure Set_Cursor_Visibility (Visibility : in out Cursor_Visibility); -- AKA + pragma Inline (Set_Cursor_Visibility); -- ANCHOR(`napms()',`Nap_Milli_Seconds') procedure Nap_Milli_Seconds (Ms : in Natural); -- AKA + pragma Inline (Nap_Milli_Seconds); -- |===================================================================== -- | Some usefull helpers. @@ -1176,12 +1362,10 @@ include(`ACS_Map') -- Screen coordinates are the position informations on the physical device. -- An Curses_Exception will be raised if Line and Column are not in the -- Window or if you pass the Null_Window as argument. + -- We don't inline this procedure private type Window is new System.Address; Null_Window : constant Window := Window (System.Null_Address); - Generation_Bit_Order : constant System.Bit_Order := System.M4_BIT_ORDER; - -- This constant may be different on your system. - end Terminal_Interface.Curses; diff --git a/Ada95/html/Makefile b/Ada95/html/Makefile deleted file mode 100644 index caf46e35..00000000 --- a/Ada95/html/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# Nothing to do in this directory - -all:: - @ - -clean:: - @ - -distclean:: clean - @ - -realclean:: clean - @ - -mostlyclean:: clean - @ - -install:: - @ diff --git a/Ada95/html/curs_addch.3x.html b/Ada95/html/curs_addch.3x.html index e739fc42..5903801e 100644 --- a/Ada95/html/curs_addch.3x.html +++ b/Ada95/html/curs_addch.3x.html @@ -74,8 +74,8 @@ ACS_RTEE + right tee ACS_LTEE + left tee ACS_BTEE + bottom tee ACS_TTEE + top tee ACS_HLINE - horizontal line ACS_VLINE | vertical - line ACS_PLUS + plus ACS_S1 - scan line 1 ACS_S9 - _ scan line 9 ACS_DIAMOND + diamond + line ACS_PLUS + plus ACS_S1 - scan line 1 + ACS_S9 _ scan line 9 ACS_DIAMOND + diamond ACS_CKBOARD : checker board (stipple) ACS_DEGREE ' degree symbol ACS_PLMINUS # plus/minus ACS_BULLET o bullet @@ -85,7 +85,7 @@ ACS_UARROW ^ arrow pointing up ACS_BOARD # board of squares ACS_LANTERN # lantern symbol ACS_BLOCK # solid square block ACS_S3 - scan line - 3 ACS_S7 - scan line 7 ACS_LEQUAL < less- + 3 ACS_S7 - scan line 7 ACS_LEQUAL < less- than-or-equal-to ACS_GEQUAL > greater-than-or- equal-to ACS_PI * greek pi ACS_NEQUAL ! not- equal ACS_STERLING f pound-sterling symbol diff --git a/Ada95/html/curs_attr.3x.html b/Ada95/html/curs_attr.3x.html index 6fe234c7..dd64b5b4 100644 --- a/Ada95/html/curs_attr.3x.html +++ b/Ada95/html/curs_attr.3x.html @@ -71,7 +71,7 @@ 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 of init_pair, see curs_color(3X)). The opts argument is not presently used, but is reserved for the future (leave it NULL). diff --git a/Ada95/html/curs_color.3x.html b/Ada95/html/curs_color.3x.html index a1f877be..dab8b2fe 100644 --- a/Ada95/html/curs_color.3x.html +++ b/Ada95/html/curs_color.3x.html @@ -145,7 +145,7 @@ 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). + or scrolling operations, see curs_bkgd(3X). Several caveats apply on 386 and 486 machines with VGA- compatible graphics: diff --git a/Ada95/html/curs_getch.3x.html b/Ada95/html/curs_getch.3x.html index a89c96e7..52d23976 100644 --- a/Ada95/html/curs_getch.3x.html +++ b/Ada95/html/curs_getch.3x.html @@ -92,42 +92,43 @@ KEY_CLOSE/Close key KEY_COMMAND/Cmd (command) key KEY_COPY/Copy key KEY_CREATE/Create key KEY_END/End key KEY_EXIT/Exit key KEY_FIND/Find key KEY_HELP/Help key - KEY_MARK/Mark key KEY_MESSAGE/Message key KEY_MOVE/Move - key KEY_NEXT/Next object key KEY_OPEN/Open key - KEY_OPTIONS/Options key KEY_PREVIOUS/Previous object key - KEY_REDO/Redo key KEY_REFERENCE/Ref(erence) key - KEY_REFRESH/Refresh key KEY_REPLACE/Replace key - KEY_RESTART/Restart key KEY_RESUME/Resume key + KEY_MARK/Mark key KEY_MESSAGE/Message key KEY_MOUSE/Mouse + event read KEY_MOVE/Move key KEY_NEXT/Next object key + KEY_OPEN/Open key KEY_OPTIONS/Options key KEY_PREVI- + OUS/Previous object key KEY_REDO/Redo key KEY_REFER- + ENCE/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_SCAN- - CEL/Shifted cancel key KEY_SCOMMAND/Shifted command key - KEY_SCOPY/Shifted copy key KEY_SCREATE/Shifted create key - KEY_SDC/Shifted delete char key KEY_SDL/Shifted delete - line key KEY_SELECT/Select key KEY_SEND/Shifted end key + CEL/Shifted cancel key KEY_SCOMMAND/Shifted command key + KEY_SCOPY/Shifted copy key KEY_SCREATE/Shifted create key + KEY_SDC/Shifted delete char key KEY_SDL/Shifted delete + line key KEY_SELECT/Select key KEY_SEND/Shifted end key KEY_SEOL/Shifted clear line key KEY_SEXIT/Shifted exit key KEY_SFIND/Shifted find key KEY_SHELP/Shifted help key - KEY_SHOME/Shifted home key KEY_SIC/Shifted input key + KEY_SHOME/Shifted home key KEY_SIC/Shifted input key KEY_SLEFT/Shifted left arrow key KEY_SMESSAGE/Shifted mes- sage key KEY_SMOVE/Shifted move key KEY_SNEXT/Shifted next - key KEY_SOPTIONS/Shifted options key KEY_SPREVIOUS/Shifted - KEY_SRIGHT/Shifted right arrow KEY_SRSUME/Shifted resume - key KEY_SSAVE/Shifted save key KEY_SSUSPEND/Shifted sus- - pend key KEY_SUNDO/Shifted undo key KEY_SUSPEND/Suspend + redo key KEY_SREPLACE/Shifted replace key + KEY_SRIGHT/Shifted right arrow KEY_SRSUME/Shifted resume + key KEY_SSAVE/Shifted save key KEY_SSUSPEND/Shifted sus- + pend key KEY_SUNDO/Shifted undo key KEY_SUSPEND/Suspend key KEY_UNDO/Undo key Keypad is arranged like this: - center allbox tab(/) ; c c c . A1/up/A3 left/B2/right + center allbox tab(/) ; c c c . A1/up/A3 left/B2/right C1/down/C3 The has_key routine takes a key value from the above list, - and returns TRUE or FALSE according as the current termi- + and returns TRUE or FALSE according as the current termi- nal type recognizes a key with that value.

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.
 
@@ -135,64 +136,63 @@
 

NOTES

        Use of the escape key by a programmer for a single charac-
-       ter  function  is discouraged, as it will cause a delay of
+       ter function is discouraged, as it will cause a  delay  of
        up to one second while the keypad code looks for a follow-
        ing function-key sequence.
 
-       When  using  getch, wgetch, mvgetch, or mvwgetch, nocbreak
+       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
+       the same time.  Depending on the state of the  tty  driver
+       when  each  character  is  typed,  the program may produce
        undesirable results.
 
        Note that getch, mvgetch, and mvwgetch may be macros.
 
        Historically, the set of keypad macros was largely defined
-       by the extremely function-key-rich keyboard  of  the  AT&T
-       7300,  aka  3B1,  aka Safari 4.  Modern personal computers
-       usually have only a small subset of these.   IBM  PC-style
-       consoles   typically  support  little  more  than  KEY_UP,
-       KEY_DOWN,   KEY_LEFT,   KEY_RIGHT,   KEY_HOME,    KEY_END,
+       by  the  extremely  function-key-rich keyboard of the AT&T
+       7300, aka 3B1, aka Safari 4.   Modern  personal  computers
+       usually  have  only a small subset of these.  IBM PC-style
+       consoles  typically  support  little  more  than   KEY_UP,
+       KEY_DOWN,    KEY_LEFT,   KEY_RIGHT,   KEY_HOME,   KEY_END,
        KEY_NPAGE, KEY_PPAGE, and function keys 1 through 12.  The
        Ins key is usually mapped to KEY_IC.
 
 
 

PORTABILITY

-       The *get* functions are described in the XSI Curses  stan-
-       dard,  Issue  4.   They  read single-byte characters only.
-       The standard specifies that they return  ERR  on  failure,
+       The  *get* functions are described in the XSI Curses stan-
+       dard, Issue 4.  They  read  single-byte  characters  only.
+       The  standard  specifies  that they return ERR on failure,
        but specifies no error conditions.
 
-       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
-       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
-       read(2)  call in progress or not, and also (in some imple-
-       mentations) depending on whether an input timeout or  non-
+       The echo behavior of these functions on input of  KEY_  or
+       backspace  characters  was not specified in the SVr4 docu-
+
+       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
+       read(2) call in progress or not, and also (in some  imple-
+       mentations)  depending on whether an input timeout or non-
        blocking mode hsd 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
-       causes it to return ERR with errno set  to  EINTR.   Under
-       the  ncurses  implementation, handled signals never inter-
+       for  either  of  two  cases:  (a)  signal receipt does not
+       interrupt 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
-       feature macro.
+       The  has_key  function is unique to ncurses.  We recommend
+       that  any  code  using  it  be  conditionalized   on   the
+       NCURSES_VERSION feature macro.
 
 
 

SEE ALSO

-       curses(3X),        curs_inopts(3X),         curs_move(3X),
-       curs_refresh(3X).
-
-
+       curses(3X),        curs_inopts(3X),        curs_mouse(3X),
+       curs_move(3X), curs_refresh(3X).  resizeterm(3X).
 
 
 
diff --git a/Ada95/html/curs_inch.3x.html b/Ada95/html/curs_inch.3x.html
index 093f99ad..cb7dd9be 100644
--- a/Ada95/html/curs_inch.3x.html
+++ b/Ada95/html/curs_inch.3x.html
@@ -30,8 +30,8 @@
        returned by winch.
 
        l  l  .   A_CHARTEXT     Bit-mask  to  extract   character
-       A_ATTRIBUTES   Bit-mask   to  extract  attributes  A_COLOR
-            Bit-mask to extract color-pair field information
+       A_ATTRIBUTES   Bit-mask      to     extract     attributes
+       A_COLOR   Bit-mask to extract color-pair field information
 
 
 
@@ -41,7 +41,7 @@

PORTABILITY

-       These functions are described in the XSI Curses  standard,
+       These  functions are described in the XSI Curses standard,
        Issue 4.
 
 
diff --git a/Ada95/html/curs_kernel.3x.html b/Ada95/html/curs_kernel.3x.html
index 82b012f7..fe706d52 100644
--- a/Ada95/html/curs_kernel.3x.html
+++ b/Ada95/html/curs_kernel.3x.html
@@ -3,7 +3,7 @@
 
        def_prog_mode,       def_shell_mode,      reset_prog_mode,
        reset_shell_mode, resetty, savetty, getsyx, setsyx, ripof-
-       fline, curs_set, napms - low-level xscurses routines
+       fline, curs_set, napms - low-level curses routines
 
 
 
diff --git a/Ada95/html/curs_mouse.3x.html b/Ada95/html/curs_mouse.3x.html index d328f533..82622ed8 100644 --- a/Ada95/html/curs_mouse.3x.html +++ b/Ada95/html/curs_mouse.3x.html @@ -28,7 +28,7 @@

DESCRIPTION

        These functions provide an interface to mouse events  from
-       ncurses(3x).   Mouse  events  are represented by KEY_MOUSE
+       ncurses(3X).   Mouse  events  are represented by KEY_MOUSE
        pseudo-key values in the wgetch input stream.
 
        To make mouse events visible, use the mousemask  function.
@@ -47,26 +47,28 @@
        Here are the mouse event type masks:
 
        l  l  _ _ l l.  Name Description BUTTON1_PRESSED     mouse
-       button 1 down BUTTON1_RELEASED    mouse button 1  up  BUT-
-       TON1_CLICKED        mouse       button      1      clicked
+       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
-       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 dur-
-       ing  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
+       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_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
 
        Once  a  class of mouse events have been made visible in a
        window, calling the wgetch function  on  that  window  may
@@ -109,10 +111,9 @@
        All  routines  return  the  integer ERR upon failure or OK
        upon successful completion.
 
-
-
-

PORTABILITY

-       These calls were designed for  ncurses(3x),  and  are  not
+       These calls were designed for  ncurses(3X),  and  are  not
+       found in SVr4 curses, 4.4BSD curses, or any other previous
+       version of curses.
 
        The feature macro NCURSES_MOUSE_VERSION is provided so the
        preprocessor  can  be  used to test whether these features
@@ -125,11 +126,11 @@
        teed.  Additional fields may be added to the structure  in
        the future.
 
-       Under  ncurses(3x),  these  calls  are  implemented  using
+       Under  ncurses(3X),  these  calls  are  implemented  using
        either xterm's built-in mouse-tracking API  or  Alessandro
        Rubini's  gpm  server.   If  you are using something other
        than xterm there is no gpm daemon running on your machine,
-       mouse  events  will not be visible to ncurses(3x) (and the
+       mouse  events  will not be visible to ncurses(3X) (and the
        wmousemask function will always return 0).
 
        The z member in the event structure is not presently used.
@@ -166,9 +167,6 @@
 
 
 
-
-
-
 
diff --git a/Ada95/html/curs_outopts.3x.html b/Ada95/html/curs_outopts.3x.html index 54e8aa71..7c5ec4bb 100644 --- a/Ada95/html/curs_outopts.3x.html +++ b/Ada95/html/curs_outopts.3x.html @@ -134,6 +134,10 @@ perform better vertical-motion optimization at wrefresh time. + The XSI Curses standard does not mention that the cursor + should be made invisible as a side-effect of leaveok. + SVr4 curses does this. +

NOTES

@@ -163,10 +167,6 @@
 
 
 
-
-
-
-
 
diff --git a/Ada95/html/curs_print.3x.html b/Ada95/html/curs_print.3x.html index fcf16ee0..9848edf9 100644 --- a/Ada95/html/curs_print.3x.html +++ b/Ada95/html/curs_print.3x.html @@ -48,7 +48,7 @@

PORTABILITY

-       The mcprint call was designed for ncurses(3x), and is  not
+       The mcprint call was designed for ncurses(3X), and is  not
        found in SVr4 curses, 4.4BSD curses, or any other previous
        version of curses.
 
diff --git a/Ada95/html/curs_refresh.3x.html b/Ada95/html/curs_refresh.3x.html
index ff6d9a33..9e44730f 100644
--- a/Ada95/html/curs_refresh.3x.html
+++ b/Ada95/html/curs_refresh.3x.html
@@ -62,16 +62,15 @@
 
        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) then does a refresh of the window.
-       The routine redrawwin() touches the entire window and then
-       refreshes it.
+       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.
 
 
@@ -82,16 +81,16 @@
 
 

PORTABILITY

-       The  XSI  Curses  standard,  Issue 4 describes these func-
+       The XSI Curses standard, Issue  4  describes  these  func-
        tions.
 
-       Whether wnoutrefresh() copies to the  virtual  screen  the
-       entire  contents  of a window or just its changed portions
+       Whether  wnoutrefresh()  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).   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
+       (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.
 
 
@@ -117,6 +116,7 @@
 
 
 
+
 
diff --git a/Ada95/html/curs_scanw.3x.html b/Ada95/html/curs_scanw.3x.html index c15106f6..5dfe2078 100644 --- a/Ada95/html/curs_scanw.3x.html +++ b/Ada95/html/curs_scanw.3x.html @@ -51,7 +51,7 @@

SEE ALSO

-       curses(3X), curs_getstr, curs_printw, scanf(3S)
+       curses(3X), curs_getstr(3X), curs_printw(3X), scanf(3S)
 
 
 
diff --git a/Ada95/html/curs_termcap.3x.html b/Ada95/html/curs_termcap.3x.html
index 1e336333..5f448c49 100644
--- a/Ada95/html/curs_termcap.3x.html
+++ b/Ada95/html/curs_termcap.3x.html
@@ -83,7 +83,7 @@
 
 

SEE ALSO

-       curses(3X), curs_terminfo(5), putc(3S).
+       curses(3X), terminfo(5), putc(3S).
 
 
 
diff --git a/Ada95/html/curs_terminfo.3x.html b/Ada95/html/curs_terminfo.3x.html
index e125d997..85d536f4 100644
--- a/Ada95/html/curs_terminfo.3x.html
+++ b/Ada95/html/curs_terminfo.3x.html
@@ -19,8 +19,6 @@
        int  restartterm(const  char  *term,   int   fildes,   int
        *errret);
        char *tparm(const char *str, ...);
-       char  *tparam(const  char  *str,  char  *buffer, int size,
-       ...);
        int tputs(const char *str, int affcnt, int (*putc)(int));
        int putp(const char *str);
        int vidputs(chtype attrs, int (*putc)(char));
@@ -33,96 +31,91 @@
 
 

DESCRIPTION

-       These  low-level  routines must be called by programs that
+       These low-level routines must be called by  programs  that
        have to deal directly with the terminfo database to handle
-       certain  terminal  capabilities, such as programming func-
-       tion keys.  For all other functionality,  curses  routines
+       certain terminal capabilities, such as  programming  func-
+       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
+       setupterm  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
-       use_env(FALSE) has  been  called,  values  for  lines  and
+       use_env(FALSE)  has  been  called,  values  for  lines and
        columns specified in terminfo are used.  Otherwise, if the
-       environment variables LINES and COLUMNS exist, their  val-
+       environment  variables LINES and COLUMNS exist, their val-
        ues are used.  If these environment variables do not exist
        and the program is running in a window, the current window
-       size  is used.  Otherwise, if the environment variables do
-       not exist, the values for lines and columns  specified  in
+       size is used.  Otherwise, if the environment variables  do
+       not  exist,  the values for lines and columns specified in
        the terminfo database are used.
 
-       The  header  files  curses.h and term.h should be included
-       (in this order) to get the definitions for these  strings,
+       The header files curses.h and term.h  should  be  included
+       (in  this order) to get the definitions for these strings,
        numbers,  and  flags.   Parameterized  strings  should  be
-       passed through tparm to instantiate  them.   All  terminfo
-       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
-       before exiting.  Programs desiring  shell  escapes  should
+       passed  through  tparm  to instantiate them.  All terminfo
+       strings [including the output of tparm] should be  printed
+       with  tputs or putp.  Call the reset_shell_mode to restore
+       enter_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_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.
 
        The setupterm routine reads in the terminfo database, ini-
        tializing the terminfo structures, but does not set up the
        output virtualization structures used by curses.  The ter-
-       minal type is the character string term; if term is  null,
-       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  status of 1 in errret is normal, 0 means that
-       the terminal could not be found, and  -1  means  that  the
-       terminfo  database could not be found.  If errret is null,
-       setupterm prints an error message upon  finding  an  error
+       minal  type is the character string term; if term is null,
+       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 status of 1 in errret is normal, 0  means  that
+       the  terminal  could  not  be found, and -1 means that the
+       terminfo database could not be found.  If errret is  null,
+       setupterm  prints  an  error message upon finding an error
        and exits.  Thus, the simplest call is:
 
              setupterm((char *)0, 1, (int *)0);,
 
-       which  uses  all the defaults and sends the output to std-
+       which uses all the defaults and sends the output  to  std-
        out.
 
-       The setterm routine is being replaced by  setupterm.   The
+       The  setterm  routine is being replaced by setupterm.  The
        call:
 
              setupterm(term, 1, (int *)0)
 
-       provides  the  same  functionality  as setterm(term).  The
-       setterm routine is included here  for  BSD  compatibility,
+       provides the same  functionality  as  setterm(term).   The
+       setterm  routine  is  included here for BSD compatibility,
        and is not recommended for new programs.
 
-       The  set_curterm  routine  sets  the  variable cur_term to
+       The set_curterm routine  sets  the  variable  cur_term  to
        nterm, and makes all of the terminfo boolean, numeric, and
-       string  variables  use  the values from nterm.  It returns
+       string variables use the values from  nterm.   It  returns
        the old value of cur_term.
 
-       The del_curterm routine frees  the  space  pointed  to  by
+       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
+       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
        has been called.
 
        The  restartterm  routine  is  similar  to  setupterm  and
-       initscr, except that it is called after  restoring  memory
-       and the input and output options are the same as when mem-
-       ory was saved, but the terminal type and baud rate may  be
-       different.   Accordingly, it saves various tty state bits,
-       does a setupterm, and then restores the bits.
+       initscr,  except  that it is called after restoring memory
+       to a previous state (for example, when  reloading  a  game
+       saved  as a core image dump).  It assumes that the windows
+       be different.  Accordingly, it  saves  various  tty  state
+       bits, does a setupterm, and then restores the bits.
 
        The tparm routine instantiates the string str with parame-
-       ters  pi.  A pointer is returned to the result of str with
+       ters pi.  A pointer is returned to the result of str  with
        the parameters applied.
 
-       The tparam routine is included for compatibility with  the
-       GNU  termcap  implementation.  It works like tparm but you
-       specify a buffer and buffer size to  be  filled  with  the
-       expanded string.
-
        The  tputs  routine  applies  padding  information  to the
        string str and outputs it.  The str  must  be  a  terminfo
        string  variable  or the return value from tparm, tgetstr,
@@ -161,12 +154,13 @@
 
        The capname for each capability is given in the table col-
        umn entitled capname code in the capabilities  section  of
+       terminfo(5).
+
+       char *boolnames, *boolcodes, *boolfnames
 
        char *numnames, *numcodes, *numfnames
 
        char *strnames, *strcodes, *strfnames
-
-       These  null-terminated  arrays  contain  the capnames, the
        termcap codes, and the full C names, for each of the  ter-
        minfo variables.
 
@@ -221,6 +215,12 @@
 
 
 
+
+
+
+
+
+
 
diff --git a/Ada95/html/define_key.3x.html b/Ada95/html/define_key.3x.html new file mode 100644 index 00000000..585285cd --- /dev/null +++ b/Ada95/html/define_key.3x.html @@ -0,0 +1,70 @@ + + +
+       define_key - define a keycode
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int define_key(char *definition, int keycode);
+
+
+
+

DESCRIPTION

+       This is an extension to the curses library.  It permits an
+       application to define keycodes  with  their  corresponding
+       control  strings,  so that the ncurses library will inter-
+       pret them just as it would the  predefined  codes  in  the
+       terminfo database.
+
+       If  the  given string is null, any existing definition for
+       the keycode is removed.
+
+
+
+

RETURN VALUE

+       The keycode  must  be  greater  than  zero,  else  ERR  is
+       returned.
+
+
+
+

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-
+       ditioned using NCURSES_VERSION.
+
+
+
+

SEE ALSO

+       keyok(3X).
+
+
+
+

AUTHOR

+       Thomas Dickey.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/dft_fgbg.3x.html b/Ada95/html/dft_fgbg.3x.html index 02ddbcf2..b13ea12d 100644 --- a/Ada95/html/dft_fgbg.3x.html +++ b/Ada95/html/dft_fgbg.3x.html @@ -1,7 +1,7 @@
-       use_default_colors - use terminal's default colors
+       dft_fgbg - use terminal's default colors
 
 
 
@@ -39,7 +39,7 @@

NOTES

-       Associated with this extension, the init_pair(3x) function
+       Associated with this extension, the init_pair(3X) function
        accepts negative arguments to specify  default  foreground
        or background colors.
 
@@ -54,7 +54,7 @@
 
 

SEE ALSO

-       curs_color(3x), ded(1).
+       curs_color(3X), ded(1).
 
 
 
diff --git a/Ada95/html/form.3x.html b/Ada95/html/form.3x.html index f2c3e19e..39b9e4f3 100644 --- a/Ada95/html/form.3x.html +++ b/Ada95/html/form.3x.html @@ -1,7 +1,7 @@
-       forms - curses extension for programming forms
+       form - curses extension for programming forms
 
 
 
@@ -11,21 +11,21 @@

DESCRIPTION

-       The forms library provides terminal-independent facilities
+       The  form library provides terminal-independent facilities
        for composing form screens  on  character-cell  terminals.
        The  library  includes:  field  routines, which create and
        modify form fields; and form routines, which group  fields
        into forms, display forms on the screen, and handle inter-
        action with the user.
 
-       The forms library uses the curses libraries, and a  curses
+       The form library uses the curses libraries, and  a  curses
        initialization  routine  such  as  initscr  must be called
-       before using any of these functions.   To  use  the  forms
+       before using any of these  functions.   To  use  the  form
        library, link with the options -lform -lcurses.
 
 
    Current Default Values for Field Attributes
-       The  forms  library  maintains  a  default value for field
+       The  form  library  maintains  a  default  value for field
        attributes.  You can get or set this  default  by  calling
        the  appropriate  get_  or  set_ routine with a NULL field
        pointer.  Changing  this  default  with  a  set_  function
@@ -38,63 +38,63 @@
        of the manual page on which it is described.
 
        l  l  l  l  .   curses  Routine  Name Manual  Page  Name =
-       current_field  form_page(3X)  data_ahead     form_data(3X)
-       data_behind    form_data(3X)  dup_field form_field_new(3X)
-       dynamic_fieldinfo   form_field_info(3X)
-       field_arg form_field_validation(3X)
-       field_back     form_field_attributes(3X)
-       field_buffer   form_field_buffer(3X)
-       field_count    form_field(3X)
-       field_fore     form_field_attributes(3X)
-       field_index    form_page(3X)
-       field_info     form_field_info(3X)
-       field_init     form_hook(3X)
-       field_just     form_field_just(3X)
-       field_opts     form_field_opts(3X)
-       field_opts_off form_field_opts(3X)
-       field_opts_on  form_field_opts(3X)
-       field_pad form_field_attributes(3X)
-       field_status   form_field_buffer(3X)
-       field_term     form_hook(3X)
-       field_type     form_field_validation(3X)
-       form_fields    form_field(3X)      form_init form_hook(3X)
-       form_opts form_opts(3X)       form_opts_off  form_opts(3X)
-       form_opts_on   form_opts(3X)       form_page form_page(3X)
-       form_request_by_name     form_requestname(3X)
-       form_request_name   form_requestname(3X)
-       form_sub  form_win(3X)             form_term form_hook(3X)
-       form_userptr   form_userptr(3X)     form_win  form_win(3X)
-       free_field     form_field_new(3X)   free_form form_new(3X)
-       link_field     form_field_new(3X)
-       link_fieldtype link_fieldtype(3X)
-       move_field     form_field(3X) new_field form_field_new(3X)
-       new_form  form_new(3X)         new_page  form_new_page(3X)
-       pos_form_cursor     form_cursor(3X)
-       post_form form_post(3X)        scale_form     form_win(3X)
-       set_current_field   form_page(3X)
-       set_field_back form_field_attributes(3X)
-       set_field_buffer    form_field_buffer(3X)
-       set_field_fore form_field_attributes(3X)
-       set_field_init form_hook(3X)
-       set_field_just form_field_just(3X)
-       set_field_opts form_field_opts(3X)
-       set_field_pad  form_field_attributes(3X)
-       set_field_status    form_field_buffer(3X)
-       set_field_term form_hook(3X)
-       set_field_type form_field_validation(3X)
-       set_field_userptr   form_field_userptr(3X)
-       set_fieldtype_arg   form_fieldtype(3X)
-       set_fieldtype_choice     form_fieldtype(3X)
-       set_form_fields     form_field(3X)
-       set_form_init  form_hook(3X)
-       set_form_opts  form_field_opts(3X)
-       set_form_page  form_page(3X)   set_form_sub   form_win(3X)
-       set_form_term  form_hook(3X)
-       set_form_userptr    form_userptr(3X)
-       set_form_win   form_win(3X)
-       set_max_field  form_field_buffer(3X)
-       set_new_page   form_new_page(3X)
-       unpost_form    form_post(3X)
+       current_field  form_page(3X)  data_ahead     form_data(3X)
+       data_behind    form_data(3X)  dup_field form_field_new(3X)
+       dynamic_fieldinfo   form_field_info(3X)
+       field_arg form_field_validation(3X)
+       field_back     form_field_attributes(3X)
+       field_buffer   form_field_buffer(3X)
+       field_count    form_field(3X)
+       field_fore     form_field_attributes(3X)
+       field_index    form_page(3X)
+       field_info     form_field_info(3X)
+       field_init     form_hook(3X)
+       field_just     form_field_just(3X)
+       field_opts     form_field_opts(3X)
+       field_opts_off form_field_opts(3X)
+       field_opts_on  form_field_opts(3X)
+       field_pad form_field_attributes(3X)
+       field_status   form_field_buffer(3X)
+       field_term     form_hook(3X)
+       field_type     form_field_validation(3X)
+       form_fields    form_field(3X)      form_init form_hook(3X)
+       form_opts form_opts(3X)       form_opts_off  form_opts(3X)
+       form_opts_on   form_opts(3X)       form_page form_page(3X)
+       form_request_by_name     form_requestname(3X)
+       form_request_name   form_requestname(3X)
+       form_sub  form_win(3X)             form_term form_hook(3X)
+       form_userptr   form_userptr(3X)     form_win  form_win(3X)
+       free_field     form_field_new(3X)   free_form form_new(3X)
+       link_field     form_field_new(3X)
+       link_fieldtype form_fieldtype(3X)
+       move_field     form_field(3X) new_field form_field_new(3X)
+       new_form  form_new(3X)         new_page  form_new_page(3X)
+       pos_form_cursor     form_cursor(3X)
+       post_form form_post(3X)        scale_form     form_win(3X)
+       set_current_field   form_page(3X)
+       set_field_back form_field_attributes(3X)
+       set_field_buffer    form_field_buffer(3X)
+       set_field_fore form_field_attributes(3X)
+       set_field_init form_hook(3X)
+       set_field_just form_field_just(3X)
+       set_field_opts form_field_opts(3X)
+       set_field_pad  form_field_attributes(3X)
+       set_field_status    form_field_buffer(3X)
+       set_field_term form_hook(3X)
+       set_field_type form_field_validation(3X)
+       set_field_userptr   form_field_userptr(3X)
+       set_fieldtype_arg   form_fieldtype(3X)
+       set_fieldtype_choice     form_fieldtype(3X)
+       set_form_fields     form_field(3X)
+       set_form_init  form_hook(3X)
+       set_form_opts  form_field_opts(3X)
+       set_form_page  form_page(3X)   set_form_sub   form_win(3X)
+       set_form_term  form_hook(3X)
+       set_form_userptr    form_userptr(3X)
+       set_form_win   form_win(3X)
+       set_max_field  form_field_buffer(3X)
+       set_new_page   form_new_page(3X)
+       unpost_form    form_post(3X)
 
 
 
diff --git a/Ada95/html/form_driver.3x.html b/Ada95/html/form_driver.3x.html index 524917c4..c4d122c8 100644 --- a/Ada95/html/form_driver.3x.html +++ b/Ada95/html/form_driver.3x.html @@ -231,7 +231,7 @@

SEE ALSO

-       curses(3X), forms(3x).
+       curses(3X), form(3X).
 
 
 
diff --git a/Ada95/html/form_field_buffer.3x.html b/Ada95/html/form_field_buffer.3x.html index 32ebdce6..5fca7372 100644 --- a/Ada95/html/form_field_buffer.3x.html +++ b/Ada95/html/form_field_buffer.3x.html @@ -21,7 +21,7 @@ the given field to contain a given string. Buffer 0 is the displayed value of the field; other numbered buffers may be allocated by applications through the nbuf argument - of (see field_new(3X)) but are not manipulated by the + of (see form_field_new(3X)) but are not manipulated by the forms library. The function field_buffer returns the foreground attribute. diff --git a/Ada95/html/form_field_new.3x.html b/Ada95/html/form_field_new.3x.html index 5275c1d6..9860310b 100644 --- a/Ada95/html/form_field_new.3x.html +++ b/Ada95/html/form_field_new.3x.html @@ -67,7 +67,7 @@ were not supported on Version 7 or BSD versions. It may be unwise to count on the set of attributes copied - by dup_field(3x) being portable; the System V forms + by dup_field(3X) being portable; the System V forms library documents are not very explicit on what gets copied and was not. diff --git a/Ada95/html/form_field_opts.3x.html b/Ada95/html/form_field_opts.3x.html index f92e9856..d1be72bc 100644 --- a/Ada95/html/form_field_opts.3x.html +++ b/Ada95/html/form_field_opts.3x.html @@ -37,26 +37,29 @@ O_ACTIVE The field is visited during processing. If this option is off, the field will not be reachable by - navigation keys. + navigation keys. Please notice that an invisible + field appears to be inactive also. O_PUBLIC - The field contents are displayed as data is entered. + The field contents are displayed as data is entered. O_EDIT The field can be edited. O_WRAP - Words that don't fit on a line are wrapped to the + Words that don't fit on a line are wrapped to the next line. Words are blank-separated. O_BLANK - The field is cleared whenever a character is entered + The field is cleared whenever a character is entered at the first position. O_AUTOSKIP Skip to the next field when this one fills - O_NULLOK + Allow a blank field. + + O_STATIC Field buffers are fixed to field's original size. O_PASSOK @@ -65,7 +68,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.
@@ -88,13 +91,13 @@
 
 

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.
 
 
@@ -113,9 +116,6 @@
 
 
 
-
-
-
 
 
diff --git a/Ada95/html/form_field_userptr.3x.html b/Ada95/html/form_field_userptr.3x.html index e8bb557f..dc61c29c 100644 --- a/Ada95/html/form_field_userptr.3x.html +++ b/Ada95/html/form_field_userptr.3x.html @@ -8,8 +8,8 @@

SYNOPSIS

        #include <form.h>
-       int set_field_userptr(FIELD *field, const void*userptr);
-       const void *field_userptr(const FIELD *field);
+       int set_field_userptr(FIELD *field, void*userptr);
+       void *field_userptr(const FIELD *field);
 
 
 
diff --git a/Ada95/html/form_field_validation.3x.html b/Ada95/html/form_field_validation.3x.html index 0c33a6d0..a8b5671a 100644 --- a/Ada95/html/form_field_validation.3x.html +++ b/Ada95/html/form_field_validation.3x.html @@ -67,7 +67,7 @@ Regular expression data. Requires a regular expres- sion (char *) third argument; the data is valid if the regular expression matches it. Regular expres- - sions are in the format of regcomp(3x) and + sions are in the format of regcomp(3X) and regexec(3X). Please notice that the regular expres- sion must match the whole field. If you have for example an eight character wide field, a regular diff --git a/Ada95/html/form_fieldtype.3x.html b/Ada95/html/form_fieldtype.3x.html index 4a25187a..d56915ef 100644 --- a/Ada95/html/form_fieldtype.3x.html +++ b/Ada95/html/form_fieldtype.3x.html @@ -51,12 +51,16 @@ object which can later be passed to validation predicated. The other two hook arguments should copy and free argu- ment-block structures. They will be used by the forms- - driver code. + driver code. You must supply the mak_arg function, the + other two are optional, you may supply NULL for them. In + this case it is assumed, that mak_arg doesn't allocate + memory but simply loads the argument into a single scalar + value. - The form driver requests REQ_NEXT_CHOICE and - REQ_PREV_CHOICE assume that the possible values of a field form an ordered set, and provide the forms user with a way to move through the set. The set_fieldtype_choice func- + tion allows forms programmers to define successor and pre- + decessor functions for the field type. These functions take the field pointer and an argument-block structure as arguments. @@ -115,10 +119,6 @@ - - - - diff --git a/Ada95/html/form_userptr.3x.html b/Ada95/html/form_userptr.3x.html index 3dda58e6..5eac8966 100644 --- a/Ada95/html/form_userptr.3x.html +++ b/Ada95/html/form_userptr.3x.html @@ -7,8 +7,8 @@

SYNOPSIS

        #include <form.h>
-       int set_form_userptr(FORM *form, const void *userptr);
-       const void* form_userptr(const FORM *form);
+       int set_form_userptr(FORM *form, void *userptr);
+       void* form_userptr(const FORM *form);
 
 
 
diff --git a/Ada95/html/index.html b/Ada95/html/index.html index 6900ef37..50ec3abc 100644 --- a/Ada95/html/index.html +++ b/Ada95/html/index.html @@ -24,15 +24,15 @@ This binding comes AS IS with no warranty, implied or expressed.

General Remarks

    -
  • This document describes Version 00.92.00 of the binding.
  • +
  • This document describes Version 00.93 of the binding.
  • The functionality is modelled to be compatible with the ncurses package, a clone of the SVr4 curses model.
    I did the development on an Intel box running Linux 1.3.x and 2.0, -ncurses-1.9.9e and the +ncurses-4.x and the GNU Ada Translator -gnat-3.05. For any older versions of ncurses and gnat -it will not work.
  • +gnat-3.09. For any older versions of ncurses and gnat +it is not guaranteed to work.
  • You must have the m4 macroprocessor to build this package. If you don't have this program, you can get the FSF version here.
  • @@ -71,13 +71,10 @@ Same suggestion as above. an OO abstraction of the (n)curses functionality. As mentioned above it's a thin binding for the (n)curses functions. But without any doubt it would be nice to build on top of this an OO abstraction -of (n)curses functionality. -
  • If you use the user-pointer mechanism for most of the ncurses -structures in a mixed language environemt, i.e. Ada95 and C routines -operate on the same objects, care must be taken because the Ada -binding itself uses the user pointer mechanism for it's own purposes. -See the corresponding section in implementention -details.
  • +of (n)curses functionality.
    +The only exception is the method how fieldtypes are represented in +this Binding. We provide an abstract tagged type Field_Type from +which the various fieldtypes are derived.
  • I currently do not support the link_fieldtype functionality of the forms subsystem.
  • The *_IO packages are currently output only.
  • @@ -99,9 +96,21 @@ forms subsystem.
  • Forms +
  • Field_Types + +
  • Text_IO Most likely you will follow a mixed approach. Some features are easy to simulate, others will be hard if not impossible.
  • -
  • For menu items, the name and descriptions are internally copied by ncurses. -So the binding doesn't care for the lifetime of the strings passed to the -construction routine for items. This assumption is not true in most other implementations -of the menu library. In this case you have to modify the binding routine -New_Item to safestore the strings.
  • I'm quite sure I forgot something.

    diff --git a/Ada95/html/keyok.3x.html b/Ada95/html/keyok.3x.html new file mode 100644 index 00000000..3cf442dc --- /dev/null +++ b/Ada95/html/keyok.3x.html @@ -0,0 +1,70 @@ + + +

    +       keyok - enable or disable a keycode
    +
    +
    +
    +

    SYNOPSIS

    +       #include <curses.h>
    +
    +       int keyok(int keycode, bool enable);
    +
    +
    +
    +

    DESCRIPTION

    +       This is an extension to the curses library.  It permits an
    +       application to disable specific keycodes, rather than  use
    +       the  keypad  function  to disable all keycodes.  Keys that
    +       have been disabled can be reenabled.
    +
    +
    +
    +

    RETURN VALUE

    +       The keycode  must  be  greater  than  zero,  else  ERR  is
    +       returned.   If  it  does  not correspond to a defined key,
    +       then ERR is returned.  If the enable  parameter  is  true,
    +       then  the  key  must  have  been disabled, and vice versa.
    +       Otherwise, the function returns OK.
    +
    +
    +
    +

    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-
    +       ditioned using NCURSES_VERSION.
    +
    +
    +
    +

    SEE ALSO

    +       define_key(3X).
    +
    +
    +
    +

    AUTHOR

    +       Thomas Dickey.
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + diff --git a/Ada95/html/menu.3x.html b/Ada95/html/menu.3x.html index 8439ff83..68d79251 100644 --- a/Ada95/html/menu.3x.html +++ b/Ada95/html/menu.3x.html @@ -1,7 +1,7 @@
    -       menus - curses extension for programming menus
    +       menu - curses extension for programming menus
     
     
     
    @@ -11,21 +11,21 @@

    DESCRIPTION

    -       The menus library provides terminal-independent facilities
    +       The  menu library provides terminal-independent facilities
            for composing menu systems  on  character-cell  terminals.
            The library includes: item routines, which create and mod-
            ify menu items; and menu routines, which group items  into
            menus, display menus on the screen, and handle interaction
            with the user.
     
    -       The menus library uses the curses libraries, and a  curses
    +       The menu library uses the curses libraries, and  a  curses
            initialization  routine  such  as  initscr  must be called
    -       before using any of these functions.   To  use  the  menus
    +       before using any of these  functions.   To  use  the  menu
            library, link with the options -lmenu -lcurses.
     
     
        Current Default Values for Item Attributes
    -       The  menus  library  maintains  a  default  value for item
    +       The  menu  library  maintains  a  default  value  for item
            attributes.  You can get or set this  default  by  calling
            the  appropriate  get_  or  set_  routine with a NULL item
            pointer.  Changing  this  default  with  a  set_  function
    @@ -38,49 +38,49 @@
            of the manual page on which it is described.
     
            l   l   .    curses   Routine   Name Manual  Page  Name  =
    -       current_item   mitem_current(3X)                 free_item
    -            mitem_new(3X)       free_menu            menu_new(3X)
    -       item_count     menu_items(3X)
    -       item_description    mitem_name(3X)
    -       item_index     mitem_current(3X)                 item_init
    -            menu_hook(3X) item_name      mitem_name(3X) item_opts
    -            mitem_opts(3X)          item_opts_off  mitem_opts(3X)
    -       item_opts_on   mitem_opts(3X) item_term      menu_hook(3X)
    -       item_userptr   mitem_userptr(3X)
    -       item_value     mitem_value(3X)  item_visible   mitem_visi-
    -       ble(3X)          menu_back                menu_attribs(3X)
    -       menu_driver    menu_driver(3X)                   menu_fore
    -            menu_attribs(3X)       menu_format    menu_format(3X)
    -       menu_grey               menu_attribs(3X)         menu_init
    -            menu_hook(3X) menu_items     menu_items(3X) menu_mark
    -            menu_mark(3X)       menu_opts           menu_opts(3X)
    -       menu_opts_off  menu_opts(3X)  menu_opts_on   menu_opts(3X)
    -       menu_pad        menu_attribs(3X)  menu_pattern   menu_pat-
    -       tern(3X)     menu_request_by_name     menu_requestname(3X)
    -            menu_win(3X)       menu_term            menu_hook(3X)
    -       menu_userptr   menu_userptr(3X)                   menu_win
    -            menu_win(3X)  new_item        mitem_new(3X)  new_menu
    -            menu_new(3X)      pos_menu_cursor     menu_cursor(3X)
    -       post_menu     menu_post(3X)    scale_menu     menu_win(3X)
    -       set_current_item    menu_current_item(3X)
    -       set_item_init  menu_hook(3X) set_item_opts  mitem_opts(3X)
    -       set_item_term  menu_hook(3X)
    -       set_item_userptr    mitem_userptr(3X)
    -       set_item_value mitem_value(3X)
    -       set_menu_back  menu_attribs(3X)
    -       set_menu_fore  menu_attribs(3X)
    -       set_menu_format     menu_format(3X)
    -       set_menu_grey  menu_attribs(3X)
    -       set_menu_init  menu_hook(3X) set_menu_items menu_items(3X)
    -       set_menu_mark  menu_mark(3X) set_menu_opts  mitem_opts(3X)
    -       set_menu_pad   menu_attribs(3X)
    -       set_menu_pattern    menu_pattern(3X)
    -       set_menu_spacing    menu_spacing(3X)
    -       set_menu_sub   menu_win(3X)   set_menu_term  menu_hook(3X)
    -       set_menu_userptr    menu_userptr(3X)
    -       set_menu_win   menu_win(3X)      set_top_row    mitem_cur-
    -       rent(3X)          top_row                mitem_current(3X)
    -       unpost_menu    menu_post(3X)
    +       current_item   mitem_current(3X)                 free_item
    +            mitem_new(3X)       free_menu            menu_new(3X)
    +       item_count     menu_items(3X)
    +       item_description    mitem_name(3X)
    +       item_index     mitem_current(3X)                 item_init
    +            menu_hook(3X) item_name      mitem_name(3X) item_opts
    +            mitem_opts(3X)          item_opts_off  mitem_opts(3X)
    +       item_opts_on   mitem_opts(3X) item_term      menu_hook(3X)
    +       item_userptr   mitem_userptr(3X)
    +       item_value     mitem_value(3X)  item_visible   mitem_visi-
    +       ble(3X)          menu_back                menu_attribs(3X)
    +       menu_driver    menu_driver(3X)                   menu_fore
    +            menu_attribs(3X)       menu_format    menu_format(3X)
    +       menu_grey               menu_attribs(3X)         menu_init
    +            menu_hook(3X) menu_items     menu_items(3X) menu_mark
    +            menu_mark(3X)       menu_opts           menu_opts(3X)
    +       menu_opts_off  menu_opts(3X)  menu_opts_on   menu_opts(3X)
    +       menu_pad        menu_attribs(3X)  menu_pattern   menu_pat-
    +       tern(3X)     menu_request_by_name     menu_requestname(3X)
    +            menu_win(3X)       menu_term            menu_hook(3X)
    +       menu_userptr   menu_userptr(3X)                   menu_win
    +            menu_win(3X)  new_item        mitem_new(3X)  new_menu
    +            menu_new(3X)      pos_menu_cursor     menu_cursor(3X)
    +       post_menu     menu_post(3X)    scale_menu     menu_win(3X)
    +       set_current_item    mitem_current(3X)
    +       set_item_init  menu_hook(3X) set_item_opts  mitem_opts(3X)
    +       set_item_term  menu_hook(3X)
    +       set_item_userptr    mitem_userptr(3X)
    +       set_item_value mitem_value(3X)
    +       set_menu_back  menu_attribs(3X)
    +       set_menu_fore  menu_attribs(3X)
    +       set_menu_format     menu_format(3X)
    +       set_menu_grey  menu_attribs(3X)
    +       set_menu_init  menu_hook(3X) set_menu_items menu_items(3X)
    +       set_menu_mark  menu_mark(3X) set_menu_opts  mitem_opts(3X)
    +       set_menu_pad   menu_attribs(3X)
    +       set_menu_pattern    menu_pattern(3X)
    +       set_menu_spacing    menu_spacing(3X)
    +       set_menu_sub   menu_win(3X)   set_menu_term  menu_hook(3X)
    +       set_menu_userptr    menu_userptr(3X)
    +       set_menu_win   menu_win(3X)      set_top_row    mitem_cur-
    +       rent(3X)          top_row                mitem_current(3X)
    +       unpost_menu    menu_post(3X)
     
     
     
    diff --git a/Ada95/html/menu_driver.3x.html b/Ada95/html/menu_driver.3x.html index 81472363..53babc77 100644 --- a/Ada95/html/menu_driver.3x.html +++ b/Ada95/html/menu_driver.3x.html @@ -116,7 +116,7 @@

    SEE ALSO

    -       curses(3X), menus(3x).
    +       curses(3X), menu(3X).
     
     
     
    diff --git a/Ada95/html/menu_format.3x.html b/Ada95/html/menu_format.3x.html index 4ab46deb..e2ab655e 100644 --- a/Ada95/html/menu_format.3x.html +++ b/Ada95/html/menu_format.3x.html @@ -14,17 +14,20 @@

    DESCRIPTION

            The function set_menu_format sets the maximum display size
    -       of the given window.  If this size is too small to display
    -       all menu items, the menu will be made scrollable.
    -
    -       The   default  format  is  16  rows,  1  column.   Calling
    -       set_menu_format with a null menu pointer will change  this
    +       of the given menu.  If this size is too small  to  display
    +       all  menu items, the menu will be made scrollable. If this
    +       size is larger than the menus subwindow and the  subwindow
    +       is  too  small to display all menu items, post_menu() will
    +       fail.
    +
    +       The  default  format  is  16  rows,  1  column.    Calling
    +       set_menu_format  with a null menu pointer will change this
            default.  A zero row or column argument to set_menu_format
    -       is interpreted as a request  not  to  change  the  current
    +       is  interpreted  as  a  request  not to change the current
            value.
     
    -       The  function  menu_format  returns  the maximum-size con-
    -       straints for the given menu into the storage addressed  by
    +       The function menu_format  returns  the  maximum-size  con-
    +       straints  for the given menu into the storage addressed by
            rows and cols.
     
     
    @@ -38,7 +41,7 @@
                 System error occurred (see errno).
     
            E_BAD_ARGUMENT
    -            Routine  detected  an incorrect or out-of-range argu-
    +            Routine detected an incorrect or  out-of-range  argu-
                 ment.
     
            E_POSTED
    @@ -58,14 +61,63 @@
     
     

    PORTABILITY

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

    AUTHORS

    -       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
    -       curses by Eric S. Raymond.
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
     
     
    diff --git a/Ada95/html/menu_pattern.3x.html b/Ada95/html/menu_pattern.3x.html index 61286891..dc4d217e 100644 --- a/Ada95/html/menu_pattern.3x.html +++ b/Ada95/html/menu_pattern.3x.html @@ -16,7 +16,7 @@ Every menu has an associated pattern match buffer. As input events that are printable ASCII characters come in, they are appended to this match buffer and tested for a - match, as described in menu_driver(3x). + match, as described in menu_driver(3X). The function set_menu_pattern sets the pattern buffer for the given menu and tries to find the first matching item. diff --git a/Ada95/html/menu_post.3x.html b/Ada95/html/menu_post.3x.html index a181597f..65c79f9f 100644 --- a/Ada95/html/menu_post.3x.html +++ b/Ada95/html/menu_post.3x.html @@ -46,7 +46,8 @@ tion function. E_NO_ROOM - Menu is too large for its window. + Menu is too large for its window. You should consider + to use set_menu_format() to solve the problem. E_NOT_POSTED The menu has not been posted. @@ -62,14 +63,17 @@

    NOTES

    -       The header file <menu.h> automatically includes the header
    -       These  routines  emulate  the System V menu library.  They
    +
    +
    +
    +

    PORTABILITY

    +       These routines emulate the System V  menu  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.
     
     
    @@ -112,8 +116,6 @@
     
     
     
    -
    -
     
     
     
    diff --git a/Ada95/html/menu_userptr.3x.html b/Ada95/html/menu_userptr.3x.html
    index 85201592..68066579 100644
    --- a/Ada95/html/menu_userptr.3x.html
    +++ b/Ada95/html/menu_userptr.3x.html
    @@ -7,8 +7,8 @@
     

    SYNOPSIS

            #include <menu.h>
    -       int set_menu_userptr(MENU *menu, const void *userptr);
    -       const void *menu_userptr(const MENU *menu);
    +       int set_menu_userptr(MENU *menu, void *userptr);
    +       void *menu_userptr(const MENU *menu);
     
     
     
    diff --git a/Ada95/html/mitem_new.3x.html b/Ada95/html/mitem_new.3x.html index 54e4b030..b2f5b020 100644 --- a/Ada95/html/mitem_new.3x.html +++ b/Ada95/html/mitem_new.3x.html @@ -14,8 +14,16 @@

    DESCRIPTION

            The function new_item allocates a new item and initializes
    -       it from the name and description pointers.
    -       The function free_item de-allocates an item.
    +       it  from  the name and description pointers. Please notice
    +       that the item stores only the pointers  to  the  name  and
    +       description. Those pointers must be valid during the life-
    +       time of the item. So you  should  be  very  carefull  with
    +       names  or descriptions allocated on the stack of some rou-
    +       tines.
    +       The function free_item de-allocates an item. Please notice
    +       that  it  is  the  responsibility  of  the  application to
    +       release the memory for the name or the description of  the
    +       item.
     
     
     
    @@ -59,14 +67,6 @@ Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. - - - - - - - - diff --git a/Ada95/html/mitem_userptr.3x.html b/Ada95/html/mitem_userptr.3x.html index 8f8b5ef4..d39d1ff4 100644 --- a/Ada95/html/mitem_userptr.3x.html +++ b/Ada95/html/mitem_userptr.3x.html @@ -8,8 +8,8 @@

    SYNOPSIS

            #include <menu.h>
    -       int set_item_userptr(ITEM *item, const void *userptr);
    -       const void *item_userptr(const ITEM *item);
    +       int set_item_userptr(ITEM *item, void *userptr);
    +       void *item_userptr(const ITEM *item);
     
     
     
    diff --git a/Ada95/html/mitem_value.3x.html b/Ada95/html/mitem_value.3x.html index de0bd079..451361db 100644 --- a/Ada95/html/mitem_value.3x.html +++ b/Ada95/html/mitem_value.3x.html @@ -14,7 +14,7 @@

    DESCRIPTION

            If  you  turn  off  the menu option O_ONEVALUE (e.g., with
    -       set_menu_opts or menu_opts_off;  see  menu_opts(3x)),  the
    +       set_menu_opts or menu_opts_off;  see  menu_opts(3X)),  the
            menu becomes multi-valued; that is, more than one item may
            simultaneously be selected.
     
    diff --git a/Ada95/html/ncurses.3x.html b/Ada95/html/ncurses.3x.html
    index 0db3fafb..4cae6bbe 100644
    --- a/Ada95/html/ncurses.3x.html
    +++ b/Ada95/html/ncurses.3x.html
    @@ -69,7 +69,7 @@
            be created with newwin.
     
            Note that curses  does  not  handle  overlapping  windows,
    -       that's done by the panels(3x) library. This means that you
    +       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
            result in unpredictable, and undesired, effects.
    @@ -182,14 +182,14 @@
            addstr/curs_addstr(3X)               attroff/curs_attr(3X)
            attron/curs_attr(3X)       attrset/curs_attr(3X)      bau-
            drate/curs_termattrs(3X)                beep/curs_beep(3X)
    -       bkgd/curs_bkgd(3X)  bkgdset/curs_bkgd(3X) border/curs_bor-
    +       bkgd/curs_bkgd(3X)  bkgdset/curs_bkgd(3X) border/curs_bor-
            der(3X)                                box/curs_border(3X)
            can_change_color/curs_color(3X)     cbreak/curs_inopts(3X)
            clear/curs_clear(3X)    clearok/curs_outopts(3X)    clrto-
            bot/curs_clear(3X)    clrtoeol/curs_clear(3X)   color_con-
            tent/curs_color(3X)               copywin/curs_overlay(3X)
            curs_set/curs_kernel(3X)     def_prog_mode/curs_kernel(3X)
    -       def_shell_mode/curs_kernel(3X)       del_curterm/curs_ter-
    +       def_shell_mode/curs_kernel(3X)       del_curterm/curs_ter-
            minfo(3X)  delay_output/curs_util(3X) delch/curs_delch(3X)
            deleteln/curs_deleteln(3X) delscreen/curs_initscr(3X) del-
            win/curs_window(3X)      derwin/curs_window(3X)      doup-
    @@ -241,17 +241,17 @@
            napms/curs_kernel(3X)                  newpad/curs_pad(3X)
            newterm/curs_initscr(3X)            newwin/curs_window(3X)
            nl/curs_outopts(3X)     nocbreak/curs_inopts(3X)     node-
    -       lay/curs_inopts(3X) noecho/curs_inopts(3X)  nonl/curs_out-
    +       lay/curs_inopts(3X) noecho/curs_inopts(3X)  nonl/curs_out-
            opts(3X)  noqiflush/curs_inopts(3X)  noraw/curs_inopts(3X)
            notimeout/curs_inopts(3X)  overlay/curs_overlay(3X)  over-
            write/curs_overlay(3X)         pair_content/curs_color(3X)
            pechochar/curs_pad(3X)   pnoutrefresh/curs_pad(3X)    pre-
    -       fresh/curs_pad(3X)  printw/curs_printw(3X)  putp/curs_ter-
    +       fresh/curs_pad(3X)  printw/curs_printw(3X)  putp/curs_ter-
            minfo(3X)   putwin/curs_util(3X)   qiflush/curs_inopts(3X)
            raw/curs_inopts(3X)             redrawwin/curs_refresh(3X)
            refresh/curs_refresh(3X)   reset_prog_mode/curs_kernel(3X)
            reset_shell_mode/curs_kernel(3X)   resetty/curs_kernel(3X)
    -       resizeterm/resizeterm(3x)*   restartterm/curs_terminfo(3X)
    +       resizeterm/resizeterm(3X)*   restartterm/curs_terminfo(3X)
            ripoffline/curs_kernel(3X)         savetty/curs_kernel(3X)
            scanw/curs_scanw(3X)            scr_dump/curs_scr_dump(3X)
            scr_init/curs_scr_dump(3X)   scr_restore/curs_scr_dump(3X)
    @@ -277,7 +277,7 @@
            tputs/curs_termcap(3X)    tputs/curs_terminfo(3X)   typea-
            head/curs_inopts(3X)                  unctrl/curs_util(3X)
            ungetch/curs_getch(3X) ungetmouse/curs_mouse(3X)* untouch-
    -       win/curs_touch(3X) use_env/curs_util(3X) vidattr/curs_ter-
    +       win/curs_touch(3X) use_env/curs_util(3X) vidattr/curs_ter-
            minfo(3X)  vidputs/curs_terminfo(3X) vline/curs_border(3X)
            vwprintw/curs_printw(3X)    vwscanw/curs_scanw(3X)    wad-
            dch/curs_addch(3X)   waddchnstr/curs_addchstr(3X)  waddch-
    @@ -299,7 +299,7 @@
            winsstr/curs_insstr(3X)              winstr/curs_instr(3X)
            wmove/curs_move(3X)          wnoutrefresh/curs_refresh(3X)
            wprintw/curs_printw(3X)   wredrawln/curs_refresh(3X)  wre-
    -       fresh/curs_refresh(3X)                wresize/wresize(3x)*
    +       fresh/curs_refresh(3X)                wresize/wresize(3X)*
            wscanw/curs_scanw(3X)    wscrl/curs_scroll(3X)    wsetscr-
            reg/curs_outopts(3X)    wstandend/curs_attr(3X)    wstand-
            out/curs_attr(3X)      wsyncdown/curs_window(3X)     wsyn-
    @@ -357,7 +357,7 @@
            Versions of curses compiled on PC clones  support  display
            of  the  PC ROM characters (including ROM characters 0-31,
            which stock SVr4 curses cannot display).  See  the  EXTEN-
    -       SIONS sections of curs_addch(3x) and curs_attr(3x).
    +       SIONS sections of curs_addch(3X) and curs_attr(3X).
     
            The curses library includes facilities for capturing mouse
            events on certain terminals  (including  xterm).  See  the
    diff --git a/Ada95/html/panel.3x.html b/Ada95/html/panel.3x.html
    index 9875c217..74d806c5 100644
    --- a/Ada95/html/panel.3x.html
    +++ b/Ada95/html/panel.3x.html
    @@ -96,7 +96,7 @@
                   replaces the current window of  panel  with  window
                   (useful, for example if you want to resize a panel;
                   if you're using ncurses, you can call replace_panel
    -              on  the output of wresize(3x)).  It does not change
    +              on  the output of wresize(3X)).  It does not change
                   the position of the panel in the stack.
     
            panel_above(pan)
    diff --git a/Ada95/html/resizeterm.3x.html b/Ada95/html/resizeterm.3x.html
    index 18401194..92c125db 100644
    --- a/Ada95/html/resizeterm.3x.html
    +++ b/Ada95/html/resizeterm.3x.html
    @@ -46,10 +46,17 @@
            to  avoid invoking it in a context where malloc or realloc
            may have been interrupted, since it uses those  functions.
     
    +       If  ncurses  is configured to supply its own SIGWINCH han-
    +       dler, the resizeterm function ungetch's a KEY_RESIZE which
    +       will  be  read on the next call to getch.  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.
    +
     
     

    SEE ALSO

    -       wresize(3x).
    +       wresize(3X).
     
     
     
    @@ -58,13 +65,6 @@ for BSD curses). - - - - - - - diff --git a/Ada95/html/table.html b/Ada95/html/table.html index f142107e..e984bb47 100644 --- a/Ada95/html/table.html +++ b/Ada95/html/table.html @@ -10,23 +10,24 @@ PUBLIC "-//IETF//DTD HTML 3.0//EN"> - + - + - + - + - + + - + @@ -35,7 +36,7 @@ PUBLIC "-//IETF//DTD HTML 3.0//EN"> - + @@ -52,10 +53,10 @@ PUBLIC "-//IETF//DTD HTML 3.0//EN"> - + - + @@ -77,16 +78,16 @@ PUBLIC "-//IETF//DTD HTML 3.0//EN"> - - - + + + - - + + @@ -105,12 +106,13 @@ PUBLIC "-//IETF//DTD HTML 3.0//EN"> - + + - + - + @@ -149,7 +151,7 @@ PUBLIC "-//IETF//DTD HTML 3.0//EN"> - + @@ -167,7 +169,7 @@ PUBLIC "-//IETF//DTD HTML 3.0//EN"> - + @@ -185,10 +187,10 @@ PUBLIC "-//IETF//DTD HTML 3.0//EN"> - - - - + + + + @@ -204,7 +206,7 @@ PUBLIC "-//IETF//DTD HTML 3.0//EN"> - + @@ -251,18 +253,18 @@ PUBLIC "-//IETF//DTD HTML 3.0//EN"> - + - - + + - + diff --git a/Ada95/html/terminal_interface-curses-forms-choice_field_types_s.html b/Ada95/html/terminal_interface-curses-forms-choice_field_types_s.html deleted file mode 100644 index b696e9a1..00000000 --- a/Ada95/html/terminal_interface-curses-forms-choice_field_types_s.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - -
    -------------------------------------------------------------------------------
    ---                                                                          --
    ---                           GNAT ncurses Binding                           --
    ---                                                                          --
    ---              Terminal_Interface.Curses.Forms.Choice_Field_Types          --
    ---                                                                          --
    ---                                 S P E C                                  --
    ---                                                                          --
    ---  Version 00.92                                                           --
    ---                                                                          --
    ---  The ncurses Ada95 binding is copyrighted 1996 by                        --
    ---  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
    ---                                                                          --
    ---  Permission is hereby granted to reproduce and distribute this           --
    ---  binding by any means and for any fee, whether alone or as part          --
    ---  of a larger distribution, in source or in binary form, PROVIDED         --
    ---  this notice is included with any such distribution, and is not          --
    ---  removed from any of its header files. Mention of ncurses and the        --
    ---  author of this binding in any applications linked with it is            --
    ---  highly appreciated.                                                     --
    ---                                                                          --
    ---  This binding comes AS IS with no warranty, implied or expressed.        --
    -------------------------------------------------------------------------------
    ---  Version Control:
    ---  @Revision: 1.6 @
    -------------------------------------------------------------------------------
    ---  You must instantiate this package for any user defined field type
    ---  to make it visible to the runtime.
    ---
    -generic
    -   type User is new Ada_Defined_Field_Type with private;
    -   type User_Access is access User;
    -   with function Field_Check (Fld  : Field;
    -                              Info : User_Access) return Boolean;
    -   with function Character_Check (Ch   : Character;
    -                                  Info : User_Access) return Boolean;
    -   with function Next_Choice (Fld  : Field;
    -                              Info : User_Access) return Boolean;
    -   with function Prev_Choice (Fld  : Field;
    -                              Info : User_Access) return Boolean;
    -package Terminal_Interface.Curses.Forms.Choice_Field_Types is
    ---
    ---  Nothing public.
    ---  But we need the body.
    -    pragma Elaborate_Body;
    -end Terminal_Interface.Curses.Forms.Choice_Field_Types;
    -
    -
    - -


    -

    -This is BETA software. The interface is subject to change without notice.

    - - -

    This hypertext format was generated by David A. Wheeler's ada2html - - - diff --git a/Ada95/html/terminal_interface-curses-forms-field_types-alpha_s.html b/Ada95/html/terminal_interface-curses-forms-field_types-alpha_s.html new file mode 100644 index 00000000..8487da97 --- /dev/null +++ b/Ada95/html/terminal_interface-curses-forms-field_types-alpha_s.html @@ -0,0 +1,68 @@ + + + + + +

    +------------------------------------------------------------------------------
    +--                                                                          --
    +--                           GNAT ncurses Binding                           --
    +--                                                                          --
    +--              Terminal_Interface.Curses.Forms.Field_Types.Alpha           --
    +--                                                                          --
    +--                                 S P E C                                  --
    +--                                                                          --
    +------------------------------------------------------------------------------
    +-- Copyright (c) 1998 Free 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.                                                           --
    +------------------------------------------------------------------------------
    +--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
    +--  Version Control:
    +--  @Revision: 1.1 @
    +------------------------------------------------------------------------------
    +package Terminal_Interface.Curses.Forms.Field_Types.Alpha is
    +
    +   type Alpha_Field is new Field_Type
    +     with record
    +        Minimum_Field_Width : Natural := 0;
    +     end record;
    +
    +   procedure Set_Field_Type (Fld : in Field;
    +                             Typ : in Alpha_Field);
    +
    +end Terminal_Interface.Curses.Forms.Field_Types.Alpha;
    +
    +
    + +


    +

    +This is BETA software. The interface is subject to change without notice.

    + + +

    This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-forms-field_types-alphanumeric_s.html b/Ada95/html/terminal_interface-curses-forms-field_types-alphanumeric_s.html new file mode 100644 index 00000000..48aaeaa9 --- /dev/null +++ b/Ada95/html/terminal_interface-curses-forms-field_types-alphanumeric_s.html @@ -0,0 +1,68 @@ + + + + + +

    +------------------------------------------------------------------------------
    +--                                                                          --
    +--                           GNAT ncurses Binding                           --
    +--                                                                          --
    +--          Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric        --
    +--                                                                          --
    +--                                 S P E C                                  --
    +--                                                                          --
    +------------------------------------------------------------------------------
    +-- Copyright (c) 1998 Free 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.                                                           --
    +------------------------------------------------------------------------------
    +--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
    +--  Version Control:
    +--  @Revision: 1.1 @
    +------------------------------------------------------------------------------
    +package Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric is
    +
    +   type AlphaNumeric_Field is new Field_Type
    +     with record
    +        Minimum_Field_Width : Natural := 0;
    +     end record;
    +
    +   procedure Set_Field_Type (Fld : in Field;
    +                             Typ : in AlphaNumeric_Field);
    +
    +end Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric;
    +
    +
    + +


    +

    +This is BETA software. The interface is subject to change without notice.

    + + +

    This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-forms-field_types-enumeration-ada_s.html b/Ada95/html/terminal_interface-curses-forms-field_types-enumeration-ada_s.html new file mode 100644 index 00000000..4be75b70 --- /dev/null +++ b/Ada95/html/terminal_interface-curses-forms-field_types-enumeration-ada_s.html @@ -0,0 +1,74 @@ + + + + + +

    +------------------------------------------------------------------------------
    +--                                                                          --
    +--                           GNAT ncurses Binding                           --
    +--                                                                          --
    +--         Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada      --
    +--                                                                          --
    +--                                 S P E C                                  --
    +--                                                                          --
    +------------------------------------------------------------------------------
    +-- Copyright (c) 1998 Free 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.                                                           --
    +------------------------------------------------------------------------------
    +--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
    +--  Version Control:
    +--  @Revision: 1.1 @
    +------------------------------------------------------------------------------
    +generic
    +   type T is (<>);
    +
    +package 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 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;
    +
    +
    + +


    +

    +This is BETA software. The interface is subject to change without notice.

    + + +

    This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-forms-field_types-enumeration_s.html b/Ada95/html/terminal_interface-curses-forms-field_types-enumeration_s.html new file mode 100644 index 00000000..d72b2a0b --- /dev/null +++ b/Ada95/html/terminal_interface-curses-forms-field_types-enumeration_s.html @@ -0,0 +1,112 @@ + + + + + +

    +------------------------------------------------------------------------------
    +--                                                                          --
    +--                           GNAT ncurses Binding                           --
    +--                                                                          --
    +--           Terminal_Interface.Curses.Forms.Field_Types.Enumeration        --
    +--                                                                          --
    +--                                 S P E C                                  --
    +--                                                                          --
    +------------------------------------------------------------------------------
    +-- Copyright (c) 1998 Free 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.                                                           --
    +------------------------------------------------------------------------------
    +--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
    +--  Version Control:
    +--  @Revision: 1.1 @
    +------------------------------------------------------------------------------
    +with Interfaces.C.Strings;
    +
    +package Terminal_Interface.Curses.Forms.Field_Types.Enumeration is
    +
    +   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 Enum_Array is array (Positive range <>)
    +     of String_Access;
    +
    +   type Enumeration_Info (C : Positive) is
    +      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;
    +
    +   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;
    +
    +   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);
    +
    +private
    +   type CPA_Access is access Interfaces.C.Strings.chars_ptr_array;
    +
    +   type Enumeration_Field is new Field_Type with
    +      record
    +         Case_Sensitive       : Boolean := False;
    +         Match_Must_Be_Unique : Boolean := False;
    +         Arr                  : CPA_Access := null;
    +      end record;
    +
    +end Terminal_Interface.Curses.Forms.Field_Types.Enumeration;
    +
    +
    + +


    +

    +This is BETA software. The interface is subject to change without notice.

    + + +

    This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-forms-field_types-intfield_s.html b/Ada95/html/terminal_interface-curses-forms-field_types-intfield_s.html new file mode 100644 index 00000000..6a556c73 --- /dev/null +++ b/Ada95/html/terminal_interface-curses-forms-field_types-intfield_s.html @@ -0,0 +1,70 @@ + + + + + +

    +------------------------------------------------------------------------------
    +--                                                                          --
    +--                           GNAT ncurses Binding                           --
    +--                                                                          --
    +--            Terminal_Interface.Curses.Forms.Field_Types.IntField          --
    +--                                                                          --
    +--                                 S P E C                                  --
    +--                                                                          --
    +------------------------------------------------------------------------------
    +-- Copyright (c) 1998 Free 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.                                                           --
    +------------------------------------------------------------------------------
    +--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
    +--  Version Control:
    +--  @Revision: 1.1 @
    +------------------------------------------------------------------------------
    +package Terminal_Interface.Curses.Forms.Field_Types.IntField is
    +
    +   type Integer_Field is new Field_Type with
    +      record
    +         Precision   : Natural;
    +         Lower_Limit : Integer;
    +         Upper_Limit : Integer;
    +      end record;
    +
    +   procedure Set_Field_Type (Fld : in Field;
    +                             Typ : in Integer_Field);
    +
    +end Terminal_Interface.Curses.Forms.Field_Types.IntField;
    +
    +
    + +


    +

    +This is BETA software. The interface is subject to change without notice.

    + + +

    This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-forms-field_types-ipv4_address_s.html b/Ada95/html/terminal_interface-curses-forms-field_types-ipv4_address_s.html new file mode 100644 index 00000000..a8938712 --- /dev/null +++ b/Ada95/html/terminal_interface-curses-forms-field_types-ipv4_address_s.html @@ -0,0 +1,65 @@ + + + + + +

    +------------------------------------------------------------------------------
    +--                                                                          --
    +--                           GNAT ncurses Binding                           --
    +--                                                                          --
    +--          Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address        --
    +--                                                                          --
    +--                                 S P E C                                  --
    +--                                                                          --
    +------------------------------------------------------------------------------
    +-- Copyright (c) 1998 Free 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.                                                           --
    +------------------------------------------------------------------------------
    +--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
    +--  Version Control:
    +--  @Revision: 1.1 @
    +------------------------------------------------------------------------------
    +package Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address is
    +
    +   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);
    +
    +end Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address;
    +
    +
    + +


    +

    +This is BETA software. The interface is subject to change without notice.

    + + +

    This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-forms-field_types-numeric_s.html b/Ada95/html/terminal_interface-curses-forms-field_types-numeric_s.html new file mode 100644 index 00000000..c9164429 --- /dev/null +++ b/Ada95/html/terminal_interface-curses-forms-field_types-numeric_s.html @@ -0,0 +1,70 @@ + + + + + +

    +------------------------------------------------------------------------------
    +--                                                                          --
    +--                           GNAT ncurses Binding                           --
    +--                                                                          --
    +--             Terminal_Interface.Curses.Forms.Field_Types.Numeric          --
    +--                                                                          --
    +--                                 S P E C                                  --
    +--                                                                          --
    +------------------------------------------------------------------------------
    +-- Copyright (c) 1998 Free 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.                                                           --
    +------------------------------------------------------------------------------
    +--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
    +--  Version Control:
    +--  @Revision: 1.1 @
    +------------------------------------------------------------------------------
    +package Terminal_Interface.Curses.Forms.Field_Types.Numeric is
    +
    +   type Numeric_Field is new Field_Type with
    +      record
    +         Precision   : Natural;
    +         Lower_Limit : Float;
    +         Upper_Limit : Float;
    +      end record;
    +
    +   procedure Set_Field_Type (Fld : in Field;
    +                             Typ : in Numeric_Field);
    +
    +end Terminal_Interface.Curses.Forms.Field_Types.Numeric;
    +
    +
    + +


    +

    +This is BETA software. The interface is subject to change without notice.

    + + +

    This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-forms-field_types-regexp_s.html b/Ada95/html/terminal_interface-curses-forms-field_types-regexp_s.html new file mode 100644 index 00000000..eb197a2c --- /dev/null +++ b/Ada95/html/terminal_interface-curses-forms-field_types-regexp_s.html @@ -0,0 +1,70 @@ + + + + + +

    +------------------------------------------------------------------------------
    +--                                                                          --
    +--                           GNAT ncurses Binding                           --
    +--                                                                          --
    +--              Terminal_Interface.Curses.Forms.Field_Types.RegExp          --
    +--                                                                          --
    +--                                 S P E C                                  --
    +--                                                                          --
    +------------------------------------------------------------------------------
    +-- Copyright (c) 1998 Free 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.                                                           --
    +------------------------------------------------------------------------------
    +--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
    +--  Version Control:
    +--  @Revision: 1.1 @
    +------------------------------------------------------------------------------
    +package Terminal_Interface.Curses.Forms.Field_Types.RegExp is
    +
    +   type String_Access is access String;
    +
    +   type Regular_Expression_Field is new Field_Type with
    +      record
    +         Regular_Expression : String_Access;
    +      end record;
    +
    +   procedure Set_Field_Type (Fld : in Field;
    +                             Typ : in Regular_Expression_Field);
    +
    +end Terminal_Interface.Curses.Forms.Field_Types.RegExp;
    +
    +
    + +


    +

    +This is BETA software. The interface is subject to change without notice.

    + + +

    This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-forms-field_types-user-choice_s.html b/Ada95/html/terminal_interface-curses-forms-field_types-user-choice_s.html new file mode 100644 index 00000000..3efb8a08 --- /dev/null +++ b/Ada95/html/terminal_interface-curses-forms-field_types-user-choice_s.html @@ -0,0 +1,107 @@ + + + + + +

    +------------------------------------------------------------------------------
    +--                                                                          --
    +--                           GNAT ncurses Binding                           --
    +--                                                                          --
    +--           Terminal_Interface.Curses.Forms.Field_Types.User.Choice        --
    +--                                                                          --
    +--                                 S P E C                                  --
    +--                                                                          --
    +------------------------------------------------------------------------------
    +-- Copyright (c) 1998 Free 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.                                                           --
    +------------------------------------------------------------------------------
    +--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
    +--  Version Control:
    +--  @Revision: 1.1 @
    +------------------------------------------------------------------------------
    +with Ada.Unchecked_Deallocation;
    +with Terminal_Interface.Curses.Aux;
    +
    +package Terminal_Interface.Curses.Forms.Field_Types.User.Choice is
    +
    +   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;
    +
    +   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
    +      is abstract;
    +   --  If True is returned, the function successfully generated a previous
    +   --  value into the fields buffer.
    +
    +   --  +----------------------------------------------------------------------
    +   --  | Private Part.
    +   --  |
    +private
    +   use type Interfaces.C.Int;
    +
    +   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);
    +   --  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;
    +
    +
    + +


    +

    +This is BETA software. The interface is subject to change without notice.

    + + +

    This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-forms-field_types-user_s.html b/Ada95/html/terminal_interface-curses-forms-field_types-user_s.html new file mode 100644 index 00000000..df4346e0 --- /dev/null +++ b/Ada95/html/terminal_interface-curses-forms-field_types-user_s.html @@ -0,0 +1,110 @@ + + + + + +

    +------------------------------------------------------------------------------
    +--                                                                          --
    +--                           GNAT ncurses Binding                           --
    +--                                                                          --
    +--               Terminal_Interface.Curses.Forms.Field_Types.User           --
    +--                                                                          --
    +--                                 S P E C                                  --
    +--                                                                          --
    +------------------------------------------------------------------------------
    +-- Copyright (c) 1998 Free 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.                                                           --
    +------------------------------------------------------------------------------
    +--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
    +--  Version Control:
    +--  @Revision: 1.1 @
    +------------------------------------------------------------------------------
    +with Ada.Unchecked_Deallocation;
    +with Terminal_Interface.Curses.Aux;
    +
    +package Terminal_Interface.Curses.Forms.Field_Types.User is
    +
    +   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;
    +
    +   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
    +      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);
    +   --  This should work for all types derived from User_Defined_Field_Type.
    +   --  No need to reimplement it for your derived type.
    +
    +   --  +----------------------------------------------------------------------
    +   --  | Private Part.
    +   --  | Used by the Choice child package.
    +private
    +   use type Interfaces.C.Int;
    +
    +   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);
    +   --  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;
    +
    +
    + +


    +

    +This is BETA software. The interface is subject to change without notice.

    + + +

    This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-forms-field_types_s.html b/Ada95/html/terminal_interface-curses-forms-field_types_s.html index 28c6fa6b..89f8a85c 100644 --- a/Ada95/html/terminal_interface-curses-forms-field_types_s.html +++ b/Ada95/html/terminal_interface-curses-forms-field_types_s.html @@ -4,6 +4,7 @@

    +
     ------------------------------------------------------------------------------
     --                                                                          --
     --                           GNAT ncurses Binding                           --
    @@ -12,48 +13,229 @@
     --                                                                          --
     --                                 S P E C                                  --
     --                                                                          --
    ---  Version 00.92                                                           --
    +------------------------------------------------------------------------------
    +-- Copyright (c) 1998 Free Software Foundation, Inc.                        --
     --                                                                          --
    ---  The ncurses Ada95 binding is copyrighted 1996 by                        --
    ---  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
    +-- 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:                 --
     --                                                                          --
    ---  Permission is hereby granted to reproduce and distribute this           --
    ---  binding by any means and for any fee, whether alone or as part          --
    ---  of a larger distribution, in source or in binary form, PROVIDED         --
    ---  this notice is included with any such distribution, and is not          --
    ---  removed from any of its header files. Mention of ncurses and the        --
    ---  author of this binding in any applications linked with it is            --
    ---  highly appreciated.                                                     --
    +-- The above copyright notice and this permission notice shall be included  --
    +-- in all copies or substantial portions of the Software.                   --
     --                                                                          --
    ---  This binding comes AS IS with no warranty, implied or expressed.        --
    +-- 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.                                                           --
     ------------------------------------------------------------------------------
    +--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
     --  Version Control:
    ---  @Revision: 1.3 @
    +--  @Revision: 1.1 @
     ------------------------------------------------------------------------------
    -with Ada.Finalization; use Ada.Finalization;
    -
    ---  You must instantiate this package for any user defined field type
    ---  to make it visible to the runtime.
    ---
    -generic
    -   type User is new Ada_Defined_Field_Type with private;
    -   type User_Access is access User;
    -   with function Field_Check (Fld  : Field;
    -                              Info : User_Access) return Boolean;
    -   with function Character_Check (Ch   : Character;
    -                                  Info : User_Access) return Boolean;
    +with Terminal_Interface.Curses.Aux;
    +
     package Terminal_Interface.Curses.Forms.Field_Types is
    ---
    ---  Nothing public. All happens magically.
    ---
    +
    +   --  |=====================================================================
    +   --  | Man page form_fieldtype.3x
    +   --  |=====================================================================
    +
    +   type Field_Type is abstract tagged null record;
    +   --  Abstract base type for all field types. A concrete field type
    +   --  is an extension that adds some data elements describing formats or
    +   --  boundary values for the type and validation routines.
    +   --  For the builtin low-level fieldtypes, the validation routines are
    +   --  already defined by the low-level C library.
    +   --  The builtin types like Alpha or AlphaNumeric etc. are defined in
    +   --  child packages of this package. You may use one of them as example
    +   --  how to create you own child packages for low-level field types that
    +   --  you may have already written in C.
    +
    +   type Field_Type_Access is access all Field_Type'Class;
    +
    +   --  |
    +   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
    +   --       have to pass a single Field_Type parameter.
    +
    +   --  ---------------------------------------------------------------------
    +
    +   --  |=====================================================================
    +   --  | Man page form_field_validation.3x
    +   --  |=====================================================================
    +
    +   --  |
    +   function Get_Type (Fld : in Field) return Field_Type_Access;
    +   --  AKA: field_type()
    +   --  AKA: field_arg()
    +   --  In Ada95 we can combine these. If you try to retrieve the field type
    +   --  that is not defined as extension of the abstract tagged type above,
    +   --  you will raise a Form_Exception.
    +
    +   --  +----------------------------------------------------------------------
    +   --  | Private Part.
    +   --  | Most of this is used by the implementations of the child packages.
    +   --  |
     private
    -   type Tracker is new Limited_Controlled with null record;
    +   use Terminal_Interface.Curses.Aux;
     
    -   procedure Initialize (Obj : in out Tracker);
    -   procedure Finalize   (Obj : in out Tracker);
    +   type Makearg_Function is access
    +     function (Args : System.Address) return System.Address;
    +   pragma Convention (C, Makearg_Function);
     
    -end Terminal_Interface.Curses.Forms.Field_Types;
    +   type Copyarg_Function is access
    +     function (Usr : System.Address) return System.Address;
    +   pragma Convention (C, Copyarg_Function);
    +
    +   type Freearg_Function is access
    +     procedure (Usr : System.Address);
    +   pragma Convention (C, Freearg_Function);
    +
    +   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;
    +   pragma Convention (C, Char_Check_Function);
     
    +   type Choice_Function is access
    +     function (Fld : Field; Usr : System.Address) return C_Int;
    +   pragma Convention (C, Choice_Function);
    +
    +   --  +----------------------------------------------------------------------
    +   --  | This must be in sync with the FIELDTYPE structure in form.h
    +   --  |
    +   type Low_Level_Field_Type is
    +      record
    +         Status :              C_Short;
    +         Ref_Count :           C_Long_Int;
    +         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);
    +   type C_Field_Type is access all Low_Level_Field_Type;
    +
    +   Null_Field_Type   : constant C_Field_Type := null;
    +
    +   --  +----------------------------------------------------------------------
    +   --  | This four low-level fieldtypes are the ones associated with
    +   --  | fieldtypes handled by this binding. Any other low-level fieldtype
    +   --  | will result in a Form_Exception is function Get_Type.
    +   --  |
    +   C_Generic_Type   : C_Field_Type := Null_Field_Type;
    +   C_Generic_Choice : C_Field_Type := Null_Field_Type;
    +   C_Builtin_Router : C_Field_Type := Null_Field_Type;
    +   C_Choice_Router  : C_Field_Type := Null_Field_Type;
    +
    +   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
    +   --  conformant Field_Type object.
    +   --  The parameter Cft must be C_Builtin_Router for regular low-level
    +   --  fieldtypes (like TYP_ALPHA or TYP_ALNUM) and C_Choice_Router for
    +   --  low-level fieldtypes witch choice functions (like TYP_ENUM).
    +   --  Any other value will raise a Form_Exception.
    +
    +   function Make_Arg (Args : System.Address) return System.Address;
    +   pragma Convention (C, Make_Arg);
    +   --  This is the Makearg_Function for the internal low-level types
    +   --  introduced by this binding.
    +
    +   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.
    +
    +   procedure Free_Arg (Usr : System.Address);
    +   pragma Convention (C, Free_Arg);
    +   --  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;
    +   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;
    +   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;
    +   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;
    +   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
    +   --  type. It routes the call to the corresponding low-level prev_choice
    +   --  function.
    +
    +   --  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
    +      Cft : C_Field_Type;        --  the original low-level type
    +   end record;
    +   type Argument_Access is access all Argument;
    +
    +   --  +----------------------------------------------------------------------
    +   --  |
    +   --  | Some Imports of libform routines to deal with low-level fieldtypes.
    +   --  |
    +   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)
    +     return C_Int;
    +   pragma Import (C, Set_Fieldtype_Arg, "set_fieldtype_arg");
    +
    +   function Set_Fieldtype_Choice (Cft : C_Field_Type;
    +                                  Next, Prev : Choice_Function)
    +     return C_Int;
    +   pragma Import (C, Set_Fieldtype_Choice, "set_fieldtype_choice");
    +
    +end Terminal_Interface.Curses.Forms.Field_Types;
     
     
    diff --git a/Ada95/html/terminal_interface-curses-forms-field_user_data_s.html b/Ada95/html/terminal_interface-curses-forms-field_user_data_s.html index 7ad321cc..16c28b0f 100644 --- a/Ada95/html/terminal_interface-curses-forms-field_user_data_s.html +++ b/Ada95/html/terminal_interface-curses-forms-field_user_data_s.html @@ -13,23 +13,36 @@ -- ---- S P E C ---- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. ---- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.3 @ +-- @Revision: 1.4 @------------------------------------------------------------------------------generic @@ -37,15 +50,6 @@ type User_Access isaccess User; package Terminal_Interface.Curses.Forms.Field_User_Data is - -- The binding uses the C level user pointer already for its own - -- internal purposes. So you can´t easily manipulate the user pointer - -- with the low level C routines for this field without taking care of - -- this special situation. If you want to read or write with C routines - -- the user pointer of this field, you should get first the low level - -- user pointer. This points to a record, that always has as its first - -- member the Ada95 user pointer for this field. You should never change - -- the low level user pointer of an Ada created field. - ---- |=====================================================================-- | Man page form_field_userptr.3x-- |===================================================================== @@ -54,13 +58,13 @@ procedure Set_User_Data (Fld : in Field; Data : in User_Access); -- AKA: set_field_userptr - pragma Convention (C, Set_User_Data); + pragma Inline (Set_User_Data); -- |procedure Get_User_Data (Fld : in Field; Data : out User_Access); -- AKA: field_userptr - pragma Convention (C, Get_User_Data); + pragma Inline (Get_User_Data); end Terminal_Interface.Curses.Forms.Field_User_Data; diff --git a/Ada95/html/terminal_interface-curses-forms-form_user_data_s.html b/Ada95/html/terminal_interface-curses-forms-form_user_data_s.html index be754bed..0478e861 100644 --- a/Ada95/html/terminal_interface-curses-forms-form_user_data_s.html +++ b/Ada95/html/terminal_interface-curses-forms-form_user_data_s.html @@ -13,23 +13,36 @@ -- ---- S P E C ---- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. ---- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.3 @ +-- @Revision: 1.4 @------------------------------------------------------------------------------generic @@ -37,15 +50,6 @@ type User_Access isaccess User; package Terminal_Interface.Curses.Forms.Form_User_Data is - -- The binding uses the C level user pointer already for its own - -- internal purposes. So you can´t easily manipulate the user pointer - -- with the low level C routines for this form without taking care of - -- this special situation. If you want to read or write with C routines - -- the user pointer of this form, you should get first the low level - -- user pointer. This points to a record, that always has as its first - -- member the Ada95 user pointer for this form. You should never change - -- the low level user pointer of an Ada created form. - ---- |=====================================================================-- | Man page form_userptr.3x-- |===================================================================== @@ -54,13 +58,13 @@ procedure Set_User_Data (Frm : in Form; Data : in User_Access); -- AKA: set_form_userptr - pragma Convention (C, Set_User_Data); + pragma Inline (Set_User_Data); -- |procedure Get_User_Data (Frm : in Form; Data : out User_Access); -- AKA: form_userptr - pragma Convention (C, Get_User_Data); + pragma Inline (Get_User_Data); end Terminal_Interface.Curses.Forms.Form_User_Data; diff --git a/Ada95/html/terminal_interface-curses-forms_s.html b/Ada95/html/terminal_interface-curses-forms_s.html index add98be2..1f0302bd 100644 --- a/Ada95/html/terminal_interface-curses-forms_s.html +++ b/Ada95/html/terminal_interface-curses-forms_s.html @@ -13,33 +13,44 @@ -- ---- S P E C ---- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. ---- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.9 @ +-- @Revision: 1.10 @------------------------------------------------------------------------------ --- form binding, generated at Sun Feb 2 17:21:44 1997 +-- form binding.-- This module is generated. Please don't change it manually!-- Run the generator instead.-- |with System; -with Ada.Tags; use Ada.Tags; with Ada.Characters.Latin_1; with Interfaces.C; -with Interfaces.C.Strings; package Terminal_Interface.Curses.Forms is @@ -50,12 +61,9 @@ type Field isprivate; type Form isprivate; - type C_Field_Type isprivate; Null_Field : constant Field; Null_Form : constant Form; - Null_Field_Type : constant C_Field_Type; - type Field_Justification is (None, Left, @@ -127,7 +135,13 @@ type Field_Array isarray (Positive range <>) ofaliased Field; pragma Convention (C, Field_Array); - type Field_Array_Access isaccessall Field_Array; + type Field_Array_Access isaccess Field_Array; + + procedure Free (FA : inout 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 + -- the array.subtype Form_Request_Code is Key_Code range (Key_Max + 1) .. (Key_Max + 57); @@ -267,6 +281,10 @@ procedure Request_Name (Key : in Form_Request_Code; Name : out String); + function Request_Name (Key : Form_Request_Code) return String; + -- Same as function + pragma Inline (Request_Name); + -------------------- Exceptions -------------------- @@ -344,6 +362,12 @@ Str : out String); -- AKA: field_buffer() + function Get_Buffer + (Fld : in Field; + Buffer : in Buffer_Number := Buffer_Number'First) return String; + -- AKA: field_buffer() + -- Same but as function + -- |procedure Set_Status (Fld : in Field; Status : in Boolean := True); @@ -536,18 +560,17 @@ -- |procedure Redefine (Frm : in Form; - Flds : in Field_Array); + Flds : in Field_Array_Access); -- AKA: set_form_fields() - -- With a bit more comfort. You don´t need to terminate the Field_Array - -- with a null entry. This is handled internally in the binding.-- |procedure Set_Fields (Frm : in Form; - Flds : in Field_Array) renames Redefine; + Flds : in Field_Array_Access) renames Redefine; -- AKA: set_form_fields()-- | - function Fields (Frm : Form) return Field_Array_Access; + function Fields (Frm : Form; + Index : Positive) return Field; -- AKA: form_fields()-- | @@ -565,11 +588,12 @@ -- |===================================================================== -- | - function Create (Fields : Field_Array) return Form; + function Create (Fields : Field_Array_Access) return Form; -- AKA: new_form()-- | - function New_Form (Fields : Field_Array) return Form renames Create; + function New_Form (Fields : Field_Array_Access) return Form + renames Create; -- AKA: new_form()-- | @@ -690,217 +714,15 @@ function Is_New_Page (Fld : Field) return Boolean; -- AKA: new_page() - -- |===================================================================== - -- | Man page form_fieldtype.3x - -- |===================================================================== - - type Field_Type isabstracttaggednullrecord; - type Field_Type_Access isaccessall Field_Type'Class; - - function Native_Type (Ftype : Field_Type) - return C_Field_Type isabstract; - -- This function returns the C libraries handle to the field type. - -- May be you need this if you want to interface to lower level - -- routines in the form library. - - -- | - procedure Set_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 - -- have to pass a single Field_Type parameter. - - type C_Defined_Field_Type isabstractnew Field_Type withnullrecord; - -- This is the root of all field typed defined in C, i.e. this are - -- the predefined field types in the form library. - - type Alpha_Field isnew C_Defined_Field_Type - withrecord - Minimum_Field_Width : Natural := 0; - endrecord; - procedure Set_Type (Fld : in Field; - Fld_Type : in Alpha_Field); - function Native_Type (Ftype : Alpha_Field) - return C_Field_Type; - - type Alpha_Numeric_Field isnew C_Defined_Field_Type with - record - Minimum_Field_Width : Natural := 0; - endrecord; - procedure Set_Type (Fld : in Field; - Fld_Type : in Alpha_Numeric_Field); - function Native_Type (Ftype : Alpha_Numeric_Field) - return C_Field_Type; - - type Integer_Field isnew C_Defined_Field_Type with - record - Precision : Natural; - Lower_Limit : Integer; - Upper_Limit : Integer; - endrecord; - procedure Set_Type (Fld : in Field; - Fld_Type : in Integer_Field); - function Native_Type (Ftype : Integer_Field) - return C_Field_Type; - - type Numeric_Field isnew C_Defined_Field_Type with - record - Precision : Natural; - Lower_Limit : Float; - Upper_Limit : Float; - endrecord; - procedure Set_Type (Fld : in Field; - Fld_Type : in Numeric_Field); - function Native_Type (Ftype : Numeric_Field) - return C_Field_Type; - - type String_Access isaccess String; - - type Regular_Expression_Field isnew C_Defined_Field_Type with - record - Regular_Expression : String_Access; - endrecord; - procedure Set_Type (Fld : in Field; - Fld_Type : in Regular_Expression_Field); - function Native_Type (Ftype : Regular_Expression_Field) - return C_Field_Type; - - type Enum_Array isarray (Positive range <>) - of String_Access; - - type Enumeration_Info (C : Positive) is - record - Names : Enum_Array (1 .. C); - Case_Sensitive : Boolean := False; - Match_Must_Be_Unique : Boolean := False; - endrecord; - - type Enumeration_Field isnew C_Defined_Field_Type withprivate; - - 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; - - procedure Release (Enum : inout 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. - - procedure Set_Type (Fld : in Field; - Fld_Type : in Enumeration_Field); - function Native_Type (Ftype : Enumeration_Field) - return C_Field_Type; - - -- The next type defintions are all ncurses extensions. They are typically - -- not available in other curses implementations. - - type Internet_V4_Address_Field isnew C_Defined_Field_Type - withnullrecord; - procedure Set_Type (Fld : in Field; - Fld_Type : in Internet_V4_Address_Field); - function Native_Type (Ftype : Internet_V4_Address_Field) - return C_Field_Type; - - - type Ada_Defined_Field_Type isabstractnew Field_Type withnullrecord; - -- This is the root of the mechanism we use to create field types in - -- Ada95. You don't have to redefine the Set_Field_Type and - -- Native_Field_Type methods, because they work generically on this - -- class. - - procedure Set_Type (Fld : Field; - Fld_Type : Ada_Defined_Field_Type); - - function Native_Type (Ftype : Ada_Defined_Field_Type) - return C_Field_Type; - - -- |===================================================================== - -- | Man page form_field_validation.3x - -- |===================================================================== - - -- | - function Get_Type (Fld : in Field) return Field_Type_Access; - -- AKA: field_type() - -- AKA: field_arg() - -- In Ada95 we can combine these------------------------------------------------------------------------------private type Field isnew System.Address; type Form isnew System.Address; - type C_Field_Type isnew System.Address; Null_Field : constant Field := Field (System.Null_Address); Null_Form : constant Form := Form (System.Null_Address); - Null_Field_Type : constant C_Field_Type := - C_Field_Type (System.Null_Address); - - type CPA_Access isaccess Interfaces.C.Strings.chars_ptr_array; - - type Enumeration_Field isnew C_Defined_Field_Type with - record - Case_Sensitive : Boolean := False; - Match_Must_Be_Unique : Boolean := False; - Arr : CPA_Access := null; - endrecord; - - -- In our binding we use the fields user pointer as hook to maintain - -- our own info structure about the field type. To be able to still - -- provide a user pointer, we use this wrapper. - -- - type Field_User_Wrapper is - record - U : System.Address; -- the hook we provide for the user - T : Field_Type_Access; -- may be null - N : Natural; -- use counter - endrecord; - pragma Convention (C, Field_User_Wrapper); - type Field_User_Wrapper_Access isaccessall Field_User_Wrapper; - pragma Controlled (Field_User_Wrapper_Access); - - function Set_Field_Userptr (Fld : Field; - Wrp : Field_User_Wrapper_Access) - return Interfaces.C.int; - pragma Import (C, Set_Field_Userptr, "set_field_userptr"); - - function Field_Userptr (Fld : Field) return Field_User_Wrapper_Access; - pragma Import (C, Field_Userptr, "field_userptr"); - - -- In our binding we use the forms user pointer as hook to maintain - -- our own info structure about the field association. To be able to still - -- provide a user pointer, we use this wrapper. - -- - type Form_User_Wrapper is - record - U : System.Address; -- the hook we provide for the user - I : Field_Array_Access; - endrecord; - pragma Convention (C, Form_User_Wrapper); - type Form_User_Wrapper_Access isaccessall Form_User_Wrapper; - pragma Controlled (Form_User_Wrapper_Access); - - function Set_Form_Userptr (Frm : Form; - Wrp : Form_User_Wrapper_Access) - return Interfaces.C.int; - pragma Import (C, Set_Form_Userptr, "set_form_userptr"); - - function Form_Userptr (Frm : Form) return Form_User_Wrapper_Access; - pragma Import (C, Form_Userptr, "form_userptr"); - - procedure Register_Type (T : in Ada_Defined_Field_Type'Class; - Cft : in C_Field_Type); - procedure Unregister_Type (T : in Ada_Defined_Field_Type'Class); - function Search_Type (T : Ada_Defined_Field_Type'Class) - return C_Field_Type; Generation_Bit_Order : constant System.Bit_Order := System.Low_Order_First; -- This constant may be different on your system. diff --git a/Ada95/html/terminal_interface-curses-menus-item_user_data_s.html b/Ada95/html/terminal_interface-curses-menus-item_user_data_s.html index 5675d804..a867f54b 100644 --- a/Ada95/html/terminal_interface-curses-menus-item_user_data_s.html +++ b/Ada95/html/terminal_interface-curses-menus-item_user_data_s.html @@ -13,23 +13,36 @@ -- ---- S P E C ---- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. ---- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.2 @ +-- @Revision: 1.3 @------------------------------------------------------------------------------generic @@ -49,13 +62,13 @@ procedure Set_User_Data (Itm : in Item; Data : in User_Access); -- AKA: set_item_userptr - pragma Convention (C, Set_User_Data); + pragma Inline (Set_User_Data); -- |procedure Get_User_Data (Itm : in Item; Data : out User_Access); -- AKA: item_userptr - pragma Convention (C, Get_User_Data); + pragma Inline (Get_User_Data); end Terminal_Interface.Curses.Menus.Item_User_Data; diff --git a/Ada95/html/terminal_interface-curses-menus-menu_user_data_s.html b/Ada95/html/terminal_interface-curses-menus-menu_user_data_s.html index 2cbd2338..69ff87f9 100644 --- a/Ada95/html/terminal_interface-curses-menus-menu_user_data_s.html +++ b/Ada95/html/terminal_interface-curses-menus-menu_user_data_s.html @@ -13,23 +13,36 @@ -- ---- S P E C ---- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. ---- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.2 @ +-- @Revision: 1.3 @------------------------------------------------------------------------------generic @@ -37,15 +50,6 @@ type User_Access isaccess User; package Terminal_Interface.Curses.Menus.Menu_User_Data is - -- The binding uses the C level user pointer already for its own - -- internal purposes. So you can´t easily manipulate the user pointer - -- with the low level C routines for this menu without taking care of - -- this special situation. If you want to read or write with C routines - -- the user pointer of this menu, you should get first the low level - -- user pointer. This points to a record, that always has as its first - -- member the Ada95 user pointer for this menu. You should never change - -- the low level user pointer of an Ada created menu. - ---- |=====================================================================-- | Man page menu_userptr.3x-- |===================================================================== @@ -54,13 +58,13 @@ procedure Set_User_Data (Men : in Menu; Data : in User_Access); -- AKA: set_menu_userptr - pragma Convention (C, Set_User_Data); + pragma Inline (Set_User_Data); -- |procedure Get_User_Data (Men : in Menu; Data : out User_Access); -- AKA: menu_userptr - pragma Convention (C, Get_User_Data); + pragma Inline (Get_User_Data); end Terminal_Interface.Curses.Menus.Menu_User_Data; diff --git a/Ada95/html/terminal_interface-curses-menus_s.html b/Ada95/html/terminal_interface-curses-menus_s.html index cd1ce0cc..394bfff3 100644 --- a/Ada95/html/terminal_interface-curses-menus_s.html +++ b/Ada95/html/terminal_interface-curses-menus_s.html @@ -13,25 +13,38 @@ -- ---- S P E C ---- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. ---- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.7 @ +-- @Revision: 1.8 @------------------------------------------------------------------------------ --- menu binding, generated at Sun Feb 2 17:21:44 1997 +-- menu binding.-- This module is generated. Please don't change it manually!-- Run the generator instead.-- | @@ -100,6 +113,9 @@ procedure Request_Name (Key : in Menu_Request_Code; Name : out String); + function Request_Name (Key : Menu_Request_Code) return String; + -- Same as function + -------------------- Exceptions -------------------- @@ -168,7 +184,13 @@ type Item_Array isarray (Positive range <>) ofaliased Item; pragma Convention (C, Item_Array); - type Item_Array_Access isaccessall Item_Array; + type Item_Array_Access isaccess Item_Array; + + procedure Free (IA : inout 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 + -- the array.-- |=====================================================================-- | Man page mitem_new.3x @@ -244,12 +266,19 @@ procedure Name (Itm : in Item; Name : out String); -- AKA: item_name() + function Name (Itm : Item) return String; + -- AKA: item_name() + -- Implemented as function-- |procedure Description (Itm : in Item; Description : out String); -- AKA: item_description(); + function Description (Itm : Item) return String; + -- AKA: item_description(); + -- Implemented as function + -- |=====================================================================-- | Man page mitem_current.3x-- |===================================================================== @@ -364,6 +393,10 @@ Mark : out String); -- AKA: menu_mark() + function Mark (Men : Menu) return String; + -- AKA: menu_mark() + -- Implemented as function + -- |=====================================================================-- | Man page menu_attribs.3x-- |===================================================================== @@ -531,16 +564,15 @@ -- |procedure Redefine (Men : in Menu; - Items : in Item_Array); + Items : in Item_Array_Access); -- AKA: set_menu_items() - -- With a bit more comfort. You don´t need to terminate the Item_Array - -- with a null entry. This is handled internally in the binding.procedure Set_Items (Men : in Menu; - Items : in Item_Array) renames Redefine; + Items : in Item_Array_Access) renames Redefine; -- | - function Items (Men : Menu) return Item_Array_Access; + function Items (Men : Menu; + Index : Positive) return Item; -- AKA: menu_items()-- | @@ -552,10 +584,10 @@ -- |===================================================================== -- | - function Create (Items : Item_Array) return Menu; + function Create (Items : Item_Array_Access) return Menu; -- AKA: new_menu() - function New_Menu (Items : Item_Array) return Menu renames Create; + function New_Menu (Items : Item_Array_Access) return Menu renames Create; -- |procedure Delete (Men : in out Menu); @@ -584,21 +616,6 @@ Null_Item : constant Item := Item (System.Null_Address); Null_Menu : constant Menu := Menu (System.Null_Address); - -- This binding uses the original user pointer mechanism of a menu to store - -- specific informations about a menu. This wrapper record carries this - -- specifics and contains a field to maintain a new user pointer. Please - -- note that you must take this into account if you wan't to use the user - -- pointer mechanism of a menu created with this binding in low-level C - -- routines. - type Ada_User_Wrapper is - record - U : System.Address; - I : Item_Array_Access; - end record; - pragma Convention (C, Ada_User_Wrapper); - type Ada_User_Wrapper_Access is access all Ada_User_Wrapper; - pragma Controlled (Ada_User_Wrapper_Access); - Generation_Bit_Order : constant System.Bit_Order := System.Low_Order_First; -- This constant may be different on your system. diff --git a/Ada95/html/terminal_interface-curses-mouse_s.html b/Ada95/html/terminal_interface-curses-mouse_s.html index 0b92a66a..8054e668 100644 --- a/Ada95/html/terminal_interface-curses-mouse_s.html +++ b/Ada95/html/terminal_interface-curses-mouse_s.html @@ -13,25 +13,38 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. -- -- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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. ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.6 @ +-- @Revision: 1.8 @------------------------------------------------------------------------------ --- mouse binding, generated at Sun Feb 2 17:21:45 1997 +-- mouse binding.-- This module is generated. Please don't change it manually!-- Run the generator instead.-- | @@ -70,6 +83,9 @@ -- | Man page curs_mouse.3x-- |===================================================================== + function Has_Mouse return Boolean; + -- Return true if a mouse device is supported, false otherwise. + procedure Register_Reportable_Event (B : in Mouse_Button; S : in Button_State; @@ -84,7 +100,6 @@ -- AKA: mousemask()procedure End_Mouse; - pragma Import (C, End_Mouse, "_nc_ada_unregister_mouse"); -- Terminates the mouse-- | diff --git a/Ada95/html/terminal_interface-curses-panels-user_data_s.html b/Ada95/html/terminal_interface-curses-panels-user_data_s.html index 236b7c81..307d0c84 100644 --- a/Ada95/html/terminal_interface-curses-panels-user_data_s.html +++ b/Ada95/html/terminal_interface-curses-panels-user_data_s.html @@ -13,23 +13,36 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. -- -- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.2 @ +-- @Revision: 1.3 @------------------------------------------------------------------------------generic diff --git a/Ada95/html/terminal_interface-curses-panels_s.html b/Ada95/html/terminal_interface-curses-panels_s.html index c292134e..9d2ca4c4 100644 --- a/Ada95/html/terminal_interface-curses-panels_s.html +++ b/Ada95/html/terminal_interface-curses-panels_s.html @@ -13,23 +13,36 @@ -- ---- S P E C ---- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. ---- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.2 @ +-- @Revision: 1.3 @------------------------------------------------------------------------------with System; diff --git a/Ada95/html/terminal_interface-curses-text_io-complex_io_s.html b/Ada95/html/terminal_interface-curses-text_io-complex_io_s.html index a336fce8..8a959df2 100644 --- a/Ada95/html/terminal_interface-curses-text_io-complex_io_s.html +++ b/Ada95/html/terminal_interface-curses-text_io-complex_io_s.html @@ -12,23 +12,36 @@ -- ---- S P E C ---- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. ---- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.3 @ +-- @Revision: 1.4 @------------------------------------------------------------------------------with Ada.Numerics.Generic_Complex_Types; diff --git a/Ada95/html/terminal_interface-curses-text_io-decimal_io_s.html b/Ada95/html/terminal_interface-curses-text_io-decimal_io_s.html index 6ffe5562..3dd4f325 100644 --- a/Ada95/html/terminal_interface-curses-text_io-decimal_io_s.html +++ b/Ada95/html/terminal_interface-curses-text_io-decimal_io_s.html @@ -12,23 +12,36 @@ -- ---- S P E C ---- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. ---- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.4 @ +-- @Revision: 1.5 @------------------------------------------------------------------------------generic type Num isdelta <> digits <>; diff --git a/Ada95/html/terminal_interface-curses-text_io-enumeration_io_s.html b/Ada95/html/terminal_interface-curses-text_io-enumeration_io_s.html index e3b3c89b..0c45c78a 100644 --- a/Ada95/html/terminal_interface-curses-text_io-enumeration_io_s.html +++ b/Ada95/html/terminal_interface-curses-text_io-enumeration_io_s.html @@ -12,23 +12,36 @@ -- ---- S P E C ---- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. ---- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.4 @ +-- @Revision: 1.5 @------------------------------------------------------------------------------generic type Enum is (<>); diff --git a/Ada95/html/terminal_interface-curses-text_io-fixed_io_s.html b/Ada95/html/terminal_interface-curses-text_io-fixed_io_s.html index c6686deb..72f1bd1b 100644 --- a/Ada95/html/terminal_interface-curses-text_io-fixed_io_s.html +++ b/Ada95/html/terminal_interface-curses-text_io-fixed_io_s.html @@ -12,23 +12,36 @@ -- ---- S P E C ---- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. ---- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.4 @ +-- @Revision: 1.5 @------------------------------------------------------------------------------generic type Num isdelta <>; diff --git a/Ada95/html/terminal_interface-curses-text_io-float_io_s.html b/Ada95/html/terminal_interface-curses-text_io-float_io_s.html index cf5cc4a4..9d337e18 100644 --- a/Ada95/html/terminal_interface-curses-text_io-float_io_s.html +++ b/Ada95/html/terminal_interface-curses-text_io-float_io_s.html @@ -12,23 +12,36 @@ -- ---- S P E C ---- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. ---- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.4 @ +-- @Revision: 1.5 @------------------------------------------------------------------------------generic type Num isdigits <>; diff --git a/Ada95/html/terminal_interface-curses-text_io-integer_io_s.html b/Ada95/html/terminal_interface-curses-text_io-integer_io_s.html index 052606a4..6346da73 100644 --- a/Ada95/html/terminal_interface-curses-text_io-integer_io_s.html +++ b/Ada95/html/terminal_interface-curses-text_io-integer_io_s.html @@ -12,23 +12,36 @@ -- ---- S P E C ---- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. ---- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.4 @ +-- @Revision: 1.5 @------------------------------------------------------------------------------generic type Num isrange <>; diff --git a/Ada95/html/terminal_interface-curses-text_io-modular_io_s.html b/Ada95/html/terminal_interface-curses-text_io-modular_io_s.html index d01cad1b..fa631501 100644 --- a/Ada95/html/terminal_interface-curses-text_io-modular_io_s.html +++ b/Ada95/html/terminal_interface-curses-text_io-modular_io_s.html @@ -12,23 +12,36 @@ -- ---- S P E C ---- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. ---- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.4 @ +-- @Revision: 1.5 @------------------------------------------------------------------------------generic type Num ismod <>; diff --git a/Ada95/html/terminal_interface-curses-text_io_s.html b/Ada95/html/terminal_interface-curses-text_io_s.html index d7af6f4a..1b88db78 100644 --- a/Ada95/html/terminal_interface-curses-text_io_s.html +++ b/Ada95/html/terminal_interface-curses-text_io_s.html @@ -12,23 +12,36 @@ -- ---- S P E C ---- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. ---- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.5 @ +-- @Revision: 1.6 @------------------------------------------------------------------------------with System; with System.Parameters; diff --git a/Ada95/html/terminal_interface-curses_s.html b/Ada95/html/terminal_interface-curses_s.html index 6eaf8bae..e294a6d3 100644 --- a/Ada95/html/terminal_interface-curses_s.html +++ b/Ada95/html/terminal_interface-curses_s.html @@ -14,25 +14,38 @@ -- ---- S P E C ---- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. ---- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.7 @ +-- @Revision: 1.9 @------------------------------------------------------------------------------ --- curses binding, generated at Sun Feb 2 17:21:42 1997 +-- curses binding.-- This module is generated. Please don't change it manually!-- Run the generator instead.-- | @@ -190,6 +203,7 @@ 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 := Special_Key_Code'Last; @@ -445,7 +459,7 @@ ACS_Down_Arrow : constant Character := '.'; ACS_Up_Arrow : constant Character := '-'; ACS_Board_Of_Squares : constant Character := 'h'; - ACS_Lantern : constant Character := 'I'; + 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'; @@ -1346,28 +1360,46 @@ function Get_Soft_Label_Key_Attributes return Color_Pair; -- AKA: slk_attr() + -- |===================================================================== + -- | Man page keyok.3x + -- |===================================================================== + + -- | + procedure Enable_Key (Key : in Special_Key_Code; + Enable : in Boolean := True); + -- AKA: keyok() + + -- |===================================================================== + -- | Man page define_key.3x + -- |===================================================================== + + -- | + procedure Define_Key (Definition : in String; + Key : in Special_Key_Code); + -- AKA: define_key() + -- |=====================================================================-- | Man page curs_util.3x-- |=====================================================================-- | Not implemented : filter, use_env, putwin, getwin-- - -- | + -- |procedure Key_Name (Key : in Real_Key_Code; Name : out String); -- AKA: keyname()-- The external name for a real keystroke. - -- | + -- |procedure Un_Control (Ch : in Attributed_Character; Str : out String); -- AKA: unctrl() - -- | + -- |procedure Delay_Output (Msecs : in Natural); -- AKA: delay_output() - -- | + -- |procedure Flush_Input; -- AKA: flushinp() @@ -1375,35 +1407,35 @@ -- | Man page curs_termattrs.3x-- |===================================================================== - -- | + -- |function Baudrate return Natural; -- AKA: baudrate() - -- | + -- |function Erase_Character return Character; -- AKA: erasechar() - -- | + -- |function Kill_Character return Character; -- AKA: killchar() - -- | + -- |function Has_Insert_Character return Boolean; -- AKA: has_ic() - -- | + -- |function Has_Insert_Line return Boolean; -- AKA: has_il() - -- | + -- |function Supported_Attributes return Character_Attribute_Set; -- AKA: termattrs() - -- | + -- |procedure Long_Name (Name : out String); -- AKA: longname() - -- | + -- |procedure Terminal_Name (Name : out String); -- AKA: termname() @@ -1411,39 +1443,39 @@ -- | Man page curs_color.3x-- |===================================================================== - -- | + -- |procedure Start_Color; -- AKA: start_clolor()pragma Import (C, Start_Color, "start_color"); - -- | + -- |procedure Init_Pair (Pair : in Redefinable_Color_Pair; Fore : in Color_Number; Back : in Color_Number); -- AKA: init_pair() - -- | + -- |procedure Pair_Content (Pair : in Color_Pair; Fore : out Color_Number; Back : out Color_Number); -- AKA: pair_content() - -- | + -- |function Has_Colors return Boolean; -- AKA: has_colors() - -- | + -- |procedure Init_Color (Color : in Color_Number; Red : in RGB_Value; Green : in RGB_Value; Blue : in RGB_Value); -- AKA: init_color() - -- | + -- |function Can_Change_Color return Boolean; -- AKA: can_change_color() - -- | + -- |procedure Color_Content (Color : in Color_Number; Red : out RGB_Value; Green : out RGB_Value; @@ -1458,21 +1490,21 @@ -- type Curses_Mode is (Curses, Shell); - -- | + -- |procedure Save_Curses_Mode (Mode : in Curses_Mode); -- AKA: def_prog_mode()-- AKA: def_shell_mode() - -- | + -- |procedure Reset_Curses_Mode (Mode : in Curses_Mode); -- AKA: reset_prog_mode()-- AKA: reset_shell_mode() - -- | + -- |procedure Save_Terminal_State; -- AKA: savetty() - -- | + -- |procedure Reset_Terminal_State; -- AKA: resetty(); @@ -1484,7 +1516,7 @@ -- a good practice to return 0 if you think all went fine-- and -1 otherwise. - -- | + -- |procedure Rip_Off_Lines (Lines : in Integer; Proc : in Stdscr_Init_Proc); -- AKA: ripoffline() @@ -1495,11 +1527,11 @@ type Cursor_Visibility is (Invisible, Normal, Very_Visible); - -- | + -- |procedure Set_Cursor_Visibility (Visibility : in out Cursor_Visibility); -- AKA: curs_set() - -- | + -- |procedure Nap_Milli_Seconds (Ms : in Natural); -- AKA: napms() diff --git a/Ada95/html/terminal_interface_s.html b/Ada95/html/terminal_interface_s.html index 32d50f4c..e405d092 100644 --- a/Ada95/html/terminal_interface_s.html +++ b/Ada95/html/terminal_interface_s.html @@ -12,23 +12,36 @@ -- ---- S P E C ---- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free Software Foundation, Inc. ---- -- --- The ncurses Ada95 binding is copyrighted 1996 by -- --- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- 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: ---- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. ---- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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. -------------------------------------------------------------------------------- +-- Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de ---- Version Control: --- @Revision: 1.3 @ +-- @Revision: 1.4 @------------------------------------------------------------------------------package Terminal_Interface is-- diff --git a/Ada95/html/wresize.3x.html b/Ada95/html/wresize.3x.html index 3c1d67b1..a5fd1ab8 100644 --- a/Ada95/html/wresize.3x.html +++ b/Ada95/html/wresize.3x.html @@ -40,7 +40,7 @@

    SEE ALSO

    -       resizeterm(3x).
    +       resizeterm(3X).
     
     
     
    diff --git a/Ada95/samples/Makefile.in b/Ada95/samples/Makefile.in index 2130e4a3..09ed5518 100644 --- a/Ada95/samples/Makefile.in +++ b/Ada95/samples/Makefile.in @@ -1,32 +1,41 @@ -#---------------------------------------------------------------------------- -# -- -# GNAT ncurses Binding -- -# samples/Makefile -- -# -- -# Version 00.92 -- -# -- -# The ncurses Ada95 binding is copyrighted 1996 by -- -# Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- -# -- -# Permission is hereby granted to reproduce and distribute this -- -# binding by any means and for any fee, whether alone or as part -- -# of a larger distribution, in source or in binary form, PROVIDED -- -# this notice is included with any such distribution, and is not -- -# removed from any of its header files. Mention of ncurses and the -- -# author of this binding in any applications linked with it is -- -# highly appreciated. -- -# -- -# This binding comes AS IS with no warranty, implied or expressed. -- -#---------------------------------------------------------------------------- +############################################################################## +# Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +# # Version Control -# $Revision: 1.7 $ +# $Revision: 1.16 $ # .SUFFIXES: SHELL = /bin/sh THIS = Makefile -MODEL = ../../@DFT_OBJ_SUBDIR@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -66,19 +75,19 @@ ada_objdir=../ada_objects LD_FLAGS = @LD_MODEL@ $(LOCAL_LIBS) @LDFLAGS@ @LIBS@ @LOCAL_LDFLAGS2@ $(LDFLAGS) -ADA = @nc_ada_compiler@ +ADA = @cf_ada_compiler@ ADAFLAGS = @ADAFLAGS@ -I$(srcdir) -ADAMAKE = @nc_ada_make@ +ADAMAKE = @cf_ada_make@ ADAMAKEFLAGS = -aI$(srcdir) -aI$(ada_srcdir) -aI$(srcdir)/$(ada_srcdir) -aO$(ada_objdir) -ALIB = @nc_ada_package@ +ALIB = @cf_ada_package@ ABASE = $(ALIB)-curses CARGS =-cargs $(ADAFLAGS) LARGS =-largs -L../../lib $(LD_FLAGS) -PROGS = tour +PROGS = tour rain TOUR_OBJS = tour.o sample.o sample-curses_demo.o sample-explanation.o \ sample-form_demo.o sample-function_key_setting.o \ @@ -88,7 +97,20 @@ TOUR_OBJS = tour.o sample.o sample-curses_demo.o sample-explanation.o \ sample-curses_demo-attributes.o sample-curses_demo-mouse.o \ sample-form_demo-aux.o sample-my_field_type.o -all :: demo1 +RAIN_OBJS = rain.o status.o + +all :: demo1 rainy_day + @ + +sources : + @ + +install \ +install.libs :: + @ + +uninstall \ +uninstall.libs :: @ demo1: explain.msg @@ -97,15 +119,18 @@ demo1: explain.msg explain.msg: $(srcdir)/explain.txt cp $(srcdir)/explain.txt $@ -clean :: +rainy_day: + $(ADAMAKE) $(ADAMAKEFLAGS) rain $(CARGS) $(LARGS) + +mostlyclean: + @ + +clean :: mostlyclean rm -f *.o *.ali b_t*.* *.s $(PROGS) a.out core b_*_test.c *.xr[bs] explain.msg distclean :: clean rm -f Makefile -mostlyclean :: clean - @ - realclean :: distclean @ diff --git a/Ada95/samples/explain.txt b/Ada95/samples/explain.txt index 51c7d695..570f617b 100644 --- a/Ada95/samples/explain.txt +++ b/Ada95/samples/explain.txt @@ -3,7 +3,7 @@ This is Version 00.90.00 of the demo package. #MENUKEYS In a menu you can use the following Keys in the whole application: - - CTRL-Q Quit the menu + - CTRL-X eXit the menu - CTRL-N Go to next item - CTRL-P Go to previous item - CTRL-U Scroll up one line @@ -12,11 +12,11 @@ In a menu you can use the following Keys in the whole application: - PAGE DOWN Scroll down one page - PAGE UP Scroll back one page - CTRL-B Scroll back one page - - CTRL-X Clear pattern + - CTRL-Y Clear pattern - CTRL-H Delete last character from pattern - Backspace Delete last character from pattern - CTRL-A Next pattern match - - CTRL-Z Previous pattern match + - CTRL-E Previous pattern match - CTRL-T Toggle item in a multi-selection menu - CR or LF Select an item - HOME Key Go to the first item @@ -27,19 +27,20 @@ In a menu you can use the following Keys in the whole application: - Cursor Right Right one item - END Key Go to last item #FORMKEYS - - CTRL-Q Quit the form - - CTRL-F Go to the next page of the form - - CTRL-B Go to the previous page of the form - - CTRL-N Go to the next field - - CTRL-P Go to the previous field + - CTRL-X eXit the form + - CTRL-F Go forward to the next field + - CTRL-B Go backward to the previous field - CTRL-L Go to the field left of the current one - CTRL-R Go to the field right of the current one - CTRL-U Go to the field above the current one - CTRL-D Go to the field below the current one + - CTRL-W Go to the next word in the field - CTRL-T Go to the previous word in the field - - CTRL-S Go to the beginning of the field + + - CTRL-A Go to the beginning of the field - CTRL-E Go to the end of the field + - CTRL-I Insert a blank character at the current position - CTRL-O Insert a line - CTRL-V Delete a character @@ -47,9 +48,9 @@ In a menu you can use the following Keys in the whole application: - CTRL-Y Delete a line - CTRL-G Delete a word - CTRL-K Clear to end of field - - CTRL-X Clear the field - - CTRL-A Next choice in a choice field (Enumerations etc.) - - CTRL-Z Previous choice in a choice field. + + - CTRL-N Next choice in a choice field (Enumerations etc.) + - CTRL-P Previous choice in a choice field. #HELP #HELPKEYS You may scroll with the Cursor Up/Down Keys. @@ -75,8 +76,8 @@ You may select this options: You may press at any place in this demo CTRL-C. This will give you a command window. You can just type in the Label-String of a function key, then this key will be simulated. This should help you to run the application even if -you run it on a terminal with no or only a few function keys. With CTRL-A -and CTRL-Z you may browse through the possible values in the command window. +you run it on a terminal with no or only a few function keys. With CTRL-N +and CTRL-P you may browse through the possible values in the command window. #MENU00 Here we give you a selection of various menu demonstrations. #MENU-PAD00 diff --git a/Ada95/samples/rain.adb b/Ada95/samples/rain.adb new file mode 100644 index 00000000..c29cd98d --- /dev/null +++ b/Ada95/samples/rain.adb @@ -0,0 +1,161 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Rain -- +-- -- +-- B O D Y -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Laurent Pautet 1997 (modified by J.Pfeifer) +-- Version Control +-- $Revision: 1.3 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +-- -- +with Ada.Numerics.Float_Random; use Ada.Numerics.Float_Random; +with Status; use Status; +with Terminal_Interface.Curses; use Terminal_Interface.Curses; + +procedure Rain is + + Visibility : Cursor_Visibility; + + subtype X_Position is Line_Position; + subtype Y_Position is Column_Position; + + Xpos : array (1 .. 5) of X_Position; + Ypos : array (1 .. 5) of Y_Position; + + N : Integer; + + G : Generator; + + Max_X, X : X_Position; + Max_Y, Y : Y_Position; + + procedure Next (J : in out Integer); + procedure Cursor (X : X_Position; Y : Y_Position); + + procedure Next (J : in out Integer) is + begin + if J = 5 then + J := 1; + else + J := J + 1; + end if; + end Next; + + procedure Cursor (X : X_Position; Y : Y_Position) is + begin + Move_Cursor (Line => X, Column => Y); + end Cursor; + pragma Inline (Cursor); + +begin + + Init_Screen; + Set_NL_Mode; + Set_Echo_Mode (False); + + Visibility := Invisible; + Set_Cursor_Visibility (Visibility); + + Max_X := Lines - 5; + Max_Y := Columns - 5; + + for I in Xpos'Range loop + Xpos (I) := X_Position (Float (Max_X) * Random (G)) + 2; + Ypos (I) := Y_Position (Float (Max_Y) * Random (G)) + 2; + end loop; + + N := 1; + while Process.Continue loop + + X := X_Position (Float (Max_X) * Random (G)) + 2; + Y := Y_Position (Float (Max_Y) * Random (G)) + 2; + + Cursor (X, Y); + Add (Ch => '.'); + + Cursor (Xpos (N), Ypos (N)); + Add (Ch => 'o'); + + -- + Next (N); + Cursor (Xpos (N), Ypos (N)); + Add (Ch => 'O'); + + -- + Next (N); + Cursor (Xpos (N) - 1, Ypos (N)); + Add (Ch => '-'); + Cursor (Xpos (N), Ypos (N) - 1); + Add (Str => "|.|"); + Cursor (Xpos (N) + 1, Ypos (N)); + Add (Ch => '-'); + + -- + Next (N); + Cursor (Xpos (N) - 2, Ypos (N)); + Add (Ch => '-'); + Cursor (Xpos (N) - 1, Ypos (N) - 1); + Add (Str => "/\\"); + Cursor (Xpos (N), Ypos (N) - 2); + Add (Str => "| O |"); + Cursor (Xpos (N) + 1, Ypos (N) - 1); + Add (Str => "\\/"); + Cursor (Xpos (N) + 2, Ypos (N)); + Add (Ch => '-'); + + -- + Next (N); + Cursor (Xpos (N) - 2, Ypos (N)); + Add (Ch => ' '); + Cursor (Xpos (N) - 1, Ypos (N) - 1); + Add (Str => " "); + Cursor (Xpos (N), Ypos (N) - 2); + Add (Str => " "); + Cursor (Xpos (N) + 1, Ypos (N) - 1); + Add (Str => " "); + Cursor (Xpos (N) + 2, Ypos (N)); + Add (Ch => ' '); + + Xpos (N) := X; + Ypos (N) := Y; + + Refresh; + Nap_Milli_Seconds (50); + end loop; + + Visibility := Normal; + Set_Cursor_Visibility (Visibility); + End_Windows; + +end Rain; diff --git a/Ada95/samples/rain.ads b/Ada95/samples/rain.ads new file mode 100644 index 00000000..3f075e7f --- /dev/null +++ b/Ada95/samples/rain.ads @@ -0,0 +1,42 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Rain -- +-- -- +-- S P E C -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Laurent Pautet 1997 (modified by J.Pfeifer) +-- Version Control +-- $Revision: 1.3 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +-- -- +procedure Rain; diff --git a/Ada95/samples/sample-curses_demo-attributes.adb b/Ada95/samples/sample-curses_demo-attributes.adb index d1eb8f71..9b9089a5 100644 --- a/Ada95/samples/sample-curses_demo-attributes.adb +++ b/Ada95/samples/sample-curses_demo-attributes.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.4 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; diff --git a/Ada95/samples/sample-curses_demo-attributes.ads b/Ada95/samples/sample-curses_demo-attributes.ads index fc93e747..30f82577 100644 --- a/Ada95/samples/sample-curses_demo-attributes.ads +++ b/Ada95/samples/sample-curses_demo-attributes.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ package Sample.Curses_Demo.Attributes is diff --git a/Ada95/samples/sample-curses_demo-mouse.adb b/Ada95/samples/sample-curses_demo-mouse.adb index e8351598..0240da5f 100644 --- a/Ada95/samples/sample-curses_demo-mouse.adb +++ b/Ada95/samples/sample-curses_demo-mouse.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.4 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; diff --git a/Ada95/samples/sample-curses_demo-mouse.ads b/Ada95/samples/sample-curses_demo-mouse.ads index ad3e5dac..49eb84ab 100644 --- a/Ada95/samples/sample-curses_demo-mouse.ads +++ b/Ada95/samples/sample-curses_demo-mouse.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ package Sample.Curses_Demo.Mouse is diff --git a/Ada95/samples/sample-curses_demo.adb b/Ada95/samples/sample-curses_demo.adb index 81ac9a5a..aa5b1091 100644 --- a/Ada95/samples/sample-curses_demo.adb +++ b/Ada95/samples/sample-curses_demo.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Terminal_Interface.Curses.Menus; use Terminal_Interface.Curses.Menus; @@ -43,6 +57,12 @@ with Sample.Curses_Demo.Attributes; package body Sample.Curses_Demo is + type User_Data is new Integer; + type User_Data_Access is access all User_Data; + package PUD is new Panels.User_Data (User_Data, User_Data_Access); + -- We use above instantiation of the generic User_Data package to + -- demonstrate and test the use of the user data maechanism. + procedure Demo is function My_Driver (M : Menu; @@ -50,20 +70,25 @@ package body Sample.Curses_Demo is Pan : Panel) return Boolean; package Mh is new Sample.Menu_Demo.Handler (My_Driver); - Itm : constant Item_Array (1 .. 2) := + Itm : Item_Array_Access := new Item_Array' (New_Item ("Attributes Demo"), - New_Item ("Mouse Demo")); - M : Menu := New_Menu (Itm); + New_Item ("Mouse Demo"), + Null_Item); + M : Menu := New_Menu (Itm); + U1 : User_Data_Access := new User_Data'(4711); + U2 : User_Data_Access; function My_Driver (M : Menu; K : Key_Code; Pan : Panel) return Boolean is Idx : constant Positive := Get_Index (Current (M)); + Result : Boolean := False; begin + PUD.Set_User_Data (Pan, U1); -- set some user data, just for fun if K in User_Key_Code'Range then if K = QUIT then - return True; + Result := True; elsif K = SELECT_ITEM then if Idx in Itm'Range then Hide (Pan); @@ -82,16 +107,18 @@ package body Sample.Curses_Demo is end if; end if; end if; - return False; + PUD.Get_User_Data (Pan, U2); -- get the user data + pragma Assert (U1.all = U2.all and then U1 = U2); + return Result; end My_Driver; begin - if Item_Count (M) /= Itm'Length then + if (1 + Item_Count (M)) /= Itm'Length then raise Constraint_Error; end if; - if not Has_Key (Key_Mouse) then + if not Has_Mouse then declare O : Item_Option_Set; begin @@ -110,7 +137,7 @@ package body Sample.Curses_Demo is Pop_Environment; Delete (M); - + Free (Itm, True); end Demo; end Sample.Curses_Demo; diff --git a/Ada95/samples/sample-curses_demo.ads b/Ada95/samples/sample-curses_demo.ads index 49e5fb6c..eb1f691e 100644 --- a/Ada95/samples/sample-curses_demo.ads +++ b/Ada95/samples/sample-curses_demo.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ package Sample.Curses_Demo is diff --git a/Ada95/samples/sample-explanation.adb b/Ada95/samples/sample-explanation.adb index 67930911..eb7f4577 100644 --- a/Ada95/samples/sample-explanation.adb +++ b/Ada95/samples/sample-explanation.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.6 $ +-- $Revision: 1.9 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ -- Poor mans help system. This scans a sequential file for key lines and -- then reads the lines up to the next key. Those lines are presented in diff --git a/Ada95/samples/sample-explanation.ads b/Ada95/samples/sample-explanation.ads index 3eaecbe3..ff7bd4ba 100644 --- a/Ada95/samples/sample-explanation.ads +++ b/Ada95/samples/sample-explanation.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ -- Poor mans help system. This scans a sequential file for key lines and -- then reads the lines up to the next key. Those lines are presented in diff --git a/Ada95/samples/sample-form_demo-aux.adb b/Ada95/samples/sample-form_demo-aux.adb index 2f3f24e7..6da5e951 100644 --- a/Ada95/samples/sample-form_demo-aux.adb +++ b/Ada95/samples/sample-form_demo-aux.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.5 $ +-- $Revision: 1.9 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; @@ -120,36 +134,40 @@ package body Sample.Form_Demo.Aux is K := Get_Key (W); if K in Special_Key_Code'Range then case K is - when HELP_CODE => Explain_Context; - when EXPLAIN_CODE => Explain ("FORMKEYS"); - when Key_Home => return F_First_Field; - when Key_End => return F_Last_Field; - when QUIT_CODE => return QUIT; - when Key_Cursor_Down => return F_Down_Char; - when Key_Cursor_Up => return F_Up_Char; - when Key_Cursor_Left => return F_Left_Char; - when Key_Cursor_Right => return F_Right_Char; - when Key_Next_Page => return F_ScrollForward_Line; - when Key_Previous_Page => return F_ScrollBackward_Line; - when Key_Backspace => return F_Delete_Previous; - when others => return K; + when HELP_CODE => Explain_Context; + when EXPLAIN_CODE => Explain ("FORMKEYS"); + when Key_Home => return F_First_Field; + when Key_End => return F_Last_Field; + when QUIT_CODE => return QUIT; + when Key_Cursor_Down => return F_Down_Char; + when Key_Cursor_Up => return F_Up_Char; + when Key_Cursor_Left => return F_Previous_Char; + when Key_Cursor_Right => return F_Next_Char; + when Key_Next_Page => return F_Next_Page; + when Key_Previous_Page => return F_Previous_Page; + when Key_Backspace => return F_Delete_Previous; + when Key_Clear_Screen => return F_Clear_Field; + when Key_Clear_End_Of_Line => return F_Clear_EOF; + when others => return K; end case; elsif K in Normal_Key_Code'Range then Ch := Character'Val (K); case Ch is - when DC1 => return QUIT; -- CTRL-Q - when ACK => return F_Next_Page; -- CTRL-F - when STX => return F_Previous_Page; -- CTRL-B - when SO => return F_Next_Field; -- CTRL-N - when DLE => return F_Previous_Field; -- CTRL-P + when CAN => return QUIT; -- CTRL-X + + when ACK => return F_Next_Field; -- CTRL-F + when STX => return F_Previous_Field; -- CTRL-B when FF => return F_Left_Field; -- CTRL-L when DC2 => return F_Right_Field; -- CTRL-R when NAK => return F_Up_Field; -- CTRL-U when EOT => return F_Down_Field; -- CTRL-D + when ETB => return F_Next_Word; -- CTRL-W when DC4 => return F_Previous_Word; -- CTRL-T - when DC3 => return F_Begin_Field; -- CTRL-S + + when SOH => return F_Begin_Field; -- CTRL-A when ENQ => return F_End_Field; -- CTRL-E + when HT => return F_Insert_Char; -- CTRL-I when SI => return F_Insert_Line; -- CTRL-O when SYN => return F_Delete_Char; -- CTRL-V @@ -157,9 +175,10 @@ package body Sample.Form_Demo.Aux is when EM => return F_Delete_Line; -- CTRL-Y when BEL => return F_Delete_Word; -- CTRL-G when VT => return F_Clear_EOF; -- CTRL-K - when CAN => return F_Clear_Field; -- CTRL-X - when SOH => return F_Next_Choice; -- CTRL-A - when SUB => return F_Previous_Choice; -- CTRL-Z + + when SO => return F_Next_Choice; -- CTRL-N + when DLE => return F_Previous_Choice; -- CTRL-P + when CR | LF => if Handle_CRLF then return F_New_Line; @@ -224,12 +243,11 @@ package body Sample.Form_Demo.Aux is is N : Natural := 0; O : Field_Option_Set; - A : constant Field_Array_Access := Fields (F); H : constant Natural := Field_Count (F); begin if H > 0 then for I in 1 .. H loop - Get_Options (A.all (I), O); + Get_Options (Fields (F, I), O); if O.Active then N := N + 1; end if; diff --git a/Ada95/samples/sample-form_demo-aux.ads b/Ada95/samples/sample-form_demo-aux.ads index d1927985..1fd44778 100644 --- a/Ada95/samples/sample-form_demo-aux.ads +++ b/Ada95/samples/sample-form_demo-aux.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; diff --git a/Ada95/samples/sample-form_demo-handler.adb b/Ada95/samples/sample-form_demo-handler.adb index 6f992b7d..2678027d 100644 --- a/Ada95/samples/sample-form_demo-handler.adb +++ b/Ada95/samples/sample-form_demo-handler.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; with Sample.Form_Demo.Aux; diff --git a/Ada95/samples/sample-form_demo-handler.ads b/Ada95/samples/sample-form_demo-handler.ads index 33c9f146..4754563a 100644 --- a/Ada95/samples/sample-form_demo-handler.ads +++ b/Ada95/samples/sample-form_demo-handler.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; diff --git a/Ada95/samples/sample-form_demo.adb b/Ada95/samples/sample-form_demo.adb index 9d4390f6..62189267 100644 --- a/Ada95/samples/sample-form_demo.adb +++ b/Ada95/samples/sample-form_demo.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; @@ -32,7 +46,6 @@ with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; 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.Keyboard_Handler; use Sample.Keyboard_Handler; with Sample.My_Field_Type; use Sample.My_Field_Type; with Sample.Manifest; use Sample.Manifest; @@ -41,6 +54,12 @@ with Sample.Form_Demo.Aux; use Sample.Form_Demo.Aux; with Sample.Function_Key_Setting; use Sample.Function_Key_Setting; with Sample.Form_Demo.Handler; +with Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada; +with Terminal_Interface.Curses.Forms.Field_Types.Enumeration; +use Terminal_Interface.Curses.Forms.Field_Types.Enumeration; +with Terminal_Interface.Curses.Forms.Field_Types.IntField; +use Terminal_Interface.Curses.Forms.Field_Types.IntField; + package body Sample.Form_Demo is type User_Data is @@ -57,33 +76,32 @@ package body Sample.Form_Demo is Terminal_Interface.Curses.Forms.Form_User_Data (User_Data, User_Access); - Enums : constant Enum_Array := (new String'("alpha"), - new String'("beta"), - new String'("gamma")); + type Weekday is (Sunday, Monday, Tuesday, Wednesday, Thursday, + Friday, Saturday); - Enum_Info : constant Enumeration_Info := (Enums'Length, Enums, - False, False); + package Weekday_Enum is new + Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada (Weekday); - Enum_Field : constant Enumeration_Field := Create (Enum_Info, True); + Enum_Field : constant Enumeration_Field := + Weekday_Enum.Create; procedure Demo is Mft : My_Data := (Ch => 'X'); - FA : Field_Array (1 .. 9) := (Make (0, 14, "Sample Entry Form"), - Make (2, 0, "An Enumeration"), - Make (2, 20, "Numeric 1-10"), - Make (2, 34, "Only 'X'"), - Make (5, 0, - "Multiple Lines offscreen (Scroll)"), - - Make (Width => 18, Top => 3, Left => 0), - Make (Width => 12, Top => 3, Left => 20), - Make (Width => 12, Top => 3, Left => 34), - Make (Width => 46, Top => 6, Left => 0, - Height => 4, Off_Screen => 2) - ); + FA : Field_Array_Access := new Field_Array' + (Make (0, 14, "Sample Entry Form"), + Make (2, 0, "WeekdayEnumeration"), + Make (2, 20, "Numeric 1-10"), + Make (2, 34, "Only 'X'"), + Make (5, 0, "Multiple Lines offscreen(Scroll)"), + Make (Width => 18, Top => 3, Left => 0), + Make (Width => 12, Top => 3, Left => 20), + Make (Width => 12, Top => 3, Left => 34), + Make (Width => 46, Top => 6, Left => 0, Height => 4, Off_Screen => 2), + Null_Field + ); Frm : Terminal_Interface.Curses.Forms.Form := Create (FA); @@ -100,9 +118,9 @@ package body Sample.Form_Demo is Notepad ("FORM-PAD00"); Default_Labels; - Set_Type (FA (6), Enum_Field); - Set_Type (FA (7), I_F); - Set_Type (FA (8), Mft); + Set_Field_Type (FA (6), Enum_Field); + Set_Field_Type (FA (7), I_F); + Set_Field_Type (FA (8), Mft); F1 := new User_Data'(Data => 4711); Fld_U.Set_User_Data (FA (1), F1); @@ -116,9 +134,7 @@ package body Sample.Form_Demo is Pop_Environment; Delete (Frm); - for I in FA'Range loop - Delete (FA (I)); - end loop; + Free (FA, True); end Demo; end Sample.Form_Demo; diff --git a/Ada95/samples/sample-form_demo.ads b/Ada95/samples/sample-form_demo.ads index 42fdec6b..7d9a2772 100644 --- a/Ada95/samples/sample-form_demo.ads +++ b/Ada95/samples/sample-form_demo.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ package Sample.Form_Demo is diff --git a/Ada95/samples/sample-function_key_setting.adb b/Ada95/samples/sample-function_key_setting.adb index 4cae7275..979fefd0 100644 --- a/Ada95/samples/sample-function_key_setting.adb +++ b/Ada95/samples/sample-function_key_setting.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.3 $ +-- $Revision: 1.6 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; with Sample.Manifest; use Sample.Manifest; diff --git a/Ada95/samples/sample-function_key_setting.ads b/Ada95/samples/sample-function_key_setting.ads index 6199094d..71c120f3 100644 --- a/Ada95/samples/sample-function_key_setting.ads +++ b/Ada95/samples/sample-function_key_setting.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; diff --git a/Ada95/samples/sample-header_handler.adb b/Ada95/samples/sample-header_handler.adb index b66402d8..4787f24f 100644 --- a/Ada95/samples/sample-header_handler.adb +++ b/Ada95/samples/sample-header_handler.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.4 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Ada.Calendar; use Ada.Calendar; with Terminal_Interface.Curses.Text_IO.Integer_IO; diff --git a/Ada95/samples/sample-header_handler.ads b/Ada95/samples/sample-header_handler.ads index a88b798d..d2124ddb 100644 --- a/Ada95/samples/sample-header_handler.ads +++ b/Ada95/samples/sample-header_handler.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; diff --git a/Ada95/samples/sample-helpers.adb b/Ada95/samples/sample-helpers.adb index 379b592a..533f411c 100644 --- a/Ada95/samples/sample-helpers.adb +++ b/Ada95/samples/sample-helpers.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; diff --git a/Ada95/samples/sample-helpers.ads b/Ada95/samples/sample-helpers.ads index 6b4ef2ae..d2f5f039 100644 --- a/Ada95/samples/sample-helpers.ads +++ b/Ada95/samples/sample-helpers.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; diff --git a/Ada95/samples/sample-keyboard_handler.adb b/Ada95/samples/sample-keyboard_handler.adb index c320cdd2..1d7a85a1 100644 --- a/Ada95/samples/sample-keyboard_handler.adb +++ b/Ada95/samples/sample-keyboard_handler.adb @@ -6,31 +6,48 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Ada.Strings; use Ada.Strings; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants; with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; +with Ada.Characters.Handling; use Ada.Characters.Handling; with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms; +with Terminal_Interface.Curses.Forms.Field_Types.Enumeration; +use Terminal_Interface.Curses.Forms.Field_Types.Enumeration; with Sample.Header_Handler; use Sample.Header_Handler; with Sample.Form_Demo.Aux; use Sample.Form_Demo.Aux; @@ -64,9 +81,10 @@ package body Sample.Keyboard_Handler is Labels : Label_Array; - FA : Field_Array (1 .. 2) := (Make (0, 0, "Command:"), - Make (Top => 0, Left => 9, - Width => Columns - 11)); + FA : Field_Array_Access := new Field_Array' + (Make (0, 0, "Command:"), + Make (Top => 0, Left => 9, Width => Columns - 11), + Null_Field); K : Real_Key_Code := Key_None; N : Natural := 0; @@ -93,7 +111,7 @@ package body Sample.Keyboard_Handler is Get_Buffer (Fld => FA (2), Str => Buffer); Trim (Buffer, Left); if Buffer (1) /= ' ' then - Cmdc := Buffer (Cmdc'Range); + Cmdc := To_Upper (Buffer (Cmdc'Range)); for I in Labels'Range loop if Cmdc = Labels (I) then K := Function_Key_Code @@ -136,7 +154,7 @@ package body Sample.Keyboard_Handler is end if; end loop; Enum_Field := Create (Enum_Info, True); - Set_Type (FA (2), Enum_Field); + Set_Field_Type (FA (2), Enum_Field); Set_Background (FA (2), Normal_Video); Fh.Drive_Me (Frm, Lines - 3, 0); @@ -144,9 +162,7 @@ package body Sample.Keyboard_Handler is Update_Panels; Update_Screen; end; end if; - for I in FA'Range loop - Delete (FA (I)); - end loop; + Free (FA, True); In_Command := False; return K; end Command; diff --git a/Ada95/samples/sample-keyboard_handler.ads b/Ada95/samples/sample-keyboard_handler.ads index 7927ac0e..9b870247 100644 --- a/Ada95/samples/sample-keyboard_handler.ads +++ b/Ada95/samples/sample-keyboard_handler.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; diff --git a/Ada95/samples/sample-manifest.ads b/Ada95/samples/sample-manifest.ads index 3f14246a..4d9aa502 100644 --- a/Ada95/samples/sample-manifest.ads +++ b/Ada95/samples/sample-manifest.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.4 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; diff --git a/Ada95/samples/sample-menu_demo-aux.adb b/Ada95/samples/sample-menu_demo-aux.adb index 9e091b2c..66e10c15 100644 --- a/Ada95/samples/sample-menu_demo-aux.adb +++ b/Ada95/samples/sample-menu_demo-aux.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.4 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; @@ -164,21 +178,21 @@ package body Sample.Menu_Demo.Aux is elsif K in Normal_Key_Code'Range then Ch := Character'Val (K); case Ch is - when DC1 => return QUIT; -- CTRL-Q + when CAN => return QUIT; -- CTRL-X when SO => return REQ_NEXT_ITEM; -- CTRL-N when DLE => return REQ_PREV_ITEM; -- CTRL-P when NAK => return REQ_SCR_ULINE; -- CTRL-U when EOT => return REQ_SCR_DLINE; -- CTRL-D when ACK => return REQ_SCR_DPAGE; -- CTRL-F when STX => return REQ_SCR_UPAGE; -- CTRL-B - when CAN => return REQ_CLEAR_PATTERN; -- CTRL-X + when EM => return REQ_CLEAR_PATTERN; -- CTRL-Y when BS => return REQ_BACK_PATTERN; -- CTRL-H when SOH => return REQ_NEXT_MATCH; -- CTRL-A - when SUB => return REQ_PREV_MATCH; -- CTRL-Z + when ENQ => return REQ_PREV_MATCH; -- CTRL-E when DC4 => return REQ_TOGGLE_ITEM; -- CTRL-T - when CR => return SELECT_ITEM; -- CTRL-M - when LF => return SELECT_ITEM; -- CTRL-J - when others => return K; + + when CR | LF => return SELECT_ITEM; + when others => return K; end case; else return K; diff --git a/Ada95/samples/sample-menu_demo-aux.ads b/Ada95/samples/sample-menu_demo-aux.ads index a1061305..1efbb3dc 100644 --- a/Ada95/samples/sample-menu_demo-aux.ads +++ b/Ada95/samples/sample-menu_demo-aux.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; diff --git a/Ada95/samples/sample-menu_demo-handler.adb b/Ada95/samples/sample-menu_demo-handler.adb index aa0c10ea..cac7578b 100644 --- a/Ada95/samples/sample-menu_demo-handler.adb +++ b/Ada95/samples/sample-menu_demo-handler.adb @@ -6,26 +6,41 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Sample.Menu_Demo.Aux; with Sample.Explanation; use Sample.Explanation; +with Sample.Manifest; use Sample.Manifest; package body Sample.Menu_Demo.Handler is @@ -60,9 +75,19 @@ package body Sample.Menu_Demo.Handler is case R is when Menu_Ok => null; when Unknown_Request => - if My_Driver (M, K, Pan) then - exit; - end if; + declare + I : constant Item := Current (M); + O : Item_Option_Set; + begin + Get_Options (I, O); + if K = SELECT_ITEM and then not O.Selectable then + Beep; + else + if My_Driver (M, K, Pan) then + exit; + end if; + end if; + end; when others => Beep; end case; end; diff --git a/Ada95/samples/sample-menu_demo-handler.ads b/Ada95/samples/sample-menu_demo-handler.ads index 107d1c7a..78a2ebb5 100644 --- a/Ada95/samples/sample-menu_demo-handler.ads +++ b/Ada95/samples/sample-menu_demo-handler.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; diff --git a/Ada95/samples/sample-menu_demo.adb b/Ada95/samples/sample-menu_demo.adb index 6006fc3c..1d08316f 100644 --- a/Ada95/samples/sample-menu_demo.adb +++ b/Ada95/samples/sample-menu_demo.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.4 $ +-- $Revision: 1.7 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; @@ -60,30 +74,20 @@ package body Sample.Menu_Demo is package Mh is new Sample.Menu_Demo.Handler (My_Driver); - I : constant Item_Array (1 .. 12) := (New_Item ("January", - "31 Days"), - New_Item ("February", - "28/29 Days"), - New_Item ("March", - "31 Days"), - New_Item ("April", - "30 Days"), - New_Item ("May", - "31 Days"), - New_Item ("June", - "30 Days"), - New_Item ("July", - "31 Days"), - New_Item ("August", - "31 Days"), - New_Item ("September", - "30 Days"), - New_Item ("October", - "31 Days"), - New_Item ("November", - "30 Days"), - New_Item ("December", - "31 Days")); + I : Item_Array_Access := new Item_Array' + (New_Item ("January", "31 Days"), + New_Item ("February", "28/29 Days"), + New_Item ("March", "31 Days"), + New_Item ("April", "30 Days"), + New_Item ("May", "31 Days"), + New_Item ("June", "30 Days"), + New_Item ("July", "31 Days"), + New_Item ("August", "31 Days"), + New_Item ("September", "30 Days"), + New_Item ("October", "31 Days"), + New_Item ("November", "30 Days"), + New_Item ("December", "31 Days"), + Null_Item); M : Menu := New_Menu (I); Flip_State : Boolean := True; @@ -300,7 +304,7 @@ package body Sample.Menu_Demo is Pop_Environment; Delete (M); - + Free (I, True); end Spacing_Test; end Spacing_Demo; @@ -323,9 +327,10 @@ package body Sample.Menu_Demo is package Mh is new Sample.Menu_Demo.Handler (My_Driver); - Itm : constant Item_Array (1 .. 2) := + Itm : Item_Array_Access := new Item_Array' (New_Item ("Menu Layout Options"), - New_Item ("Demo of Hook functions")); + New_Item ("Demo of Hook functions"), + Null_Item); M : Menu := New_Menu (Itm); U1 : User_Data_Access := new User_Data'(4711); @@ -381,6 +386,7 @@ package body Sample.Menu_Demo is Pop_Environment; Delete (M); + Free (Itm, True); end Demo; end Sample.Menu_Demo; diff --git a/Ada95/samples/sample-menu_demo.ads b/Ada95/samples/sample-menu_demo.ads index 797ed2b1..250e0892 100644 --- a/Ada95/samples/sample-menu_demo.ads +++ b/Ada95/samples/sample-menu_demo.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ package Sample.Menu_Demo is diff --git a/Ada95/samples/sample-my_field_type.adb b/Ada95/samples/sample-my_field_type.adb index 5becee3d..f2f1b112 100644 --- a/Ada95/samples/sample-my_field_type.adb +++ b/Ada95/samples/sample-my_field_type.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms; @@ -32,18 +46,20 @@ 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. - function F_Check (Fld : Field; Info : My_Access) return Boolean + function Field_Check (Fld : Field; + Typ : My_Data) return Boolean is begin return True; - end F_Check; + end Field_Check; -- Check exactly against the specified character. - function C_Check (Ch : Character; Info : My_Access) return Boolean + function Character_Check (Ch : Character; + Typ : My_Data) return Boolean is - C : constant Character := Info.Ch; + C : constant Character := Typ.Ch; begin return Ch = C; - end C_Check; + end Character_Check; end Sample.My_Field_Type; diff --git a/Ada95/samples/sample-my_field_type.ads b/Ada95/samples/sample-my_field_type.ads index cf4d8f9f..b05a3ef4 100644 --- a/Ada95/samples/sample-my_field_type.ads +++ b/Ada95/samples/sample-my_field_type.ads @@ -6,46 +6,57 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.3 $ +-- $Revision: 1.6 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms; -with Terminal_Interface.Curses.Forms.Field_Types; +with Terminal_Interface.Curses.Forms.Field_Types.User; +use Terminal_Interface.Curses.Forms.Field_Types.User; -- This is a very simple user defined field type. It accepts only a -- defined character as input into the field. -- package Sample.My_Field_Type is - type My_Data is new Ada_Defined_Field_Type with + type My_Data is new User_Defined_Field_Type with record Ch : Character; end record; - type My_Access is access My_Data; - -private - function F_Check (Fld : Field; Info : My_Access) return Boolean; - function C_Check (Ch : Character; Info : My_Access) return Boolean; + function Field_Check (Fld : Field; + Typ : My_Data) return Boolean; - package One_Character_Only is new - Terminal_Interface.Curses.Forms.Field_Types - (My_Data, My_Access, F_Check, C_Check); + function Character_Check (Ch : Character; + Typ : My_Data) return Boolean; end Sample.My_Field_Type; diff --git a/Ada95/samples/sample-text_io_demo.adb b/Ada95/samples/sample-text_io_demo.adb index d122801d..9962be9c 100644 --- a/Ada95/samples/sample-text_io_demo.adb +++ b/Ada95/samples/sample-text_io_demo.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Ada.Numerics.Generic_Elementary_Functions; with Ada.Numerics.Complex_Types; @@ -107,7 +121,6 @@ package body Sample.Text_IO_Demo is Notepad ("TEXTIO-PAD00"); Set_Echo_Mode (FALSE); - Set_Raw_Mode; Set_Meta_Mode; Set_KeyPad_Mode; W := Sub_Window (Standard_Window, Lines - 2, Columns - 2, 1, 1); diff --git a/Ada95/samples/sample-text_io_demo.ads b/Ada95/samples/sample-text_io_demo.ads index 557ce8a4..3d64b299 100644 --- a/Ada95/samples/sample-text_io_demo.ads +++ b/Ada95/samples/sample-text_io_demo.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ package Sample.Text_IO_Demo is diff --git a/Ada95/samples/sample.adb b/Ada95/samples/sample.adb index 8b3d55d5..ce0cc3a1 100644 --- a/Ada95/samples/sample.adb +++ b/Ada95/samples/sample.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.5 $ +-- $Revision: 1.8 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Text_IO; @@ -76,11 +90,12 @@ package body Sample is package Mh is new Sample.Menu_Demo.Handler (My_Driver); - I : constant Item_Array (1 .. 4) := + I : Item_Array_Access := new Item_Array' (New_Item ("Curses Core Demo"), New_Item ("Menu Demo"), New_Item ("Form Demo"), - New_Item ("Text IO Demo")); + New_Item ("Text IO Demo"), + Null_Item); M : Menu := New_Menu (I); @@ -121,7 +136,7 @@ package body Sample is begin - if Item_Count (M) /= I'Length then + if (1 + Item_Count (M)) /= I'Length then raise Constraint_Error; end if; @@ -147,6 +162,7 @@ package body Sample is pragma Assert (I1.Data = I2.Data); Delete (M); + Free (I, True); end Main_Menu; begin diff --git a/Ada95/samples/sample.ads b/Ada95/samples/sample.ads index 8a385d48..7522815b 100644 --- a/Ada95/samples/sample.ads +++ b/Ada95/samples/sample.ads @@ -6,23 +6,37 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ package Sample is procedure Whow; diff --git a/Ada95/samples/status.adb b/Ada95/samples/status.adb new file mode 100644 index 00000000..850e4e3c --- /dev/null +++ b/Ada95/samples/status.adb @@ -0,0 +1,56 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Status -- +-- -- +-- B O D Y -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control +-- $Revision: 1.3 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +-- This package has been contributed by Laurent Pautet -- +-- -- +package body Status is + + protected body Process is + procedure Stop is + begin + Done := True; + end Stop; + function Continue return Boolean is + begin + return not Done; + end Continue; + end Process; + +end Status; diff --git a/Ada95/samples/status.ads b/Ada95/samples/status.ads new file mode 100644 index 00000000..4b81b0a5 --- /dev/null +++ b/Ada95/samples/status.ads @@ -0,0 +1,55 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Status -- +-- -- +-- S P E C -- +-- -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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: Juergen Pfeifer 1996 +-- Version Control +-- $Revision: 1.3 $ +-- Binding Version 00.93 +------------------------------------------------------------------------------ +-- This package has been contributed by Laurent Pautet -- +-- -- +with Ada.Interrupts.Names; + +package Status is + + protected Process is + procedure Stop; + function Continue return Boolean; + pragma Attach_Handler (Stop, Ada.Interrupts.Names.SIGINT); + private + Done : Boolean := False; + end Process; + +end Status; diff --git a/Ada95/samples/tour.adb b/Ada95/samples/tour.adb index bbcdcd3a..920eb91a 100644 --- a/Ada95/samples/tour.adb +++ b/Ada95/samples/tour.adb @@ -6,23 +6,37 @@ -- -- -- B O D Y -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ with Sample; use Sample; diff --git a/Ada95/samples/tour.ads b/Ada95/samples/tour.ads index 9d8395c6..2abc440f 100644 --- a/Ada95/samples/tour.ads +++ b/Ada95/samples/tour.ads @@ -6,22 +6,36 @@ -- -- -- S P E C -- -- -- --- Version 00.92 -- +------------------------------------------------------------------------------ +-- Copyright (c) 1998 Free 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 ncurses Ada95 binding is copyrighted 1996 by -- --- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- -- -- --- Permission is hereby granted to reproduce and distribute this -- --- binding by any means and for any fee, whether alone or as part -- --- of a larger distribution, in source or in binary form, PROVIDED -- --- this notice is included with any such distribution, and is not -- --- removed from any of its header files. Mention of ncurses and the -- --- author of this binding in any applications linked with it is -- --- highly appreciated. -- +-- 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. -- -- -- --- This binding comes AS IS with no warranty, implied or expressed. -- +-- 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: Juergen Pfeifer 1996 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- Binding Version 00.93 ------------------------------------------------------------------------------ procedure Tour; diff --git a/INSTALL b/INSTALL index 0e6a92cb..b7504674 100644 --- a/INSTALL +++ b/INSTALL @@ -1,4 +1,4 @@ --- $Id: INSTALL,v 1.27 1997/04/26 23:48:19 tom Exp $ +-- $Id: INSTALL,v 1.28 1998/02/12 23:43:24 tom Exp $ --------------------------------------------------------------------- How to install Ncurses/Terminfo on your system --------------------------------------------------------------------- @@ -50,6 +50,8 @@ You will need the following in order to build and install ncurses under UNIX: * sed * BSD or System V style install (a script is enclosed) +Ncurses has been also built in the OS/2 EMX environment. + INSTALLATION PROCEDURE: 1. First, decide whether you want ncurses to replace your existing library (in @@ -196,6 +198,9 @@ INSTALLATION PROCEDURE: panels. You need to have c++ (and its libraries) installed before you can compile and run the demo. + If you do not have C++, you must use the --without-cxx option to tell + the configure script to not attempt to build the C++ bindings. + 7. If you're running an older Linux, you must either (a) tell Linux that the console terminal type is `linux' or (b) make a link to or copy of the linux entry in the appropriate place under your terminfo directory, named @@ -310,8 +315,10 @@ CONFIGURING FALLBACK ENTRIES 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. + 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). If you wanted (say) to have linux, vt100, and xterm fallbacks, you would use the commands @@ -411,13 +418,13 @@ USING NCURSES WITH EMACS: already be applied in your sources -- check for the #define TERMINFO. USING NCURSES WITH GPM: - Ncurses 4.1 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 of libcurses.so (the BSD curses) into - the libgpm.so file, producing symbol conflicts with ncurses. You may - be able to work around this problem by linking as follows: + 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 of libcurses.so (the BSD curses) + into the libgpm.so file, producing symbol conflicts with ncurses. You + may be able to work around this problem by linking as follows: cc -o foo foo.o -lncurses -lgpm -lncurses @@ -426,6 +433,9 @@ USING NCURSES WITH GPM: ftp.clark.net:/pub/dickey/ncurses/gpm-1.10-970125.tgz + This patch is incorporated in gpm 1.12; however some integrators + are slow to update this library. + USING NCURSES WITH ELVIS: To use ncurses as the screen-painting library for Elvis, apply the following patch to the Elvis curses @@ -464,4 +474,3 @@ BUGS: The Hacker's Guide in the misc directory includes some guidelines on how to report bugs in ways that will get them fixed most quickly. - diff --git a/MANIFEST b/MANIFEST index bb5df407..5dc59fae 100644 --- a/MANIFEST +++ b/MANIFEST @@ -5,10 +5,27 @@ ./Ada95/ada_include/Makefile.in ./Ada95/ada_include/terminal_interface-curses-aux.adb ./Ada95/ada_include/terminal_interface-curses-aux.ads -./Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.adb -./Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.ads +./Ada95/ada_include/terminal_interface-curses-forms-field_types-alpha.adb +./Ada95/ada_include/terminal_interface-curses-forms-field_types-alpha.ads +./Ada95/ada_include/terminal_interface-curses-forms-field_types-alphanumeric.adb +./Ada95/ada_include/terminal_interface-curses-forms-field_types-alphanumeric.ads +./Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration-ada.adb +./Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration-ada.ads +./Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration.adb +./Ada95/ada_include/terminal_interface-curses-forms-field_types-enumeration.ads +./Ada95/ada_include/terminal_interface-curses-forms-field_types-intfield.adb +./Ada95/ada_include/terminal_interface-curses-forms-field_types-intfield.ads +./Ada95/ada_include/terminal_interface-curses-forms-field_types-ipv4_address.adb +./Ada95/ada_include/terminal_interface-curses-forms-field_types-ipv4_address.ads +./Ada95/ada_include/terminal_interface-curses-forms-field_types-numeric.adb +./Ada95/ada_include/terminal_interface-curses-forms-field_types-numeric.ads +./Ada95/ada_include/terminal_interface-curses-forms-field_types-regexp.adb +./Ada95/ada_include/terminal_interface-curses-forms-field_types-regexp.ads +./Ada95/ada_include/terminal_interface-curses-forms-field_types-user-choice.adb +./Ada95/ada_include/terminal_interface-curses-forms-field_types-user-choice.ads +./Ada95/ada_include/terminal_interface-curses-forms-field_types-user.adb +./Ada95/ada_include/terminal_interface-curses-forms-field_types-user.ads ./Ada95/ada_include/terminal_interface-curses-forms-field_types.adb -./Ada95/ada_include/terminal_interface-curses-forms-field_types.ads ./Ada95/ada_include/terminal_interface-curses-forms-field_user_data.adb ./Ada95/ada_include/terminal_interface-curses-forms-form_user_data.adb ./Ada95/ada_include/terminal_interface-curses-forms.adb @@ -41,6 +58,7 @@ ./Ada95/gen/Makefile.in ./Ada95/gen/gen.c ./Ada95/gen/normal.m4 +./Ada95/gen/terminal_interface-curses-forms-field_types.ads.m4 ./Ada95/gen/terminal_interface-curses-forms-field_user_data.ads.m4 ./Ada95/gen/terminal_interface-curses-forms-form_user_data.ads.m4 ./Ada95/gen/terminal_interface-curses-forms.ads.m4 @@ -51,7 +69,6 @@ ./Ada95/gen/terminal_interface-curses-panels-user_data.ads.m4 ./Ada95/gen/terminal_interface-curses-panels.ads.m4 ./Ada95/gen/terminal_interface-curses.ads.m4 -./Ada95/html/Makefile ./Ada95/html/curs_addch.3x.html ./Ada95/html/curs_addchstr.3x.html ./Ada95/html/curs_addstr.3x.html @@ -92,6 +109,7 @@ ./Ada95/html/curs_touch.3x.html ./Ada95/html/curs_util.3x.html ./Ada95/html/curs_window.3x.html +./Ada95/html/define_key.3x.html ./Ada95/html/dft_fgbg.3x.html ./Ada95/html/form.3x.html ./Ada95/html/form_cursor.3x.html @@ -117,6 +135,7 @@ ./Ada95/html/form_userptr.3x.html ./Ada95/html/form_win.3x.html ./Ada95/html/index.html +./Ada95/html/keyok.3x.html ./Ada95/html/menu.3x.html ./Ada95/html/menu_attribs.3x.html ./Ada95/html/menu_cursor.3x.html @@ -144,7 +163,16 @@ ./Ada95/html/panel.3x.html ./Ada95/html/resizeterm.3x.html ./Ada95/html/table.html -./Ada95/html/terminal_interface-curses-forms-choice_field_types_s.html +./Ada95/html/terminal_interface-curses-forms-field_types-alpha_s.html +./Ada95/html/terminal_interface-curses-forms-field_types-alphanumeric_s.html +./Ada95/html/terminal_interface-curses-forms-field_types-enumeration-ada_s.html +./Ada95/html/terminal_interface-curses-forms-field_types-enumeration_s.html +./Ada95/html/terminal_interface-curses-forms-field_types-intfield_s.html +./Ada95/html/terminal_interface-curses-forms-field_types-ipv4_address_s.html +./Ada95/html/terminal_interface-curses-forms-field_types-numeric_s.html +./Ada95/html/terminal_interface-curses-forms-field_types-regexp_s.html +./Ada95/html/terminal_interface-curses-forms-field_types-user-choice_s.html +./Ada95/html/terminal_interface-curses-forms-field_types-user_s.html ./Ada95/html/terminal_interface-curses-forms-field_types_s.html ./Ada95/html/terminal_interface-curses-forms-field_user_data_s.html ./Ada95/html/terminal_interface-curses-forms-form_user_data_s.html @@ -169,6 +197,8 @@ ./Ada95/samples/Makefile.in ./Ada95/samples/README ./Ada95/samples/explain.txt +./Ada95/samples/rain.adb +./Ada95/samples/rain.ads ./Ada95/samples/sample-curses_demo-attributes.adb ./Ada95/samples/sample-curses_demo-attributes.ads ./Ada95/samples/sample-curses_demo-mouse.adb @@ -204,6 +234,8 @@ ./Ada95/samples/sample-text_io_demo.ads ./Ada95/samples/sample.adb ./Ada95/samples/sample.ads +./Ada95/samples/status.adb +./Ada95/samples/status.ads ./Ada95/samples/tour.adb ./Ada95/samples/tour.ads ./INSTALL @@ -221,34 +253,65 @@ ./c++/NEWS ./c++/PROBLEMS ./c++/README-first +./c++/cursesapp.cc +./c++/cursesapp.h +./c++/cursesf.cc +./c++/cursesf.h ./c++/cursesm.cc ./c++/cursesm.h +./c++/cursesmain.cc ./c++/cursesp.cc ./c++/cursesp.h ./c++/cursesw.cc ./c++/cursesw.h +./c++/cursslk.cc +./c++/cursslk.h ./c++/demo.cc -./c++/etip.h +./c++/edit_cfg.sh +./c++/etip.h.in +./c++/headers ./c++/internal.h ./c++/modules +./config.guess +./config.sub ./configure ./configure.in ./dist.mk ./form/Makefile.in ./form/READ.ME +./form/fld_arg.c +./form/fld_attr.c +./form/fld_current.c ./form/fld_def.c +./form/fld_dup.c +./form/fld_ftchoice.c +./form/fld_ftlink.c +./form/fld_info.c +./form/fld_just.c +./form/fld_link.c +./form/fld_max.c +./form/fld_move.c +./form/fld_newftyp.c +./form/fld_opts.c +./form/fld_pad.c +./form/fld_page.c ./form/fld_stat.c ./form/fld_type.c ./form/fld_user.c ./form/form.h ./form/form.priv.h ./form/frm_adabind.c +./form/frm_cursor.c ./form/frm_data.c ./form/frm_def.c ./form/frm_driver.c ./form/frm_hook.c ./form/frm_opts.c +./form/frm_page.c +./form/frm_post.c ./form/frm_req_name.c +./form/frm_scale.c +./form/frm_sub.c ./form/frm_user.c ./form/frm_win.c ./form/fty_alnum.c @@ -267,11 +330,12 @@ ./include/MKterm.h.awk.in ./include/Makefile.in ./include/capdefaults.c -./include/config_h.in ./include/curses.h.in ./include/edit_cfg.sh ./include/headers ./include/nc_alloc.h +./include/nc_panel.h +./include/ncurses_cfg.hin ./include/term_entry.h ./include/termcap.h.in ./include/tic.h @@ -321,6 +385,7 @@ ./man/curs_touch.3x ./man/curs_util.3x ./man/curs_window.3x +./man/define_key.3x ./man/dft_fgbg.3x ./man/form.3x ./man/form_cursor.3x @@ -346,6 +411,8 @@ ./man/form_userptr.3x ./man/form_win.3x ./man/infocmp.1m +./man/keyok.3x +./man/make_sed.sh ./man/man_db.renames ./man/menu.3x ./man/menu_attribs.3x @@ -398,15 +465,20 @@ ./menu/m_item_nam.c ./menu/m_item_new.c ./menu/m_item_opt.c +./menu/m_item_top.c ./menu/m_item_use.c ./menu/m_item_val.c ./menu/m_item_vis.c ./menu/m_items.c ./menu/m_new.c ./menu/m_opts.c +./menu/m_pad.c +./menu/m_pattern.c ./menu/m_post.c ./menu/m_req_name.c +./menu/m_scale.c ./menu/m_spacing.c +./menu/m_sub.c ./menu/m_userptr.c ./menu/m_win.c ./menu/menu.h @@ -414,6 +486,7 @@ ./menu/mf_common.h ./menu/modules ./misc/Makefile.in +./misc/emx.src ./misc/hackguide.doc ./misc/hackguide.html ./misc/makellib @@ -431,12 +504,10 @@ ./mk-1st.awk ./mk-2nd.awk ./mkinstalldirs -./ncurses.lsm ./ncurses/MKcaptab.awk ./ncurses/MKexpanded.sh ./ncurses/MKfallback.sh ./ncurses/MKkeyname.awk -./ncurses/MKkeys.awk ./ncurses/MKlib_gen.sh ./ncurses/MKnames.awk ./ncurses/MKunctrl.awk @@ -446,12 +517,16 @@ ./ncurses/alloc_entry.c ./ncurses/captoinfo.c ./ncurses/comp_error.c +./ncurses/comp_expand.c ./ncurses/comp_hash.c ./ncurses/comp_parse.c ./ncurses/comp_scan.c ./ncurses/curses.priv.h +./ncurses/define_key.c +./ncurses/fifo_defs.h ./ncurses/hardscroll.c ./ncurses/hashmap.c +./ncurses/keyok.c ./ncurses/keys.list ./ncurses/lib_acs.c ./ncurses/lib_adabind.c @@ -461,20 +536,27 @@ ./ncurses/lib_beep.c ./ncurses/lib_bkgd.c ./ncurses/lib_box.c +./ncurses/lib_chgat.c ./ncurses/lib_clear.c +./ncurses/lib_clearok.c ./ncurses/lib_clrbot.c ./ncurses/lib_clreol.c ./ncurses/lib_color.c +./ncurses/lib_cur_term.c ./ncurses/lib_data.c ./ncurses/lib_delch.c ./ncurses/lib_delwin.c ./ncurses/lib_dft_fgbg.c ./ncurses/lib_doupdate.c +./ncurses/lib_echo.c ./ncurses/lib_endwin.c ./ncurses/lib_erase.c +./ncurses/lib_flash.c ./ncurses/lib_freeall.c ./ncurses/lib_getch.c ./ncurses/lib_getstr.c +./ncurses/lib_hline.c +./ncurses/lib_immedok.c ./ncurses/lib_inchstr.c ./ncurses/lib_initscr.c ./ncurses/lib_insch.c @@ -483,28 +565,43 @@ ./ncurses/lib_instr.c ./ncurses/lib_isendwin.c ./ncurses/lib_kernel.c +./ncurses/lib_leaveok.c ./ncurses/lib_longname.c ./ncurses/lib_mouse.c ./ncurses/lib_move.c ./ncurses/lib_mvcur.c ./ncurses/lib_mvwin.c +./ncurses/lib_napms.c ./ncurses/lib_newterm.c ./ncurses/lib_newwin.c +./ncurses/lib_nl.c ./ncurses/lib_options.c ./ncurses/lib_overlay.c ./ncurses/lib_pad.c ./ncurses/lib_print.c ./ncurses/lib_printw.c ./ncurses/lib_raw.c +./ncurses/lib_redrawln.c ./ncurses/lib_refresh.c ./ncurses/lib_restart.c ./ncurses/lib_scanw.c ./ncurses/lib_screen.c ./ncurses/lib_scroll.c +./ncurses/lib_scrollok.c ./ncurses/lib_scrreg.c ./ncurses/lib_set_term.c ./ncurses/lib_setup.c ./ncurses/lib_slk.c +./ncurses/lib_slkatrof.c +./ncurses/lib_slkatron.c +./ncurses/lib_slkatrset.c +./ncurses/lib_slkattr.c +./ncurses/lib_slkclear.c +./ncurses/lib_slkinit.c +./ncurses/lib_slklab.c +./ncurses/lib_slkrefr.c +./ncurses/lib_slkset.c +./ncurses/lib_slktouch.c ./ncurses/lib_termcap.c ./ncurses/lib_ti.c ./ncurses/lib_touch.c @@ -517,15 +614,26 @@ ./ncurses/lib_tracemse.c ./ncurses/lib_tstp.c ./ncurses/lib_twait.c +./ncurses/lib_ungetch.c ./ncurses/lib_vidattr.c +./ncurses/lib_vline.c +./ncurses/lib_wattroff.c +./ncurses/lib_wattron.c ./ncurses/lib_window.c ./ncurses/llib-lncurses +./ncurses/make_keys.c ./ncurses/modules +./ncurses/name_match.c +./ncurses/nc_panel.c ./ncurses/parse_entry.c ./ncurses/read_entry.c ./ncurses/read_termcap.c ./ncurses/resizeterm.c +./ncurses/safe_sprintf.c ./ncurses/sigaction.c +./ncurses/softscroll.c +./ncurses/trace_buf.c +./ncurses/tries.c ./ncurses/vsscanf.c ./ncurses/wresize.c ./ncurses/write_entry.c @@ -533,6 +641,20 @@ ./panel/headers ./panel/llib-lpanel ./panel/modules +./panel/p_above.c +./panel/p_below.c +./panel/p_bottom.c +./panel/p_delete.c +./panel/p_hidden.c +./panel/p_hide.c +./panel/p_move.c +./panel/p_new.c +./panel/p_replace.c +./panel/p_show.c +./panel/p_top.c +./panel/p_update.c +./panel/p_user.c +./panel/p_win.c ./panel/panel.c ./panel/panel.h ./panel/panel.priv.h @@ -550,11 +672,16 @@ ./progs/toe.c ./progs/tput.c ./progs/tset.c +./shlib-versions ./sysdeps/unix/sysv/linux/Makefile +./sysdeps/unix/sysv/linux/alpha/configure ./sysdeps/unix/sysv/linux/configure ./sysdeps/unix/sysv/linux/edit_man.sed ./sysdeps/unix/sysv/linux/edit_man.sh ./sysdeps/unix/sysv/linux/run_tic.sh +./tack/Makefile.in +./tack/modules +./tar-copy.sh ./test/Makefile.in ./test/README ./test/blue.c @@ -562,19 +689,24 @@ ./test/bs.c ./test/configure.in ./test/firework.c +./test/firstlast.c ./test/gdc.6 ./test/gdc.c ./test/hanoi.c ./test/hashtest.c +./test/keynames.c ./test/knight.c ./test/lrtest.c ./test/modules ./test/ncurses.c +./test/ncurses_tst.hin ./test/newdemo.c ./test/rain.c ./test/tclock.c ./test/test.priv.h +./test/testaddch.c ./test/testcurs.c +./test/testscanw.c ./test/tracemunch ./test/view.c ./test/worm.c diff --git a/Makefile.glibc b/Makefile.glibc index 0767871b..75b54b17 100644 --- a/Makefile.glibc +++ b/Makefile.glibc @@ -21,7 +21,7 @@ # subdir := ncurses -ncurses-version = 4.1 +ncurses-version = 4.2 form-version = $(ncurses-version) menu-version = $(ncurses-version) panel-version = $(ncurses-version) @@ -38,51 +38,218 @@ subdir-dirs = $(extras) progs test vpath %.c $(subdir-dirs) vpath %.h $(subdir-dirs) -libform-routines = fld_def fld_stat fld_type fld_user \ - frm_adabind frm_data frm_def \ - frm_driver frm_hook frm_opts \ - frm_req_name frm_user frm_win \ - fty_alnum fty_alpha fty_enum fty_int \ - fty_ipv4 fty_num fty_regex - -libncurses-routines = alloc_entry captoinfo comp_error comp_hash \ - comp_parse comp_scan hardscroll \ - hashmap lib_acs lib_adabind lib_addch \ - lib_addstr lib_baudrate \ - lib_beep lib_bkgd lib_box lib_clear \ - lib_clrbot lib_clreol lib_color \ - lib_data lib_delch lib_delwin \ - lib_dft_fgbg lib_doupdate lib_endwin \ - lib_erase lib_freeall lib_getch \ - lib_getstr lib_inchstr lib_initscr \ - lib_insch lib_insdel lib_insstr \ - lib_instr lib_isendwin lib_kernel \ - lib_longname lib_mouse lib_move \ - lib_mvcur lib_mvwin lib_newterm \ - lib_newwin lib_options lib_overlay \ - lib_pad lib_print lib_printw lib_raw \ - lib_refresh lib_restart lib_scanw \ - lib_screen lib_scroll lib_scrreg \ - lib_set_term lib_setup lib_slk \ - lib_termcap lib_ti lib_touch \ - lib_tparm lib_tputs lib_trace \ - lib_traceatr lib_tracechr \ - lib_tracedmp lib_tracemse lib_tstp \ - lib_twait lib_vidattr \ - lib_window names parse_entry \ - read_entry read_termcap resizeterm \ - wresize write_entry \ - codes comp_captab expanded fallback \ - lib_gen names lib_keyname unctrl - -libmenu-routines = m_adabind m_attribs m_cursor m_driver \ - m_format m_global m_hook m_item_cur \ - m_item_nam m_item_new m_item_opt \ - m_item_use m_item_val m_item_vis \ - m_items m_new m_opts m_post \ - m_req_name m_spacing m_userptr m_win - -libpanel-routines = panel +libform-routines = \ + fld_arg \ + fld_attr \ + fld_current \ + fld_def \ + fld_dup \ + fld_ftchoice \ + fld_ftlink \ + fld_info \ + fld_just \ + fld_link \ + fld_max \ + fld_move \ + fld_newftyp \ + fld_opts \ + fld_pad \ + fld_page \ + fld_stat \ + fld_type \ + fld_user \ + frm_adabind \ + frm_cursor \ + frm_data \ + frm_def \ + frm_driver \ + frm_hook \ + frm_opts \ + frm_page \ + frm_post \ + frm_req_name \ + frm_scale \ + frm_sub \ + frm_user \ + frm_win \ + fty_alnum \ + fty_alpha \ + fty_enum \ + fty_int \ + fty_ipv4 \ + fty_num \ + fty_regex + +libncurses-routines = \ + alloc_entry \ + captoinfo \ + codes \ + comp_captab \ + comp_error \ + comp_expand \ + comp_hash \ + comp_parse \ + comp_scan \ + define_key \ + expanded \ + fallback \ + hardscroll \ + hashmap \ + keyok \ + lib_acs \ + lib_adabind \ + lib_addch \ + lib_addstr \ + lib_baudrate \ + lib_beep \ + lib_bkgd \ + lib_box \ + lib_chgat \ + lib_clear \ + lib_clearok \ + lib_clrbot \ + lib_clreol \ + lib_color \ + lib_cur_term \ + lib_data \ + lib_delch \ + lib_delwin \ + lib_dft_fgbg \ + lib_doupdate \ + lib_echo \ + lib_endwin \ + lib_erase \ + lib_flash \ + lib_freeall \ + lib_gen \ + lib_getch \ + lib_getstr \ + lib_hline \ + lib_immedok \ + lib_inchstr \ + lib_initscr \ + lib_insch \ + lib_insdel \ + lib_insstr \ + lib_instr \ + lib_isendwin \ + lib_kernel \ + lib_keyname \ + lib_leaveok \ + lib_longname \ + lib_mouse \ + lib_move \ + lib_mvcur \ + lib_mvwin \ + lib_napms \ + lib_newterm \ + lib_newwin \ + lib_nl \ + lib_options \ + lib_overlay \ + lib_pad \ + lib_print \ + lib_printw \ + lib_raw \ + lib_redrawln \ + lib_refresh \ + lib_restart \ + lib_scanw \ + lib_screen \ + lib_scroll \ + lib_scrollok \ + lib_scrreg \ + lib_set_term \ + lib_setup \ + lib_slk \ + lib_slkatrof \ + lib_slkatron \ + lib_slkatrset \ + lib_slkattr \ + lib_slkclear \ + lib_slkinit \ + lib_slklab \ + lib_slkrefr \ + lib_slkset \ + lib_slktouch \ + lib_termcap \ + lib_ti \ + lib_touch \ + lib_tparm \ + lib_tputs \ + lib_trace \ + lib_traceatr \ + lib_tracechr \ + lib_tracedmp \ + lib_tracemse \ + lib_tstp \ + lib_twait \ + lib_ungetch \ + lib_vidattr \ + lib_vline \ + lib_wattroff \ + lib_wattron \ + lib_window \ + name_match \ + names \ + nc_panel \ + parse_entry \ + read_entry \ + read_termcap \ + resizeterm \ + safe_sprintf \ + softscroll \ + trace_buf \ + tries \ + unctrl \ + wresize \ + write_entry + +libmenu-routines = \ + m_adabind \ + m_attribs \ + m_cursor \ + m_driver \ + m_format \ + m_global \ + m_hook \ + m_item_cur \ + m_item_nam \ + m_item_new \ + m_item_opt \ + m_item_top \ + m_item_use \ + m_item_val \ + m_item_vis \ + m_items \ + m_new \ + m_opts \ + m_pad \ + m_pattern \ + m_post \ + m_req_name \ + m_scale \ + m_spacing \ + m_sub \ + m_userptr \ + m_win + +libpanel-routines = \ + panel \ + p_above \ + p_below \ + p_bottom \ + p_delete \ + p_hide \ + p_hidden \ + p_move \ + p_new \ + p_replace \ + p_show \ + p_top \ + p_update \ + p_user \ + p_win headers = curses.h eti.h form.h menu.h panel.h term.h termcap.h \ unctrl.h @@ -100,8 +267,9 @@ extra-objs = $(tic-objs) $(toe-objs) $(infocmp-objs) $(clear-objs) \ # mvcur won't compile test-srcs = tctest thardscroll thashmap \ - blue bs firework gdc hanoi hashtest knight lrtest \ - ncurses newdemo rain tclock testcurs view worm xmas + blue bs firework firstlast gdc hanoi hashtest knight \ + lrtest ncurses newdemo rain tclock testaddch testcurs \ + testscanw view worm xmas mvcur-objs = mvcur.o dump_entry.o tctest-objs = tctest.o thardscroll-objs = thardscroll.o @@ -131,18 +299,42 @@ ifndef inst_mandir inst_mandir = $(install_root)/$(mandir) endif -CPPFLAGS += -DTERMINFO='"$(terminfodir)"' -Iinclude -Incurses \ - -Imenu -Iprogs -Itest -I$(objpfx) +CPPFLAGS += -DTERMINFO='"$(terminfodir)"' -Iinclude -Iform -Incurses \ + -Imenu -Ipanel -Iprogs -Itest + +ifneq ($(strip $(objpfx)),) +CPPFLAGS += -I$(objpfx) +endif + +LDLIBS-tclock = math/libm + +tests: $(test-srcs:%=$(objpfx)%) + +$(objpfx)mvcur.d: ncurses/lib_mvcur.c + $(CC) -M $(CFLAGS) $(CPPFLAGS) -DTRACE -DMAIN $? | \ + sed -e 's/^lib_mvcur.o/mvcur.o/' > $@ $(objpfx)mvcur.o: ncurses/lib_mvcur.c $(CC) -c -o $@ $(CFLAGS) $(CPPFLAGS) -DTRACE -DMAIN $? +$(objpfx)tctest.d: ncurses/captoinfo.c + $(CC) -M $(CFLAGS) $(CPPFLAGS) -DTRACE -DMAIN $? | \ + sed -e 's/^captoinfo.o/tctest.o/' > $@ + $(objpfx)tctest.o: ncurses/captoinfo.c $(CC) -c -o $@ $(CFLAGS) $(CPPFLAGS) -DTRACE -DMAIN $? +$(objpfx)thardscroll.d: ncurses/hardscroll.c + $(CC) -M $(CFLAGS) $(CPPFLAGS) -DTRACE -DSCROLLDEBUG $? | \ + sed -e 's/^hardscroll.o/thardscroll.o/' > $@ + $(objpfx)thardscroll.o: ncurses/hardscroll.c $(CC) -c -o $@ $(CFLAGS) $(CPPFLAGS) -DTRACE -DSCROLLDEBUG $? +$(objpfx)thashmap.d: ncurses/hashmap.c + $(CC) -M $(CFLAGS) $(CPPFLAGS) -DTRACE -DHASHDEBUG $? | \ + sed -e 's/^hashmap.o/thashmap.o/' > $@ + $(objpfx)thashmap.o: ncurses/hashmap.c $(CC) -c -o $@ $(CFLAGS) $(CPPFLAGS) -DTRACE -DHASHDEBUG $? @@ -175,12 +367,19 @@ $(test-srcs:%=$(objpfx)%): $(objpfx)libform.a $(objpfx)libmenu.a \ # a statically-linked program that hasn't already loaded it. $(extras:%=$(objpfx)lib%.so): $(common-objpfx)libc.so -subdir_install: $(inst_libdir)/libtermcap.a $(inst_libdir)/libcurses.a +subdir_install: $(inst_libdir)/libtermcap.a $(inst_libdir)/libcurses.a \ + $(inst_bindir)/reset $(inst_bindir)/captoinfo $(inst_libdir)/libtermcap.a $(inst_libdir)/libcurses.a: \ $(inst_libdir)/libncurses.a $(make-link) +$(inst_bindir)/reset: $(inst_bindir)/tset + $(make-link) + +$(inst_bindir)/captoinfo: $(inst_bindir)/tic + $(make-link) + ifeq (yes,$(build-shared)) subdir_install: $(inst_libdir)/libtermcap.so $(inst_libdir)/libcurses.so diff --git a/Makefile.in b/Makefile.in index 368d31f5..6019d0a3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,29 +1,40 @@ -# $Id: Makefile.in,v 1.10 1997/03/22 00:57:42 tom Exp $ -################################################################################ -# Copyright 1996,1997 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: Makefile.in,v 1.15 1998/02/11 12:13:39 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# # Master Makefile for ncurses library. SHELL = /bin/sh INSTALL_PREFIX=@INSTALL_PREFIX@ -NC_MFLAGS = @nc_cv_makeflags@ INSTALL_PREFIX="$(INSTALL_PREFIX)" +CF_MFLAGS = @cf_cv_makeflags@ INSTALL_PREFIX="$(INSTALL_PREFIX)" @SET_MAKE@ @@ -67,4 +78,6 @@ clean \ distclean \ mostlyclean \ realclean \ +sources \ +uninstall \ install :: diff --git a/NEWS b/NEWS index fff6125d..5b22ebaf 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,1063 @@ -This is a log of changes that ncurses has gone through since Zeyd -started working with Pavel Curtis' original work, pcurses, in 1992: +-- $Id: NEWS,v 1.316 1998/02/28 23:10:26 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. + +Changes through 1.9.9e are recorded by Zeyd M. Ben-Halim. +Changes since 1.9.9e are recorded by Thomas Dickey. + +980228 pre-release + + add linux-koi8r replace linux-koi8, which is not KOI8 (patch by + QingLong ). + + minor documentation fixes (patch by Juergen Pfeifer). + + add setlocale() call to ncurses.c (reported by Claes G. Lindblad + ). + + correct sign-extension in lib_insstr.c (reported by Sotiris + Vassilopoulos ) + +980221 pre-release + + regenerated some documentation overlooked in 980214 patch + (ncurses-intro.doc, curs_outopts.3x.html) + + minor ifdef change to C++ binding to work with gcc 2.8.0 (patch by + Juergen Pfeifer). + + change maintainer's mailing address to florian@gnu.org, change + tentative mailing list address to bug-ncurses-request@gnu.org (patch + by Florian La Roche). + + add definition of $(REL_VERSION) to c++/Makefile.in (reported by Gran + Hasse ). + + restore version numbers to Ada95 binding, accidentally deleted by + copyright patch (patch by Juergen Pfeifer). + +980214 pre-release + + remove ncurses.lsm from MANIFEST so that it won't be used in FSF + distributions, though it is retained in development. + + correct scaling of milliseconds to nanoseconds in lib_napms.c (patch + by Jeremy Buhler). + + update mailing-list information (bug-ncurses@gnu.org). + + update announcement for upcoming 4.2 release. + + modify -lm test to check for 'sin()' rather than 'floor()' + + remove spurious commas from terminfo.src descriptions. + + change copyright notices to Free Software Foundation + +980207 + + minor fixes for autoconf macros CF_ERRNO, CF_HELP_MESSAGE and + CF_SIZECHANGE + + modify Makefile.glibc so that $(objpfx) is defined (H.J.Lu). + + ifdef-out true-return from _nc_mouse_inline() which depends on + merge of QNX patch (pending 4.2 release). + > patch by J.T.Conklin, to split off seldom-used modules in ncurses + (reduces size by up to 2.6kb): + + move functionality of _nc_usleep into napms, add configuration case + for nanosleep(). + + moved wchgat() from lib_addch.c to lib_chgat.c + + moved clearok(), immedok(), leaveok(), and scrollok() from + lib_options.c to lib_clearok.c, lib_immedok.c, lib_leaveok.c and + lib_scrollok.c. + + moved napms() from lib_kernel.c to lib_napms.c + + moved echo() and noecho() from lib_raw.c to lib_echo.c + + moved nl() and nonl() from lib_raw.c to lib_nl.c + +980131 + + corrected conversion in tclock.c (cf: 971018). + + updates to Makefile.glibc and associated Linux configure script + (patch by H.J.Lu). + + workaround a quoting problem on SunOS with tar-copy.sh + + correct init_pair() calls in worm.c to work when use_default_colors() + is not available. + + include in CF_SYS_TIME_SELECT to work with FreeBSD 2.1.5 + + add ncv capability to FreeBSD console (cons25w), making reverse + work with color. + + correct sense of configure-test for sys/time.h inclusion with + sys/select.h + + fixes for Ada95/ada_include/Makefile.in to work with --srcdir option. + + remove unused/obsolete test-program rules from progs/Makefile.in + (the rules in ncurses/Makefile.in work). + + remove shared-library loader flags from test/Makefile.in, etc. + + simplify test/configure.in using new version of autoconf to create + test/ncurses_cfg.h + + suppress suffix rules in test/Makefile.in, provide explicit dependency + to work with --srcdir option and less capable 'make' programs. + > adapted from patch for QNX by Xiaodan Tang: + + initialize %P and %g variables set/used in tparm, and also ensure + that empty strings don't return a null result from tparam_internal + + add QNX-specific prototype for vsscanf() + + move initialization of SP->_keytry from init_keytry() to newterm() to + avoid resetting it via a keyok() call by mouse_activate(). + + reorganized some functions in lib_mouse() to use case-statements. + + remove sgr string from qnx terminfo entry since it is reported to + turn off attributes inconsistently. + +980124 + + add f/F/b/B commands to ncurses 'b' test to toggle colors, providing + test for no_color_video. + + adjusted emx.src to use no_color_video, now works with ncurses 'b' + and 'k' tests. + + implement no_color_video attribute, and as a special case, reverse + colors when the reverse attribute cannot be combined with color. + + check for empty string in $TERM variable (reported by Brett Michaels + ). + > from reports by Fred Fish: + + add configure-test for isascii + + add configure-test for -lm library. + + modify CF_BOOL_SIZE to check if C++ bool types are unsigned. + > patches by J.J.G.Ripoll + + add configure/makefile variables to support .exe extension on + OS/2 EMX (requires additional autoconf patches). + + explicitly initialize variables in lib_data.c to appease OS/2 linker + > patches by Fred Fish + + misc/Makefile.in (install.data): Avoid trying to install the CVS + directory. + + aclocal.m4 (install.includes): Remove files in the include directory + where we are going to install new ones, not the original source + files. + + misc/terminfo.src: Add entry for "beterm", derived from termcap + distributed with BeOS PR2 using captoinfo. + + aclocal.m4: Wrap $cf_cv_type_of_bool with quotes (contains space) + + aclocal.m4: Assume bool types are unsigned. + + progs/infocmp.c: workaround mwcc 32k function data limit + +980117 + + correct initialization of color-pair (from 970524) in xmas.c, which + was using only one color-pair for all colors (reported by + J.J.G.Ripoll). + + add multithread options for objects build on EMX, for compatibility + with XFree86. + + split up an expression in MKlib_gen.sh to work around a problem on + OS/2 EMX, with 'ash' (patch by J.J.G.Ripoll). + + change terminfo entries xterm (xterm-xf86-v40), xterm-8bit rs1 to use + hard reset. + + rename terminfo entry xterm-xf86-v39t to xterm-xf86-v40 + + remove bold/underline from sun console entries since they're not + implemented. + + correct _tracef calls in _tracedump(), which did not separate format + from parameters. + + correct getopt string for tic "-o" option, and add it to man-page + synopsis (reported by Darren Hiebert ). + + correct typo in panel/Makefile.in, reversed if-statement in scrolling + optimization (Alexander V. Lukyanov). + + test for 'remove()', use 'unlink() if not found (patch by Philippe De + Muyter ). + > patches by Juergen Pfeifer: + + Improve a feature of the forms driver. For invisible fields + (O_VISIBLE off) only the contents but not the attributes are cleared. + We now clear both. (Reported by Javier Kohan + ) + + The man page form_field_opts.3x makes now clear, that invisible + fields are also always inactive. + + adjust ifdef's to compile the C++ binding with the just released + gcc-2.8.0 c++ and the corresponding new C++ libraries. + +980110 + + correct "?" command in ncurses.c; it was performing non-screen writes + while the program was in screen mode. (It "worked" in 1.9.9e because + that version sets OPOST and OCRNL incorrectly). + + return error from functions in lib_kernel, lib_raw and lib_ti if + cur_term is null, or if underlying I/O fails. + + amend change to tputs() so that it does not return an error if + cur_term is null, since some applications depend on being able to use + tputs without initializing the terminal (reported by Christian J. + Robinson ). + +980103 + + add a copy of emx.src from J.J.G.Ripoll's OS/2 EMX version of ncurses + 1.9.9e, together with fixes/additions for the "ansi" terminal type. + + add tic check for save/restore cursor if change_scroll_region is + defined (from O'Reilly book). + + modify read_termcap.c to handle EMX-style pathnames (reported by + J.J.G.Ripoll). + + modify lib_raw.c to use EMX's setmode (from J.J.G.Ripoll, who says + EMX's curses does this). + + modify _nc_tic_expand() to generate \0 rather than \200. + + move/revise 'expand()' from dump_entry.c to ncurses library as + _nc_tic_expand(), for use by tack. + + decode \a as \007 for terminfo, as per XSI. + + correct translation of terminfo "^@", to \200, like \0. + + modify next_char() to treat the same as , for + cross-platform compatibility. + + use new version of autoconf (971230) to work around limited + environment on CLIX, due to the way autoconf builds --help message. + > patch by Juergen Pfeifer: + + check that the Ada95 binding runs against the correct version of + ncurses. + + insert constants about the library version into the main spec-file of + the Ada95 binding. + +971227 + + modify open/fopen calls to use binary mode, needed for EMX. + + modify configure script to work with autoconf 2.10 mods for OS/2 + EMX from J.J.G.Ripoll. + + generated ncurses_cfg.h with patch (971222) to autoconf 2.12 which + bypasses limited sed buffer length. + > several changes from Juan Jose Garcia Ripoll + (J.J.G.Ripoll) to support OS/2 EMX: + + add a _scrolling flag to SP, to set when we encounter a terminal + that simply cannot scroll. + + corrected logic in _nc_add_to_try(), by ensuring that strings with + embedded \200 characters are matched. + + don't assume the host has 'link()' function, for linking terminfo + entries. + +971220 + + if there's no ioctl's to support sigwinch handler, disable it. + + add configure option --disable-ext-funcs to remove the extended + functions from the build. + + add configure option --with-termlib to generate the terminfo + functions as a separate library. + + add 'sources' rule to facilitate cross-compiling. + + review/fix order of mostlyclean/clean/distclean rules. + + modify install-rule for headers to first remove old header, in + case there was a symbolic link that confuses the install script. + + corrected substitution for NCURSES_CONST in term.h (cf: 971108) + + add null pointer checks in wnoutrefresh(), overlap() (patch by + Xiaodan Tang ) + + correct tputs(), which could dereference a null cur_term if invoked + before terminal is initialized (patch by Christopher Seawood + ) + > patch by Juergen Pfeifer: + + makes better use of "pragma Inline" in the Ada95 binding + + resynchronizes the generated html manpages + +971213 + + additional fixes for man-pages section-references + + add (for debugging) a check for ich/ich1 conflict with smir/rmir + to tic, etc. + + remove hpa/vpa from rxvt terminal description because they are not + implemented correctly, added sgr0. + + change ncurses 's' to use raw mode, so ^Q works (reported by Rudolf + Leitgeb ) + +971206 + + modify protection when installing libraries to (normally) not + executable. HP-UX shared libraries are an exception. + + add configure check for 'tack'. + + implement script for renaming section-references in man-page install, + for Debian configuration. + + add validity-check for SP in trace code in baudrate() (reported by + Daniel Weaver). + > patch by Alexander V. Lukyanov (fixes to match sol25 curses) + + modify 'overlay()' so that copy applies target window background to + characters. + + correct 'mvwin()' so that it does not clear the previous locations. + + correct lib_acs.c so that 8-bit character is not sign expanded in + case of wide characters in chtype. + + correct control-char test in lib_addch.c for use with wide chars + + use attribute in the chtype when adding a control character in + lib_addch.c control char was added with current attribute + +971129 + + save/restore errno in _tracef() function + + change treatment of initialize_color to use a range of 0..1000 + (recommended by Daniel Weaver). + + set umask in mkinstalldirs, fixing problems reported by users who + have set root's umask to 077. + + correct bug in tic that caused capabilities to be reprinted at the + end of output when they had embedded comments. + + rewrote wredrawln to correspond to XSI, and split-out since it is + not often used (from report by Alexander V. Lukyanov, 970825) + + rewrote Dan Nelson's change to make it portable, as well as to + correct logic for handling backslashes. + + add code to _nc_tgetent() to make it work more like a real tgetent(). + It removes all empty fields, and removes all but the first in a group + of duplicate caps. The code was pulled from the BSD libtermcap code + in termcap.c (patch by Dan Nelson + + don't include --enable-widec in the --with-develop configure option, + since it is not binary-compatible with 4.1 (noted by Alexander V. + Lukyanov) + > patch by Juergen Pfeifer: + + further improvements of the usage of elaboration pragmas in the Ada95 + binding + + enhanced Ada95 sample to use the user_data mechanism for panels. + + a fix for the configuration script to make gnat-3.10 the required + version. + + resync of the html version of the manpages + +971122 + > fixes/updates for terminfo.src: + + add vt220-js, pilot, rbcomm, datapoint entries from esr's 27-jun-97 + version. + + add hds200 description (Walter Skorski) + + add EMX 0.9b descriptions + + correct rmso/smso capabilities in wy30-mc and wy50-mc (Daniel Weaver) + + rename xhpterm back to hpterm. + > patch by Juergen Pfeifer: + + Improves the usage of elaboration pragmas for the Ada95 binding. + + Adds a translation of the test/rain.c into Ada95 to the samples. + This has been contributed to the project by Laurent Pautet + (pautet@gnat.com) + +971115 + + increase MAX_NAME_SIZE to 512 to handle extremely long alias list + in HP-UX terminfo. + + correction & simplification of delay computation in tputs, based on + comments from Daniel Weaver. + + replace test for SCO with more precise header tests. + + add configure test for unsigned literals, use in NCURSES_BITS macro. + + comment-out the -PIC, etc., flags from c++, progs and test makefiles + since they probably are not needed, and are less efficient (noted by. + Ju"rgen Fluk) + + add -L$(libdir) to loader options, after -L../lib so that loaders + that record this information will tend to do the right thing if + the programs are moved around after installing them (suggested by. + Ju"rgen Fluk). + + add -R option to loader options for programs for Solaris if the + --enable-rpath option is specified for the libraries. + +971112 + + correct installed filename for shared libraries on *BSD (reported by + Ju"rgen Fluk). + +971108 + + cleanup logic for deciding when tputs() should call delay_output(), + based on comments from Daniel Weaver. + + modified tputs() to avoid use of float. + + correct use of trailpad in tputs(), which used the wrong variable + in call to delay_output(). + + correct inverted expression for null-count in delay_output() + (analysis by Daniel Weaver). + + apply --enable-rpath option to Solaris (requested by Larry Virden). + + correct substitution of EXTRA_CFLAGS for gcc 2.6.3 + + correct check for error-return by _nc_tgetent(), which returns 0 + for success. + + add configure test for BSD 4.4 cgetent() function, modify + read_termcap.c to use the host's version of that if found, using the + terminal database on FreeBSD (reported by Peter Wemm). + + add u8, u9 strings to sun-il description for Daniel Weaver. + + use NCURSES_CONST in panel's user-pointer. + + modify edit_cfg.sh and MKterm.h.awk.in to substitute NCURSES_CONST + so that will work on NeXT. + + use _nc_set_screen() rather than assignments to SP to fix port to + NeXT (reported by Francisco A. Tomei Torres). + +971101 + + force mandatory padding in bell and flash_screen, as specified in XSI. + + don't allow padding_baud_rate to override mandatory delays (reported + by Daniel Weaver). + + modify delay_output() to use _nc_timed_wait() if no baudrate has been + defined, or if the cur_term pointer is not initialized. XSI treats + this as unspecified. (requested by Daniel Weaver). + + change getcap-cache ifdef's to eliminate unnecessary chdir/mkdir + when that feature is not configured. + + remove _nc_err_abort() calls when write_entry.c finds a directory but + cannot write to it, e.g., when translating part/all of /etc/termcap + (reported by Andreas Jaeger ). + (this dates back to 951102, in 1.9.7a). + + minor ifdef fixes to compile with atac and glibc 2.0.5c + + add check for -lgen when configuring regexpr.h + + modify Solaris shared-library option "-d y" to "-dy" to workaround + incompatibility of gcc 2.7.2 vs vendor's tools. + +971026 + + correct ifdef's for struct winsize vs struct ttysize in lib_setup.c + to compile on SCO. + + remove dangling backslash in panel/Makefile.in + + modify MKkeyname.awk to work with SCO's nawk, which dumps core in the + length() function. + + correct length of allocation in _nc_add_to_try(), to allow for + trailing null. + + correct logic in _nc_remove_key(), which was discarding too many + nodes (patch by Alexander V. Lukyanov) + +971025 + + add definition for $(REL_VERSION) to test/Makefile.in, so *BSD + shared libraries link properly (see 970524). + + modify Linux shared-library generation to include library + dependencies (e.g., -lncurses and -lgpm) in the forms, menu and + panel libraries (suggested by Juergen Pfeifer). + + modify configure script to use config.guess and config.sub rather + than uname, which is unreliable on some systems. + + updated Makefile.glibc, test-built with glibc 2.0.5c + + modify keyname() to return values consistent with SVr4 curses (patch + by Ju"rgen Fluk). + > changes requested by Daniel Weaver: + + modify delay_output() so that it uses the same output function as + tputs() if called from that function. + + move _baudrate from SCREEN to TERMINAL so that low-level use of + tputs works when SP is not set. + > patch by Juergen Pfeifer: + + factor lib_menu and lib_form into smaller modules + + clean up the interface between panel and SCREEN + + minor changes to the Ada95 mouse support implemenation + + minor bugfix in C++ binding to ripoff windows + + fix a few Ada95 html documentation pages + +971018 + + split-out lib_ungetch.c, make runtime link to resizeterm() to + decouple those modules from lib_restart.c + + add xterm-xf86-v39t description to terminfo.src + + reset SP->_endwin in lib_tstp.c cleanup() function after calling + endwin() to avoid unnecessary repainting if the application has + established an atexit function, etc. Encountered this problem in + the c++ demo, whose destructors repaint the screen. + + combine _nc_get_screensize() and resizeterm() calls as new function + _nc_update_screensize(). + + minor fixes to allow compile with g++ (suggested by Nelson H. F. + Beebe). + + implement install-rules for Ada95 makefiles. + + use screen_lines or MAXLINES as needed where LINES was coded, + as well as screen_columns for COLS, in the ncurses library. + > patch by Alexander V. Lukyanov: + + modify logic for ripped-off lines to handle several SCREENs. + > patch by Juergen Pfeifer: + + factors lib_slk.c into some smaller modules + + factors panel.c into some smaller modules + + puts the static information about the current panel stack into the + SCREEN structure to allow different panel stacks on different + screens. + + preliminary fix for an error adjusting LINES to account for + ripped-off lines. + +971011 + + move _nc_max_click_interval and other mouse interface items to SCREEN + struct so that they are associated with a single terminal, and also + save memory when the application does not need a mouse (roughly 3k vs + 0.5k on Linux). + + modify mouseinterval() so that a negative parameter queries the + click-interval without modifying it. + + modify ncurses 'i' test to work with ncurses' apparent extension from + SVr4, i.e., allows nocbreak+noecho (analysis by Alexander V. + Lukyanov). + + add configure options --with-ada-includes and --with-ada-objects, + to drive Ada95 binding install (not yet implemented). + + install C++ binding as -lncurses++ and associated headers with the + other ncurses headers. + + fix header uninstall if configure --srcdir is used. + > minor interface changes (request by Daniel Weaver , + to support 'tack' program): + + export functions _nc_trans_string() and _nc_msec_cost(). + + add variable _nc_nulls_sent, to record the number of padding + characters output in delay_output(). + + move tests for generic_type and hard_copy terminals in setupterm() + to the end of that function so that the library will still be + initialized, though not generally useful for curses programs. + > patches by Alexander V. Lukyanov: + + modify ClrBottom() to avoid using clr_eos if there is only one line + to erase. + + typo in configure --help. + > patch by J.T.Conklin (with minor resync against Juergen's changes) + + split-out lib_flash.c from lib_beep.c + + split-out lib_hline.c and lib_vline.c from lib_box.c + + split-out lib_wattron.c, lib_wattroff.c from lib_addch.c + +971005 + > patch by Juergen Pfeifer: + + correct source/target of c++/edit_cfg.sh + +971004 + + add color, mouse support to kterm terminfo entry. + + modify lib_mouse.c to recognize rxvt, kterm, color_xterm also as + providing "xterm"-style mouse. + + updated rxvt's terminfo description to correspond to 2.21b, with + fixes for the acsc (the box1 capability is incorrect, ech1 does not + work). + + fix logic in parse_entry.c that discarded acsc when 'synthesizing' + an entry from equivalents in XENIX or AIX. This lets ncurses handle + the distribution copy of rxvt's terminfo. + + modify acsc capability for linux and linux-koi8 terminfo descriptions + (from Pavel Roskin ). + + corrected definition in curses.h for ACS_LANTERN, which was 'I' + rather than 'i' (see 970802). + + updated terminfo.src with reformatted acsc entries, and repaired the + trashed entries with spurious '\' characters that this exposed. + + add logic to dump_entry.c to reformat acsc entries into canonical + form (sorted, unique mapping). + + add configure script to generate c++/etip.h + + add configure --with-develop option, to enable by default most of the + experimental options (requested by Alexander V. Lukyanov). + + rename 'deinstall' to 'uninstall', following GNU convention (suggested + by Alexander V. Lukyanov). + > patches by Alexander V. Lukyanov: + + modify tactics 2 and 5 in onscreen_mvcur(), to allow them on the last + line of the screen, since carriage return will not cause a newline. + + remove clause from PutCharLR() that would try to use + eat_newline_glitch since that apparently does not work on some + terminals (e.g., M$ telnet). + + correct a limit check in scroll_csr_backward() + > patches by Juergen Pfeifer: + + adds dummy implementations of methods above() and below() to the + NCursesPanel class. + + fixes missing returncode in NCursesWindow::ripoffline() + + fixes missing returncode in TestApplication::run() in demo.cc + + We should at least give a comment in etip.h why it is currently a + problem to install the C++ binding somewhere + + makes the WINDOW* argument of wenclose() a const. + + modifies several of the routines in lib_adabind.c to use a const + WINDOW* argument. + +970927 + + add 'deinstall' rules. + + use explicit assignments in configure --without-progs option to + work around autoconf bug which doesn't always set $withval. + + check for ldconfig, don't try to run it if not found. + + implement simple/unoptimized case in lib_doupdate.c to handle + display with magic cookie glitch, tested with ncurses.c program. + + correct missing _tracef in getmouse(), to balance the returnCode + macro. + + simplify show_attr() in ncurses.c using termattrs(). + > patches by Juergen Pfeifer: + + provides missing inlines for mvw[hv]line in cursesw.h of the C++ + binding + + fixes a typo in a comment of frm_driver.c + + Enhances Ada95 Makefiles to fulfill the requirement of GNAT-3.10 that + generics should be compiled. Proper fixes to the configuration + scripts are also provided. + +970920 + + several modifications to the configure script (requested by Ward + Horner): + + add configure options --without-progs, to suppress the build of the + utility programs, e.g., for cross-compiling. + + add $(HOSTCCFLAGS) and $(HOSTLDFLAGS) symbols to ncurses + Makefile.in, to simplify setup for cross compiling. + + add logic in configure script to recognize "--target=vxworks", and + generate load/install actions for VxWorks objects. + + move typedef for sigaction_t into SigAction.h to work around problem + generating lint library. + + modify fty_regex.c to reflect renaming of ifdef's for regular + expressions. + + simplify ifdef in lib_setup.c for TIOCGWINSZ since that symbol may + reside in . + + merge testcurs.c with version from PDCurses 2.3, clarifying some of + the more obscure tests, which rely upon color. + + use macros getbegyx() and getmaxyx() in newdemo.c and testcurs.c + + modify ncurses.c to use getbegyx() and getmaxyx() macros to cover up + implementation difference wrt SVr4 curses, allow 's' test to work. + + add missing endwin() to testscanw.c program (reported by Fausto + Saporito ). + + fixes/updates for Makefile.glibc and related files under sysdeps + (patch by H.J.Lu). + > patches by Juergen Pfeifer: + + add checks for null pointers, especially WINDOW's throughout the + ncurses library. + + solve a problem with wrong calculation of panel overlapping (reported + by Ward Horner): + + make sure that a panel's window isn't a pad. + + do more error checking in module lib_touch.c + + missing files for Ada95 binding from the last patch + + synch. of generated html pages (RCS-Id's were wrong in html files) + + support for Key_Resize in Ada binding + + changed documentation style in ./c++/cursesm.h + > patches by Alexander V. Lukyanov: + + undo attempt to do recursive inlining for PutChar(), noting that it + did not improve timing measurably, but inflated the size of + lib_doupdate.o + +970913 + + modify rain.c to use color. + + correct scroll_csr_backward() to match scroll_csr_forward(). + + minor adjustment to llib-lncurses, to work with Solaris 2.5.1 + + minor fixes to sysdeps/unix/sysv/linux/configure to reflect renaming + of configure cache variables in 970906. + + correct logic involving changes to O_VISIBLE option in + Synchronize_Options function in frm_driver.c (Tony Hoffmann + ) + + add $(HOSTCC) symbol to ncurses Makefile.in, to simplify setup for + cross compiling (suggested by Chris Johns). + + modify ifdef in lib_setup.c to only include if we can + use it to support screen-size calculation (reported by Chris Johns). + + #undef unctrl to avoid symbol conflict in port to RTEMS (reported by + Chris Johns ) + > patches by Juergen Pfeifer: + + simplified, made minor corrections to Ada95 binding to form fieldtype. + + The C++ binding has been enhanced: + + Improve NCursesWindow class: added additional methods to cover + more ncurses functionality. Make refresh() and noutrefresh() + virtual members to allow different implementation in the + NCursesPanel class. + + CAUTION: changed order of parameters in vline() and hline() of + NCursesWindow class. + + Make refresh() in NCursesPanel non-static, it is now a + reimplementation of refresh() in the base class. Added + noutrefresh() to NCursesPanel. + + Added NCursesForm and related classes to support libform + functionality. + + Moved most of configuration related stuff from cursesw.h to etip.h + + Added NCursesApplication class to support easy configuration of + menu and forms related attributes as well as ripped of title lines + and Soft-Label-Keys for an application. + + Support of Auto-Cleanup for a menu's fieldlist. + + Change of return type for current_item() and operator[] for menus. + + Enhanced demo. + + Fixed a bug in form/fld_def.c: take into account that copyarg and + freearg for a fieldtype may be NULL, makearg must not be NULL + + Fixed a bug in form/fld_type.c: in set_fieldtype_arg() makearg must + not be NULL, copyarg and freearg may be NULL. + + Fixed a bug in form/frm_def.c: Allow Disconnect_Fields() if it is + already disconnected. + + Enhance form/frm_driver.c: Allow growth of dynamic fields also on + navigation requests. + + Fixed a bug in form/fty_enum.c: wrong position of postincrement in + case-insensitiva comparision routine. + + Enhanced form/lib_adabind.c with function _nc_get_field() to get a + forms field by index. + + Enhanced menu/m_adabind.c with function _nc_get_item() to get a menus + item by index. + + Fixed in curses.h.in: make chtype argument for pechochar() constant. + Mark wbkgdset() as implemented, remove wbkgdset macro, because it was + broken (didn't handle colors correctly). + + Enhanced lib_mouse.c: added _nc_has_mouse() function + + Added _nc_has_mouse() prototype to curses.priv.h + + Modified lib_bkgd.c: hopefully correct implementation of wbkgdset(); + streamlined implementation of wbkgd() + + Modified lib_mvwin.c: Disable move of a pad. Implement (costly) + move of subwindows. Fixed update behaviour of movements of regular + windows. + + Fixed lib_pad.c: make chtype argument of pechochar() const. + + Fixed lib_window.c: dupwin() is not(!) in every bit a really clone + of the original. Subwindows become regular windows by doing a + dupwin(). + + Improved manpage form_fieldtype.3x + > patches by Alexander V. Lukyanov: + + simplify the PutChar() handling of exit_am_mode, because we already + know that auto_right_margin is true. + + add a check in PutChar() for ability to insert to the case of + shifting character to LR corner. + + in terminal initialization by _nc_screen_resume(), make sure that + terminal right margin mode is known. + + move logic that invokes touchline(), or does the equivalent, into + _nc_scroll_window(). + + modify scrolling logic use of insert/delete line capability, assuming + that they affect the screen contents only within the current + scrolling region. + + modify rain.c to demonstrate SIGWINCH handler. + + remove logic from getch() that would return an ERR if the application + called getch() when the cursor was at the lower-right corner of the + physical screen, and the terminal does not have insert-character + ability. + + change view.c so that it breaks out of getch() loop if a KEY_RESIZE + is read, and modify logic in getch() so this fix will yield the + desired behavior, i.e., the screen is repainted automatically when + the terminal window is resized. + +970906 + + add configure option --enable-sigwinch + + modify view.c to test KEY_RESIZE logic, with "-r" option. + + modify testcurs.c to eliminate misleading display wrt cursor type + by testing if the terminal supports cnorm, civis, cvvis. + + several fixes for m68k/NeXT 4.0, to bring cur_term, _nc_curr_line and + _nc_curr_col variables into linked programs: move these variables, + making new modules lib_cur_term and trace_buf (reported by Francisco + Alberto Tomei Torres ). + > patches by Alexander V. Lukyanov: + + add pseudo-functionkey KEY_RESIZE which is returned by getch() when + the SIGWINCH handler has been called since the last call to + doupdate(). + + modify lib_twait.c to hide EINTR only if HIDE_EINTR is defined. + + add SIGWINCH handler to ncurses library which is used if there is no + application SIGWINCH handler in effect when the screen is + initialized. + + make linked list of all SCREEN structures. + + move curses.h include before definition of SCREEN to use types in + that structure. + + correction to ensure that wgetstr uses only a newline to force a + scroll (970831). + +970831 + + add experimental configure option --enable-safe-sprintf; the normal + mode now allocates a buffer as large as the screen for the + lib_printw.c functions. + + modify wgetch to refresh screen when reading ungetch'd characters, + since the application may require this - SVr4 does this. + + refine treatment of newline in wgetstr to echo only when this would + force the screen to scroll. + +970830 + + remove override in wgetstr() that forces keypad(), since SVr4 does + not do this. + + correct y-reference for erasure in wgetstr() when a wrap forces a + scroll. + + correct x-position in waddch() after a wrap forces a scroll. + + echo newline in wgetstr(), making testscanw.c scroll properly when + scanw is done. + + modify vwscanw() to avoid potential buffer overflow. + + rewrote lib_printw.c to eliminate fixed-buffer limits. + > patches by Alexander V. Lukyanov: + + correct an error in handling cooked mode in wgetch(); processing + was in the wrong order. + + simplified logic in wgetch() that handles backspace, etc., by using + wechochar(). + + correct wechochar() so that it interprets the output character as + in waddch(). + + modify pechochar() to use prefresh() rather than doupdate(), since + the latter does not guarantee immediate refresh of the pad. + + modify pechochar() so that if called with a non-pad WINDOW, will + invoke wechochar() instead. + + modify fifo indices to allow fifo to be longer than 127 bytes. + +970823 + + add xterm-8bit to terminfo.src + + moved logic for SP->_fifohold inside check_pending() to make it + work properly when we add calls to that function. + + ensure that bool functions return only TRUE or FALSE, and TRUE/FALSE + are assigned to bool values (patch by H.J.Lu). + > patches by Alexander V. Lukyanov: + + several fixes to getch: + 1. Separate cooked and raw keys in fifo + 2. Fix the case of ungetch'ed KEY_MOUSE + 3. wrap the code for hiding EINTR with ifdef HIDE_EINTR + 4. correctly handle input errors (i.e., EINTR) without loss of raw + keys + 5. recognize ESC KEY_LEFT and similar + 6. correctly handle the case of receiption of KEY_MOUSE from gpm + + correct off-by-one indexing error in _nc_mouse_parse(), that caused + single mouse events (press/release) to be ignored in favor of + composed events (click). Improves on a fix from integrating gpm + support in 961229. + + add another call to check_pending, before scrolling, for + line-breakout optimization + + improve hashmap.c by + 1. fixed loop condition in grow_hunks() + 2. not marking lines with offset 0 + 3. fixed condition of 'too far' criteria, thus one-line hunks are + ignored and two lines interchanged won't pass. + + rewrote/simplified _nc_scroll_optimize() by separating into two + passes, forward/backward, looking for chunks moving only in the given + direction. + + move logic that emits sgr0 when initializing the screen to + _nc_screen_init(), now invoked from newterm. + + move cursor-movement cleanup from endwin() into _nc_mvcur_wrap() + function and screen cleanup (i.e., color) into _nc_screen_wrap() + function. + + add new functions _nc_screen_init(), _nc_screen_resume() and + _nc_screen_wrap(). + + rename _nc_mvcur_scrolln() to _nc_scrolln(). + + add a copy of acs_map[] to the SCREEN structure, where it can be + stored/retrieved via set_term(). + + move variables _nc_idcok, _nc_idlok, _nc_windows into the SCREEN + structure. + +970816 + + implement experimental _nc_perform_scroll(). + + modify newterm (actually _nc_setupscreen()) to emit an sgr0 when + initializing the screen, as does SVr4 (reported by Alexander V. + Lukyanov). + + added test_progs rule to ncurses/Makefile. + + modify test/configure.in to check if initscr is already in $LIBS + before looking for (n)curses library. + + correct version-number in configure script for OSF1 shared-library + options (patch by Tim Mooney). + + add -DNDEBUG to CPPFLAGS for --enable-assertions (as Juergen + originally patched) since the c++ demo files do not necessarily + include ncurses_cfg.h + + supply default value for --enable-assertions option in configure + script (reported by Kriang Lerdsuwanakij ). + > patches by Alexander V. Lukyanov: + + correct/simplify logic of werase(), wclrtoeol() and wclrbot(). See + example firstlast.c + + optimize waddch_literal() and waddch_nosync() by factoring out + common subexpressions. + + correct sense of NDEBUG ifdef for CHECK_POSITION macro. + + corrections to render_char(), to make handling of colored blanks + match SVr4 curses, as well as to correct a bug that xor'd space + against the background character. + + replaced hash function with a faster one (timed it) + + rewrote the hashmap algorithm to be one-pass, this avoids multiple + cost_effective() calls on the same lines. + + modified cost_effective() so it is now slightly more precise. + > patches by H.J.Lu for glibc integration: + + add modules define_key, keyok, name_match, tries + + add makefile rules for some of the unit tests in ncurses (mvcur, + captoinfo, hardscroll, hashmap). + + update Linux configure-script for wide-character definitions. + +970809 + + modify _tracebits() to show the character size (e.g., CS8). + + modify tparm() to emit '\200' where the generated string would have a + null (reported by From: Ian Dall for + terminal type ncr7900). + + modify install process so that ldconfig is not invoked if the + package is built with an install-prefix. + + correct test program for chtype size (reported by Tim Mooney). + + add configure option --disable-scroll-hints, using this to ifdef the + logic that computes indices for _nc_scroll_optimize(). + + add module ncurses/softscroll.c, to perform single-stage computation + of scroll indices used in _nc_scroll_optimize(). This is faster than + the existing scrolling algorithm, but tends to make too-small hunks. + + eliminate fixed buffer size in _nc_linedump(). + + minor fixes to lib_doupdate.c to add tradeoff between clr_eol (el) + and clr_bol (el1), refine logic in ClrUpdate() and ClrBottom() (patch + by Alexander V. Lukyanov). + + add test/testaddch.c, from a pending patch by Alexander V. Lukyanov. + + correct processing of "configure --enable-assertions" option (patch + by Juergen Pfeifer). + +970802 + + add '-s' (single-step) option too test/hashtest.c, correct an error + in loop limit for '-f' (footer option), toggle scrollok() when + writing footer to avoid wrap at lower-right corner. + + correct behavior of clrtoeol() immediately after wrapping cursor, + which was not clearing the line at the cursor position (reported by + Liviu Daia ). + + corrected mapping for ACS_LANTERN, which was 'I' rather than 'i' + (reported by Klaus Weide ). + + many corrections to make progs/capconvert work, as well as make it + reasonably portable and integrated with ncurses 4.1 (reported by Dave + Furstenau ). + +970726 + + add flag SP->_fifohold, corresponding logic to modify the behavior of + the line breakout logic so that if the application does not read + input, refreshes will not be stopped, but only slowed. + + generate slk_attr_off(), slk_attr_on(), slk_attr_set(), vid_attr(), + ifdef'd for wide-character support, since ncurses' WA_xxx attribute + masks are identical with the A_xxx masks. + + modify MKlib_gen.sh to generate ifdef'd functions to support optional + configuration of wide-characters. + + modify tset to behave more like SVr4's tset, which does not modify + the settings of intr, quit or erase unless they are given as command + options (reported by Nelson H. F. Beebe ). + + modify tset to look in /etc/ttys or /etc/ttytype if the configuration + does not have getttynam(). + + extend baudrate table in tset.c to match baudrate() function. + + add table entries for 230400 and 460800 bd to baudrate() function. + + improve breakout logic by allowing it before the first line updated, + which is what SVr4 curses does (patch by Alexander V. Lukyanov). + + correct initialization of vcost in relative_move(), for cursor-down + case (patch by Alexander V. Lukyanov). + > nits gleaned from Debian distribution of 1.9.9g-3: + + install symbolic link for intotocap. + + reference libc directly when making shared libraries. + + correct renaming of curs_scr_dmp.3x in man_db.renames. + + guard tgetflag() and other termcap functions against null cur_term + pointer. + +970719 + + corrected initial state of software echo (error in 970405, reported + by Alexander V. Lukyanov). + + reviewed/added messages to configure script, so that all non-test + options should be accompanied by a message. + + add configure check for long filenames, using this to determine if + it is safe to allow long aliases for terminal descriptions as does + SVr4. + + add configure options for widec (wide character), hashmap (both + experimental). + > patch by Alexander V. Lukyanov: + + hashmap.c - improved by heuristic, so that scroll test works much + better when csr is not available. + + hardscroll.c - patched so that it continues to scroll other chunks + after failure to scroll one. + + lib_doupdate.c - _nc_mvcur_scrolln extended to handle more cases; csr + is avoided as it is relative costly. Fixed wrong coordinates in one + case and wrong string in TRACE. + > patch by Juergen Pfeifer: + + modify C++ binding to compile on AIX 4.x with the IBM C-SET++ + compiler. + +970712 + + remove alternate character set from kterm terminfo entry; it uses the + shift-out control for a purpose incompatible with curses, i.e., font + switching. + + disentangle 'xterm' terminfo entry from some derived entries that + should be based on xterm-r6 instead. + + add cbt to xterm-xf86-xv32 terminfo entry; I added the emulation for + XFree86 3.1.2F, but overlooked its use in terminfo then - T.Dickey. + + correct logic in lib_mvcur.c that uses back_tab. + +970706 + + correct change from 970628 to ClrUpdate() in lib_doupdate.c so that + contents of curscr are saved in newscr before clearing the screen. + This is needed to make repainting work with the present logic of + TransformLine(). + + use napms() rather than sleep() in tset.c to avoid interrupting I/O. + +970705 + + add limit checks to _nc_read_file_entry() to guard against overflow + of buffer when reading incompatible terminfo format, e.g, from OSF/1. + + correct some loop-variable errors in xmc support in lib_doupdate.c + + modify ncurses 'b' test to add gaps, specified by user, to allow + investigation of interaction with xmc (magic cookie) code. + + correct typo in 970524 mods to xmas.c, had omitted empty parameter + list from has_colors(), which gcc ignores, but SVr4 does not + (reported by Larry Virden). + + correct rmso capability in wy50-mc description. + + add configure option "--enable-hard-tabs", renamed TABS_OK ifdef to + USE_HARD_TABS. + > patch by Juergen Pfeifer: + + Add bindings for keyok() and define_key() to the Ada95 packages. + + Improve man pages menu_post.3x and menu_format.3x + + Fix the HTML pages in the Ada95/html directory to reflect the above + changes. + +970628 + + modify change from 970101 to ClrUpdate() in lib_doupdate.c so that + pending changes to both curscr and newscr are flushed properly. + This fixes a case where the first scrolling operation in nvi would + cause the screen to be cleared unnecessarily and repainted before + doing the indexing, i.e., by repeatedly pressing 'j' (reported by + Juergen Pfeifer). + + correct error in trans_string() which added embedded newlines in a + terminfo description to the stored strings. + + remove spurious newlines from sgr in wyse50 (and several other) + terminfo descriptions. + + add configure option for experimental xmc (magic cookie) code, + "--enable-xmc-glitch". When disabled (the default), attributes that + would store a magic cookie are suppressed in vidputs(). The magic + cookie code is far from workable at this stage; the configuration + option is a stopgap. + + move _nc_initscr() from lib_initscr.c to lib_newterm.c + + correct path for invoking make_keys (a missing "./"). + +970621 + + correct sign-extension problem with "infocmp -e", which corrupted + acsc values computed for linux fallback data. + + correct dependency on ncurses/names.c (a missing "./"). + + modify configure script to use '&&' even for cd'ing to existing + directories to work around broken shell interpreters. + + correct a loop-limit in _nc_hash_map() (patch by Alexander V. + Lukyanov). + +970615 + + restore logic in _nc_scroll_optimize() which marks as touched the + lines in curscr that are shifted. + + add new utility 'make_keys' to compute keys.tries as a table rather + than a series of function calls. + + correct include-dependency for tic.h used by name_match + + removed buffer-allocation for name and description from m_item_new.c, + since this might result in incompatibilities with SVr4. Also fixed + the corresponding Ada95 binding module (patch by Juergen Pfeifer, + from report by Avery Pennarun ) + + removed the mechanism to timestamp the generated Ada95 sources. This + resulted always in generating patches for the HTML doc, even when + nothing really changed (patch by Juergen Pfeifer). + + improve man page mitem_new.3x (patch by Juergen Pfeifer). + +970614 + + remove ech capability from rxvt description because it does not work. + + add missing case logic for infocmp -I option (reported by Lorenzo M. + Catucci ) + + correct old bug in pnoutrefresh() unmasked by fix in 970531; this + caused glitches in the ncurses 'p' test since the area outside the + pad was not compared when setting up indices for _nc_scroll_optimize. + + rewrote tracebits() to workaround misdefinition of TOSTOP on Ultrix + 4.4, as well as to eliminate fixed-size buffer (reported by Chris + Tanner ) + + correct prototype for termattrs() as per XPG4 version 2. + + add placeholder prototypes for color_set(), erasewchar(), + term_attrs(), wcolor_set() as per XPG4 version 2. + + correct attribution for progs/progs.priv.h and lib_twait.c + + improve line-breakout logic by checking based on changed lines rather + than total lines (patch by Alexander V. Lukyanov). + + correct loop limits for table-lookup of enumerated value in form + (patch by Juergen Pfeifer). + + improve threshhold computation for determining when to call ClrToEOL + (patch by Alexander V. Lukyanov). + +970531 + + add configure option --disable-database to force the library to + use only the fallback data. + + add configure option --with-fallbacks, to specify list of fallback + terminal descriptions. + + add a symbolic link for ncurses.h during install; too many programs + still assume there's an ncurses.h + + add new terminfo.src entry for xterm-xf86-v33. + + restore terminfo.src entry for emu to using setf/setb, since it is + not, after all, generating ANSI sequences. Corrected missing comma + that caused setf/setb entries to merge. + + modify mousemask() to use keyok() to enable/disable KEY_MOUSE, so + that applications can disable ncurses' mouse and supply their own + handler. + + add extensions keyok() and define_key(). These are designed to allow + the user's application better control over the use of function keys, + e.g., disabling the ncurses KEY_MOUSE. (The define_key idea was from + a mailing-list thread started by kjahds@kjahds.com Nov'1995). + + restore original behavior in ncurses 'g' test, i.e., explicitly + set the keypad mode rather than use the default, since it confuses + people. + + rewrote the newdemo banner so it's readable (reported by Hugh Daniel). + + tidy up exit from hashtest (reported by Hugh Daniel). + + restore check for ^Q in ncurses 'g' test broken in 970510 (reported + by Hugh Daniel) + + correct tput program, checking return-value of setupterm (patch by + Florian La Roche). + + correct logic in pnoutrefresh() and pechochar() functions (reported + by Kriang Lerdsuwanakij ). The computation + of 'wide' date to eric's #283 (1.9.9), and the pechochar bug to the + original implementation (1.9.6). + + correct typo in vt102-w terminfo.src entry (patch by Robert Wuest + ) + + move calls of _nc_background() out of various loops, as its return + value will be the same for the whole window being operated on (patch + by J.T.Conklin). + + add macros getcur[xy] getbeg[xy] getpar[xy], which are defined in + SVr4 headers (patch by J.T.Conklin ) + + modify glibc addon-configure scripts (patch by H.J.Lu). + + correct a bug in hashmap.c: the size used for clearing the hashmap + table was incorrect, causing stack corruption for large values of + LINES, e.g., >MAXLINES/2 (patch by Alexander V. Lukyanov). + + eric's terminfo 9.13.23 & 9.13.24 changes: replaced minitel-2 entry, + added MGR, ansi-nt (note: the changes described for 9.13.24 have not + been applied). + > several changes by Juergen Pfeifer: + + correct a missing error-return in form_driver.c when wrapping of a + field is not possible. + + correct logic in form_driver.c for configurations that do not have + memccpy() (reported by Sidik Isani ) + + change several c++ binding functions to inline. + + modify c++ menu binding to inherit from panels, for proper + initialization. + + correct freeing of menu items in c++ binding. + + modify c++ binding to reflect removal of const from user data pointer + in forms/menus libraries. + +970524 + + add description of xterm-16color. + + modify name of shared-library on *BSD to end with $(REL_VERSION) + rather than $(ABI_VERSION) to match actual convention on FreeBSD + (cf: 960713). + + add OpenBSD to shared-library case, same as NetBSD and FreeBSD + (reported by Hugh Daniel ). + + corrected include-dependency in menu/Makefile so that "make install" + works properly w/o first doing "make". + + add fallback definition for isascii, used in infocmp. + + modify xmas to use color, and to exit right away when a key is + pressed. + + modify gdc so that the scrolled digits function as described (there + was no time delay between the stages, and the digits overwrote the + bounding box without tidying up). + + modify lib_color.c to use setaf/setab only for the ANSI color codes + 0 through 7. Using 16 colors requires setf/setb. + + modify ncurses 'c' test to work with 16 colors, as well as the normal + 8 colors. + + remove const qualifier from user data pointer in forms and menus + libraries (patch by Juergen Pfeifer). + + rewrote 'waddchnstr()' to avoid using the _nc_waddch_nosync() + function, thereby not interpreting tabs, etc., as per spec (patch by + Alexander V. Lukyanov). + +970517 + + suppress check for pre-existing ncurses header if the --prefix + option is specified. + + add configure options "--with-system-type" and "--with-system-release" + to assist in checking the generated makefiles. + + add configure option "--enable-rpath" to allow installers to specify + that programs linked against shared libraries will have their library + path embedded, allowing installs into nonstandard locations. + + add flags to OSF1 shared-library options to specify version and + symbol file (patch by Tim Mooney ) + + add missing definition for ABI_VERSION to c++/Makefile.in (reported + by Satoshi Adachi ). + + modify link flags to accommodate HP-UX linker which embeds absolute + pathnames in executables linked against shared libraries (reported by + Jason Evans , solved by Alan Shutko + ). + + drop unnecessary check for attribute-change in onscreen_mvcur() since + mvcur() is the only caller within the library, and that check in turn + is exercised only from lib_doupdate.c (patch by Alexander V. + Lukyanov). + + add 'blank' parameter to _nc_scroll_window() so _nc_mvcur_scrolln() + can use the background of stdscr as a parameter to that function + (patch by Alexander V. Lukyanov). + + moved _nc_mvcur_scrolln() from lib_mvcur.c to lib_doupdate.c, to use + the latter's internal functions, as well as to eliminate unnecessary + cursor save/restore operations (patch by Alexander V. Lukyanov). + + omit parameter of ClrUpdate(), since it is called only for newscr, + further optimized/reduced by using ClearScreen() and TransformLine() + to get rid of duplicate code (patch by Alexander V. Lukyanov). + + modify scrolling algorithm in _nc_scroll_optimize() to reject hunks + that are smaller than the distance to be moved (patch by Alexander V. + Lukyanov). + + correct a place where the panel library was not ifdef'd in ncurses.c + (Juergen Pfeifer) + + documentation fixes (Juergen Pfeifer) 970515 4.1 release for upload to prep.ai.mit.edu + re-tag changes since 970505 as 4.1 release. @@ -49,7 +1107,7 @@ started working with Pavel Curtis' original work, pcurses, in 1992: rather than the strings which they (may) point to. + add check to ensure that C++ binding and demo are not built with g++ versions below 2.7, since the binding uses templates. - + modify c++ binding and demo to build and run with SGI's c++ compiler. + + modify c++ binding and demo to build and run with SGI's c++ compiler. (It also compiles with the Sun SparcWorks compiler, but the demo does not link, due to a vtbl problem). + corrections to demo.cc, to fix out-of-scope variables (Juergen @@ -175,7 +1233,7 @@ started working with Pavel Curtis' original work, pcurses, in 1992: + add header dependencies so that "make install.libs" will succeed even if "make all" is not done first. + moved some macros from lib_doupdate.c to curses.priv.h to use in - expanded functions with ATAC. + expanded functions with ATAC. + correct implementation of lib_instr.c; both XSI and SVr4 agree that the winnstr functions can return more characters than will fit on one line. @@ -322,7 +1380,7 @@ started working with Pavel Curtis' original work, pcurses, in 1992: > contrary to comments, some scrolling cases were tested after the insert/delete line method. + modify _tracedump() to show first/last changes. - + modify param of ClrUpdate() in lib_doupdate.c to 'curscr', fixes + + modify param of ClrUpdate() in lib_doupdate.c to 'newscr', fixes refresh problem (reported by Peter Wemm) that caused nvi to not show result of ":r !ls" until a ^L was typed. diff --git a/README b/README index 8af7db77..cf1ab656 100644 --- a/README +++ b/README @@ -1,3 +1,5 @@ +-- $Id: README,v 1.17 1998/02/15 01:26:47 tom Exp $ +------------------------------------------------------------------------------- README file for the ncurses package See the file ANNOUNCE for a summary of ncurses features and ports. @@ -12,11 +14,11 @@ Browse the file misc/hackguide.html for a tour of the package internals. ROADMAP AND PACKAGE OVERVIEW: -You should be reading this file in a directory called: ncurses-d.d.d, -where d.d.d is the current version number (see the dist.mk file in -this directory for that). There should be a number of subdirectories, -including `c++', `form', `man', `menu', `misc', `ncurses', `panel', -`progs', `test', and `Ada95'. +You should be reading this file in a directory called: ncurses-d.d, where d.d +is the current version number (see the dist.mk file in this directory for +that). There should be a number of subdirectories, including `c++', `form', +`man', `menu', `misc', `ncurses', `panel', `progs', `test', 'tack' and `Ada95'. +(The 'tack' program is distributed separately). A full build/install of this package typically installs several libraries, a handful of utilities, and a database hierarchy. Here is an inventory of the @@ -30,33 +32,36 @@ The libraries are: libncurses_p.a (profiling enabled) libpanel.a (normal) + libpanel.so (shared) libpanel_g.a (debug and trace code enabled) libmenu.a (normal) + libmenu.so (shared) libmenu_g.a (debug enabled) libform.a (normal) + libform.so (shared) libform_g.a (debug enabled) The ncurses libraries implement the curses API. The panel, menu and forms -libraries implement clones of the SVr4 panel, menu and forms APIs. The -source code for these lives in the `ncurses', `panel', `menu', and -`form' directories respectively. +libraries implement clones of the SVr4 panel, menu and forms APIs. The source +code for these lives in the `ncurses', `panel', `menu', and `form' directories +respectively. In the `c++' directory, you'll find code that defines an interface to the -curses and panels library packaged as a C++ class, and a demo program in C++ -to test it. These class definition modules are not installed anywhere by -default; it's up to you what you do with them. +curses, forms, menus and panels library packaged as C++ classes, and a demo program in C++ +to test it. These class definition modules are not installed by the 'make +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.05 or above). It is not installed automatically. +an usable version of GNAT (3.10 or above). It is not installed automatically. See the Ada95 directory for more build and installation instructions and for documentation of the binding. -In order to do its job, the ncurses code needs your terminal type to be set in -the environment variable TERM (normally set by your OS; under UNIX, getty(1) +To do its job, the ncurses code needs your terminal type to be set in the +environment variable TERM (normally set by your OS; under UNIX, getty(1) typically does this, but you can override it in your .profile); and, it needs a database of terminal descriptions in which to look up your terminal type's capabilities. @@ -72,7 +77,7 @@ second form. In the `misc' directory, there is a text file terminfo.src, in editable terminfo format, which can be used to generate the terminfo binaries (that's what make install.data does). If the package was built with the ---with-termcap option enabled, and the ncurses library can't find a terminfo +--enable-termcap option enabled, and the ncurses library cannot find a terminfo description for your terminal, it will fall back to the termcap file supplied with your system (which the ncurses package installation leaves strictly alone). @@ -83,33 +88,23 @@ The utilities are as follows: infocmp -- terminfo binary to source decompiler/comparator clear -- emits clear-screen for current terminal tput -- shell-script access to terminal capabilities. - tset -- terminal-initialization utility toe -- table of entries utility + tset -- terminal-initialization utility -The first two are used for manipulating terminfo descriptions; the next two -are for use in shell scripts. The last is provided for 4.4BSD compatibility. -The source code for all of these lives in the `progs' directory. +The first two (tic and infocmp) are used for manipulating terminfo +descriptions; the next two (clear and tput) are for use in shell scripts. The +last (tset) is provided for 4.4BSD compatibility. The source code for all of +these lives in the `progs' directory. Detailed documentation for all libraries and utilities can be found in the `man' directory. An HTML introduction to ncurses, panels, and -menus programming lives in the `misc' directory. - -The `test' directory contains programs that can be used to verify the -functions of the ncurses libraries. See test/README for descriptions of -these programs. Notably, the `ncurses' utility is designed to help you -systematically exercise the library functions. - -RELATED RESOURCES: - -This distribution now includes (and uses) a copy of the master terminfo -database maintained by Eric Raymond. This database (which is the -official descendant of the 4.4BSD termcap file) changes faster than this -code does. +menus programming lives in the `misc' directory. Manpages in HTML format +are under `Ada95/html'. -You can surf to a WWW page that carries the current terminfo master file, -and news about ncurses, at - - http://www.ccil.org/~esr/ncurses.html +The `test' directory contains programs that can be used to verify or +demonstrate the functions of the ncurses libraries. See test/README for +descriptions of these programs. Notably, the `ncurses' utility is designed to +help you systematically exercise the library functions. AUTHORS: @@ -122,23 +117,30 @@ Zeyd M. Ben-Halim: Thomas Dickey (maintainer since 1.9.9e): configuration scripts, porting, mods to adhere to XSI Curses in the areas of background color, terminal modes. Also memory leak testing, - the wresize extension and numerous bug fixes (more than half of those - enumerated in NEWS since release 1.9.2d) + the wresize, default colors and key definition extensions and numerous + bug fixes (more than half of those enumerated in NEWS beginning with + the internal release 1.8.9). + +Florian La Roche (official maintainer for FSF's ncurses 4.2) + Beginning with release 4.2, ncurses is distributed under an MIT-style + license. Eric S. Raymond: the man pages, infocmp(1), tput(1), clear(1), captoinfo(1), tset(1), - toe(1), most of tic(1), src/lib_twait.c, trace levels, the HTML intro, - wgetnstr() and many other entry points, the cursor-movement - optimization, the scroll-pack optimizer for vertical motions, - the mouse interface and xterm mouse support, and the ncurses - test program. + toe(1), most of tic(1), trace levels, the HTML intro, wgetnstr() and + many other entry points, the cursor-movement optimization, the + scroll-pack optimizer for vertical motions, the mouse interface and + xterm mouse support, and the ncurses test program. Juergen Pfeifer - The menu and form code, and the Ada95 binding. Ongoing support for - panel. + The menu and form libraries, C++ bindings for ncurses, menus, forms and + panels, as well as the Ada95 binding. Ongoing support for panel. CONTRIBUTORS: +Alexander V. Lukyanov + for numerous fixes and improvements to the optimization logic. + David MacKenzie for first-class bug-chasing and methodical testing. @@ -161,6 +163,9 @@ Keith Bostic (maintainer of 4.4BSD curses) for help, criticism, comments, bug-finding, and being willing to deep-six BSD curses for this one when it grew up. +Richard Stallman, + for his commitment to making ncurses free software. + Countless other people have contributed by reporting bugs, sending fixes, suggesting improvements, and generally whining about ncurses :-) diff --git a/TO-DO b/TO-DO index 8e4d6f27..57c87f85 100644 --- a/TO-DO +++ b/TO-DO @@ -1,44 +1,35 @@ +-- $Id: TO-DO,v 1.38 1997/10/11 14:47:42 tom Exp $ + SHORT-TERM TO-DO ITEMS: Known Problems: +* XPG4 specifies that the enhanced features are not available unless the + _XOPEN_SOURCE_EXTENDED test macro is defined by the application. Ncurses uses + this macro (incorrectly) to address a dependency upon wchar_t. The functions + which use wchar_t are not implemented, so the effect of the test macro is + pointless. + * 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. -* Ncurses cursor movement does not make effective use of hard tabs, as SVr4 - does. - -* Scrolling optimization has holes: for example, the ncurses 'p' test, which - exercises scrolling in a pad does not (1996/12/24) use scrolling regions. - Also, running other tests shows that scrolling optimization forces repaints - of the screen between calls to refresh(). - -* The stacking order of windows on the screen does not match that implemented - in SVr4 (e.g., Solaris curses). XSI doesn't specify a stacking order, so - full compatibility for this behavior must be achieved by testing/analysis. +* 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. -* The ncurses 'o' test does not behave the same on SVr4 (Solaris) as with - ncurses (the latter pops windows up more). The former also produces 20% - fewer characters in a 'script' output. Further analysis is needed. +* 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. 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 ++ 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 (the - actual code that does this is in ncurses/lib_options.c:add_keytry(). - This is a legacy terminfo property we can't mess with. - -* Recognition of xterm mouse reports is implemented by setting the kmous - capability to the mouse-report prefix. As a result, the kmous sequence is - eaten even when mouse recognition is disabled. This could be fixed if - necessary with special code that pokes the kmous value back into the - input FIFO when KEY_MOUSE is seen and the mousemask is zero, but that would - be kind of ugly. + 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... @@ -58,7 +49,7 @@ Portability (or lack thereof): 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. + 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. @@ -67,7 +58,8 @@ Portability (or lack thereof): * The demo build for the c++ library craps out with many link errors under gcc 2.6.3. We're told the C++ support in 2.6.3 is broken and that the right - fix is to upgrade to 2.7.0. + fix is to upgrade to 2.7.0. This demo is also known to not build with + the Sun SPARCworks 4.1 C++ compiler, due to a problem resolving templates. * Under Ultrix, configure craps out (Ultrix sh is lame). Run it under ksh. @@ -78,9 +70,11 @@ Portability (or lack thereof): Then, run "make mostlyclean", remove config.* from the top-level directory and configure for the cross-compiler. -Untested features: ++ 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. -* The rep optimization in lib_doupdate.c is not yet thoroughly tested. +Untested features: * The code for the HP color model using set_color_pair is untested. diff --git a/aclocal.m4 b/aclocal.m4 index efaa3949..dbc6baa2 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,29 +1,41 @@ -dnl***************************************************************************** -dnl Copyright 1996,1997 by Thomas E. Dickey * -dnl All Rights Reserved. * -dnl * -dnl Permission to use, copy, modify, and distribute this software and its * -dnl documentation for any purpose and without fee is hereby granted, provided * -dnl that the above copyright notice appear in all copies and that both that * -dnl copyright notice and this permission notice appear in supporting * -dnl documentation, and that the name of the above listed copyright holder(s) * -dnl not be used in advertising or publicity pertaining to distribution of the * -dnl software without specific, written prior permission. THE ABOVE LISTED * -dnl COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * -dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * -dnl EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * -dnl SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * -dnl RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * -dnl CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * -dnl CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * -dnl***************************************************************************** -dnl $Id: aclocal.m4,v 1.60 1997/05/10 15:56:16 tom Exp $ +dnl*************************************************************************** +dnl Copyright (c) 1998 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 * +dnl "Software"), to deal in the Software without restriction, including * +dnl without limitation the rights to use, copy, modify, merge, publish, * +dnl distribute, distribute with modifications, sublicense, and/or sell * +dnl copies of the Software, and to permit persons to whom the Software is * +dnl furnished to do so, subject to the following conditions: * +dnl * +dnl The above copyright notice and this permission notice shall be included * +dnl in all copies or substantial portions of the Software. * +dnl * +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * +dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * +dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * +dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * +dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * +dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * +dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. * +dnl * +dnl Except as contained in this notice, the name(s) of the above copyright * +dnl holders shall not be used in advertising or otherwise to promote the * +dnl sale, use or other dealings in this Software without prior written * +dnl authorization. * +dnl*************************************************************************** +dnl +dnl Author: Thomas E. Dickey 1996,1997,1998 +dnl +dnl $Id: aclocal.m4,v 1.121 1998/02/11 12:13:40 tom Exp $ dnl Macros used in NCURSES auto-configuration script. dnl dnl --------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------- dnl Construct the list of include-options for the C programs in the Ada95 dnl binding. -AC_DEFUN([NC_ADA_INCLUDE_DIRS], +AC_DEFUN([CF_ADA_INCLUDE_DIRS], [ ACPPFLAGS="$ACPPFLAGS -I. -I../../include" if test "$srcdir" != "."; then @@ -49,15 +61,15 @@ dnl 2.6.3 does, in anticipation of the ANSI C++ standard. dnl dnl Treat the configuration-variable specially here, since we're directly dnl substituting its value (i.e., 1/0). -AC_DEFUN([NC_BOOL_DECL], +AC_DEFUN([CF_BOOL_DECL], [ AC_MSG_CHECKING([for builtin c++ bool type]) -AC_CACHE_VAL(nc_cv_builtin_bool,[ +AC_CACHE_VAL(cf_cv_builtin_bool,[ AC_TRY_COMPILE([],[bool x = false], - [nc_cv_builtin_bool=1], - [nc_cv_builtin_bool=0]) + [cf_cv_builtin_bool=1], + [cf_cv_builtin_bool=0]) ]) -if test $nc_cv_builtin_bool = 1 +if test $cf_cv_builtin_bool = 1 then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi @@ -65,11 +77,11 @@ fi dnl --------------------------------------------------------------------------- dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type). dnl Don't bother looking for bool.h, since it's been deprecated. -AC_DEFUN([NC_BOOL_SIZE], +AC_DEFUN([CF_BOOL_SIZE], [ AC_MSG_CHECKING([for size of c++ bool]) -AC_CACHE_VAL(nc_cv_type_of_bool,[ - rm -f nc_test.out +AC_CACHE_VAL(cf_cv_type_of_bool,[ + rm -f cf_test.out AC_TRY_RUN([ #include #include @@ -78,9 +90,11 @@ AC_CACHE_VAL(nc_cv_type_of_bool,[ #endif main() { - FILE *fp = fopen("nc_test.out", "w"); + FILE *fp = fopen("cf_test.out", "w"); if (fp != 0) { - bool x = false; + bool x = true; + if ((-x) >= 0) + fputs("unsigned ", fp); if (sizeof(x) == sizeof(int)) fputs("int", fp); else if (sizeof(x) == sizeof(char)) fputs("char", fp); else if (sizeof(x) == sizeof(short))fputs("short",fp); @@ -90,15 +104,15 @@ main() exit(0); } ], - [nc_cv_type_of_bool=`cat nc_test.out`], - [nc_cv_type_of_bool=unknown], - [nc_cv_type_of_bool=unknown]) + [cf_cv_type_of_bool=`cat cf_test.out`], + [cf_cv_type_of_bool=unknown], + [cf_cv_type_of_bool=unknown]) ]) - rm -f nc_test.out -AC_MSG_RESULT($nc_cv_type_of_bool) -if test $nc_cv_type_of_bool = unknown ; then + rm -f cf_test.out +AC_MSG_RESULT($cf_cv_type_of_bool) +if test "$cf_cv_type_of_bool" = unknown ; then AC_MSG_WARN(Assuming unsigned for type of bool) - nc_cv_type_of_bool=unsigned + cf_cv_type_of_bool=unsigned fi ])dnl dnl --------------------------------------------------------------------------- @@ -112,22 +126,25 @@ dnl dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's dnl programs from a vendor's. -AC_DEFUN([NC_CFG_DEFAULTS], +AC_DEFUN([CF_CFG_DEFAULTS], [ AC_MSG_CHECKING(for prefix) if test "x$prefix" = "xNONE" ; then - case "$nc_cv_systype" in + case "$cf_cv_system_name" in # non-vendor systems don't have a conflict - NetBSD|FreeBSD|Linux) prefix=/usr + openbsd*|netbsd*|freebsd*|linux*) + prefix=/usr ;; *) prefix=$ac_default_prefix ;; esac fi AC_MSG_RESULT($prefix) + +if test "x$prefix" = "xNONE" ; then AC_MSG_CHECKING(for default include-directory) -test -n "$verbose" && echo 1>&6 -for nc_symbol in \ +test -n "$verbose" && echo 1>&AC_FD_MSG +for cf_symbol in \ $includedir \ $includedir/ncurses \ $prefix/include \ @@ -137,76 +154,161 @@ for nc_symbol in \ /usr/include \ /usr/include/ncurses do - nc_dir=`eval echo $nc_symbol` - if test -f $nc_dir/curses.h ; then - if ( fgrep NCURSES_VERSION $nc_dir/curses.h 2>&1 >/dev/null ) ; then - includedir="$nc_symbol" - test -n "$verbose" && echo $ac_n " found " 1>&6 + cf_dir=`eval echo $cf_symbol` + if test -f $cf_dir/curses.h ; then + if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then + includedir="$cf_symbol" + test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG break fi fi - test -n "$verbose" && echo " tested $nc_dir" 1>&6 + test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG done AC_MSG_RESULT($includedir) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl Check for data that is usually declared in or +dnl $1 = the name to check +AC_DEFUN([CF_CHECK_ERRNO], +[ +AC_MSG_CHECKING([declaration of $1]) +AC_CACHE_VAL(cf_cv_dcl_$1,[ + AC_TRY_COMPILE([ +#include +#include +#include ], + [long x = (long) $1], + [eval 'cf_cv_dcl_'$1'=yes'], + [eval 'cf_cv_dcl_'$1'=no]')]) +eval 'cf_result=$cf_cv_dcl_'$1 +AC_MSG_RESULT($cf_result) + +# It's possible (for near-UNIX clones) that the data doesn't exist +AC_CACHE_VAL(cf_cv_have_$1,[ +if test $cf_result = no ; then + eval 'cf_result=DECL_'$1 + CF_UPPER(cf_result,$cf_result) + AC_DEFINE_UNQUOTED($cf_result) + AC_MSG_CHECKING([existence of $1]) + AC_TRY_LINK([ +#undef $1 +extern long $1; +], + [$1 = 2], + [eval 'cf_cv_have_'$1'=yes'], + [eval 'cf_cv_have_'$1'=no']) + eval 'cf_result=$cf_cv_have_'$1 + AC_MSG_RESULT($cf_result) +else + eval 'cf_cv_have_'$1'=yes' +fi +]) +eval 'cf_result=HAVE_'$1 +CF_UPPER(cf_result,$cf_result) +eval 'test $cf_cv_have_'$1' = yes && AC_DEFINE_UNQUOTED($cf_result)' +])dnl +dnl --------------------------------------------------------------------------- +dnl Check if the terminal-capability database functions are available. If not, +dnl ncurses has a much-reduced version. +AC_DEFUN([CF_CGETENT],[ +AC_MSG_CHECKING(for terminal-capability database functions) +AC_CACHE_VAL(cf_cv_cgetent,[ +AC_TRY_LINK([ +#include ],[ + char temp[128]; + char *buf = temp; + char *db_array = temp; + cgetent(&buf, /* int *, */ &db_array, "vt100"); + cgetcap(buf, "tc", '='); + cgetmatch(buf, "tc"); + ], + [cf_cv_cgetent=yes], + [cf_cv_cgetent=no]) +]) +AC_MSG_RESULT($cf_cv_cgetent) +test $cf_cv_cgetent = yes && AC_DEFINE(HAVE_BSD_CGETENT) +])dnl +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. +dnl +dnl If we've packaged config.guess and config.sub, run that (since it does a +dnl better job than uname). +AC_DEFUN([CF_CHECK_CACHE], +[ +if test -f $srcdir/config.guess ; then + AC_CANONICAL_HOST + system_name="$host_os" +else + system_name="`(uname -s -r) 2>/dev/null`" + if test -z "$system_name" ; then + system_name="`(hostname) 2>/dev/null`" + fi +fi +test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") +AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) + +test -z "$system_name" && system_name="$cf_cv_system_name" +test -n "$cf_cv_system_name" && AC_MSG_RESULT("Configuring for $cf_cv_system_name") + +if test ".$system_name" != ".$cf_cv_system_name" ; then + AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) + AC_ERROR("Please remove config.cache and try again.") +fi ])dnl dnl --------------------------------------------------------------------------- dnl If we're trying to use g++, test if libg++ is installed (a rather common dnl problem :-). If we have the compiler but no library, we'll be able to dnl configure, but won't be able to build the c++ demo program. -AC_DEFUN([NC_CXX_LIBRARY], +AC_DEFUN([CF_CXX_LIBRARY], [ -nc_cxx_library=unknown +cf_cxx_library=unknown if test $ac_cv_prog_gxx = yes; then AC_MSG_CHECKING([for libg++]) - nc_save="$LIBS" + cf_save="$LIBS" LIBS="$LIBS -lg++ -lm" AC_TRY_LINK([ #include ], [float foo=abs(1.0)], - [nc_cxx_library=yes + [cf_cxx_library=yes CXXLIBS="$CXXLIBS -lg++ -lm"], - [nc_cxx_library=no]) - LIBS="$nc_save" - AC_MSG_RESULT($nc_cxx_library) + [cf_cxx_library=no]) + LIBS="$cf_save" + AC_MSG_RESULT($cf_cxx_library) fi ])dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([NC_DIRS_TO_MAKE], +AC_DEFUN([CF_DIRS_TO_MAKE], [ DIRS_TO_MAKE="lib" -for nc_item in $nc_list_models +for cf_item in $cf_list_models do - NC_OBJ_SUBDIR($nc_item,nc_subdir) - DIRS_TO_MAKE="$DIRS_TO_MAKE $nc_subdir" + CF_OBJ_SUBDIR($cf_item,cf_subdir) + DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir" done -for nc_dir in $DIRS_TO_MAKE +for cf_dir in $DIRS_TO_MAKE do - test ! -d $nc_dir && mkdir $nc_dir + test ! -d $cf_dir && mkdir $cf_dir done AC_SUBST(DIRS_TO_MAKE) ])dnl dnl --------------------------------------------------------------------------- -dnl -AC_DEFUN([NC_ERRNO], +dnl Check if 'errno' is declared in +AC_DEFUN([CF_ERRNO], [ -AC_MSG_CHECKING([for errno external decl]) -AC_CACHE_VAL(nc_cv_extern_errno,[ - AC_TRY_COMPILE([ -#include ], - [int x = errno], - [nc_cv_extern_errno=yes], - [nc_cv_extern_errno=no]) - ]) -AC_MSG_RESULT($nc_cv_extern_errno) -test $nc_cv_extern_errno = yes && AC_DEFINE(HAVE_EXTERN_ERRNO) +CF_CHECK_ERRNO(errno) ])dnl dnl --------------------------------------------------------------------------- dnl Test for availability of useful gcc __attribute__ directives to quiet dnl compiler warnings. Though useful, not all are supported -- and contrary dnl to documentation, unrecognized directives cause older compilers to barf. -AC_DEFUN([NC_GCC_ATTRIBUTES], -[cat > conftest.i < conftest.i <&AC_FD_CC - case $nc_attribute in + CF_UPPER(CF_ATTRIBUTE,$cf_attribute) + cf_directive="__attribute__(($cf_attribute))" + echo "checking for gcc $cf_directive" 1>&AC_FD_CC + case $cf_attribute in scanf|printf) cat >conftest.h <conftest.h <>confdefs.h # else # sed -e 's/__attr.*/\/*nothing*\//' conftest.h >>confdefs.h @@ -273,7 +375,7 @@ else fgrep define conftest.i >>confdefs.h fi rm -rf conftest* - +fi ])dnl dnl --------------------------------------------------------------------------- dnl Check if the compiler supports useful warning options. There's a few that @@ -282,9 +384,11 @@ dnl dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) dnl -Wredundant-decls (system headers make this too noisy) dnl -Wtraditional (combines too many unrelated messages, only a few useful) +dnl -Wwrite-strings (too noisy, but should review occasionally) +dnl -pedantic dnl -AC_DEFUN([NC_GCC_WARNINGS], -[nc_warn_CFLAGS="" +AC_DEFUN([CF_GCC_WARNINGS], +[ if test -n "$GCC" then changequote(,)dnl @@ -294,11 +398,11 @@ int main(int argc, char *argv[]) { return argv[argc-1] == 0; } EOF changequote([,])dnl AC_CHECKING([for gcc warning options]) - nc_save_CFLAGS="$CFLAGS" - nc_warn_CFLAGS="-W -Wall" - nc_warn_CONST="" - test "$with_ext_const" = yes && nc_warn_CONST="Wwrite-strings" - for nc_opt in \ + cf_save_CFLAGS="$CFLAGS" + EXTRA_CFLAGS="-W -Wall" + cf_warn_CONST="" + test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" + for cf_opt in \ Wbad-function-cast \ Wcast-align \ Wcast-qual \ @@ -308,41 +412,55 @@ EOF Wnested-externs \ Wpointer-arith \ Wshadow \ - Wstrict-prototypes $nc_warn_CONST + Wstrict-prototypes $cf_warn_CONST do - CFLAGS="$nc_save_CFLAGS $nc_warn_CFLAGS -$nc_opt" + CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" if AC_TRY_EVAL(ac_compile); then - test -n "$verbose" && AC_MSG_RESULT(... -$nc_opt) - nc_warn_CFLAGS="$nc_warn_CFLAGS -$nc_opt" + test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) + EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" + test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES" fi done rm -f conftest* - CFLAGS="$nc_save_CFLAGS" + CFLAGS="$cf_save_CFLAGS" fi +AC_SUBST(EXTRA_CFLAGS) ])dnl dnl --------------------------------------------------------------------------- dnl Verify Version of GNAT. -AC_DEFUN([NC_GNAT_VERSION], +AC_DEFUN([CF_GNAT_VERSION], [ changequote(<<, >>)dnl -nc_cv_gnat_version=`$nc_ada_make -v 2>&1 | grep '[0-9].[0-9][0-9]*' |\ +cf_cv_gnat_version=`$cf_ada_make -v 2>&1 | grep '[0-9].[0-9][0-9]*' |\ sed -e 's/[^0-9 \.]//g' | $AWK '{print $<<1>>;}'` -case $nc_cv_gnat_version in - 3.0[5-9]|3.[1-9]*|[4-9].*) +case $cf_cv_gnat_version in + 3.[1-9]*|[4-9].*) ac_cv_prog_gnat_correct=yes ;; - *) echo Unsupported GNAT version $nc_cv_gnat_version. Disabling Ada95 binding. + *) echo Unsupported GNAT version $cf_cv_gnat_version. Required is 3.10 or better. Disabling Ada95 binding. ac_cv_prog_gnat_correct=no ;; esac +case $cf_cv_gnat_version in + 3.1*|[4-9].*) + cf_compile_generics=generics + ;; + *) cf_compile_generics= + ;; +esac changequote([, ])dnl ]) dnl --------------------------------------------------------------------------- +dnl Insert text into the help-message, for readability, from AC_ARG_WITH. +AC_DEFUN([CF_HELP_MESSAGE], +[AC_DIVERT_HELP([$1])dnl +])dnl +dnl --------------------------------------------------------------------------- dnl Construct the list of include-options according to whether we're building dnl in the source directory or using '--srcdir=DIR' option. If we're building dnl with gcc, don't append the includedir if it happens to be /usr/include, dnl since that usually breaks gcc's shadow-includes. -AC_DEFUN([NC_INCLUDE_DIRS], +AC_DEFUN([CF_INCLUDE_DIRS], [ CPPFLAGS="$CPPFLAGS -I. -I../include" if test "$srcdir" != "."; then @@ -362,6 +480,19 @@ fi AC_SUBST(CPPFLAGS) ])dnl dnl --------------------------------------------------------------------------- +dnl Check if we have either a function or macro for 'isascii()'. +AC_DEFUN([CF_ISASCII], +[ +AC_MSG_CHECKING(for isascii) +AC_CACHE_VAL(cf_cv_have_isascii,[ + AC_TRY_LINK([#include ],[int x = isascii(' ')], + [cf_cv_have_isascii=yes], + [cf_cv_have_isascii=no]) +])dnl +AC_MSG_RESULT($cf_cv_have_isascii) +test $cf_cv_have_isascii = yes && AC_DEFINE(HAVE_ISASCII) +])dnl +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 dnl subdirectory is a library-source directory, modify the LIBRARIES list in @@ -373,114 +504,150 @@ dnl one: dnl lib.so -> dnl lib.so. -> dnl lib.so.. -AC_DEFUN([NC_LIB_RULES], +AC_DEFUN([CF_LIB_RULES], [ -AC_REQUIRE([NC_SYSTYPE]) -AC_REQUIRE([NC_VERSION]) -for nc_dir in $SRC_SUBDIRS +CF_LIB_PREFIX(cf_prefix) +AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) +for cf_dir in $SRC_SUBDIRS do - if test -f $srcdir/$nc_dir/modules; then + if test -f $srcdir/$cf_dir/modules; then - nc_libs_to_make= - for nc_item in $NC_LIST_MODELS + cf_libs_to_make= + for cf_item in $CF_LIST_MODELS do - NC_LIB_SUFFIX($nc_item,nc_suffix) - nc_libs_to_make="$nc_libs_to_make ../lib/lib${nc_dir}${nc_suffix}" + CF_LIB_SUFFIX($cf_item,cf_suffix) + cf_libs_to_make="$cf_libs_to_make ../lib/${cf_prefix}${cf_dir}${cf_suffix}" done - sed -e "s@\@LIBS_TO_MAKE\@@$nc_libs_to_make@" \ - $nc_dir/Makefile >$nc_dir/Makefile.out - mv $nc_dir/Makefile.out $nc_dir/Makefile + if test $cf_dir = ncurses ; then + case "$LIB_SUBSETS" in + termlib+*) #(vi + ;; + *) #(vi + cf_item=`echo $cf_libs_to_make |sed -e s/$LIB_NAME/$TINFO_NAME/g` + cf_libs_to_make="$cf_libs_to_make $cf_item" + ;; + esac + fi + + sed -e "s@\@LIBS_TO_MAKE\@@$cf_libs_to_make@" \ + $cf_dir/Makefile >$cf_dir/Makefile.out + mv $cf_dir/Makefile.out $cf_dir/Makefile $AWK -f $srcdir/mk-0th.awk \ - name=$nc_dir \ - $srcdir/$nc_dir/modules >>$nc_dir/Makefile + name=$cf_dir \ + $srcdir/$cf_dir/modules >>$cf_dir/Makefile - for nc_item in $NC_LIST_MODELS + for cf_item in $CF_LIST_MODELS do - echo 'Appending rules for '$nc_item' model ('$nc_dir')' - NC_UPPERCASE($nc_item,NC_ITEM) - NC_LIB_SUFFIX($nc_item,nc_suffix) - NC_OBJ_SUBDIR($nc_item,nc_subdir) + echo 'Appending rules for '$cf_item' model ('$cf_dir')' + CF_UPPER(CF_ITEM,$cf_item) + CF_LIB_SUFFIX($cf_item,cf_suffix) + CF_OBJ_SUBDIR($cf_item,cf_subdir) # These dependencies really are for development, not # builds, but they are useful in porting, too. - nc_depend="../include/ncurses_cfg.h" + cf_depend="../include/ncurses_cfg.h" if test "$srcdir" = "."; then - nc_reldir="." + cf_reldir="." else - nc_reldir="\$(srcdir)" + cf_reldir="\$(srcdir)" fi - if test -f $srcdir/$nc_dir/$nc_dir.priv.h; then - nc_depend="$nc_depend $nc_reldir/$nc_dir.priv.h" - elif test -f $srcdir/$nc_dir/curses.priv.h; then - nc_depend="$nc_depend $nc_reldir/curses.priv.h" + + if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then + cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h" + elif test -f $srcdir/$cf_dir/curses.priv.h; then + cf_depend="$cf_depend $cf_reldir/curses.priv.h" fi + + for cf_subset in $LIB_SUBSETS + do $AWK -f $srcdir/mk-1st.awk \ - name=$nc_dir \ - MODEL=$NC_ITEM \ - model=$nc_subdir \ - suffix=$nc_suffix \ - DoLinks=$nc_cv_do_symlinks \ - rmSoLocs=$nc_cv_rm_so_locs \ + name=$cf_dir \ + MODEL=$CF_ITEM \ + model=$cf_subdir \ + prefix=$cf_prefix \ + suffix=$cf_suffix \ + subset=$cf_subset \ + DoLinks=$cf_cv_do_symlinks \ + rmSoLocs=$cf_cv_rm_so_locs \ + ldconfig="$LDCONFIG" \ overwrite=$WITH_OVERWRITE \ - depend="$nc_depend" \ - $srcdir/$nc_dir/modules >>$nc_dir/Makefile - test $nc_dir = ncurses && WITH_OVERWRITE=no + depend="$cf_depend" \ + target="$target" \ + $srcdir/$cf_dir/modules >>$cf_dir/Makefile + test $cf_dir = ncurses && WITH_OVERWRITE=no $AWK -f $srcdir/mk-2nd.awk \ - name=$nc_dir \ - MODEL=$NC_ITEM \ - model=$nc_subdir \ + name=$cf_dir \ + MODEL=$CF_ITEM \ + model=$cf_subdir \ + subset=$cf_subset \ srcdir=$srcdir \ echo=$WITH_ECHO \ - $srcdir/$nc_dir/modules >>$nc_dir/Makefile + $srcdir/$cf_dir/modules >>$cf_dir/Makefile + done done fi - echo ' cd '$nc_dir'; $(MAKE) $(NC_MFLAGS) [$]@' >>Makefile + echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >>Makefile done -for nc_dir in $SRC_SUBDIRS +for cf_dir in $SRC_SUBDIRS do - if test -f $srcdir/$nc_dir/modules; then + if test -f $cf_dir/Makefile ; then + case "$cf_dir" in + Ada95) #(vi + echo 'install.libs \' >> Makefile + echo 'uninstall.libs ::' >> Makefile + echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >> Makefile + ;; + esac + fi + + if test -f $srcdir/$cf_dir/modules; then echo >> Makefile - if test -f $srcdir/$nc_dir/headers; then -cat >> Makefile <> Makefile <> Makefile fi -cat >> Makefile <> Makefile <> Makefile <> Makefile <> Makefile <> Makefile <headers.sh <headers.sh <>$nc_dir/Makefile <>$cf_dir/Makefile <>$nc_dir/Makefile + test -n "$j" && echo " $j \\" >>$cf_dir/Makefile j=$i done - echo " $j" >>$nc_dir/Makefile - for i in `cat $srcdir/$nc_dir/headers |fgrep -v "#"` + echo " $j" >>$cf_dir/Makefile + for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"` + do + echo " @ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f `basename $i`) ; ../headers.sh \$(INSTALL_DATA) \$(INSTALL_PREFIX)\$(includedir) \$(srcdir) $i" >>$cf_dir/Makefile + test $i = curses.h && echo " @ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f ncurses.h && \$(LN_S) curses.h ncurses.h)" >>$cf_dir/Makefile + done + + cat >>$cf_dir/Makefile <>$nc_dir/Makefile + i=`basename $i` + echo " -@ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f $i)" >>$cf_dir/Makefile + test $i = curses.h && echo " -@ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f ncurses.h)" >>$cf_dir/Makefile done fi done +])dnl +dnl --------------------------------------------------------------------------- +dnl Compute the library-prefix for the given host system +dnl $1 = variable to set +AC_DEFUN([CF_LIB_PREFIX], +[ + case $cf_cv_system_name in + os2) $1='' ;; + *) $1='lib' ;; + esac ])dnl dnl --------------------------------------------------------------------------- dnl Compute the library-suffix from the given model name -AC_DEFUN([NC_LIB_SUFFIX], +dnl $1 = model name +dnl $2 = variable to set +AC_DEFUN([CF_LIB_SUFFIX], [ - AC_REQUIRE([NC_SYSTYPE]) - AC_REQUIRE([NC_VERSION]) + AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) case $1 in normal) $2='.a' ;; debug) $2='_g.a' ;; profile) $2='_p.a' ;; shared) - case $nc_cv_systype in - NetBSD|FreeBSD) - $2='.so.$(ABI_VERSION)' ;; - HP_UX) $2='.sl' ;; + case $cf_cv_system_name in + openbsd*|netbsd*|freebsd*) + $2='.so.$(REL_VERSION)' ;; + hpux*) $2='.sl' ;; *) $2='.so' ;; esac esac ])dnl dnl --------------------------------------------------------------------------- dnl Compute the string to append to -library from the given model name -AC_DEFUN([NC_LIB_TYPE], +AC_DEFUN([CF_LIB_TYPE], [ case $1 in normal) $2='' ;; @@ -592,10 +784,10 @@ dnl Some systems have a non-ANSI linker that doesn't pull in modules that have dnl only data (i.e., no functions), for example NeXT. On those systems we'll dnl have to provide wrappers for global tables to ensure they're linked dnl properly. -AC_DEFUN([NC_LINK_DATAONLY], +AC_DEFUN([CF_LINK_DATAONLY], [ AC_MSG_CHECKING([if data-only library module links]) -AC_CACHE_VAL(nc_cv_link_dataonly,[ +AC_CACHE_VAL(cf_cv_link_dataonly,[ rm -f conftest.a changequote(,)dnl cat >conftest.$ac_ext <&5 >/dev/null - nc_saveLIBS="$LIBS" + cf_saveLIBS="$LIBS" LIBS="conftest.a $LIBS" AC_TRY_RUN([ int main() @@ -639,116 +831,113 @@ EOF exit (!testfunc()); } ], - [nc_cv_link_dataonly=yes], - [nc_cv_link_dataonly=no], - [nc_cv_link_dataonly=unknown]) - LIBS="$nc_saveLIBS" + [cf_cv_link_dataonly=yes], + [cf_cv_link_dataonly=no], + [cf_cv_link_dataonly=unknown]) + LIBS="$cf_saveLIBS" ]) -AC_MSG_RESULT($nc_cv_link_dataonly) -test $nc_cv_link_dataonly = no && AC_DEFINE(BROKEN_LINKER) +AC_MSG_RESULT($cf_cv_link_dataonly) +test $cf_cv_link_dataonly = no && AC_DEFINE(BROKEN_LINKER) ])dnl dnl --------------------------------------------------------------------------- dnl Some 'make' programs support $(MAKEFLAGS), some $(MFLAGS), to pass 'make' dnl options to lower-levels. It's very useful for "make -n" -- if we have it. dnl (GNU 'make' does both :-) -AC_DEFUN([NC_MAKEFLAGS], +AC_DEFUN([CF_MAKEFLAGS], [ AC_MSG_CHECKING([for makeflags variable]) -AC_CACHE_VAL(nc_cv_makeflags,[ - nc_cv_makeflags='' - for nc_option in '$(MFLAGS)' '-$(MAKEFLAGS)' +AC_CACHE_VAL(cf_cv_makeflags,[ + cf_cv_makeflags='' + for cf_option in '$(MFLAGS)' '-$(MAKEFLAGS)' do - cat >ncurses.tmp <cf_makeflags.tmp </dev/null` - if test "$nc_result" != "." + echo '.$cf_option' +CF_EOF + set cf_result=`${MAKE-make} -f cf_makeflags.tmp 2>/dev/null` + if test "$cf_result" != "." then - nc_cv_makeflags=$nc_option + cf_cv_makeflags=$cf_option break fi done - rm -f ncurses.tmp - ]) -AC_MSG_RESULT($nc_cv_makeflags) -AC_SUBST(nc_cv_makeflags) + rm -f cf_makeflags.tmp]) +AC_MSG_RESULT($cf_cv_makeflags) +AC_SUBST(cf_cv_makeflags) ])dnl 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 dnl will install man-pages. -AC_DEFUN([NC_MAN_PAGES], +AC_DEFUN([CF_MAN_PAGES], [AC_MSG_CHECKING(format of man-pages) 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!) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - nc_form=unknown - for nc_dir in $MANPATH; do - test -z "$nc_dir" && nc_dir=/usr/man - nc_rename="" - nc_format=no + cf_form=unknown + for cf_dir in $MANPATH; do + test -z "$cf_dir" && cf_dir=/usr/man + cf_rename="" + cf_format=no changequote({{,}})dnl - for nc_name in $nc_dir/*/date.[01]* $nc_dir/*/date + for cf_name in $cf_dir/*/date.[01]* $cf_dir/*/date changequote([,])dnl do - nc_test=`echo $nc_name | sed -e 's/*//'` - if test "x$nc_test" = "x$nc_name" ; then - case "$nc_name" in - *.gz) nc_form=gzip; nc_name=`basename $nc_name .gz`;; - *.Z) nc_form=compress; nc_name=`basename $nc_name .Z`;; - *.0) nc_form=BSDI; nc_format=yes;; - *) nc_form=cat;; + cf_test=`echo $cf_name | sed -e 's/*//'` + if test "x$cf_test" = "x$cf_name" ; then + case "$cf_name" in + *.gz) cf_form=gzip; cf_name=`basename $cf_name .gz`;; + *.Z) cf_form=compress; cf_name=`basename $cf_name .Z`;; + *.0) cf_form=BSDI; cf_format=yes;; + *) cf_form=cat;; esac break fi done - if test "$nc_form" != "unknown" ; then + if test "$cf_form" != "unknown" ; then break fi done IFS="$ac_save_ifs" if test "$prefix" = "NONE" ; then - nc_prefix="$ac_default_prefix" + cf_prefix="$ac_default_prefix" else - nc_prefix="$prefix" + cf_prefix="$prefix" fi # Debian 'man' program? test -f /etc/debian_version && \ - nc_rename=`cd $srcdir;pwd`/man/man_db.renames + cf_rename=`cd $srcdir && pwd`/man/man_db.renames test ! -d man && mkdir man # Construct a sed-script to perform renaming within man-pages - if test -n "$nc_rename" ; then - fgrep -v \# $nc_rename | \ - sed -e 's/^/s\//' \ - -e 's/\./\\./' \ - -e 's/ / /g' \ - -e 's/[ ]\+/\//' \ - -e s/\$/\\\/g/ >man/edit_man.sed + if test -n "$cf_rename" ; then + $srcdir/man/make_sed.sh $cf_rename >man/edit_man.sed fi - if test $nc_format = yes ; then - nc_subdir='$mandir/cat' + if test $cf_format = yes ; then + cf_subdir='$mandir/cat' else - nc_subdir='$mandir/man' + cf_subdir='$mandir/man' fi -cat >man/edit_man.sh <man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh <\$TMP -NC_EOF +CF_EOF else -cat >>man/edit_man.sh <>man/edit_man.sh <\$TMP -NC_EOF + target="$cf_subdir\$section/\$target" + test \$verb = installing && sed -e "s,@DATADIR@,\$datadir," < \$i | sed -f edit_man.sed >\$TMP +CF_EOF fi -if test $nc_format = yes ; then -cat >>man/edit_man.sh <>man/edit_man.sh <\$TMP.out mv \$TMP.out \$TMP -NC_EOF +CF_EOF +fi fi -case "$nc_form" in +case "$cf_form" in compress) -cat >>man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh </dev/null ) +then + echo "$2 is unchanged" + rm -f $1 +else + echo "creating $2" + rm -f $2 + mv $1 $2 +fi +])dnl +dnl --------------------------------------------------------------------------- dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the dnl misc/tabset install won't work properly. Usually this happens only when dnl using the fallback mkinstalldirs script -AC_DEFUN([NC_PROG_INSTALL], +AC_DEFUN([CF_PROG_INSTALL], [AC_PROG_INSTALL case $INSTALL in /*) ;; *) changequote({{,}})dnl - nc_dir=`echo $INSTALL|sed -e 's%/[^/]*$%%'` - test -z "$nc_dir" && nc_dir=. + cf_dir=`echo $INSTALL|sed -e 's%/[^/]*$%%'` + test -z "$cf_dir" && cf_dir=. changequote([,])dnl - INSTALL=`cd $nc_dir;pwd`/`echo $INSTALL | sed -e 's:^.*/::'` + INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's:^.*/::'` ;; esac ])dnl dnl --------------------------------------------------------------------------- dnl Attempt to determine if we've got one of the flavors of regular-expression dnl code that we can support. -AC_DEFUN([NC_REGEX], +AC_DEFUN([CF_REGEX], [ AC_MSG_CHECKING([for regular-expression headers]) -AC_CACHE_VAL(nc_cv_regex,[ +AC_CACHE_VAL(cf_cv_regex,[ AC_TRY_LINK([#include #include ],[ regex_t *p; int x = regcomp(p, "", 0); int y = regexec(p, "", 0, 0, 0); regfree(p); - ],[nc_cv_regex="regex.h"],[ + ],[cf_cv_regex="regex.h"],[ AC_TRY_LINK([#include ],[ char *p = compile("", "", "", 0); int x = step("", ""); - ],[nc_cv_regex="regexp.h"],[ + ],[cf_cv_regex="regexp.h"],[ + cf_save_LIBS="$LIBS" + LIBS="-lgen $LIBS" AC_TRY_LINK([#include ],[ char *p = compile("", "", ""); int x = step("", ""); - ],[nc_cv_regex="regexpr.h"])])]) + ],[cf_cv_regex="regexpr.h"],[LIBS="$cf_save_LIBS"])])]) ]) -AC_MSG_RESULT($nc_cv_regex) -case $nc_cv_regex in - regex.h) AC_DEFINE(HAVE_REGEX_H) ;; - regexp.h) AC_DEFINE(HAVE_REGEXP_H) ;; - regexpr.h) AC_DEFINE(HAVE_REGEXPR_H) ;; +AC_MSG_RESULT($cf_cv_regex) +case $cf_cv_regex in + regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;; + regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;; + regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;; esac ])dnl dnl --------------------------------------------------------------------------- +dnl This bypasses the normal autoconf process because we're generating an +dnl arbitrary number of NEED_xxxx definitions with the CF_HAVE_FUNCS macro. +dnl Rather than populate an aclocal.h file with all of those definitions, we do +dnl it here. +dnl +dnl Parameters: +dnl $1 = input, which configure has done substitutions upon (will delete) +dnl $2 = target file +dnl $3 = preamble, if any (a 'here' document) +dnl $4 = trailer, if any (a 'here' document) +dnl +AC_DEFUN([CF_SED_CONFIG_H],[ +cf_config_h=conf$$ +rm -f $cf_config_h +## PREAMBLE +ifelse($3,,[ +echo '/* generated by configure-script */' >$cf_config_h +],[cat >$cf_config_h <$cf_config_h + $ac_cv_path_TD_CONFIG $1 |egrep '^#' | sort >>$cf_config_h +else +grep -v '^ -D' $1 >>$cf_config_h +changequote(,)dnl +sed -e '/^ -D/!d' \ + -e '/^# /d' \ + -e 's/ -D/\ +#define /g' \ + -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1 /g' \ + -e 's@\\@@g' \ + $1 | sort >>$cf_config_h +changequote([,])dnl +fi +## TRAILER +ifelse($4,,, +[cat >>$cf_config_h < +#if HAVE_TERMIOS_H +#include +#else +#if HAVE_TERMIO_H +#include +#endif +#endif +#if NEED_PTEM_H +/* This is a workaround for SCO: they neglected to define struct winsize in + * termios.h -- it's only in termio.h and ptem.h + */ +#include +#include +#endif +#if !defined(sun) || !defined(HAVE_TERMIOS_H) +#include +#endif +],[ +#ifdef TIOCGSIZE + struct ttysize win; /* FIXME: what system is this? */ + int y = win.ts_lines; + int x = win.ts_cols; +#else +#ifdef TIOCGWINSZ + struct winsize win; + int y = win.ws_row; + int x = win.ws_col; +#else + no TIOCGSIZE or TIOCGWINSZ +#endif /* TIOCGWINSZ */ +#endif /* TIOCGSIZE */ + ], + [cf_cv_sizechange=yes], + [cf_cv_sizechange=no]) + + CFLAGS="$cf_save_CFLAGS" + if test "$cf_cv_sizechange" = yes ; then + echo "size-change succeeded ($cf_opts)" >&AC_FD_CC + test -n "$cf_opts" && AC_DEFINE_UNQUOTED($cf_opts) + break + fi +done + ]) +AC_MSG_RESULT($cf_cv_sizechange) +test $cf_cv_sizechange != no && AC_DEFINE(HAVE_SIZECHANGE) ])dnl dnl --------------------------------------------------------------------------- dnl Check for datatype 'speed_t', which is normally declared via either dnl sys/types.h or termios.h -AC_DEFUN([NC_SPEED_TYPE], +AC_DEFUN([CF_SPEED_TYPE], [ AC_MSG_CHECKING([for speed_t]) -AC_CACHE_VAL(nc_cv_type_speed_t,[ +AC_CACHE_VAL(cf_cv_type_speed_t,[ AC_TRY_COMPILE([ #include #if HAVE_TERMIOS_H #include #endif], [speed_t x = 0], - [nc_cv_type_speed_t=yes], - [nc_cv_type_speed_t=no]) + [cf_cv_type_speed_t=yes], + [cf_cv_type_speed_t=no]) ]) -AC_MSG_RESULT($nc_cv_type_speed_t) -test $nc_cv_type_speed_t != yes && AC_DEFINE(speed_t,unsigned) +AC_MSG_RESULT($cf_cv_type_speed_t) +test $cf_cv_type_speed_t != yes && AC_DEFINE(speed_t,unsigned) ])dnl 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 $nc_cv_src_modules which we'll -dnl use in NC_LIB_RULES. +dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll +dnl use in CF_LIB_RULES. dnl dnl This uses the configured value to make the lists SRC_SUBDIRS and dnl SUB_MAKEFILES which are used in the makefile-generation scheme. -AC_DEFUN([NC_SRC_MODULES], +AC_DEFUN([CF_SRC_MODULES], [ AC_MSG_CHECKING(for src modules) -TEST_DEPS="${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX}" -TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX}" -nc_cv_src_modules= -for nc_dir in $1 + +# dependencies and linker-arguments for test-programs +TEST_DEPS="${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS" +TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS" + +# dependencies and linker-arguments for utility-programs +PROG_ARGS="$TEST_ARGS" + +cf_cv_src_modules= +for cf_dir in $1 do - if test -f $srcdir/$nc_dir/modules; then - if test -z "$nc_cv_src_modules"; then - nc_cv_src_modules=$nc_dir + if test -f $srcdir/$cf_dir/modules; then + + # We may/may not have tack in the distribution, though the + # makefile is. + if test $cf_dir = tack ; then + if test ! -f $srcdir/${cf_dir}/${cf_dir}.h; then + continue + fi + fi + + if test -z "$cf_cv_src_modules"; then + cf_cv_src_modules=$cf_dir else - nc_cv_src_modules="$nc_cv_src_modules $nc_dir" + cf_cv_src_modules="$cf_cv_src_modules $cf_dir" fi + # Make the ncurses_cfg.h file record the library interface files as # well. These are header files that are the same name as their # directory. Ncurses is the only library that does not follow # that pattern. - if test -f $srcdir/${nc_dir}/${nc_dir}.h; then - NC_UPPERCASE($nc_dir,nc_have_include) - AC_DEFINE_UNQUOTED(HAVE_${nc_have_include}_H) - AC_DEFINE_UNQUOTED(HAVE_LIB${nc_have_include}) - TEST_DEPS="${LIB_PREFIX}${nc_dir}${DFT_DEP_SUFFIX} $TEST_DEPS" - TEST_ARGS="-l${nc_dir}${DFT_ARG_SUFFIX} $TEST_ARGS" + if test $cf_dir = tack ; then + continue + elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then + CF_UPPER(cf_have_include,$cf_dir) + AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H) + AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include}) + TEST_DEPS="${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS" + TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS" fi fi done -AC_MSG_RESULT($nc_cv_src_modules) -TEST_ARGS="-L${LIB_DIR} $TEST_ARGS" +AC_MSG_RESULT($cf_cv_src_modules) +TEST_ARGS="-L${LIB_DIR} -L\$(libdir) $TEST_ARGS" AC_SUBST(TEST_DEPS) AC_SUBST(TEST_ARGS) +PROG_ARGS="-L${LIB_DIR} -L\$(libdir) $PROG_ARGS" +AC_SUBST(PROG_ARGS) + SRC_SUBDIRS="man include" -for nc_dir in $nc_cv_src_modules +for cf_dir in $cf_cv_src_modules do - SRC_SUBDIRS="$SRC_SUBDIRS $nc_dir" + SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir" done SRC_SUBDIRS="$SRC_SUBDIRS misc test" -test $nc_cxx_library != no && SRC_SUBDIRS="$SRC_SUBDIRS c++" +test $cf_cxx_library != no && SRC_SUBDIRS="$SRC_SUBDIRS c++" ADA_SUBDIRS= if test "$ac_cv_prog_gnat_correct" = yes && test -d $srcdir/Ada95; then @@ -1058,162 +1442,323 @@ if test "$ac_cv_prog_gnat_correct" = yes && test -d $srcdir/Ada95; then fi SUB_MAKEFILES= -for nc_dir in $SRC_SUBDIRS +for cf_dir in $SRC_SUBDIRS do - SUB_MAKEFILES="$SUB_MAKEFILES $nc_dir/Makefile" + SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile" done if test -n "$ADA_SUBDIRS"; then - for nc_dir in $ADA_SUBDIRS + for cf_dir in $ADA_SUBDIRS do - SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$nc_dir/Makefile" + SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile" done AC_SUBST(ADA_SUBDIRS) fi ])dnl dnl --------------------------------------------------------------------------- dnl Remove "-g" option from the compiler options -AC_DEFUN([NC_STRIP_G_OPT], +AC_DEFUN([CF_STRIP_G_OPT], [$1=`echo ${$1} | sed -e 's/-g //' -e 's/-g$//'`])dnl dnl --------------------------------------------------------------------------- +dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only +dnl do this if we've found the sigaction function. +dnl +dnl If needed, define SVR4_ACTION. +AC_DEFUN([CF_STRUCT_SIGACTION],[ +if test $ac_cv_func_sigaction = yes; then +AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE) +AC_TRY_COMPILE([ +#include +#include ], + [struct sigaction act], + [sigact_bad=no], + [ +AC_TRY_COMPILE([ +#define _POSIX_SOURCE +#include +#include ], + [struct sigaction act], + [sigact_bad=yes + AC_DEFINE(SVR4_ACTION)], + [sigact_bad=unknown])]) +AC_MSG_RESULT($sigact_bad) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl Some machines require _POSIX_SOURCE to completely define struct termios. +dnl If so, define SVR4_TERMIO +AC_DEFUN([CF_STRUCT_TERMIOS],[ +if test $ac_cv_header_termios_h = yes ; then + case "$CFLAGS" in + *-D_POSIX_SOURCE*) + termios_bad=dunno ;; + *) termios_bad=maybe ;; + esac + if test $termios_bad = maybe ; then + AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE) + AC_TRY_COMPILE([#include ], + [struct termios foo; int x = foo.c_iflag], + termios_bad=no, [ + AC_TRY_COMPILE([ +#define _POSIX_SOURCE +#include ], + [struct termios foo; int x = foo.c_iflag], + termios_bad=unknown, + termios_bad=yes AC_DEFINE(SVR4_TERMIO)) + ]) + AC_MSG_RESULT($termios_bad) + fi +fi +])dnl +dnl --------------------------------------------------------------------------- dnl Shorthand macro for substituting things that the user may override dnl with an environment variable. dnl dnl $1 = long/descriptive name dnl $2 = environment variable dnl $3 = default value -AC_DEFUN([NC_SUBST], -[AC_CACHE_VAL(nc_cv_subst_$2,[ +AC_DEFUN([CF_SUBST], +[AC_CACHE_VAL(cf_cv_subst_$2,[ AC_MSG_CHECKING(for $1 (symbol $2)) test -z "[$]$2" && $2=$3 AC_MSG_RESULT([$]$2) AC_SUBST($2) -nc_cv_subst_$2=[$]$2]) -$2=${nc_cv_subst_$2} +cf_cv_subst_$2=[$]$2]) +$2=${cf_cv_subst_$2} ])dnl dnl --------------------------------------------------------------------------- -dnl Check for declarion of sys_errlist in one of stdio.h and errno.h. -dnl Declaration of sys_errlist on BSD4.4 interferes with our declaration. -dnl Reported by Keith Bostic. -AC_DEFUN([NC_SYS_ERRLIST], -[ -AC_MSG_CHECKING([declaration of sys_errlist]) -AC_CACHE_VAL(nc_cv_dcl_sys_errlist,[ - AC_TRY_COMPILE([ -#include -#include -#include ], - [ char *c = (char *) *sys_errlist; ], - [nc_cv_dcl_sys_errlist=yes], - [nc_cv_dcl_sys_errlist=no]) - ]) -AC_MSG_RESULT($nc_cv_dcl_sys_errlist) -test $nc_cv_dcl_sys_errlist = yes && AC_DEFINE(HAVE_EXTERN_SYS_ERRLIST) -])dnl -dnl --------------------------------------------------------------------------- -dnl Derive the system-type (our main clue to the method of building shared -dnl libraries). -AC_DEFUN([NC_SYSTYPE], +dnl Get the version-number for use in shared-library naming, etc. +AC_DEFUN([CF_SUBST_NCURSES_VERSION], [ -AC_CACHE_VAL(nc_cv_systype,[ changequote(,)dnl -nc_cv_systype="`(uname -s || hostname || echo unknown) 2>/dev/null |sed -e s'/[:\/.-]/_/'g | sed 1q`" +NCURSES_MAJOR="`egrep '^NCURSES_MAJOR[ ]*=' $srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" +NCURSES_MINOR="`egrep '^NCURSES_MINOR[ ]*=' $srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" +NCURSES_PATCH="`egrep '^NCURSES_PATCH[ ]*=' $srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" changequote([,])dnl -if test -z "$nc_cv_systype"; then nc_cv_systype=unknown;fi -]) -AC_MSG_RESULT(System type is $nc_cv_systype) +cf_cv_abi_version=${NCURSES_MAJOR} +cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR} +dnl Show the computed version, for logging +AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version (`date`)) +dnl We need these values in the generated headers +AC_SUBST(NCURSES_MAJOR) +AC_SUBST(NCURSES_MINOR) +AC_SUBST(NCURSES_PATCH) +dnl We need these values in the generated makefiles +AC_SUBST(cf_cv_rel_version) +AC_SUBST(cf_cv_abi_version) +AC_SUBST(cf_cv_builtin_bool) +AC_SUBST(cf_cv_type_of_bool) ])dnl dnl --------------------------------------------------------------------------- -dnl On some systems ioctl(fd, TIOCGWINSZ, &size) will always return {0,0} until -dnl ioctl(fd, TIOCSWINSZ, &size) is called to explicitly set the size of the -dnl screen. -dnl -dnl Attempt to determine if we're on such a system by running a test-program. -dnl This won't work, of course, if the configure script is run in batch mode, -dnl since we've got to have access to the terminal. -dnl -dnl 1996/4/26 - Converted this into a simple test for able-to-compile, since -dnl we're reminded that _nc_get_screensize() does the same functional test. -AC_DEFUN([NC_TIOCGWINSZ], +dnl Check if we can include with ; this breaks on +dnl older SCO configurations. +AC_DEFUN([CF_SYS_TIME_SELECT], [ -AC_MSG_CHECKING([for working TIOCGWINSZ]) -AC_CACHE_VAL(nc_cv_use_tiocgwinsz,[ - AC_TRY_RUN([ -#if HAVE_TERMIOS_H -#include +AC_MSG_CHECKING(if sys/time.h works with sys/select.h) +AC_CACHE_VAL(cf_cv_sys_time_select,[ +AC_TRY_COMPILE([ +#include +#if HAVE_SYS_TIME_H +#include #endif -#if SYSTEM_LOOKS_LIKE_SCO -/* they neglected to define struct winsize in termios.h -- it's only - in termio.h */ -#include -#include +#if HAVE_SYS_SELECT_H +#include #endif -#if !defined(sun) || !defined(HAVE_TERMIOS_H) -#include +],[],[cf_cv_sys_time_select=yes], + [cf_cv_sys_time_select=no]) + ]) +AC_MSG_RESULT($cf_cv_sys_time_select) +test $cf_cv_sys_time_select = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT) +])dnl +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 +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([ +#if USE_WIDEC_SUPPORT +#include /* we want wchar_t */ +#define WANT_BITS 39 +#else +#define WANT_BITS 31 #endif +#include int main() { - static struct winsize size; - int fd; - for (fd = 0; fd <= 2; fd++) { /* try in/out/err in case redirected */ - if (ioctl(0, TIOCGWINSZ, &size) == 0 - && size.ws_row > 0 - && size.ws_col > 0) - exit(0); + FILE *fp = fopen("cf_test.out", "w"); + if (fp != 0) { + char *result = "long"; +#if 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; + for (n = 0; n < WANT_BITS; n++) { + unsigned int y = (x >> n); + if (y != 1 || x == 0) { + x = 0; + break; + } + } + /* + * If x is nonzero, an int is big enough for the bits + * that we want. + */ + result = (x != 0) ? "int" : "long"; + } + fputs(result, fp); + fclose(fp); } - exit(0); /* in either case, it compiles & links ... */ + exit(0); } ], - [nc_cv_use_tiocgwinsz=yes], - [nc_cv_use_tiocgwinsz=no], - [nc_cv_use_tiocgwinsz=unknown]) + [cf_cv_typeof_chtype=`cat cf_test.out`], + [cf_cv_typeof_chtype=long], + [cf_cv_typeof_chtype=long]) + rm -f cf_test.out ]) -AC_MSG_RESULT($nc_cv_use_tiocgwinsz) -test $nc_cv_use_tiocgwinsz != yes && AC_DEFINE(BROKEN_TIOCGWINSZ) +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 -AC_DEFUN([NC_TYPE_SIGACTION], +AC_DEFUN([CF_TYPE_SIGACTION], [ AC_MSG_CHECKING([for type sigaction_t]) -AC_CACHE_VAL(nc_cv_type_sigaction,[ +AC_CACHE_VAL(cf_cv_type_sigaction,[ AC_TRY_COMPILE([ #include ], [sigaction_t x], - [nc_cv_type_sigaction=yes], - [nc_cv_type_sigaction=no]) + [cf_cv_type_sigaction=yes], + [cf_cv_type_sigaction=no])]) +AC_MSG_RESULT($cf_cv_type_sigaction) +test $cf_cv_type_sigaction = yes && AC_DEFINE(HAVE_TYPE_SIGACTION) +])dnl +dnl --------------------------------------------------------------------------- +dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers +dnl won't, but they're still there. +AC_DEFUN([CF_UNSIGNED_LITERALS], +[ +AC_MSG_CHECKING([if unsigned literals are legal]) +AC_CACHE_VAL(cf_cv_unsigned_literals,[ + AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1], + [cf_cv_unsigned_literals=yes], + [cf_cv_unsigned_literals=no]) ]) -AC_MSG_RESULT($nc_cv_type_sigaction) -test $nc_cv_type_sigaction = yes && AC_DEFINE(HAVE_TYPE_SIGACTION) -]) +AC_MSG_RESULT($cf_cv_unsigned_literals) +])dnl dnl --------------------------------------------------------------------------- -dnl Make an uppercase version of a given name -AC_DEFUN([NC_UPPERCASE], +dnl Make an uppercase version of a variable +dnl $1=uppercase($2) +AC_DEFUN([CF_UPPER], [ changequote(,)dnl -$2=`echo $1 |tr '[a-z]' '[A-Z]'` +$1=`echo $2 | tr '[a-z]' '[A-Z]'` changequote([,])dnl ])dnl dnl --------------------------------------------------------------------------- -dnl Get the version-number for use in shared-library naming, etc. -AC_DEFUN([NC_VERSION], +dnl Compute the shift-mask that we'll use for wide-character indices. We use +dnl all but the index portion of chtype for storing attributes. +AC_DEFUN([CF_WIDEC_SHIFT], [ -changequote(,)dnl -NCURSES_MAJOR="`egrep '^NCURSES_MAJOR[ ]*=' $srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" -NCURSES_MINOR="`egrep '^NCURSES_MINOR[ ]*=' $srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" -NCURSES_PATCH="`egrep '^NCURSES_PATCH[ ]*=' $srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" -changequote([,])dnl -nc_cv_abi_version=${NCURSES_MAJOR} -nc_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR} -dnl Show the computed version, for logging -AC_MSG_RESULT(Configuring NCURSES $nc_cv_rel_version ABI $nc_cv_abi_version (`date`)) -dnl We need these values in the generated headers -AC_SUBST(NCURSES_MAJOR) -AC_SUBST(NCURSES_MINOR) -AC_SUBST(NCURSES_PATCH) -dnl We need these values in the generated makefiles -AC_SUBST(nc_cv_rel_version) -AC_SUBST(nc_cv_abi_version) -AC_SUBST(nc_cv_builtin_bool) -AC_SUBST(nc_cv_type_of_bool) +AC_REQUIRE([CF_TYPEOF_CHTYPE]) +AC_MSG_CHECKING([for number of bits in chtype]) +AC_CACHE_VAL(cf_cv_shift_limit,[ + AC_TRY_RUN([ +#include +int main() +{ + FILE *fp = fopen("cf_test.out", "w"); + if (fp != 0) { + int n; + unsigned TYPEOF_CHTYPE x = 1L; + for (n = 0; ; n++) { + unsigned long y = (x >> n); + if (y != 1 || x == 0) + break; + x <<= 1; + } + fprintf(fp, "%d", n); + fclose(fp); + } + exit(0); +} + ], + [cf_cv_shift_limit=`cat cf_test.out`], + [cf_cv_shift_limit=32], + [cf_cv_shift_limit=32]) + rm -f cf_test.out + ]) +AC_MSG_RESULT($cf_cv_shift_limit) +AC_SUBST(cf_cv_shift_limit) + +AC_MSG_CHECKING([for width of character-index]) +AC_CACHE_VAL(cf_cv_widec_shift,[ +if test ".$with_widec" = ".yes" ; then + cf_attrs_width=39 + if ( expr $cf_cv_shift_limit \> $cf_attrs_width >/dev/null ) + then + cf_cv_widec_shift=`expr 16 + $cf_cv_shift_limit - $cf_attrs_width` + else + cf_cv_widec_shift=16 + fi +else + cf_cv_widec_shift=8 +fi +]) +AC_MSG_RESULT($cf_cv_widec_shift) +AC_SUBST(cf_cv_widec_shift) +])dnl +dnl --------------------------------------------------------------------------- +dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just +dnl defaulting to yes/no. +dnl +dnl $1 = option name +dnl $2 = help-text +dnl $3 = environment variable to set +dnl $4 = default value, shown in the help-message, must be a constant +dnl $5 = default value, if it's an expression & cannot be in the help-message +dnl +AC_DEFUN([CF_WITH_PATH], +[AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),, +ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl +case ".$withval" in #(vi +./*) #(vi + ;; +.\[$]{*prefix}*) #(vi + eval withval="$withval" + case ".$withval" in #(vi + .NONE/*) + withval=`echo $withval | sed -e s@NONE@$ac_default_prefix@` + ;; + esac + ;; #(vi +.NONE/*) + withval=`echo $withval | sed -e s@NONE@$ac_default_prefix@` + ;; +*) + AC_ERROR(expected a pathname for $1) + ;; +esac +eval $3="$withval" +AC_SUBST($3)dnl ])dnl diff --git a/announce.html b/announce.html index 27026006..611888a5 100644 --- a/announce.html +++ b/announce.html @@ -1,68 +1,62 @@ -Announcing ncurses 4.1 - +Announcing ncurses 4.2 + -

    Announcing ncurses 4.1

    +

    Announcing ncurses 4.2

    The ncurses (new curses) library is a freeware emulation of System V Release 4.0 curses. It uses terminfo format, supports pads and color and multiple highlights and forms characters and function-key mapping, -and has all the other SYSV-curses enhancements over BSD curses.

    +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 -ncurses.

    +ncurses.

    The ncurses code was developed under Linux. It should port easily to -any ANSI/POSIX-conforming UNIX. It has even been ported to OS/2 Warp!

    +any ANSI/POSIX-conforming UNIX. It has even been ported to OS/2 Warp!

    The distribution includes the library and support utilities, including a terminfo compiler tic(1), a decompiler infocmp(1), clear(1), tput(1), tset(1), and a termcap conversion tool captoinfo(1). Full manual pages are provided for -the library and tools.

    +the library and tools.

    -The ncurses distribution is available via anonymous FTP at: +The ncurses distribution is available via anonymous FTP at +the GNU distribution site +ftp://prep.ai.mit.edu/pub/gnu. +It is also available at ftp://ftp.clark.net/pub/dickey/ncurses. -and -ftp://ftp.netcom.com/pub/zm/zmbenhal/ncurses. -It is also carried on the GNU distribution site at ftp://prep.ai.mit.edu/pub/gnu.

    Features of ncurses

    -The ncurses package is fully compatible with SVr4 curses:

    +The ncurses package is fully compatible with SVr4 (System V Release 4) curses:

      -
    • All 257 of the SVr4 calls have been implemented (and are documented).

      - +

    • All 257 of the SVr4 calls have been implemented (and are documented).
    • Full support for SVr4 curses features including keyboard mapping, color, forms-drawing with ACS characters, and automatic recognition of keypad -and function keys.

      - -

    • An emulation of the System V Release 4 panels library, supporting -a stack of windows with backing store, is included.

      - -

    • An emulation of the System V Release 4 menus library, supporting -a uniform but flexible interface for menu programming, is included.

      - -

    • An emulation of the System V Release 4 form library, supporting -data collection through on-screen forms, is included.

      - +and function keys. +

    • An emulation of the SVr4 panels library, supporting +a stack of windows with backing store, is included. +
    • An emulation of the SVr4 menus library, supporting +a uniform but flexible interface for menu programming, is included. +
    • An emulation of the SVr4 form library, supporting +data collection through on-screen forms, is included.
    • Binary terminfo entries generated by the ncurses tic(1) implementation -are bit-for-bit-compatible with the entry format SVr4 curses uses.

      - +are bit-for-bit-compatible with the entry format SVr4 curses uses.

    • The utilities have options to allow you to filter terminfo entries for use with less capable curses/terminfo -versions such as the HP/UX and AIX ports.
    +versions such as the HP/UX and AIX ports. -The ncurses package also has many useful extensions over SVr4:

    +The ncurses package also has many useful extensions over SVr4:

    • The API is 8-bit clean and base-level conformant with the X/OPEN curses @@ -70,29 +64,33 @@ specification, XSI Curses (that is, it implements all BASE level features, but not all EXTENDED features). Most EXTENDED-level features not directly concerned with wide-character support are implemented, including many function calls not supported under SVr4 curses (but portability of all -calls is documented so you can use the SVr4 subset only).

      - +calls is documented so you can use the SVr4 subset only).

    • Unlike SVr4 curses, ncurses can write to the rightmost-bottommost corner -of the screen if your terminal has an insert-character capability.

      - +of the screen if your terminal has an insert-character capability.

    • (PC-clone boxes only) Support for access to the IBM PC ROM characters -0-32 through the highlight A_ALTCHARSET.

      - -

    • Support for mouse event reporting under xterm.

      - +0-32 through the highlight A_ALTCHARSET. +

    • Ada95 and C++ bindings. +
    • Support for mouse event reporting under xterm. +
    • Extended mouse support via Alessandro Rubini's gpm package.
    • The function wresize() allows you to resize windows, preserving their data. - +
    • The function use_default_colors() allows you to +use the terminal's default colors for the default color pair, +achieving the effect of transparent colors. +
    • The functions keyok() +and define_key() allow +you to better control the use of function keys, +e.g., disabling the ncurses KEY_MOUSE, +or by defining more than one control sequence to map to a given key code. +
    • Support for 16-color terminals, such as aixterm and XFree86 xterm.
    • Better cursor-movement optimization. The package now features a cursor-local-movement computation more efficient than either BSD's -or System V's.

      - +or System V's.

    • Super hardware scrolling support. The screen-update code incorporates a novel, simple, and cheap algorithm that enables it to make optimal use of hardware scrolling, line-insertion, and line-deletion for screen-line movements. This algorithm is more powerful than -the 4.4BSD curses quickch() routine.

      - +the 4.4BSD curses quickch() routine.

    • Real support for terminals with the magic-cookie glitch. The screen-update code will refrain from drawing a highlight if the magic- cookie unattributed spaces required just before the beginning and @@ -100,51 +98,40 @@ after the end would step on a non-space character. It will automatically shift highlight boundaries when doing so would make it possible to draw the highlight without changing the visual appearance of the screen. -
    • It is possible to generate the library with a list of pre-loaded fallback entries linked to it so that it can serve those terminal types even when no terminfo tree or termcap file is accessible (this may be useful -for support of screen-oriented programs that must run in single-user mode).

      - +for support of screen-oriented programs that must run in single-user mode).

    • The tic(1)/captoinfo utility provided with ncurses has the ability to translate many termcaps from the XENIX, IBM and -AT&T extension sets.

      - -

    • A BSD-like tset(1) utility is provided.

      - +AT&T extension sets. +

    • A BSD-like tset(1) utility is provided.
    • The ncurses library and utilities will automatically read terminfo entries from $HOME/.terminfo if it exists, and compile to that directory if it exists and the user has no write access to the system directory. This feature makes it easier for users to have personal terminfo entries -without giving up access to the system terminfo directory.

      - +without giving up access to the system terminfo directory.

    • You may specify a path of directories to search for compiled descriptions with the environment variable TERMINFO_DIRS (this -generalizes the feature provided by TERMINFO under stock System V.)

      - +generalizes the feature provided by TERMINFO under stock System V.)

    • In terminfo source files, use capabilities may refer not just to other entries in the same source file (as in System V) but also to compiled entries in either the system terminfo directory or the user's -$HOME/.terminfo directory.

      - +$HOME/.terminfo directory.

    • A script (capconvert) is provided to help BSD users transition from termcap to terminfo. It gathers the information in a TERMCAP environment variable and/or a ~/.termcap local entries file -and converts it to an equivalent local terminfo tree under $HOME/.terminfo.

      - +and converts it to an equivalent local terminfo tree under $HOME/.terminfo.

    • Automatic fallback to the /etc/termcap file can be compiled in when it is not possible to build a terminfo tree. This feature is neither fast nor cheap, you don't want to use it unless you have to, -but it's there.

      - +but it's there.

    • The table-of-entries utility toe makes it easy for users to -see exactly what terminal types are available on the system.

      - +see exactly what terminal types are available on the system.

    • The library meets the XSI requirement that every macro entry point have a corresponding function which may be linked (and will be prototype-checked) if the macro definition is disabled with -#undef.

      - +#undef.

    • An HTML "Introduction to Programming with NCURSES" document provides a narrative introduction to the curses programming interface.
    @@ -155,10 +142,10 @@ Numerous bugs present in earlier versions have been fixed; the library is far more reliable than it used to be. Bounds checking in many `dangerous' entry points has been improved. The code is now type-safe according to gcc -Wall. The library has been checked for malloc leaks and -arena corruption by the Purify memory-allocation tester.

    +arena corruption by the Purify memory-allocation tester.

    The ncurses code has been tested with a wide variety of applications -including:

    +including:

    ded
    directory-editor @@ -168,6 +155,10 @@ including:

    for similar applications on Linux.

    lynx-2.7
    the character-screen WWW browser +
    Midnight Commander 4.1 +
    file manager +
    mutt 0.88 +
    mail utility
    ncftp 2.0
    file-transfer utility
    nvi @@ -182,7 +173,7 @@ as well as some that use ncurses for the terminfo support alone:
    minicom-1.75
    terminal emulator
    tin-unoff -
    tin (unofficial) newsreader, supporting color, MIME +
    tin 1.4 newsreader, supporting color, MIME ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff.
    vile
    vi-like-emacs @@ -195,52 +186,45 @@ a few games).

    Who's Who and What's What

    -The original maintainer of ncurses is Zeyd Ben-Halim. Unfortunately, -he can only work on the package part time. As a result, since 1.8.1, -much of the enhancement work and documentation has been done -by Eric S. Raymond. -The current primary maintainers are +The original developers of ncurses are Zeyd Ben-Halim and +Eric S. Raymond. +Ongoing work is being done by Thomas Dickey and -Juergen Pfeifer. +Jürgen Pfeifer. +Florian La Roche +acts as the maintainer for the Free Software Foundation, which holds the +copyright on ncurses. +Contact the current maintainers at +bug-ncurses@gnu.org.

    -There is an ncurses mailing list. It is a majordomo list; to join, write -to ncurses-request@mailgate.bsdi.com with a message containing the line: +To join the ncurses mailing list, please write email to +bug-ncurses-request@gnu.org containing the line:

                  subscribe <name>@<host.domain>
     
    This list is open to anyone interested in helping with the development and -testing of this package.

    +testing of this package.

    Beta versions of ncurses and patches to the current release are made available at ftp://ftp.clark.net/pub/dickey/ncurses.

    Future Plans

      -
    • Extended mouse support via Alessandro Rubini's gpm package. -
    • Extended-level XPG4 conformance, with internationalization support.

      +

    • Extended-level XPG4 conformance, with internationalization support.
    • Ports to more systems, including DOS and Windows.
    We need people to help with these projects. If you are interested in working on them, please join the ncurses list. -

    The terminfo/termcap Database

    +

    Other Related Resources

    -The distribution includes and uses a copy of the terminfo-format +The distribution includes and uses a version of the terminfo-format terminal description file maintained by Eric Raymond. - -You can download either the -termcap -or -terminfo -versions of the terminal-type -database from Eric's ncurses page, -http://www.ccil.org/~esr/ncurses.html.

    - -

    Other Related Resources

    +http://earthspace.net/~esr/terminfo.

    You can find lots of information on terminal-related topics not covered in the terminfo file at diff --git a/announce.html.in b/announce.html.in index a4c643b1..256e95ba 100644 --- a/announce.html.in +++ b/announce.html.in @@ -1,11 +1,11 @@ Announcing ncurses @VERSION@ - + @@ -14,55 +14,49 @@ The ncurses (new curses) library is a freeware emulation of System V Release 4.0 curses. It uses terminfo format, supports pads and color and multiple highlights and forms characters and function-key mapping, -and has all the other SYSV-curses enhancements over BSD curses.

    +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 -ncurses.

    +ncurses.

    The ncurses code was developed under Linux. It should port easily to -any ANSI/POSIX-conforming UNIX. It has even been ported to OS/2 Warp!

    +any ANSI/POSIX-conforming UNIX. It has even been ported to OS/2 Warp!

    The distribution includes the library and support utilities, including a terminfo compiler tic(1), a decompiler infocmp(1), clear(1), tput(1), tset(1), and a termcap conversion tool captoinfo(1). Full manual pages are provided for -the library and tools.

    +the library and tools.

    -The ncurses distribution is available via anonymous FTP at: +The ncurses distribution is available via anonymous FTP at +the GNU distribution site +ftp://prep.ai.mit.edu/pub/gnu. +It is also available at ftp://ftp.clark.net/pub/dickey/ncurses. -and -ftp://ftp.netcom.com/pub/zm/zmbenhal/ncurses. -It is also carried on the GNU distribution site at ftp://prep.ai.mit.edu/pub/gnu.

    Features of ncurses

    -The ncurses package is fully compatible with SVr4 curses:

    +The ncurses package is fully compatible with SVr4 (System V Release 4) curses:

      -
    • All 257 of the SVr4 calls have been implemented (and are documented).

      - +

    • All 257 of the SVr4 calls have been implemented (and are documented).
    • Full support for SVr4 curses features including keyboard mapping, color, forms-drawing with ACS characters, and automatic recognition of keypad -and function keys.

      - -

    • An emulation of the System V Release 4 panels library, supporting -a stack of windows with backing store, is included.

      - -

    • An emulation of the System V Release 4 menus library, supporting -a uniform but flexible interface for menu programming, is included.

      - -

    • An emulation of the System V Release 4 form library, supporting -data collection through on-screen forms, is included.

      - +and function keys. +

    • An emulation of the SVr4 panels library, supporting +a stack of windows with backing store, is included. +
    • An emulation of the SVr4 menus library, supporting +a uniform but flexible interface for menu programming, is included. +
    • An emulation of the SVr4 form library, supporting +data collection through on-screen forms, is included.
    • Binary terminfo entries generated by the ncurses tic(1) implementation -are bit-for-bit-compatible with the entry format SVr4 curses uses.

      - +are bit-for-bit-compatible with the entry format SVr4 curses uses.

    • The utilities have options to allow you to filter terminfo entries for use with less capable curses/terminfo -versions such as the HP/UX and AIX ports.
    +versions such as the HP/UX and AIX ports. -The ncurses package also has many useful extensions over SVr4:

    +The ncurses package also has many useful extensions over SVr4:

    • The API is 8-bit clean and base-level conformant with the X/OPEN curses @@ -70,29 +64,33 @@ specification, XSI Curses (that is, it implements all BASE level features, but not all EXTENDED features). Most EXTENDED-level features not directly concerned with wide-character support are implemented, including many function calls not supported under SVr4 curses (but portability of all -calls is documented so you can use the SVr4 subset only).

      - +calls is documented so you can use the SVr4 subset only).

    • Unlike SVr4 curses, ncurses can write to the rightmost-bottommost corner -of the screen if your terminal has an insert-character capability.

      - +of the screen if your terminal has an insert-character capability.

    • (PC-clone boxes only) Support for access to the IBM PC ROM characters -0-32 through the highlight A_ALTCHARSET.

      - -

    • Support for mouse event reporting under xterm.

      - +0-32 through the highlight A_ALTCHARSET. +

    • Ada95 and C++ bindings. +
    • Support for mouse event reporting under xterm. +
    • Extended mouse support via Alessandro Rubini's gpm package.
    • The function wresize() allows you to resize windows, preserving their data. - +
    • The function use_default_colors() allows you to +use the terminal's default colors for the default color pair, +achieving the effect of transparent colors. +
    • The functions keyok() +and define_key() allow +you to better control the use of function keys, +e.g., disabling the ncurses KEY_MOUSE, +or by defining more than one control sequence to map to a given key code. +
    • Support for 16-color terminals, such as aixterm and XFree86 xterm.
    • Better cursor-movement optimization. The package now features a cursor-local-movement computation more efficient than either BSD's -or System V's.

      - +or System V's.

    • Super hardware scrolling support. The screen-update code incorporates a novel, simple, and cheap algorithm that enables it to make optimal use of hardware scrolling, line-insertion, and line-deletion for screen-line movements. This algorithm is more powerful than -the 4.4BSD curses quickch() routine.

      - +the 4.4BSD curses quickch() routine.

    • Real support for terminals with the magic-cookie glitch. The screen-update code will refrain from drawing a highlight if the magic- cookie unattributed spaces required just before the beginning and @@ -100,51 +98,40 @@ after the end would step on a non-space character. It will automatically shift highlight boundaries when doing so would make it possible to draw the highlight without changing the visual appearance of the screen. -
    • It is possible to generate the library with a list of pre-loaded fallback entries linked to it so that it can serve those terminal types even when no terminfo tree or termcap file is accessible (this may be useful -for support of screen-oriented programs that must run in single-user mode).

      - +for support of screen-oriented programs that must run in single-user mode).

    • The tic(1)/captoinfo utility provided with ncurses has the ability to translate many termcaps from the XENIX, IBM and -AT&T extension sets.

      - -

    • A BSD-like tset(1) utility is provided.

      - +AT&T extension sets. +

    • A BSD-like tset(1) utility is provided.
    • The ncurses library and utilities will automatically read terminfo entries from $HOME/.terminfo if it exists, and compile to that directory if it exists and the user has no write access to the system directory. This feature makes it easier for users to have personal terminfo entries -without giving up access to the system terminfo directory.

      - +without giving up access to the system terminfo directory.

    • You may specify a path of directories to search for compiled descriptions with the environment variable TERMINFO_DIRS (this -generalizes the feature provided by TERMINFO under stock System V.)

      - +generalizes the feature provided by TERMINFO under stock System V.)

    • In terminfo source files, use capabilities may refer not just to other entries in the same source file (as in System V) but also to compiled entries in either the system terminfo directory or the user's -$HOME/.terminfo directory.

      - +$HOME/.terminfo directory.

    • A script (capconvert) is provided to help BSD users transition from termcap to terminfo. It gathers the information in a TERMCAP environment variable and/or a ~/.termcap local entries file -and converts it to an equivalent local terminfo tree under $HOME/.terminfo.

      - +and converts it to an equivalent local terminfo tree under $HOME/.terminfo.

    • Automatic fallback to the /etc/termcap file can be compiled in when it is not possible to build a terminfo tree. This feature is neither fast nor cheap, you don't want to use it unless you have to, -but it's there.

      - +but it's there.

    • The table-of-entries utility toe makes it easy for users to -see exactly what terminal types are available on the system.

      - +see exactly what terminal types are available on the system.

    • The library meets the XSI requirement that every macro entry point have a corresponding function which may be linked (and will be prototype-checked) if the macro definition is disabled with -#undef.

      - +#undef.

    • An HTML "Introduction to Programming with NCURSES" document provides a narrative introduction to the curses programming interface.
    @@ -155,10 +142,10 @@ Numerous bugs present in earlier versions have been fixed; the library is far more reliable than it used to be. Bounds checking in many `dangerous' entry points has been improved. The code is now type-safe according to gcc -Wall. The library has been checked for malloc leaks and -arena corruption by the Purify memory-allocation tester.

    +arena corruption by the Purify memory-allocation tester.

    The ncurses code has been tested with a wide variety of applications -including:

    +including:

    ded
    directory-editor @@ -168,6 +155,10 @@ including:

    for similar applications on Linux.

    lynx-2.7
    the character-screen WWW browser +
    Midnight Commander 4.1 +
    file manager +
    mutt 0.88 +
    mail utility
    ncftp 2.0
    file-transfer utility
    nvi @@ -182,7 +173,7 @@ as well as some that use ncurses for the terminfo support alone:
    minicom-1.75
    terminal emulator
    tin-unoff -
    tin (unofficial) newsreader, supporting color, MIME +
    tin 1.4 newsreader, supporting color, MIME ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff.
    vile
    vi-like-emacs @@ -195,52 +186,45 @@ a few games).

    Who's Who and What's What

    -The original maintainer of ncurses is Zeyd Ben-Halim. Unfortunately, -he can only work on the package part time. As a result, since 1.8.1, -much of the enhancement work and documentation has been done -by Eric S. Raymond. -The current primary maintainers are +The original developers of ncurses are Zeyd Ben-Halim and +Eric S. Raymond. +Ongoing work is being done by Thomas Dickey and -Juergen Pfeifer. +Jürgen Pfeifer. +Florian La Roche +acts as the maintainer for the Free Software Foundation, which holds the +copyright on ncurses. +Contact the current maintainers at +bug-ncurses@gnu.org.

    -There is an ncurses mailing list. It is a majordomo list; to join, write -to ncurses-request@mailgate.bsdi.com with a message containing the line: +To join the ncurses mailing list, please write email to +bug-ncurses-request@gnu.org containing the line:

                  subscribe <name>@<host.domain>
     
    This list is open to anyone interested in helping with the development and -testing of this package.

    +testing of this package.

    Beta versions of ncurses and patches to the current release are made available at ftp://ftp.clark.net/pub/dickey/ncurses.

    Future Plans

      -
    • Extended mouse support via Alessandro Rubini's gpm package. -
    • Extended-level XPG4 conformance, with internationalization support.

      +

    • Extended-level XPG4 conformance, with internationalization support.
    • Ports to more systems, including DOS and Windows.
    We need people to help with these projects. If you are interested in working on them, please join the ncurses list. -

    The terminfo/termcap Database

    +

    Other Related Resources

    -The distribution includes and uses a copy of the terminfo-format +The distribution includes and uses a version of the terminfo-format terminal description file maintained by Eric Raymond. - -You can download either the -termcap -or -terminfo -versions of the terminal-type -database from Eric's ncurses page, -http://www.ccil.org/~esr/ncurses.html.

    - -

    Other Related Resources

    +http://earthspace.net/~esr/terminfo.

    You can find lots of information on terminal-related topics not covered in the terminfo file at diff --git a/c++/Makefile.in b/c++/Makefile.in index 6be83aeb..5b3c1beb 100644 --- a/c++/Makefile.in +++ b/c++/Makefile.in @@ -1,23 +1,34 @@ -# $Id: Makefile.in,v 1.20 1997/05/04 21:15:38 tom Exp $ -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: Makefile.in,v 1.42 1998/02/19 16:54:54 florian Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# # Simple makefile for c++ window class demo # turn off _all_ suffix rules; we'll generate our own @@ -26,63 +37,148 @@ SHELL = /bin/sh MODEL = ../@DFT_OBJ_SUBDIR@ +INSTALL_PREFIX = @INSTALL_PREFIX@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ libdir = @libdir@ includedir = @includedir@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +AR = @AR@ +AR_OPTS = @AR_OPTS@ +RANLIB = @RANLIB@ + CXX = @CXX@ CXXFLAGS = @CXXFLAGS@ CXXLIBS = @CXXLIBS@ INCDIR = ../include -CPPFLAGS = @CPPFLAGS@ -I$(INCDIR) -I$(srcdir)/../c++ -DHAVE_CONFIG_H +CPPFLAGS = -I../c++ -I$(INCDIR) -I$(srcdir) -DHAVE_CONFIG_H @CPPFLAGS@ CCFLAGS = $(CPPFLAGS) $(CXXFLAGS) CFLAGS_NORMAL = $(CCFLAGS) CFLAGS_DEBUG = $(CCFLAGS) @CXX_G_OPT@ -DTRACE CFLAGS_PROFILE = $(CCFLAGS) -pg -CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ +CFLAGS_SHARED = $(CCFLAGS) # @CC_SHARED_OPTS@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) +REL_VERSION = @cf_cv_rel_version@ +ABI_VERSION = @cf_cv_abi_version@ + LINK = $(CXX) -LDFLAGS = -L../lib \ - -lmenu@DFT_ARG_SUFFIX@ \ - -lpanel@DFT_ARG_SUFFIX@ \ - -lncurses@DFT_ARG_SUFFIX@ \ - @LDFLAGS@ \ + +LIBROOT = ncurses++ +LIBNAME = ../lib/lib$(LIBROOT).a + +LDFLAGS = @EXTRA_LDFLAGS@ -L../lib -L$(libdir) \ + -l$(LIBROOT) \ + @TEST_ARGS@ @LDFLAGS@ \ @LD_MODEL@ @LIBS@ @EXTRA_LIBS@ @LOCAL_LDFLAGS@ $(CXXLIBS) -all: demo +LDFLAGS_NORMAL = $(LDFLAGS) +LDFLAGS_DEBUG = $(LDFLAGS) @CC_G_OPT@ +LDFLAGS_PROFILE = $(LDFLAGS) -pg +LDFLAGS_SHARED = $(LDFLAGS) @CC_SHARED_OPTS@ # @LD_SHARED_OPTS@ + +LDFLAGS_DEFAULT = $(LDFLAGS_@DFT_UPR_MODEL@) + +AUTO_SRC = \ + etip.h -OBJS_DEMO = \ +all: $(AUTO_SRC) $(LIBNAME) demo + +sources : $(AUTO_SRC) + +# 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. +LIB_OBJS = \ + $(MODEL)/cursesf.o \ $(MODEL)/cursesm.o \ $(MODEL)/cursesw.o \ $(MODEL)/cursesp.o \ - $(MODEL)/demo.o + $(MODEL)/cursslk.o \ + $(MODEL)/cursesapp.o \ + $(MODEL)/cursesmain.o + +$(LIBNAME) : $(LIB_OBJS) + $(AR) $(AR_OPTS) $@ $? + $(RANLIB) $@ + +OBJS_DEMO = $(MODEL)/demo.o + +$(MODEL)/demo.o : $(srcdir)/demo.cc \ + $(cursesf_h) $(cursesm_h) $(cursesapp_h) demo: $(OBJS_DEMO) \ - ../lib/libmenu@DFT_DEP_SUFFIX@ \ - ../lib/libpanel@DFT_DEP_SUFFIX@ \ - ../lib/libncurses@DFT_DEP_SUFFIX@ - @ECHO_LINK@ $(LINK) -o $@ $(OBJS_DEMO) $(LDFLAGS) + $(LIBNAME) \ + @TEST_DEPS@ + @ECHO_LINK@ $(LINK) -o $@ $(OBJS_DEMO) $(LDFLAGS_DEFAULT) + +etip.h: $(srcdir)/etip.h.in $(srcdir)/edit_cfg.sh + cp $(srcdir)/etip.h.in $@ + sh $(srcdir)/edit_cfg.sh ../include/ncurses_cfg.h $@ + +$(INSTALL_PREFIX)$(libdir) : + $(srcdir)/../mkinstalldirs $@ -install: -install.libs: +install \ +install.libs:: $(LIBNAME) $(INSTALL_PREFIX)$(libdir) + $(INSTALL) $(LIBNAME) $(INSTALL_PREFIX)$(libdir)/$(LIBNAME) -clean :: - -rm -f core demo $(OBJS_DEMO) +uninstall \ +uninstall.libs:: + -rm -f $(INSTALL_PREFIX)$(libdir)/$(LIBNAME) + +mostlyclean :: + -rm -f core tags TAGS *~ *.ln *.atac trace + +clean :: mostlyclean + -rm -f demo $(AUTO_SRC) $(LIBNAME) $(LIB_OBJS) $(OBJS_DEMO) distclean :: clean -rm -f Makefile -mostlyclean :: clean - realclean :: distclean +############################################################################### + +cursesw_h = $(srcdir)/cursesw.h \ + etip.h \ + $(INCDIR)/curses.h + +cursesp_h = $(srcdir)/cursesp.h \ + $(cursesw_h) \ + $(INCDIR)/panel.h + +cursesf_h = $(srcdir)/cursesf.h \ + $(cursesp_h) \ + $(INCDIR)/form.h + +cursesm_h = $(srcdir)/cursesm.h \ + $(cursesp_h) \ + $(INCDIR)/menu.h + +cursslk_h = $(srcdir)/cursslk.h \ + $(cursesw_h) + +cursesapp_h = $(srcdir)/cursesapp.h \ + $(cursslk_h) + +$(INCDIR)/form.h : + cd ../form && $(MAKE) $@ + +$(INCDIR)/menu.h : + cd ../menu && $(MAKE) $@ + +$(INCDIR)/panel.h : + cd ../panel && $(MAKE) $@ + ############################################################################### # The remainder of this file is automatically generated during configuration ############################################################################### diff --git a/c++/NEWS b/c++/NEWS index 525fa728..2472ea98 100644 --- a/c++/NEWS +++ b/c++/NEWS @@ -2,6 +2,26 @@ This is a log of changes that the ncurses C++ binding has gone through starting with the integration of menu and forms integration into the binding. +970908 + Improve NCursesWindow class: added additional methods to + cover more ncurses functionality. Make refresh() and + noutrefresh() virtual members to allow different implementation + in the NCursesPanel class. + + CAUTION: changed order of parameters in vline() and hline() of + NCursesWindow class. + + Make refresh() in NCursesPanel non-static, it is now a + reimplementation of refresh() in the base class. Added + noutrefresh() to NCursesPanel. + + Added NCursesForm and related classes to support libform + functionality. + + Moved most of configuration related stuff from cursesw.h to + etip.h + + Added NCursesApplication class to support easy configuration + of menu and forms related attributes as well as ripped of + title lines and Soft-Label-Keys for an application. + + Support of Auto-Cleanup for a menus fieldlist. + + Change of return type for current_item() and operator[] for + menus. + + Enhanced demo. 970502 + Introduced the THROW and THROWS functions/macros to prepare a smoother transition to real exception handling. @@ -9,8 +29,9 @@ into the binding. + Added the NCursesMenu class to support libmenu functionality. + The inheritace relation between NCursesWindow and NCursesColorWindow was kind of brain damage. Monochrome is a special case of colored, so - the relation should be just the opposite. This would allow all derived - classes like NCursesPanel, NCursesMenu or NCursesForm to have colors. + the relation should be just the opposite. This would allow all + derived classes like NCursesPanel, NCursesMenu or NCursesForm to + have colors. To resolve that design flaw I put the color functionality into the NCursesWindow class and it can be switched on by the static member useColors(). NCursesColorWindow is still there for compatibility diff --git a/c++/PROBLEMS b/c++/PROBLEMS index 709846be..81c1ebaf 100644 --- a/c++/PROBLEMS +++ b/c++/PROBLEMS @@ -1,8 +1,5 @@ This is a list of open problems. This mainly lists known missing pieces and design flaws. -1. Missing binding to libform - - - - +1. Testing!!! +2. Better demo program diff --git a/c++/README-first b/c++/README-first index b0c38fad..b3b0b9d8 100644 --- a/c++/README-first +++ b/c++/README-first @@ -1,7 +1,7 @@ C++ interface to ncurses routines ----------------------------------------------------------------------- -This directory contains the source code for three C++ classes which +This directory contains the source code for several C++ classes which ease the use of writing ncurses-based programs. The code is derived from the libg++ CursesWindow class but enhanced for ncurses. @@ -15,23 +15,21 @@ the curses.h file. This is a steady cause of trouble because many common identifiers are used. Instead now all #defines are inline functions which also allows strict type checking of arguments. -The next enhancement is color support, which is provided by a derived -class. The implementation chosen here is directed to unrestricted use -of mixes of color and monochrome windows. This is done through virtual -functions and means that you can write all of your code as if a color -window is the destination. If the destination window is monochrome these -functions calls have no effect. - - NOTE: This implementation of the color support was topic of - some discussion. The introduction of virtual functions - introduced some overhead. Please let us know what you think - about this: is it worth being able to write color supporting - functions. - -The last point to mention is the support of another package Zeyd -distributes with his ncurses package: the panels library. This support -is provided by the NCursesPanel class, which is also derived from the -NCursesWindow class. This allows building interfaces with windows. +The next enhancement is color support. It was originally provided by a +derived class. This caused some trouble if you think about Panels or +Menus and Forms with colors. We decided to put color support into the +base class so that any derived class may use color support also. +The implementation chosen here is directed to unrestricted use +of mixes of color and monochrome windows. The original NCursesColorWindow +class is maintained for compatibility reasons. + +The last point to mention is the support of other packages that are +distributed with the ncurses package: the panels library, the menu library +and the form library. This support is provided by the NCursesPanel class, +which is also derived from the NCursesWindow class and the NCursesMenu +and NCursesForm classes which are derived from NCursesPanel. This allows +building interfaces with windows. + Please see the example program for a quick introduction. Note that at this point, there is no documentation for these classes. @@ -52,6 +50,9 @@ welcome. Please let us know which functionality you miss. Original author: Eric Newton for FSF's libg++ -Authors of this release: +Authors of first ncurses based release (NCursesWindow, NCursesPanel): Ulrich Drepper and Anatoly Ivasyuk + +Author of this release: + Juergen Pfeifer diff --git a/c++/cursesapp.cc b/c++/cursesapp.cc new file mode 100644 index 00000000..ec45577a --- /dev/null +++ b/c++/cursesapp.cc @@ -0,0 +1,146 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1997 * + ****************************************************************************/ + +#include "cursesapp.h" +#include "internal.h" + +MODULE_ID("$Id: cursesapp.cc,v 1.2 1998/02/11 12:13:41 tom Exp $") + +void +NCursesApplication::init(bool bColors) { + if (bColors) + NCursesWindow::useColors(); + + if (Root_Window->colors() > 1) { + b_Colors = TRUE; + Root_Window->setcolor(1); + Root_Window->setpalette(COLOR_YELLOW,COLOR_BLUE); + Root_Window->setcolor(2); + Root_Window->setpalette(COLOR_CYAN,COLOR_BLUE); + Root_Window->setcolor(3); + Root_Window->setpalette(COLOR_BLACK,COLOR_BLUE); + Root_Window->setcolor(4); + Root_Window->setpalette(COLOR_BLACK,COLOR_CYAN); + Root_Window->setcolor(5); + Root_Window->setpalette(COLOR_BLUE,COLOR_YELLOW); + Root_Window->setcolor(6); + Root_Window->setpalette(COLOR_BLACK,COLOR_GREEN); + } + else + b_Colors = FALSE; + + Root_Window->bkgd(' '|window_backgrounds()); +} + +NCursesApplication* NCursesApplication::theApp = 0; +NCursesWindow* NCursesApplication::titleWindow = 0; +NCursesApplication::SLK_Link* NCursesApplication::slk_stack = 0; + +NCursesApplication::~NCursesApplication() { + Soft_Label_Key_Set* S; + + delete titleWindow; + while( (S=top()) ) { + pop(); + delete S; + } + delete Root_Window; + ::endwin(); +} + +int NCursesApplication::rinit(NCursesWindow& w) { + titleWindow = &w; + return OK; +} + +void NCursesApplication::push(Soft_Label_Key_Set& S) { + SLK_Link* L = new SLK_Link; + assert(L); + L->prev = slk_stack; + L->SLKs = &S; + slk_stack = L; + if (Root_Window) + S.show(); +} + +bool NCursesApplication::pop() { + if (slk_stack) { + SLK_Link* L = slk_stack; + slk_stack = slk_stack->prev; + delete L; + if (Root_Window && top()) + top()->show(); + } + return (slk_stack ? FALSE : TRUE); +} + +Soft_Label_Key_Set* NCursesApplication::top() const { + if (slk_stack) + return slk_stack->SLKs; + else + return (Soft_Label_Key_Set*)0; +} + +int NCursesApplication::operator()(void) { + bool bColors = b_Colors; + Soft_Label_Key_Set* S; + + 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) { + S = new Soft_Label_Key_Set(fmt); + assert(S); + init_labels(*S); + } + + Root_Window = new NCursesWindow(::stdscr); + init(bColors); + + if (ts>0) + title(); + if (fmt!=Soft_Label_Key_Set::None) { + push(*S); + } + + return run(); +} + +NCursesApplication::NCursesApplication(bool bColors) { + b_Colors = bColors; + if (theApp) + THROW(new NCursesException("Application object already created.")); + else + theApp = this; +} diff --git a/c++/cursesapp.h b/c++/cursesapp.h new file mode 100644 index 00000000..998f14f1 --- /dev/null +++ b/c++/cursesapp.h @@ -0,0 +1,163 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1997 * + ****************************************************************************/ + +// $Id: cursesapp.h,v 1.3 1998/02/11 12:13:41 tom Exp $ + +#ifndef _CURSESAPP_H +#define _CURSESAPP_H + +#include + +class NCursesApplication { +public: + typedef struct _slk_link { // This structure is used to maintain + struct _slk_link* prev; // a stack of SLKs + Soft_Label_Key_Set* SLKs; + } SLK_Link; +private: + static int rinit(NCursesWindow& w); // Internal Init function for title + static NCursesApplication* theApp; // Global ref. to the application + + static SLK_Link* slk_stack; + +protected: + static NCursesWindow* titleWindow; // The Title Window (if any) + + bool b_Colors; // Is this a color application? + NCursesWindow* Root_Window; // This is the stdscr equiv. + + // Initialization of attributes; + // Rewrite this in your derived class if you prefer other settings + virtual void init(bool bColors); + + // The number of lines for the title window. Default is no title window + // You may rewrite this in your derived class + virtual int titlesize() const { + return 0; + } + + // This method is called to put something into the title window initially + // You may rewrite this in your derived class + virtual void title() { + } + + // The layout used for the Soft Label Keys. Default is to have no SLKs. + // You may rewrite this in your derived class + virtual Soft_Label_Key_Set::Label_Layout useSLKs() const { + return Soft_Label_Key_Set::None; + } + + // This method is called to initialize the SLKs. Default is nothing. + // You may rewrite this in your derived class + virtual void init_labels(Soft_Label_Key_Set& S) const { + } + + // Your derived class must implement this method. The return value must + // 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); + +public: + virtual ~NCursesApplication(); + + // Get a pointer to the current application object + static NCursesApplication* getApplication() { + return theApp; + } + + // This method runs the application and returns its exit value + int operator()(void); + + // Process the commandline arguments. The default implementation simply + // ignores them. Your derived class may rewrite this. + virtual void handleArgs(int argc, char* argv[]) { + } + + // Does this application use colors? + inline bool useColors() const { + return b_Colors; + } + + // Push the Key Set S onto the SLK Stack. S then becomes the current set + // of Soft Labelled Keys. + void push(Soft_Label_Key_Set& S); + + // Throw away the current set of SLKs and make the previous one the + // new current set. + bool pop(); + + // Retrieve the current set of Soft Labelled Keys. + Soft_Label_Key_Set* top() const; + + // Attributes to use for menu and forms foregrounds + virtual chtype foregrounds() const { + return b_Colors ? COLOR_PAIR(1) : A_BOLD; + } + + // Attributes to use for menu and forms backgrounds + virtual chtype backgrounds() const { + return b_Colors ? COLOR_PAIR(2) : A_NORMAL; + } + + // Attributes to use for inactive (menu) elements + virtual chtype inactives() const { + return b_Colors ? (COLOR_PAIR(3)|A_DIM) : A_DIM; + } + + // Attributes to use for (form) labels and SLKs + virtual chtype labels() const { + return b_Colors ? COLOR_PAIR(4) : A_NORMAL; + } + + // Attributes to use for form backgrounds + virtual chtype dialog_backgrounds() const { + return b_Colors ? COLOR_PAIR(4) : A_NORMAL; + } + + // Attributes to use as default for (form) window backgrounds + virtual chtype window_backgrounds() const { + return b_Colors ? COLOR_PAIR(5) : A_NORMAL; + } + + // Attributes to use for the title window + virtual chtype screen_titles() const { + return b_Colors ? COLOR_PAIR(6) : A_BOLD; + } + +}; + +#endif // _CURSESAPP_H diff --git a/c++/cursesf.cc b/c++/cursesf.cc new file mode 100644 index 00000000..66a6f09e --- /dev/null +++ b/c++/cursesf.cc @@ -0,0 +1,423 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1997 * + ****************************************************************************/ + +#include "cursesf.h" +#include "cursesapp.h" +#include "internal.h" + +MODULE_ID("$Id: cursesf.cc,v 1.7 1998/02/11 12:13:41 tom Exp $") + +NCursesFormField::~NCursesFormField () { + if (field) + OnError(::free_field (field)); +} + +/* Construct a FIELD* array from an array of NCursesFormField + * objects. + */ +FIELD** +NCursesForm::mapFields(NCursesFormField* nfields[]) { + int fieldCount = 0,lcv; + + assert(nfields); + + for (lcv=0; nfields[lcv]->field; ++lcv) + ++fieldCount; + + FIELD** fields = new FIELD*[fieldCount + 1]; + + for (lcv=0;nfields[lcv]->field;++lcv) { + fields[lcv] = nfields[lcv]->field; + } + fields[lcv] = NULL; + + my_fields = nfields; + + if (form) + delete[] ::form_fields(form); + return fields; +} + +void NCursesForm::setDefaultAttributes() { + NCursesApplication* S = NCursesApplication::getApplication(); + + int n = count(); + if (n > 0) { + for(int i=0; ioptions() & (O_EDIT|O_ACTIVE))==(O_EDIT|O_ACTIVE)) { + if (S) { + f->set_foreground(S->foregrounds()); + f->set_background(S->backgrounds()); + } + f->set_pad_character('_'); + } + else { + if (S) + f->set_background(S->labels()); + } + } + } + + if (S) { + bkgd(' '|S->dialog_backgrounds()); + if (sub) + sub->bkgd(' '|S->dialog_backgrounds()); + } +} + +void +NCursesForm::InitForm(NCursesFormField* nfields[], + bool with_frame, + bool autoDelete_Fields) { + int mrows, mcols; + + keypad(TRUE); + meta(TRUE); + + b_framed = with_frame; + b_autoDelete = autoDelete_Fields; + + form = (FORM*)0; + form = ::new_form(mapFields(nfields)); + if (!form) + OnError (E_SYSTEM_ERROR); + + UserHook* hook = new UserHook; + hook->m_user = NULL; + hook->m_back = this; + hook->m_owner = form; + ::set_form_userptr(form,(void*)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); + + scale(mrows, mcols); + ::set_form_win(form, w); + + if (with_frame) { + if ((mrows > height()-2) || (mcols > width()-2)) + OnError(E_NO_ROOM); + sub = new NCursesWindow(*this,mrows,mcols,1,1,'r'); + ::set_form_sub(form, sub->w); + b_sub_owner = TRUE; + } + else { + sub = (NCursesWindow*)0; + b_sub_owner = FALSE; + } + options_on(O_NL_OVERLOAD); + setDefaultAttributes(); +} + +NCursesForm::~NCursesForm() { + UserHook* hook = (UserHook*)::form_userptr(form); + delete hook; + if (b_sub_owner) { + delete sub; + ::set_form_sub(form,(WINDOW *)0); + } + if (form) { + FIELD** fields = ::form_fields(form); + int cnt = count(); + + OnError(::set_form_fields(form,(FIELD**)0)); + + if (b_autoDelete) { + if (cnt>0) { + for (int i=0; i <= cnt; i++) + delete my_fields[i]; + } + delete[] my_fields; + } + + ::free_form(form); + // It's essential to do this after free_form() + delete[] fields; + } +} + +void +NCursesForm::setSubWindow(NCursesWindow& nsub) { + if (!isDescendant(nsub)) + OnError(E_SYSTEM_ERROR); + else { + if (b_sub_owner) + delete sub; + sub = ⊄ + ::set_form_sub(form,sub->w); + } +} + +/* Internal hook functions. They will route the hook + * calls to virtual methods of the NCursesForm class, + * so in C++ providing a hook is done simply by + * implementing a virtual method in a derived class + */ +void +NCursesForm::frm_init(FORM *f) { + getHook(f)->On_Form_Init(); +} + +void +NCursesForm::frm_term(FORM *f) { + getHook(f)->On_Form_Termination(); +} + +void +NCursesForm::fld_init(FORM *f) { + NCursesForm* F = getHook(f); + F->On_Field_Init (*(F->current_field ())); +} + +void +NCursesForm::fld_term(FORM *f) { + NCursesForm* F = getHook(f); + F->On_Field_Termination (*(F->current_field ())); +} + +void +NCursesForm::On_Form_Init() { +} + +void +NCursesForm::On_Form_Termination() { +} + +void +NCursesForm::On_Field_Init(NCursesFormField& field) { +} + +void +NCursesForm::On_Field_Termination(NCursesFormField& field) { +} + +// call the form driver and do basic error checking. +int +NCursesForm::driver (int c) { + int res = ::form_driver (form, c); + switch (res) { + case E_OK: + case E_REQUEST_DENIED: + case E_INVALID_FIELD: + case E_UNKNOWN_COMMAND: + break; + default: + OnError (res); + } + return (res); +} + +void NCursesForm::On_Request_Denied(int c) const { + beep(); +} + +void NCursesForm::On_Invalid_Field(int c) const { + beep(); +} + +void NCursesForm::On_Unknown_Command(int c) const { + beep(); +} + +static const int CMD_QUIT = MAX_COMMAND + 1; + +NCursesFormField* +NCursesForm::operator()(void) { + int drvCmnd; + int err; + int c; + + post(); + show(); + refresh(); + + while (((drvCmnd = virtualize((c=getch()))) != CMD_QUIT)) { + switch((err=driver(drvCmnd))) { + case E_REQUEST_DENIED: + On_Request_Denied(c); + break; + case E_INVALID_FIELD: + On_Invalid_Field(c); + break; + case E_UNKNOWN_COMMAND: + On_Unknown_Command(c); + break; + case E_OK: + break; + default: + OnError(err); + } + } + + unpost(); + hide(); + refresh(); + return my_fields[::field_index (::current_field (form))]; +} + +// Provide a default key virtualization. Translate the keyboard +// code c into a form request code. +// The default implementation provides a hopefully straightforward +// mapping for the most common keystrokes and form requests. +int +NCursesForm::virtualize(int c) { + switch(c) { + + case KEY_HOME : return(REQ_FIRST_FIELD); + case KEY_END : return(REQ_LAST_FIELD); + + case KEY_DOWN : return(REQ_DOWN_CHAR); + case KEY_UP : return(REQ_UP_CHAR); + case KEY_LEFT : return(REQ_PREV_CHAR); + case KEY_RIGHT : return(REQ_NEXT_CHAR); + + case KEY_NPAGE : return(REQ_NEXT_PAGE); + case KEY_PPAGE : return(REQ_PREV_PAGE); + + case KEY_BACKSPACE : return(REQ_DEL_PREV); + case KEY_ENTER : return(REQ_NEW_LINE); + case KEY_CLEAR : return(REQ_CLR_FIELD); + + case CTRL('X') : return(CMD_QUIT); // eXit + + case CTRL('F') : return(REQ_NEXT_FIELD); // Forward + case CTRL('B') : return(REQ_PREV_FIELD); // Backward + case CTRL('L') : return(REQ_LEFT_FIELD); // Left + case CTRL('R') : return(REQ_RIGHT_FIELD); // Right + case CTRL('U') : return(REQ_UP_FIELD); // Up + case CTRL('D') : return(REQ_DOWN_FIELD); // Down + + case CTRL('W') : return(REQ_NEXT_WORD); + case CTRL('T') : return(REQ_PREV_WORD); + + case CTRL('A') : return(REQ_BEG_FIELD); + case CTRL('E') : return(REQ_END_FIELD); + + case CTRL('I') : return(REQ_INS_CHAR); + case CTRL('M') : + case CTRL('J') : return(REQ_NEW_LINE); + case CTRL('O') : return(REQ_INS_LINE); + case CTRL('V') : return(REQ_DEL_CHAR); + case CTRL('H') : return(REQ_DEL_PREV); + case CTRL('Y') : return(REQ_DEL_LINE); + case CTRL('G') : return(REQ_DEL_WORD); + case CTRL('K') : return(REQ_CLR_EOF); + + case CTRL('N') : return(REQ_NEXT_CHOICE); + case CTRL('P') : return(REQ_PREV_CHOICE); + + default: + return(c); + } +} +// +// ------------------------------------------------------------------------- +// User Defined Fieldtypes +// ------------------------------------------------------------------------- +// +bool UserDefinedFieldType::fcheck(FIELD *f, const void *u) { + NCursesFormField* F = (NCursesFormField*)u; + assert(F); + UserDefinedFieldType* udf = (UserDefinedFieldType*)(F->fieldtype()); + assert(udf); + return udf->field_check(*F); +} + +bool UserDefinedFieldType::ccheck(int c, const void *u) { + NCursesFormField* F = (NCursesFormField*)u; + assert(F); + UserDefinedFieldType* udf = + (UserDefinedFieldType*)(F->fieldtype()); + assert(udf); + return udf->char_check(c); +} + +void* UserDefinedFieldType::makearg(va_list* va) { + return va_arg(*va,NCursesFormField*); +} + +FIELDTYPE* UserDefinedFieldType::generic_fieldtype = + ::new_fieldtype(UserDefinedFieldType::fcheck, + UserDefinedFieldType::ccheck); + +FIELDTYPE* UserDefinedFieldType_With_Choice::generic_fieldtype_with_choice = + ::new_fieldtype(UserDefinedFieldType::fcheck, + UserDefinedFieldType::ccheck); + +bool UserDefinedFieldType_With_Choice::next_choice(FIELD *f, const void *u) { + NCursesFormField* F = (NCursesFormField*)u; + assert(F); + UserDefinedFieldType_With_Choice* udf = + (UserDefinedFieldType_With_Choice*)(F->fieldtype()); + assert(udf); + return udf->next(*F); +} + +bool UserDefinedFieldType_With_Choice::prev_choice(FIELD *f, const void *u) { + NCursesFormField* F = (NCursesFormField*)u; + assert(F); + UserDefinedFieldType_With_Choice* udf = + (UserDefinedFieldType_With_Choice*)(F->fieldtype()); + assert(udf); + return udf->previous(*F); +} + +class UDF_Init { +private: + int code; + static UDF_Init* I; +public: + UDF_Init() { + code = ::set_fieldtype_arg(UserDefinedFieldType::generic_fieldtype, + UserDefinedFieldType::makearg, + NULL, + NULL); + if (code==E_OK) + code = ::set_fieldtype_arg + (UserDefinedFieldType_With_Choice::generic_fieldtype_with_choice, + UserDefinedFieldType::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); + } +}; + +UDF_Init* UDF_Init::I = new UDF_Init(); + diff --git a/c++/cursesf.h b/c++/cursesf.h new file mode 100644 index 00000000..d90a8520 --- /dev/null +++ b/c++/cursesf.h @@ -0,0 +1,823 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1997 * + ****************************************************************************/ + +// $Id: cursesf.h,v 1.6 1998/02/11 12:13:41 tom Exp $ + +#ifndef _CURSESF_H +#define _CURSESF_H + +#include + +extern "C" { +# include +} +// +// ------------------------------------------------------------------------- +// The abstract base class for buitin and user defined Fieldtypes. +// ------------------------------------------------------------------------- +// +class NCursesFormField; // forward declaration + +// Class to represent builtin field types as well as C++ written new +// fieldtypes (see classes UserDefineFieldType... +class NCursesFieldType { + friend class NCursesFormField; + +protected: + FIELDTYPE* fieldtype; + + inline void OnError(int err) const THROWS(NCursesFormException) { + if (err!=E_OK) + THROW(new NCursesFormException (err)); + } + + NCursesFieldType(FIELDTYPE *f) : fieldtype(f) { + } + + virtual ~NCursesFieldType() {} + + // Set the fields f fieldtype to this one. + virtual void set(NCursesFormField& f) = 0; + +public: + NCursesFieldType() : fieldtype((FIELDTYPE*)0) { + } +}; + +// +// ------------------------------------------------------------------------- +// The class representing a forms field, wrapping the lowlevel FIELD struct +// ------------------------------------------------------------------------- +// +class NCursesFormField { + friend class NCursesForm; + +protected: + FIELD *field; // lowlevel structure + NCursesFieldType* ftype; // Associated field type + + // Error handler + inline void OnError (int err) const THROWS(NCursesFormException) { + if (err != E_OK) + THROW(new NCursesFormException (err)); + } + +public: + // Create a 'Null' field. Can be used to delimit a field list + NCursesFormField() + : field((FIELD*)0), ftype((NCursesFieldType*)0) { + } + + // Create a new field + NCursesFormField (int rows, + int cols, + 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, + offscreen_rows, additional_buffers); + if (!field) + OnError(errno); + } + + virtual ~NCursesFormField (); + + // Duplicate the field at a new position + inline NCursesFormField* dup(int first_row, int first_col) { + NCursesFormField* f = new NCursesFormField(); + if (!f) + OnError(E_SYSTEM_ERROR); + else { + f->ftype = ftype; + f->field = ::dup_field(field,first_row,first_col); + if (!f->field) + OnError(errno); + } + return f; + } + + // Link the field to a new location + inline NCursesFormField* link(int first_row, int first_col) { + NCursesFormField* f = new NCursesFormField(); + if (!f) + OnError(E_SYSTEM_ERROR); + else { + f->ftype = ftype; + f->field = ::link_field(field,first_row,first_col); + if (!f->field) + OnError(errno); + } + return f; + } + + // Get the lowlevel field representation + inline FIELD* get_field() const { + return field; + } + + // Retrieve info about the field + inline void info(int& rows, int& cols, + int& first_row, int& first_col, + int& offscreen_rows, int& additional_buffers) const { + OnError(::field_info(field, &rows, &cols, + &first_row, &first_col, + &offscreen_rows, &additional_buffers)); + } + + // Retrieve info about the fields dynamic properties. + inline void dynamic_info(int& dynamic_rows, int& dynamic_cols, + int& max_growth) const { + OnError(::dynamic_field_info(field, &dynamic_rows, &dynamic_cols, + &max_growth)); + } + + // For a dynamic field you may set the maximum growth limit. + // A zero means unlimited growth. + inline void set_maximum_growth(int growth = 0) { + OnError(::set_max_field(field,growth)); + } + + // Move the field to a new position + inline void move(int row, int col) { + OnError(::move_field(field,row,col)); + } + + // Mark the field to start a new page + inline void new_page(bool pageFlag = FALSE) { + OnError(::set_new_page(field,pageFlag)); + } + + // Retrieve whether or not the field starts a new page. + inline bool is_new_page() const { + return ::new_page(field); + } + + // Set the justification for the field + inline void set_justification(int just) { + OnError(::set_field_just(field,just)); + } + + // Retrieve the fields justification + inline int justification() const { + return ::field_just(field); + } + // Set the foreground attribute for the field + inline void set_foreground(chtype fore) { + OnError(::set_field_fore(field,fore)); + } + + // Retrieve the fields foreground attribute + inline chtype fore() const { + return ::field_fore(field); + } + + // Set the background attribute for the field + inline void set_background(chtype back) { + OnError(::set_field_back(field,back)); + } + + // Retrieve the fields background attribute + inline chtype back() const { + return ::field_back(field); + } + + // Set the padding character for the field + inline void set_pad_character(int pad) { + OnError(::set_field_pad(field,pad)); + } + + // Retrieve the fields padding character + inline int pad() const { + return ::field_pad(field); + } + + // Switch on the fields options + inline void options_on (Field_Options options) { + OnError (::field_opts_on (field, options)); + } + + // Switch off the fields options + inline void options_off (Field_Options options) { + OnError (::field_opts_off (field, options)); + } + + // Retrieve the fields options + inline Field_Options options () const { + return ::field_opts (field); + } + + // Set the fields options + inline void set_options (Field_Options options) { + OnError (::set_field_opts (field, options)); + } + + // Mark the field as changed + inline void set_changed(bool changeFlag = TRUE) { + OnError(::set_field_status(field,changeFlag)); + } + + // Test whether or not the field is marked as changed + inline bool changed() const { + return ::field_status(field); + } + + // Return the index of the field in the field array of a form + // or -1 if the field is not associated to a form + inline int index() const { + return ::field_index(field); + } + + // Store a value in a fields buffer. The default buffer is nr. 0 + inline void set_value(const char *val, int buffer = 0) { + OnError(::set_field_buffer(field,buffer,val)); + } + + // Retrieve the value of a fields buffer. The defaukt buffer is nr. 0 + inline char* value(int buffer = 0) const { + return ::field_buffer(field,buffer); + } + + // Set the validation type of the field. + inline void set_fieldtype(NCursesFieldType& f) { + ftype = &f; + f.set(*this); // A good friend may do that... + } + + // Retrieve the validation type of the field. + inline NCursesFieldType* fieldtype() const { + return ftype; + } + +}; + +// +// ------------------------------------------------------------------------- +// The class representing a form, wrapping the lowlevel FORM struct +// ------------------------------------------------------------------------- +// +class 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_autoDelete; // Delete fields when deleting form? + + NCursesFormField** my_fields; // The array of fields for this form + + // 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 + const NCursesForm* m_back; // backward pointer to C++ object + 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); + assert(hook && hook->m_owner==f); + return (NCursesForm*)(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 *); + + // Calculate FIELD* array for the menu + FIELD** mapFields(NCursesFormField* nfields[]); + +protected: + // internal routines + inline void set_user(void *user) { + UserHook* uptr = (UserHook*)::form_userptr (form); + assert (uptr && uptr->m_back==this && uptr->m_owner==form); + uptr->m_user = user; + } + + inline void *get_user() { + UserHook* uptr = (UserHook*)::form_userptr (form); + assert (uptr && uptr->m_back==this && uptr->m_owner==form); + return uptr->m_user; + } + + void InitForm (NCursesFormField* Fields[], + bool with_frame, + bool autoDeleteFields); + + inline void OnError (int err) const THROWS(NCursesFormException) { + if (err != E_OK) + THROW(new NCursesFormException (err)); + } + + // this wraps the form_driver call. + virtual int driver (int c) ; + + // 'Internal' constructor, builds an object without association to a + // field array. + NCursesForm( int lines, + int cols, + int begin_y = 0, + int begin_x = 0) + : NCursesPanel(lines,cols,begin_y,begin_x), + form ((FORM*)0) { + } + +public: + // Create form for the default panel. + NCursesForm (NCursesFormField* Fields[], + bool with_frame=FALSE, // reserve space for a frame? + bool autoDelete_Fields=FALSE) // do automatic cleanup? + : NCursesPanel() { + 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 begin_y, + int begin_x, + bool with_frame=FALSE, // reserve space for a frame? + bool autoDelete_Fields=FALSE) // do automatic cleanup? + : NCursesPanel(lines, cols, begin_y, begin_x) { + InitForm(Fields, with_frame, autoDelete_Fields); + } + + virtual ~NCursesForm(); + + // Set the default attributes for the form + virtual void setDefaultAttributes(); + + // Retrieve current field of the form. + inline NCursesFormField* current_field() const { + return my_fields[::field_index(::current_field(form))]; + } + + // Set the forms subwindow + void setSubWindow(NCursesWindow& sub); + + // Set these fields for the form + inline void setFields(NCursesFormField* Fields[]) { + OnError(::set_form_fields(form,mapFields(Fields))); + } + + // Remove the form from the screen + inline void unpost (void) { + OnError (::unpost_form (form)); + } + + // Post the form to the screen if flag is true, unpost it otherwise + inline void post(bool flag = TRUE) { + OnError (flag ? ::post_form(form) : ::unpost_form (form)); + } + + // Decorations + inline void frame(const char *title=NULL, const char* btitle=NULL) { + if (b_framed) + NCursesPanel::frame(title,btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void boldframe(const char *title=NULL, const char* btitle=NULL) { + if (b_framed) + NCursesPanel::boldframe(title,btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void label(const char *topLabel, const char *bottomLabel) { + if (b_framed) + NCursesPanel::label(topLabel,bottomLabel); + else + OnError(E_SYSTEM_ERROR); + } + + // ----- + // Hooks + // ----- + + // Called after the form gets repositioned in its window. + // This is especially true if the form is posted. + virtual void On_Form_Init(); + + // Called before the form gets repositioned in its window. + // This is especially true if the form is unposted. + virtual void On_Form_Termination(); + + // Called after the field became the current field + virtual void On_Field_Init(NCursesFormField& field); + + // Called before this field is left as current field. + 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)); + } + + // Retrieve number of fields in the form. + int count() const { + return ::field_count(form); + } + + // Make the page the current page of the form. + void set_page(int page) { + OnError(::set_form_page(form,page)); + } + + // Retrieve current page number + int page() const { + return ::form_page(form); + } + + // Switch on the forms options + inline void options_on (Form_Options options) { + OnError (::form_opts_on (form, options)); + } + + // Switch off the forms options + inline void options_off (Form_Options options) { + OnError (::form_opts_off (form, options)); + } + + // Retrieve the forms options + inline Form_Options options () const { + return ::form_opts (form); + } + + // Set the forms options + inline void set_options (Form_Options options) { + OnError (::set_form_opts (form, options)); + } + + // Are there more data in the current field after the data shown + inline bool data_ahead() const { + return ::data_ahead(form); + } + + // Are there more data in the current field before the data shown + inline bool data_behind() const { + return ::data_behind(form); + } + + // Position the cursor to the current field + inline void position_cursor () { + OnError (::pos_form_cursor (form)); + } + // Set the current field + inline void set_current(NCursesFormField& F) { + OnError (::set_current_field(form, F.field)); + } + + // Provide a default key virtualization. Translate the keyboard + // code c into a form request code. + // The default implementation provides a hopefully straightforward + // mapping for the most common keystrokes and form requests. + virtual int virtualize(int c); + + // Operators + inline NCursesFormField* operator[](int i) const { + if ( (i < 0) || (i >= ::field_count (form)) ) + OnError (E_BAD_ARGUMENT); + return my_fields[i]; + } + + // Perform the menu's operation + // Return the field where you left the form. + virtual NCursesFormField* operator()(void); + + // Exception handlers. The default is a Beep. + virtual void On_Request_Denied(int c) const; + virtual void On_Invalid_Field(int c) const; + virtual void On_Unknown_Command(int c) const; + +}; + +// +// ------------------------------------------------------------------------- +// This is the typical C++ typesafe way to allow to attach +// user data to a field of a form. Its assumed that the user +// data belongs to some class T. Use T as template argument +// to create a UserField. +// ------------------------------------------------------------------------- +template class NCursesUserField : public NCursesFormField +{ +public: + NCursesUserField (int rows, + int cols, + int first_row = 0, + int first_col = 0, + const T* p_UserData = (T*)0, + int offscreen_rows = 0, + int additional_buffers = 0) + : NCursesFormField (rows, cols, + first_row, first_col, + offscreen_rows, additional_buffers) { + if (field) + OnError(::set_field_userptr(field,(void *)p_UserData)); + } + + virtual ~NCursesUserField() {}; + + inline const T* UserData (void) const { + return (const T*)::field_userptr (field); + } + + inline virtual void setUserData(const T* p_UserData) { + if (field) + OnError (::set_field_userptr (field, (void *)p_UserData)); + } +}; +// +// ------------------------------------------------------------------------- +// The same mechanism is used to attach user data to a form +// ------------------------------------------------------------------------- +// +template class NCursesUserForm : public NCursesForm +{ +protected: + // 'Internal' constructor, builds an object without association to a + // field array. + NCursesUserForm( int lines, + int cols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = (T*)0) + : NCursesForm(lines,cols,begin_y,begin_x) { + if (form) + set_user ((void *)p_UserData); + } + +public: + NCursesUserForm (NCursesFormField Fields[], + bool with_frame=FALSE, + bool autoDelete_Fields=FALSE) + : NCursesForm (Fields, with_frame, autoDelete_Fields) { + }; + + NCursesUserForm (NCursesFormField Fields[], + const T* p_UserData = (T*)0, + bool with_frame=FALSE, + bool autoDelete_Fields=FALSE) + : NCursesForm (Fields, with_frame, autoDelete_Fields) { + if (form) + set_user ((void *)p_UserData); + }; + + NCursesUserForm (NCursesFormField Fields[], + int lines, + int cols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = (T*)0, + bool with_frame=FALSE, + bool autoDelete_Fields=FALSE) + : NCursesForm (Fields, lines, cols, begin_y, begin_x, + with_frame, autoDelete_Fields) { + if (form) + set_user ((void *)p_UserData); + }; + + virtual ~NCursesUserForm() { + }; + + inline T* UserData (void) const { + return (T*)get_user (); + }; + + inline virtual void setUserData (const T* p_UserData) { + if (form) + set_user ((void *)p_UserData); + } + +}; +// +// ------------------------------------------------------------------------- +// Builtin Fieldtypes +// ------------------------------------------------------------------------- +// +class Alpha_Field : public NCursesFieldType { +private: + int min_field_width; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype,min_field_width)); + } + +public: + Alpha_Field(int width) + : NCursesFieldType(TYPE_ALPHA), + min_field_width(width) { + } +}; + +class Alphanumeric_Field : public NCursesFieldType { +private: + int min_field_width; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype,min_field_width)); + } + +public: + Alphanumeric_Field(int width) + : NCursesFieldType(TYPE_ALNUM), + min_field_width(width) { + } +}; + +class Integer_Field : public NCursesFieldType { +private: + int precision; + long lower_limit, upper_limit; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype, + precision,lower_limit,upper_limit)); + } + +public: + Integer_Field(int prec, long low=0L, long high=0L) + : NCursesFieldType(TYPE_INTEGER), + precision(prec), lower_limit(low), upper_limit(high) { + } +}; + +class Numeric_Field : public NCursesFieldType { +private: + int precision; + double lower_limit, upper_limit; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype, + precision,lower_limit,upper_limit)); + } + +public: + Numeric_Field(int prec, double low=0.0, double high=0.0) + : NCursesFieldType(TYPE_NUMERIC), + precision(prec), lower_limit(low), upper_limit(high) { + } +}; + +class Regular_Expression_Field : public NCursesFieldType { +private: + char* regex; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype,regex)); + } + +public: + Regular_Expression_Field(const char *expr) + : NCursesFieldType(TYPE_REGEXP) { + regex = new char[1+::strlen(expr)]; + strcpy(regex,expr); + } + + ~Regular_Expression_Field() { + delete[] regex; + } +}; + +class Enumeration_Field : public NCursesFieldType { +private: + char** list; + int case_sensitive; + int non_unique_matches; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype, + list,case_sensitive,non_unique_matches)); + } +public: + Enumeration_Field(char* enums[], + bool case_sens=FALSE, + bool non_unique=FALSE) + : NCursesFieldType(TYPE_ENUM), + list(enums), + case_sensitive(case_sens?-1:0), + non_unique_matches(non_unique?-1:0) { + } +}; + +class IPV4_Address_Field : public NCursesFieldType { +private: + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype)); + } + +public: + IPV4_Address_Field() : NCursesFieldType(TYPE_IPV4) { + } +}; +// +// ------------------------------------------------------------------------- +// Abstract base class for User-Defined Fieldtypes +// ------------------------------------------------------------------------- +// +class 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 + // FIELDTYPE* element. + static FIELDTYPE* generic_fieldtype; + +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*); + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype,&f)); + } + +protected: + // Redefine this function to do a field validation. The argument + // is a reference to the field you should validate. + virtual bool field_check(NCursesFormField& f) = 0; + + // Redefine this function to do a character validation. The argument + // is the character to be validated. + virtual bool char_check (int c) = 0; + +public: + UserDefinedFieldType() : NCursesFieldType(generic_fieldtype) { + } +}; +// +// ------------------------------------------------------------------------- +// Abstract base class for User-Defined Fieldtypes with Choice functions +// ------------------------------------------------------------------------- +// +class 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 + // generic lowlevel FIELDTYPE* element. + static FIELDTYPE* generic_fieldtype_with_choice; + + // 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 *); + +protected: + // Redefine this function to do the retrieval of the next choice value. + // The argument is a reference to the field tobe examined. + virtual bool next (NCursesFormField& f) = 0; + + // Redefine this function to do the retrieval of the previous choice value. + // The argument is a reference to the field tobe examined. + virtual bool previous(NCursesFormField& f) = 0; + +public: + UserDefinedFieldType_With_Choice() { + fieldtype = generic_fieldtype_with_choice; + } +}; + +#endif // _CURSESF_H + diff --git a/c++/cursesm.cc b/c++/cursesm.cc index 8d77d19c..632ab6f9 100644 --- a/c++/cursesm.cc +++ b/c++/cursesm.cc @@ -1,38 +1,62 @@ // * this is for making emacs happy: -*-Mode: C++;-*- -/*-----------------------------------------------------------------------------+ -| The ncurses menu C++ binding is Copyright (C) 1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1997 * + ****************************************************************************/ +#include "cursesm.h" +#include "cursesapp.h" #include "internal.h" -MODULE_ID("$Id: cursesm.cc,v 1.4 1997/05/05 20:27:32 tom Exp $") - -#pragma implementation +MODULE_ID("$Id: cursesm.cc,v 1.8 1998/02/11 12:13:40 tom Exp $") + +NCursesMenuItem::~NCursesMenuItem() { + if (item) + OnError(::free_item(item)); +} -#include "cursesm.h" +bool +NCursesMenuItem::action() { + return FALSE; +}; -const int CMD_ACTION = MAX_COMMAND + 1; -const int CMD_QUIT = MAX_COMMAND + 2; +NCursesMenuCallbackItem::~NCursesMenuCallbackItem() { +} -unsigned long NCursesMenu::total_count = 0; +bool +NCursesMenuCallbackItem::action() { + if (p_fct) + return p_fct (*this); + else + return FALSE; +} /* Internal hook functions. They will route the hook * calls to virtual methods of the NCursesMenu class, @@ -40,29 +64,25 @@ unsigned long NCursesMenu::total_count = 0; * implementing a virtual method in a derived class */ void -NCursesMenu::mnu_init(MENU *m) -{ +NCursesMenu::mnu_init(MENU *m) { getHook(m)->On_Menu_Init(); } void -NCursesMenu::mnu_term(MENU *m) -{ +NCursesMenu::mnu_term(MENU *m) { getHook(m)->On_Menu_Termination(); } void -NCursesMenu::itm_init(MENU *m) -{ +NCursesMenu::itm_init(MENU *m) { NCursesMenu* M = getHook(m); - M->On_Item_Init (M->current_item ()); + M->On_Item_Init (*(M->current_item ())); } void -NCursesMenu::itm_term(MENU *m) -{ +NCursesMenu::itm_term(MENU *m) { NCursesMenu* M = getHook(m); - M->On_Item_Termination (M->current_item ()); + M->On_Item_Termination (*(M->current_item ())); } /* Construct an ITEM* array from an array of NCursesMenuItem @@ -70,43 +90,36 @@ NCursesMenu::itm_term(MENU *m) */ ITEM** NCursesMenu::mapItems(NCursesMenuItem* nitems[]) { - int itemCount = 0,lcv; - - for (lcv=0; nitems[lcv]->item; ++lcv) - ++itemCount; - - ITEM** items = new ITEM*[itemCount + 1]; - - for (lcv=0;nitems[lcv]->item;++lcv) { - items[lcv] = nitems[lcv]->item; - } - items[lcv] = NULL; - - my_items = nitems; - - if (menu) - delete[] ::menu_items(menu); - return items; -} - - -void -NCursesMenu::setItems(NCursesMenuItem* nitems[]) -{ - OnError(::set_menu_items(menu,mapItems(nitems))); + int itemCount = 0,lcv; + + for (lcv=0; nitems[lcv]->item; ++lcv) + ++itemCount; + + ITEM** items = new ITEM*[itemCount + 1]; + + for (lcv=0;nitems[lcv]->item;++lcv) { + items[lcv] = nitems[lcv]->item; + } + items[lcv] = NULL; + + my_items = nitems; + + if (menu) + delete[] ::menu_items(menu); + return items; } void NCursesMenu::InitMenu(NCursesMenuItem* nitems[], - bool with_frame) { + bool with_frame, + bool autoDelete_Items) { int mrows, mcols; - if (total_count++==0) { - raw(); - keypad(TRUE); - } + keypad(TRUE); + meta(TRUE); b_framed = with_frame; + b_autoDelete = autoDelete_Items; menu = (MENU*)0; menu = ::new_menu(mapItems(nitems)); @@ -117,7 +130,7 @@ NCursesMenu::InitMenu(NCursesMenuItem* nitems[], hook->m_user = NULL; hook->m_back = this; hook->m_owner = menu; - ::set_menu_userptr(menu,(const void*)hook); + ::set_menu_userptr(menu,(void*)hook); ::set_menu_init (menu, NCursesMenu::mnu_init); ::set_menu_term (menu, NCursesMenu::mnu_term); @@ -143,40 +156,14 @@ NCursesMenu::InitMenu(NCursesMenuItem* nitems[], void NCursesMenu::setDefaultAttributes() { - if (NumberOfColors() > 1) { - setcolor(1); - setpalette(COLOR_YELLOW,COLOR_BLUE); - setcolor(2); - setpalette(COLOR_CYAN,COLOR_BLUE); - setcolor(3); - setpalette(COLOR_WHITE,COLOR_CYAN); - ::set_menu_fore(menu, COLOR_PAIR(1)); - ::set_menu_back(menu, COLOR_PAIR(2)); - ::set_menu_grey(menu, COLOR_PAIR(3)); - } - else { - ::set_menu_fore(menu, A_BOLD); - ::set_menu_back(menu, A_NORMAL); - ::set_menu_grey(menu, A_DIM); + NCursesApplication* S = NCursesApplication::getApplication(); + if (S) { + ::set_menu_fore(menu, S->foregrounds()); + ::set_menu_back(menu, S->backgrounds()); + ::set_menu_grey(menu, S->inactives()); } } - -NCursesMenu::NCursesMenu(NCursesMenuItem* menu[]) - : NCursesPanel() { - InitMenu(menu); -} - -NCursesMenu::NCursesMenu(NCursesMenuItem* menu[], - int lines, - int cols, - int begin_y, - int begin_x, - bool with_frame) - : NCursesPanel(lines, cols, begin_y, begin_x) { - InitMenu(menu,with_frame); -} - NCursesMenu::~NCursesMenu() { UserHook* hook = (UserHook*)::menu_userptr(menu); delete hook; @@ -184,16 +171,28 @@ NCursesMenu::~NCursesMenu() { delete sub; ::set_menu_sub(menu,(WINDOW *)0); } - free_menu(menu); - - // It's essential to do this after free_menu() - delete[] ::menu_items(menu); - --total_count; + if (menu) { + ITEM** itms = ::menu_items(menu); + int cnt = count(); + + OnError(::set_menu_items(menu,(ITEM**)0)); + + if (b_autoDelete) { + if (cnt>0) { + for (int i=0; i <= cnt; i++) + delete my_items[i]; + } + delete[] my_items; + } + + ::free_menu(menu); + // It's essential to do this after free_menu() + delete[] itms; + } } void -NCursesMenu::setSubWindow(NCursesWindow& nsub) -{ +NCursesMenu::setSubWindow(NCursesWindow& nsub) { if (!isDescendant(nsub)) OnError(E_SYSTEM_ERROR); else { @@ -204,6 +203,20 @@ NCursesMenu::setSubWindow(NCursesWindow& nsub) } } +bool +NCursesMenu::set_pattern (const char *pat) { + int res = ::set_menu_pattern (menu, pat); + switch(res) { + case E_OK: + break; + case E_NO_MATCH: + return FALSE; + default: + OnError (res); + } + return TRUE; +} + // call the menu driver and do basic error checking. int NCursesMenu::driver (int c) { @@ -221,43 +234,39 @@ NCursesMenu::driver (int c) { return (res); } -bool -NCursesMenu::set_pattern (const char *pat) { - int res = ::set_menu_pattern (menu, pat); - switch(res) { - case E_OK: - break; - case E_NO_MATCH: - return FALSE; - default: - OnError (res); - } - return TRUE; -} - +static const int CMD_QUIT = MAX_COMMAND + 1; +static const int CMD_ACTION = MAX_COMMAND + 2; +// +// ------------------------------------------------------------------------- // Provide a default key virtualization. Translate the keyboard // code c into a menu request code. // The default implementation provides a hopefully straightforward // mapping for the most common keystrokes and menu requests. +// ------------------------------------------------------------------------- int NCursesMenu::virtualize(int c) { switch(c) { - case CTRL('Q') : return(CMD_QUIT); - case KEY_DOWN : - case CTRL('N') : return(REQ_NEXT_ITEM); - case KEY_UP : - case CTRL('P') : return(REQ_PREV_ITEM); - case CTRL('U') : return(REQ_SCR_ULINE); - case CTRL('D') : return(REQ_SCR_DLINE); - case CTRL('F') : return(REQ_SCR_DPAGE); - case CTRL('B') : return(REQ_SCR_UPAGE); - case CTRL('X') : return(REQ_CLEAR_PATTERN); + case CTRL('X') : return(CMD_QUIT); // eXit + + case KEY_DOWN : return(REQ_DOWN_ITEM); + case CTRL('N') : return(REQ_NEXT_ITEM); // Next + case KEY_UP : return(REQ_UP_ITEM); + case CTRL('P') : return(REQ_PREV_ITEM); // Previous + + case CTRL('U') : return(REQ_SCR_ULINE); // Up + case CTRL('D') : return(REQ_SCR_DLINE); // Down + case CTRL('F') : return(REQ_SCR_DPAGE); // Forward + case CTRL('B') : return(REQ_SCR_UPAGE); // Backward + + case CTRL('Y') : return(REQ_CLEAR_PATTERN); case CTRL('H') : return(REQ_BACK_PATTERN); case CTRL('A') : return(REQ_NEXT_MATCH); - case CTRL('Z') : return(REQ_PREV_MATCH); + case CTRL('E') : return(REQ_PREV_MATCH); case CTRL('T') : return(REQ_TOGGLE_ITEM); + case CTRL('J') : case CTRL('M') : return(CMD_ACTION); + case KEY_HOME : return(REQ_FIRST_ITEM); case KEY_LEFT : return(REQ_LEFT_ITEM); case KEY_RIGHT : return(REQ_RIGHT_ITEM); @@ -271,7 +280,7 @@ NCursesMenu::virtualize(int c) { } } -NCursesMenuItem& +NCursesMenuItem* NCursesMenu::operator()(void) { int drvCmnd; int err; @@ -283,6 +292,7 @@ NCursesMenu::operator()(void) { refresh(); while (!b_action && ((drvCmnd = virtualize((c=getch()))) != CMD_QUIT)) { + switch((err=driver(drvCmnd))) { case E_REQUEST_DENIED: On_Request_Denied(c); @@ -292,8 +302,23 @@ NCursesMenu::operator()(void) { break; case E_UNKNOWN_COMMAND: if (drvCmnd == CMD_ACTION) { - NCursesMenuItem& itm = current_item(); - b_action = itm.action(); + if (options() & O_ONEVALUE) { + NCursesMenuItem* itm = current_item(); + assert(itm); + if (itm->options() & O_SELECTABLE) + b_action = itm->action(); + else + On_Not_Selectable(c); + } + else { + int n = count(); + for(int i=0; ivalue()) { + b_action |= itm->action(); + } + } + } } else On_Unknown_Command(c); break; @@ -310,5 +335,45 @@ NCursesMenu::operator()(void) { unpost(); hide(); refresh(); - return *(my_items[::item_index (::current_item (menu))]); + if (options() & O_ONEVALUE) + return my_items[::item_index (::current_item (menu))]; + else + return NULL; } + +void +NCursesMenu::On_Menu_Init() { +} + +void +NCursesMenu::On_Menu_Termination() { +} + +void +NCursesMenu::On_Item_Init(NCursesMenuItem& item) { +} + +void +NCursesMenu::On_Item_Termination(NCursesMenuItem& item) { +} + +void +NCursesMenu::On_Request_Denied(int c) const { + beep(); +} + +void +NCursesMenu::On_Not_Selectable(int c) const { + beep(); +} + +void +NCursesMenu::On_No_Match(int c) const { + beep(); +} + +void +NCursesMenu::On_Unknown_Command(int c) const { + beep(); +} + diff --git a/c++/cursesm.h b/c++/cursesm.h index 97825f7f..03065cff 100644 --- a/c++/cursesm.h +++ b/c++/cursesm.h @@ -1,136 +1,132 @@ // * This makes emacs happy -*-Mode: C++;-*- -/*-----------------------------------------------------------------------------+ -| The ncurses menu C++ binding is Copyright (C) 1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1997 * + ****************************************************************************/ + +// $Id: cursesm.h,v 1.9 1998/02/11 12:13:41 tom Exp $ + #ifndef _CURSESM_H #define _CURSESM_H -#include #include -#include extern "C" { # include } - +// +// ------------------------------------------------------------------------- // This wraps the ITEM type of -class NCursesMenuItem -{ +// ------------------------------------------------------------------------- +// +class NCursesMenuItem { friend class NCursesMenu; - + protected: ITEM *item; - void OnError (int err) const THROWS(NCursesMenuException) - { + inline void OnError (int err) const THROWS(NCursesMenuException) { if (err != E_OK) THROW(new NCursesMenuException (err)); } public: - // Create an item. If you pass both parameters as NULL, a delimiter - // item is constructed which can be used to terminate a list of - // NCursesMenu objects. NCursesMenuItem (const char* p_name = NULL, - const char* p_descript = NULL ) - { + const char* p_descript = NULL ) { item = p_name ? ::new_item (p_name, p_descript) : (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. + virtual ~NCursesMenuItem (); // Release the items memory - virtual ~NCursesMenuItem () - { - if (item) - ::free_item (item); - } - // Name of the item - inline const char* name () const - { + inline const char* name () const { return ::item_name (item); } + // Name of the item - // Description of the item - inline const char* description () const - { + inline const char* description () const { return ::item_description (item); } - - // index of the item in an item array (or -1) - inline int index (void) const - { + // Description of the item + + inline int index (void) const { return ::item_index (item); } + // Index of the item in an item array (or -1) - // switch on an item's option - inline void options_on (Item_Options options) - { + inline void options_on (Item_Options options) { OnError (::item_opts_on (item, options)); } + // Switch on the items options - // switch off an item's option - inline void options_off (Item_Options options) - { + inline void options_off (Item_Options options) { OnError (::item_opts_off (item, options)); } + // Switch off the item's option - // return the item's options - inline Item_Options options () const - { + inline Item_Options options () const { return ::item_opts (item); } + // Retrieve the items options - // set the item's options - inline void set_options (Item_Options options) - { + inline void set_options (Item_Options options) { OnError (::set_item_opts (item, options)); } + // Set the items options - // set/reset the item's selection state - inline void set_value (bool f) - { + inline void set_value (bool f) { OnError (::set_item_value (item,f)); } + // Set/Reset the items selection state - // return the item's selection state - inline bool value () const - { + inline bool value () const { return ::item_value (item); } + // Retrieve the items selection state - // return visibility of the item - inline bool visible () const - { + inline bool visible () const { return ::item_visible (item); } + // Retrieve visibility of the item - // perform an action associated with this item; you may use this in an + virtual bool action(); + // Perform an action associated with this item; you may use this in an // user supplied driver for a menu; you may derive from this class and // overload action() to supply items with different actions. - // If an action returns true, the menu will be exited. - virtual bool action() { - return FALSE; - }; + // If an action returns true, the menu will be exited. The default action + // is to do nothing. }; // Prototype for an items callback function. @@ -139,8 +135,7 @@ 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 NCursesMenuCallbackItem : public NCursesMenuItem -{ +class NCursesMenuCallbackItem : public NCursesMenuItem { private: const ITEMCALLBACK* p_fct; @@ -152,43 +147,37 @@ public: p_fct (fct) { } - virtual ~NCursesMenuCallbackItem() { - }; + virtual ~NCursesMenuCallbackItem(); - bool action() { - if (p_fct) - return p_fct (*this); - else - return FALSE; - } + bool action(); }; - - +// +// ------------------------------------------------------------------------- +// This wraps the MENU type of +// ------------------------------------------------------------------------- +// class NCursesMenu : public NCursesPanel { protected: MENU *menu; private: - // Keep book of the number of instantiated C++ menus. - static unsigned long total_count; - NCursesWindow* sub; // the subwindow object bool b_sub_owner; // is this our own subwindow? bool b_framed; // has the menu a border? + bool b_autoDelete; // Delete items when deleting menu? NCursesMenuItem** my_items; // The array of items for this menu // This structure is used for the menu's user data field to link the // MENU* to the C++ object and to provide extra space for a user pointer. typedef struct { - const void* m_user; // the pointer for the user's data + void* m_user; // the pointer for the user's data const NCursesMenu* m_back; // backward pointer to C++ object const MENU* m_owner; } UserHook; // Get the backward pointer to the C++ object from a MENU - static inline NCursesMenu* getHook(const MENU *m) - { + static inline NCursesMenu* getHook(const MENU *m) { UserHook* hook = (UserHook*)::menu_userptr(m); assert(hook && hook->m_owner==m); return (NCursesMenu*)(hook->m_back); @@ -207,44 +196,61 @@ private: protected: // internal routines - void set_user(const void *user) - { + inline void set_user(void *user) { UserHook* uptr = (UserHook*)::menu_userptr (menu); assert (uptr && uptr->m_back==this && uptr->m_owner==menu); uptr->m_user = user; } - const void *get_user() - { + inline void *get_user() { UserHook* uptr = (UserHook*)::menu_userptr (menu); assert (uptr && uptr->m_back==this && uptr->m_owner==menu); return uptr->m_user; - } - - - void InitMenu (NCursesMenuItem* menu[], bool with_frame=FALSE); + } + + void InitMenu (NCursesMenuItem* menu[], + bool with_frame, + bool autoDeleteItems); - void OnError (int err) const THROWS(NCursesMenuException) - { + inline void OnError (int err) const THROWS(NCursesMenuException) { 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) { + } public: - // make a full window size menu - NCursesMenu (NCursesMenuItem* menu[]); + // Make a full window size menu + NCursesMenu (NCursesMenuItem* Items[], + bool with_frame=FALSE, // Reserve space for a frame? + bool autoDelete_Items=FALSE) // Autocleanup of Items? + : NCursesPanel() { + InitMenu(Items, with_frame, autoDelete_Items); + } - // make a menu with a window of this size. - NCursesMenu (NCursesMenuItem* menu[], + // Make a menu with a window of this size. + NCursesMenu (NCursesMenuItem* Items[], int lines, int cols, - int begin_y, - int begin_x, - bool with_frame=FALSE); - + 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) { + InitMenu(Items, with_frame, autoDelete_Items); + } + virtual ~NCursesMenu (); // Retrieve the menus subwindow @@ -257,77 +263,67 @@ public: void setSubWindow(NCursesWindow& sub); // Set these items for the menu - void setItems(NCursesMenuItem* nitems[]); + inline void setItems(NCursesMenuItem* Items[]) { + OnError(::set_menu_items(menu,mapItems(Items))); + } // Remove the menu from the screen - inline void unpost (void) - { + 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) - { + inline void post(bool flag = TRUE) { flag ? OnError (::post_menu(menu)) : OnError (::unpost_menu (menu)); } // Get the numer of rows and columns for this menu - inline void scale (int& mrows, int& mcols) const - { + inline void scale (int& mrows, int& mcols) const { OnError (::scale_menu (menu, &mrows, &mcols)); } // Set the format of this menu - inline void set_format(int mrows, int mcols) - { + inline void set_format(int mrows, int mcols) { OnError (::set_menu_format(menu, mrows, mcols)); } // Get the format of this menu - void menu_format(int& rows,int& cols) - { + inline void menu_format(int& rows,int& cols) { ::menu_format(menu,&rows,&cols); } - // item things - NCursesMenuItem* items() const - { + // Items of the menu + inline NCursesMenuItem* items() const { return *my_items; } // Get the number of items in this menu - int count() const - { + inline int count() const { return ::item_count(menu); } // Get the current item (i.e. the one the cursor is located) - NCursesMenuItem& current_item() const - { - return *(my_items[::item_index(::current_item(menu))]); + inline NCursesMenuItem* current_item() const { + return my_items[::item_index(::current_item(menu))]; } // Get the marker string - inline const char* mark() const - { + inline const char* mark() const { return ::menu_mark(menu); } // Set the marker string - inline void set_mark(const char *mark) - { + inline void set_mark(const char *mark) { OnError (::set_menu_mark (menu, mark)); } // Get the name of the request code c - inline static const char* request_name(int c) - { + inline static const char* request_name(int c) { return ::menu_request_name(c); } // Get the current pattern - inline char* pattern() const - { + inline char* pattern() const { return ::menu_pattern(menu); } @@ -339,91 +335,76 @@ public: virtual void setDefaultAttributes(); // Get the menus background attributes - chtype back() const - { + inline chtype back() const { return ::menu_back(menu); } // Get the menus foreground attributes - chtype fore() const - { + inline chtype fore() const { return ::menu_fore(menu); } // Get the menus grey attributes (used for unselectable items) - chtype grey() const - { + inline chtype grey() const { return ::menu_grey(menu); } // Set the menus background attributes - chtype set_background(chtype a) - { + inline chtype set_background(chtype a) { return ::set_menu_back(menu,a); } // Set the menus foreground attributes - chtype foreground(chtype a) - { + inline chtype set_foreground(chtype a) { return ::set_menu_fore(menu,a); } // Set the menus grey attributes (used for unselectable items) - chtype set_grey(chtype a) - { + inline chtype set_grey(chtype a) { return ::set_menu_grey(menu,a); } - - inline void options_on (Menu_Options opts) - { + + inline void options_on (Menu_Options opts) { OnError (::menu_opts_on (menu,opts)); } - inline void options_off(Menu_Options opts) - { + inline void options_off(Menu_Options opts) { OnError (::menu_opts_off(menu,opts)); } inline Menu_Options options() const { return ::menu_opts(menu); } - - inline void set_options (Menu_Options opts) - { + + inline void set_options (Menu_Options opts) { OnError (::set_menu_opts (menu,opts)); } - inline int pad() const - { + inline int pad() const { return ::menu_pad(menu); } - inline void set_pad (int padch) - { + inline void set_pad (int padch) { OnError (::set_menu_pad (menu, padch)); } - + // Position the cursor to the current item - inline void position_cursor () const - { + inline void position_cursor () const { OnError (::pos_menu_cursor (menu)); } // Set the current item - inline void set_current(NCursesMenuItem& I) - { + inline void set_current(NCursesMenuItem& I) { OnError (::set_current_item(menu, I.item)); } // Get the current top row of the menu - inline int top_row (void) const - { + inline int top_row (void) const { return ::top_row (menu); } // Set the current top row of the menu - inline void set_top_row (int row) - { + inline void set_top_row (int row) { OnError (::set_top_row (menu, row)); } @@ -437,7 +418,7 @@ public: spc_rows, spc_columns)); } - + // Get the spacing info for the menu inline void Spacing(int& spc_description, int& spc_rows, @@ -449,21 +430,21 @@ public: } // Decorations - void frame(const char *title=NULL, const char* btitle=NULL) { + inline void frame(const char *title=NULL, const char* btitle=NULL) { if (b_framed) NCursesPanel::frame(title,btitle); else OnError(E_SYSTEM_ERROR); } - void boldframe(const char *title=NULL, const char* btitle=NULL) { + inline void boldframe(const char *title=NULL, const char* btitle=NULL) { if (b_framed) NCursesPanel::boldframe(title,btitle); else OnError(E_SYSTEM_ERROR); } - - void label(const char *topLabel, const char *bottomLabel) { + + inline void label(const char *topLabel, const char *bottomLabel) { if (b_framed) NCursesPanel::label(topLabel,bottomLabel); else @@ -476,26 +457,18 @@ public: // Called after the menu gets repositioned in its window. // This is especially true if the menu is posted. - virtual void On_Menu_Init() - { - } + virtual void On_Menu_Init(); // Called before the menu gets repositioned in its window. // This is especially true if the menu is unposted. - virtual void On_Menu_Termination() - { - } + virtual void On_Menu_Termination(); // Called after the item became the current item - virtual void On_Item_Init(NCursesMenuItem& item) - { - } + virtual void On_Item_Init(NCursesMenuItem& item); // Called before this item is left as current item. - virtual void On_Item_Termination(NCursesMenuItem& 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 @@ -504,16 +477,16 @@ public: // Operators - NCursesMenuItem& operator[](int i) const - { + inline NCursesMenuItem* operator[](int i) const { if ( (i < 0) || (i >= ::item_count (menu)) ) OnError (E_BAD_ARGUMENT); - return *(my_items[i]); + return (my_items[i]); } // Perform the menu's operation - // Return the item where you left the selection mark. - virtual NCursesMenuItem& operator()(void); + // Return the item where you left the selection mark for a single + // selection menu, or NULL for a multivalued menu. + virtual NCursesMenuItem* operator()(void); // -------------------- // Exception handlers @@ -521,100 +494,98 @@ public: // -------------------- // Called if the request is denied - virtual void On_Request_Denied(int c) const { - beep(); - } + virtual void On_Request_Denied(int c) const; // Called if the item is not selectable - virtual void On_Not_Selectable(int c) const { - beep(); - } + virtual void On_Not_Selectable(int c) const; // Called if pattern doesn't match - virtual void On_No_Match(int c) const { - beep(); - } + virtual void On_No_Match(int c) const; // Called if the command is unknown - virtual void On_Unknown_Command(int c) const { - beep(); - } -}; - + virtual void On_Unknown_Command(int c) const; +}; +// +// ------------------------------------------------------------------------- // This is the typical C++ typesafe way to allow to attach // user data to an item of a menu. Its assumed that the user // data belongs to some class T. Use T as template argument // to create a UserItem. +// ------------------------------------------------------------------------- +// template class NCursesUserItem : public NCursesMenuItem { public: - NCursesUserItem (const char* p_name = NULL, - const char* p_descript = NULL ) - : NCursesMenuItem (p_name, p_descript) - {}; - - NCursesUserItem (const T* p_UserData, - const char* p_name, - const char* p_descript = NULL ) - : NCursesMenuItem (p_name, p_descript) - { - if (item) - OnError (::set_item_userptr (item, (const void *)p_UserData)); + NCursesUserItem (const char* p_name, + const char* p_descript = NULL, + const T* p_UserData = (T*)0) + : NCursesMenuItem (p_name, p_descript) { + if (item) + OnError (::set_item_userptr (item, (void *)p_UserData)); }; virtual ~NCursesUserItem() {}; - const T* UserData (void) const - { + inline const T* UserData (void) const { return (const T*)::item_userptr (item); }; - virtual void setUserData(const T* p_UserData) { + inline virtual void setUserData(const T* p_UserData) { if (item) - OnError (::set_item_userptr (item, (const void *)p_UserData)); + OnError (::set_item_userptr (item, (void *)p_UserData)); } }; - +// +// ------------------------------------------------------------------------- // The same mechanism is used to attach user data to a menu +// ------------------------------------------------------------------------- +// template class NCursesUserMenu : public NCursesMenu { +protected: + NCursesUserMenu( int lines, + int cols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = (T*)0) + : NCursesMenu(lines,cols,begin_y,begin_x) { + if (menu) + set_user ((void *)p_UserData); + } + public: - NCursesUserMenu (NCursesMenuItem menu[]) - : NCursesMenu (menu) - {}; - - NCursesUserMenu (const T* p_UserData, - NCursesMenuItem menu[]) - : NCursesMenu (menu) - { - if (m) - set_user ((const void *)p_UserData); + NCursesUserMenu (NCursesMenuItem Items[], + const T* p_UserData = (T*)0, + bool with_frame=FALSE, + bool autoDelete_Items=FALSE) + : NCursesMenu (Items, with_frame, autoDelete_Items) { + if (menu) + set_user ((void *)p_UserData); }; - - NCursesUserMenu (const T* p_UserData, - NCursesMenuItem menu[], + + NCursesUserMenu (NCursesMenuItem Items[], int lines, int cols, - int begin_y, - int begin_x, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = (T*)0, bool with_frame=FALSE) - : NCursesMenu (menu, lines, cols, begin_y, begin_x, with_frame) - { - if (m) - set_user ((const void *)p_UserData); + : NCursesMenu (Items, lines, cols, begin_y, begin_x, with_frame) { + if (menu) + set_user ((void *)p_UserData); }; - - virtual ~NCursesUserMenu() {}; - - const T* UserData (void) const - { - return (const T*)get_user (); + + virtual ~NCursesUserMenu() { + }; + + inline T* UserData (void) const { + return (T*)get_user (); }; - virtual void setUserData (const T* p_UserData) { - if (m) - set_user ((const void *)p_UserData); + inline virtual void setUserData (const T* p_UserData) { + if (menu) + set_user ((void *)p_UserData); } }; diff --git a/c++/cursesmain.cc b/c++/cursesmain.cc new file mode 100644 index 00000000..30e5e888 --- /dev/null +++ b/c++/cursesmain.cc @@ -0,0 +1,51 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1997 * + ****************************************************************************/ + +#include "cursesapp.h" +#include "internal.h" + +MODULE_ID("$Id: cursesmain.cc,v 1.3 1998/02/11 12:13:41 tom Exp $") + +/* This is the default implementation of main() for a NCursesApplication. + * You only have to instantiate a static NCursesApplication object in your + * main application source file and link this module with your application. + */ +int main(int argc, char* argv[]) +{ + NCursesApplication* A = NCursesApplication::getApplication(); + if (!A) + return(1); + A->handleArgs(argc,argv); + ::endwin(); + return((*A)()); +} diff --git a/c++/cursesp.cc b/c++/cursesp.cc index bb5506c0..9b3b204c 100644 --- a/c++/cursesp.cc +++ b/c++/cursesp.cc @@ -1,35 +1,54 @@ // * this is for making emacs happy: -*-Mode: C++;-*- -/* - written and - Copyright (C) 1993 by Anatoly Ivasyuk (anatoly@nick.csh.rit.edu) +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ - Modified by Juergen Pfeifer, April 1997 -*/ +/**************************************************************************** + * Author: Juergen Pfeifer 1993,1997 * + ****************************************************************************/ +#include "cursesp.h" #include "internal.h" -MODULE_ID("$Id: cursesp.cc,v 1.6 1997/05/04 01:02:08 tom Exp $") - -#pragma implementation -#include "cursesp.h" +MODULE_ID("$Id: cursesp.cc,v 1.11 1998/02/17 09:04:12 juergen Exp $") -NCursesPanel::NCursesPanel(int lines, - int cols, - int begin_y, - int begin_x) - : NCursesWindow(lines, cols, begin_y, begin_x) { - - p = ::new_panel(w); - if (!p) - OnError(ERR); - - UserHook* hook = new UserHook; - hook->m_user = NULL; - hook->m_back = this; - hook->m_owner = p; - ::set_panel_userptr(p, (const void *)hook); -} +NCursesPanel* NCursesPanel::dummy = (NCursesPanel*)0; +void NCursesPanel::init() { + p = ::new_panel(w); + if (!p) + OnError(ERR); + + UserHook* hook = new UserHook; + hook->m_user = NULL; + hook->m_back = this; + hook->m_owner = p; + ::set_panel_userptr(p, (void *)hook); +} NCursesPanel::~NCursesPanel() { UserHook* hook = (UserHook*)::panel_userptr(p); @@ -53,10 +72,16 @@ NCursesPanel::redraw() { ::doupdate(); } -void +int NCursesPanel::refresh() { ::update_panels(); - ::doupdate(); + return doupdate(); +} + +int +NCursesPanel::noutrefresh() { + ::update_panels(); + return OK; } void @@ -90,6 +115,10 @@ NCursesPanel::label(const char *tLabel, const char *bLabel) { void NCursesPanel::centertext(int row,const char *label) { - if (label) - OnError(addstr(row,(maxx() - strlen(label)) / 2, label)); + if (label) { + int x = (maxx() - strlen(label)) / 2; + if (x<0) + x=0; + OnError(addstr(row, x, label, width())); + } } diff --git a/c++/cursesp.h b/c++/cursesp.h index 9ea20aeb..f347875f 100644 --- a/c++/cursesp.h +++ b/c++/cursesp.h @@ -2,51 +2,64 @@ #ifndef _CURSESP_H #define _CURSESP_H +// $Id: cursesp.h,v 1.10 1998/02/17 09:01:28 juergen Exp $ + #include -#include extern "C" { -#include -#include +# include } class NCursesPanel : public NCursesWindow { - protected: PANEL *p; + static NCursesPanel *dummy; private: // This structure is used for the panel's user data field to link the // PANEL* to the C++ object and to provide extra space for a user pointer. typedef struct { - const void* m_user; // the pointer for the user's data + void* m_user; // the pointer for the user's data const NCursesPanel* m_back; // backward pointer to C++ object const PANEL* m_owner; // the panel itself } UserHook; + void init(); // Initialize the panel object + protected: - void set_user(const void *user) { + void set_user(void *user) { UserHook* uptr = (UserHook*)::panel_userptr (p); assert (uptr && uptr->m_back==this && uptr->m_owner==p); uptr->m_user = user; } + // Set the user pointer of the panel. - const void *get_user() { + void *get_user() { UserHook* uptr = (UserHook*)::panel_userptr (p); assert (uptr && uptr->m_back==this && uptr->m_owner==p); return uptr->m_user; } void OnError (int err) const THROWS((NCursesPanelException)) { - if (err != OK) + if (err==ERR) THROW(new NCursesPanelException (this, err)); } + // If err is equal to the curses error indicator ERR, an error handler + // is called. public: - NCursesPanel(int lines = 0, - int cols = 0, + NCursesPanel(int lines, + int cols, int begin_y = 0, - int begin_x = 0); + int begin_x = 0) + : NCursesWindow(lines,cols,begin_y,begin_x) { + init(); + } + // Create a panel with this size starting at the requested position. + + NCursesPanel() : NCursesWindow(::stdscr) { init(); } + // This constructor creates the default Panel associated with the + // ::stdscr window virtual ~NCursesPanel(); @@ -54,42 +67,81 @@ public: inline void hide() { OnError (::hide_panel(p)); } + // Hide the panel. It stays in the stack but becomes invisible. inline void show() { OnError (::show_panel(p)); } + // Show the panel, i.e. make it visible. inline void top() { OnError (::top_panel(p)); } + // Make this panel the top panel in the stack. 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. - inline void mvpan(int y, int x) { - OnError (::move_panel(p, y, x)); - } - - inline void mvwin(int y, int x) { - OnError (::move_panel(p, y, x)); + inline int mvwin(int y, int x) { + OnError(::move_panel(p, y, x)); + return OK; } inline bool hidden() const { - return ::panel_hidden (p); + return (::panel_hidden (p) ? TRUE : FALSE); + } + // Return TRUE if the panel is hidden, FALSE otherwise. + +/* The functions panel_above() and panel_below() are not reflected in + the NCursesPanel class. The reason for this is, that we cannot + assume that a panel retrieved by those operations is one wrapped + by a C++ class. Although this situation might be handled, we also + 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 { + OnError(ERR); + return *dummy; } - static void redraw(); // redraw all panels - static void refresh(); // update screen - + inline NCursesPanel& below() const { + OnError(ERR); + return *dummy; + } + + // Those two are rewrites of the corresponding virtual members of + // NCursesWindow + int refresh(); + // Propagate all panel changes to the virtual screen and update the + // physical screen. + + int noutrefresh(); + // Propagate all panel changes to the virtual screen. + + static void redraw(); + // Redraw all panels. + // decorations - virtual void frame(const char *title=NULL, const char* btitle=NULL); - virtual void boldframe(const char *title=NULL, const char* btitle=NULL); - virtual void label(const char *topLabel, const char *bottomLabel); - virtual void centertext(int row,const char *label); - -}; + 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. + + virtual void boldframe(const char* title=NULL, + const char* btitle=NULL); + // Same as frame(), but use highlighted attributes. + virtual void label(const char* topLabel, + const char* bottomLabel); + // Put the title centered in the top line and btitle in the bottom line. + + virtual void centertext(int row,const char* label); + // Put the label text centered in the specified row. +}; /* We use templates to provide a typesafe mechanism to associate * user data with a panel. A NCursesUserPanel is a panel @@ -98,33 +150,37 @@ public: template class NCursesUserPanel : public NCursesPanel { public: - NCursesUserPanel (int lines = 0, - int cols = 0, + NCursesUserPanel (int lines, + int cols, int begin_y = 0, - int begin_x = 0) - : NCursesPanel (lines, cols, begin_y, begin_x) { - }; - - NCursesUserPanel (const T* p_UserData, - int lines = 0, - int cols = 0, - int begin_y = 0, - int begin_x = 0) + int begin_x = 0, + const T* p_UserData = (T*)0) : NCursesPanel (lines, cols, begin_y, begin_x) { if (p) - set_user ((const void *)p_UserData); + set_user ((void *)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() { + if (p) + set_user((void *)p_UserData); + }; + // This creates an user panel associated with the ::stdscr and user data + // pointed to by p_UserData. + virtual ~NCursesUserPanel() {}; - const T* UserData (void) const { - return (const T*)get_user (); + T* UserData (void) const { + return (T*)get_user (); }; - + // Retrieve the user data associated with the panel. + virtual void setUserData (const T* p_UserData) { if (p) - set_user ((const void *)p_UserData); + set_user ((void *)p_UserData); } + // Associate the user panel with the user data pointed to by p_UserData. }; #endif // _CURSESP_H diff --git a/c++/cursesw.cc b/c++/cursesw.cc index d1354425..b3bd3071 100644 --- a/c++/cursesw.cc +++ b/c++/cursesw.cc @@ -22,22 +22,19 @@ modified by Juergen Pfeifer (Juergen.Pfeifer@T-Online.de) */ +#include "cursesw.h" #include "internal.h" -MODULE_ID("$Id: cursesw.cc,v 1.5 1997/05/05 20:04:59 tom Exp $") - -#pragma implementation - -#include "cursesw.h" +MODULE_ID("$Id: cursesw.cc,v 1.10 1997/10/20 21:26:35 juergen Exp $") #define COLORS_NEED_INITIALIZATION -1 #define COLORS_NOT_INITIALIZED 0 #define COLORS_MONOCHROME 1 #define COLORS_ARE_REALLY_THERE 2 - // declare static variables for the class -int NCursesWindow::count = 0; +long NCursesWindow::count = 0L; +bool NCursesWindow::b_initialized = FALSE; int NCursesWindow::scanw(const char* fmt, ...) @@ -113,10 +110,9 @@ NCursesWindow::printw(int y, int x, const char * fmt, ...) void NCursesWindow::init(void) { - noecho(); - cbreak(); leaveok(0); keypad(1); + meta(1); } void @@ -127,18 +123,32 @@ NCursesWindow::err_handler(const char *msg) const THROWS(NCursesException) void NCursesWindow::initialize() { - ::initscr(); - if (colorInitialized==COLORS_NEED_INITIALIZATION) { - colorInitialized=COLORS_NOT_INITIALIZED; - count++; - useColors(); - count--; + if (!b_initialized) { + ::initscr(); + b_initialized = TRUE; + if (colorInitialized==COLORS_NEED_INITIALIZATION) { + colorInitialized=COLORS_NOT_INITIALIZED; + useColors(); + } + ::noecho(); + ::cbreak(); } } +NCursesWindow::NCursesWindow() { + if (!b_initialized) + initialize(); + + w = (WINDOW *)0; + init(); + alloced = FALSE; + subwins = par = sib = 0; + count++; +} + NCursesWindow::NCursesWindow(int lines, int cols, int begin_y, int begin_x) { - if (count==0) + if (!b_initialized) initialize(); w = ::newwin(lines, cols, begin_y, begin_x); @@ -147,40 +157,36 @@ NCursesWindow::NCursesWindow(int lines, int cols, int begin_y, int begin_x) } init(); - alloced = 1; + alloced = TRUE; subwins = par = sib = 0; count++; } NCursesWindow::NCursesWindow(WINDOW* &window) { - if (count==0) + if (!b_initialized) initialize(); w = window; init(); - alloced = 0; + alloced = FALSE; subwins = par = sib = 0; count++; } - NCursesWindow::NCursesWindow(NCursesWindow& win, int l, int c, - int by, int bx, char absrel) + int begin_y, int begin_x, char absrel) { - if (absrel == 'r') { // relative origin - by += win.begy(); - bx += win.begx(); + if (absrel == 'a') { // absolute origin + begin_y -= win.begy(); + begin_x -= win.begx(); } // Even though we treat subwindows as a tree, the standard curses - // library needs the `subwin' call to link to the root in + // library needs the `subwin' call to link to the parent in // order to correctly perform refreshes, etc. - - NCursesWindow* root = &win; - while (root->par != 0) root = root->par; - - w = subwin(root->w, l, c, by, bx); + // Friendly enough, this also works for pads. + w = ::derwin(win.w, l, c, begin_y, begin_x); if (w == 0) { err_handler("Cannot construct subwindow"); } @@ -189,9 +195,54 @@ NCursesWindow::NCursesWindow(NCursesWindow& win, int l, int c, sib = win.subwins; win.subwins = this; subwins = 0; - alloced = 1; + alloced = TRUE; count++; } + +NCursesWindow NCursesWindow::Clone() { + WINDOW *d = ::dupwin(w); + NCursesWindow W(d); + W.subwins = subwins; + W.sib = sib; + W.par = par; + W.alloced = alloced; + return W; +} + +typedef int (*RIPOFFINIT)(NCursesWindow&); +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) { + w = win; + assert((w->_maxx+1)==cols); + alloced = FALSE; + subwins = par = sib = 0; +} + +int NCursesWindow::ripoff_init(WINDOW *w, int cols) +{ + int res = ERR; + + RIPOFFINIT init = *prip++; + if (init) { + NCursesWindow* W = new NCursesWindow(w,cols); + res = init(*W); + } + return res; +} + +int NCursesWindow::ripoffline(int ripoff_lines, + int (*init)(NCursesWindow& win)) { + int code = ::_nc_ripoffline(ripoff_lines,ripoff_init); + if (code==OK && init && ripoff_lines) { + R_INIT[r_init_idx++] = init; + } + return code; +} bool NCursesWindow::isDescendant(NCursesWindow& win) { @@ -214,7 +265,7 @@ NCursesWindow::kill_subwindows() if (p->alloced) { if (p->w != 0) ::delwin(p->w); - p->alloced = 0; + p->alloced = FALSE; } p->w = 0; // cause a run-time error if anyone attempts to use... } @@ -247,11 +298,14 @@ NCursesWindow::~NCursesWindow() if (alloced && w != 0) delwin(w); - --count; - if (count == 0) - endwin(); - else if (count < 0) { // cannot happen! + if (alloced) { + --count; + if (count == 0) { + ::endwin(); + } + else if (count < 0) { // cannot happen! err_handler("Too many windows destroyed"); + } } } @@ -264,9 +318,9 @@ void NCursesWindow::useColors(void) { if (colorInitialized == COLORS_NOT_INITIALIZED) { - if (count>0) { - if (has_colors()) { - start_color(); + if (b_initialized) { + if (::has_colors()) { + ::start_color(); colorInitialized = COLORS_ARE_REALLY_THERE; } else @@ -342,3 +396,19 @@ NCursesWindow::setcolor(short pair) } return OK; } + +extern "C" int _nc_has_mouse(void); + +bool NCursesWindow::has_mouse() const { + return ((::has_key(KEY_MOUSE) || ::_nc_has_mouse()) + ? TRUE : FALSE); +} + +NCursesPad::NCursesPad(int lines, int cols) : NCursesWindow() { + w = ::newpad(lines,cols); + if (w==(WINDOW*)0) { + count--; + err_handler("Cannot construct window"); + } + alloced = TRUE; +} diff --git a/c++/cursesw.h b/c++/cursesw.h index 41026f32..0e8e7d4d 100644 --- a/c++/cursesw.h +++ b/c++/cursesw.h @@ -2,31 +2,20 @@ #ifndef _CURSESW_H #define _CURSESW_H -#include - -#pragma interface +// $Id: cursesw.h,v 1.13 1998/01/20 16:53:50 Fred.Fish Exp $ +#include #include #include - -#if defined(__GNUG__) -# if HAVE_BUILTIN_H -# define exception builtin_exception -# include -# undef exception -# endif -#else // #elif defined (__SUNPRO_CC) -# include -# include - extern "C" { unsigned sleep(int); } -#endif - -#if HAVE_VALUES_H -# include -#endif - +#ifdef __MWERKS__ +/* This is a bogus check, stringstream is actually ANSI C++ standard, + * but old compilers like GCC don't have it, and new compilers like Metrowerks + * don't have strstream + */ +#include +#else #include -#include +#endif extern "C" { # include @@ -48,6 +37,18 @@ inline int UNDEF(addch)(chtype ch) { return addch(ch); } #define addch UNDEF(addch) #endif +#ifdef echochar +inline int UNDEF(echochar)(chtype ch) { return echochar(ch); } +#undef echochar +#define echochar UNDEF(echochar) +#endif + +#ifdef insdelln +inline int UNDEF(insdelln)(int n) { return insdelln(n); } +#undef insdelln +#define insdelln UNDEF(insdelln) +#endif + #ifdef addstr /* The (char*) cast is to hack around missing const's */ inline int UNDEF(addstr)(const char * str) { return addstr((char*)str); } @@ -86,6 +87,20 @@ inline int UNDEF(box)(WINDOW *win, int v, int h) { return box(win, v, h); } #define box UNDEF(box) #endif +#ifdef mvwhline +inline int UNDEF(mvwhline)(WINDOW *win,int y,int x,chtype c,int n) { + return mvwhline(win,y,x,c,n); } +#undef mvwhline +#define mvwhline UNDEF(mvwhline) +#endif + +#ifdef mvwvline +inline int UNDEF(mvwvline)(WINDOW *win,int y,int x,chtype c,int n) { + return mvwvline(win,y,x,c,n); } +#undef mvwvline +#define mvwvline UNDEF(mvwvline) +#endif + #ifdef clear inline int UNDEF(clear)() { return clear(); } #undef clear @@ -93,7 +108,7 @@ inline int UNDEF(clear)() { return clear(); } #endif #ifdef clearok -inline int UNDEF(clearok)(WINDOW* win, int bf) { return clearok(win, bf); } +inline int UNDEF(clearok)(WINDOW* win, bool bf) { return clearok(win, bf); } #undef clearok #define clearok UNDEF(clearok) #else @@ -131,7 +146,8 @@ inline int UNDEF(erase)() { return erase(); } #endif #ifdef flushok -inline int UNDEF(flushok)(WINDOW* _win, int _bf) { return flushok(_win, _bf); } +inline int UNDEF(flushok)(WINDOW* _win, bool _bf) { + return flushok(_win, _bf); } #undef flushok #define flushok UNDEF(flushok) #else @@ -150,8 +166,90 @@ inline int UNDEF(getstr)(char *_str) { return getstr(_str); } #define getstr UNDEF(getstr) #endif +#ifdef instr +inline int UNDEF(instr)(char *_str) { return instr(_str); } +#undef instr +#define instr UNDEF(instr) +#endif + +#ifdef innstr +inline int UNDEF(innstr)(char *_str, int n) { return innstr(_str,n); } +#undef innstr +#define innstr UNDEF(innstr) +#endif + +#ifdef mvwinnstr +inline int UNDEF(mvwinnstr)(WINDOW *win, int y, int x, char *_str, int n) { + return mvwinnstr(win,y,x,_str,n); } +#undef mvwinnstr +#define mvwinnstr UNDEF(mvwinnstr) +#endif + +#ifdef mvinnstr +inline int UNDEF(mvinnstr)(int y, int x, char *_str, int n) { + return mvinnstr(y,x,_str,n); } +#undef mvinnstr +#define mvinnstr UNDEF(mvinnstr) +#endif + +#ifdef winsstr +inline int UNDEF(winsstr)(WINDOW *w, const char *_str) { + return winsstr(w,_str); } +#undef winsstr +#define winsstr UNDEF(winsstr) +#endif + +#ifdef mvwinsstr +inline int UNDEF(mvwinsstr)(WINDOW *w, int y, int x, const char *_str) { + return mvwinsstr(w,y,x,_str); } +#undef mvwinsstr +#define mvwinsstr UNDEF(mvwinsstr) +#endif + +#ifdef insstr +inline int UNDEF(insstr)(const char *_str) { + return insstr(_str); } +#undef insstr +#define insstr UNDEF(insstr) +#endif + +#ifdef mvinsstr +inline int UNDEF(mvinsstr)(int y, int x,const char *_str) { + return mvinsstr(y,x,_str); } +#undef mvinsstr +#define mvinsstr UNDEF(mvinsstr) +#endif + +#ifdef insnstr +inline int UNDEF(insnstr)(const char *_str, int n) { + return insnstr(_str,n); } +#undef insnstr +#define insnstr UNDEF(insnstr) +#endif + +#ifdef mvwinsnstr +inline int UNDEF(mvwinsnstr)(WINDOW *w, int y, int x,const char *_str, int n) { + return mvwinsnstr(w,y,x,_str,n); } +#undef mvwinsnstr +#define mvwinsnstr UNDEF(mvwinsnstr) +#endif + +#ifdef mvinsnstr +inline int UNDEF(mvinsnstr)(int y, int x,const char *_str, int n) { + return mvinsnstr(y,x,_str,n); } +#undef mvinsnstr +#define mvinsnstr UNDEF(mvinsnstr) +#endif + +#ifdef getnstr +inline int UNDEF(getnstr)(char *_str, int n) { return getnstr(_str,n); } +#undef getnstr +#define getnstr UNDEF(getnstr) +#endif + #ifdef getyx -inline void UNDEF(getyx)(WINDOW* win, int& y, int& x) { getyx(win, y, x); } +inline void UNDEF(getyx)(const WINDOW* win, int& y, int& x) { + getyx(win, y, x); } #undef getyx #define getyx UNDEF(getyx) #endif @@ -175,7 +273,7 @@ inline int UNDEF(hline)(chtype ch, int n) { return hline(ch, n); } #endif #ifdef inch -inline int UNDEF(inch)() { return inch(); } +inline chtype UNDEF(inch)() { return inch(); } #undef inch #define inch UNDEF(inch) #endif @@ -193,7 +291,7 @@ inline int UNDEF(insertln)() { return insertln(); } #endif #ifdef leaveok -inline int UNDEF(leaveok)(WINDOW* win, int bf) { return leaveok(win, bf); } +inline int UNDEF(leaveok)(WINDOW* win, bool bf) { return leaveok(win, bf); } #undef leaveok #define leaveok UNDEF(leaveok) #else @@ -212,6 +310,12 @@ inline int UNDEF(refresh)() { return refresh(); } #define refresh UNDEF(refresh) #endif +#ifdef redrawwin +inline int UNDEF(redrawwin)(WINDOW *win) { return redrawwin(win); } +#undef redrawwin +#define redrawwin UNDEF(redrawwin) +#endif + #ifdef scrl inline int UNDEF(scrl)(int l) { return scrl(l); } #undef scrl @@ -225,7 +329,7 @@ inline int UNDEF(scroll)(WINDOW *win) { return scroll(win); } #endif #ifdef scrollok -inline int UNDEF(scrollok)(WINDOW* win, int bf) { return scrollok(win, bf); } +inline int UNDEF(scrollok)(WINDOW* win, bool bf) { return scrollok(win, bf); } #undef scrollok #define scrollok UNDEF(scrollok) #else @@ -316,12 +420,36 @@ inline int UNDEF(wstandout)(WINDOW *win) { return wstandout(win); } #define wstandout UNDEF(wstandout) #endif + #ifdef wattroff inline int UNDEF(wattroff)(WINDOW *win, int att) { return wattroff(win, att); } #undef wattroff #define wattroff UNDEF(wattroff) #endif +#ifdef chgat +inline int UNDEF(chgat)(int n,attr_t attr, short color, const void *opts) { + return chgat(n,attr,color,opts); } +#undef chgat +#define chgat UNDEF(chgat) +#endif + +#ifdef mvchgat +inline int UNDEF(mvchgat)(int y, int x, int n, + attr_t attr, short color, const void *opts) { + return mvchgat(y,x,n,attr,color,opts); } +#undef mvchgat +#define mvchgat UNDEF(mvchgat) +#endif + +#ifdef mvwchgat +inline int UNDEF(mvwchgat)(WINDOW *win, int y, int x, int n, + attr_t attr, short color, const void *opts) { + return mvwchgat(win,y,x,n,attr,color,opts); } +#undef mvwchgat +#define mvwchgat UNDEF(mvwchgat) +#endif + #ifdef wattrset inline int UNDEF(wattrset)(WINDOW *win, int att) { return wattrset(win, att); } #undef wattrset @@ -329,13 +457,13 @@ inline int UNDEF(wattrset)(WINDOW *win, int att) { return wattrset(win, att); } #endif #ifdef winch -inline chtype UNDEF(winch)(WINDOW* win) { return winch(win); } +inline chtype UNDEF(winch)(const WINDOW* win) { return winch(win); } #undef winch #define winch UNDEF(winch) #endif #ifdef mvwaddch -inline int UNDEF(mvwaddch)(WINDOW *win, int y, int x, chtype ch) +inline int UNDEF(mvwaddch)(WINDOW *win, int y, int x, const chtype ch) { return mvwaddch(win, y, x, ch); } #undef mvwaddch #define mvwaddch UNDEF(mvwaddch) @@ -355,6 +483,13 @@ inline int UNDEF(mvwaddchstr)(WINDOW *win, int y, int x, chtype *str) #define mvwaddchstr UNDEF(mvwaddchstr) #endif +#ifdef addnstr +inline int UNDEF(addnstr)(const char *str, int n) +{ return addnstr((char*)str, n); } +#undef addnstr +#define addnstr UNDEF(addnstr) +#endif + #ifdef mvwaddnstr inline int UNDEF(mvwaddnstr)(WINDOW *win, int y, int x, const char *str, int n) { return mvwaddnstr(win, y, x, (char*)str, n); } @@ -389,8 +524,16 @@ inline int UNDEF(mvwgetstr)(WINDOW *win, int y, int x, char *str) #define mvwgetstr UNDEF(mvwgetstr) #endif +#ifdef mvwgetnstr +inline int UNDEF(mvwgetnstr)(WINDOW *win, int y, int x, char *str, int n) +{return mvwgetnstr(win,y,x, str,n);} +#undef mvwgetnstr +#define mvwgetnstr UNDEF(mvwgetnstr) +#endif + #ifdef mvwinch -inline int UNDEF(mvwinch)(WINDOW *win, int y, int x) { return mvwinch(win, y, x);} +inline chtype UNDEF(mvwinch)(WINDOW *win, int y, int x) { + return mvwinch(win, y, x);} #undef mvwinch #define mvwinch UNDEF(mvwinch) #endif @@ -441,8 +584,15 @@ inline int UNDEF(mvgetstr)(int y, int x, char *str) {return mvgetstr(y, x, str); #define mvgetstr UNDEF(mvgetstr) #endif +#ifdef mvgetnstr +inline int UNDEF(mvgetnstr)(int y, int x, char *str, int n) { + return mvgetnstr(y, x, str,n);} +#undef mvgetnstr +#define mvgetnstr UNDEF(mvgetnstr) +#endif + #ifdef mvinch -inline int UNDEF(mvinch)(int y, int x) { return mvinch(y, x);} +inline chtype UNDEF(mvinch)(int y, int x) { return mvinch(y, x);} #undef mvinch #define mvinch UNDEF(mvinch) #endif @@ -490,6 +640,24 @@ inline int UNDEF(nocrmode)(void) { return nocrmode(); } #define nocrmode UNDEF(nocrmode) #endif +#ifdef getbkgd +inline chtype UNDEF(getbkgd)(const WINDOW *win) { return getbkgd(win); } +#undef getbkgd +#define getbkgd UNDEF(getbkgd) +#endif + +#ifdef bkgd +inline int UNDEF(bkgd)(chtype ch) { return bkgd(ch); } +#undef bkgd +#define bkgd UNDEF(bkgd) +#endif + +#ifdef bkgdset +inline void UNDEF(bkgdset)(chtype ch) { bkgdset(ch); } +#undef bkgdset +#define bkgdset UNDEF(bkgdset) +#endif + /* * * C++ class for windows. @@ -499,34 +667,49 @@ inline int UNDEF(nocrmode)(void) { return nocrmode(); } class NCursesWindow { - friend class NCursesMenu; friend class NCursesForm; + friend class NCursesMenu; + friend class NCursesForm; private: + static bool b_initialized; static void initialize(); - void init(); - void err_handler(const char *) const THROWS(NCursesException); + static int ripoff_init(WINDOW *,int); + void init(); + short getcolor(int getback) const; static int setpalette(short fore, short back, short pair); static int colorInitialized; - + + // This private constructor is only used during the initialization + // of windows generated by ripoffline() calls. + NCursesWindow(WINDOW* win, int cols); + protected: - static int count; // count of all active windows: + void err_handler(const char *) const THROWS(NCursesException); + // Signal an error with the given message text. + + static long count; // count of all active windows: // We rely on the c++ promise that // all otherwise uninitialized // static class vars are set to 0 - WINDOW * w; // the curses WINDOW + WINDOW* w; // the curses WINDOW - int alloced; // true if we own the WINDOW + bool alloced; // TRUE if we own the WINDOW NCursesWindow* par; // parent, if subwindow NCursesWindow* subwins; // head of subwindows list NCursesWindow* sib; // next subwindow of parent void kill_subwindows(); // disable all subwindows - + // Destroy all subwindows. + + /* Only for use by derived classes. They are then in charge to + fill the member variables correctly. */ + NCursesWindow(); + public: NCursesWindow(WINDOW* &window); // useful only for stdscr @@ -538,171 +721,476 @@ public: NCursesWindow(NCursesWindow& par,// parent window int lines, // number of lines int cols, // number of columns - int by, // absolute or relative - int bx, // origins: + int begin_y, // absolute or relative + int begin_x, // origins: char absrel = 'a');// if `a', by & bx are - // absolute screen pos, - // else if `r', they are - // relative to par origin + // absolute screen pos, else if `r', they are relative to par origin + virtual ~NCursesWindow(); - + + NCursesWindow Clone(); + // Make an exact copy of the window. + + // Initialization. static void useColors(void); // Call this routine very early if you want to have colors. + static int ripoffline(int ripoff_lines, + int (*init)(NCursesWindow& win)); + // This function is used to generate a window of ripped-of lines. + // If the argument is positive, lines are removed from the top, if it + // is negative lines are removed from the bottom. This enhances the + // lowlevel ripoffline() function because it uses the internal + // implementation that allows to remove more than just a single line. + // This function must be called before any other ncurses function. The + // creation of the window is defered until ncurses gets initialized. + // The initialization function is then called. + + // ------------------------------------------------------------------------- // terminal status + // ------------------------------------------------------------------------- int lines() const { return LINES; } - // number of lines on terminal, *not* window + // Number of lines on terminal, *not* window + int cols() const { return COLS; } - // number of cols on terminal, *not* window + // Number of cols on terminal, *not* window + + int tabsize() const { return TABSIZE; } + // Size of a tab on terminal, *not* window + static int NumberOfColors(); - // number of available colors + // Number of available colors + int colors() const { return NumberOfColors(); } - // number of available colors + // Number of available colors + // ------------------------------------------------------------------------- // window status + // ------------------------------------------------------------------------- int height() const { return maxy() + 1; } - // number of lines in this window + // Number of lines in this window + int width() const { return maxx() + 1; } - // number of cols in this window + // Number of columns in this window + int begx() const { return w->_begx; } - // smallest x coord in window + // Column of top left corner relative to stdscr + int begy() const { return w->_begy; } - // smallest y coord in window + // Line of top left corner relative to stdscr + int maxx() const { return w->_maxx; } - // largest x coord in window + // Largest x coord in window + int maxy() const { return w->_maxy; } - // largest x coord in window + // Largest y coord in window + short getcolor() const; - // actual color pair + // Actual color pair + short foreground() const { return getcolor(0); } - // actual foreground color + // Actual foreground color + short background() const { return getcolor(1); } - // actual background color + // Actual background color + int setpalette(short fore, short back); - // set color palette entry + // Set color palette entry + int setcolor(short pair); - // set actually used palette entry + // Set actually used palette entry + // ------------------------------------------------------------------------- // window positioning - int move(int y, int x) { return ::wmove(w, y, x); } - + // ------------------------------------------------------------------------- + virtual int mvwin(int begin_y, int begin_x) { + return ::mvwin(w,begin_y,begin_x); } + // Move window to new position with the new position as top left corner. + // This is virtual because it is redefined in NCursesPanel. + + // ------------------------------------------------------------------------- // coordinate positioning - void getyx(int& y, int& x) { ::getyx(w, y, x); } - int mvcur(int sy, int ey, int sx, int ex) { - return ::mvcur(sy, ey, sx, ex); } + // ------------------------------------------------------------------------- + int move(int y, int x) { return ::wmove(w, y, x); } + // Move cursor the this position + + void getyx(int& y, int& x) const { ::getyx(w, y, x); } + // Get current position of the cursor + + int mvcur(int oldrow, int oldcol, int newrow, int newcol) const { + return ::mvcur(oldrow, oldcol, newrow, newcol); } + // Perform lowlevel cursor motion that takes effect immediately. + // ------------------------------------------------------------------------- // input + // ------------------------------------------------------------------------- int getch() { return ::wgetch(w); } - int getch(int y, int x) { - return (::wmove(w, y, x)==ERR) ? ERR : ::wgetch(w); } - int getstr(char* str) { return ::wgetstr(w, str); } - int getstr(int y, int x, char* str) { - return (::wmove(w, y, x)==ERR) ? ERR : ::wgetstr(w, str); } - int scanw(const char*, ...) + // Get a keystroke from the window. + + int getch(int y, int x) { return ::mvwgetch(w,y,x); } + // Move cursor to position and get a keystroke from the window + + int getstr(char* str, int n=-1) { + return ::wgetnstr(w, str,n); } + // Read a series of characters into str until a newline or carriage return + // is received. Read at most n characters. If n is negative, the limit is + // ignored. + + int getstr(int y, int x, char* str, int n=-1) { + return ::mvwgetnstr(w,y,x,str,n); } + // Move the cursor to the requested position and then perform the getstr() + // as described above. + + int instr(char *s, int n=-1) { return ::winnstr(w,s,n); } + // Get a string of characters from the window into the buffer s. Retrieve + // at most n characters, if n is negative retrieve all characters up to the + // end of the current line. Attributes are stripped from the characters. + + int instr(int y, int x, char *s, int n=-1) { + return ::mvwinnstr(w,y,x,s,n); } + // Move the cursor to the requested position and then perform the instr() + // as described above. + + int scanw(const char* fmt, ...) + // Perform a scanw function from the window. This only works if you're + // using the GNU C++ compiler. #if __GNUG__ >= 2 __attribute__ ((format (scanf, 2, 3))); #else ; #endif - int scanw(int, int, const char*, ...) + + int scanw(int y, int x, const char* fmt, ...) + // Move the cursor to the requested position and then perform a scanw + // from the window. This nly works if you're using the GNU C++ compiler. #if __GNUG__ >= 2 __attribute__ ((format (scanf, 4, 5))); #else ; #endif + // ------------------------------------------------------------------------- // output + // ------------------------------------------------------------------------- int addch(const chtype ch) { return ::waddch(w, ch); } - int addch(int y, int x, chtype ch) { - return (::wmove(w, y, x)==ERR) ? ERR : ::waddch(w, ch); } - int addstr(const char* str) { return ::waddstr(w, (char*)str); } - int addstr(int y, int x, const char * str) { - return (::wmove(w, y, x)==ERR) ? ERR : ::waddstr(w, (char*)str); } + // Put attributed character to the window. + + int addch(int y, int x, const chtype ch) { + return ::mvwaddch(w,y,x,ch); } + // Move cursor to the requested position and then put attributed character + // to the window. + + int echochar(const chtype ch) { return ::wechochar(w,ch); } + // Put attributed character to the window and refresh it immediately. + + int addstr(const char* str, int n=-1) { + return ::waddnstr(w, (char*)str,n); } + // Write the string str to the window, stop writing if the terminating + // NUL or the limit n is reached. If n is negative, it is ignored. + + int addstr(int y, int x, const char * str, int n=-1) { + return ::mvwaddnstr(w,y,x,(char*)str,n); } + // Move the cursor to the requested position and then perform the addstr + // as described above. + int printw(const char* fmt, ...) + // Do a formatted print to the window. #if __GNUG__ >= 2 __attribute__ ((format (printf, 2, 3))); #else ; #endif + int printw(int y, int x, const char * fmt, ...) + // Move the cursor and then do a formatted print to the window. #if __GNUG__ >= 2 __attribute__ ((format (printf, 4, 5))); #else ; #endif - int inch() { return ::winch(w); } - int inch(int y, int x) { - return (::wmove(w, y, x)==ERR) ? ERR : (int) ::winch(w); } + + chtype inch() const { return ::winch(w); } + // Retrieve attributed character under the current cursor position. + + chtype inch(int y, int x) { return ::mvwinch(w,y,x); } + // Move cursor to requested position and then retrieve attributed character + // at this position. + int insch(chtype ch) { return ::winsch(w, ch); } + // Insert attributed character into the window before current cursor + // position. + int insch(int y, int x, chtype ch) { - return (::wmove(w, y, x)==ERR) ? ERR : ::winsch(w, ch); } - int insertln() { return ::winsertln(w); } - int attron(chtype at) { return ::wattron(w, at); } + return ::mvwinsch(w,y,x,ch); } + // Move cursor to requested position and then insert the attributed + // character before that position. + + int insertln() { return ::winsdelln(w,1); } + // Insert an empty line above the current line. + + int insdelln(int n=1) { return ::winsdelln(w,n); } + // If n>0 insert that many lines above the current line. If n<0 delete + // that many lines beginning with the current line. + + int insstr(const char *s, int n=-1) { + return ::winsnstr(w,s,n); } + // Insert the string into the window before the current cursor position. + // Insert stops at end of string or when the limit n is reached. If n is + // negative, it is ignored. + + int insstr(int y, int x, const char *s, int n=-1) { + return ::mvwinsnstr(w,y,x,s,n); } + // Move the cursor to the requested position and then perform the insstr() + // as described above. + + int attron (chtype at) { return ::wattron (w, at); } + // Switch on the window attributes; + int attroff(chtype at) { return ::wattroff(w, at); } + // Switch off the window attributes; + int attrset(chtype at) { return ::wattrset(w, at); } - + // Set the window attributes; + + int chgat(int n,attr_t attr, short color, const void *opts=NULL) { + return ::wchgat(w,n,attr,color,opts); } + // Change the attributes of the next n characters in the current line. If + // n is negative or greater than the number of remaining characters in the + // line, the attributes will be changed up to the end of the line. + + int chgat(int y, int x, + int n,attr_t attr, short color, const void *opts=NULL) { + return ::mvwchgat(w,y,x,n,attr,color,opts); } + // Move the cursor to the requested position and then perform chgat() as + // described above. + + // ------------------------------------------------------------------------- + // background + // ------------------------------------------------------------------------- + chtype getbkgd() const { return ::getbkgd(w); } + // Get current background setting. + + int bkgd(const chtype ch) { return ::wbkgd(w,ch); } + // Set the background property and apply it to the window. + + void bkgdset(chtype ch) { ::wbkgdset(w,ch); } + // Set the background property. + + // ------------------------------------------------------------------------- // borders - int box(chtype vert=0, chtype hor=0) { return ::box(w, vert, hor); } - + // ------------------------------------------------------------------------- + int box(chtype vert=0, chtype hor=0) { + return ::wborder(w, vert, vert, hor, hor, 0, 0 ,0, 0); } + // Draw a box around the window with the given vertical and horizontal + // drawing characters. If you specifiy a zero as character, curses will try + // to find a "nice" character. + + int border(chtype left=0, chtype right=0, + chtype top =0, chtype bottom=0, + chtype top_left =0, chtype top_right=0, + chtype bottom_left =0, chtype bottom_right=0) { + return ::wborder(w,left,right,top,bottom,top_left,top_right, + bottom_left,bottom_right); } + // Draw a border around the window with the given characters for the + // various parts of the border. If you pass zero for a character, curses + // will try to find "nice" characters. + + // ------------------------------------------------------------------------- // lines and boxes - int hline(int y, int x, chtype ch, int len) { - return (::wmove(w, y, x)==ERR) ? ERR: ::whline(w, ch, len); } - int hline(int y, int x, int len) { - return (::wmove(w, y, x)==ERR) ? ERR: ::whline(w, 0, len); } - int hline(chtype ch, int len) { return ::whline(w, ch, len); } - int hline(int len) { return ::whline(w, 0, len); } - int vline(int y, int x, chtype ch, int len) { - return (::wmove(w, y, x)==ERR) ? ERR: ::wvline(w, ch, len); } - int vline(int y, int x, int len) { - return (::wmove(w, y, x)==ERR) ? ERR: ::wvline(w, 0, len); } - int vline(chtype ch, int len) { return ::wvline(w, ch, len); } - int vline(int len) { return ::wvline(w, 0, len); } + // ------------------------------------------------------------------------- + int hline(int len, chtype ch=0) { return ::whline(w, ch, len); } + // Draw a horizontal line of len characters with the given character. If + // you pass zero for the character, curses will try to find a "nice" one. + + int hline(int y, int x, int len, chtype ch=0) { + return ::mvwhline(w,y,x,ch,len); } + // Move the cursor to the requested position and then draw a horizontal line. + + int vline(int len, chtype ch=0) { return ::wvline(w, ch, len); } + // Draw a vertical line of len characters with the given character. If + // you pass zero for the character, curses will try to find a "nice" one. + + int vline(int y, int x, int len, chtype ch=0) { + return ::mvwvline(w,y,x,ch,len); } + // Move the cursor to the requested position and then draw a vertical line. + // ------------------------------------------------------------------------- // erasure + // ------------------------------------------------------------------------- int erase() { return ::werase(w); } + // Erase the window. + int clear() { return ::wclear(w); } - int clearok(int bf) { return ::clearok(w, bf); } + // Clear the window. + + int clearok(bool bf) { return ::clearok(w, bf); } + // Set/Reset the clear flag. If set, the next refresh() will clear the + // screen. + int clrtobot() { return ::wclrtobot(w); } + // Clear to the end of the window. + int clrtoeol() { return ::wclrtoeol(w); } + // Clear to the end of the line. + int delch() { return ::wdelch(w); } - int delch(int y, int x) { - return (::wmove(w, y, x)==ERR) ? ERR : ::wdelch(w); } - int deleteln() { return ::wdeleteln(w); } - + // Delete character under the cursor. + + int delch(int y, int x) { return ::mvwdelch(w,y,x); } + // Move cursor to requested position and delete the character under the + // cursor. + + int deleteln() { return ::winsdelln(w,-1); } + // Delete the current line. + + // ------------------------------------------------------------------------- // screen control - int scroll() { return ::scroll(w); } - int scrollok(int bf) { return ::scrollok(w, bf); } - int idlok(int bf) { return ::idlok(w, bf); } - int touchwin() { return ::touchwin(w); } - int refresh() { return ::wrefresh(w); } - int leaveok(int bf) { return ::leaveok(w, bf); } - int noutrefresh() { return ::wnoutrefresh(w); } - int doupdate() { return ::doupdate(); } + // ------------------------------------------------------------------------- + int scroll(int amount=1) { return ::wscrl(w,amount); } + // Scroll amount lines. If amount is positive, scroll up, otherwise + // scroll down. + + int scrollok(bool bf) { return ::scrollok(w, bf); } + // If bf is TRUE, window scrolls if cursor is moved off the bottom + // edge of the window or a scrolling region, otherwise the cursor is left + // at the bottom line. + + int setscrreg(int from, int to) { + return ::wsetscrreg(w,from,to); } + // Define a soft scrolling region. + + int idlok(bool bf) { return ::idlok(w, bf); } + // If bf is TRUE, use insert/delete line hardware support if possible. + // Otherwise do it in software. + + + void idcok(bool bf) { ::idcok(w, bf); } + // If bf is TRUE, use insert/delete character hardware support if possible. + // Otherwise do it in software. + + int touchwin() { return ::wtouchln(w,0,height(),1); } + // Mark the whole window as modified. + + int untouchwin() { return ::wtouchln(w,0,height(),0); } + // Mark the whole window as unmodified. + + int touchln(int s, int cnt, bool changed=TRUE) { + return ::wtouchln(w,s,cnt,(int)(changed?1:0)); } + // Mark cnt lines beginning from line s as changed or unchanged, depending + // on the value of the changed flag. + + bool is_linetouched(int line) const { + return (::is_linetouched(w,line) ? TRUE:FALSE); } + // Return TRUE if line is marked as changed, FALSE otherwise + + bool is_wintouched() const { + return (::is_wintouched(w) ? TRUE:FALSE); } + // Return TRUE if window is marked as changed, FALSE otherwise + + int leaveok(bool bf) { return ::leaveok(w, bf); } + // If bf is TRUE, curses will leave the cursor after an update whereever + // it is after the update. + + int redrawln(int from, int n) { return ::wredrawln(w,from,n); } + // Redraw n lines starting from the requested line + + int redrawwin() { return ::wredrawln(w,0,height()); } + // Redraw the whole window + + int doupdate() { return ::doupdate(); } + // Do all outputs to make the physical screen looking like the virtual one + + void syncdown() { ::wsyncdown(w); } + // Propagate the changes down to all descendant windows + + void syncup() { ::wsyncup(w); } + // Propagate the changes up in the hierarchy + + void cursyncup() { ::wcursyncup(w); } + // Position the cursor in all ancestor windows corresponding to our setting + + int syncok(bool bf) { return ::syncok(w,bf); } + // If called with bf=TRUE, syncup() is called whenever the window is changed + #ifndef _no_flushok - int flushok(int bf) { return ::flushok(w, bf); } + int flushok(bool bf) { return ::flushok(w, bf); } #endif - int keypad(int bf) { return ::keypad(w, bf); } + + void immedok(bool bf) { ::immedok(w,bf); } + // If called with bf=TRUE, any change in the window will cause an + // automatic immediate refresh() + + int keypad(bool bf) { return ::keypad(w, bf); } + // If called with bf=TRUE, the application will interpret function keys. + + int meta(bool bf) { return ::meta(w,bf); } + // If called with bf=TRUE, keys may generate 8-Bit characters. Otherwise + // 7-Bit characters are generated. + int standout() { return ::wstandout(w); } + // Enable "standout" attributes + int standend() { return ::wstandend(w); } + // Disable "standout" attributes + + // ------------------------------------------------------------------------- + // The next two are virtual, because we redefine them in the + // NCursesPanel class. + // ------------------------------------------------------------------------- + virtual int refresh() { return ::wrefresh(w); } + // Propagate the changes in this window to the virtual screen and call + // doupdate(). This is redefined in NCursesPanel. + + virtual int noutrefresh() { return ::wnoutrefresh(w); } + // Propagate the changes in this window to the virtual screen. This is + // redefined in NCursesPanel. + // ------------------------------------------------------------------------- // multiple window control - int overlay(NCursesWindow &win) { + // ------------------------------------------------------------------------- + int overlay(NCursesWindow& win) { return ::overlay(w, win.w); } - int overwrite(NCursesWindow &win) { + // Overlay this window over win. + + int overwrite(NCursesWindow& win) { return ::overwrite(w, win.w); } - - + // Overwrite win with this window. + + int copywin(NCursesWindow& win, + int sminrow, int smincol, + int dminrow, int dmincol, + int dmaxrow, int dmaxcol, bool overlay=TRUE) { + return ::copywin(w,win.w,sminrow,smincol,dminrow,dmincol, + dmaxrow,dmaxcol,(int)(overlay?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. + + // ------------------------------------------------------------------------- + // Mouse related + // ------------------------------------------------------------------------- + bool has_mouse() const; + // Return TRUE if terminal supports a mouse, FALSE otherwise + + // ------------------------------------------------------------------------- // traversal support + // ------------------------------------------------------------------------- NCursesWindow* child() { return subwins; } + // Get the first child window. + NCursesWindow* sibling() { return sib; } + // Get the next child of my parent. + NCursesWindow* parent() { return par; } - - // True if win is a child of this window. + // Get my parent. + bool isDescendant(NCursesWindow& win); + // Return TRUE if win is a descendant of this. }; - +// ------------------------------------------------------------------------- // We leave this here for compatibility reasons. +// ------------------------------------------------------------------------- class NCursesColorWindow : public NCursesWindow { public: NCursesColorWindow(WINDOW* &window) // useful only for stdscr @@ -719,12 +1207,46 @@ public: NCursesColorWindow(NCursesWindow& par,// parent window int lines, // number of lines int cols, // number of columns - int by, // absolute or relative - int bx, // origins: + 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, - by,bx) { // else if `r', they are - useColors(); } // relative to par origin + begin_y,begin_x, // else if `r', they are + absrel ) { // relative to par origin + useColors(); } +}; + +class NCursesPad : public NCursesWindow { +public: + NCursesPad(int lines, int cols); + + int echochar(const chtype ch) { return ::pechochar(w,ch); } + // Put the attributed character onto the pad and immediately do a + // prefresh(). + + // For Pad's we reimplement refresh() and noutrefresh() to do nothing. + // You should call the versions with the argument list that are specific + // for Pad's. + int refresh() { return OK; }; + int noutrefresh() { return OK; }; + + int refresh(int pminrow, int pmincol, + int sminrow, int smincol, + int smaxrow, int smaxcol) { + return ::prefresh(w,pminrow,pmincol, + sminrow,smincol,smaxrow,smaxcol); + } + // The coordinates sminrow,smincol,smaxrow,smaxcol describe a rectangle + // on the screen. refresh copies a rectangle of this size beginning + // with top left corner pminrow,pmincol onto the screen and calls doupdate(). + + int noutrefresh(int pminrow, int pmincol, + int sminrow, int smincol, + int smaxrow, int smaxcol) { + return ::pnoutrefresh(w,pminrow,pmincol, + sminrow,smincol,smaxrow,smaxcol); + } + // Does the same like refresh() but without calling doupdate(). }; #endif // _CURSESW_H diff --git a/c++/cursslk.cc b/c++/cursslk.cc new file mode 100644 index 00000000..719006ec --- /dev/null +++ b/c++/cursslk.cc @@ -0,0 +1,121 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1997 * + ****************************************************************************/ + +#include "cursslk.h" +#include "cursesapp.h" +#include "internal.h" + +MODULE_ID("$Id: cursslk.cc,v 1.2 1998/02/11 12:13:41 tom Exp $") + +void Soft_Label_Key_Set::Soft_Label_Key::operator=(char *text) { + delete[] label; + label = new char[1 + ::strlen(text)]; + ::strcpy(label,text); +} + +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::format = None; + +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; + } + b_attrInit = FALSE; +} + +Soft_Label_Key_Set::Soft_Label_Key_Set() { + if (format==None) + Error("No default SLK layout"); + init(); +} + +Soft_Label_Key_Set::Soft_Label_Key_Set(Soft_Label_Key_Set::Label_Layout fmt) { + if (fmt==None) + Error("Invalid SLK Layout"); + if (count++==0) { + format = fmt; + if (ERR == ::slk_init((int)fmt)) + Error("slk_init"); + num_labels = (fmt>=PC_Style?12:8); + } + else if (fmt!=format) + Error("All SLKs must have same layout"); + init(); +} + +Soft_Label_Key_Set::~Soft_Label_Key_Set() { + if (!::isendwin()) + clear(); + delete[] slk_array; + count--; +} + +Soft_Label_Key_Set::Soft_Label_Key& Soft_Label_Key_Set::operator[](int i) { + if (i<1 || i>num_labels) + Error("Invalid Label index"); + return slk_array[i-1]; +} + +void Soft_Label_Key_Set::activate_label(int i, bool bf) { + if (!b_attrInit) { + NCursesApplication* A = NCursesApplication::getApplication(); + if (A) attrset(A->labels()); + b_attrInit = TRUE; + } + Soft_Label_Key& K = (*this)[i]; + if (ERR==::slk_set(K.num,bf?K.label:"",K.format)) + Error("slk_set"); + noutrefresh(); +} + +void Soft_Label_Key_Set::activate_labels(bool bf) { + if (!b_attrInit) { + NCursesApplication* A = NCursesApplication::getApplication(); + if (A) attrset(A->labels()); + b_attrInit = TRUE; + } + for(int i=1; i <= num_labels; i++) { + Soft_Label_Key& K = (*this)[i]; + if (ERR==::slk_set(K.num,bf?K.label:"",K.format)) + Error("slk_set"); + } + if (bf) + restore(); + else + clear(); + noutrefresh(); +} diff --git a/c++/cursslk.h b/c++/cursslk.h new file mode 100644 index 00000000..f2e25701 --- /dev/null +++ b/c++/cursslk.h @@ -0,0 +1,200 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1997 * + ****************************************************************************/ + +// $Id: cursslk.h,v 1.2 1998/02/11 12:13:41 tom Exp $ + +#ifndef _CURSSLK_H +#define _CURSSLK_H + +#include + +class Soft_Label_Key_Set { +public: + // This inner class represents the attributes of a Soft Label Key (SLK) + class Soft_Label_Key { + friend class Soft_Label_Key_Set; + public: + typedef enum { Left=0, Center=1, Right=2 } Justification; + + private: + char *label; // The Text of the Label + Justification format; // The Justification + int num; // The number of the Label + + Soft_Label_Key() : label((char*)0),format(Left),num(-1) { + } + + virtual ~Soft_Label_Key() { + delete[] label; + }; + + public: + // Set the text of the Label + void operator=(char *text); + + // Set the Justification of the Label + inline void operator=(Justification just) { + format = just; + } + + // Retrieve the text of the label + inline char* operator()(void) const { + return label; + } + }; + +public: + typedef enum { + None = -1, + Three_Two_Three = 0, + Four_Four = 1, + PC_Style = 2, + PC_Style_With_Index = 3 + } Label_Layout; + +private: + static long count; // Number of Key Sets + static Label_Layout format; // Layout of the Key Sets + static int num_labels; // Number Of Labels in Key Sets + bool b_attrInit; // Are attributes initialized + + Soft_Label_Key *slk_array; // The array of SLK's + + // Init the Key Set + void init(); + + // Activate or Deactivate Label# i, Label counting starts with 1! + void activate_label(int i, bool bf=TRUE); + + // Activate of Deactivate all Labels + void activate_labels(bool bf); + +protected: + inline void Error (const char* msg) const THROWS(NCursesException) { + THROW(new NCursesException (msg)); + } + + // Remove SLK's from screen + void clear() { + if (ERR==::slk_clear()) + Error("slk_clear"); + } + + // Restore them + void restore() { + if (ERR==::slk_restore()) + Error("slk_restore"); + } + +public: + + // Construct a Key Set, use the most comfortable layout as default. + // You must create a Soft_Label_Key_Set before you create any object of + // the NCursesWindow, NCursesPanel or derived classes. (Actually before + // ::initscr() is called). + Soft_Label_Key_Set(Label_Layout fmt); + + // This constructor assumes, that you already constructed a Key Set + // with a layout by the constructor above. This layout will be reused. + Soft_Label_Key_Set(); + + virtual ~Soft_Label_Key_Set(); + + // Get Label# i. Label counting starts with 1! + Soft_Label_Key& operator[](int i); + + // Retrieve number of Labels + inline int labels() const { return num_labels; } + + // Refresh the SLK portion of the screen + 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() { + if (ERR==::slk_noutrefresh()) + Error("slk_noutrefresh"); + } + + // Mark the whole SLK portion of the screen as modified + inline void touch() { + if (ERR==::slk_touch()) + Error("slk_touch"); + } + + // Activate Label# i + inline void show(int i) { + activate_label(i,FALSE); + activate_label(i,TRUE); + } + + // Hide Label# i + inline void hide(int i) { + activate_label(i,FALSE); + } + + // Show all Labels + inline void show() { + activate_labels(FALSE); + activate_labels(TRUE); + } + + // Hide all Labels + inline void hide() { + activate_labels(FALSE); + } + + inline void attron(attr_t attrs) { + if (ERR==::slk_attron(attrs)) + Error("slk_attron"); + } + + inline void attroff(attr_t attrs) { + if (ERR==::slk_attroff(attrs)) + Error("slk_attroff"); + } + + inline void attrset(attr_t attrs) { + if (ERR==::slk_attrset(attrs)) + Error("slk_attrset"); + } + + inline attr_t attr() const { + return ::slk_attr(); + } +}; + +#endif // _CURSSLK_H diff --git a/c++/demo.cc b/c++/demo.cc index 29b60fd7..d0728eff 100644 --- a/c++/demo.cc +++ b/c++/demo.cc @@ -3,70 +3,78 @@ * * written by Anatoly Ivasyuk (anatoly@nick.csh.rit.edu) * - * $Id: demo.cc,v 1.7 1997/05/05 20:53:41 tom Exp $ + * Demo code for NCursesMenu and NCursesForm written by + * Juergen Pfeifer + * + * $Id: demo.cc,v 1.13 1998/02/19 16:54:54 florian Exp $ */ -#include - +#include "cursesapp.h" #include "cursesm.h" +#include "cursesf.h" #if HAVE_LIBC_H # include #endif +extern "C" unsigned int sleep(unsigned int); + +// +// ------------------------------------------------------------------------- +// class SillyDemo { public: void run(int sleeptime) { - // We need to define a full screen panel for the main screen so - // that when redraws happen, the main screen actually gets redrawn. - // I think there may be a bug in the panels code which won't redraw - // the main screen otherwise. Maybe someone out there can find it... NCursesPanel *std = new NCursesPanel(); // Make a few small demo panels - NCursesPanel *u = new NCursesPanel(10,20,12,4); - NCursesPanel *v = new NCursesPanel(10,20,10,6); - NCursesPanel *w = new NCursesPanel(10,20,8,8); - NCursesPanel *x = new NCursesPanel(10,20,6,10); - NCursesPanel *y = new NCursesPanel(10,20,4,12); - NCursesPanel *z = new NCursesPanel(10,30,2,14); + NCursesPanel *u = new NCursesPanel(8,20,12,4); + NCursesPanel *v = new NCursesPanel(8,20,10,6); + NCursesPanel *w = new NCursesPanel(8,20,8,8); + NCursesPanel *x = new NCursesPanel(8,20,6,10); + NCursesPanel *y = new NCursesPanel(8,20,4,12); + NCursesPanel *z = new NCursesPanel(8,30,2,14); // Draw something on the main screen, so we can see what happens // when panels get moved or deleted. std->box(); - std->move(10,0); - std->hline('a',79); - std->move(0,40); - std->vline(20); + std->move(std->height()/2,1); + std->hline(std->width()-2); + std->move(1,std->width()/2); + std->vline(std->height()-2); + std->addch(0,std->width()/2,ACS_TTEE); + std->addch(std->height()-1,std->width()/2,ACS_BTEE); + std->addch(std->height()/2,0,ACS_LTEE); + std->addch(std->height()/2,std->width()-1,ACS_RTEE); + std->addch(std->height()/2,std->width()/2,ACS_PLUS); // Draw frames with titles around panels so that we can see where // the panels are located. - u->boldframe("Win U"); v->frame("Win V"); w->boldframe("Win W"); x->frame("Win X"); y->boldframe("Win Y"); z->frame("Win Z"); + if (NCursesApplication::getApplication()->useColors()) { + u->bkgd(' '|COLOR_PAIR(1)); + w->bkgd(' '|COLOR_PAIR(1)); + y->bkgd(' '|COLOR_PAIR(1)); + v->bkgd(' '|COLOR_PAIR(2)); + x->bkgd(' '|COLOR_PAIR(2)); + z->bkgd(' '|COLOR_PAIR(2)); + } // A refresh to any valid panel updates all panels and refreshes // the screen. Using std is just convenient - We know it's always // valid until the end of the program. std->refresh(); - - // Show that things actually come back correctly when the screen - // is cleared and the global NCursesPanel::redraw() is called. - - sleep(sleeptime); - ::clear(); // call ncurses clear() directly - ::wrefresh(stdscr); // call ncurses refresh directly sleep(sleeptime); - NCursesPanel::redraw(); // Show what happens when panels are deleted and moved. @@ -84,7 +92,7 @@ class SillyDemo // show how it looks when a panel moves sleep(sleeptime); - y->mvpan(5,30); + y->mvwin(5,30); std->refresh(); sleep(sleeptime); @@ -102,6 +110,8 @@ class SillyDemo sleep(sleeptime); delete x; + + std->clear(); std->refresh(); // Don't forget to clean up the main screen. Since this is the @@ -113,23 +123,23 @@ class SillyDemo } }; - class UserData { private: int u; public: UserData(int x) : u(x) {} - int sleeptime() const { return u; } - + int sleeptime() const { return u; } }; - +// +// ------------------------------------------------------------------------- +// template class MyAction : public NCursesUserItem { public: - MyAction (const T* p_UserData, - const char* p_name) - : NCursesUserItem(p_UserData, p_name) + MyAction (const char* p_name, + const T* p_UserData) + : NCursesUserItem(p_name, (const char*)0, p_UserData) {}; ~MyAction() {} @@ -148,26 +158,155 @@ public: } bool action() { - endwin(); return TRUE; } }; +// +// ------------------------------------------------------------------------- +// +class Label : public NCursesFormField +{ +public: + Label(const char*title, + int row, int col) + : NCursesFormField(1,(int)::strlen(title),row,col) { + set_value(title); + options_off(O_EDIT|O_ACTIVE); + } +}; +// +// ------------------------------------------------------------------------- +// +class MyFieldType : public UserDefinedFieldType { +private: + int chk; +protected: + bool field_check(NCursesFormField& f) { + return TRUE; + } + bool char_check(int c) { + return (c==chk?TRUE:FALSE); + } +public: + MyFieldType(int x) : chk(x) { + } +}; +// +// ------------------------------------------------------------------------- +// +class TestForm : public NCursesForm +{ +private: + NCursesFormField** F; + MyFieldType* mft; + Integer_Field *ift; + Enumeration_Field *eft; + + static char *weekdays[]; + +public: + TestForm() : NCursesForm(13,51,(lines()-15)/2,(cols()-53)/2) { + + F = new NCursesFormField*[10]; + mft = new MyFieldType('X'); + ift = new Integer_Field(0,1,10); + eft = new Enumeration_Field(weekdays); + + F[0] = new Label("Demo Entry Form",0,16); + F[1] = new Label("Weekday Enum",2,1); + F[2] = new Label("Number(1-10)",2,21); + F[3] = new Label("Only 'X'",2,35); + F[4] = new Label("Multiline Field (Dynamic and Scrollable)",5,1); + F[5] = new NCursesFormField(1,18,3,1); + F[6] = new NCursesFormField(1,12,3,21); + F[7] = new NCursesFormField(1,12,3,35); + F[8] = new NCursesFormField(4,46,6,1,2); + F[9] = new NCursesFormField(); + + InitForm(F,TRUE,TRUE); + boldframe(); + + F[5]->set_fieldtype(*eft); + F[6]->set_fieldtype(*ift); + + F[7]->set_fieldtype(*mft); + F[7]->set_maximum_growth(20); // max. 20 characters + F[7]->options_off(O_STATIC); // make field dynamic + + F[8]->set_maximum_growth(10); // max. 10 lines + F[8]->options_off(O_STATIC); // make field dynamic + } + + ~TestForm() { + delete mft; + delete ift; + delete eft; + } +}; + +char* TestForm::weekdays[] = { + "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", + "Friday", "Saturday", (char *)0 }; +// +// ------------------------------------------------------------------------- +// +class FormAction : public NCursesMenuItem +{ +public: + FormAction(const char *s) : NCursesMenuItem(s) { + } + bool action() { + TestForm F; + Soft_Label_Key_Set* S = new Soft_Label_Key_Set; + for(int i=1; i <= S->labels(); i++) { + char buf[5]; + ::sprintf(buf,"Frm%02d",i); + (*S)[i] = buf; // Text + (*S)[i] = Soft_Label_Key_Set::Soft_Label_Key::Left; // Justification + } + NCursesApplication::getApplication()->push(*S); + F(); + NCursesApplication::getApplication()->pop(); + return FALSE; + } +}; +// +// ------------------------------------------------------------------------- +// +class PassiveItem : public NCursesMenuItem { +public: + PassiveItem(const char* text) : NCursesMenuItem(text) { + options_off(O_SELECTABLE); + } +}; +// +// ------------------------------------------------------------------------- +// class MyMenu : public NCursesMenu { private: NCursesPanel* P; + NCursesMenuItem** I; + UserData *u; public: - MyMenu (NCursesMenuItem* menu[]) - : NCursesMenu (menu, 7, 8, 2, 2, TRUE) + MyMenu () + : NCursesMenu (8, 8, (lines()-10)/2, (cols()-10)/2) { - if (NCursesWindow::NumberOfColors() > 2) { - setcolor(1); - setpalette(COLOR_YELLOW, COLOR_BLUE); - } - - P = new NCursesPanel(1,COLS,LINES-1,0); + u = new UserData(1); + I = new NCursesMenuItem*[7]; + I[0] = new PassiveItem("One"); + I[1] = new PassiveItem("Two"); + I[2] = new MyAction ("Silly", u); + I[3] = new FormAction("Form"); + I[4] = new PassiveItem("Five"); + I[5] = new QuitItem(); + I[6] = new NCursesMenuItem(); // Terminating empty item + + InitMenu(I,TRUE,TRUE); + + P = new NCursesPanel(1,6,LINES-1,1); boldframe("Demo","Silly"); P->show(); } @@ -176,22 +315,25 @@ public: { P->hide(); delete P; + delete u; } virtual void On_Menu_Init() { + NCursesWindow W(::stdscr); P->move(0,0); P->clrtoeol(); - P->addstr("12345"); - NCursesPanel::refresh(); + for(int i=1; i<=count(); i++) + P->addch('0' + i); + P->bkgd(W.getbkgd()); + refresh(); } virtual void On_Menu_Termination() { P->move(0,0); P->clrtoeol(); - P->addstr("Menu Exit"); - NCursesPanel::refresh(); + refresh(); } virtual void On_Item_Init(NCursesMenuItem& item) @@ -200,7 +342,7 @@ public: P->attron(A_REVERSE); P->printw("%1d",1+item.index()); P->attroff(A_REVERSE); - NCursesPanel::refresh(); + refresh(); } virtual void On_Item_Termination(NCursesMenuItem& item) @@ -208,33 +350,54 @@ public: P->move(0,item.index()); P->attroff(A_REVERSE); P->printw("%1d",1+item.index()); - NCursesPanel::refresh(); + refresh(); } }; +// +// ------------------------------------------------------------------------- +// +class TestApplication : public NCursesApplication { +protected: + int titlesize() const { return 1; } + void title(); + Soft_Label_Key_Set::Label_Layout useSLKs() const { + return Soft_Label_Key_Set::PC_Style_With_Index; + } + void init_labels(Soft_Label_Key_Set& S) const; -main() -{ - UserData* u = new UserData(1); +public: + TestApplication() : NCursesApplication(TRUE) { + } - NCursesWindow::useColors(); + int run(); +}; - NCursesMenuItem** I = new NCursesMenuItem*[6]; - I[0] = new NCursesMenuItem("One"); - I[1] = new NCursesMenuItem("Two"); - I[2] = new MyAction (u, "Silly"); - I[3] = new NCursesMenuItem("Four"); - I[4] = new QuitItem(); - I[5] = new NCursesMenuItem(); - - MyMenu m(I); +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); + S[i] = buf; // Text + S[i] = Soft_Label_Key_Set::Soft_Label_Key::Left; // Justification + } +} - m(); +void TestApplication::title() { + const char * const title = "Simple C++ Binding Demo"; + const int len = ::strlen(title); + + titleWindow->bkgd(screen_titles()); + titleWindow->addstr(0,(titleWindow->cols()-len)/2,title); + titleWindow->noutrefresh(); +} - for(int i=0; i < 6; i++) { - delete I[i]; - } - delete I; - delete u; - exit(0); +int TestApplication::run() { + MyMenu M; + M(); + return 0; } + +// +// ------------------------------------------------------------------------- +// +static TestApplication Demo; diff --git a/c++/edit_cfg.sh b/c++/edit_cfg.sh new file mode 100755 index 00000000..04f4e222 --- /dev/null +++ b/c++/edit_cfg.sh @@ -0,0 +1,59 @@ +#!/bin/sh +# $Id: edit_cfg.sh,v 1.4 1998/02/11 12:13:41 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1997 +# +# Edit the default value of the etip.h file based on the autoconf-generated +# values: +# +# $1 = ncurses_cfg.h +# $2 = etip.h +# +for name in \ + HAVE_BUILTIN_H \ + HAVE_TYPEINFO \ + HAVE_VALUES_H +do + mv $2 $2.bak + if ( grep "[ ]$name[ ]1" $1 2>&1 >/dev/null) + then + sed -e 's/define '$name'.*$/ define '$name' 1/' $2.bak >$2 + else + sed -e 's/define '$name'.*$/ define '$name' 0/' $2.bak >$2 + fi + if (cmp -s $2 $2.bak) + then + echo '** same: '$name + mv $2.bak $2 + else + echo '** edit: '$name + rm -f $2.bak + fi +done diff --git a/c++/etip.h b/c++/etip.h deleted file mode 100644 index 82fb7710..00000000 --- a/c++/etip.h +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef _ETIP_H -#define _ETIP_H - -#ifdef __GNUG__ -#if HAVE_TYPEINFO -# include -#endif -#endif - -#include - -// Forward Declarations -class NCursesPanel; -class NCursesMenu; -class NCursesForm; - -class NCursesException -{ -public: - int errorno; - const char *message; - - NCursesException (const char* msg, int err) - : message(msg), errorno (err) - {}; - - NCursesException (const char* msg) - : message(msg), errorno (E_SYSTEM_ERROR) - {}; - - virtual const char *classname() const { - return "NCursesWindow"; - } -}; - -class NCursesPanelException : public NCursesException -{ -public: - const NCursesPanel* p; - - NCursesPanelException (const char *msg, int err) : - NCursesException (msg, err), - p ((NCursesPanel*)0) - {}; - - NCursesPanelException (const NCursesPanel* panel, - const char *msg, - int err) : - NCursesException (msg, err), - p (panel) - {}; - - NCursesPanelException (int err) : - NCursesException ("panel library error", err), - p ((NCursesPanel*)0) - {}; - - NCursesPanelException (const NCursesPanel* panel, - int err) : - NCursesException ("panel library error", err), - p (panel) - {}; - - virtual const char *classname() const { - return "NCursesPanel"; - } - -}; - -class NCursesMenuException : public NCursesException -{ -public: - const NCursesMenu* m; - - NCursesMenuException (const char *msg, int err) : - NCursesException (msg, err), - m ((NCursesMenu *)0) - {}; - - NCursesMenuException (const NCursesMenu* menu, - const char *msg, - int err) : - NCursesException (msg, err), - m (menu) - {}; - - NCursesMenuException (int err) : - NCursesException ("menu library error", err), - m ((NCursesMenu *)0) - {}; - - NCursesMenuException (const NCursesMenu* menu, - int err) : - NCursesException ("menu library error", err), - m (menu) - {}; - - virtual const char *classname() const { - return "NCursesMenu"; - } - -}; - -class NCursesFormException : public NCursesException -{ -public: - const NCursesForm* f; - - NCursesFormException (const char *msg, int err) : - NCursesException (msg, err), - f ((NCursesForm*)0) - {}; - - NCursesFormException (const NCursesForm* form, - const char *msg, - int err) : - NCursesException (msg, err), - f (form) - {}; - - NCursesFormException (int err) : - NCursesException ("form library error", err), - f ((NCursesForm*)0) - {}; - - NCursesFormException (const NCursesForm* form, - int err) : - NCursesException ("form library error", err), - f (form) - {}; - - virtual const char *classname() const { - return "NCursesForm"; - } - -}; - -inline void THROW(const NCursesException *e) { -#if defined(__GNUG__) - (*lib_error_handler)(e?e->classname():"",e?e->message:""); -#else // #elif defined(__SUNPRO_CC) - genericerror(1, ((e != 0) ? (char *)(e->message) : "")); -#endif -} - -#define THROWS(s) - -#endif diff --git a/c++/etip.h.in b/c++/etip.h.in new file mode 100644 index 00000000..170d6046 --- /dev/null +++ b/c++/etip.h.in @@ -0,0 +1,232 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1997 * + ****************************************************************************/ + +// $Id: etip.h.in,v 1.4 1998/02/17 09:01:38 juergen Exp $ + +#ifndef _ETIP_H +#define _ETIP_H + +// These are substituted at configure/build time +#ifndef HAVE_BUILTIN_H +#define HAVE_BUILTIN_H 0 +#endif + +#ifndef HAVE_TYPEINFO +#define HAVE_TYPEINFO 0 +#endif + +#ifndef HAVE_VALUES_H +#define HAVE_VALUES_H 0 +#endif + +#ifdef __GNUG__ +# if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) +# if HAVE_TYPEINFO +# include +# endif +# endif +#endif + +#if defined(__GNUG__) +# if HAVE_BUILTIN_H +# define exception builtin_exception +# include +# undef exception +# endif +#elif defined (__SUNPRO_CC) +# include +# include +#else +# include +#endif + +extern "C" { +#if HAVE_VALUES_H +# include +#endif + +#include +#include +#include +} + +// Forward Declarations +class NCursesPanel; +class NCursesMenu; +class NCursesForm; + +class NCursesException +{ +public: + int errorno; + const char *message; + + NCursesException (const char* msg, int err) + : message(msg), errorno (err) + {}; + + NCursesException (const char* msg) + : message(msg), errorno (E_SYSTEM_ERROR) + {}; + + virtual const char *classname() const { + return "NCursesWindow"; + } +}; + +class NCursesPanelException : public NCursesException +{ +public: + const NCursesPanel* p; + + NCursesPanelException (const char *msg, int err) : + NCursesException (msg, err), + p ((NCursesPanel*)0) + {}; + + NCursesPanelException (const NCursesPanel* panel, + const char *msg, + int err) : + NCursesException (msg, err), + p (panel) + {}; + + NCursesPanelException (int err) : + NCursesException ("panel library error", err), + p ((NCursesPanel*)0) + {}; + + NCursesPanelException (const NCursesPanel* panel, + int err) : + NCursesException ("panel library error", err), + p (panel) + {}; + + virtual const char *classname() const { + return "NCursesPanel"; + } + +}; + +class NCursesMenuException : public NCursesException +{ +public: + const NCursesMenu* m; + + NCursesMenuException (const char *msg, int err) : + NCursesException (msg, err), + m ((NCursesMenu *)0) + {}; + + NCursesMenuException (const NCursesMenu* menu, + const char *msg, + int err) : + NCursesException (msg, err), + m (menu) + {}; + + NCursesMenuException (int err) : + NCursesException ("menu library error", err), + m ((NCursesMenu *)0) + {}; + + NCursesMenuException (const NCursesMenu* menu, + int err) : + NCursesException ("menu library error", err), + m (menu) + {}; + + virtual const char *classname() const { + return "NCursesMenu"; + } + +}; + +class NCursesFormException : public NCursesException +{ +public: + const NCursesForm* f; + + NCursesFormException (const char *msg, int err) : + NCursesException (msg, err), + f ((NCursesForm*)0) + {}; + + NCursesFormException (const NCursesForm* form, + const char *msg, + int err) : + NCursesException (msg, err), + f (form) + {}; + + NCursesFormException (int err) : + NCursesException ("form library error", err), + f ((NCursesForm*)0) + {}; + + NCursesFormException (const NCursesForm* form, + int err) : + NCursesException ("form library error", err), + f (form) + {}; + + virtual const char *classname() const { + return "NCursesForm"; + } + +}; + +#if !(defined(__GNUG__)||defined(__SUNPRO_CC)) +# include + extern "C" void exit(int); +#endif + +inline void THROW(const NCursesException *e) { +#if defined(__GNUG__) +# if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) + (*lib_error_handler)(e?e->classname():"",e?e->message:""); +#else + throw *e; +#endif +#elif defined(__SUNPRO_CC) + genericerror(1, ((e != 0) ? (char *)(e->message) : "")); +#else + if (e) + cerr << e->message << endl; + exit(0); +#endif +} + +#define THROWS(s) + +#endif // _ETIP_H diff --git a/c++/headers b/c++/headers new file mode 100644 index 00000000..3470386a --- /dev/null +++ b/c++/headers @@ -0,0 +1,39 @@ +# C++ headers +# $Id: headers,v 1.2 1998/02/11 12:13:40 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1997 +# +$(srcdir)/cursesapp.h +$(srcdir)/cursesf.h +$(srcdir)/cursesm.h +$(srcdir)/cursesp.h +$(srcdir)/cursesw.h +$(srcdir)/cursslk.h +etip.h diff --git a/c++/internal.h b/c++/internal.h index a2df9f61..9e5de1b4 100644 --- a/c++/internal.h +++ b/c++/internal.h @@ -1,7 +1,40 @@ -#ifndef CPLUS_INTERNAL_H -#define CPLUS_INTERNAL_H 1 +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -#include +/**************************************************************************** + * Author: Juergen Pfeifer 1997 * + ****************************************************************************/ + +// $Id: internal.h,v 1.3 1998/02/11 12:13:40 tom Exp $ + +#ifndef _CPLUS_INTERNAL_H +#define _CPLUS_INTERNAL_H 1 #ifdef USE_RCS_IDS #define MODULE_ID(id) static const char Ident[] = id; diff --git a/c++/modules b/c++/modules index 3d21ec02..55048d9e 100644 --- a/c++/modules +++ b/c++/modules @@ -1,24 +1,42 @@ # Program modules -################################################################################ -# Copyright 1995 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ -cursesm c++ $(srcdir) $(srcdir)/cursesm.h $(srcdir)/cursesp.h $(srcdir)/cursesw.h $(srcdir)/etip.h -cursesp c++ $(srcdir) $(srcdir)/cursesp.h $(srcdir)/cursesw.h $(srcdir)/etip.h -cursesw c++ $(srcdir) $(srcdir)/cursesw.h $(srcdir)/etip.h -demo c++ $(srcdir) $(srcdir)/cursesp.h $(srcdir)/cursesw.h $(srcdir)/etip.h +# $Id: modules,v 1.5 1998/02/11 12:13:41 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1995,1997 +# + +@ base +cursesf c++ $(srcdir) $(cursesf_h) $(cursesapp_h) +cursesm c++ $(srcdir) $(cursesm_h) $(cursesapp_h) +cursesp c++ $(srcdir) $(cursesp_h) +cursesw c++ $(srcdir) $(cursesw_h) +cursslk c++ $(srcdir) $(cursslk_h) $(cursesapp_h) +cursesapp c++ $(srcdir) $(cursesapp_h) +cursesmain c++ $(srcdir) $(cursesapp_h) +demo c++ $(srcdir) $(cursesf_h) $(cursesm_h) $(cursesapp_h) diff --git a/config.guess b/config.guess new file mode 100755 index 00000000..5bb9a89d --- /dev/null +++ b/config.guess @@ -0,0 +1,696 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc. +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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. + +# Written by Per Bothner . +# The master version of this file is at the FSF in /home/gd/gnu/lib. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit system type (host/target name). +# +# Only a few systems have been added to this list; please add others +# (but try to keep the structure clean). +# + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 8/24/94.) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + alpha:OSF1:*:*) + # 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 alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'` + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-cbm-sysv4 + exit 0;; + amiga:NetBSD:*:*) + echo m68k-cbm-netbsd${UNAME_RELEASE} + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-cbm-openbsd${UNAME_RELEASE} + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + Pyramid*:OSx*:*:*|MIS*:OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + 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 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + 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 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:NetBSD:*:*) + echo m68k-atari-netbsd${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-atari-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:NetBSD:*:*) + echo m68k-sun-netbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-sun-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:NetBSD:*:*) + echo m68k-apple-netbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-apple-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >dummy.c + int main (argc, argv) int argc; char **argv; { + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + ${CC-cc} dummy.c -o dummy \ + && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ + -o ${TARGET_BINARY_INTERFACE}x = x ] ; then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????: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 ' + i?86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo rs6000-ibm-aix3.2.5 + 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 ;; + *:AIX:*:4) + if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=4.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[3478]??:HP-UX:*:*) + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;; + 9000/8?? ) HP_ARCH=hppa1.0 ;; + esac + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i?86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F300:UNIX_System_V:*:*) + FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + F301:UNIX_System_V:*:*) + echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` + exit 0 ;; + hp3[0-9][05]:NetBSD:*:*) + echo m68k-hp-netbsd${UNAME_RELEASE} + exit 0 ;; + hp3[0-9][05]:OpenBSD:*:*) + echo m68k-hp-openbsd${UNAME_RELEASE} + exit 0 ;; + i?86:BSD/386:*:* | *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:NetBSD:*:*) + echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo i386-pc-cygwin32 + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin32 + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. + ld_help_string=`ld --help 2>&1` + if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then + echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then + echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then + echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then + echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then + echo "powerpc-unknown-linux-gnu" ; exit 0 + elif test "${UNAME_MACHINE}" = "alpha" ; then + echo alpha-unknown-linux-gnu ; exit 0 + elif test "${UNAME_MACHINE}" = "sparc" ; then + echo sparc-unknown-linux-gnu ; exit 0 + else + # Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us + # useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout. + test ! -d /usr/lib/ldscripts/. \ + && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 + # Determine whether the default compiler is a.out or elf + cat >dummy.c </dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + fi ;; +# 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. + i?86:DYNIX/ptx:4*:*) + echo i386-sequent-sysv4 + exit 0 ;; + i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i?86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/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 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*: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 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i?86:LynxOS:2.*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +#if !defined (ultrix) + printf ("vax-dec-bsd\n"); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 +rm -f dummy.c dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +#echo '(Unable to guess system type)' 1>&2 + +exit 1 diff --git a/config.sub b/config.sub new file mode 100755 index 00000000..04325249 --- /dev/null +++ b/config.sub @@ -0,0 +1,927 @@ +#! /bin/sh +# Configuration validation subroutine script, version 1.1. +# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, 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. + +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +if [ x$1 = x ] +then + echo Configuration name missing. 1>&2 + echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 + echo "or $0 ALIAS" 1>&2 + echo where ALIAS is a recognized configuration type. 1>&2 + exit 1 +fi + +# First pass through any local machine types. +case $1 in + *local*) + echo $1 + exit 0 + ;; + *) + ;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + linux-gnu*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple) + os= + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \ + | arme[lb] | pyramid \ + | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \ + | alpha | we32k | ns16k | clipper | i370 | sh \ + | powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \ + | pdp11 | mips64el | mips64orion | mips64orionel \ + | sparc | sparclet | sparclite | sparc64) + basic_machine=$basic_machine-unknown + ;; + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i[3456]86) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \ + | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \ + | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \ + | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \ + | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* | f301-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-cbm + ;; + amigados) + basic_machine=m68k-cbm + os=-amigados + ;; + amigaunix | amix) + basic_machine=m68k-cbm + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [ctj]90-cray) + basic_machine=c90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + os=-mvs + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[3456]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i[3456]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i[3456]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i[3456]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + miniframe) + basic_machine=m68000-convergent + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + np1) + basic_machine=np1-gould + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5) + basic_machine=i586-intel + ;; + pentiumpro | p6) + basic_machine=i686-intel + ;; + pentium-* | p5-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + k5) + # We don't have specific support for AMD's K5 yet, so just call it a Pentium + basic_machine=i586-amd + ;; + nexen) + # We don't have specific support for Nexgen yet, so just call it a Pentium + basic_machine=i586-nexgen + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=rs6000-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + mips) + basic_machine=mips-mips + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sparc) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # 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|'` + ;; + -solaris) + os=-solaris2 + ;; + -unixware* | svr4*) + os=-sysv4 + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -linux-gnu* | -uxpv*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -xenix) + os=-xenix + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-semi) + os=-aout + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-ibm) + os=-aix + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigados + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f301-fujitsu) + os=-uxpv + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -hpux*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os diff --git a/configure b/configure index c494a667..6304cea7 100755 --- a/configure +++ b/configure @@ -1,10 +1,9 @@ #! /bin/sh -# From configure.in Revision: 1.64 - +# From configure.in Revision: 1.126 # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12.970309 +# Generated automatically using autoconf version 2.12.971230 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -14,56 +13,6 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: -ac_help="$ac_help - --enable-add-ons=DIR... used to check if we are a glibc add-on." -ac_help="$ac_help - --without-cxx suppress check for C++" -ac_help="$ac_help - --with-install-prefix prefixes actual install-location" -ac_help="$ac_help - --with-shared generate shared-libraries" -ac_help="$ac_help - --with-normal generate normal-libraries (default)" -ac_help="$ac_help - --with-debug generate debug-libraries (default)" -ac_help="$ac_help - --with-profile generate profile-libraries" -ac_help="$ac_help - --with-dbmalloc test: use Conor Cahill's dbmalloc library" -ac_help="$ac_help - --with-dmalloc test: use Gray Watson's dmalloc library" -ac_help="$ac_help - --with-gpm use Alessandro Rubini's GPM library" -ac_help="$ac_help - --disable-overwrite leave out the link to -lcurses" -ac_help="$ac_help - --enable-big-core assume machine has lots of memory" -ac_help="$ac_help - --enable-termcap compile in termcap fallback support" -ac_help="$ac_help - --enable-getcap fast termcap load, no xrefs to terminfo" -ac_help="$ac_help - --enable-getcap-cache cache translated termcaps in ~/.terminfo" -ac_help="$ac_help - --enable-symlinks make tic use symbolic links not hard links" -ac_help="$ac_help - --enable-bsdpad recognize BSD-style prefix padding" -ac_help="$ac_help - --enable-const compile with extra/non-standard const" -ac_help="$ac_help - --with-rcs-ids build: compile-in RCS identifiers" -ac_help="$ac_help - --enable-echo build: display \"compiling\" commands (default)" -ac_help="$ac_help - --enable-warnings build: turn on GCC compiler warnings" -ac_help="$ac_help - --enable-assertions test: turn on generation of assertion code" -ac_help="$ac_help - --disable-leaks test: suppress permanent memory-leaks" -ac_help="$ac_help - --enable-expanded test: generate functions for certain macros" -ac_help="$ac_help - --disable-macros test: use functions rather than macros" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -233,9 +182,62 @@ Features and packages: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi +cat <&6 +cf_cv_abi_version=${NCURSES_MAJOR} +cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR} +echo "$ac_t""Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version (`date`)" 1>&6 + @@ -586,18 +590,87 @@ echo "$ac_t""Configuring NCURSES $nc_cv_rel_version ABI $nc_cv_abi_version (`dat +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +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 + +# Make sure we can run config.sub. +if $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:622: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`$ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`$ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + system_name="$host_os" +else + system_name="`(uname -s -r) 2>/dev/null`" + if test -z "$system_name" ; then + system_name="`(hostname) 2>/dev/null`" + fi +fi +test -n "$system_name" && cat >> confdefs.h <&6 else - -nc_cv_systype="`(uname -s || hostname || echo unknown) 2>/dev/null |sed -e s'/[:\/.-]/_/'g | sed 1q`" -if test -z "$nc_cv_systype"; then nc_cv_systype=unknown;fi + cf_cv_system_name="$system_name" +fi + + +test -z "$system_name" && system_name="$cf_cv_system_name" +test -n "$cf_cv_system_name" && echo "$ac_t"""Configuring for $cf_cv_system_name"" 1>&6 +if test ".$system_name" != ".$cf_cv_system_name" ; then + echo "$ac_t""Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" 1>&6 + { echo "configure: error: "Please remove config.cache and try again."" 1>&2; exit 1; } fi -echo "$ac_t""System type is $nc_cv_systype" 1>&6 + +# Check whether --with-system-type or --without-system-type was given. +if test "${with_system_type+set}" = set; then + withval="$with_system_type" + echo "configure: warning: overriding system type to $withval" 1>&2 + cf_cv_system_name=$withval +fi # We need a configure script only when compiling as part of GNU C library. @@ -609,6 +682,7 @@ echo "$ac_t""System type is $nc_cv_systype" 1>&6 # So we try here to find out whether we are called from the glibc configure # or by a user. # + # Check whether --enable-add-ons or --disable-add-ons was given. if test "${enable_add_ons+set}" = set; then enableval="$enable_add_ons" @@ -619,7 +693,6 @@ fi if test x"$glibc_add_on" = "xyes" ; then -if test -f $srcdir/../glibcbug.in; then rm -f $srcdir/Banner # We are in glibc. rm -f $srcdir/Makefile @@ -629,53 +702,31 @@ if test -f $srcdir/../glibcbug.in; then 's/^[ ]*ncurses-version[ ]*=[ ]*\([^ ^ ]*\)[ ]*$/\1/'`" > $srcdir/Banner exit 0 fi -fi ### Save the given $CFLAGS to allow user-override. -nc_user_CFLAGS="$CFLAGS" - -### Derive the system name, as a check for reusing the autoconf cache -system_name="`(uname -s -r || hostname || echo unknown) 2>/dev/null`" -if test -n "$system_name" ; then - cat >> confdefs.h <&6 -else - nc_cv_system_name="$system_name" -fi - -test -z "$system_name" && system_name="$nc_cv_system_name" -test -n "$nc_cv_system_name" && echo "$ac_t"""Configuring for $nc_cv_system_name"" 1>&6 - -if test ".$system_name" != ".$nc_cv_system_name" ; then - echo "$ac_t"""Cached system name does not agree with actual"" 1>&6 - { echo "configure: error: "Please remove config.cache and try again."" 1>&2; exit 1; } -fi +cf_user_CFLAGS="$CFLAGS" ### Default install-location echo $ac_n "checking for prefix""... $ac_c" 1>&6 -echo "configure:665: checking for prefix" >&5 +echo "configure:713: checking for prefix" >&5 if test "x$prefix" = "xNONE" ; then - case "$nc_cv_systype" in + case "$cf_cv_system_name" in # non-vendor systems don't have a conflict - NetBSD|FreeBSD|Linux) prefix=/usr + openbsd*|netbsd*|freebsd*|linux*) + prefix=/usr ;; *) prefix=$ac_default_prefix ;; esac fi echo "$ac_t""$prefix" 1>&6 + +if test "x$prefix" = "xNONE" ; then echo $ac_n "checking for default include-directory""... $ac_c" 1>&6 -echo "configure:677: checking for default include-directory" >&5 +echo "configure:728: checking for default include-directory" >&5 test -n "$verbose" && echo 1>&6 -for nc_symbol in \ +for cf_symbol in \ $includedir \ $includedir/ncurses \ $prefix/include \ @@ -685,24 +736,25 @@ for nc_symbol in \ /usr/include \ /usr/include/ncurses do - nc_dir=`eval echo $nc_symbol` - if test -f $nc_dir/curses.h ; then - if ( fgrep NCURSES_VERSION $nc_dir/curses.h 2>&1 >/dev/null ) ; then - includedir="$nc_symbol" + cf_dir=`eval echo $cf_symbol` + if test -f $cf_dir/curses.h ; then + if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then + includedir="$cf_symbol" test -n "$verbose" && echo $ac_n " found " 1>&6 break fi fi - test -n "$verbose" && echo " tested $nc_dir" 1>&6 + test -n "$verbose" && echo " tested $cf_dir" 1>&6 done echo "$ac_t""$includedir" 1>&6 +fi ### Checks for programs. # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:706: checking for $ac_word" >&5 +echo "configure:758: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -731,7 +783,7 @@ 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:735: checking for $ac_word" >&5 +echo "configure:787: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -779,7 +831,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:783: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:835: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -789,11 +841,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -813,12 +865,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:817: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:869: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:822: checking whether we are using GNU C" >&5 +echo "configure:874: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -827,7 +879,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:831: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:883: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -842,7 +894,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:846: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:898: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -871,11 +923,11 @@ fi if test -n "$GCC" ; then echo $ac_n "checking version of gcc""... $ac_c" 1>&6 -echo "configure:875: checking version of gcc" >&5 +echo "configure:927: checking version of gcc" >&5 eval "$CC --version" fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:879: checking how to run the C preprocessor" >&5 +echo "configure:931: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -890,13 +942,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:900: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:952: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -907,13 +959,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:917: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:969: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -937,13 +989,13 @@ echo "$ac_t""$CPP" 1>&6 if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:941: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:993: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext < Autoconf TIOCGETP @@ -961,7 +1013,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -983,7 +1035,7 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:987: checking for POSIXized ISC" >&5 +echo "configure:1039: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -1003,20 +1055,57 @@ else ISC= fi +# Extract the first word of "ldconfig", so it can be a program name with args. +set dummy ldconfig; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1062: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_LDCONFIG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$LDCONFIG" in + /*) + ac_cv_path_LDCONFIG="$LDCONFIG" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH:/sbin:/usr/sbin$ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_LDCONFIG="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +LDCONFIG="$ac_cv_path_LDCONFIG" +if test -n "$LDCONFIG"; then + echo "$ac_t""$LDCONFIG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +echo $ac_n "checking if you want to build with C++""... $ac_c" 1>&6 +echo "configure:1092: checking if you want to build with C++" >&5 # Check whether --with-cxx or --without-cxx was given. if test "${with_cxx+set}" = set; then withval="$with_cxx" - : + cf_with_cxx=$withval +else + cf_with_cxx=yes fi -if test "X$withval" != Xno ; then +echo "$ac_t""$cf_with_cxx" 1>&6 +if test "X$cf_with_cxx" != Xno ; then for ac_prog in $CCC c++ g++ gcc CC cxx cc++ 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1020: checking for $ac_word" >&5 +echo "configure:1109: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1047,7 +1136,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1051: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:1140: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1057,11 +1146,11 @@ ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $L cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1087,12 +1176,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1091: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1180: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:1096: checking whether we are using GNU C++" >&5 +echo "configure:1185: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1101,7 +1190,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1105: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1194: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -1116,7 +1205,7 @@ if test $ac_cv_prog_gxx = yes; then ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:1120: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:1209: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1144,13 +1233,33 @@ else fi fi -if test -n "$GXX" ; then case "`${CXX-g++} --version`" in 1*|2.[0-6]*) GXX=""; CXX=""; ac_cv_prog_gxx=no; nc_cxx_library=no ; echo No: templates do not work;; esac; fi +if test -n "$GXX" ; then case "`${CXX-g++} --version`" in 1*|2.[0-6]*) GXX=""; CXX=""; ac_cv_prog_gxx=no; cf_cxx_library=no ; echo No: templates do not work;; esac; fi + +echo $ac_n "checking if you want to build programs such as tic""... $ac_c" 1>&6 +echo "configure:1240: checking if you want to build programs such as tic" >&5 + +# Check whether --with-progs or --without-progs was given. +if test "${with_progs+set}" = set; then + withval="$with_progs" + cf_with_progs=$withval +else + cf_with_progs=yes +fi + +echo "$ac_t""$cf_with_progs" 1>&6 + +modules_to_build="ncurses" +if test "X$cf_with_progs" != Xno ; then +modules_to_build="$modules_to_build progs tack" +fi +modules_to_build="$modules_to_build panel menu form" + 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1154: checking for $ac_word" >&5 +echo "configure:1263: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1179,7 +1288,7 @@ test -n "$AWK" && break done echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1183: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1292: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1205,25 +1314,6 @@ else SET_MAKE="MAKE=${MAKE-make}" fi -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } -fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -1235,7 +1325,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1239: checking for a BSD compatible install" >&5 +echo "configure:1329: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1288,14 +1378,58 @@ case $INSTALL in /*) ;; *) - nc_dir=`echo $INSTALL|sed -e 's%/[^/]*$%%'` - test -z "$nc_dir" && nc_dir=. - INSTALL=`cd $nc_dir;pwd`/`echo $INSTALL | sed -e 's:^.*/::'` + cf_dir=`echo $INSTALL|sed -e 's%/[^/]*$%%'` + test -z "$cf_dir" && cf_dir=. + INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's:^.*/::'` ;; esac +echo $ac_n "checking for long file names""... $ac_c" 1>&6 +echo "configure:1389: checking for long file names" >&5 +if eval "test \"`echo '$''{'ac_cv_sys_long_file_names'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_sys_long_file_names=yes +# Test for long file names in all the places we know might matter: +# . the current directory, where building will happen +# $prefix/lib where we will be installing things +# $exec_prefix/lib likewise +# eval it to expand exec_prefix. +# $TMPDIR if set, where it might want to write temporary files +# if $TMPDIR is not set: +# /tmp where it might want to write temporary files +# /var/tmp likewise +# /usr/tmp likewise +if test -n "$TMPDIR" && test -d "$TMPDIR" && test -w "$TMPDIR"; then + ac_tmpdirs="$TMPDIR" +else + ac_tmpdirs='/tmp /var/tmp /usr/tmp' +fi +for ac_dir in . $ac_tmpdirs `eval echo $prefix/lib $exec_prefix/lib` ; do + test -d $ac_dir || continue + test -w $ac_dir || continue # It is less confusing to not echo anything here. + (echo 1 > $ac_dir/conftest9012345) 2>/dev/null + (echo 2 > $ac_dir/conftest9012346) 2>/dev/null + val=`cat $ac_dir/conftest9012345 2>/dev/null` + if test ! -f $ac_dir/conftest9012345 || test "$val" != 1; then + ac_cv_sys_long_file_names=no + rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null + break + fi + rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null +done +fi + +echo "$ac_t""$ac_cv_sys_long_file_names" 1>&6 +if test $ac_cv_sys_long_file_names = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_LONG_FILE_NAMES 1 +EOF + +fi + echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1299: checking whether ln -s works" >&5 +echo "configure:1433: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1318,7 +1452,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1322: checking for $ac_word" >&5 +echo "configure:1456: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1349,7 +1483,7 @@ 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1353: checking for $ac_word" >&5 +echo "configure:1487: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LINT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1382,7 +1516,7 @@ 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1386: checking for $ac_word" >&5 +echo "configure:1520: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1412,145 +1546,142 @@ done -if eval "test \"`echo '$''{'nc_cv_subst_LD'+set}'`\" = set"; then +if eval "test \"`echo '$''{'cf_cv_subst_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo $ac_n "checking for loader (symbol LD)""... $ac_c" 1>&6 -echo "configure:1421: checking for loader (symbol LD)" >&5 +echo "configure:1555: checking for loader (symbol LD)" >&5 test -z "$LD" && LD=ld echo "$ac_t""$LD" 1>&6 -nc_cv_subst_LD=$LD +cf_cv_subst_LD=$LD fi -LD=${nc_cv_subst_LD} +LD=${cf_cv_subst_LD} -if eval "test \"`echo '$''{'nc_cv_subst_AR'+set}'`\" = set"; then +if eval "test \"`echo '$''{'cf_cv_subst_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo $ac_n "checking for archiver (symbol AR)""... $ac_c" 1>&6 -echo "configure:1435: checking for archiver (symbol AR)" >&5 +echo "configure:1569: checking for archiver (symbol AR)" >&5 test -z "$AR" && AR=ar echo "$ac_t""$AR" 1>&6 -nc_cv_subst_AR=$AR +cf_cv_subst_AR=$AR fi -AR=${nc_cv_subst_AR} +AR=${cf_cv_subst_AR} -if eval "test \"`echo '$''{'nc_cv_subst_AR_OPTS'+set}'`\" = set"; then +if eval "test \"`echo '$''{'cf_cv_subst_AR_OPTS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo $ac_n "checking for archiver options (symbol AR_OPTS)""... $ac_c" 1>&6 -echo "configure:1449: checking for archiver options (symbol AR_OPTS)" >&5 +echo "configure:1583: checking for archiver options (symbol AR_OPTS)" >&5 test -z "$AR_OPTS" && AR_OPTS=rv echo "$ac_t""$AR_OPTS" 1>&6 -nc_cv_subst_AR_OPTS=$AR_OPTS +cf_cv_subst_AR_OPTS=$AR_OPTS fi -AR_OPTS=${nc_cv_subst_AR_OPTS} +AR_OPTS=${cf_cv_subst_AR_OPTS} echo $ac_n "checking for makeflags variable""... $ac_c" 1>&6 -echo "configure:1461: checking for makeflags variable" >&5 -if eval "test \"`echo '$''{'nc_cv_makeflags'+set}'`\" = set"; then +echo "configure:1595: checking for makeflags variable" >&5 +if eval "test \"`echo '$''{'cf_cv_makeflags'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - nc_cv_makeflags='' - for nc_option in '$(MFLAGS)' '-$(MAKEFLAGS)' + cf_cv_makeflags='' + for cf_option in '$(MFLAGS)' '-$(MAKEFLAGS)' do - cat >ncurses.tmp <cf_makeflags.tmp </dev/null` - if test "$nc_result" != "." + echo '.$cf_option' +CF_EOF + set cf_result=`${MAKE-make} -f cf_makeflags.tmp 2>/dev/null` + if test "$cf_result" != "." then - nc_cv_makeflags=$nc_option + cf_cv_makeflags=$cf_option break fi done - rm -f ncurses.tmp - + rm -f cf_makeflags.tmp fi -echo "$ac_t""$nc_cv_makeflags" 1>&6 +echo "$ac_t""$cf_cv_makeflags" 1>&6 echo $ac_n "checking format of man-pages""... $ac_c" 1>&6 -echo "configure:1488: checking format of man-pages" >&5 +echo "configure:1621: checking format of man-pages" >&5 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!) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - nc_form=unknown - for nc_dir in $MANPATH; do - test -z "$nc_dir" && nc_dir=/usr/man - nc_rename="" - nc_format=no - for nc_name in $nc_dir/*/date.[01]* $nc_dir/*/date + cf_form=unknown + for cf_dir in $MANPATH; do + test -z "$cf_dir" && cf_dir=/usr/man + cf_rename="" + cf_format=no + for cf_name in $cf_dir/*/date.[01]* $cf_dir/*/date do - nc_test=`echo $nc_name | sed -e 's/*//'` - if test "x$nc_test" = "x$nc_name" ; then - case "$nc_name" in - *.gz) nc_form=gzip; nc_name=`basename $nc_name .gz`;; - *.Z) nc_form=compress; nc_name=`basename $nc_name .Z`;; - *.0) nc_form=BSDI; nc_format=yes;; - *) nc_form=cat;; + cf_test=`echo $cf_name | sed -e 's/*//'` + if test "x$cf_test" = "x$cf_name" ; then + case "$cf_name" in + *.gz) cf_form=gzip; cf_name=`basename $cf_name .gz`;; + *.Z) cf_form=compress; cf_name=`basename $cf_name .Z`;; + *.0) cf_form=BSDI; cf_format=yes;; + *) cf_form=cat;; esac break fi done - if test "$nc_form" != "unknown" ; then + if test "$cf_form" != "unknown" ; then break fi done IFS="$ac_save_ifs" if test "$prefix" = "NONE" ; then - nc_prefix="$ac_default_prefix" + cf_prefix="$ac_default_prefix" else - nc_prefix="$prefix" + cf_prefix="$prefix" fi # Debian 'man' program? test -f /etc/debian_version && \ - nc_rename=`cd $srcdir;pwd`/man/man_db.renames + cf_rename=`cd $srcdir && pwd`/man/man_db.renames test ! -d man && mkdir man # Construct a sed-script to perform renaming within man-pages - if test -n "$nc_rename" ; then - fgrep -v \# $nc_rename | \ - sed -e 's/^/s\//' \ - -e 's/\./\\./' \ - -e 's/ / /g' \ - -e 's/ \+/\//' \ - -e s/\$/\\\/g/ >man/edit_man.sed + if test -n "$cf_rename" ; then + $srcdir/man/make_sed.sh $cf_rename >man/edit_man.sed fi - if test $nc_format = yes ; then - nc_subdir='$mandir/cat' + if test $cf_format = yes ; then + cf_subdir='$mandir/cat' else - nc_subdir='$mandir/man' + cf_subdir='$mandir/man' fi -cat >man/edit_man.sh <man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh <\$TMP -NC_EOF +CF_EOF else -cat >>man/edit_man.sh <>man/edit_man.sh <\$TMP -NC_EOF + target="$cf_subdir\$section/\$target" + test \$verb = installing && sed -e "s,@DATADIR@,\$datadir," < \$i | sed -f edit_man.sed >\$TMP +CF_EOF fi -if test $nc_format = yes ; then -cat >>man/edit_man.sh <>man/edit_man.sh <\$TMP.out mv \$TMP.out \$TMP -NC_EOF +CF_EOF +fi fi -case "$nc_form" in +case "$cf_form" in compress) -cat >>man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh <&6 +echo "$ac_t""$cf_form" 1>&6 +echo $ac_n "checking if you have specified an install-prefix""... $ac_c" 1>&6 +echo "configure:1771: checking if you have specified an install-prefix" >&5 + # Check whether --with-install-prefix or --without-install-prefix was given. if test "${with_install_prefix+set}" = set; then withval="$with_install_prefix" @@ -1634,47 +1780,102 @@ if test "${with_install_prefix+set}" = set; then esac fi +echo "$ac_t""$INSTALL_PREFIX" 1>&6 + + +############################################################################### ### Options to allow the user to specify the set of libraries which are used. ### Use "--without-normal --with-shared" to allow the default model to be ### shared, for example. -nc_list_models="" +cf_list_models="" + +echo $ac_n "checking if you want to build shared libraries""... $ac_c" 1>&6 +echo "configure:1796: checking if you want to build shared libraries" >&5 + # Check whether --with-shared or --without-shared was given. if test "${with_shared+set}" = set; then withval="$with_shared" - test "$withval" = "yes" && nc_list_models="$nc_list_models shared" + with_shared=$withval +else + with_shared=no fi +echo "$ac_t""$with_shared" 1>&6 +test "$with_shared" = "yes" && cf_list_models="$cf_list_models shared" + +echo $ac_n "checking if you want to build static libraries""... $ac_c" 1>&6 +echo "configure:1810: checking if you want to build static libraries" >&5 + # Check whether --with-normal or --without-normal was given. if test "${with_normal+set}" = set; then withval="$with_normal" - test "$withval" = "yes" && nc_list_models="$nc_list_models normal" + with_normal=$withval else - nc_list_models="$nc_list_models normal" + with_normal=yes fi +echo "$ac_t""$with_normal" 1>&6 +test "$with_normal" = "yes" && cf_list_models="$cf_list_models normal" + +echo $ac_n "checking if you want to build debug libraries""... $ac_c" 1>&6 +echo "configure:1824: checking if you want to build debug libraries" >&5 + # Check whether --with-debug or --without-debug was given. if test "${with_debug+set}" = set; then withval="$with_debug" - test "$withval" = "yes" && nc_list_models="$nc_list_models debug" + with_debug=$withval else - nc_list_models="$nc_list_models debug" + with_debug=yes fi +echo "$ac_t""$with_debug" 1>&6 +test "$with_debug" = "yes" && cf_list_models="$cf_list_models debug" + +echo $ac_n "checking if you want to build profiling libraries""... $ac_c" 1>&6 +echo "configure:1838: checking if you want to build profiling libraries" >&5 + # Check whether --with-profile or --without-profile was given. if test "${with_profile+set}" = set; then withval="$with_profile" - test "$withval" = "yes" && nc_list_models="$nc_list_models profile" + with_profile=$withval +else + with_profile=no +fi + +echo "$ac_t""$with_profile" 1>&6 +test "$with_profile" = "yes" && cf_list_models="$cf_list_models profile" + +echo $ac_n "checking if you want to build a separate terminfo library""... $ac_c" 1>&6 +echo "configure:1852: checking if you want to build a separate terminfo library" >&5 + +# Check whether --with-termlib or --without-termlib was given. +if test "${with_termlib+set}" = set; then + withval="$with_termlib" + with_termlib=$withval +else + with_termlib=no fi +echo "$ac_t""$with_termlib" 1>&6 ### Checks for special libraries, must be done up-front. +echo $ac_n "checking if you want to link with dbmalloc for testing""... $ac_c" 1>&6 +echo "configure:1866: checking if you want to link with dbmalloc for testing" >&5 + # Check whether --with-dbmalloc or --without-dbmalloc was given. if test "${with_dbmalloc+set}" = set; then withval="$with_dbmalloc" - echo $ac_n "checking for debug_malloc in -ldbmalloc""... $ac_c" 1>&6 -echo "configure:1678: checking for debug_malloc in -ldbmalloc" >&5 + with_dbmalloc=yes +else + with_dbmalloc=no +fi + +echo "$ac_t""$with_dbmalloc" 1>&6 +if test $with_dbmalloc = yes ; then + echo $ac_n "checking for debug_malloc in -ldbmalloc""... $ac_c" 1>&6 +echo "configure:1879: checking for debug_malloc in -ldbmalloc" >&5 ac_lib_var=`echo dbmalloc'_'debug_malloc | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1682,7 +1883,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldbmalloc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1722,11 +1923,21 @@ fi fi +echo $ac_n "checking if you want to link with dmalloc for testing""... $ac_c" 1>&6 +echo "configure:1928: checking if you want to link with dmalloc for testing" >&5 + # Check whether --with-dmalloc or --without-dmalloc was given. if test "${with_dmalloc+set}" = set; then withval="$with_dmalloc" - echo $ac_n "checking for dmalloc_debug in -ldmalloc""... $ac_c" 1>&6 -echo "configure:1730: checking for dmalloc_debug in -ldmalloc" >&5 + with_dmalloc=yes +else + with_dmalloc=no +fi + +echo "$ac_t""$with_dmalloc" 1>&6 +if test $with_dmalloc = yes ; then + echo $ac_n "checking for dmalloc_debug in -ldmalloc""... $ac_c" 1>&6 +echo "configure:1941: checking for dmalloc_debug in -ldmalloc" >&5 ac_lib_var=`echo dmalloc'_'dmalloc_debug | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1734,7 +1945,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldmalloc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1774,11 +1985,21 @@ fi fi +echo $ac_n "checking if you want to link with the gpm mouse library""... $ac_c" 1>&6 +echo "configure:1990: checking if you want to link with the gpm mouse library" >&5 + # Check whether --with-gpm or --without-gpm was given. if test "${with_gpm+set}" = set; then withval="$with_gpm" - echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6 -echo "configure:1782: checking for Gpm_Open in -lgpm" >&5 + with_gpm=yes +else + with_gpm=no +fi + +echo "$ac_t""$with_gpm" 1>&6 +if test $with_gpm = yes ; then + echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6 +echo "configure:2003: 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 @@ -1786,7 +2007,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgpm -lcurses -ltermcap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1814,6 +2035,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 EXTRA_LIBS="$EXTRA_LIBS -lgpm -lncurses" + SHLIB_LIST="$SHLIB_DEPS -lgpm " cat >> confdefs.h <<\EOF #define HAVE_LIBGPM 1 EOF @@ -1822,17 +2044,17 @@ EOF do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1826: checking for $ac_hdr" >&5 +echo "configure:2048: 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:1836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2058: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1869,27 +2091,26 @@ fi echo $ac_n "checking for specified models""... $ac_c" 1>&6 -echo "configure:1873: checking for specified models" >&5 -test -z "$nc_list_models" && nc_list_models=normal -echo "$ac_t""$nc_list_models" 1>&6 +echo "configure:2095: checking for specified models" >&5 +test -z "$cf_list_models" && cf_list_models=normal +echo "$ac_t""$cf_list_models" 1>&6 ### Use the first model as the default, and save its suffix for use in building ### up test-applications. -DFT_LWR_MODEL=`echo $nc_list_models | $AWK '{print $1}'` +DFT_LWR_MODEL=`echo $cf_list_models | $AWK '{print $1}'` -DFT_UPR_MODEL=`echo $DFT_LWR_MODEL |tr '[a-z]' '[A-Z]'` +DFT_UPR_MODEL=`echo $DFT_LWR_MODEL | tr '[a-z]' '[A-Z]'` - case $DFT_LWR_MODEL in normal) DFT_DEP_SUFFIX='.a' ;; debug) DFT_DEP_SUFFIX='_g.a' ;; profile) DFT_DEP_SUFFIX='_p.a' ;; shared) - case $nc_cv_systype in - NetBSD|FreeBSD) - DFT_DEP_SUFFIX='.so.$(ABI_VERSION)' ;; - HP_UX) DFT_DEP_SUFFIX='.sl' ;; + case $cf_cv_system_name in + openbsd*|netbsd*|freebsd*) + DFT_DEP_SUFFIX='.so.$(REL_VERSION)' ;; + hpux*) DFT_DEP_SUFFIX='.sl' ;; *) DFT_DEP_SUFFIX='.so' ;; esac esac @@ -1908,11 +2129,20 @@ DFT_UPR_MODEL=`echo $DFT_LWR_MODEL |tr '[a-z]' '[A-Z]'` shared) DFT_OBJ_SUBDIR='obj_s' ;; esac +TINFO_NAME=tinfo + + LIB_NAME=ncurses LIB_DIR=../lib -LIB_PREFIX=$LIB_DIR/lib + + case $cf_cv_system_name in + os2) cf_prefix='' ;; + *) cf_prefix='lib' ;; + esac + +LIB_PREFIX=$LIB_DIR/$cf_prefix @@ -1935,25 +2165,45 @@ profile) LD_MODEL='-pg';; shared) LD_MODEL='' ;; esac - +echo $ac_n "checking if rpath option should be used""... $ac_c" 1>&6 +echo "configure:2170: checking if rpath option should be used" >&5 + +# Check whether --enable-rpath or --disable-rpath was given. +if test "${enable_rpath+set}" = set; then + enableval="$enable_rpath" + cf_cv_ld_rpath=$enableval +else + cf_cv_ld_rpath=no +fi + +echo "$ac_t""$cf_cv_ld_rpath" 1>&6 + + LOCAL_LDFLAGS= LOCAL_LDFLAGS2= + LD_SHARED_OPTS= + INSTALL_LIB="-m 644" - nc_cv_do_symlinks=no - nc_cv_rm_so_locs=no + cf_cv_do_symlinks=no + cf_cv_rm_so_locs=no - case $nc_cv_systype in - HP_UX) + case $cf_cv_system_name in + hpux*) # (tested with gcc 2.7.2 -- I don't have c89) if test "${CC}" = "gcc"; then CC_SHARED_OPTS='-fPIC' + LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)' else CC_SHARED_OPTS='+Z' + LD_SHARED_OPTS='+b $(libdir)' fi MK_SHARED_LIB='$(LD) -b -o $@' + # HP-UX shared libraries must be executable, and should be + # readonly to exploit a quirk in the memory manager. + INSTALL_LIB="-m 555" ;; - IRIX*) + irix*) # tested with IRIX 5.2 and 'cc'. if test "${CC}" = "gcc"; then CC_SHARED_OPTS='-fPIC' @@ -1961,54 +2211,67 @@ esac CC_SHARED_OPTS='-KPIC' fi MK_SHARED_LIB='$(LD) -shared -rdata_shared -soname `basename $@` -o $@' - nc_cv_rm_so_locs=yes + cf_cv_rm_so_locs=yes ;; - Linux) - # tested with Linux 1.2.8 and gcc 2.7.0 (ELF) + linux*) + # tested with Linux 2.0.29 and gcc 2.7.2 (ELF) CC_SHARED_OPTS='-fPIC' - MK_SHARED_LIB='gcc -o $@.$(REL_VERSION) -shared -Wl,-soname,`basename $@.$(ABI_VERSION)`,-stats' + MK_SHARED_LIB='gcc -o $@.$(REL_VERSION) -L../lib -L\$(libdir) -shared -Wl,-soname,`basename $@.$(ABI_VERSION)`,-stats,$(SHLIB_LIST)-lc' + test $cf_cv_ld_rpath = yes && cf_ld_rpath_opt="-Wl,-rpath," if test $DFT_LWR_MODEL = "shared" ; then LOCAL_LDFLAGS='-Wl,-rpath,../lib' LOCAL_LDFLAGS2='-Wl,-rpath,../../lib' fi - nc_cv_do_symlinks=yes + cf_cv_do_symlinks=yes ;; - NetBSD|FreeBSD) + openbsd*|netbsd*|freebsd*) CC_SHARED_OPTS='-fpic -DPIC' MK_SHARED_LIB='$(LD) -Bshareable -o $@' ;; - OSF1|MLS+) + osf*|mls+*) # tested with OSF/1 V3.2 and 'cc' # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't # link with shared libs). CC_SHARED_OPTS='' - MK_SHARED_LIB='$(LD) -o $@.$(REL_VERSION) -shared -soname `basename $@.$(ABI_VERSION)`' + MK_SHARED_LIB='$(LD) -o $@.$(REL_VERSION) -set_version $(ABI_VERSION):$(REL_VERSION) -expect_unresolved "*" -shared -soname `basename $@.$(ABI_VERSION)`' + test $cf_cv_ld_rpath = yes && cf_ld_rpath_opt="-rpath" + case $host_os in + osf4*) + MK_SHARED_LIB="${MK_SHARED_LIB} -msym" + ;; + esac if test $DFT_LWR_MODEL = "shared" ; then LOCAL_LDFLAGS='-Wl,-rpath,../lib' LOCAL_LDFLAGS2='-Wl,-rpath,../../lib' fi - nc_cv_do_symlinks=yes - nc_cv_rm_so_locs=yes + cf_cv_do_symlinks=yes + cf_cv_rm_so_locs=yes ;; - SunOS) + sunos4*) # tested with SunOS 4.1.1 and gcc 2.7.0 - # tested with SunOS 5.3 (solaris 2.3) and gcc 2.7.0 if test $ac_cv_prog_gcc = yes; then CC_SHARED_OPTS='-fpic' else CC_SHARED_OPTS='-KPIC' fi - case `uname -r` in - 4.*) - MK_SHARED_LIB='$(LD) -assert pure-text -o $@.$(REL_VERSION)' - ;; - 5.*) - MK_SHARED_LIB='$(LD) -d y -G -h `basename $@.$(ABI_VERSION)` -o $@.$(REL_VERSION)' - ;; - esac - nc_cv_do_symlinks=yes + MK_SHARED_LIB='$(LD) -assert pure-text -o $@.$(REL_VERSION)' + cf_cv_do_symlinks=yes + ;; + solaris2*) + # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2 + if test $ac_cv_prog_gcc = yes; then + CC_SHARED_OPTS='-fpic' + else + CC_SHARED_OPTS='-KPIC' + fi + MK_SHARED_LIB='$(LD) -dy -G -h `basename $@.$(ABI_VERSION)` -o $@.$(REL_VERSION)' + if test $cf_cv_ld_rpath = yes ; then + cf_ld_rpath_opt="-R" + EXTRA_LDFLAGS="-R ../lib:\$(libdir) $EXTRA_LDFLAGS" + fi + cf_cv_do_symlinks=yes ;; - UNIX_SV) + unix_sv*) # tested with UnixWare 1.1.2 CC_SHARED_OPTS='-KPIC' MK_SHARED_LIB='$(LD) -d y -G -o $@' @@ -2018,6 +2281,39 @@ esac MK_SHARED_LIB='echo unknown' ;; esac + + if test -n "$cf_ld_rpath_opt" ; then + echo $ac_n "checking if we need a space after rpath option""... $ac_c" 1>&6 +echo "configure:2288: checking if we need a space after rpath option" >&5 + cf_save_LIBS="$LIBS" + LIBS="$LIBS ${cf_ld_rpath_opt}/usr/lib" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + cf_rpath_space=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_rpath_space=yes +fi +rm -f conftest* + LIBS="$cf_save_LIBS" + echo "$ac_t""$cf_rpath_space" 1>&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)" + fi + + + + @@ -2025,17 +2321,20 @@ esac if test "$CC_SHARED_OPTS" = "unknown"; then - for model in $nc_list_models; do + for model in $cf_list_models; do if test "$model" = "shared"; then - echo '** Shared libraries are not supported in this version' - exit 1 + { echo "configure: error: Shared libraries are not supported in this version" 1>&2; exit 1; } fi done fi +############################################################################### + + ### use option --disable-overwrite to leave out the link to -lcurses -echo $ac_n "checking include directory""... $ac_c" 1>&6 -echo "configure:2039: checking include directory" >&5 +echo $ac_n "checking if you wish to install ncurses overwriting curses""... $ac_c" 1>&6 +echo "configure:2337: checking if you wish to install ncurses overwriting curses" >&5 + # Check whether --enable-overwrite or --disable-overwrite was given. if test "${enable_overwrite+set}" = set; then enableval="$enable_overwrite" @@ -2048,11 +2347,70 @@ else with_overwrite=yes fi +echo "$ac_t""$with_overwrite" 1>&6 +echo $ac_n "checking where we will install curses.h""... $ac_c" 1>&6 +echo "configure:2353: checking where we will install curses.h" >&5 echo "$ac_t""$includedir" 1>&6 +echo $ac_n "checking if external terminfo-database is used""... $ac_c" 1>&6 +echo "configure:2357: checking if external terminfo-database is used" >&5 + +# Check whether --enable-database or --disable-database was given. +if test "${enable_database+set}" = set; then + enableval="$enable_database" + with_database=$enableval +else + with_database=yes +fi + +echo "$ac_t""$with_database" 1>&6 +test $with_database != no && cat >> confdefs.h <<\EOF +#define USE_DATABASE 1 +EOF + + +echo $ac_n "checking if you want to build with function extensions""... $ac_c" 1>&6 +echo "configure:2374: checking if you want to build with function extensions" >&5 + +# 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 "$ac_t""$with_ext_funcs" 1>&6 +test "$with_ext_funcs" = yes && cat >> confdefs.h <<\EOF +#define NCURSES_EXT_FUNCS 1 +EOF + + +echo $ac_n "checking for list of fallback descriptions""... $ac_c" 1>&6 +echo "configure:2391: checking for list of fallback descriptions" >&5 + +# Check whether --with-fallbacks or --without-fallbacks was given. +if test "${with_fallbacks+set}" = set; then + withval="$with_fallbacks" + with_fallback=$withval +else + with_fallback= +fi + +echo "$ac_t""$with_fallback" 1>&6 +FALLBACK_LIST=`echo $with_fallback|sed -e 's/,/ /'` + + +if test $with_database = no ; then + if test -z $with_fallback ; then + { echo "configure: error: You have disabled the database w/o specifying fallbacks" 1>&2; exit 1; } + fi +fi + ### use option --enable-big-core to make tic run faster on big machines echo $ac_n "checking if big-core option selected""... $ac_c" 1>&6 -echo "configure:2056: checking if big-core option selected" >&5 +echo "configure:2413: checking if big-core option selected" >&5 + # Check whether --enable-big-core or --disable-big-core was given. if test "${enable_big_core+set}" = set; then enableval="$enable_big_core" @@ -2068,8 +2426,9 @@ EOF ### use option --enable-termcap to compile in the termcap fallback support -echo $ac_n "checking if termcap-fallback support is needed""... $ac_c" 1>&6 -echo "configure:2073: checking if termcap-fallback support is needed" >&5 +echo $ac_n "checking if you want termcap-fallback support""... $ac_c" 1>&6 +echo "configure:2431: checking if you want termcap-fallback support" >&5 + # Check whether --enable-termcap or --disable-termcap was given. if test "${enable_termcap+set}" = set; then enableval="$enable_termcap" @@ -2089,7 +2448,8 @@ else ### use option --enable-getcap to use a hacked getcap for reading termcaps echo $ac_n "checking if fast termcap-loader is needed""... $ac_c" 1>&6 -echo "configure:2093: checking if fast termcap-loader is needed" >&5 +echo "configure:2452: checking if fast termcap-loader is needed" >&5 + # Check whether --enable-getcap or --disable-getcap was given. if test "${enable_getcap+set}" = set; then enableval="$enable_getcap" @@ -2105,7 +2465,8 @@ EOF echo $ac_n "checking if translated termcaps will be cached in ~/.terminfo""... $ac_c" 1>&6 -echo "configure:2109: checking if translated termcaps will be cached in ~/.terminfo" >&5 +echo "configure:2469: checking if translated termcaps will be cached in ~/.terminfo" >&5 + # Check whether --enable-getcap-cache or --disable-getcap-cache was given. if test "${enable_getcap_cache+set}" = set; then enableval="$enable_getcap_cache" @@ -2122,31 +2483,125 @@ EOF fi -### use option --enable-symlinks to make tic use symlinks, not hard links -echo $ac_n "checking if tic should use symbolic links""... $ac_c" 1>&6 -echo "configure:2128: checking if tic should use symbolic links" >&5 -# Check whether --enable-symlinks or --disable-symlinks was given. -if test "${enable_symlinks+set}" = set; then - enableval="$enable_symlinks" - with_symlinks=$enableval -else - with_symlinks=no -fi - -echo "$ac_t""$with_symlinks" 1>&6 -test "$with_symlinks" = yes && cat >> confdefs.h <<\EOF -#define USE_SYMLINKS 1 -EOF - +### Use option --enable-symlinks to make tic use symlinks, not hard links +### to reduce storage requirements for the terminfo database. +### +### Most Unix systems have both link and symlink, a few don't have symlink. +### A few non-Unix systems implement symlink, but not link. +### A few non-systems implement neither. -### use option --enable-bsdpad to have tputs process BSD-style prefix padding -echo $ac_n "checking if tputs should process BSD-style prefix padding""... $ac_c" 1>&6 -echo "configure:2145: checking if tputs should process BSD-style prefix padding" >&5 -# Check whether --enable-bsdpad or --disable-bsdpad was given. -if test "${enable_bsdpad+set}" = set; then - enableval="$enable_bsdpad" - with_bsdpad=$enableval -else +for ac_func in \ + link \ + symlink +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2499: 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 < +/* Override any gcc2 internal prototype to avoid an error. */ +/* 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(); + +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 +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2527: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + +with_links=no +with_symlinks=no + +if test "$ac_cv_func_link" != yes ; then + echo $ac_n "checking if tic should use symbolic links""... $ac_c" 1>&6 +echo "configure:2557: checking if tic should use symbolic links" >&5 + if test "$ac_cv_func_symlink" = yes ; then + with_symlinks=yes + else + with_symlinks=no + fi + echo "$ac_t""$with_symlinks" 1>&6 +elif test "$ac_cv_func_symlink" != yes ; then + echo $ac_n "checking if tic should use hard links""... $ac_c" 1>&6 +echo "configure:2566: checking if tic should use hard links" >&5 + if test "$ac_cv_func_link" = yes ; then + with_links=yes + else + with_links=no + fi + echo "$ac_t""$with_links" 1>&6 +else + echo $ac_n "checking if tic should use symbolic links""... $ac_c" 1>&6 +echo "configure:2575: checking if tic should use symbolic links" >&5 + +# Check whether --enable-symlinks or --disable-symlinks was given. +if test "${enable_symlinks+set}" = set; then + enableval="$enable_symlinks" + with_symlinks=$enableval +else + with_symlinks=no +fi + + echo "$ac_t""$with_symlinks" 1>&6 +fi + +test "$with_links" = yes && cat >> confdefs.h <<\EOF +#define USE_LINKS 1 +EOF + +test "$with_symlinks" = yes && cat >> confdefs.h <<\EOF +#define USE_SYMLINKS 1 +EOF + + +### use option --enable-bsdpad to have tputs process BSD-style prefix padding +echo $ac_n "checking if tputs should process BSD-style prefix padding""... $ac_c" 1>&6 +echo "configure:2599: checking if tputs should process BSD-style prefix padding" >&5 + +# 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 @@ -2158,7 +2613,8 @@ EOF ### use option --enable-const to turn on use of const beyond that in XSI. echo $ac_n "checking for extended use of const keyword""... $ac_c" 1>&6 -echo "configure:2162: checking for extended use of const keyword" >&5 +echo "configure:2617: checking for extended use of const keyword" >&5 + # Check whether --enable-const or --disable-const was given. if test "${enable_const+set}" = set; then enableval="$enable_const" @@ -2175,7 +2631,8 @@ EOF ### Enable compiling-in rcs id's echo $ac_n "checking if RCS identifiers should be compiled-in""... $ac_c" 1>&6 -echo "configure:2179: checking if RCS identifiers should be compiled-in" >&5 +echo "configure:2635: checking if RCS identifiers should be compiled-in" >&5 + # Check whether --with-rcs-ids or --without-rcs-ids was given. if test "${with_rcs_ids+set}" = set; then withval="$with_rcs_ids" @@ -2190,7 +2647,151 @@ test "$with_rcs_ids" = yes && cat >> confdefs.h <<\EOF EOF +############################################################################### + +echo $ac_n "checking if you want all experimental code""... $ac_c" 1>&6 +echo "configure:2654: checking if you want all experimental code" >&5 + +# 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 "$ac_t""$with_develop" 1>&6 + +### use option --enable-hard-tabs to turn on use of hard-tabs optimize +echo $ac_n "checking if you want experimental hard-tabs code""... $ac_c" 1>&6 +echo "configure:2668: checking if you want experimental hard-tabs code" >&5 + +# 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 + with_hardtabs=$with_develop +fi + +echo "$ac_t""$with_hardtabs" 1>&6 +test "$with_hardtabs" = yes && cat >> confdefs.h <<\EOF +#define USE_HARD_TABS 1 +EOF + + +### use option --enable-hashmap to turn on use of hashmap scrolling logic +echo $ac_n "checking if you want experimental hashmap code""... $ac_c" 1>&6 +echo "configure:2686: checking if you want experimental hashmap code" >&5 + +# 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=$with_develop +fi + +echo "$ac_t""$with_hashmap" 1>&6 +test "$with_hashmap" = yes && cat >> confdefs.h <<\EOF +#define USE_HASHMAP 1 +EOF + + +echo $ac_n "checking if you want experimental safe-sprintf code""... $ac_c" 1>&6 +echo "configure:2703: checking if you want experimental safe-sprintf code" >&5 + +# 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 "$ac_t""$with_safe_sprintf" 1>&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 +echo $ac_n "checking if you want to experiment without scrolling-hints code""... $ac_c" 1>&6 +echo "configure:2721: checking if you want to experiment without scrolling-hints code" >&5 + +# 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 "$ac_t""$with_scroll_hints" 1>&6 +test "$with_scroll_hints" = yes && cat >> confdefs.h <<\EOF +#define USE_SCROLL_HINTS 1 +EOF + + +### use option --enable-sigwinch to turn on use of SIGWINCH logic +echo $ac_n "checking if you want experimental SIGWINCH handler""... $ac_c" 1>&6 +echo "configure:2739: checking if you want experimental SIGWINCH handler" >&5 + +# 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_develop +fi + +echo "$ac_t""$with_sigwinch" 1>&6 +test "$with_sigwinch" = yes && cat >> confdefs.h <<\EOF +#define USE_SIGWINCH 1 +EOF + + +### use option --enable-widec to turn on use of wide-character support +echo $ac_n "checking if you want experimental wide-character code""... $ac_c" 1>&6 +echo "configure:2757: checking if you want experimental wide-character code" >&5 + +# 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 "$ac_t""$with_widec" 1>&6 +test "$with_widec" = yes && cat >> confdefs.h <<\EOF +#define USE_WIDEC_SUPPORT 1 +EOF + + +### use option --enable-xmc-glitch to turn on use of magic-cookie optimize +echo $ac_n "checking if you want experimental xmc code""... $ac_c" 1>&6 +echo "configure:2775: checking if you want experimental xmc code" >&5 + +# 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 "$ac_t""$with_xmc_glitch" 1>&6 +test "$with_xmc_glitch" = yes && cat >> confdefs.h <<\EOF +#define USE_XMC_SUPPORT 1 +EOF + + +############################################################################### + + ### use option --disable-echo to suppress full display compiling commands + # Check whether --enable-echo or --disable-echo was given. if test "${enable_echo+set}" = set; then enableval="$enable_echo" @@ -2207,6 +2808,7 @@ fi ### use option --enable-warnings to turn on all gcc warnings + # Check whether --enable-warnings or --disable-warnings was given. if test "${enable_warnings+set}" = set; then enableval="$enable_warnings" @@ -2215,20 +2817,20 @@ fi if test -n "$with_warnings"; then ADAFLAGS="$ADAFLAGS -gnatg" - nc_warn_CFLAGS="" + if test -n "$GCC" then cat > conftest.$ac_ext <&6 -echo "configure:2227: checking for gcc warning options" >&5 - nc_save_CFLAGS="$CFLAGS" - nc_warn_CFLAGS="-W -Wall" - nc_warn_CONST="" - test "$with_ext_const" = yes && nc_warn_CONST="Wwrite-strings" - for nc_opt in \ +echo "configure:2829: checking for gcc warning options" >&5 + cf_save_CFLAGS="$CFLAGS" + EXTRA_CFLAGS="-W -Wall" + cf_warn_CONST="" + test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" + for cf_opt in \ Wbad-function-cast \ Wcast-align \ Wcast-qual \ @@ -2238,19 +2840,24 @@ echo "configure:2227: checking for gcc warning options" >&5 Wnested-externs \ Wpointer-arith \ Wshadow \ - Wstrict-prototypes $nc_warn_CONST + Wstrict-prototypes $cf_warn_CONST do - CFLAGS="$nc_save_CFLAGS $nc_warn_CFLAGS -$nc_opt" - if { (eval echo configure:2245: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - test -n "$verbose" && echo "$ac_t""... -$nc_opt" 1>&6 - nc_warn_CFLAGS="$nc_warn_CFLAGS -$nc_opt" + CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" + if { (eval echo configure:2847: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + test -n "$verbose" && echo "$ac_t""... -$cf_opt" 1>&6 + EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" + test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES" fi done rm -f conftest* - CFLAGS="$nc_save_CFLAGS" + CFLAGS="$cf_save_CFLAGS" fi + fi + +if test -n "$GCC" +then cat > conftest.i <&6 -echo "configure:2272: checking for gcc __attribute__ directives" >&5 +echo "configure:2879: checking for gcc __attribute__ directives" >&5 cat > conftest.$ac_ext <&5 - case $nc_attribute in + cf_directive="__attribute__(($cf_attribute))" + echo "checking for gcc $cf_directive" 1>&5 + case $cf_attribute in scanf|printf) cat >conftest.h <conftest.h <&5; (eval $ac_compile) 2>&5; }; then - test -n "$verbose" && echo "$ac_t""... $nc_attribute" 1>&6 + if { (eval echo configure:2919: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + test -n "$verbose" && echo "$ac_t""... $cf_attribute" 1>&6 cat conftest.h >>confdefs.h # else # sed -e 's/__attr.*/\/*nothing*\//' conftest.h >>confdefs.h @@ -2319,20 +2926,27 @@ else fgrep define conftest.i >>confdefs.h fi rm -rf conftest* - +fi ### use option --enable-assertions to turn on generation of assertion code + # Check whether --enable-assertions or --disable-assertions was given. if test "${enable_assertions+set}" = set; then enableval="$enable_assertions" with_assertions=$enableval +else + with_assertions=no fi if test -n "$GCC" then - if test -z "$with_assertions" + if test $with_assertions = no then + cat >> confdefs.h <<\EOF +#define NDEBUG 1 +EOF + CPPFLAGS="$CPPFLAGS -DNDEBUG" else ADAFLAGS="$ADAFLAGS -gnata" @@ -2340,6 +2954,7 @@ then fi ### use option --disable-leaks to suppress "permanent" leaks, for testing + # Check whether --enable-leaks or --disable-leaks was given. if test "${enable_leaks+set}" = set; then enableval="$enable_leaks" @@ -2355,6 +2970,7 @@ EOF ### use option --enable-expanded to generate certain macros as functions + # Check whether --enable-expanded or --disable-expanded was given. if test "${enable_expanded+set}" = set; then enableval="$enable_expanded" @@ -2366,6 +2982,7 @@ fi ### use option --disable-macros to suppress macros in favor of functions + # Check whether --enable-macros or --disable-macros was given. if test "${enable_macros+set}" = set; then enableval="$enable_macros" @@ -2378,12 +2995,12 @@ fi ### Checks for libraries. echo $ac_n "checking for gettimeofday""... $ac_c" 1>&6 -echo "configure:2382: checking for gettimeofday" >&5 +echo "configure:2999: checking for gettimeofday" >&5 if eval "test \"`echo '$''{'ac_cv_func_gettimeofday'+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; then +if { (eval echo configure:3027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_gettimeofday=yes" else @@ -2427,8 +3044,9 @@ EOF else echo "$ac_t""no" 1>&6 + echo $ac_n "checking for gettimeofday in -lbsd""... $ac_c" 1>&6 -echo "configure:2432: checking for gettimeofday in -lbsd" >&5 +echo "configure:3050: checking for gettimeofday in -lbsd" >&5 ac_lib_var=`echo bsd'_'gettimeofday | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2436,7 +3054,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lbsd $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2473,14 +3091,105 @@ fi fi +MATH_LIB="" +echo $ac_n "checking for sin""... $ac_c" 1>&6 +echo "configure:3097: checking for sin" >&5 +if eval "test \"`echo '$''{'ac_cv_func_sin'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sin(); + +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_sin) || defined (__stub___sin) +choke me +#else +sin(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3125: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_sin=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_sin=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'sin`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for sin in -lm""... $ac_c" 1>&6 +echo "configure:3143: checking for sin in -lm" >&5 +ac_lib_var=`echo m'_'sin | 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="-lm $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + MATH_LIB="-lm" +else + echo "$ac_t""no" 1>&6 +fi + +fi + + + ### Checks for header files. echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2479: checking for ANSI C header files" >&5 +echo "configure:3188: 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 @@ -2488,7 +3197,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3201: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2505,7 +3214,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 @@ -2523,7 +3232,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 @@ -2544,7 +3253,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2555,7 +3264,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2559: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -2583,12 +3292,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:2587: checking for $ac_hdr that defines DIR" >&5 +echo "configure:3296: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -2596,7 +3305,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:2600: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3309: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -2621,7 +3330,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:2625: checking for opendir in -ldir" >&5 +echo "configure:3334: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2629,7 +3338,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3353: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2662,7 +3371,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:2666: checking for opendir in -lx" >&5 +echo "configure:3375: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2670,7 +3379,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2705,13 +3414,13 @@ fi echo $ac_n "checking for regular-expression headers""... $ac_c" 1>&6 -echo "configure:2709: checking for regular-expression headers" >&5 -if eval "test \"`echo '$''{'nc_cv_regex'+set}'`\" = set"; then +echo "configure:3418: checking for regular-expression headers" >&5 +if eval "test \"`echo '$''{'cf_cv_regex'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2724,16 +3433,16 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3437: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - nc_cv_regex="regex.h" + cf_cv_regex="regex.h" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < int main() { @@ -2743,16 +3452,18 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3456: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - nc_cv_regex="regexp.h" + cf_cv_regex="regexp.h" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* + cf_save_LIBS="$LIBS" + LIBS="-lgen $LIBS" cat > conftest.$ac_ext < int main() { @@ -2762,12 +3473,14 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - nc_cv_regex="regexpr.h" + cf_cv_regex="regexpr.h" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 + rm -rf conftest* + LIBS="$cf_save_LIBS" fi rm -f conftest* fi @@ -2777,18 +3490,18 @@ rm -f conftest* fi -echo "$ac_t""$nc_cv_regex" 1>&6 -case $nc_cv_regex in +echo "$ac_t""$cf_cv_regex" 1>&6 +case $cf_cv_regex in regex.h) cat >> confdefs.h <<\EOF -#define HAVE_REGEX_H 1 +#define HAVE_REGEX_H_FUNCS 1 EOF ;; regexp.h) cat >> confdefs.h <<\EOF -#define HAVE_REGEXP_H 1 +#define HAVE_REGEXP_H_FUNCS 1 EOF ;; regexpr.h) cat >> confdefs.h <<\EOF -#define HAVE_REGEXPR_H 1 +#define HAVE_REGEXPR_H_FUNCS 1 EOF ;; esac @@ -2817,17 +3530,17 @@ values.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2821: checking for $ac_hdr" >&5 +echo "configure:3534: 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:2831: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3544: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2854,47 +3567,58 @@ fi done -# check for HPUX's ANSI compiler -if test $nc_cv_systype = HP_UX; then -if test -z "$GCC"; then +PROG_EXT= +case $cf_cv_system_name in +hpux*) + # check for HPUX's ANSI compiler + if test -z "$GCC"; then echo $ac_n "checking for HP/UX ANSI compiler""... $ac_c" 1>&6 -echo "configure:2862: checking for HP/UX ANSI compiler" >&5 - nc_save_CFLAGS="$CFLAGS" +echo "configure:3577: checking for HP/UX ANSI compiler" >&5 + cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Aa" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3588: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - nc_hpux_cc=yes + cf_hpux_cc=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - nc_hpux_cc=no + cf_hpux_cc=no fi rm -f conftest* - echo "$ac_t""$nc_hpux_cc" 1>&6 - if test $nc_hpux_cc = yes; then + echo "$ac_t""$cf_hpux_cc" 1>&6 + if test $cf_hpux_cc = yes; then cat >> confdefs.h <<\EOF #define _HPUX_SOURCE 1 EOF else - CFLAGS="$nc_save_CFLAGS" + CFLAGS="$cf_save_CFLAGS" fi -fi;fi + fi + ;; +os2*) + # We make sure -Zexe is not used -- it would interfere with @PROG_EXT@ + CFLAGS="$CFLAGS -Zmt -D__ST_MT_ERRNO__" + LDFLAGS=`echo "$LDFLAGS -Zmt -Zcrtdll" | sed "s/-Zexe//g"` + PROG_EXT=".exe" + ;; +esac + # check for ISC (this may also define _POSIX_SOURCE) # Note: even non-Posix ISC needs to declare fd_set if test "$ISC" = yes ; then echo $ac_n "checking for main in -lcposix""... $ac_c" 1>&6 -echo "configure:2898: checking for main in -lcposix" >&5 +echo "configure:3622: checking for main in -lcposix" >&5 ac_lib_var=`echo cposix'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2902,14 +3626,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lcposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2937,7 +3661,7 @@ else fi echo $ac_n "checking for bzero in -linet""... $ac_c" 1>&6 -echo "configure:2941: checking for bzero in -linet" >&5 +echo "configure:3665: checking for bzero in -linet" >&5 ac_lib_var=`echo inet'_'bzero | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2945,7 +3669,7 @@ else ac_save_LIBS="$LIBS" LIBS="-linet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2979,17 +3703,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2983: checking for $ac_hdr" >&5 +echo "configure:3707: 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:2993: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3717: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3017,47 +3741,48 @@ done fi -# check for SCO. this is a hack, and should be split into individual -# features -- the sys/time.h and select.h conflict, and the need for -# ptem.h due to winsize struct. -echo "checking for SCO by checking on /usr/bin/scosh" 1>&6 -echo "configure:3025: checking for SCO by checking on /usr/bin/scosh" >&5 -# Extract the first word of "scosh", so it can be a program name with args. -set dummy scosh; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3029: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_COULD_BE_SCO'+set}'`\" = set"; then + +echo $ac_n "checking if sys/time.h works with sys/select.h""... $ac_c" 1>&6 +echo "configure:3747: 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 - if test -n "$COULD_BE_SCO"; then - ac_cv_prog_COULD_BE_SCO="$COULD_BE_SCO" # Let the user override the test. + +cat > conftest.$ac_ext < +#if HAVE_SYS_TIME_H +#include +#endif +#if HAVE_SYS_SELECT_H +#include +#endif + +int main() { + +; return 0; } +EOF +if { (eval echo configure:3768: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cf_cv_sys_time_select=yes else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_COULD_BE_SCO="maybe" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_COULD_BE_SCO" && ac_cv_prog_COULD_BE_SCO="maybenot" -fi + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cv_sys_time_select=no fi -COULD_BE_SCO="$ac_cv_prog_COULD_BE_SCO" -if test -n "$COULD_BE_SCO"; then - echo "$ac_t""$COULD_BE_SCO" 1>&6 -else - echo "$ac_t""no" 1>&6 +rm -f conftest* + fi -if test "$COULD_BE_SCO" = "maybe" -then - cat >> confdefs.h <<\EOF -#define SYSTEM_LOOKS_LIKE_SCO 1 +echo "$ac_t""$cf_cv_sys_time_select" 1>&6 +test $cf_cv_sys_time_select = yes && cat >> confdefs.h <<\EOF +#define HAVE_SYS_TIME_SELECT 1 EOF -fi + ### checks for compiler characteristics ac_ext=c @@ -3068,12 +3793,12 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:3072: checking for working const" >&5 +echo "configure:3797: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3851: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -3143,21 +3868,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:3147: checking for inline" >&5 +echo "configure:3872: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3886: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -3182,103 +3907,316 @@ EOF ;; esac -test $ac_cv_c_inline != no && cat >> confdefs.h <<\EOF -#define CC_HAS_INLINE_FUNCS 1 -EOF +test $ac_cv_c_inline != no && cat >> confdefs.h <<\EOF +#define CC_HAS_INLINE_FUNCS 1 +EOF + + + +echo $ac_n "checking if unsigned literals are legal""... $ac_c" 1>&6 +echo "configure:3918: checking if unsigned literals are legal" >&5 +if eval "test \"`echo '$''{'cf_cv_unsigned_literals'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cf_cv_unsigned_literals=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cv_unsigned_literals=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$cf_cv_unsigned_literals" 1>&6 + + + +echo $ac_n "checking for type of chtype""... $ac_c" 1>&6 +echo "configure:3949: checking for type of chtype" >&5 +if eval "test \"`echo '$''{'cf_cv_typeof_chtype'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + if test "$cross_compiling" = yes; then + cf_cv_typeof_chtype=long +else + cat > conftest.$ac_ext < /* 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"; +#if 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; + for (n = 0; n < WANT_BITS; n++) { + unsigned int y = (x >> n); + if (y != 1 || x == 0) { + x = 0; + break; + } + } + /* + * If x is nonzero, an int is big enough for the bits + * that we want. + */ + result = (x != 0) ? "int" : "long"; + } + fputs(result, fp); + fclose(fp); + } + exit(0); +} + +EOF +if { (eval echo configure:4004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + cf_cv_typeof_chtype=`cat cf_test.out` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + cf_cv_typeof_chtype=long +fi +rm -fr conftest* +fi + + rm -f cf_test.out + +fi + +echo "$ac_t""$cf_cv_typeof_chtype" 1>&6 + + +cat >> confdefs.h <&6 +echo "configure:4037: checking for number of bits in chtype" >&5 +if eval "test \"`echo '$''{'cf_cv_shift_limit'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + if test "$cross_compiling" = yes; then + cf_cv_shift_limit=32 +else + cat > conftest.$ac_ext < +int main() +{ + FILE *fp = fopen("cf_test.out", "w"); + if (fp != 0) { + int n; + unsigned TYPEOF_CHTYPE x = 1L; + for (n = 0; ; n++) { + unsigned long y = (x >> n); + if (y != 1 || x == 0) + break; + x <<= 1; + } + fprintf(fp, "%d", n); + fclose(fp); + } + exit(0); +} + +EOF +if { (eval echo configure:4069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + cf_cv_shift_limit=`cat cf_test.out` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + cf_cv_shift_limit=32 +fi +rm -fr conftest* +fi + + rm -f cf_test.out + +fi + +echo "$ac_t""$cf_cv_shift_limit" 1>&6 + + +echo $ac_n "checking for width of character-index""... $ac_c" 1>&6 +echo "configure:4089: checking for width of character-index" >&5 +if eval "test \"`echo '$''{'cf_cv_widec_shift'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +if test ".$with_widec" = ".yes" ; then + cf_attrs_width=39 + if ( expr $cf_cv_shift_limit \> $cf_attrs_width >/dev/null ) + then + cf_cv_widec_shift=`expr 16 + $cf_cv_shift_limit - $cf_attrs_width` + else + cf_cv_widec_shift=16 + fi +else + cf_cv_widec_shift=8 +fi + +fi + +echo "$ac_t""$cf_cv_widec_shift" 1>&6 + ### Checks for external-data -echo $ac_n "checking for errno external decl""... $ac_c" 1>&6 -echo "configure:3194: checking for errno external decl" >&5 -if eval "test \"`echo '$''{'nc_cv_extern_errno'+set}'`\" = set"; then + +echo $ac_n "checking declaration of errno""... $ac_c" 1>&6 +echo "configure:4116: checking declaration of errno" >&5 +if eval "test \"`echo '$''{'cf_cv_dcl_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext < conftest.$ac_ext < +#include +#include +#include int main() { -int x = errno +long x = (long) errno ; return 0; } EOF -if { (eval echo configure:3208: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4132: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - nc_cv_extern_errno=yes + eval 'cf_cv_dcl_'errno'=yes' else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - nc_cv_extern_errno=no + eval 'cf_cv_dcl_'errno'=no' fi rm -f conftest* - fi -echo "$ac_t""$nc_cv_extern_errno" 1>&6 -test $nc_cv_extern_errno = yes && cat >> confdefs.h <<\EOF -#define HAVE_EXTERN_ERRNO 1 -EOF - - +eval 'cf_result=$cf_cv_dcl_'errno +echo "$ac_t""$cf_result" 1>&6 -echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6 -echo "configure:3229: checking declaration of sys_errlist" >&5 -if eval "test \"`echo '$''{'nc_cv_dcl_sys_errlist'+set}'`\" = set"; then +# It's possible (for near-UNIX clones) that the data doesn't exist +if eval "test \"`echo '$''{'cf_cv_have_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext <> confdefs.h <&6 +echo "configure:4162: checking existence of errno" >&5 + cat > conftest.$ac_ext < -#include -#include +#undef errno +extern long errno; + int main() { - char *c = (char *) *sys_errlist; +errno = 2 ; return 0; } EOF -if { (eval echo configure:3245: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - nc_cv_dcl_sys_errlist=yes + eval 'cf_cv_have_'errno'=yes' else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - nc_cv_dcl_sys_errlist=no + eval 'cf_cv_have_'errno'=no' fi rm -f conftest* - + eval 'cf_result=$cf_cv_have_'errno + echo "$ac_t""$cf_result" 1>&6 +else + eval 'cf_cv_have_'errno'=yes' fi -echo "$ac_t""$nc_cv_dcl_sys_errlist" 1>&6 -test $nc_cv_dcl_sys_errlist = yes && cat >> confdefs.h <<\EOF -#define HAVE_EXTERN_SYS_ERRLIST 1 +fi + +eval 'cf_result=HAVE_'errno + +cf_result=`echo $cf_result | tr '[a-z]' '[A-Z]'` + +eval 'test $cf_cv_have_'errno' = yes && cat >> confdefs.h <&6 -echo "configure:3266: checking if data-only library module links" >&5 -if eval "test \"`echo '$''{'nc_cv_link_dataonly'+set}'`\" = set"; then +echo "configure:4204: checking if data-only library module links" >&5 +if eval "test \"`echo '$''{'cf_cv_link_dataonly'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest.a cat >conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; } ; then + if { (eval echo configure:4214: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } ; 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; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:4233: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then mv conftest.o func.o && \ ( $AR $AR_OPTS conftest.a func.o ) 2>&5 1>/dev/null fi rm -f conftest.$ac_ext func.o ( eval $ac_cv_prog_RANLIB conftest.a ) 2>&5 >/dev/null - nc_saveLIBS="$LIBS" + cf_saveLIBS="$LIBS" LIBS="conftest.a $LIBS" if test "$cross_compiling" = yes; then - nc_cv_link_dataonly=unknown + cf_cv_link_dataonly=unknown else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4255: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then - nc_cv_link_dataonly=yes + cf_cv_link_dataonly=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* - nc_cv_link_dataonly=no + cf_cv_link_dataonly=no fi rm -fr conftest* fi - LIBS="$nc_saveLIBS" + LIBS="$cf_saveLIBS" fi -echo "$ac_t""$nc_cv_link_dataonly" 1>&6 -test $nc_cv_link_dataonly = no && cat >> confdefs.h <<\EOF +echo "$ac_t""$cf_cv_link_dataonly" 1>&6 +test $cf_cv_link_dataonly = no && cat >> confdefs.h <<\EOF #define BROKEN_LINKER 1 EOF echo $ac_n "checking for speed_t""... $ac_c" 1>&6 -echo "configure:3341: checking for speed_t" >&5 -if eval "test \"`echo '$''{'nc_cv_type_speed_t'+set}'`\" = set"; then +echo "configure:4279: checking for speed_t" >&5 +if eval "test \"`echo '$''{'cf_cv_type_speed_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3354,21 +4292,21 @@ int main() { speed_t x = 0 ; return 0; } EOF -if { (eval echo configure:3358: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4296: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - nc_cv_type_speed_t=yes + cf_cv_type_speed_t=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - nc_cv_type_speed_t=no + cf_cv_type_speed_t=no fi rm -f conftest* fi -echo "$ac_t""$nc_cv_type_speed_t" 1>&6 -test $nc_cv_type_speed_t != yes && cat >> confdefs.h <<\EOF +echo "$ac_t""$cf_cv_type_speed_t" 1>&6 +test $cf_cv_type_speed_t != yes && cat >> confdefs.h <<\EOF #define speed_t unsigned EOF @@ -3378,7 +4316,9 @@ EOF for ac_func in \ getttynam \ memccpy \ +nanosleep \ poll \ +remove \ select \ setbuf \ setbuffer \ @@ -3390,16 +4330,17 @@ tcgetattr \ times \ usleep \ vfscanf \ +vsnprintf \ vsscanf \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3398: checking for $ac_func" >&5 +echo "configure:4339: 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; then +if { (eval echo configure:4367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3447,35 +4388,137 @@ fi done +if test "$with_getcap" = "yes" ; then + +echo $ac_n "checking for terminal-capability database functions""... $ac_c" 1>&6 +echo "configure:4395: checking for terminal-capability database functions" >&5 +if eval "test \"`echo '$''{'cf_cv_cgetent'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +cat > conftest.$ac_ext < +int main() { + + char temp[128]; + char *buf = temp; + char *db_array = temp; + cgetent(&buf, /* int *, */ &db_array, "vt100"); + cgetcap(buf, "tc", '='); + cgetmatch(buf, "tc"); + +; return 0; } +EOF +if { (eval echo configure:4416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + cf_cv_cgetent=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cv_cgetent=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$cf_cv_cgetent" 1>&6 +test $cf_cv_cgetent = yes && cat >> confdefs.h <<\EOF +#define HAVE_BSD_CGETENT 1 +EOF + + +fi + + +echo $ac_n "checking for isascii""... $ac_c" 1>&6 +echo "configure:4439: checking for isascii" >&5 +if eval "test \"`echo '$''{'cf_cv_have_isascii'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { +int x = isascii(' ') +; return 0; } +EOF +if { (eval echo configure:4452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + cf_cv_have_isascii=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cv_have_isascii=no +fi +rm -f conftest* + +fi +echo "$ac_t""$cf_cv_have_isascii" 1>&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 $ac_n "checking whether sigaction needs _POSIX_SOURCE""... $ac_c" 1>&6 -echo "configure:3453: checking whether sigaction needs _POSIX_SOURCE" >&5 +echo "configure:4473: checking whether sigaction needs _POSIX_SOURCE" >&5 cat > conftest.$ac_ext < #include int main() { -struct sigaction act; +struct sigaction act ; return 0; } EOF -if { (eval echo configure:3463: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4484: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* sigact_bad=no else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - sigact_bad=yes cat >> confdefs.h <<\EOF + +cat > conftest.$ac_ext < +#include +int main() { +struct sigaction act +; return 0; } +EOF +if { (eval echo configure:4503: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + sigact_bad=yes + cat >> confdefs.h <<\EOF #define SVR4_ACTION 1 EOF +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + sigact_bad=unknown +fi +rm -f conftest* fi rm -f conftest* echo "$ac_t""$sigact_bad" 1>&6 fi -# some machines require _POSIX_SOURCE to completely define struct termios + if test $ac_cv_header_termios_h = yes ; then case "$CFLAGS" in *-D_POSIX_SOURCE*) @@ -3484,16 +4527,16 @@ if test $ac_cv_header_termios_h = yes ; then esac if test $termios_bad = maybe ; then echo $ac_n "checking whether termios.h needs _POSIX_SOURCE""... $ac_c" 1>&6 -echo "configure:3488: checking whether termios.h needs _POSIX_SOURCE" >&5 +echo "configure:4531: checking whether termios.h needs _POSIX_SOURCE" >&5 cat > conftest.$ac_ext < int main() { struct termios foo; int x = foo.c_iflag ; return 0; } EOF -if { (eval echo configure:3497: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4540: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* termios_bad=no else @@ -3502,7 +4545,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4558: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* termios_bad=unknown else @@ -3531,11 +4574,12 @@ rm -f conftest* fi fi + if test "$cross_compiling" = yes ; then echo "configure: warning: cross compiling: assume setvbuf params not reversed" 1>&2 else echo $ac_n "checking whether setvbuf arguments are reversed""... $ac_c" 1>&6 -echo "configure:3539: checking whether setvbuf arguments are reversed" >&5 +echo "configure:4583: checking whether setvbuf arguments are reversed" >&5 if eval "test \"`echo '$''{'ac_cv_func_setvbuf_reversed'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3543,7 +4587,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < /* If setvbuf has the reversed format, exit 0. */ @@ -3557,7 +4601,7 @@ main () { exit(0); /* Non-reversed systems segv here. */ } EOF -if { (eval echo configure:3561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_setvbuf_reversed=yes else @@ -3582,12 +4626,12 @@ fi fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:3586: checking return type of signal handlers" >&5 +echo "configure:4630: 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 @@ -3604,7 +4648,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:3608: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4652: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -3624,13 +4668,13 @@ EOF echo $ac_n "checking for type sigaction_t""... $ac_c" 1>&6 -echo "configure:3628: checking for type sigaction_t" >&5 -if eval "test \"`echo '$''{'nc_cv_type_sigaction'+set}'`\" = set"; then +echo "configure:4672: checking for type sigaction_t" >&5 +if eval "test \"`echo '$''{'cf_cv_type_sigaction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3638,89 +4682,112 @@ int main() { sigaction_t x ; return 0; } EOF -if { (eval echo configure:3642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4686: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - nc_cv_type_sigaction=yes + cf_cv_type_sigaction=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - nc_cv_type_sigaction=no + cf_cv_type_sigaction=no fi rm -f conftest* - fi -echo "$ac_t""$nc_cv_type_sigaction" 1>&6 -test $nc_cv_type_sigaction = yes && cat >> confdefs.h <<\EOF +echo "$ac_t""$cf_cv_type_sigaction" 1>&6 +test $cf_cv_type_sigaction = yes && cat >> confdefs.h <<\EOF #define HAVE_TYPE_SIGACTION 1 EOF -echo $ac_n "checking for working TIOCGWINSZ""... $ac_c" 1>&6 -echo "configure:3663: checking for working TIOCGWINSZ" >&5 -if eval "test \"`echo '$''{'nc_cv_use_tiocgwinsz'+set}'`\" = set"; then +echo $ac_n "checking declaration of size-change""... $ac_c" 1>&6 +echo "configure:4706: checking declaration of size-change" >&5 +if eval "test \"`echo '$''{'cf_cv_sizechange'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test "$cross_compiling" = yes; then - nc_cv_use_tiocgwinsz=unknown -else - cat > conftest.$ac_ext < conftest.$ac_ext < #if HAVE_TERMIOS_H #include +#else +#if HAVE_TERMIO_H +#include +#endif #endif -#if SYSTEM_LOOKS_LIKE_SCO -/* they neglected to define struct winsize in termios.h -- it's only - in termio.h */ -#include -#include +#if NEED_PTEM_H +/* This is a workaround for SCO: they neglected to define struct winsize in + * termios.h -- it's only in termio.h and ptem.h + */ +#include +#include #endif #if !defined(sun) || !defined(HAVE_TERMIOS_H) #include #endif -int main() -{ - static struct winsize size; - int fd; - for (fd = 0; fd <= 2; fd++) { /* try in/out/err in case redirected */ - if (ioctl(0, TIOCGWINSZ, &size) == 0 - && size.ws_row > 0 - && size.ws_col > 0) - exit(0); - } - exit(0); /* in either case, it compiles & links ... */ -} - + +int main() { + +#ifdef TIOCGSIZE + struct ttysize win; /* FIXME: what system is this? */ + int y = win.ts_lines; + int x = win.ts_cols; +#else +#ifdef TIOCGWINSZ + struct winsize win; + int y = win.ws_row; + int x = win.ws_col; +#else + no TIOCGSIZE or TIOCGWINSZ +#endif /* TIOCGWINSZ */ +#endif /* TIOCGSIZE */ + +; return 0; } EOF -if { (eval echo configure:3701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - nc_cv_use_tiocgwinsz=yes +if { (eval echo configure:4759: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cf_cv_sizechange=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -fr conftest* - nc_cv_use_tiocgwinsz=no -fi -rm -fr conftest* + rm -rf conftest* + cf_cv_sizechange=no fi +rm -f conftest* + CFLAGS="$cf_save_CFLAGS" + if test "$cf_cv_sizechange" = yes ; then + echo "size-change succeeded ($cf_opts)" >&5 + test -n "$cf_opts" && cat >> confdefs.h <&6 -test $nc_cv_use_tiocgwinsz != yes && cat >> confdefs.h <<\EOF -#define BROKEN_TIOCGWINSZ 1 +echo "$ac_t""$cf_cv_sizechange" 1>&6 +test $cf_cv_sizechange != no && cat >> confdefs.h <<\EOF +#define HAVE_SIZECHANGE 1 EOF -case "$nc_cv_systype" in -Linux) +case "$cf_cv_system_name" in +linux*) cat >> confdefs.h <<\EOF #define GOOD_SELECT 1 EOF @@ -3728,7 +4795,7 @@ EOF ;; esac -if test -z "$nc_user_CFLAGS" ; then +if test -z "$cf_user_CFLAGS" ; then CFLAGS=`echo ${CFLAGS} | sed -e 's/-g //' -e 's/-g$//'` CXXFLAGS=`echo ${CXXFLAGS} | sed -e 's/-g //' -e 's/-g$//'` fi @@ -3737,7 +4804,7 @@ if test -n "$CXX" ; then # Extract the first word of "$CXX", so it can be a program name with args. set dummy $CXX; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3741: checking for $ac_word" >&5 +echo "configure:4808: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX_EXISTS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3775,14 +4842,14 @@ ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $L cross_compiling=$ac_cv_prog_cxx_cross -nc_cxx_library=unknown +cf_cxx_library=unknown if test $ac_cv_prog_gxx = yes; then echo $ac_n "checking for libg++""... $ac_c" 1>&6 -echo "configure:3782: checking for libg++" >&5 - nc_save="$LIBS" +echo "configure:4849: checking for libg++" >&5 + cf_save="$LIBS" LIBS="$LIBS -lg++ -lm" cat > conftest.$ac_ext < @@ -3791,23 +4858,23 @@ int main() { float foo=abs(1.0) ; return 0; } EOF -if { (eval echo configure:3795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - nc_cxx_library=yes + cf_cxx_library=yes CXXLIBS="$CXXLIBS -lg++ -lm" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - nc_cxx_library=no + cf_cxx_library=no fi rm -f conftest* - LIBS="$nc_save" - echo "$ac_t""$nc_cxx_library" 1>&6 + LIBS="$cf_save" + echo "$ac_t""$cf_cxx_library" 1>&6 fi echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6 -echo "configure:3811: checking how to run the C++ preprocessor" >&5 +echo "configure:4878: checking how to run the C++ preprocessor" >&5 if test -z "$CXXCPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3820,12 +4887,12 @@ ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $L cross_compiling=$ac_cv_prog_cxx_cross CXXCPP="${CXX-g++} -E" cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3829: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4896: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -3847,17 +4914,17 @@ for ac_hdr in builtin.h typeinfo do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3851: checking for $ac_hdr" >&5 +echo "configure:4918: 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:3861: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4928: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3885,50 +4952,50 @@ done echo $ac_n "checking for builtin c++ bool type""... $ac_c" 1>&6 -echo "configure:3889: checking for builtin c++ bool type" >&5 -if eval "test \"`echo '$''{'nc_cv_builtin_bool'+set}'`\" = set"; then +echo "configure:4956: checking for builtin c++ bool type" >&5 +if eval "test \"`echo '$''{'cf_cv_builtin_bool'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4969: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - nc_cv_builtin_bool=1 + cf_cv_builtin_bool=1 else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - nc_cv_builtin_bool=0 + cf_cv_builtin_bool=0 fi rm -f conftest* fi -if test $nc_cv_builtin_bool = 1 +if test $cf_cv_builtin_bool = 1 then echo "$ac_t""yes" 1>&6 else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for size of c++ bool""... $ac_c" 1>&6 -echo "configure:3922: checking for size of c++ bool" >&5 -if eval "test \"`echo '$''{'nc_cv_type_of_bool'+set}'`\" = set"; then +echo "configure:4989: checking for size of c++ bool" >&5 +if eval "test \"`echo '$''{'cf_cv_type_of_bool'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - rm -f nc_test.out + rm -f cf_test.out if test "$cross_compiling" = yes; then - nc_cv_type_of_bool=unknown + cf_cv_type_of_bool=unknown else cat > conftest.$ac_ext <= 0) + fputs("unsigned ", fp); if (sizeof(x) == sizeof(int)) fputs("int", fp); else if (sizeof(x) == sizeof(char)) fputs("char", fp); else if (sizeof(x) == sizeof(short))fputs("short",fp); @@ -3954,14 +5023,14 @@ main() } EOF -if { (eval echo configure:3958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then - nc_cv_type_of_bool=`cat nc_test.out` + cf_cv_type_of_bool=`cat cf_test.out` else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* - nc_cv_type_of_bool=unknown + cf_cv_type_of_bool=unknown fi rm -fr conftest* fi @@ -3969,35 +5038,37 @@ fi fi - rm -f nc_test.out -echo "$ac_t""$nc_cv_type_of_bool" 1>&6 -if test $nc_cv_type_of_bool = unknown ; then + rm -f cf_test.out +echo "$ac_t""$cf_cv_type_of_bool" 1>&6 +if test "$cf_cv_type_of_bool" = unknown ; then echo "configure: warning: Assuming unsigned for type of bool" 1>&2 - nc_cv_type_of_bool=unsigned + cf_cv_type_of_bool=unsigned fi else - nc_cxx_library=no - if eval "test \"`echo '$''{'nc_cv_builtin_bool'+set}'`\" = set"; then + cf_cxx_library=no + if eval "test \"`echo '$''{'cf_cv_builtin_bool'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - nc_cv_builtin_bool=0 + cf_cv_builtin_bool=0 fi - if eval "test \"`echo '$''{'nc_cv_sizeof_bool'+set}'`\" = set"; then + if eval "test \"`echo '$''{'cf_cv_sizeof_bool'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - nc_cv_sizeof_bool=int + cf_cv_sizeof_bool=int fi fi -nc_ada_make=gnatmake -# Extract the first word of "$nc_ada_make", so it can be a program name with args. -set dummy $nc_ada_make; ac_word=$2 + + +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4001: checking for $ac_word" >&5 +echo "configure:5072: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gnat_exists'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4024,24 +5095,31 @@ else fi if test "$ac_cv_prog_gnat_exists" = no; then - nc_ada_make= + cf_ada_make= else -nc_cv_gnat_version=`$nc_ada_make -v 2>&1 | grep '[0-9].[0-9][0-9]*' |\ +cf_cv_gnat_version=`$cf_ada_make -v 2>&1 | grep '[0-9].[0-9][0-9]*' |\ sed -e 's/[^0-9 \.]//g' | $AWK '{print $1;}'` -case $nc_cv_gnat_version in - 3.0[5-9]|3.[1-9]*|[4-9].*) +case $cf_cv_gnat_version in + 3.[1-9]*|[4-9].*) ac_cv_prog_gnat_correct=yes ;; - *) echo Unsupported GNAT version $nc_cv_gnat_version. Disabling Ada95 binding. + *) echo Unsupported GNAT version $cf_cv_gnat_version. Required is 3.10 or better. Disabling Ada95 binding. ac_cv_prog_gnat_correct=no ;; esac +case $cf_cv_gnat_version in + 3.1*|[4-9].*) + cf_compile_generics=generics + ;; + *) cf_compile_generics= + ;; +esac # Extract the first word of "m4", so it can be a program name with args. set dummy m4; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4045: checking for $ac_word" >&5 +echo "configure:5123: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_m4_exists'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4073,12 +5151,76 @@ fi fi fi if test "$ac_cv_prog_gnat_correct" = yes; then - nc_ada_compiler=gcc - nc_ada_package=terminal_interface + ADAFLAGS="-O3 $ADAFLAGS" + cf_ada_compiler=gcc + cf_ada_package=terminal_interface + + + + + + + +# Check whether --with-ada-include or --without-ada-include was given. +if test "${with_ada_include+set}" = set; then + withval="$with_ada_include" + : +else + withval="${ADA_INCLUDE-$exec_prefix/ada_include}" +fi +case ".$withval" in #(vi +./*) #(vi + ;; +.\${*prefix}*) #(vi + eval withval="$withval" + case ".$withval" in #(vi + .NONE/*) + withval=`echo $withval | sed -e s@NONE@$ac_default_prefix@` + ;; + esac + ;; #(vi +.NONE/*) + withval=`echo $withval | sed -e s@NONE@$ac_default_prefix@` + ;; +*) + { echo "configure: error: expected a pathname for ada-include" 1>&2; exit 1; } + ;; +esac +eval ADA_INCLUDE="$withval" + + +# Check whether --with-ada-objects or --without-ada-objects was given. +if test "${with_ada_objects+set}" = set; then + withval="$with_ada_objects" + : +else + withval="${ADA_OBJECTS-$exec_prefix/ada_objects}" +fi +case ".$withval" in #(vi +./*) #(vi + ;; +.\${*prefix}*) #(vi + eval withval="$withval" + case ".$withval" in #(vi + .NONE/*) + withval=`echo $withval | sed -e s@NONE@$ac_default_prefix@` + ;; + esac + ;; #(vi +.NONE/*) + withval=`echo $withval | sed -e s@NONE@$ac_default_prefix@` + ;; +*) + { echo "configure: error: expected a pathname for ada-objects" 1>&2; exit 1; } + ;; +esac +eval ADA_OBJECTS="$withval" + + fi ### It's not possible to appease gcc 2.6.3's conversion-warnings if we're @@ -4088,17 +5230,30 @@ if test -n "$with_warnings"; then if test -n "$GCC"; then case "`$CC --version`" in 2.6.3) - if test "$nc_cv_sizeof_bool" != "char"; then - nc_warn_CFLAGS="$nc_warn_CFLAGS -Wconversion" + if test "$cf_cv_sizeof_bool" != "char"; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wconversion" fi ;; 2.5*) - nc_warn_CFLAGS="$nc_warn_CFLAGS -Wconversion" + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wconversion" ;; esac fi fi +### Construct the library-subsets, if any, from this set of keywords: +### none, base, ext_funcs, termlib. +echo $ac_n "checking for library subsets""... $ac_c" 1>&6 +echo "configure:5248: checking for library subsets" >&5 +if test "$with_termlib" = yes ; then + LIB_SUBSETS="termlib " +else + LIB_SUBSETS="termlib+" +fi +LIB_SUBSETS="${LIB_SUBSETS}base" +test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs" +echo "$ac_t""$LIB_SUBSETS" 1>&6 + ### Construct the list of include-directories to be generated CPPFLAGS="$CPPFLAGS -I. -I../include" @@ -4137,55 +5292,86 @@ fi +### Set up low-level terminfo dependencies for makefiles. Note that we +### could override this. +if test "$with_termlib" = yes ; then + TEST_DEPS="${LIB_PREFIX}${TINFO_NAME}${DFT_DEP_SUFFIX}" + TEST_ARGS="-l${TINFO_NAME}${DFT_ARG_SUFFIX}" +fi +PROG_DEPS="$TEST_DEPS" +PROG_ARGS="$TEST_ARGS" + ### Construct the list of subdirectories for which we'll customize makefiles ### with the appropriate compile-rules. + echo $ac_n "checking for src modules""... $ac_c" 1>&6 -echo "configure:4145: checking for src modules" >&5 -TEST_DEPS="${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX}" -TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX}" -nc_cv_src_modules= -for nc_dir in ncurses progs panel menu form +echo "configure:5310: checking for src modules" >&5 + +# dependencies and linker-arguments for test-programs +TEST_DEPS="${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS" +TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS" + +# dependencies and linker-arguments for utility-programs +PROG_ARGS="$TEST_ARGS" + +cf_cv_src_modules= +for cf_dir in $modules_to_build do - if test -f $srcdir/$nc_dir/modules; then - if test -z "$nc_cv_src_modules"; then - nc_cv_src_modules=$nc_dir + if test -f $srcdir/$cf_dir/modules; then + + # We may/may not have tack in the distribution, though the + # makefile is. + if test $cf_dir = tack ; then + if test ! -f $srcdir/${cf_dir}/${cf_dir}.h; then + continue + fi + fi + + if test -z "$cf_cv_src_modules"; then + cf_cv_src_modules=$cf_dir else - nc_cv_src_modules="$nc_cv_src_modules $nc_dir" + cf_cv_src_modules="$cf_cv_src_modules $cf_dir" fi + # Make the ncurses_cfg.h file record the library interface files as # well. These are header files that are the same name as their # directory. Ncurses is the only library that does not follow # that pattern. - if test -f $srcdir/${nc_dir}/${nc_dir}.h; then + if test $cf_dir = tack ; then + continue + elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then -nc_have_include=`echo $nc_dir |tr '[a-z]' '[A-Z]'` +cf_have_include=`echo $cf_dir | tr '[a-z]' '[A-Z]'` cat >> confdefs.h <> confdefs.h <&6 -TEST_ARGS="-L${LIB_DIR} $TEST_ARGS" +echo "$ac_t""$cf_cv_src_modules" 1>&6 +TEST_ARGS="-L${LIB_DIR} -L\$(libdir) $TEST_ARGS" + +PROG_ARGS="-L${LIB_DIR} -L\$(libdir) $PROG_ARGS" + SRC_SUBDIRS="man include" -for nc_dir in $nc_cv_src_modules +for cf_dir in $cf_cv_src_modules do - SRC_SUBDIRS="$SRC_SUBDIRS $nc_dir" + SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir" done SRC_SUBDIRS="$SRC_SUBDIRS misc test" -test $nc_cxx_library != no && SRC_SUBDIRS="$SRC_SUBDIRS c++" +test $cf_cxx_library != no && SRC_SUBDIRS="$SRC_SUBDIRS c++" ADA_SUBDIRS= if test "$ac_cv_prog_gnat_correct" = yes && test -d $srcdir/Ada95; then @@ -4194,42 +5380,42 @@ if test "$ac_cv_prog_gnat_correct" = yes && test -d $srcdir/Ada95; then fi SUB_MAKEFILES= -for nc_dir in $SRC_SUBDIRS +for cf_dir in $SRC_SUBDIRS do - SUB_MAKEFILES="$SUB_MAKEFILES $nc_dir/Makefile" + SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile" done if test -n "$ADA_SUBDIRS"; then - for nc_dir in $ADA_SUBDIRS + for cf_dir in $ADA_SUBDIRS do - SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$nc_dir/Makefile" + SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile" done fi DIRS_TO_MAKE="lib" -for nc_item in $nc_list_models +for cf_item in $cf_list_models do - case $nc_item in - normal) nc_subdir='objects' ;; - debug) nc_subdir='obj_g' ;; - profile) nc_subdir='obj_p' ;; - shared) nc_subdir='obj_s' ;; + case $cf_item in + normal) cf_subdir='objects' ;; + debug) cf_subdir='obj_g' ;; + profile) cf_subdir='obj_p' ;; + shared) cf_subdir='obj_s' ;; esac - DIRS_TO_MAKE="$DIRS_TO_MAKE $nc_subdir" + DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir" done -for nc_dir in $DIRS_TO_MAKE +for cf_dir in $DIRS_TO_MAKE do - test ! -d $nc_dir && mkdir $nc_dir + test ! -d $cf_dir && mkdir $cf_dir done ### Now that we're done running tests, add the compiler-warnings, if any -CFLAGS="$CFLAGS $nc_warn_CFLAGS" +CFLAGS="$CFLAGS $EXTRA_CFLAGS" ################################################################################ trap '' 1 2 15 @@ -4295,19 +5481,7 @@ fi trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - +DEFS=-DHAVE_CONFIG_H # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} @@ -4334,7 +5508,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12.970309" + echo "$CONFIG_STATUS generated by autoconf version 2.12.971230" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -4345,13 +5519,13 @@ done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo "include/config_h \ +trap 'rm -fr `echo "\ include/MKterm.h.awk \ include/curses.h \ include/termcap.h \ include/unctrl.h \ $SUB_MAKEFILES \ - Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 + Makefile include/ncurses_cfg.h:include/ncurses_cfg.hin" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + + +# Transform confdefs.h into a list of #define's. We won't use it as a sed +# script, but as data to insert where we see @DEFS@. We expect AC_SAVE_DEFS to +# be either 'cat' or 'sort'. +sort confdefs.h >conftest.vals + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +echo ' rm -f conftest.frag' >> $CONFIG_STATUS +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write chunks of a limited-size here document to conftest.frag. + echo ' cat >> conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +# Run sed to substitute the contents of conftest.frag into conftest.in at the +# marker @DEFS@. +echo ' cat >> conftest.edit < conftest.out +rm -f conftest.in +mv conftest.out conftest.in +rm -f conftest.edit conftest.frag +' >> $CONFIG_STATUS + + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +# Extra commands, if any + case $cf_cv_system_name in + os2) cf_prefix='' ;; + *) cf_prefix='lib' ;; + esac -for nc_dir in $SRC_SUBDIRS +for cf_dir in $SRC_SUBDIRS do - if test -f $srcdir/$nc_dir/modules; then + if test -f $srcdir/$cf_dir/modules; then - nc_libs_to_make= - for nc_item in $NC_LIST_MODELS + cf_libs_to_make= + for cf_item in $CF_LIST_MODELS do - - case $nc_item in - normal) nc_suffix='.a' ;; - debug) nc_suffix='_g.a' ;; - profile) nc_suffix='_p.a' ;; + case $cf_item in + normal) cf_suffix='.a' ;; + debug) cf_suffix='_g.a' ;; + profile) cf_suffix='_p.a' ;; shared) - case $nc_cv_systype in - NetBSD|FreeBSD) - nc_suffix='.so.$(ABI_VERSION)' ;; - HP_UX) nc_suffix='.sl' ;; - *) nc_suffix='.so' ;; + case $cf_cv_system_name in + openbsd*|netbsd*|freebsd*) + cf_suffix='.so.$(REL_VERSION)' ;; + hpux*) cf_suffix='.sl' ;; + *) cf_suffix='.so' ;; esac esac - nc_libs_to_make="$nc_libs_to_make ../lib/lib${nc_dir}${nc_suffix}" + cf_libs_to_make="$cf_libs_to_make ../lib/${cf_prefix}${cf_dir}${cf_suffix}" done - sed -e "s@\@LIBS_TO_MAKE\@@$nc_libs_to_make@" \ - $nc_dir/Makefile >$nc_dir/Makefile.out - mv $nc_dir/Makefile.out $nc_dir/Makefile + if test $cf_dir = ncurses ; then + case "$LIB_SUBSETS" in + termlib+*) #(vi + ;; + *) #(vi + cf_item=`echo $cf_libs_to_make |sed -e s/$LIB_NAME/$TINFO_NAME/g` + cf_libs_to_make="$cf_libs_to_make $cf_item" + ;; + esac + fi + + sed -e "s@\@LIBS_TO_MAKE\@@$cf_libs_to_make@" \ + $cf_dir/Makefile >$cf_dir/Makefile.out + mv $cf_dir/Makefile.out $cf_dir/Makefile $AWK -f $srcdir/mk-0th.awk \ - name=$nc_dir \ - $srcdir/$nc_dir/modules >>$nc_dir/Makefile + name=$cf_dir \ + $srcdir/$cf_dir/modules >>$cf_dir/Makefile - for nc_item in $NC_LIST_MODELS + for cf_item in $CF_LIST_MODELS do - echo 'Appending rules for '$nc_item' model ('$nc_dir')' + echo 'Appending rules for '$cf_item' model ('$cf_dir')' -NC_ITEM=`echo $nc_item |tr '[a-z]' '[A-Z]'` +CF_ITEM=`echo $cf_item | tr '[a-z]' '[A-Z]'` - - case $nc_item in - normal) nc_suffix='.a' ;; - debug) nc_suffix='_g.a' ;; - profile) nc_suffix='_p.a' ;; + case $cf_item in + normal) cf_suffix='.a' ;; + debug) cf_suffix='_g.a' ;; + profile) cf_suffix='_p.a' ;; shared) - case $nc_cv_systype in - NetBSD|FreeBSD) - nc_suffix='.so.$(ABI_VERSION)' ;; - HP_UX) nc_suffix='.sl' ;; - *) nc_suffix='.so' ;; + case $cf_cv_system_name in + openbsd*|netbsd*|freebsd*) + cf_suffix='.so.$(REL_VERSION)' ;; + hpux*) cf_suffix='.sl' ;; + *) cf_suffix='.so' ;; esac esac - case $nc_item in - normal) nc_subdir='objects' ;; - debug) nc_subdir='obj_g' ;; - profile) nc_subdir='obj_p' ;; - shared) nc_subdir='obj_s' ;; + case $cf_item in + normal) cf_subdir='objects' ;; + debug) cf_subdir='obj_g' ;; + profile) cf_subdir='obj_p' ;; + shared) cf_subdir='obj_s' ;; esac # These dependencies really are for development, not # builds, but they are useful in porting, too. - nc_depend="../include/ncurses_cfg.h" + cf_depend="../include/ncurses_cfg.h" if test "$srcdir" = "."; then - nc_reldir="." + cf_reldir="." else - nc_reldir="\$(srcdir)" + cf_reldir="\$(srcdir)" fi - if test -f $srcdir/$nc_dir/$nc_dir.priv.h; then - nc_depend="$nc_depend $nc_reldir/$nc_dir.priv.h" - elif test -f $srcdir/$nc_dir/curses.priv.h; then - nc_depend="$nc_depend $nc_reldir/curses.priv.h" + + if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then + cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h" + elif test -f $srcdir/$cf_dir/curses.priv.h; then + cf_depend="$cf_depend $cf_reldir/curses.priv.h" fi + + for cf_subset in $LIB_SUBSETS + do $AWK -f $srcdir/mk-1st.awk \ - name=$nc_dir \ - MODEL=$NC_ITEM \ - model=$nc_subdir \ - suffix=$nc_suffix \ - DoLinks=$nc_cv_do_symlinks \ - rmSoLocs=$nc_cv_rm_so_locs \ + name=$cf_dir \ + MODEL=$CF_ITEM \ + model=$cf_subdir \ + prefix=$cf_prefix \ + suffix=$cf_suffix \ + subset=$cf_subset \ + DoLinks=$cf_cv_do_symlinks \ + rmSoLocs=$cf_cv_rm_so_locs \ + ldconfig="$LDCONFIG" \ overwrite=$WITH_OVERWRITE \ - depend="$nc_depend" \ - $srcdir/$nc_dir/modules >>$nc_dir/Makefile - test $nc_dir = ncurses && WITH_OVERWRITE=no + depend="$cf_depend" \ + target="$target" \ + $srcdir/$cf_dir/modules >>$cf_dir/Makefile + test $cf_dir = ncurses && WITH_OVERWRITE=no $AWK -f $srcdir/mk-2nd.awk \ - name=$nc_dir \ - MODEL=$NC_ITEM \ - model=$nc_subdir \ + name=$cf_dir \ + MODEL=$CF_ITEM \ + model=$cf_subdir \ + subset=$cf_subset \ srcdir=$srcdir \ echo=$WITH_ECHO \ - $srcdir/$nc_dir/modules >>$nc_dir/Makefile + $srcdir/$cf_dir/modules >>$cf_dir/Makefile + done done fi - echo ' cd '$nc_dir'; $(MAKE) $(NC_MFLAGS) $@' >>Makefile + echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) $@' >>Makefile done -for nc_dir in $SRC_SUBDIRS +for cf_dir in $SRC_SUBDIRS do - if test -f $srcdir/$nc_dir/modules; then + if test -f $cf_dir/Makefile ; then + case "$cf_dir" in + Ada95) #(vi + echo 'install.libs \' >> Makefile + echo 'uninstall.libs ::' >> Makefile + echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) $@' >> Makefile + ;; + esac + fi + + if test -f $srcdir/$cf_dir/modules; then echo >> Makefile - if test -f $srcdir/$nc_dir/headers; then -cat >> Makefile <> Makefile <> Makefile fi -cat >> Makefile <> Makefile <> Makefile <> Makefile <> Makefile <> Makefile <headers.sh <headers.sh <>$nc_dir/Makefile <>$cf_dir/Makefile <>$nc_dir/Makefile + test -n "$j" && echo " $j \\" >>$cf_dir/Makefile j=$i done - echo " $j" >>$nc_dir/Makefile - for i in `cat $srcdir/$nc_dir/headers |fgrep -v "#"` + echo " $j" >>$cf_dir/Makefile + for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"` do - echo " @ ../headers.sh \$(INSTALL_DATA) \$(INSTALL_PREFIX)\$(includedir) \$(srcdir) $i" >>$nc_dir/Makefile + echo " @ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f `basename $i`) ; ../headers.sh \$(INSTALL_DATA) \$(INSTALL_PREFIX)\$(includedir) \$(srcdir) $i" >>$cf_dir/Makefile + test $i = curses.h && echo " @ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f ncurses.h && \$(LN_S) curses.h ncurses.h)" >>$cf_dir/Makefile done - fi -done + cat >>$cf_dir/Makefile <>$cf_dir/Makefile + test $i = curses.h && echo " -@ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f ncurses.h)" >>$cf_dir/Makefile + done + fi +done -### Special editing. We generate ncurses_cfg.h directly to allow all filenames -### to be MSDOS-compatible, as well as to make the list of definitions be -### dynamically determined by the configuration script -- a consideration when -### doing type-clean development testing. - -echo creating include/ncurses_cfg.h -rm -f include/ncurses_cfg.h -echo "/* generated by configure-script - * On host: $SYS_NAME - */ -#ifndef NC_CONFIG_H -#define NC_CONFIG_H" >include/ncurses_cfg.h -sed -e '/^ -D/!d' \ - -e 's/ -D/\ -#define /g' \ - -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1 /g' \ - -e 's/\\//g' \ - include/config_h | sort >>include/ncurses_cfg.h -echo " - /* The C compiler may not treat these properly, but C++ has to */ -#ifdef __cplusplus -#undef const -#undef inline -#else -#if defined(lint) || defined(TRACE) -#undef inline -#define inline /* nothing */ -#endif -#endif -#endif /* NC_CONFIG_H */" >> include/ncurses_cfg.h -echo removing include/config_h -rm include/config_h exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 -make preinstall +${MAKE-make} preinstall diff --git a/configure.in b/configure.in index 3e202a79..4ccaceee 100644 --- a/configure.in +++ b/configure.in @@ -1,30 +1,46 @@ -dnl***************************************************************************** -dnl Copyright 1996,1997 by Thomas E. Dickey * -dnl All Rights Reserved. * -dnl * -dnl Permission to use, copy, modify, and distribute this software and its * -dnl documentation for any purpose and without fee is hereby granted, provided * -dnl that the above copyright notice appear in all copies and that both that * -dnl copyright notice and this permission notice appear in supporting * -dnl documentation, and that the name of the above listed copyright holder(s) * -dnl not be used in advertising or publicity pertaining to distribution of the * -dnl software without specific, written prior permission. THE ABOVE LISTED * -dnl COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * -dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * -dnl EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * -dnl SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * -dnl RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * -dnl CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * -dnl CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * -dnl***************************************************************************** -dnl $Id: configure.in,v 1.64 1997/05/10 15:26:07 tom Exp $ +dnl*************************************************************************** +dnl Copyright (c) 1998 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 * +dnl "Software"), to deal in the Software without restriction, including * +dnl without limitation the rights to use, copy, modify, merge, publish, * +dnl distribute, distribute with modifications, sublicense, and/or sell * +dnl copies of the Software, and to permit persons to whom the Software is * +dnl furnished to do so, subject to the following conditions: * +dnl * +dnl The above copyright notice and this permission notice shall be included * +dnl in all copies or substantial portions of the Software. * +dnl * +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * +dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * +dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * +dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * +dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * +dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * +dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. * +dnl * +dnl Except as contained in this notice, the name(s) of the above copyright * +dnl holders shall not be used in advertising or otherwise to promote the * +dnl sale, use or other dealings in this Software without prior written * +dnl authorization. * +dnl*************************************************************************** +dnl +dnl Author: Thomas E. Dickey 1996,1997 +dnl +dnl $Id: configure.in,v 1.126 1998/02/12 23:10:43 tom Exp $ dnl Process this file with autoconf to produce a configure script. -AC_PREREQ(2.12) -AC_REVISION($Revision: 1.64 $) +AC_PREREQ(2.12.971222) +AC_REVISION($Revision: 1.126 $) AC_INIT(ncurses/lib_initscr.c) +AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin) -NC_VERSION -NC_SYSTYPE +CF_SUBST_NCURSES_VERSION +CF_CHECK_CACHE +AC_ARG_WITH(system-type, +[ --with-system-type=XXX test: override derived host system-type], +[AC_MSG_WARN(overriding system type to $withval) + cf_cv_system_name=$withval]) # We need a configure script only when compiling as part of GNU C library. # Here we have to generate one of the files we need while compiling. @@ -44,7 +60,6 @@ AC_ARG_ENABLE(add-ons, dnl dnl We need to use [ and ] for other purposes for a while now. changequote(,)dnl if test x"$glibc_add_on" = "xyes" ; then -if test -f $srcdir/../glibcbug.in; then rm -f $srcdir/Banner # We are in glibc. rm -f $srcdir/Makefile @@ -54,30 +69,13 @@ if test -f $srcdir/../glibcbug.in; then 's/^[ ]*ncurses-version[ ]*=[ ]*\([^ ^ ]*\)[ ]*$/\1/'`" > $srcdir/Banner exit 0 fi -fi changequote([,])dnl ### Save the given $CFLAGS to allow user-override. -nc_user_CFLAGS="$CFLAGS" - -### Derive the system name, as a check for reusing the autoconf cache -system_name="`(uname -s -r || hostname || echo unknown) 2>/dev/null`" -if test -n "$system_name" ; then - AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") -else - system_name="`(hostname) 2>/dev/null`" -fi -AC_CACHE_VAL(nc_cv_system_name,[nc_cv_system_name="$system_name"]) -test -z "$system_name" && system_name="$nc_cv_system_name" -test -n "$nc_cv_system_name" && AC_MSG_RESULT("Configuring for $nc_cv_system_name") - -if test ".$system_name" != ".$nc_cv_system_name" ; then - AC_MSG_RESULT("Cached system name does not agree with actual") - AC_ERROR("Please remove config.cache and try again.") -fi +cf_user_CFLAGS="$CFLAGS" ### Default install-location -NC_CFG_DEFAULTS +CF_CFG_DEFAULTS ### Checks for programs. AC_PROG_CC @@ -88,21 +86,41 @@ fi AC_PROG_CPP AC_PROG_GCC_TRADITIONAL AC_ISC_POSIX +AC_PATH_PROG(LDCONFIG,ldconfig,,$PATH:/sbin:/usr/sbin) dnl DEFECT in autoconf 2.12: an attempt to set policy, this breaks the dnl configure script by not letting us test if C++ dnl is present, making this option necessary. +AC_MSG_CHECKING(if you want to build with C++) AC_ARG_WITH(cxx, - [ --without-cxx suppress check for C++]) -if test "X$withval" != Xno ; then + [ --without-cxx suppress check for C++, don't build demo], + [cf_with_cxx=$withval], + [cf_with_cxx=yes]) +AC_MSG_RESULT($cf_with_cxx) +if test "X$cf_with_cxx" != Xno ; then AC_PROG_CXX fi changequote(,)dnl -if test -n "$GXX" ; then case "`${CXX-g++} --version`" in 1*|2.[0-6]*) GXX=""; CXX=""; ac_cv_prog_gxx=no; nc_cxx_library=no ; echo No: templates do not work;; esac; fi +if test -n "$GXX" ; then case "`${CXX-g++} --version`" in 1*|2.[0-6]*) GXX=""; CXX=""; ac_cv_prog_gxx=no; cf_cxx_library=no ; echo No: templates do not work;; esac; fi changequote([,])dnl + +AC_MSG_CHECKING(if you want to build programs such as tic) +AC_ARG_WITH(progs, + [ --without-progs suppress build with programs (e.g., tic)], + [cf_with_progs=$withval], + [cf_with_progs=yes]) +AC_MSG_RESULT($cf_with_progs) + +modules_to_build="ncurses" +if test "X$cf_with_progs" != Xno ; then +modules_to_build="$modules_to_build progs tack" +fi +modules_to_build="$modules_to_build panel menu form" + AC_PROG_AWK AC_PROG_MAKE_SET -NC_PROG_INSTALL +CF_PROG_INSTALL +AC_SYS_LONG_FILE_NAMES AC_PROG_LN_S AC_PROG_RANLIB AC_CHECK_PROGS(LINT, tdlint lint alint) @@ -110,16 +128,17 @@ AC_CHECK_PROGS(MAN, man man_db) AC_SUBST(LINT_OPTS) dnl These are standard among *NIX systems, but not when cross-compiling -NC_SUBST(loader,LD,ld) -NC_SUBST(archiver,AR,ar) -NC_SUBST(archiver options,AR_OPTS,rv) +CF_SUBST(loader,LD,ld) +CF_SUBST(archiver,AR,ar) +CF_SUBST(archiver options,AR_OPTS,rv) -NC_MAKEFLAGS -NC_MAN_PAGES +CF_MAKEFLAGS +CF_MAN_PAGES dnl Special option for use by system-builders: the install-prefix is used to dnl adjust the location into which the actual install is done, so that an dnl archive can be built without modifying the host system's configuration. +AC_MSG_CHECKING(if you have specified an install-prefix) AC_ARG_WITH(install-prefix, [ --with-install-prefix prefixes actual install-location], [case "$withval" in #(vi @@ -128,67 +147,122 @@ AC_ARG_WITH(install-prefix, *) INSTALL_PREFIX="$withval" ;; esac]) +AC_MSG_RESULT($INSTALL_PREFIX) AC_SUBST(INSTALL_PREFIX) +############################################################################### +CF_HELP_MESSAGE(Options to Specify the Libraries Built/Used:) + ### Options to allow the user to specify the set of libraries which are used. ### Use "--without-normal --with-shared" to allow the default model to be ### shared, for example. -nc_list_models="" +cf_list_models="" + +AC_MSG_CHECKING(if you want to build shared libraries) AC_ARG_WITH(shared, [ --with-shared generate shared-libraries], - [test "$withval" = "yes" && nc_list_models="$nc_list_models shared"]) + [with_shared=$withval], + [with_shared=no]) +AC_MSG_RESULT($with_shared) +test "$with_shared" = "yes" && cf_list_models="$cf_list_models shared" + +AC_MSG_CHECKING(if you want to build static libraries) AC_ARG_WITH(normal, [ --with-normal generate normal-libraries (default)], - [test "$withval" = "yes" && nc_list_models="$nc_list_models normal"], - [nc_list_models="$nc_list_models normal"]) + [with_normal=$withval], + [with_normal=yes]) +AC_MSG_RESULT($with_normal) +test "$with_normal" = "yes" && cf_list_models="$cf_list_models normal" + +AC_MSG_CHECKING(if you want to build debug libraries) AC_ARG_WITH(debug, [ --with-debug generate debug-libraries (default)], - [test "$withval" = "yes" && nc_list_models="$nc_list_models debug"], - [nc_list_models="$nc_list_models debug"]) + [with_debug=$withval], + [with_debug=yes]) +AC_MSG_RESULT($with_debug) +test "$with_debug" = "yes" && cf_list_models="$cf_list_models debug" + +AC_MSG_CHECKING(if you want to build profiling libraries) AC_ARG_WITH(profile, [ --with-profile generate profile-libraries], - [test "$withval" = "yes" && nc_list_models="$nc_list_models profile"]) + [with_profile=$withval], + [with_profile=no]) +AC_MSG_RESULT($with_profile) +test "$with_profile" = "yes" && cf_list_models="$cf_list_models profile" + +AC_MSG_CHECKING(if you want to build a separate terminfo library) +AC_ARG_WITH(termlib, + [ --with-termlib generate separate terminfo library], + [with_termlib=$withval], + [with_termlib=no]) +AC_MSG_RESULT($with_termlib) ### Checks for special libraries, must be done up-front. +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], - [AC_CHECK_LIB(dbmalloc,debug_malloc)]) + [with_dbmalloc=yes], + [with_dbmalloc=no]) +AC_MSG_RESULT($with_dbmalloc) +if test $with_dbmalloc = yes ; then + AC_CHECK_LIB(dbmalloc,debug_malloc) +fi + +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], - [AC_CHECK_LIB(dmalloc,dmalloc_debug)]) + [with_dmalloc=yes], + [with_dmalloc=no]) +AC_MSG_RESULT($with_dmalloc) +if test $with_dmalloc = yes ; then + AC_CHECK_LIB(dmalloc,dmalloc_debug) +fi + +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], - [AC_CHECK_LIB(gpm,Gpm_Open,[ + [with_gpm=yes], + [with_gpm=no]) +AC_MSG_RESULT($with_gpm) +if test $with_gpm = yes ; then + AC_CHECK_LIB(gpm,Gpm_Open,[ EXTRA_LIBS="$EXTRA_LIBS -lgpm -lncurses" + SHLIB_LIST="$SHLIB_DEPS -lgpm " AC_DEFINE(HAVE_LIBGPM) AC_CHECK_HEADERS(gpm.h) - ],,-lcurses -ltermcap)]) + ],,-lcurses -ltermcap) +fi AC_SUBST(EXTRA_LIBS) +AC_SUBST(SHLIB_LIST) AC_MSG_CHECKING(for specified models) -test -z "$nc_list_models" && nc_list_models=normal -AC_MSG_RESULT($nc_list_models) +test -z "$cf_list_models" && cf_list_models=normal +AC_MSG_RESULT($cf_list_models) ### Use the first model as the default, and save its suffix for use in building ### up test-applications. -DFT_LWR_MODEL=`echo $nc_list_models | $AWK '{print $1}'` -NC_UPPERCASE($DFT_LWR_MODEL,DFT_UPR_MODEL)dnl -NC_LIB_SUFFIX($DFT_LWR_MODEL,DFT_DEP_SUFFIX)dnl -NC_LIB_TYPE($DFT_LWR_MODEL,DFT_ARG_SUFFIX)dnl -NC_OBJ_SUBDIR($DFT_LWR_MODEL,DFT_OBJ_SUBDIR)dnl +DFT_LWR_MODEL=`echo $cf_list_models | $AWK '{print $1}'` +CF_UPPER(DFT_UPR_MODEL,$DFT_LWR_MODEL)dnl +CF_LIB_SUFFIX($DFT_LWR_MODEL,DFT_DEP_SUFFIX)dnl +CF_LIB_TYPE($DFT_LWR_MODEL,DFT_ARG_SUFFIX)dnl +CF_OBJ_SUBDIR($DFT_LWR_MODEL,DFT_OBJ_SUBDIR)dnl AC_SUBST(DFT_OBJ_SUBDIR)dnl the default object-directory ("obj") AC_SUBST(DFT_LWR_MODEL)dnl the default model ("normal") AC_SUBST(DFT_UPR_MODEL)dnl the default model ("NORMAL") AC_SUBST(DFT_DEP_SUFFIX)dnl the corresponding library-suffix (".a") AC_SUBST(DFT_ARG_SUFFIX)dnl the string to append to "-lncurses" ("") -AC_SUBST(nc_list_models)dnl the complete list of models ("normal debug") +AC_SUBST(cf_list_models)dnl the complete list of models ("normal debug") + +TINFO_NAME=tinfo +AC_SUBST(TINFO_NAME) LIB_NAME=ncurses AC_SUBST(LIB_NAME) LIB_DIR=../lib -LIB_PREFIX=$LIB_DIR/lib +CF_LIB_PREFIX(cf_prefix) +LIB_PREFIX=$LIB_DIR/$cf_prefix AC_SUBST(LIB_PREFIX) dnl Not all ports of gcc support the -g option @@ -213,19 +287,29 @@ profile) LD_MODEL='-pg';; shared) LD_MODEL='' ;; esac AC_SUBST(LD_MODEL)dnl the type of link (e.g., -g or -pg) -NC_SHARED_OPTS + +AC_MSG_CHECKING(if rpath option should be used) +AC_ARG_ENABLE(rpath, +[ --enable-rpath use rpath option when generating shared libraries], +[cf_cv_ld_rpath=$enableval], +[cf_cv_ld_rpath=no]) +AC_MSG_RESULT($cf_cv_ld_rpath) + +CF_SHARED_OPTS if test "$CC_SHARED_OPTS" = "unknown"; then - for model in $nc_list_models; do + for model in $cf_list_models; do if test "$model" = "shared"; then - echo '** Shared libraries are not supported in this version' - exit 1 + AC_ERROR(Shared libraries are not supported in this version) fi done fi +############################################################################### +CF_HELP_MESSAGE(Fine-Tuning Your Configuration:) + ### use option --disable-overwrite to leave out the link to -lcurses -AC_MSG_CHECKING(include directory) +AC_MSG_CHECKING(if you wish to install ncurses overwriting curses) AC_ARG_ENABLE(overwrite, [ --disable-overwrite leave out the link to -lcurses], [with_overwrite=$enableval @@ -234,8 +318,41 @@ AC_ARG_ENABLE(overwrite, includedir='$(prefix)/include/ncurses' ], [with_overwrite=yes]) +AC_MSG_RESULT($with_overwrite) +AC_MSG_CHECKING(where we will install curses.h) AC_MSG_RESULT($includedir) +AC_MSG_CHECKING(if external terminfo-database is used) +AC_ARG_ENABLE(database, + [ --disable-database use only built-in data], + [with_database=$enableval], + [with_database=yes]) +AC_MSG_RESULT($with_database) +test $with_database != no && AC_DEFINE(USE_DATABASE) + +AC_MSG_CHECKING(if you want to build with function extensions) +AC_ARG_ENABLE(ext-funcs, + [ --disable-ext-funcs disable function-extensions], + [with_ext_funcs=$enableval], + [with_ext_funcs=yes]) +AC_MSG_RESULT($with_ext_funcs) +test "$with_ext_funcs" = yes && AC_DEFINE(NCURSES_EXT_FUNCS) + +AC_MSG_CHECKING(for list of fallback descriptions) +AC_ARG_WITH(fallbacks, + [ --with-fallbacks=XXX specify list of fallback terminal descriptions], + [with_fallback=$withval], + [with_fallback=]) +AC_MSG_RESULT($with_fallback) +FALLBACK_LIST=`echo $with_fallback|sed -e 's/,/ /'` +AC_SUBST(FALLBACK_LIST) + +if test $with_database = no ; then + if test -z $with_fallback ; then + AC_ERROR(You have disabled the database w/o specifying fallbacks) + fi +fi + ### use option --enable-big-core to make tic run faster on big machines AC_MSG_CHECKING(if big-core option selected) AC_ARG_ENABLE(big-core, @@ -246,7 +363,7 @@ AC_MSG_RESULT($with_big_core) test "$with_big_core" = "yes" && AC_DEFINE(HAVE_BIG_CORE) ### use option --enable-termcap to compile in the termcap fallback support -AC_MSG_CHECKING(if termcap-fallback support is needed) +AC_MSG_CHECKING(if you want termcap-fallback support) AC_ARG_ENABLE(termcap, [ --enable-termcap compile in termcap fallback support], [with_termcap=$enableval], @@ -276,13 +393,46 @@ test "$with_getcap_cache" = "yes" && AC_DEFINE(USE_GETCAP_CACHE) fi -### use option --enable-symlinks to make tic use symlinks, not hard links -AC_MSG_CHECKING(if tic should use symbolic links) -AC_ARG_ENABLE(symlinks, +### Use option --enable-symlinks to make tic use symlinks, not hard links +### to reduce storage requirements for the terminfo database. +### +### Most Unix systems have both link and symlink, a few don't have symlink. +### A few non-Unix systems implement symlink, but not link. +### A few non-systems implement neither. + +AC_CHECK_FUNCS( \ + link \ + symlink ) + +with_links=no +with_symlinks=no + +if test "$ac_cv_func_link" != yes ; then + AC_MSG_CHECKING(if tic should use symbolic links) + if test "$ac_cv_func_symlink" = yes ; then + with_symlinks=yes + else + with_symlinks=no + fi + AC_MSG_RESULT($with_symlinks) +elif test "$ac_cv_func_symlink" != yes ; then + AC_MSG_CHECKING(if tic should use hard links) + if test "$ac_cv_func_link" = yes ; then + with_links=yes + else + with_links=no + fi + AC_MSG_RESULT($with_links) +else + AC_MSG_CHECKING(if tic should use symbolic links) + AC_ARG_ENABLE(symlinks, [ --enable-symlinks make tic use symbolic links not hard links], [with_symlinks=$enableval], [with_symlinks=no]) -AC_MSG_RESULT($with_symlinks) + AC_MSG_RESULT($with_symlinks) +fi + +test "$with_links" = yes && AC_DEFINE(USE_LINKS) test "$with_symlinks" = yes && AC_DEFINE(USE_SYMLINKS) ### use option --enable-bsdpad to have tputs process BSD-style prefix padding @@ -306,15 +456,89 @@ test "$with_ext_const" = yes && AC_DEFINE(NCURSES_CONST,const) ### Enable compiling-in rcs id's AC_MSG_CHECKING(if RCS identifiers should be compiled-in) AC_ARG_WITH(rcs-ids, - [ --with-rcs-ids build: compile-in RCS identifiers], + [ --with-rcs-ids compile-in RCS identifiers], [with_rcs_ids=$enableval], [with_rcs_ids=no]) AC_MSG_RESULT($with_rcs_ids) test "$with_rcs_ids" = yes && AC_DEFINE(USE_RCS_IDS) +############################################################################### +CF_HELP_MESSAGE(Experimental Code:) +AC_MSG_CHECKING(if you want all experimental code) +AC_ARG_WITH(develop, + [ --with-develop enable all experimental options for testing], + [with_develop=$withval], + [with_develop=no]) +AC_MSG_RESULT($with_develop) + +### use option --enable-hard-tabs to turn on use of hard-tabs optimize +AC_MSG_CHECKING(if you want experimental hard-tabs code) +AC_ARG_ENABLE(hard-tabs, + [ --enable-hard-tabs compile with experimental hard-tabs code], + [with_hardtabs=$enableval], + [with_hardtabs=$with_develop]) +AC_MSG_RESULT($with_hardtabs) +test "$with_hardtabs" = yes && AC_DEFINE(USE_HARD_TABS) + +### use option --enable-hashmap to turn on use of hashmap scrolling logic +AC_MSG_CHECKING(if you want experimental hashmap code) +AC_ARG_ENABLE(hashmap, + [ --enable-hashmap compile with experimental hashmap code], + [with_hashmap=$enableval], + [with_hashmap=$with_develop]) +AC_MSG_RESULT($with_hashmap) +test "$with_hashmap" = yes && AC_DEFINE(USE_HASHMAP) + +AC_MSG_CHECKING(if you want experimental safe-sprintf code) +AC_ARG_ENABLE(safe-sprintf, + [ --disable-safe-sprintf compile with experimental safe-sprintf code], + [with_safe_sprintf=$enableval], + [with_safe_sprintf=no]) +AC_MSG_RESULT($with_safe_sprintf) +test "$with_safe_sprintf" = yes && AC_DEFINE(USE_SAFE_SPRINTF) + +### use option --disable-scroll-hints to turn off use of scroll-hints scrolling logic +AC_MSG_CHECKING(if you want to experiment without scrolling-hints code) +AC_ARG_ENABLE(scroll-hints, + [ --disable-scroll-hints compile hashmap without scroll-hints code], + [with_scroll_hints=$enableval], + [with_scroll_hints=yes]) +AC_MSG_RESULT($with_scroll_hints) +test "$with_scroll_hints" = yes && AC_DEFINE(USE_SCROLL_HINTS) + +### use option --enable-sigwinch to turn on use of SIGWINCH logic +AC_MSG_CHECKING(if you want experimental SIGWINCH handler) +AC_ARG_ENABLE(sigwinch, + [ --enable-sigwinch compile with experimental SIGWINCH handler], + [with_sigwinch=$enableval], + [with_sigwinch=$with_develop]) +AC_MSG_RESULT($with_sigwinch) +test "$with_sigwinch" = yes && AC_DEFINE(USE_SIGWINCH) + +### use option --enable-widec to turn on use of wide-character support +AC_MSG_CHECKING(if you want experimental wide-character code) +AC_ARG_ENABLE(widec, + [ --enable-widec compile with experimental wide-char code], + [with_widec=$enableval], + [with_widec=no]) +AC_MSG_RESULT($with_widec) +test "$with_widec" = yes && AC_DEFINE(USE_WIDEC_SUPPORT) + +### use option --enable-xmc-glitch to turn on use of magic-cookie optimize +AC_MSG_CHECKING(if you want experimental xmc code) +AC_ARG_ENABLE(xmc-glitch, + [ --enable-xmc-glitch compile with experimental xmc code], + [with_xmc_glitch=$enableval], + [with_xmc_glitch=$with_develop]) +AC_MSG_RESULT($with_xmc_glitch) +test "$with_xmc_glitch" = yes && AC_DEFINE(USE_XMC_SUPPORT) + +############################################################################### +CF_HELP_MESSAGE(Testing/development Options:) + ### use option --disable-echo to suppress full display compiling commands AC_ARG_ENABLE(echo, - [ --enable-echo build: display \"compiling\" commands (default)], + [ --enable-echo build: display "compiling" commands (default)], [with_echo=$enableval], [with_echo=yes]) if test "$with_echo" = yes; then @@ -330,18 +554,20 @@ AC_ARG_ENABLE(warnings, [with_warnings=$enableval]) if test -n "$with_warnings"; then ADAFLAGS="$ADAFLAGS -gnatg" - NC_GCC_WARNINGS + CF_GCC_WARNINGS fi -NC_GCC_ATTRIBUTES +CF_GCC_ATTRIBUTES ### use option --enable-assertions to turn on generation of assertion code AC_ARG_ENABLE(assertions, [ --enable-assertions test: turn on generation of assertion code], - [with_assertions=$enableval]) + [with_assertions=$enableval], + [with_assertions=no]) if test -n "$GCC" then - if test -z "$with_assertions" + if test $with_assertions = no then + AC_DEFINE(NDEBUG) CPPFLAGS="$CPPFLAGS -DNDEBUG" else ADAFLAGS="$ADAFLAGS -gnata" @@ -367,14 +593,20 @@ AC_ARG_ENABLE(macros, ### Checks for libraries. AC_CHECK_FUNC(gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY),[ + AC_CHECK_LIB(bsd, gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY) LIBS="$LIBS -lbsd")])dnl CLIX: bzero, select, gettimeofday +MATH_LIB="" +AC_CHECK_FUNC(sin,, + AC_CHECK_LIB(m, sin,[MATH_LIB="-lm"])) +AC_SUBST(MATH_LIB) + ### Checks for header files. AC_STDC_HEADERS AC_HEADER_DIRENT -NC_REGEX +CF_REGEX dnl These are some other potentially nonportable headers. AC_CHECK_HEADERS( \ @@ -398,20 +630,31 @@ unistd.h \ values.h \ ) -# check for HPUX's ANSI compiler -if test $nc_cv_systype = HP_UX; then -if test -z "$GCC"; then +PROG_EXT= +case $cf_cv_system_name in +hpux*) + # check for HPUX's ANSI compiler + if test -z "$GCC"; then AC_MSG_CHECKING([for HP/UX ANSI compiler]) - nc_save_CFLAGS="$CFLAGS" + cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Aa" - AC_TRY_COMPILE([],[void (*f)(void)=0],[nc_hpux_cc=yes],[nc_hpux_cc=no]) - AC_MSG_RESULT($nc_hpux_cc) - if test $nc_hpux_cc = yes; then + AC_TRY_COMPILE([],[void (*f)(void)=0],[cf_hpux_cc=yes],[cf_hpux_cc=no]) + AC_MSG_RESULT($cf_hpux_cc) + if test $cf_hpux_cc = yes; then AC_DEFINE(_HPUX_SOURCE) else - CFLAGS="$nc_save_CFLAGS" + CFLAGS="$cf_save_CFLAGS" fi -fi;fi + fi + ;; +os2*) + # We make sure -Zexe is not used -- it would interfere with @PROG_EXT@ + CFLAGS="$CFLAGS -Zmt -D__ST_MT_ERRNO__" + LDFLAGS=`echo "$LDFLAGS -Zmt -Zcrtdll" | sed "s/-Zexe//g"` + PROG_EXT=".exe" + ;; +esac +AC_SUBST(PROG_EXT) # check for ISC (this may also define _POSIX_SOURCE) # Note: even non-Posix ISC needs to declare fd_set @@ -421,15 +664,7 @@ if test "$ISC" = yes ; then AC_CHECK_HEADERS( sys/termio.h ) fi -# check for SCO. this is a hack, and should be split into individual -# features -- the sys/time.h and select.h conflict, and the need for -# ptem.h due to winsize struct. -AC_CHECKING([for SCO by checking on /usr/bin/scosh]) -AC_PROGRAM_CHECK(COULD_BE_SCO, [scosh], maybe, maybenot) -if test "$COULD_BE_SCO" = "maybe" -then - AC_DEFINE(SYSTEM_LOOKS_LIKE_SCO) -fi +CF_SYS_TIME_SELECT ### checks for compiler characteristics AC_LANG_C @@ -437,17 +672,21 @@ AC_C_CONST AC_C_INLINE test $ac_cv_c_inline != no && AC_DEFINE(CC_HAS_INLINE_FUNCS) +CF_TYPEOF_CHTYPE +CF_WIDEC_SHIFT + ### Checks for external-data -NC_ERRNO -NC_SYS_ERRLIST -NC_LINK_DATAONLY -NC_SPEED_TYPE +CF_ERRNO +CF_LINK_DATAONLY +CF_SPEED_TYPE ### Checks for library functions. AC_CHECK_FUNCS( \ getttynam \ memccpy \ +nanosleep \ poll \ +remove \ select \ setbuf \ setbuffer \ @@ -459,39 +698,17 @@ tcgetattr \ times \ usleep \ vfscanf \ +vsnprintf \ vsscanf \ ) -if test $ac_cv_func_sigaction = yes; then -AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE) -AC_TRY_COMPILE([#include -#include ], [struct sigaction act;], - sigact_bad=no, sigact_bad=yes AC_DEFINE(SVR4_ACTION)) -AC_MSG_RESULT($sigact_bad) +if test "$with_getcap" = "yes" ; then + CF_CGETENT fi -# some machines require _POSIX_SOURCE to completely define struct termios -if test $ac_cv_header_termios_h = yes ; then - case "$CFLAGS" in - *-D_POSIX_SOURCE*) - termios_bad=dunno ;; - *) termios_bad=maybe ;; - esac - if test $termios_bad = maybe ; then - AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE) - AC_TRY_COMPILE([#include ], - [struct termios foo; int x = foo.c_iflag], - termios_bad=no, [ - AC_TRY_COMPILE([ -#define _POSIX_SOURCE -#include ], - [struct termios foo; int x = foo.c_iflag], - termios_bad=unknown, - termios_bad=yes AC_DEFINE(SVR4_TERMIO)) - ]) - AC_MSG_RESULT($termios_bad) - fi -fi +CF_ISASCII +CF_STRUCT_SIGACTION +CF_STRUCT_TERMIOS dnl FIXME (may need this) AC_SYS_RESTARTABLE_SYSCALLS if test "$cross_compiling" = yes ; then @@ -500,20 +717,20 @@ else AC_FUNC_SETVBUF_REVERSED fi AC_TYPE_SIGNAL -NC_TYPE_SIGACTION -NC_TIOCGWINSZ +CF_TYPE_SIGACTION +CF_SIZECHANGE dnl FIXME checks we don't do (but neither does the old Configure script): -case "$nc_cv_systype" in -Linux) +case "$cf_cv_system_name" in +linux*) AC_DEFINE(GOOD_SELECT) ;; esac dnl We'll do our own -g libraries, unless the user's overridden via $CFLAGS -if test -z "$nc_user_CFLAGS" ; then - NC_STRIP_G_OPT(CFLAGS) - NC_STRIP_G_OPT(CXXFLAGS) +if test -z "$cf_user_CFLAGS" ; then + CF_STRIP_G_OPT(CFLAGS) + CF_STRIP_G_OPT(CXXFLAGS) fi dnl Check for C++ compiler characteristics (and ensure that it's there!) @@ -524,25 +741,27 @@ else fi if test "$ac_cv_prog_CXX_EXISTS" = yes; then AC_LANG_CPLUSPLUS - NC_CXX_LIBRARY + CF_CXX_LIBRARY AC_CHECK_HEADERS(builtin.h typeinfo) - NC_BOOL_DECL - NC_BOOL_SIZE + CF_BOOL_DECL + CF_BOOL_SIZE else - nc_cxx_library=no - AC_CACHE_VAL(nc_cv_builtin_bool,[nc_cv_builtin_bool=0]) - AC_CACHE_VAL(nc_cv_sizeof_bool,[nc_cv_sizeof_bool=int]) + cf_cxx_library=no + AC_CACHE_VAL(cf_cv_builtin_bool,[cf_cv_builtin_bool=0]) + AC_CACHE_VAL(cf_cv_sizeof_bool,[cf_cv_sizeof_bool=int]) fi AC_SUBST(CXXLIBS) +CF_HELP_MESSAGE(Ada95 Binding Options:) + dnl Check for availability of GNU Ada Translator (GNAT). dnl At the moment we support no other Ada95 compiler. -nc_ada_make=gnatmake -AC_CHECK_PROG(gnat_exists, $nc_ada_make, yes, no) +cf_ada_make=gnatmake +AC_CHECK_PROG(gnat_exists, $cf_ada_make, yes, no) if test "$ac_cv_prog_gnat_exists" = no; then - nc_ada_make= + cf_ada_make= else - NC_GNAT_VERSION + CF_GNAT_VERSION AC_CHECK_PROG(m4_exists, m4, yes, no) if test "$ac_cv_prog_m4_exists" = no; then ac_cv_prog_gnat_correct=no @@ -550,12 +769,30 @@ else fi fi if test "$ac_cv_prog_gnat_correct" = yes; then - nc_ada_compiler=gcc - nc_ada_package=terminal_interface - AC_SUBST(nc_ada_make) - AC_SUBST(nc_ada_compiler) - AC_SUBST(nc_ada_package) + ADAFLAGS="-O3 $ADAFLAGS" + cf_ada_compiler=gcc + cf_ada_package=terminal_interface + + AC_SUBST(cf_ada_make) + AC_SUBST(cf_ada_compiler) + AC_SUBST(cf_ada_package) AC_SUBST(ADAFLAGS) + AC_SUBST(cf_compile_generics) + + CF_WITH_PATH(ada-include, + [ --with-ada-include=DIR Ada includes are in DIR], + ADA_INCLUDE, + EPREFIX/ada_include, + [$]exec_prefix/ada_include) + AC_SUBST(ADA_INCLUDE) + + CF_WITH_PATH(ada-objects, + [ --with-ada-objects=DIR Ada objects are in DIR], + ADA_OBJECTS, + EPREFIX/ada_objects, + [$]exec_prefix/ada_objects) + AC_SUBST(ADA_OBJECTS) + fi ### It's not possible to appease gcc 2.6.3's conversion-warnings if we're @@ -565,94 +802,81 @@ if test -n "$with_warnings"; then if test -n "$GCC"; then case "`$CC --version`" in 2.6.3) - if test "$nc_cv_sizeof_bool" != "char"; then - nc_warn_CFLAGS="$nc_warn_CFLAGS -Wconversion" + if test "$cf_cv_sizeof_bool" != "char"; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wconversion" fi ;; 2.5*) - nc_warn_CFLAGS="$nc_warn_CFLAGS -Wconversion" + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wconversion" ;; esac fi fi +### Construct the library-subsets, if any, from this set of keywords: +### none, base, ext_funcs, termlib. +AC_MSG_CHECKING(for library subsets) +if test "$with_termlib" = yes ; then + LIB_SUBSETS="termlib " +else + LIB_SUBSETS="termlib+" +fi +LIB_SUBSETS="${LIB_SUBSETS}base" +test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs" +AC_MSG_RESULT($LIB_SUBSETS) + ### Construct the list of include-directories to be generated -NC_INCLUDE_DIRS -NC_ADA_INCLUDE_DIRS +CF_INCLUDE_DIRS +CF_ADA_INCLUDE_DIRS + +### Set up low-level terminfo dependencies for makefiles. Note that we +### could override this. +if test "$with_termlib" = yes ; then + TEST_DEPS="${LIB_PREFIX}${TINFO_NAME}${DFT_DEP_SUFFIX}" + TEST_ARGS="-l${TINFO_NAME}${DFT_ARG_SUFFIX}" +fi +PROG_DEPS="$TEST_DEPS" +PROG_ARGS="$TEST_ARGS" ### Construct the list of subdirectories for which we'll customize makefiles ### with the appropriate compile-rules. -NC_SRC_MODULES(ncurses progs panel menu form) -NC_DIRS_TO_MAKE + +CF_SRC_MODULES($modules_to_build) +CF_DIRS_TO_MAKE ### Now that we're done running tests, add the compiler-warnings, if any -CFLAGS="$CFLAGS $nc_warn_CFLAGS" +CFLAGS="$CFLAGS $EXTRA_CFLAGS" ################################################################################ -changequote({,})dnl -AC_OUTPUT(include/config_h \ +AC_OUTPUT( \ include/MKterm.h.awk \ include/curses.h \ include/termcap.h \ include/unctrl.h \ $SUB_MAKEFILES \ - Makefile,{ - -NC_LIB_RULES - -### Special editing. We generate ncurses_cfg.h directly to allow all filenames -### to be MSDOS-compatible, as well as to make the list of definitions be -### dynamically determined by the configuration script -- a consideration when -### doing type-clean development testing. - -echo creating include/ncurses_cfg.h -rm -f include/ncurses_cfg.h -echo "/* generated by configure-script - * On host: $SYS_NAME - */ -#ifndef NC_CONFIG_H -#define NC_CONFIG_H" >include/ncurses_cfg.h -sed -e '/^ -D/!d' \ - -e 's/ -D/\ -#define /g' \ - -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1 /g' \ - -e 's/\\//g' \ - include/config_h | sort >>include/ncurses_cfg.h -echo " - /* The C compiler may not treat these properly, but C++ has to */ -#ifdef __cplusplus -#undef const -#undef inline -#else -#if defined(lint) || defined(TRACE) -#undef inline -#define inline /* nothing */ -#endif -#endif - -#endif /* NC_CONFIG_H */" >> include/ncurses_cfg.h -echo removing include/config_h -rm include/config_h -},{ + Makefile,[ +CF_LIB_RULES +],[ ### Special initialization commands, used to pass information from the ### configuration-run into config.status -SYS_NAME="`(uname -a || hostname) 2>/dev/null | sed 1q`" -if test -z "\$SYS_NAME"; then SYS_NAME=unknown;fi - -AWK=$AWK +AWK="$AWK" +CF_LIST_MODELS="$cf_list_models" DFT_LWR_MODEL="$DFT_LWR_MODEL" -NC_LIST_MODELS="$nc_list_models" +LDCONFIG="$LDCONFIG" +LIB_NAME="$LIB_NAME" +LIB_SUBSETS="$LIB_SUBSETS" +SRC_SUBDIRS="$SRC_SUBDIRS" +TINFO_NAME="$TINFO_NAME" WITH_ECHO="$with_echo" WITH_OVERWRITE="$with_overwrite" -SRC_SUBDIRS="$SRC_SUBDIRS" -nc_cxx_library="$nc_cxx_library" -nc_cv_systype="$nc_cv_systype" -nc_cv_rel_version="$nc_cv_rel_version" -nc_cv_abi_version="$nc_cv_abi_version" -nc_cv_do_symlinks="$nc_cv_do_symlinks" -nc_cv_rm_so_locs="$nc_cv_rm_so_locs" - -})dnl -changequote([,])dnl -make preinstall +cf_cv_abi_version="$cf_cv_abi_version" +cf_cv_do_symlinks="$cf_cv_do_symlinks" +cf_cv_rel_version="$cf_cv_rel_version" +cf_cv_rm_so_locs="$cf_cv_rm_so_locs" +cf_cv_system_name="$cf_cv_system_name" +cf_cxx_library="$cf_cxx_library" +target="$target" + +],sort)dnl +${MAKE-make} preinstall diff --git a/dist.mk b/dist.mk index 91d0b25a..d6a4efc2 100644 --- a/dist.mk +++ b/dist.mk @@ -1,4 +1,4 @@ -# $Id: dist.mk,v 1.38 1997/05/16 00:33:41 tom Exp $ +# $Id: dist.mk,v 1.82 1998/02/28 23:10:59 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -9,8 +9,8 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 4 -NCURSES_MINOR = 1 -NCURSES_PATCH = 970515 +NCURSES_MINOR = 2 +NCURSES_PATCH = 980228 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) @@ -50,6 +50,12 @@ EXCEPTIONS = 'announce.html$\\|ANNOUNCE\\|misc/.*\\.doc\\|man/terminfo.5\\|lib_g 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 $@ + touch $@ + find . -type f -print |sort | fgrep -v .lsm |fgrep -v .spec >$@ + TAGS: etags */*.[ch] diff --git a/form/Makefile.in b/form/Makefile.in index 054b7b58..f6a11841 100644 --- a/form/Makefile.in +++ b/form/Makefile.in @@ -1,23 +1,34 @@ -# $Id: Makefile.in,v 1.17 1997/05/05 22:39:30 tom Exp $ -################################################################################ -# Copyright 1996,1997 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: Makefile.in,v 1.24 1998/02/11 12:13:44 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# # Makefile for form source code. # # This makes the following: @@ -43,6 +54,7 @@ libdir = @libdir@ includedir = @includedir@ INSTALL = @INSTALL@ +INSTALL_LIB = @INSTALL@ @INSTALL_LIB@ INSTALL_DATA = @INSTALL_DATA@ AR = @AR@ @@ -69,9 +81,10 @@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) LINK = $(CC) LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ +SHLIB_LIST = -lncurses @SHLIB_LIST@ MK_SHARED_LIB = @MK_SHARED_LIB@ -REL_VERSION = @nc_cv_rel_version@ -ABI_VERSION = @nc_cv_abi_version@ +REL_VERSION = @cf_cv_rel_version@ +ABI_VERSION = @cf_cv_abi_version@ RANLIB = @RANLIB@ @@ -81,9 +94,14 @@ LINT = @LINT@ LINT_OPTS = @LINT_OPTS@ LINT_LIBS = -lform -lncurses @LIBS@ +AUTO_SRC = \ + ../include/form.h + ################################################################################ all \ -install :: ../include/form.h $(LIBRARIES) +install :: $(AUTO_SRC) $(LIBRARIES) + +sources : $(AUTO_SRC) $(INSTALL_PREFIX)$(libdir) : $(srcdir)/../mkinstalldirs $@ @@ -107,14 +125,15 @@ tags: TAGS: etags *.[ch] -clean :: - -rm -f tags TAGS *~ ../include/form.h +mostlyclean :: + -rm -f core tags TAGS *~ *.ln *.atac trace + +clean :: mostlyclean + -rm -f $(AUTO_SRC) distclean :: clean -rm -f Makefile -mostlyclean :: clean - realclean :: distclean ../include/mf_common.h \ diff --git a/form/READ.ME b/form/READ.ME index bb26b1cb..12a540ea 100644 --- a/form/READ.ME +++ b/form/READ.ME @@ -2,13 +2,9 @@ This is a clone of the form library that is available with typical System V curses implementations (ETI). It is modelled after the documentation that comes for this library with -a 386 based SVR4 implementation (ESIX). This system was used together -with an NCR3000 system to compile the clone using original curses -implementation and to run various programs to check the compatibility of -this clone with the original libform library. +a 386 based SVR4 implementation (ESIX). -The development environment was an ELF based Linux system, the German -Unifix distribution (aka Linux FT). +The development environment was and is an ELF based Linux system. For things that still need doing, see the TO-DO file in the top-level directory. diff --git a/form/fld_arg.c b/form/fld_arg.c new file mode 100644 index 00000000..d2d57a34 --- /dev/null +++ b/form/fld_arg.c @@ -0,0 +1,91 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_arg.c,v 1.2 1998/02/11 12:13:44 tom Exp $") + +/*--------------------------------------------------------------------------- +| 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: +| make_arg : allocates a structure for the field +| specific parameters. +| copy_arg : duplicate the structure created by +| make_arg +| free_arg : Release the memory allocated by make_arg +| or copy_arg +| +| At least make_arg must be non-NULL. +| You may pass NULL for copy_arg and free_arg if your +| make_arg function doesn't allocate memory and your +| arg fits into the storage for a (void*). +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid argument ++--------------------------------------------------------------------------*/ +int 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); + + typ->status |= _HAS_ARGS; + typ->makearg = make_arg; + typ->copyarg = copy_arg; + typ->freearg = free_arg; + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| 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. ++--------------------------------------------------------------------------*/ +void *field_arg(const FIELD * field) +{ + return Normalize_Field(field)->arg; +} + +/* fld_arg.c ends here */ diff --git a/form/fld_attr.c b/form/fld_attr.c new file mode 100644 index 00000000..ce01b65d --- /dev/null +++ b/form/fld_attr.c @@ -0,0 +1,111 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ +#include "form.priv.h" + +MODULE_ID("$Id: fld_attr.c,v 1.2 1998/02/11 12:13:44 tom Exp $") + +/*---------------------------------------------------------------------------- + Field-Attribute manipulation routines + --------------------------------------------------------------------------*/ +/* "Template" macro to generate a function to set a fields attribute */ +#define GEN_FIELD_ATTR_SET_FCT( name ) \ +int set_field_ ## name (FIELD * field, chtype attr)\ +{\ + int res = E_BAD_ARGUMENT;\ + 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;\ + }\ + RETURN(res);\ +} + +/* "Template" macro to generate a function to get a fields attribute */ +#define GEN_FIELD_ATTR_GET_FCT( name ) \ +chtype field_ ## name (const FIELD * field)\ +{\ + return ( A_ATTRIBUTES & (Normalize_Field( field ) -> name) );\ +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_field_fore(FIELD *field, chtype attr) +| +| Description : Sets the foreground of the field used to display the +| field contents. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid attributes +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +GEN_FIELD_ATTR_SET_FCT( fore ) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : chtype field_fore(const FIELD *) +| +| Description : Retrieve fields foreground attribute +| +| Return Values : The foreground attribute ++--------------------------------------------------------------------------*/ +GEN_FIELD_ATTR_GET_FCT( fore ) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_field_back(FIELD *field, chtype attr) +| +| Description : Sets the background of the field used to display the +| fields extend. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid attributes +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +GEN_FIELD_ATTR_SET_FCT( back ) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : chtype field_back(const +| +| Description : Retrieve fields background attribute +| +| Return Values : The background attribute ++--------------------------------------------------------------------------*/ +GEN_FIELD_ATTR_GET_FCT( back ) + +/* fld_attr.c ends here */ diff --git a/form/fld_current.c b/form/fld_current.c new file mode 100644 index 00000000..72534a9e --- /dev/null +++ b/form/fld_current.c @@ -0,0 +1,124 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ +#include "form.priv.h" + +MODULE_ID("$Id: fld_current.c,v 1.2 1998/02/11 12:13:44 tom Exp $") + +/*--------------------------------------------------------------------------- +| 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 +| E_BAD_ARGUMENT - invalid form or field pointer +| E_REQUEST_DENIED - field not selectable +| E_BAD_STATE - called from a hook routine +| E_INVALID_FIELD - current field can't be left +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int 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)) + { + form->current = field; + form->curpage = field->page; + } + else + { + if (form->status & _IN_DRIVER) + err = E_BAD_STATE; + else + { + if (form->current != field) + { + if (!_nc_Internal_Validation(form)) + err = E_INVALID_FIELD; + else + { + 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 + { + err = _nc_Set_Current_Field(form,field); + } + Call_Hook(form,fieldinit); + _nc_Refresh_Current_Field(form); + } + } + } + } + RETURN(err); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : FIELD *current_field(const FORM * form) +| +| Description : Return the current field. +| +| Return Values : Pointer to the current field. ++--------------------------------------------------------------------------*/ +FIELD *current_field(const FORM * form) +{ + return Normalize_Form(form)->current; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int field_index(const FIELD * field) +| +| Description : Return the index of the field in the field-array of +| the form. +| +| Return Values : >= 0 : field index +| -1 : fieldpointer invalid or field not connected ++--------------------------------------------------------------------------*/ +int field_index(const FIELD * field) +{ + return ( (field && field->form) ? field->index : -1 ); +} + +/* fld_current.c ends here */ diff --git a/form/fld_def.c b/form/fld_def.c index 9b88ee3f..3b8ddbc6 100644 --- a/form/fld_def.c +++ b/form/fld_def.c @@ -1,28 +1,38 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses form library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: fld_def.c,v 1.6 1997/05/01 16:47:54 juergen Exp $") +MODULE_ID("$Id: fld_def.c,v 1.10 1998/02/11 12:13:43 tom Exp $") /* this can't be readonly */ static FIELD default_field = { @@ -57,7 +67,7 @@ FIELD *_nc_Default_Field = &default_field; /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static TypeArgument *Make_Argument( +| Function : TypeArgument *_nc_Make_Argument( | const FIELDTYPE *typ, | va_list *ap, | int *err ) @@ -69,7 +79,8 @@ FIELD *_nc_Default_Field = &default_field; | Return Values : Pointer to argument structure. Maybe NULL. | In case of an error in *err an errorcounter is increased. +--------------------------------------------------------------------------*/ -static TypeArgument* Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err) +TypeArgument* +_nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err) { TypeArgument *res = (TypeArgument *)0; TypeArgument *p; @@ -82,14 +93,15 @@ static TypeArgument* Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err) p = (TypeArgument *)malloc(sizeof(TypeArgument)); if (p) { - p->left = Make_Argument(typ->left ,ap,err); - p->right = 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 { + assert(typ->makearg); if ( !(res=(TypeArgument *)typ->makearg(ap)) ) *err += 1; } @@ -99,10 +111,9 @@ static TypeArgument* Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err) /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static TypeArgument *Copy_Argument( -| const FIELDTYPE *typ, -| const TypeArgument *argp, -| int *err ) +| Function : TypeArgument *_nc_Copy_Argument(const FIELDTYPE *typ, +| const TypeArgument *argp, +| int *err ) | | Description : Create a copy of an argument structure for the specified | type. @@ -110,8 +121,9 @@ static TypeArgument* Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err) | Return Values : Pointer to argument structure. Maybe NULL. | In case of an error in *err an errorcounter is increased. +--------------------------------------------------------------------------*/ -static TypeArgument *Copy_Argument(const FIELDTYPE *typ, - const TypeArgument *argp, int *err) +TypeArgument* +_nc_Copy_Argument(const FIELDTYPE *typ, + const TypeArgument *argp, int *err) { TypeArgument *res = (TypeArgument *)0; TypeArgument *p; @@ -124,16 +136,21 @@ static TypeArgument *Copy_Argument(const FIELDTYPE *typ, p = (TypeArgument *)malloc(sizeof(TypeArgument)); if (p) { - p->left = Copy_Argument(typ,argp->left ,err); - p->right = 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 { - if (!(res = (TypeArgument *)(typ->copyarg((const void *)argp)))) - *err += 1; + if (typ->copyarg) + { + if (!(res = (TypeArgument *)(typ->copyarg((const void *)argp)))) + *err += 1; + } + else + res = (TypeArgument *)argp; } } return res; @@ -141,16 +158,16 @@ static TypeArgument *Copy_Argument(const FIELDTYPE *typ, /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static void Free_Argument( -| const FIELDTYPE *typ, -| TypeArgument * argp ) +| Function : void _nc_Free_Argument(const FIELDTYPE *typ, +| TypeArgument * argp ) | | Description : Release memory associated with the argument structure | for the given fieldtype. | | Return Values : - +--------------------------------------------------------------------------*/ -static void Free_Argument(const FIELDTYPE * typ, TypeArgument * argp) +void +_nc_Free_Argument(const FIELDTYPE * typ, TypeArgument * argp) { if (!typ || !(typ->status & _HAS_ARGS)) return; @@ -158,63 +175,66 @@ static void Free_Argument(const FIELDTYPE * typ, TypeArgument * argp) if (typ->status & _LINKED_TYPE) { assert(argp); - Free_Argument(typ->left ,argp->left ); - Free_Argument(typ->right,argp->right); + _nc_Free_Argument(typ->left ,argp->left ); + _nc_Free_Argument(typ->right,argp->right); free(argp); } else { - typ->freearg((void *)argp); + if (typ->freearg) + typ->freearg((void *)argp); } } /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static bool Copy_Type( FIELD *new, FIELD const *old ) +| Function : bool _nc_Copy_Type( FIELD *dst, FIELD const *src ) | -| Description : Copy argument structure of field old to field new +| Description : Copy argument structure of field src to field dst | | Return Values : TRUE - copy worked | FALSE - error occured +--------------------------------------------------------------------------*/ -static bool Copy_Type(FIELD *new, FIELD const *old) +bool +_nc_Copy_Type(FIELD *dst, FIELD const *src) { int err = 0; - assert(new && old); + assert(dst && src); - new->type = old->type; - new->arg = (void *)Copy_Argument(old->type,(TypeArgument *)(old->arg),&err); + dst->type = src->type; + dst->arg = (void *)_nc_Copy_Argument(src->type,(TypeArgument *)(src->arg),&err); if (err) { - Free_Argument(new->type,(TypeArgument *)(new->arg)); - new->type = (FIELDTYPE *)0; - new->arg = (void *)0; + _nc_Free_Argument(dst->type,(TypeArgument *)(dst->arg)); + dst->type = (FIELDTYPE *)0; + dst->arg = (void *)0; return FALSE; } else { - if (new->type) - new->type->ref++; + if (dst->type) + dst->type->ref++; return TRUE; } } /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static void Free_Type( FIELD *field ) +| Function : void _nc_Free_Type( FIELD *field ) | | Description : Release Argument structure for this field | | Return Values : - +--------------------------------------------------------------------------*/ -INLINE static void Free_Type(FIELD *field) +void +_nc_Free_Type(FIELD *field) { assert(field); if (field->type) field->type->ref--; - Free_Argument(field->type,(TypeArgument *)(field->arg)); + _nc_Free_Argument(field->type,(TypeArgument *)(field->arg)); } /*--------------------------------------------------------------------------- @@ -258,7 +278,7 @@ FIELD *new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf) New_Field->nbuf = nbuf; New_Field->link = New_Field; - if (Copy_Type(New_Field,&default_field)) + if (_nc_Copy_Type(New_Field,&default_field)) { size_t len; @@ -287,119 +307,6 @@ FIELD *new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf) return (FIELD *)0; } -/*--------------------------------------------------------------------------- -| 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 -+--------------------------------------------------------------------------*/ -FIELD *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))) ) - { - *New_Field = 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; - - if (Copy_Type(New_Field,field)) - { - size_t len; - - len = Total_Buffer_Size(New_Field); - if ( (New_Field->buf=(char *)malloc(len)) ) - { - memcpy(New_Field->buf,field->buf,len); - return New_Field; - } - } - } - - if (New_Field) - free_field(New_Field); - - SET_ERROR(err); - return (FIELD *)0; -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : FIELD *link_field(FIELD *field, int frow, int fcol) -| -| Description : Duplicates the field at the specified position. The -| new field shares its buffers with the original one, -| the attributes are independent. -| 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 -+--------------------------------------------------------------------------*/ -FIELD *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))) ) - { - *New_Field = 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 (Copy_Type(New_Field,field)) - return New_Field; - } - - if (New_Field) - free_field(New_Field); - - SET_ERROR( err ); - return (FIELD *)0; -} - /*--------------------------------------------------------------------------- | Facility : libnform | Function : int free_field( FIELD *field ) @@ -431,231 +338,9 @@ int free_field(FIELD * field) {} f->link = field->link; } - Free_Type(field); + _nc_Free_Type(field); free(field); RETURN(E_OK); } -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int field_info(const FIELD *field, -| int *rows, int *cols, -| int *frow, int *fcol, -| int *nrow, int *nbuf) -| -| Description : Retrieve infos about the fields creation parameters. -| -| Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid field pointer -+--------------------------------------------------------------------------*/ -int field_info(const FIELD *field, - int *rows, int *cols, - int *frow, int *fcol, - int *nrow, int *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; - RETURN(E_OK); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int move_field(FIELD *field,int frow, int fcol) -| -| Description : Moves the disconnected field to the new location in -| the forms subwindow. -| -| Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid argument passed -| E_CONNECTED - field is connected -+--------------------------------------------------------------------------*/ -int move_field(FIELD *field, int frow, int fcol) -{ - if ( !field || (frow<0) || (fcol<0) ) - RETURN(E_BAD_ARGUMENT); - - if (field->form) - RETURN(E_CONNECTED); - - field->frow = frow; - field->fcol = fcol; - RETURN(E_OK); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int set_field_type(FIELD *field, FIELDTYPE *type,...) -| -| Description : Associate the specified fieldtype with the field. -| Certain field types take additional arguments. Look -| at the spec of the field types ! -| -| Return Values : E_OK - success -| E_SYSTEM_ERROR - system error -+--------------------------------------------------------------------------*/ -int set_field_type(FIELD *field,FIELDTYPE *type, ...) -{ - va_list ap; - int res = E_SYSTEM_ERROR; - int err = 0; - - va_start(ap,type); - - Normalize_Field(field); - Free_Type(field); - - field->type = type; - field->arg = (void *)Make_Argument(field->type,&ap,&err); - - if (err) - { - Free_Argument(field->type,(TypeArgument *)(field->arg)); - field->type = (FIELDTYPE *)0; - field->arg = (void *)0; - } - else - { - res = E_OK; - if (field->type) - field->type->ref++; - } - - va_end(ap); - RETURN(res); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : FIELDTYPE *field_type(const FIELD *field) -| -| Description : Retrieve the associated fieldtype for this field. -| -| Return Values : Pointer to fieldtype of NULL if none is defined. -+--------------------------------------------------------------------------*/ -FIELDTYPE *field_type(const FIELD * field) -{ - return Normalize_Field(field)->type; -} - -/*--------------------------------------------------------------------------- -| 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. -+--------------------------------------------------------------------------*/ -void *field_arg(const FIELD * field) -{ - return Normalize_Field(field)->arg; -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int set_max_field(FIELD *field, int maxgrow) -| -| Description : Set the maximum growth for a dynamic field. If maxgrow=0 -| the field may grow to any possible size. -| -| Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid argument -+--------------------------------------------------------------------------*/ -int set_max_field(FIELD *field, int maxgrow) -{ - if (!field || (maxgrow<0)) - RETURN(E_BAD_ARGUMENT); - else - { - bool single_line_field = Single_Line_Field(field); - - if (maxgrow>0) - { - if (( single_line_field && (maxgrow < field->dcols)) || - (!single_line_field && (maxgrow < field->drows))) - RETURN(E_BAD_ARGUMENT); - } - field->maxgrow = maxgrow; - field->status &= ~_MAY_GROW; - if (!(field->opts & O_STATIC)) - { - if ((maxgrow==0) || - ( single_line_field && (field->dcols < maxgrow)) || - (!single_line_field && (field->drows < maxgrow))) - field->status |= _MAY_GROW; - } - } - RETURN(E_OK); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int dynamic_field_info(const FIELD *field, -| int *drows, int *dcols, -| int *maxgrow) -| -| Description : Retrieve informations about a dynamic fields current -| dynamic parameters. -| -| Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid argument -+--------------------------------------------------------------------------*/ -int dynamic_field_info(const FIELD *field, - int *drows, int *dcols, int *maxgrow) -{ - if (!field) - RETURN(E_BAD_ARGUMENT); - - if (drows) *drows = field->drows; - if (dcols) *dcols = field->dcols; - if (maxgrow) *maxgrow = field->maxgrow; - - RETURN(E_OK); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int set_new_page(FIELD *field, bool new_page_flag) -| -| Description : Marks the field as the beginning of a new page of -| the form. -| -| Return Values : E_OK - success -| E_CONNECTED - field is connected -+--------------------------------------------------------------------------*/ -int set_new_page(FIELD * field, bool new_page_flag) -{ - Normalize_Field(field); - if (field->form) - RETURN(E_CONNECTED); - - if (new_page_flag) - field->status |= _NEWPAGE; - else - field->status &= ~_NEWPAGE; - - RETURN(E_OK); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : bool new_page(const FIELD *field) -| -| Description : Retrieve the info whether or not the field starts a -| new page on the form. -| -| Return Values : TRUE - field starts a new page -| FALSE - field doesn't start a new page -+--------------------------------------------------------------------------*/ -bool new_page(const FIELD * field) -{ - return (Normalize_Field(field)->status & _NEWPAGE) ? TRUE : FALSE; -} - /* fld_def.c ends here */ diff --git a/form/fld_dup.c b/form/fld_dup.c new file mode 100644 index 00000000..1f235bf1 --- /dev/null +++ b/form/fld_dup.c @@ -0,0 +1,97 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_dup.c,v 1.2 1998/02/11 12:13:44 tom Exp $") + +/*--------------------------------------------------------------------------- +| 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 ++--------------------------------------------------------------------------*/ +FIELD *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))) ) + { + *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; + + if (_nc_Copy_Type(New_Field,field)) + { + size_t len; + + len = Total_Buffer_Size(New_Field); + if ( (New_Field->buf=(char *)malloc(len)) ) + { + memcpy(New_Field->buf,field->buf,len); + return New_Field; + } + } + } + + if (New_Field) + free_field(New_Field); + + SET_ERROR(err); + return (FIELD *)0; +} + +/* fld_dup.c ends here */ diff --git a/form/fld_ftchoice.c b/form/fld_ftchoice.c new file mode 100644 index 00000000..45f609e2 --- /dev/null +++ b/form/fld_ftchoice.c @@ -0,0 +1,62 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_ftchoice.c,v 1.2 1998/02/11 12:13:44 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_fieldtype_choice( +| FIELDTYPE *typ, +| bool (* const next_choice)(FIELD *,const void *), +| bool (* const prev_choice)(FIELD *,const void *)) +| +| Description : Define implementation of enumeration requests. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid arguments ++--------------------------------------------------------------------------*/ +int 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 ) + RETURN(E_BAD_ARGUMENT); + + typ->status |= _HAS_CHOICE; + typ->next = next_choice; + typ->prev = prev_choice; + RETURN(E_OK); +} + +/* fld_ftchoice.c ends here */ diff --git a/form/fld_ftlink.c b/form/fld_ftlink.c new file mode 100644 index 00000000..ecb1c97e --- /dev/null +++ b/form/fld_ftlink.c @@ -0,0 +1,83 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_ftlink.c,v 1.2 1998/02/11 12:13:44 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : FIELDTYPE *link_fieldtype( +| FIELDTYPE *type1, +| FIELDTYPE *type2) +| +| Description : Create a new fieldtype built from the two given types. +| They are connected by an logical 'OR'. +| 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 occured. ++--------------------------------------------------------------------------*/ +FIELDTYPE *link_fieldtype(FIELDTYPE * type1, FIELDTYPE * type2) +{ + FIELDTYPE *nftyp = (FIELDTYPE *)0; + + 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) ) + nftyp->status |= _HAS_ARGS; + if ((type1->status & _HAS_CHOICE) || (type2->status & _HAS_CHOICE) ) + nftyp->status |= _HAS_CHOICE; + nftyp->left = type1; + nftyp->right = type2; + type1->ref++; + type2->ref++; + } + else + { + SET_ERROR( E_SYSTEM_ERROR ); + } + } + else + { + SET_ERROR( E_BAD_ARGUMENT ); + } + return nftyp; +} + +/* fld_ftlink.c ends here */ diff --git a/form/fld_info.c b/form/fld_info.c new file mode 100644 index 00000000..069c0adb --- /dev/null +++ b/form/fld_info.c @@ -0,0 +1,91 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_info.c,v 1.2 1998/02/11 12:13:44 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int field_info(const FIELD *field, +| int *rows, int *cols, +| int *frow, int *fcol, +| int *nrow, int *nbuf) +| +| Description : Retrieve infos about the fields creation parameters. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid field pointer ++--------------------------------------------------------------------------*/ +int field_info(const FIELD *field, + int *rows, int *cols, + int *frow, int *fcol, + int *nrow, int *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; + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int dynamic_field_info(const FIELD *field, +| int *drows, int *dcols, +| int *maxgrow) +| +| Description : Retrieve informations about a dynamic fields current +| dynamic parameters. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid argument ++--------------------------------------------------------------------------*/ +int dynamic_field_info(const FIELD *field, + int *drows, int *dcols, int *maxgrow) +{ + if (!field) + RETURN(E_BAD_ARGUMENT); + + if (drows) *drows = field->drows; + if (dcols) *dcols = field->dcols; + if (maxgrow) *maxgrow = field->maxgrow; + + RETURN(E_OK); +} + +/* fld_info.c ends here */ diff --git a/form/fld_just.c b/form/fld_just.c new file mode 100644 index 00000000..c621c163 --- /dev/null +++ b/form/fld_just.c @@ -0,0 +1,81 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_just.c,v 1.3 1998/02/11 12:13:44 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_field_just(FIELD *field, int just) +| +| Description : Set the fields type of justification. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - one of the arguments was incorrect +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int 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) ) + { + Normalize_Field( field ); + if (field->just != just) + { + field->just = just; + res = _nc_Synchronize_Attributes( field ); + } + else + res = E_OK; + } + RETURN(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int field_just( const FIELD *field ) +| +| Description : Retrieve the fields type of justification +| +| Return Values : The justification type. ++--------------------------------------------------------------------------*/ +int field_just(const FIELD * field) +{ + return Normalize_Field( field )->just; +} + +/* fld_just.c ends here */ diff --git a/form/fld_link.c b/form/fld_link.c new file mode 100644 index 00000000..b3c6a7f0 --- /dev/null +++ b/form/fld_link.c @@ -0,0 +1,90 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_link.c,v 1.2 1998/02/11 12:13:44 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : FIELD *link_field(FIELD *field, int frow, int fcol) +| +| Description : Duplicates the field at the specified position. The +| new field shares its buffers with the original one, +| the attributes are independent. +| 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 ++--------------------------------------------------------------------------*/ +FIELD *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))) ) + { + *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 (New_Field) + free_field(New_Field); + + SET_ERROR( err ); + return (FIELD *)0; +} + +/* fld_link.c ends here */ diff --git a/form/fld_max.c b/form/fld_max.c new file mode 100644 index 00000000..1ad925c4 --- /dev/null +++ b/form/fld_max.c @@ -0,0 +1,74 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_max.c,v 1.2 1998/02/11 12:13:44 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_max_field(FIELD *field, int maxgrow) +| +| Description : Set the maximum growth for a dynamic field. If maxgrow=0 +| the field may grow to any possible size. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid argument ++--------------------------------------------------------------------------*/ +int set_max_field(FIELD *field, int maxgrow) +{ + if (!field || (maxgrow<0)) + RETURN(E_BAD_ARGUMENT); + else + { + bool single_line_field = Single_Line_Field(field); + + if (maxgrow>0) + { + if (( single_line_field && (maxgrow < field->dcols)) || + (!single_line_field && (maxgrow < field->drows))) + RETURN(E_BAD_ARGUMENT); + } + field->maxgrow = maxgrow; + field->status &= ~_MAY_GROW; + if (!(field->opts & O_STATIC)) + { + 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 new file mode 100644 index 00000000..9115335b --- /dev/null +++ b/form/fld_move.c @@ -0,0 +1,62 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_move.c,v 1.2 1998/02/11 12:13:44 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int move_field(FIELD *field,int frow, int fcol) +| +| Description : Moves the disconnected field to the new location in +| the forms subwindow. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid argument passed +| E_CONNECTED - field is connected ++--------------------------------------------------------------------------*/ +int move_field(FIELD *field, int frow, int fcol) +{ + if ( !field || (frow<0) || (fcol<0) ) + RETURN(E_BAD_ARGUMENT); + + if (field->form) + RETURN(E_CONNECTED); + + field->frow = frow; + field->fcol = fcol; + RETURN(E_OK); +} + +/* fld_move.c ends here */ + diff --git a/form/fld_newftyp.c b/form/fld_newftyp.c new file mode 100644 index 00000000..12487c90 --- /dev/null +++ b/form/fld_newftyp.c @@ -0,0 +1,125 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_newftyp.c,v 1.2 1998/02/11 12:13:44 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 */ +}; + +const FIELDTYPE* _nc_Default_FieldType = &default_fieldtype; + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : FIELDTYPE *new_fieldtype( +| bool (* const field_check)(FIELD *,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 +| E_BAD_ARGUMENT - invalid arguments +| E_SYSTEM_ERROR - system error (no memory) +| +| Return Values : Fieldtype pointer or NULL if error occured ++--------------------------------------------------------------------------*/ +FIELDTYPE *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) ) + { + nftyp = (FIELDTYPE *)malloc(sizeof(FIELDTYPE)); + if (nftyp) + { + *nftyp = default_fieldtype; + nftyp->fcheck = field_check; + nftyp->ccheck = char_check; + } + else + { + SET_ERROR( E_SYSTEM_ERROR ); + } + } + else + { + SET_ERROR( E_BAD_ARGUMENT ); + } + return nftyp; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int free_fieldtype(FIELDTYPE *typ) +| +| Description : Release the memory associated with this fieldtype. +| +| Return Values : E_OK - success +| E_CONNECTED - there are fields referencing the type +| E_BAD_ARGUMENT - invalid fieldtype pointer ++--------------------------------------------------------------------------*/ +int free_fieldtype(FIELDTYPE *typ) +{ + if (!typ) + RETURN(E_BAD_ARGUMENT); + + if (typ->ref!=0) + RETURN(E_CONNECTED); + + if (typ->status & _RESIDENT) + RETURN(E_CONNECTED); + + if (typ->status & _LINKED_TYPE) + { + if (typ->left ) typ->left->ref--; + if (typ->right) typ->right->ref--; + } + free(typ); + RETURN(E_OK); +} + +/* fld_newftyp.c ends here */ diff --git a/form/fld_opts.c b/form/fld_opts.c new file mode 100644 index 00000000..98af32f5 --- /dev/null +++ b/form/fld_opts.c @@ -0,0 +1,121 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ +#include "form.priv.h" + +MODULE_ID("$Id: fld_opts.c,v 1.2 1998/02/11 12:13:44 tom Exp $") + +/*---------------------------------------------------------------------------- + Field-Options manipulation routines + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_field_opts(FIELD *field, Field_Options opts) +| +| Description : Turns on the named options for this field and turns +| off all the remaining options. +| +| Return Values : E_OK - success +| E_CURRENT - the field is the current field +| E_BAD_ARGUMENT - invalid options +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int set_field_opts(FIELD * field, Field_Options opts) +{ + int res = E_BAD_ARGUMENT; + if (!(opts & ~ALL_FIELD_OPTS)) + res = _nc_Synchronize_Options( Normalize_Field(field), opts ); + RETURN(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : Field_Options field_opts(const FIELD *field) +| +| Description : Retrieve the fields options. +| +| Return Values : The options. ++--------------------------------------------------------------------------*/ +Field_Options field_opts(const FIELD * field) +{ + return ALL_FIELD_OPTS & Normalize_Field( field )->opts; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int field_opts_on(FIELD *field, Field_Options opts) +| +| Description : Turns on the named options for this field and all the +| remaining options are unchanged. +| +| Return Values : E_OK - success +| E_CURRENT - the field is the current field +| E_BAD_ARGUMENT - invalid options +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int field_opts_on(FIELD * field, Field_Options opts) +{ + int res = E_BAD_ARGUMENT; + + if (!(opts & ~ALL_FIELD_OPTS)) + { + Normalize_Field( field ); + res = _nc_Synchronize_Options( field, field->opts | opts ); + } + RETURN(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int field_opts_off(FIELD *field, Field_Options opts) +| +| Description : Turns off the named options for this field and all the +| remaining options are unchanged. +| +| Return Values : E_OK - success +| E_CURRENT - the field is the current field +| E_BAD_ARGUMENT - invalid options +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int field_opts_off(FIELD * field, Field_Options opts) +{ + int res = E_BAD_ARGUMENT; + + if (!(opts & ~ALL_FIELD_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 new file mode 100644 index 00000000..c7ac9086 --- /dev/null +++ b/form/fld_pad.c @@ -0,0 +1,78 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ +#include "form.priv.h" + +MODULE_ID("$Id: fld_pad.c,v 1.2 1998/02/11 12:13:44 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_field_pad(FIELD *field, int ch) +| +| Description : Set the pad character used to fill the field. This must +| be a printable character. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid field pointer or pad character +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int set_field_pad(FIELD * field, int ch) +{ + int res = E_BAD_ARGUMENT; + + Normalize_Field( field ); + if (isprint((unsigned char)ch)) + { + if (field->pad != ch) + { + field->pad = ch; + res = _nc_Synchronize_Attributes( field ); + } + else + res = E_OK; + } + RETURN(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int field_pad(const FIELD *field) +| +| Description : Retrieve the fields pad character. +| +| Return Values : The pad character. ++--------------------------------------------------------------------------*/ +int field_pad(const FIELD * field) +{ + return Normalize_Field( field )->pad; +} + +/* fld_pad.c ends here */ diff --git a/form/fld_page.c b/form/fld_page.c new file mode 100644 index 00000000..be9b915a --- /dev/null +++ b/form/fld_page.c @@ -0,0 +1,76 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_page.c,v 1.2 1998/02/11 12:13:44 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_new_page(FIELD *field, bool new_page_flag) +| +| Description : Marks the field as the beginning of a new page of +| the form. +| +| Return Values : E_OK - success +| E_CONNECTED - field is connected ++--------------------------------------------------------------------------*/ +int set_new_page(FIELD * field, bool new_page_flag) +{ + Normalize_Field(field); + if (field->form) + RETURN(E_CONNECTED); + + if (new_page_flag) + field->status |= _NEWPAGE; + else + field->status &= ~_NEWPAGE; + + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : bool new_page(const FIELD *field) +| +| Description : Retrieve the info whether or not the field starts a +| new page on the form. +| +| Return Values : TRUE - field starts a new page +| FALSE - field doesn't start a new page ++--------------------------------------------------------------------------*/ +bool new_page(const FIELD * field) +{ + return (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 98cd3a70..b237811a 100644 --- a/form/fld_stat.c +++ b/form/fld_stat.c @@ -1,28 +1,38 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses form library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: fld_stat.c,v 1.3 1997/05/01 16:47:54 juergen Exp $") +MODULE_ID("$Id: fld_stat.c,v 1.4 1998/02/11 12:13:43 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/fld_type.c b/form/fld_type.c index dad5a115..fd314f73 100644 --- a/form/fld_type.c +++ b/form/fld_type.c @@ -1,222 +1,92 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses form library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: fld_type.c,v 1.4 1997/05/01 16:47:54 juergen Exp $") +MODULE_ID("$Id: fld_type.c,v 1.7 1998/02/11 12:13:43 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 */ -}; - /*--------------------------------------------------------------------------- | Facility : libnform -| Function : FIELDTYPE *new_fieldtype( -| bool (* const field_check)(FIELD *,const void *), -| bool (* const char_check) (int, const void *) ) +| Function : int set_field_type(FIELD *field, FIELDTYPE *type,...) | -| 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 -| E_BAD_ARGUMENT - invalid arguments -| E_SYSTEM_ERROR - system error (no memory) +| Description : Associate the specified fieldtype with the field. +| Certain field types take additional arguments. Look +| at the spec of the field types ! | -| Return Values : Fieldtype pointer or NULL if error occured +| Return Values : E_OK - success +| E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -FIELDTYPE *new_fieldtype( - bool (* const field_check)(FIELD *,const void *), - bool (* const char_check) (int,const void *) ) +int set_field_type(FIELD *field,FIELDTYPE *type, ...) { - FIELDTYPE *nftyp = (FIELDTYPE *)0; - - if ( (field_check) && (char_check) ) - { - nftyp = (FIELDTYPE *)malloc(sizeof(FIELDTYPE)); - if (nftyp) - { - *nftyp = default_fieldtype; - nftyp->fcheck = field_check; - nftyp->ccheck = char_check; - } - else - { - SET_ERROR( E_SYSTEM_ERROR ); - } - } - else - { - SET_ERROR( E_BAD_ARGUMENT ); - } - return nftyp; -} + va_list ap; + int res = E_SYSTEM_ERROR; + int err = 0; -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : FIELDTYPE *link_fieldtype( -| FIELDTYPE *type1, -| FIELDTYPE *type2) -| -| Description : Create a new fieldtype built from the two given types. -| They are connected by an logical 'OR'. -| 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 occured. -+--------------------------------------------------------------------------*/ -FIELDTYPE *link_fieldtype(FIELDTYPE * type1, FIELDTYPE * type2) -{ - FIELDTYPE *nftyp = (FIELDTYPE *)0; + va_start(ap,type); + + Normalize_Field(field); + _nc_Free_Type(field); + + field->type = type; + field->arg = (void *)_nc_Make_Argument(field->type,&ap,&err); - if ( type1 && type2 ) + if (err) { - nftyp = (FIELDTYPE *)malloc(sizeof(FIELDTYPE)); - if (nftyp) - { - *nftyp = default_fieldtype; - nftyp->status |= _LINKED_TYPE; - if ((type1->status & _HAS_ARGS) || (type2->status & _HAS_ARGS) ) - nftyp->status |= _HAS_ARGS; - if ((type1->status & _HAS_CHOICE) || (type2->status & _HAS_CHOICE) ) - nftyp->status |= _HAS_CHOICE; - nftyp->left = type1; - nftyp->right = type2; - type1->ref++; - type2->ref++; - } - else - { - SET_ERROR( E_SYSTEM_ERROR ); - } + _nc_Free_Argument(field->type,(TypeArgument *)(field->arg)); + field->type = (FIELDTYPE *)0; + field->arg = (void *)0; } else { - SET_ERROR( E_BAD_ARGUMENT ); + res = E_OK; + if (field->type) + field->type->ref++; } - return nftyp; -} -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int free_fieldtype(FIELDTYPE *typ) -| -| Description : Release the memory associated with this fieldtype. -| -| Return Values : E_OK - success -| E_CONNECTED - there are fields referencing the type -| E_BAD_ARGUMENT - invalid fieldtype pointer -+--------------------------------------------------------------------------*/ -int free_fieldtype(FIELDTYPE *typ) -{ - if (!typ) - RETURN(E_BAD_ARGUMENT); - - if (typ->ref!=0) - RETURN(E_CONNECTED); - - if (typ->status & _RESIDENT) - RETURN(E_CONNECTED); - - if (typ->status & _LINKED_TYPE) - { - if (typ->left ) typ->left->ref--; - if (typ->right) typ->right->ref--; - } - free(typ); - RETURN(E_OK); + va_end(ap); + RETURN(res); } /*--------------------------------------------------------------------------- | 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 *) ) +| Function : FIELDTYPE *field_type(const FIELD *field) | -| Description : Connects to the type additional arguments necessary -| for a set_field_type call. The various function pointer -| arguments are: -| make_arg : allocates a structure for the field -| specific parameters. -| copy_arg : duplicate the structure created by -| make_arg -| free_arg : Release the memory allocated by make_arg -| or copy_arg -| -| At least one of those functions must be non-NULL. -| -| Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid argument -+--------------------------------------------------------------------------*/ -int 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 || !copy_arg || !free_arg ) - RETURN(E_BAD_ARGUMENT); - - typ->status |= _HAS_ARGS; - typ->makearg = make_arg; - typ->copyarg = copy_arg; - typ->freearg = free_arg; - RETURN(E_OK); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int set_fieldtype_choice( -| FIELDTYPE *typ, -| bool (* const next_choice)(FIELD *,const void *), -| bool (* const prev_choice)(FIELD *,const void *)) -| -| Description : Define implementation of enumeration requests. +| Description : Retrieve the associated fieldtype for this field. | -| Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid arguments +| Return Values : Pointer to fieldtype of NULL if none is defined. +--------------------------------------------------------------------------*/ -int set_fieldtype_choice(FIELDTYPE * typ, - bool (* const next_choice) (FIELD *,const void *), - bool (* const prev_choice) (FIELD *,const void *)) +FIELDTYPE *field_type(const FIELD * field) { - if ( !typ || !next_choice || !prev_choice ) - RETURN(E_BAD_ARGUMENT); - - typ->status |= _HAS_CHOICE; - typ->next = next_choice; - typ->prev = prev_choice; - RETURN(E_OK); + return Normalize_Field(field)->type; } /* fld_type.c ends here */ diff --git a/form/fld_user.c b/form/fld_user.c index 2c6475a1..db950ec0 100644 --- a/form/fld_user.c +++ b/form/fld_user.c @@ -1,28 +1,38 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses form library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: fld_user.c,v 1.4 1997/05/01 16:47:54 juergen Exp $") +MODULE_ID("$Id: fld_user.c,v 1.6 1998/02/11 12:13:43 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -33,7 +43,7 @@ MODULE_ID("$Id: fld_user.c,v 1.4 1997/05/01 16:47:54 juergen Exp $") | | Return Values : E_OK - on success +--------------------------------------------------------------------------*/ -int set_field_userptr(FIELD * field, const void *usrptr) +int set_field_userptr(FIELD * field, void *usrptr) { Normalize_Field( field )->usrptr = usrptr; RETURN(E_OK); @@ -49,7 +59,7 @@ int set_field_userptr(FIELD * field, const void *usrptr) | Return Values : Value of pointer. If no such pointer has been set, | NULL is returned +--------------------------------------------------------------------------*/ -const void *field_userptr(const FIELD *field) +void *field_userptr(const FIELD *field) { return Normalize_Field( field )->usrptr; } diff --git a/form/form.h b/form/form.h index 6e2eabe2..77fd9506 100644 --- a/form/form.h +++ b/form/form.h @@ -1,24 +1,34 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses form library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ #ifndef FORM_H #define FORM_H @@ -73,7 +83,7 @@ typedef struct fieldnode { struct typenode * type; /* field type */ void * arg; /* argument for type */ char * buf; /* field buffers */ - const void * usrptr; /* user pointer */ + void * usrptr; /* user pointer */ } FIELD; /************** @@ -120,7 +130,7 @@ typedef struct formnode { FIELD ** field; /* field [maxfield] */ FIELD * current; /* current field */ _PAGE * page; /* page [maxpage] */ - const void * usrptr; /* user pointer */ + void * usrptr; /* user pointer */ void (*forminit)(struct formnode *); void (*formterm)(struct formnode *); @@ -296,7 +306,7 @@ extern int free_field(FIELD *), field_pad(const FIELD *), set_field_buffer(FIELD *,int,const char *), set_field_status(FIELD *,bool), - set_field_userptr(FIELD *,const void *), + set_field_userptr(FIELD *, void *), set_field_opts(FIELD *,Field_Options), field_opts_on(FIELD *,Field_Options), field_opts_off(FIELD *,Field_Options); @@ -309,8 +319,7 @@ extern bool new_page(const FIELD *), extern void *field_arg(const FIELD *); -extern const void - *field_userptr(const FIELD *); +extern void *field_userptr(const FIELD *); extern FIELDTYPE *field_type(const FIELD *); @@ -355,7 +364,7 @@ extern int free_form(FORM *), unpost_form(FORM *), pos_form_cursor(FORM *), form_driver(FORM *,int), - set_form_userptr(FORM *,const void *), + set_form_userptr(FORM *,void *), set_form_opts(FORM *,Form_Options), form_opts_on(FORM *,Form_Options), form_opts_off(FORM *,Form_Options), @@ -364,8 +373,7 @@ extern int free_form(FORM *), extern const char *form_request_name(int); -extern const void - *form_userptr(const FORM *); +extern void *form_userptr(const FORM *); extern Form_Options form_opts(const FORM *); diff --git a/form/form.priv.h b/form/form.priv.h index b08d70d6..91b08151 100644 --- a/form/form.priv.h +++ b/form/form.priv.h @@ -1,24 +1,34 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses form library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ #include "mf_common.h" #include "form.h" @@ -40,6 +50,10 @@ #define _HAS_CHOICE (0x04) /* Type has choice methods */ #define _RESIDENT (0x08) /* Type is builtin */ +/* 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) @@ -61,6 +75,9 @@ #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) typedef struct typearg { struct typearg *left; @@ -92,3 +109,20 @@ typedef struct typearg { #define C_BLANK ' ' #define is_blank(c) ((c)==C_BLANK) + +extern const FIELDTYPE* _nc_Default_FieldType; + +extern TypeArgument* _nc_Make_Argument(const FIELDTYPE*,va_list*,int*); +extern TypeArgument *_nc_Copy_Argument(const FIELDTYPE*,const TypeArgument*, int*); +extern void _nc_Free_Argument(const FIELDTYPE*,TypeArgument*); +extern bool _nc_Copy_Type(FIELD*, FIELD const *); +extern void _nc_Free_Type(FIELD *); + +extern int _nc_Synchronize_Attributes(FIELD*); +extern int _nc_Synchronize_Options(FIELD*,Field_Options); +extern int _nc_Set_Form_Page(FORM*,int,FIELD*); +extern int _nc_Refresh_Current_Field(FORM*); +extern FIELD* _nc_First_Active_Field(FORM*); +extern bool _nc_Internal_Validation(FORM*); +extern int _nc_Set_Current_Field(FORM*,FIELD*); +extern int _nc_Position_Form_Cursor(FORM*); diff --git a/form/frm_adabind.c b/form/frm_adabind.c index 9db7e9f5..53d1ca2a 100644 --- a/form/frm_adabind.c +++ b/form/frm_adabind.c @@ -1,24 +1,34 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses form library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** * Module frm_adabind.c * @@ -28,12 +38,13 @@ ***************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: frm_adabind.c,v 1.3 1997/05/01 16:47:54 juergen Exp $") +MODULE_ID("$Id: frm_adabind.c,v 1.5 1998/02/11 12:13:43 tom Exp $") /* Prototypes for the functions in this module */ -void _nc_ada_normalize_field_opts (int *opt); -void _nc_ada_normalize_form_opts (int *opt); -void *_nc_ada_getvarg(va_list *); +void _nc_ada_normalize_field_opts (int *opt); +void _nc_ada_normalize_form_opts (int *opt); +void* _nc_ada_getvarg(va_list *); +FIELD* _nc_get_field(const FORM*, int); void _nc_ada_normalize_field_opts (int *opt) @@ -59,3 +70,12 @@ void *_nc_ada_getvarg(va_list *ap) { return va_arg(*ap,void*); } + +FIELD* _nc_get_field(const FORM* frm, int idx) { + if (frm && frm->field && idx>=0 && (idxmaxfield)) + { + return frm->field[idx]; + } + else + return (FIELD*)0; +} diff --git a/form/frm_cursor.c b/form/frm_cursor.c new file mode 100644 index 00000000..d5c93a28 --- /dev/null +++ b/form/frm_cursor.c @@ -0,0 +1,66 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ +#include "form.priv.h" + +MODULE_ID("$Id: frm_cursor.c,v 1.2 1998/02/11 12:13:44 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int pos_form_cursor(FORM * form) +| +| Description : Moves the form window cursor to the location required +| by the form driver to resume form processing. This may +| be needed after the application calls a curses library +| I/O routine that modifies the cursor position. +| +| Return Values : E_OK - Success +| E_SYSTEM_ERROR - System error. +| E_BAD_ARGUMENT - Invalid form pointer +| E_NOT_POSTED - Form is not posted ++--------------------------------------------------------------------------*/ +int pos_form_cursor(FORM * form) +{ + int res; + + if (!form) + res = E_BAD_ARGUMENT; + else + { + if (!(form->status & _POSTED)) + res = E_NOT_POSTED; + else + res = _nc_Position_Form_Cursor(form); + } + RETURN(res); +} + +/* frm_cursor.c ends here */ diff --git a/form/frm_data.c b/form/frm_data.c index 1fd79415..8df5c465 100644 --- a/form/frm_data.c +++ b/form/frm_data.c @@ -1,28 +1,38 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses form library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: frm_data.c,v 1.3 1997/05/01 16:47:54 juergen Exp $") +MODULE_ID("$Id: frm_data.c,v 1.4 1998/02/11 12:13:42 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/frm_def.c b/form/frm_def.c index 9b537bfa..5a93a24d 100644 --- a/form/frm_def.c +++ b/form/frm_def.c @@ -1,28 +1,38 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses form library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: frm_def.c,v 1.4 1997/05/01 16:47:54 juergen Exp $") +MODULE_ID("$Id: frm_def.c,v 1.7 1998/02/11 12:13:42 tom Exp $") /* this can't be readonly */ static FORM default_form = { @@ -109,23 +119,24 @@ static FIELD *Insert_Field_By_Position(FIELD *newfield, FIELD *head) +--------------------------------------------------------------------------*/ static void Disconnect_Fields( FORM * form ) { - FIELD **fields; - - assert(form && form->field); - - for(fields=form->field;*fields;fields++) + if (form->field) { - 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) - free(form->page); - form->page = (_PAGE *)0; -} + FIELD **fields; + + for(fields=form->field;*fields;fields++) + { + 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) + free(form->page); + form->page = (_PAGE *)0; + } +} /*--------------------------------------------------------------------------- | Facility : libnform @@ -362,30 +373,4 @@ int field_count(const FORM * form) return (Normalize_Form( form )->maxfield); } -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int scale_form( const FORM *form, int *rows, int *cols ) -| -| Description : Retrieve size of form -| -| Return Values : E_OK - no error -| E_BAD_ARGUMENT - invalid form pointer -| E_NOT_CONNECTED - no fields connected to form -+--------------------------------------------------------------------------*/ -int scale_form(const FORM * form, int * rows, int * cols) -{ - if ( !form ) - RETURN(E_BAD_ARGUMENT); - - if ( !(form->field) ) - RETURN(E_NOT_CONNECTED); - - if (rows) - *rows = form->rows; - if (cols) - *cols = form->cols; - - RETURN(E_OK); -} - /* frm_def.c ends here */ diff --git a/form/frm_driver.c b/form/frm_driver.c index 51297e5a..7fad2a74 100644 --- a/form/frm_driver.c +++ b/form/frm_driver.c @@ -1,24 +1,37 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses form library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ +#include "form.priv.h" + +MODULE_ID("$Id: frm_driver.c,v 1.31 1998/02/11 12:13:45 tom Exp $") /*---------------------------------------------------------------------------- This is the core module of the form library. It contains the majority @@ -63,10 +76,6 @@ routines I omit them mostly. --------------------------------------------------------------------------*/ -#include "form.priv.h" - -MODULE_ID("$Id: frm_driver.c,v 1.20 1997/05/01 16:47:54 juergen Exp $") - /* Some options that may effect compatibility in behavior to SVr4 forms, but they are here to allow a more intuitive and user friendly behaviour of @@ -85,6 +94,8 @@ Perhaps at some time we will make this configurable at runtime. #define FRIENDLY_PREV_NEXT_WORD (1) /* Fix the wrong behaviour for forms with all fields inactive */ #define FIX_FORM_INACTIVE_BUG (1) +/* Allow dynamic field growth also when navigating past the end */ +#define GROW_IF_NAVIGATE (1) /*---------------------------------------------------------------------------- Forward references to some internally used static functions @@ -163,10 +174,8 @@ static int FE_Delete_Previous(FORM *); /* Macro to set the attributes for a fields window */ #define Set_Field_Window_Attributes(field,win) \ -{\ - wbkgdset((win),(chtype)((field)->pad | (field)->back)); \ - wattrset((win),(field)->fore); \ -} +( wbkgdset((win),(chtype)((field)->pad | (field)->back)), \ + wattrset((win),(field)->fore) ) /* Logic to decide whether or not a field really appears on the form */ #define Field_Really_Appears(field) \ @@ -180,13 +189,6 @@ static int FE_Delete_Previous(FORM *); #define First_Position_In_Current_Field(form) \ (((form)->currow==0) && ((form)->curcol==0)) -/* This are the field options required to be a selectable field in field - navigation requests */ -#define O_SELECTABLE (O_ACTIVE | O_VISIBLE) - -/* 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 Minimum(a,b) (((a)<=(b)) ? (a) : (b)) #define Maximum(a,b) (((a)>=(b)) ? (a) : (b)) @@ -545,9 +547,9 @@ static bool Field_Grown(FIELD * field, int amount) /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static int Position_Form_Cursor(FORM * form) +| Function : int _nc_Position_Form_Cursor(FORM * form) | -| Description : Position the currsor in the window for the current +| Description : Position the cursor in the window for the current | field to be in sync. with the currow and curcol | values. | @@ -556,7 +558,8 @@ static bool Field_Grown(FIELD * field, int amount) | E_SYSTEM_ERROR - form has no current field or | field-window +--------------------------------------------------------------------------*/ -static int Position_Form_Cursor(FORM * form) +int +_nc_Position_Form_Cursor(FORM * form) { FIELD *field; WINDOW *formwin; @@ -587,7 +590,7 @@ static int Position_Form_Cursor(FORM * form) /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static int Refresh_Current_Field(FORM * form) +| Function : int _nc_Refresh_Current_Field(FORM * form) | | Description : Propagate the changes in the fields window to the | window of the form. @@ -596,7 +599,8 @@ static int Position_Form_Cursor(FORM * form) | E_BAD_ARGUMENT - invalid form pointer | E_SYSTEM_ERROR - general error +--------------------------------------------------------------------------*/ -static int Refresh_Current_Field(FORM * form) +int +_nc_Refresh_Current_Field(FORM * form) { WINDOW *formwin; FIELD *field; @@ -703,7 +707,7 @@ static int Refresh_Current_Field(FORM * form) } } untouchwin(form->w); - return Position_Form_Cursor(form); + return _nc_Position_Form_Cursor(form); } /*--------------------------------------------------------------------------- @@ -805,7 +809,7 @@ static bool Check_Char(FIELDTYPE * typ, int ch, TypeArgument *argp) return typ->ccheck(ch,(void *)argp); } } - return isprint((unsigned char)ch); + return (isprint((unsigned char)ch) ? TRUE : FALSE); } /*--------------------------------------------------------------------------- @@ -824,18 +828,23 @@ static bool Check_Char(FIELDTYPE * typ, int ch, TypeArgument *argp) static int Display_Or_Erase_Field(FIELD * field, bool bEraseFlag) { WINDOW *win; + WINDOW *fwin; if (!field) return E_SYSTEM_ERROR; - win = derwin(Get_Form_Window(field->form), + fwin = Get_Form_Window(field->form); + win = derwin(fwin, field->rows,field->cols,field->frow,field->fcol); if (!win) return E_SYSTEM_ERROR; else { - Set_Field_Window_Attributes(field,win); + if (field->opts & O_VISIBLE) + Set_Field_Window_Attributes(field,win); + else + wattr_set(win,wattr_get(fwin)); werase(win); } @@ -892,7 +901,7 @@ static int Synchronize_Field(FIELD * field) Buffer_To_Window( field, form->w ); field->status |= _NEWTOP; - res = Refresh_Current_Field( form ); + res = _nc_Refresh_Current_Field( form ); } else res = Display_Field( field ); @@ -938,7 +947,7 @@ static int Synchronize_Linked_Fields(FIELD * field) /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static int Synchronize_Attributes(FIELD * field) +| 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 @@ -948,7 +957,7 @@ static int Synchronize_Linked_Fields(FIELD * field) | E_BAD_ARGUMENT - invalid field pointer | E_SYSTEM_ERROR - some severe basic error +--------------------------------------------------------------------------*/ -static int Synchronize_Attributes(FIELD * field) +int _nc_Synchronize_Attributes(FIELD * field) { FORM *form; int res = E_OK; @@ -982,7 +991,7 @@ static int Synchronize_Attributes(FIELD * field) wsyncup(formwin); Buffer_To_Window(field,form->w); field->status |= _NEWTOP; /* fake refresh to paint all */ - Refresh_Current_Field(form); + _nc_Refresh_Current_Field(form); } } else @@ -995,8 +1004,8 @@ static int Synchronize_Attributes(FIELD * field) /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static int Synchronize_Options(FIELD * field, -| Field_Options newopts) +| 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 @@ -1006,7 +1015,8 @@ static int Synchronize_Attributes(FIELD * field) | E_BAD_ARGUMENT - invalid field pointer | E_SYSTEM_ERROR - some severe basic error +--------------------------------------------------------------------------*/ -static int Synchronize_Options(FIELD *field, Field_Options newopts) +int +_nc_Synchronize_Options(FIELD *field, Field_Options newopts) { Field_Options oldopts; Field_Options changed_opts; @@ -1036,9 +1046,9 @@ static int Synchronize_Options(FIELD *field, Field_Options newopts) if (changed_opts & O_VISIBLE) { if (newopts & O_VISIBLE) - res = Erase_Field(field); - else res = Display_Field(field); + else + res = Erase_Field(field); } else { @@ -1094,9 +1104,8 @@ static int Synchronize_Options(FIELD *field, Field_Options newopts) /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static int Set_Current_Field( -| FORM * form, -| FIELD * newfield) +| Function : int _nc_Set_Current_Field(FORM * form, +| FIELD * newfield) | | Description : Make the newfield the new current field. | @@ -1104,7 +1113,8 @@ static int Synchronize_Options(FIELD *field, Field_Options newopts) | E_BAD_ARGUMENT - invalid form or field pointer | E_SYSTEM_ERROR - some severe basic error +--------------------------------------------------------------------------*/ -static int Set_Current_Field(FORM *form, FIELD *newfield) +int +_nc_Set_Current_Field(FORM *form, FIELD *newfield) { FIELD *field; WINDOW *new_window; @@ -1127,7 +1137,7 @@ static int Set_Current_Field(FORM *form, FIELD *newfield) (field->opts & O_VISIBLE) && (field->form->curpage == field->page)) { - Refresh_Current_Field(form); + _nc_Refresh_Current_Field(form); if (field->opts & O_PUBLIC) { if (field->drows > field->rows) @@ -1198,7 +1208,7 @@ static int Set_Current_Field(FORM *form, FIELD *newfield) | Function : static int IFN_Next_Character(FORM * form) | | Description : Move to the next character in the field. In a multiline -| field this wraps and the end of the line. +| field this wraps at the end of the line. | | Return Values : E_OK - success | E_REQUEST_DENIED - at the rightmost position @@ -1211,7 +1221,17 @@ static int IFN_Next_Character(FORM * form) { if ((++(form->currow))==field->drows) { +#if GROW_IF_NAVIGATE + if (!Single_Line_Field(field) && Field_Grown(field,1)) { + form->curcol = 0; + return(E_OK); + } +#endif form->currow--; +#if GROW_IF_NAVIGATE + if (Single_Line_Field(field) && Field_Grown(field,1)) + return(E_OK); +#endif form->curcol--; return(E_REQUEST_DENIED); } @@ -1261,6 +1281,10 @@ static int IFN_Next_Line(FORM * form) if ((++(form->currow))==field->drows) { +#if GROW_IF_NAVIGATE + if (!Single_Line_Field(field) && Field_Grown(field,1)) + return(E_OK); +#endif form->currow--; return(E_REQUEST_DENIED); } @@ -1500,6 +1524,11 @@ static int IFN_Right_Character(FORM * form) { if ( (++(form->curcol)) == form->current->dcols ) { +#if GROW_IF_NAVIGATE + FIELD *field = form->current; + if (Single_Line_Field(field) && Field_Grown(field,1)) + return(E_OK); +#endif --(form->curcol); return(E_REQUEST_DENIED); } @@ -1542,6 +1571,10 @@ static int IFN_Down_Character(FORM * form) if ( (++(form->currow)) == field->drows ) { +#if GROW_IF_NAVIGATE + if (!Single_Line_Field(field) && Field_Grown(field,1)) + return(E_OK); +#endif --(form->currow); return(E_REQUEST_DENIED); } @@ -2025,7 +2058,7 @@ static int Wrapping_Not_Necessary_Or_Wrapping_Ok(FORM * form) 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 id full */ + (There_Is_No_Room_For_A_Char_In_Line(form)) && /* line is full */ (!Last_Row || Growable(field)) ) /* there are more lines*/ { char *bp; @@ -2060,6 +2093,8 @@ static int Wrapping_Not_Necessary_Or_Wrapping_Ok(FORM * form) return E_OK; } } + else + return E_OK; if (result!=E_OK) { wmove(form->w,form->currow,form->curcol); @@ -2644,14 +2679,15 @@ static bool Check_Field(FIELDTYPE *typ, FIELD *field, TypeArgument *argp) /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static bool Internal_Validation(FORM * form ) +| Function : bool _nc_Internal_Validation(FORM * form ) | | Description : Validate the current field of the form. | | Return Values : TRUE - field is valid | FALSE - field is invalid +--------------------------------------------------------------------------*/ -static bool Internal_Validation(FORM *form) +bool +_nc_Internal_Validation(FORM *form) { FIELD *field; @@ -2688,7 +2724,7 @@ static bool Internal_Validation(FORM *form) +--------------------------------------------------------------------------*/ static int FV_Validation(FORM * form) { - if (Internal_Validation(form)) + if (_nc_Internal_Validation(form)) return E_OK; else return E_INVALID_FIELD; @@ -2731,7 +2767,7 @@ INLINE static FIELD *Next_Field_On_Page(FIELD * field) /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static FIELD * First_Active_Field(FORM * form) +| 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 @@ -2740,7 +2776,8 @@ INLINE static FIELD *Next_Field_On_Page(FIELD * field) | | Return Values : Pointer to calculated field. +--------------------------------------------------------------------------*/ -static FIELD * First_Active_Field(FORM * form) +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); @@ -3019,7 +3056,7 @@ static int Inter_Field_Navigation(int (* const fct) (FORM *),FORM *form) { int res; - if (!Internal_Validation(form)) + if (!_nc_Internal_Validation(form)) res = E_INVALID_FIELD; else { @@ -3041,8 +3078,8 @@ static int Inter_Field_Navigation(int (* const fct) (FORM *),FORM *form) +--------------------------------------------------------------------------*/ static int FN_Next_Field(FORM * form) { - return Set_Current_Field(form, - Next_Field_On_Page(form->current)); + return _nc_Set_Current_Field(form, + Next_Field_On_Page(form->current)); } /*--------------------------------------------------------------------------- @@ -3057,8 +3094,8 @@ static int FN_Next_Field(FORM * form) +--------------------------------------------------------------------------*/ static int FN_Previous_Field(FORM * form) { - return Set_Current_Field(form, - Previous_Field_On_Page(form->current)); + return _nc_Set_Current_Field(form, + Previous_Field_On_Page(form->current)); } /*--------------------------------------------------------------------------- @@ -3072,9 +3109,8 @@ static int FN_Previous_Field(FORM * form) +--------------------------------------------------------------------------*/ static int FN_First_Field(FORM * form) { - return - Set_Current_Field(form, - Next_Field_On_Page(form->field[form->page[form->curpage].pmax])); + return _nc_Set_Current_Field(form, + Next_Field_On_Page(form->field[form->page[form->curpage].pmax])); } /*--------------------------------------------------------------------------- @@ -3089,7 +3125,7 @@ static int FN_First_Field(FORM * form) static int FN_Last_Field(FORM * form) { return - Set_Current_Field(form, + _nc_Set_Current_Field(form, Previous_Field_On_Page(form->field[form->page[form->curpage].pmin])); } @@ -3105,8 +3141,8 @@ static int FN_Last_Field(FORM * form) +--------------------------------------------------------------------------*/ static int FN_Sorted_Next_Field(FORM * form) { - return Set_Current_Field(form, - Sorted_Next_Field(form->current)); + return _nc_Set_Current_Field(form, + Sorted_Next_Field(form->current)); } /*--------------------------------------------------------------------------- @@ -3121,8 +3157,8 @@ static int FN_Sorted_Next_Field(FORM * form) +--------------------------------------------------------------------------*/ static int FN_Sorted_Previous_Field(FORM * form) { - return Set_Current_Field(form, - Sorted_Previous_Field(form->current)); + return _nc_Set_Current_Field(form, + Sorted_Previous_Field(form->current)); } /*--------------------------------------------------------------------------- @@ -3137,8 +3173,8 @@ static int FN_Sorted_Previous_Field(FORM * form) +--------------------------------------------------------------------------*/ static int FN_Sorted_First_Field(FORM * form) { - return Set_Current_Field(form, - Sorted_Next_Field(form->field[form->page[form->curpage].smax])); + return _nc_Set_Current_Field(form, + Sorted_Next_Field(form->field[form->page[form->curpage].smax])); } /*--------------------------------------------------------------------------- @@ -3153,7 +3189,7 @@ static int FN_Sorted_First_Field(FORM * form) +--------------------------------------------------------------------------*/ static int FN_Sorted_Last_Field(FORM * form) { - return Set_Current_Field(form, + return _nc_Set_Current_Field(form, Sorted_Previous_Field(form->field[form->page[form->curpage].smin])); } @@ -3169,8 +3205,8 @@ static int FN_Sorted_Last_Field(FORM * form) +--------------------------------------------------------------------------*/ static int FN_Left_Field(FORM * form) { - return Set_Current_Field(form, - Left_Neighbour_Field(form->current)); + return _nc_Set_Current_Field(form, + Left_Neighbour_Field(form->current)); } /*--------------------------------------------------------------------------- @@ -3185,8 +3221,8 @@ static int FN_Left_Field(FORM * form) +--------------------------------------------------------------------------*/ static int FN_Right_Field(FORM * form) { - return Set_Current_Field(form, - Right_Neighbour_Field(form->current)); + return _nc_Set_Current_Field(form, + Right_Neighbour_Field(form->current)); } /*--------------------------------------------------------------------------- @@ -3203,8 +3239,8 @@ static int FN_Right_Field(FORM * form) +--------------------------------------------------------------------------*/ static int FN_Up_Field(FORM * form) { - return Set_Current_Field(form, - Upper_Neighbour_Field(form->current)); + return _nc_Set_Current_Field(form, + Upper_Neighbour_Field(form->current)); } /*--------------------------------------------------------------------------- @@ -3221,8 +3257,8 @@ static int FN_Up_Field(FORM * form) +--------------------------------------------------------------------------*/ static int FN_Down_Field(FORM * form) { - return Set_Current_Field(form, - Down_Neighbour_Field(form->current)); + return _nc_Set_Current_Field(form, + Down_Neighbour_Field(form->current)); } /*---------------------------------------------------------------------------- END of Field Navigation routines @@ -3234,9 +3270,9 @@ static int FN_Down_Field(FORM * form) /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static int Set_Form_Page(FORM * form, -| int page, -| FIELD * field) +| Function : int _nc_Set_Form_Page(FORM * form, +| int page, +| FIELD * field) | | Description : Make the given page nr. the current page and make | the given field the current field on the page. If @@ -3247,7 +3283,8 @@ static int FN_Down_Field(FORM * form) | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -static int Set_Form_Page(FORM * form, int page, FIELD * field) +int +_nc_Set_Form_Page(FORM * form, int page, FIELD * field) { int res = E_OK; @@ -3267,7 +3304,7 @@ static int Set_Form_Page(FORM * form, int page, FIELD * field) } while(field_on_page != last_field); if (field) - res = 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 @@ -3332,7 +3369,7 @@ static int Page_Navigation(int (* const fct) (FORM *), FORM * form) { int res; - if (!Internal_Validation(form)) + if (!_nc_Internal_Validation(form)) res = E_INVALID_FIELD; else { @@ -3356,7 +3393,7 @@ static int Page_Navigation(int (* const fct) (FORM *), FORM * form) +--------------------------------------------------------------------------*/ static int PN_Next_Page(FORM * form) { - return Set_Form_Page(form,Next_Page_Number(form),(FIELD *)0); + return _nc_Set_Form_Page(form,Next_Page_Number(form),(FIELD *)0); } /*--------------------------------------------------------------------------- @@ -3370,7 +3407,7 @@ static int PN_Next_Page(FORM * form) +--------------------------------------------------------------------------*/ static int PN_Previous_Page(FORM * form) { - return Set_Form_Page(form,Previous_Page_Number(form),(FIELD *)0); + return _nc_Set_Form_Page(form,Previous_Page_Number(form),(FIELD *)0); } /*--------------------------------------------------------------------------- @@ -3384,7 +3421,7 @@ static int PN_Previous_Page(FORM * form) +--------------------------------------------------------------------------*/ static int PN_First_Page(FORM * form) { - return Set_Form_Page(form,0,(FIELD *)0); + return _nc_Set_Form_Page(form,0,(FIELD *)0); } /*--------------------------------------------------------------------------- @@ -3398,7 +3435,7 @@ static int PN_First_Page(FORM * form) +--------------------------------------------------------------------------*/ static int PN_Last_Page(FORM * form) { - return Set_Form_Page(form,form->maxpage-1,(FIELD *)0); + return _nc_Set_Form_Page(form,form->maxpage-1,(FIELD *)0); } /*---------------------------------------------------------------------------- END of Field Navigation routines @@ -3423,7 +3460,6 @@ static int Data_Entry(FORM * form, int c) { FIELD *field = form->current; int result = E_REQUEST_DENIED; - bool End_Of_Field; if ( (field->opts & O_EDIT) #if FIX_FORM_INACTIVE_BUG @@ -3457,9 +3493,9 @@ static int Data_Entry(FORM * form, int c) 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)); form->status |= _WINDOW_MODIFIED; - End_Of_Field= (((field->drows-1)==form->currow) && - ((field->dcols-1)==form->curcol)); if (End_Of_Field && !Growable(field) && (field->opts & O_AUTOSKIP)) result = Inter_Field_Navigation(FN_Next_Field,form); else @@ -3616,7 +3652,7 @@ int form_driver(FORM * form, int c) if (c==FIRST_ACTIVE_MAGIC) { - form->current = First_Active_Field(form); + form->current = _nc_First_Active_Field(form); return E_OK; } @@ -3650,10 +3686,10 @@ int form_driver(FORM * form, int c) NULL, /* Field Validation is generic */ NULL /* Choice Request is generic */ }; - int nMethods = (sizeof(Generic_Methods)/sizeof(Generic_Methods[0])); - int method = ((BI->keycode & ID_Mask) >> ID_Shft) & 0xffff; + size_t nMethods = (sizeof(Generic_Methods)/sizeof(Generic_Methods[0])); + size_t method = ((BI->keycode & ID_Mask) >> ID_Shft) & 0xffff; - if ( (method < 0) || (method >= nMethods) || !(BI->cmd) ) + if ( (method >= nMethods) || !(BI->cmd) ) res = E_SYSTEM_ERROR; else { @@ -3672,274 +3708,15 @@ int form_driver(FORM * form, int c) (TypeArgument *)(form->current->arg))) res = Data_Entry(form,c); } - Refresh_Current_Field(form); - RETURN(res); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int post_form(FORM * form) -| -| Description : Writes the form into its associated subwindow. -| -| Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid form pointer -| E_POSTED - form already posted -| E_NOT_CONNECTED - no fields connected to form -| E_NO_ROOM - form doesn't fit into subwindow -| E_SYSTEM_ERROR - system error -+--------------------------------------------------------------------------*/ -int post_form(FORM * form) -{ - WINDOW *formwin; - int err; - int page; - - if (!form) - RETURN(E_BAD_ARGUMENT); - - 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))) - 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 = Set_Form_Page(form,page,form->current))!=E_OK) - RETURN(err); - - form->status |= _POSTED; - - Call_Hook(form,forminit); - Call_Hook(form,fieldinit); - - Refresh_Current_Field(form); - RETURN(E_OK); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int unpost_form(FORM * form) -| -| Description : Erase form from its associated subwindow. -| -| Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid form pointer -| E_NOT_POSTED - form isn't posted -| E_BAD_STATE - called from a hook routine -+--------------------------------------------------------------------------*/ -int unpost_form(FORM * form) -{ - if (!form) - RETURN(E_BAD_ARGUMENT); - - if (!(form->status & _POSTED)) - RETURN(E_NOT_POSTED); - - if (form->status & _IN_DRIVER) - RETURN(E_BAD_STATE); - - Call_Hook(form,fieldterm); - Call_Hook(form,formterm); - - werase(Get_Form_Window(form)); - delwin(form->w); - form->w = (WINDOW *)0; - form->status &= ~_POSTED; - RETURN(E_OK); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int pos_form_cursor(FORM * form) -| -| Description : Moves the form window cursor to the location required -| by the form driver to resume form processing. This may -| be needed after the application calls a curses library -| I/O routine that modifies the cursor position. -| -| Return Values : E_OK - Success -| E_SYSTEM_ERROR - System error. -| E_BAD_ARGUMENT - Invalid form pointer -| E_NOT_POSTED - Form is not posted -+--------------------------------------------------------------------------*/ -int pos_form_cursor(FORM * form) -{ - int res; - - if (!form) - res = E_BAD_ARGUMENT; - else - { - if (!(form->status & _POSTED)) - res = E_NOT_POSTED; - else - res = Position_Form_Cursor(form); - } + _nc_Refresh_Current_Field(form); RETURN(res); } - -/*--------------------------------------------------------------------------- -| 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 -| E_BAD_ARGUMENT - invalid form or field pointer -| E_REQUEST_DENIED - field not selectable -| E_BAD_STATE - called from a hook routine -| E_INVALID_FIELD - current field can't be left -| E_SYSTEM_ERROR - system error -+--------------------------------------------------------------------------*/ -int 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)) - { - form->current = field; - form->curpage = field->page; - } - else - { - if (form->status & _IN_DRIVER) - err = E_BAD_STATE; - else - { - if (form->current != field) - { - if (!Internal_Validation(form)) - err = E_INVALID_FIELD; - else - { - Call_Hook(form,fieldterm); - if (field->page != form->curpage) - { - Call_Hook(form,formterm); - err = Set_Form_Page(form,field->page,field); - Call_Hook(form,forminit); - } - else - { - err = Set_Current_Field(form,field); - } - Call_Hook(form,fieldinit); - Refresh_Current_Field(form); - } - } - } - } - RETURN(err); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : FIELD *current_field(const FORM * form) -| -| Description : Return the current field. -| -| Return Values : Pointer to the current field. -+--------------------------------------------------------------------------*/ -FIELD *current_field(const FORM * form) -{ - return Normalize_Form(form)->current; -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int field_index(const FIELD * field) -| -| Description : Return the index of the field in the field-array of -| the form. -| -| Return Values : >= 0 : field index -| -1 : fieldpointer invalid or field not connected -+--------------------------------------------------------------------------*/ -int field_index(const FIELD * field) -{ - return ( (field && field->form) ? field->index : -1 ); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int set_form_page(FORM * form,int page) -| -| Description : Set the page number of the form. -| -| Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid form pointer or page number -| E_BAD_STATE - called from a hook routine -| E_INVALID_FIELD - current field can't be left -| E_SYSTEM_ERROR - system error -+--------------------------------------------------------------------------*/ -int set_form_page(FORM * form, int page) -{ - int err = E_OK; - - if ( !form || (page<0) || (page>=form->maxpage) ) - RETURN(E_BAD_ARGUMENT); - - if (!(form->status & _POSTED)) - { - form->curpage = page; - form->current = First_Active_Field(form); - } - else - { - if (form->status & _IN_DRIVER) - err = E_BAD_STATE; - else - { - if (form->curpage != page) - { - if (!Internal_Validation(form)) - err = E_INVALID_FIELD; - else - { - Call_Hook(form,fieldterm); - Call_Hook(form,formterm); - err = Set_Form_Page(form,page,(FIELD *)0); - Call_Hook(form,forminit); - Call_Hook(form,fieldinit); - Refresh_Current_Field(form); - } - } - } - } - RETURN(err); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int form_page(const FORM * form) -| -| Description : Return the current page of the form. -| -| Return Values : >= 0 : current page number -| -1 : invalid form pointer -+--------------------------------------------------------------------------*/ -int form_page(const FORM * form) -{ - return Normalize_Form(form)->curpage; -} /*---------------------------------------------------------------------------- - Field-Buffer manipulation routines + Field-Buffer manipulation routines. + The effects of setting a buffer is 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. --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- @@ -4016,14 +3793,19 @@ int set_field_buffer(FIELD * field, int buffer, const char * value) for(s=(char *)value; *s && (s < (value+len)); s++) p[s-value] = *s; if (s < (value+len)) - p[s-value] = *s++; + { + p[s-value] = *s++; + s = p + (s-value); + } 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 */ + 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)); @@ -4057,251 +3839,5 @@ char *field_buffer(const FIELD * field, int buffer) else return (char *)0; } - -/*---------------------------------------------------------------------------- - Field-Options manipulation routines - --------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int set_field_opts(FIELD *field, Field_Options opts) -| -| Description : Turns on the named options for this field and turns -| off all the remaining options. -| -| Return Values : E_OK - success -| E_CURRENT - the field is the current field -| E_BAD_ARGUMENT - invalid options -| E_SYSTEM_ERROR - system error -+--------------------------------------------------------------------------*/ -int set_field_opts(FIELD * field, Field_Options opts) -{ - int res = E_BAD_ARGUMENT; - if (!(opts & ~ALL_FIELD_OPTS)) - res = Synchronize_Options( Normalize_Field(field), opts ); - RETURN(res); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : Field_Options field_opts(const FIELD *field) -| -| Description : Retrieve the fields options. -| -| Return Values : The options. -+--------------------------------------------------------------------------*/ -Field_Options field_opts(const FIELD * field) -{ - return ALL_FIELD_OPTS & Normalize_Field( field )->opts; -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int field_opts_on(FIELD *field, Field_Options opts) -| -| Description : Turns on the named options for this field and all the -| remaining options are unchanged. -| -| Return Values : E_OK - success -| E_CURRENT - the field is the current field -| E_BAD_ARGUMENT - invalid options -| E_SYSTEM_ERROR - system error -+--------------------------------------------------------------------------*/ -int field_opts_on(FIELD * field, Field_Options opts) -{ - int res = E_BAD_ARGUMENT; - - if (!(opts & ~ALL_FIELD_OPTS)) - { - Normalize_Field( field ); - res = Synchronize_Options( field, field->opts | opts ); - } - RETURN(res); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int field_opts_off(FIELD *field, Field_Options opts) -| -| Description : Turns off the named options for this field and all the -| remaining options are unchanged. -| -| Return Values : E_OK - success -| E_CURRENT - the field is the current field -| E_BAD_ARGUMENT - invalid options -| E_SYSTEM_ERROR - system error -+--------------------------------------------------------------------------*/ -int field_opts_off(FIELD * field, Field_Options opts) -{ - int res = E_BAD_ARGUMENT; - - if (!(opts & ~ALL_FIELD_OPTS)) - { - Normalize_Field( field ); - res = Synchronize_Options( field, field->opts & ~opts ); - } - RETURN(res); -} - -/*---------------------------------------------------------------------------- - Field-Attribute manipulation routines - --------------------------------------------------------------------------*/ -/* "Template" macro to generate a function to set a fields attribute */ -#define GEN_FIELD_ATTR_SET_FCT( name ) \ -int set_field_ ## name (FIELD * field, chtype attr)\ -{\ - int res = E_BAD_ARGUMENT;\ - if ( attr==A_NORMAL || ((attr & A_ATTRIBUTES)==attr) )\ - {\ - Normalize_Field( field );\ - if ((field -> name) != attr)\ - {\ - field -> name = attr;\ - res = Synchronize_Attributes( field );\ - }\ - else\ - res = E_OK;\ - }\ - RETURN(res);\ -} - -/* "Template" macro to generate a function to get a fields attribute */ -#define GEN_FIELD_ATTR_GET_FCT( name ) \ -chtype field_ ## name (const FIELD * field)\ -{\ - return ( A_ATTRIBUTES & (Normalize_Field( field ) -> name) );\ -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int set_field_fore(FIELD *field, chtype attr) -| -| Description : Sets the foreground of the field used to display the -| field contents. -| -| Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid attributes -| E_SYSTEM_ERROR - system error -+--------------------------------------------------------------------------*/ -GEN_FIELD_ATTR_SET_FCT( fore ) - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : chtype field_fore(const FIELD *) -| -| Description : Retrieve fields foreground attribute -| -| Return Values : The foreground attribute -+--------------------------------------------------------------------------*/ -GEN_FIELD_ATTR_GET_FCT( fore ) - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int set_field_back(FIELD *field, chtype attr) -| -| Description : Sets the background of the field used to display the -| fields extend. -| -| Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid attributes -| E_SYSTEM_ERROR - system error -+--------------------------------------------------------------------------*/ -GEN_FIELD_ATTR_SET_FCT( back ) - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : chtype field_back(const -| -| Description : Retrieve fields background attribute -| -| Return Values : The background attribute -+--------------------------------------------------------------------------*/ -GEN_FIELD_ATTR_GET_FCT( back ) - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int set_field_pad(FIELD *field, int ch) -| -| Description : Set the pad character used to fill the field. This must -| be a printable character. -| -| Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid field pointer or pad character -| E_SYSTEM_ERROR - system error -+--------------------------------------------------------------------------*/ -int set_field_pad(FIELD * field, int ch) -{ - int res = E_BAD_ARGUMENT; - - Normalize_Field( field ); - if (isprint((unsigned char)ch)) - { - if (field->pad != ch) - { - field->pad = ch; - res = Synchronize_Attributes( field ); - } - else - res = E_OK; - } - RETURN(res); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int field_pad(const FIELD *field) -| -| Description : Retrieve the fields pad character. -| -| Return Values : The pad character. -+--------------------------------------------------------------------------*/ -int field_pad(const FIELD * field) -{ - return Normalize_Field( field )->pad; -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int set_field_just(FIELD *field, int just) -| -| Description : Set the fields type of justification. -| -| Return Values : E_OK - success -| E_BAD_ARGUMENT - one of the arguments was incorrect -| E_SYSTEM_ERROR - system error -+--------------------------------------------------------------------------*/ -int 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) ) - { - Normalize_Field( field ); - if (field->just != just) - { - field->just = just; - res = Synchronize_Attributes( field ); - } - else - res = E_OK; - } - RETURN(res); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int field_just( const FIELD *field ) -| -| Description : Retrieve the fields type of justification -| -| Return Values : The justification type. -+--------------------------------------------------------------------------*/ -int field_just(const FIELD * field) -{ - return Normalize_Field( field )->just; -} /* frm_driver.c ends here */ diff --git a/form/frm_hook.c b/form/frm_hook.c index 60c9993d..e7cfa607 100644 --- a/form/frm_hook.c +++ b/form/frm_hook.c @@ -1,28 +1,38 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses form library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: frm_hook.c,v 1.5 1997/05/01 16:47:54 juergen Exp $") +MODULE_ID("$Id: frm_hook.c,v 1.6 1998/02/11 12:13:43 tom Exp $") /* "Template" macro to generate function to set application specific hook */ #define GEN_HOOK_SET_FUNCTION( typ, name ) \ diff --git a/form/frm_opts.c b/form/frm_opts.c index 0adb88f5..f534d4d5 100644 --- a/form/frm_opts.c +++ b/form/frm_opts.c @@ -1,28 +1,38 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses form library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: frm_opts.c,v 1.3 1997/05/01 16:47:54 juergen Exp $") +MODULE_ID("$Id: frm_opts.c,v 1.4 1998/02/11 12:13:43 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/frm_page.c b/form/frm_page.c new file mode 100644 index 00000000..a91460c0 --- /dev/null +++ b/form/frm_page.c @@ -0,0 +1,100 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_page.c,v 1.3 1998/02/11 12:13:44 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_form_page(FORM * form,int page) +| +| Description : Set the page number of the form. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid form pointer or page number +| E_BAD_STATE - called from a hook routine +| E_INVALID_FIELD - current field can't be left +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int set_form_page(FORM * form, int page) +{ + int err = E_OK; + + 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) + err = E_BAD_STATE; + else + { + if (form->curpage != page) + { + 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); + _nc_Refresh_Current_Field(form); + } + } + } + } + RETURN(err); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int form_page(const FORM * form) +| +| Description : Return the current page of the form. +| +| Return Values : >= 0 : current page number +| -1 : invalid form pointer ++--------------------------------------------------------------------------*/ +int form_page(const FORM * form) +{ + return Normalize_Form(form)->curpage; +} + +/* frm_page.c ends here */ diff --git a/form/frm_post.c b/form/frm_post.c new file mode 100644 index 00000000..5f07ebb8 --- /dev/null +++ b/form/frm_post.c @@ -0,0 +1,117 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ +#include "form.priv.h" + +MODULE_ID("$Id: frm_post.c,v 1.2 1998/02/11 12:13:44 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int post_form(FORM * form) +| +| Description : Writes the form into its associated subwindow. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid form pointer +| E_POSTED - form already posted +| E_NOT_CONNECTED - no fields connected to form +| E_NO_ROOM - form doesn't fit into subwindow +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int post_form(FORM * form) +{ + WINDOW *formwin; + int err; + int page; + + if (!form) + RETURN(E_BAD_ARGUMENT); + + 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))) + 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) + RETURN(err); + + form->status |= _POSTED; + + Call_Hook(form,forminit); + Call_Hook(form,fieldinit); + + _nc_Refresh_Current_Field(form); + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int unpost_form(FORM * form) +| +| Description : Erase form from its associated subwindow. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid form pointer +| E_NOT_POSTED - form isn't posted +| E_BAD_STATE - called from a hook routine ++--------------------------------------------------------------------------*/ +int unpost_form(FORM * form) +{ + if (!form) + RETURN(E_BAD_ARGUMENT); + + if (!(form->status & _POSTED)) + RETURN(E_NOT_POSTED); + + if (form->status & _IN_DRIVER) + RETURN(E_BAD_STATE); + + Call_Hook(form,fieldterm); + Call_Hook(form,formterm); + + werase(Get_Form_Window(form)); + delwin(form->w); + form->w = (WINDOW *)0; + form->status &= ~_POSTED; + RETURN(E_OK); +} + +/* frm_post.c ends here */ diff --git a/form/frm_req_name.c b/form/frm_req_name.c index b878147e..ffd722cc 100644 --- a/form/frm_req_name.c +++ b/form/frm_req_name.c @@ -1,24 +1,34 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses form library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** * Module form_request_name * @@ -27,7 +37,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_req_name.c,v 1.4 1997/05/01 16:47:54 juergen Exp $") +MODULE_ID("$Id: frm_req_name.c,v 1.5 1998/02/11 12:13:43 tom Exp $") static const char *request_names[ MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1 ] = { "NEXT_PAGE" , diff --git a/form/frm_scale.c b/form/frm_scale.c new file mode 100644 index 00000000..3a52bfe5 --- /dev/null +++ b/form/frm_scale.c @@ -0,0 +1,63 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_scale.c,v 1.2 1998/02/11 12:13:44 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int scale_form( const FORM *form, int *rows, int *cols ) +| +| Description : Retrieve size of form +| +| Return Values : E_OK - no error +| E_BAD_ARGUMENT - invalid form pointer +| E_NOT_CONNECTED - no fields connected to form ++--------------------------------------------------------------------------*/ +int scale_form(const FORM * form, int * rows, int * cols) +{ + if ( !form ) + RETURN(E_BAD_ARGUMENT); + + if ( !(form->field) ) + RETURN(E_NOT_CONNECTED); + + if (rows) + *rows = form->rows; + if (cols) + *cols = form->cols; + + RETURN(E_OK); +} + +/* frm_scale.c ends here */ diff --git a/form/frm_sub.c b/form/frm_sub.c new file mode 100644 index 00000000..a5912ac3 --- /dev/null +++ b/form/frm_sub.c @@ -0,0 +1,69 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_sub.c,v 1.2 1998/02/11 12:13:44 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_form_sub(FORM *form, WINDOW *win) +| +| Description : Set the subwindow of the form to win. +| +| Return Values : E_OK - success +| E_POSTED - form is posted ++--------------------------------------------------------------------------*/ +int set_form_sub(FORM * form, WINDOW * win) +{ + if (form && (form->status & _POSTED)) + RETURN(E_POSTED); + + Normalize_Form( form )->sub = win; + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : WINDOW *form_sub(const FORM *) +| +| Description : Retrieve the window of the form. +| +| Return Values : The pointer to the Subwindow. ++--------------------------------------------------------------------------*/ +WINDOW *form_sub(const FORM * form) +{ + const FORM* f = Normalize_Form( form ); + return Get_Form_Window(f); +} + +/* frm_sub.c ends here */ diff --git a/form/frm_user.c b/form/frm_user.c index 46101ed9..46989663 100644 --- a/form/frm_user.c +++ b/form/frm_user.c @@ -1,28 +1,38 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses form library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: frm_user.c,v 1.4 1997/05/01 16:47:54 juergen Exp $") +MODULE_ID("$Id: frm_user.c,v 1.6 1998/02/11 12:13:43 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -33,7 +43,7 @@ MODULE_ID("$Id: frm_user.c,v 1.4 1997/05/01 16:47:54 juergen Exp $") | | Return Values : E_OK - on success +--------------------------------------------------------------------------*/ -int set_form_userptr(FORM * form, const void *usrptr) +int set_form_userptr(FORM * form, void *usrptr) { Normalize_Form(form)->usrptr = usrptr; RETURN(E_OK); @@ -49,7 +59,7 @@ int set_form_userptr(FORM * form, const void *usrptr) | Return Values : Value of pointer. If no such pointer has been set, | NULL is returned +--------------------------------------------------------------------------*/ -const void *form_userptr(const FORM * form) +void *form_userptr(const FORM * form) { return Normalize_Form(form)->usrptr; } diff --git a/form/frm_win.c b/form/frm_win.c index 2d96868a..879c6367 100644 --- a/form/frm_win.c +++ b/form/frm_win.c @@ -1,28 +1,38 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses form library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: frm_win.c,v 1.4 1997/05/01 16:47:54 juergen Exp $") +MODULE_ID("$Id: frm_win.c,v 1.6 1998/02/11 12:13:43 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -56,36 +66,5 @@ WINDOW *form_win(const FORM * form) return (f->win ? f->win : stdscr); } -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : int set_form_sub(FORM *form, WINDOW *win) -| -| Description : Set the subwindow of the form to win. -| -| Return Values : E_OK - success -| E_POSTED - form is posted -+--------------------------------------------------------------------------*/ -int set_form_sub(FORM * form, WINDOW * win) -{ - if (form && (form->status & _POSTED)) - RETURN(E_POSTED); - - Normalize_Form( form )->sub = win; - RETURN(E_OK); -} - -/*--------------------------------------------------------------------------- -| Facility : libnform -| Function : WINDOW *form_sub(const FORM *) -| -| Description : Retrieve the window of the form. -| -| Return Values : The pointer to the Subwindow. -+--------------------------------------------------------------------------*/ -WINDOW *form_sub(const FORM * form) -{ - const FORM* f = Normalize_Form( form ); - return Get_Form_Window(f); -} - /* frm_win.c ends here */ + diff --git a/form/fty_alnum.c b/form/fty_alnum.c index 5f358042..0128c150 100644 --- a/form/fty_alnum.c +++ b/form/fty_alnum.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_alnum.c,v 1.6 1997/02/15 17:31:21 tom Exp $") +MODULE_ID("$Id: fty_alnum.c,v 1.7 1997/10/18 19:33:55 tom Exp $") typedef struct { int width; @@ -48,12 +48,12 @@ static void *Make_AlphaNumeric_Type(va_list * ap) static void *Copy_AlphaNumeric_Type(const void *argp) { const alnumARG *ap = (const alnumARG *)argp; - alnumARG *new = (alnumARG *)malloc(sizeof(alnumARG)); + alnumARG *result = (alnumARG *)malloc(sizeof(alnumARG)); - if (new) - *new = *ap; + if (result) + *result = *ap; - return ((void *)new); + return ((void *)result); } /*--------------------------------------------------------------------------- diff --git a/form/fty_alpha.c b/form/fty_alpha.c index 4f24c319..74af2a9a 100644 --- a/form/fty_alpha.c +++ b/form/fty_alpha.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_alpha.c,v 1.6 1997/02/15 17:31:08 tom Exp $") +MODULE_ID("$Id: fty_alpha.c,v 1.7 1997/10/18 19:33:38 tom Exp $") typedef struct { int width; @@ -48,13 +48,13 @@ static void *Make_Alpha_Type(va_list * ap) static void *Copy_Alpha_Type(const void * argp) { const alphaARG *ap = (const alphaARG *)argp; - alphaARG *new = (alphaARG *)malloc(sizeof(alphaARG)); + alphaARG *result = (alphaARG *)malloc(sizeof(alphaARG)); - if (new) + if (result) { - *new = *ap; + *result = *ap; } - return ((void *)new); + return ((void *)result); } /*--------------------------------------------------------------------------- diff --git a/form/fty_enum.c b/form/fty_enum.c index 0e128083..16695cd2 100644 --- a/form/fty_enum.c +++ b/form/fty_enum.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_enum.c,v 1.5 1997/02/15 17:33:59 tom Exp $") +MODULE_ID("$Id: fty_enum.c,v 1.8 1997/10/18 19:33:20 tom Exp $") typedef struct { char **kwds; @@ -63,15 +63,15 @@ static void *Make_Enum_Type(va_list * ap) static void *Copy_Enum_Type(const void * argp) { const enumARG *ap = (const enumARG *)argp; - enumARG *new = (enumARG *)0; + enumARG *result = (enumARG *)0; if (argp) { - new = (enumARG *)malloc(sizeof(enumARG)); - if (new) - *new = *ap; + result = (enumARG *)malloc(sizeof(enumARG)); + if (result) + *result = *ap; } - return (void *)new; + return (void *)result; } /*--------------------------------------------------------------------------- @@ -127,9 +127,8 @@ static int Compare(const unsigned char *s, const unsigned char *buf, } else { - while(toupper(*s)==toupper(*buf)) + while(toupper(*s++)==toupper(*buf)) { - s++; if (*buf++=='\0') return EXACT; } } @@ -170,7 +169,7 @@ static bool Check_Enum_Field(FIELD * field, const void * argp) { if ((res=Compare((unsigned char *)s,bp,ccase))!=NOMATCH) { - t=s; + p=t=s; /* t is at least a partial match */ if ((unique && res!=EXACT)) { while( (p = *kwds++) ) @@ -181,16 +180,19 @@ static bool Check_Enum_Field(FIELD * field, const void * argp) { t = p; break; - } - t = (char *)0; + } + else + t = (char *)0; } } - } + } if (t) { set_field_buffer(field,0,t); return TRUE; } + if (!p) + break; } } return FALSE; diff --git a/form/fty_int.c b/form/fty_int.c index e9850883..dc2eab3e 100644 --- a/form/fty_int.c +++ b/form/fty_int.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_int.c,v 1.7 1997/04/19 15:22:40 juergen Exp $") +MODULE_ID("$Id: fty_int.c,v 1.8 1997/10/18 19:32:50 tom Exp $") typedef struct { int precision; @@ -53,15 +53,15 @@ static void *Make_Integer_Type(va_list * ap) static void *Copy_Integer_Type(const void * argp) { const integerARG *ap = (const integerARG *)argp; - integerARG *new = (integerARG *)0; + integerARG *result = (integerARG *)0; if (argp) { - new = (integerARG *)malloc(sizeof(integerARG)); - if (new) - *new = *ap; + result = (integerARG *)malloc(sizeof(integerARG)); + if (result) + *result = *ap; } - return (void *)new; + return (void *)result; } /*--------------------------------------------------------------------------- diff --git a/form/fty_num.c b/form/fty_num.c index eb2d5869..0508e3c4 100644 --- a/form/fty_num.c +++ b/form/fty_num.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_num.c,v 1.9 1997/04/19 17:26:38 juergen Exp $") +MODULE_ID("$Id: fty_num.c,v 1.11 1997/10/18 19:32:58 tom Exp $") #if HAVE_LOCALE_H #include @@ -63,15 +63,15 @@ static void *Make_Numeric_Type(va_list * ap) static void *Copy_Numeric_Type(const void * argp) { const numericARG *ap = (const numericARG *)argp; - numericARG *new = (numericARG *)0; + numericARG *result = (numericARG *)0; if (argp) { - new = (numericARG *)malloc(sizeof(numericARG)); - if (new) - *new = *ap; + result = (numericARG *)malloc(sizeof(numericARG)); + if (result) + *result = *ap; } - return (void *)new; + return (void *)result; } /*--------------------------------------------------------------------------- @@ -169,7 +169,7 @@ static bool Check_Numeric_Character(int c, const void * argp) c == '+' || c == '-' || c == ( -#ifdef HAVE_LOCALE_H +#if HAVE_LOCALE_H (L && L->decimal_point) ? *(L->decimal_point) : #endif '.') diff --git a/form/fty_regex.c b/form/fty_regex.c index 3ad62e9f..d563d47e 100644 --- a/form/fty_regex.c +++ b/form/fty_regex.c @@ -13,9 +13,9 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_regex.c,v 1.9 1997/05/01 16:03:17 tom Exp $") +MODULE_ID("$Id: fty_regex.c,v 1.11 1997/10/18 19:32:35 tom Exp $") -#if HAVE_REGEX_H /* We prefer POSIX regex */ +#if HAVE_REGEX_H_FUNCS /* We prefer POSIX regex */ #include typedef struct @@ -24,7 +24,7 @@ typedef struct unsigned long *refCount; } RegExp_Arg; -#elif HAVE_REGEXP_H | HAVE_REGEXPR_H +#elif HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS #undef RETURN static int reg_errno; @@ -47,7 +47,7 @@ static char *RegEx_Error(int code) #define RETURN(c) return(c) #define ERROR(c) return RegEx_Error(c) -#if HAVE_REGEXP_H +#if HAVE_REGEXP_H_FUNCS #include #else #include @@ -75,7 +75,7 @@ typedef struct +--------------------------------------------------------------------------*/ static void *Make_RegularExpression_Type(va_list * ap) { -#if HAVE_REGEX_H +#if HAVE_REGEX_H_FUNCS char *rx = va_arg(*ap,char *); RegExp_Arg *preg; @@ -98,7 +98,7 @@ static void *Make_RegularExpression_Type(va_list * ap) } } return((void *)preg); -#elif HAVE_REGEXP_H | HAVE_REGEXPR_H +#elif HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS char *rx = va_arg(*ap,char *); RegExp_Arg *pArg; @@ -115,7 +115,7 @@ static void *Make_RegularExpression_Type(va_list * ap) char *buf = (char *)malloc(blen); if (buf) { -#if HAVE_REGEXP_H +#if HAVE_REGEXP_H_FUNCS char *last_pos = compile (rx, buf, &buf[blen], '\0'); #else char *last_pos = compile (rx, buf, &buf[blen], '\0'); @@ -162,16 +162,16 @@ static void *Make_RegularExpression_Type(va_list * ap) +--------------------------------------------------------------------------*/ static void *Copy_RegularExpression_Type(const void * argp) { -#if (HAVE_REGEX_H | HAVE_REGEXP_H | HAVE_REGEXPR_H) +#if (HAVE_REGEX_H_FUNCS | HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS) const RegExp_Arg *ap = (const RegExp_Arg *)argp; - const RegExp_Arg *new = (const RegExp_Arg *)0; + const RegExp_Arg *result = (const RegExp_Arg *)0; if (ap) { *(ap->refCount) += 1; - new = ap; + result = ap; } - return (void *)new; + return (void *)result; #else return 0; #endif @@ -187,19 +187,19 @@ static void *Copy_RegularExpression_Type(const void * argp) +--------------------------------------------------------------------------*/ static void Free_RegularExpression_Type(void * argp) { -#if HAVE_REGEX_H | HAVE_REGEXP_H | HAVE_REGEXPR_H +#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) { -#if HAVE_REGEX_H +#if HAVE_REGEX_H_FUNCS if (ap->pRegExp) { free(ap->refCount); regfree(ap->pRegExp); } -#elif HAVE_REGEXP_H | HAVE_REGEXPR_H +#elif HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS if (ap->compiled_expression) { free(ap->refCount); @@ -226,11 +226,11 @@ static void Free_RegularExpression_Type(void * argp) static bool Check_RegularExpression_Field(FIELD * field, const void * argp) { bool match = FALSE; -#if HAVE_REGEX_H +#if HAVE_REGEX_H_FUNCS 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); -#elif HAVE_REGEXP_H | HAVE_REGEXPR_H +#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); diff --git a/form/headers b/form/headers index 22a25341..f2267c87 100644 --- a/form/headers +++ b/form/headers @@ -1,20 +1,31 @@ -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +############################################################################## +# Copyright (c) 1998 Free 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 1996 +# $(srcdir)/form.h diff --git a/form/llib-lform b/form/llib-lform index 7090cc13..4fda1545 100644 --- a/form/llib-lform +++ b/form/llib-lform @@ -1,96 +1,379 @@ -/****************************************************************************** - * Copyright 1996 by Thomas E. Dickey * - * All Rights Reserved. * - * * - * Permission to use, copy, modify, and distribute this software and its * - * documentation for any purpose and without fee is hereby granted, provided * - * that the above copyright notice appear in all copies and that both that * - * copyright notice and this permission notice appear in supporting * - * documentation, and that the name of the above listed copyright holder(s) * - * not be used in advertising or publicity pertaining to distribution of the * - * software without specific, written prior permission. THE ABOVE LISTED * - * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * - * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - ******************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1996,1997 * + ****************************************************************************/ /* LINTLIBRARY */ -/* ./fty_regex.c */ +/* ./fld_arg.c */ #include "form.priv.h" -#include -typedef struct -{ - regex_t *pRegExp; - unsigned long refCount; -} RegExp_Arg; +#undef set_fieldtype_arg +int set_fieldtype_arg( + FIELDTYPE *typ, + void *(*const make_arg)( + va_list *p1), + void *(*const copy_arg)( + const void *p1), + void (*const free_arg)( + void *p1)) + { return(*(int *)0); } -#undef TYPE_REGEXP -FIELDTYPE *TYPE_REGEXP; +#undef field_arg +void *field_arg( + const FIELD *field) + { return(*(void **)0); } -/* ./fty_num.c */ +/* ./fld_attr.c */ -#include +#undef set_field_fore +int set_field_fore( + FIELD *field, + chtype attr) + { return(*(int *)0); } -typedef struct { - int precision; - double low; - double high; - struct lconv* L; -} numericARG; +#undef field_fore +chtype field_fore( + const FIELD *field) + { return(*(chtype *)0); } -#undef TYPE_NUMERIC -FIELDTYPE *TYPE_NUMERIC; +#undef set_field_back +int set_field_back( + FIELD *field, + chtype attr) + { return(*(int *)0); } -/* ./fty_int.c */ +#undef field_back +chtype field_back( + const FIELD *field) + { return(*(chtype *)0); } -typedef struct { - int precision; - int low; - int high; -} integerARG; +/* ./fld_current.c */ -#undef TYPE_INTEGER -FIELDTYPE *TYPE_INTEGER; +#undef set_current_field +int set_current_field( + FORM *form, + FIELD *field) + { return(*(int *)0); } -/* ./fty_enum.c */ +#undef current_field +FIELD *current_field( + const FORM *form) + { return(*(FIELD **)0); } -typedef struct { - char **kwds; - int count; - bool checkcase; - bool checkunique; -} enumARG; +#undef field_index +int field_index( + const FIELD *field) + { return(*(int *)0); } -#undef TYPE_ENUM -FIELDTYPE *TYPE_ENUM; +/* ./fld_def.c */ -/* ./fty_alpha.c */ +#undef _nc_Default_Field +FIELD *_nc_Default_Field; -typedef struct { - int width; -} alphaARG; +#undef _nc_Make_Argument +TypeArgument *_nc_Make_Argument( + const FIELDTYPE *typ, + va_list *ap, + int *err) + { return(*(TypeArgument **)0); } + +#undef _nc_Copy_Argument +TypeArgument *_nc_Copy_Argument( + const FIELDTYPE *typ, + const TypeArgument *argp, + int *err) + { return(*(TypeArgument **)0); } + +#undef _nc_Free_Argument +void _nc_Free_Argument( + const FIELDTYPE *typ, + TypeArgument *argp) + { /* void */ } -#undef TYPE_ALPHA -FIELDTYPE *TYPE_ALPHA; +#undef _nc_Copy_Type +bool _nc_Copy_Type( + FIELD *dst, + FIELD const *src) + { return(*(bool *)0); } -/* ./fty_alnum.c */ +#undef _nc_Free_Type +void _nc_Free_Type( + FIELD *field) + { /* void */ } -typedef struct { - int width; -} alnumARG; +#undef new_field +FIELD *new_field( + int rows, + int cols, + int frow, + int fcol, + int nrow, + int nbuf) + { return(*(FIELD **)0); } -#undef TYPE_ALNUM -FIELDTYPE *TYPE_ALNUM; +#undef free_field +int free_field( + FIELD *field) + { return(*(int *)0); } -/* ./fty_ipv4.c */ -#undef TYPE_IPV4 -FIELDTYPE *TYPE_IPV4; +/* ./fld_dup.c */ + +#undef dup_field +FIELD *dup_field( + FIELD *field, + int frow, + int fcol) + { return(*(FIELD **)0); } + +/* ./fld_ftchoice.c */ + +#undef set_fieldtype_choice +int set_fieldtype_choice( + FIELDTYPE *typ, + bool (*const next_choice)( + FIELD *p1, + const void *p2), + bool (*const prev_choice)( + FIELD *p1, + const void *p2)) + { return(*(int *)0); } + +/* ./fld_ftlink.c */ + +#undef link_fieldtype +FIELDTYPE *link_fieldtype( + FIELDTYPE *type1, + FIELDTYPE *type2) + { return(*(FIELDTYPE **)0); } + +/* ./fld_info.c */ + +#undef field_info +int field_info( + const FIELD *field, + int *rows, + int *cols, + int *frow, + int *fcol, + int *nrow, + int *nbuf) + { return(*(int *)0); } + +#undef dynamic_field_info +int dynamic_field_info( + const FIELD *field, + int *drows, + int *dcols, + int *maxgrow) + { return(*(int *)0); } + +/* ./fld_just.c */ + +#undef set_field_just +int set_field_just( + FIELD *field, + int just) + { return(*(int *)0); } + +#undef field_just +int field_just( + const FIELD *field) + { return(*(int *)0); } + +/* ./fld_link.c */ + +#undef link_field +FIELD *link_field( + FIELD *field, + int frow, + int fcol) + { return(*(FIELD **)0); } + +/* ./fld_max.c */ + +#undef set_max_field +int set_max_field( + FIELD *field, + int maxgrow) + { return(*(int *)0); } + +/* ./fld_move.c */ + +#undef move_field +int move_field( + FIELD *field, + int frow, + int fcol) + { return(*(int *)0); } + +/* ./fld_newftyp.c */ + +#undef _nc_Default_FieldType +const FIELDTYPE *_nc_Default_FieldType = {0}; + +#undef new_fieldtype +FIELDTYPE *new_fieldtype( + bool (*const field_check)( + FIELD *p1, + const void *p2), + bool (*const char_check)( + int p1, + const void *p2)) + { return(*(FIELDTYPE **)0); } + +#undef free_fieldtype +int free_fieldtype( + FIELDTYPE *typ) + { return(*(int *)0); } + +/* ./fld_opts.c */ + +#undef set_field_opts +int set_field_opts( + FIELD *field, + Field_Options opts) + { return(*(int *)0); } + +#undef field_opts +Field_Options field_opts( + const FIELD *field) + { return(*(Field_Options *)0); } + +#undef field_opts_on +int field_opts_on( + FIELD *field, + Field_Options opts) + { return(*(int *)0); } + +#undef field_opts_off +int field_opts_off( + FIELD *field, + Field_Options opts) + { return(*(int *)0); } + +/* ./fld_pad.c */ + +#undef set_field_pad +int set_field_pad( + FIELD *field, + int ch) + { return(*(int *)0); } + +#undef field_pad +int field_pad( + const FIELD *field) + { return(*(int *)0); } + +/* ./fld_page.c */ + +#undef set_new_page +int set_new_page( + FIELD *field, + bool new_page_flag) + { return(*(int *)0); } + +#undef new_page +bool new_page( + const FIELD *field) + { return(*(bool *)0); } + +/* ./fld_stat.c */ + +#undef set_field_status +int set_field_status( + FIELD *field, + bool status) + { return(*(int *)0); } + +#undef field_status +bool field_status( + const FIELD *field) + { return(*(bool *)0); } + +/* ./fld_type.c */ + +#undef set_field_type +int set_field_type( + FIELD *field, + FIELDTYPE *type, + ...) + { return(*(int *)0); } + +#undef field_type +FIELDTYPE *field_type( + const FIELD *field) + { return(*(FIELDTYPE **)0); } + +/* ./fld_user.c */ + +#undef set_field_userptr +int set_field_userptr( + FIELD *field, + void *usrptr) + { return(*(int *)0); } + +#undef field_userptr +void *field_userptr( + const FIELD *field) + { return(*(void **)0); } + +/* ./frm_adabind.c */ + +#undef _nc_ada_normalize_field_opts +void _nc_ada_normalize_field_opts( + int *opt) + { /* void */ } + +#undef _nc_ada_normalize_form_opts +void _nc_ada_normalize_form_opts( + int *opt) + { /* void */ } + +#undef _nc_ada_getvarg +void *_nc_ada_getvarg( + va_list *ap) + { return(*(void **)0); } + +#undef _nc_get_field +FIELD *_nc_get_field( + const FORM *frm, + int idx) + { return(*(FIELD **)0); } + +/* ./frm_cursor.c */ + +#undef pos_form_cursor +int pos_form_cursor( + FORM *form) + { return(*(int *)0); } /* ./frm_data.c */ @@ -104,68 +387,107 @@ bool data_ahead( const FORM *form) { return(*(bool *)0); } -/* ./frm_win.c */ +/* ./frm_def.c */ + +#undef _nc_Default_Form +FORM *_nc_Default_Form; + +#undef new_form +FORM *new_form( + FIELD **fields) + { return(*(FORM **)0); } + +#undef free_form +int free_form( + FORM *form) + { return(*(int *)0); } + +#undef set_form_fields +int set_form_fields( + FORM *form, + FIELD **fields) + { return(*(int *)0); } + +#undef form_fields +FIELD **form_fields( + const FORM *form) + { return(*(FIELD ***)0); } + +#undef field_count +int field_count( + const FORM *form) + { return(*(int *)0); } + +/* ./frm_driver.c */ -#undef set_form_win -int set_form_win( - FORM *form, - WINDOW *win) +#undef _nc_Position_Form_Cursor +int _nc_Position_Form_Cursor( + FORM *form) { return(*(int *)0); } -#undef form_win -WINDOW *form_win( - const FORM *form) - { return(*(WINDOW **)0); } - -#undef set_form_sub -int set_form_sub( - FORM *form, - WINDOW *win) +#undef _nc_Refresh_Current_Field +int _nc_Refresh_Current_Field( + FORM *form) { return(*(int *)0); } -#undef form_sub -WINDOW *form_sub( - const FORM *form) - { return(*(WINDOW **)0); } +#undef _nc_Synchronize_Attributes +int _nc_Synchronize_Attributes( + FIELD *field) + { return(*(int *)0); } -/* ./frm_user.c */ +#undef _nc_Synchronize_Options +int _nc_Synchronize_Options( + FIELD *field, + Field_Options newopts) + { return(*(int *)0); } -#undef set_form_userptr -int set_form_userptr( +#undef _nc_Set_Current_Field +int _nc_Set_Current_Field( FORM *form, - const void *usrptr) + FIELD *newfield) { return(*(int *)0); } -#undef form_userptr -const void *form_userptr( - const FORM *form) - { return(*(const void **)0); } +#undef _nc_Internal_Validation +bool _nc_Internal_Validation( + FORM *form) + { return(*(bool *)0); } -/* ./frm_opts.c */ +#undef _nc_First_Active_Field +FIELD *_nc_First_Active_Field( + FORM *form) + { return(*(FIELD **)0); } -#undef set_form_opts -int set_form_opts( +#undef _nc_Set_Form_Page +int _nc_Set_Form_Page( FORM *form, - Form_Options opts) + int page, + FIELD *field) { return(*(int *)0); } -#undef form_opts -Form_Options form_opts( - const FORM *form) - { return(*(Form_Options *)0); } +typedef struct { + int keycode; + int (*cmd)(FORM *); +} Binding_Info; -#undef form_opts_on -int form_opts_on( +#undef form_driver +int form_driver( FORM *form, - Form_Options opts) + int c) { return(*(int *)0); } -#undef form_opts_off -int form_opts_off( - FORM *form, - Form_Options opts) +#undef set_field_buffer +int set_field_buffer( + FIELD *field, + int buffer, + const char *value) { return(*(int *)0); } +#undef field_buffer +char *field_buffer( + const FIELD *field, + int buffer) + { return(*(char **)0); } + /* ./frm_hook.c */ #undef set_field_init @@ -201,245 +523,57 @@ Form_Hook form_init( const FORM *form) { return(*(Form_Hook *)0); } -#undef set_form_term -int set_form_term( - FORM *form, - Form_Hook func) - { return(*(int *)0); } - -#undef form_term -Form_Hook form_term( - const FORM *form) - { return(*(Form_Hook *)0); } - -/* ./frm_req_name.c */ - -#undef form_request_name -const char *form_request_name( - int request) - { return(*(const char **)0); } - -#undef form_request_by_name -int form_request_by_name( - const char *str) - { return(*(int *)0); } - -/* ./fld_user.c */ - -#undef set_field_userptr -int set_field_userptr( - FIELD *field, - const void *usrptr) - { return(*(int *)0); } - -#undef field_userptr -const void *field_userptr( - const FIELD *field) - { return(*(const void **)0); } - -/* ./fld_type.c */ - -#undef new_fieldtype -FIELDTYPE *new_fieldtype( - bool (*const field_check)( - FIELD *p1, - const void *p2), - bool (*const char_check)( - int p1, - const void *p2)) - { return(*(FIELDTYPE **)0); } - -#undef link_fieldtype -FIELDTYPE *link_fieldtype( - FIELDTYPE *type1, - FIELDTYPE *type2) - { return(*(FIELDTYPE **)0); } - -#undef free_fieldtype -int free_fieldtype( - FIELDTYPE *typ) - { return(*(int *)0); } - -#undef set_fieldtype_arg -int set_fieldtype_arg( - FIELDTYPE *typ, - void *(*const make_arg)( - va_list *p1), - void *(*const copy_arg)( - const void *p1), - void (*const free_arg)( - void *p1)) - { return(*(int *)0); } - -#undef set_fieldtype_choice -int set_fieldtype_choice( - FIELDTYPE *typ, - bool (*const next_choice)( - FIELD *p1, - const void *p2), - bool (*const prev_choice)( - FIELD *p1, - const void *p2)) - { return(*(int *)0); } - -/* ./fld_stat.c */ - -#undef set_field_status -int set_field_status( - FIELD *field, - bool status) - { return(*(int *)0); } - -#undef field_status -bool field_status( - const FIELD *field) - { return(*(bool *)0); } - -/* ./fld_def.c */ - -#undef _nc_Default_Field -FIELD *_nc_Default_Field; - -#undef new_field -FIELD *new_field( - int rows, - int cols, - int frow, - int fcol, - int nrow, - int nbuf) - { return(*(FIELD **)0); } - -#undef dup_field -FIELD *dup_field( - FIELD *field, - int frow, - int fcol) - { return(*(FIELD **)0); } - -#undef link_field -FIELD *link_field( - FIELD *field, - int frow, - int fcol) - { return(*(FIELD **)0); } - -#undef free_field -int free_field( - FIELD *field) - { return(*(int *)0); } - -#undef field_info -int field_info( - const FIELD *field, - int *rows, - int *cols, - int *frow, - int *fcol, - int *nrow, - int *nbuf) - { return(*(int *)0); } - -#undef move_field -int move_field( - FIELD *field, - int frow, - int fcol) - { return(*(int *)0); } - -#undef set_field_type -int set_field_type( - FIELD *field, - FIELDTYPE *type, - ...) - { return(*(int *)0); } - -#undef field_type -FIELDTYPE *field_type( - const FIELD *field) - { return(*(FIELDTYPE **)0); } - -#undef field_arg -void *field_arg( - const FIELD *field) - { return(*(void **)0); } - -#undef set_max_field -int set_max_field( - FIELD *field, - int maxgrow) - { return(*(int *)0); } - -#undef dynamic_field_info -int dynamic_field_info( - const FIELD *field, - int *drows, - int *dcols, - int *maxgrow) - { return(*(int *)0); } - -#undef set_new_page -int set_new_page( - FIELD *field, - bool new_page_flag) - { return(*(int *)0); } - -#undef new_page -bool new_page( - const FIELD *field) - { return(*(bool *)0); } - -/* ./frm_def.c */ - -#undef _nc_Default_Form -FORM *_nc_Default_Form; +#undef set_form_term +int set_form_term( + FORM *form, + Form_Hook func) + { return(*(int *)0); } -#undef new_form -FORM *new_form( - FIELD **fields) - { return(*(FORM **)0); } +#undef form_term +Form_Hook form_term( + const FORM *form) + { return(*(Form_Hook *)0); } -#undef free_form -int free_form( - FORM *form) - { return(*(int *)0); } +/* ./frm_opts.c */ -#undef set_form_fields -int set_form_fields( +#undef set_form_opts +int set_form_opts( FORM *form, - FIELD **fields) + Form_Options opts) { return(*(int *)0); } -#undef form_fields -FIELD **form_fields( +#undef form_opts +Form_Options form_opts( const FORM *form) - { return(*(FIELD ***)0); } + { return(*(Form_Options *)0); } -#undef field_count -int field_count( - const FORM *form) +#undef form_opts_on +int form_opts_on( + FORM *form, + Form_Options opts) { return(*(int *)0); } -#undef scale_form -int scale_form( - const FORM *form, - int *rows, - int *cols) +#undef form_opts_off +int form_opts_off( + FORM *form, + Form_Options opts) { return(*(int *)0); } -/* ./frm_driver.c */ - -typedef struct { - int keycode; - int (*cmd)(FORM *); -} Binding_Info; +/* ./frm_page.c */ -#undef form_driver -int form_driver( +#undef set_form_page +int set_form_page( FORM *form, - int c) + int page) + { return(*(int *)0); } + +#undef form_page +int form_page( + const FORM *form) { return(*(int *)0); } +/* ./frm_post.c */ + #undef post_form int post_form( FORM *form) @@ -450,131 +584,134 @@ int unpost_form( FORM *form) { return(*(int *)0); } -#undef pos_form_cursor -int pos_form_cursor( - FORM *form) +/* ./frm_req_name.c */ + +#undef form_request_name +const char *form_request_name( + int request) + { return(*(const char **)0); } + +#undef form_request_by_name +int form_request_by_name( + const char *str) { return(*(int *)0); } -#undef set_current_field -int set_current_field( +/* ./frm_scale.c */ + +#undef scale_form +int scale_form( + const FORM *form, + int *rows, + int *cols) + { return(*(int *)0); } + +/* ./frm_sub.c */ + +#undef set_form_sub +int set_form_sub( FORM *form, - FIELD *field) + WINDOW *win) { return(*(int *)0); } -#undef current_field -FIELD *current_field( +#undef form_sub +WINDOW *form_sub( const FORM *form) - { return(*(FIELD **)0); } + { return(*(WINDOW **)0); } -#undef field_index -int field_index( - const FIELD *field) - { return(*(int *)0); } +/* ./frm_user.c */ -#undef set_form_page -int set_form_page( +#undef set_form_userptr +int set_form_userptr( FORM *form, - int page) + void *usrptr) { return(*(int *)0); } -#undef form_page -int form_page( +#undef form_userptr +void *form_userptr( const FORM *form) - { return(*(int *)0); } + { return(*(void **)0); } -#undef set_field_buffer -int set_field_buffer( - FIELD *field, - int buffer, - const char *value) +/* ./frm_win.c */ + +#undef set_form_win +int set_form_win( + FORM *form, + WINDOW *win) { return(*(int *)0); } -#undef field_buffer -char *field_buffer( - const FIELD *field, - int buffer) - { return(*(char **)0); } +#undef form_win +WINDOW *form_win( + const FORM *form) + { return(*(WINDOW **)0); } -#undef set_field_opts -int set_field_opts( - FIELD *field, - Field_Options opts) - { return(*(int *)0); } +/* ./fty_alnum.c */ -#undef field_opts -Field_Options field_opts( - const FIELD *field) - { return(*(Field_Options *)0); } +typedef struct { + int width; +} alnumARG; -#undef field_opts_on -int field_opts_on( - FIELD *field, - Field_Options opts) - { return(*(int *)0); } +#undef TYPE_ALNUM +FIELDTYPE *TYPE_ALNUM; -#undef field_opts_off -int field_opts_off( - FIELD *field, - Field_Options opts) - { return(*(int *)0); } +/* ./fty_alpha.c */ -#undef set_field_fore -int set_field_fore( - FIELD *field, - chtype attr) - { return(*(int *)0); } +typedef struct { + int width; +} alphaARG; -#undef field_fore -chtype field_fore( - const FIELD *field) - { return(*(chtype *)0); } +#undef TYPE_ALPHA +FIELDTYPE *TYPE_ALPHA; -#undef set_field_back -int set_field_back( - FIELD *field, - chtype attr) - { return(*(int *)0); } +/* ./fty_enum.c */ -#undef field_back -chtype field_back( - const FIELD *field) - { return(*(chtype *)0); } +typedef struct { + char **kwds; + int count; + bool checkcase; + bool checkunique; +} enumARG; -#undef set_field_pad -int set_field_pad( - FIELD *field, - int ch) - { return(*(int *)0); } +#undef TYPE_ENUM +FIELDTYPE *TYPE_ENUM; -#undef field_pad -int field_pad( - const FIELD *field) - { return(*(int *)0); } +/* ./fty_int.c */ -#undef set_field_just -int set_field_just( - FIELD *field, - int just) - { return(*(int *)0); } +typedef struct { + int precision; + long low; + long high; +} integerARG; -#undef field_just -int field_just( - const FIELD *field) - { return(*(int *)0); } +#undef TYPE_INTEGER +FIELDTYPE *TYPE_INTEGER; -/* ./frm_adabind.c */ +/* ./fty_ipv4.c */ +#undef TYPE_IPV4 +FIELDTYPE *TYPE_IPV4; -#undef _nc_ada_normalize_field_opts -void _nc_ada_normalize_field_opts( - int *opt) - { /* void */ } +/* ./fty_num.c */ -#undef _nc_ada_normalize_form_opts -void _nc_ada_normalize_form_opts( - int *opt) - { /* void */ } +#include -#undef _nc_ada_getvarg -void *_nc_ada_getvarg( - va_list *ap) - { return(*(void **)0); } +typedef struct { + int precision; + double low; + double high; + struct lconv* L; +} numericARG; + +#undef TYPE_NUMERIC +FIELDTYPE *TYPE_NUMERIC; + +/* ./fty_regex.c */ + +#include + +typedef struct +{ + regex_t *pRegExp; + unsigned long *refCount; +} RegExp_Arg; + +#undef TYPE_REGEXP +FIELDTYPE *TYPE_REGEXP; diff --git a/form/modules b/form/modules index de5f38cf..2beecb24 100644 --- a/form/modules +++ b/form/modules @@ -1,40 +1,74 @@ -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: modules,v 1.12 1998/02/11 12:13:44 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# + +@ base # Library objects -fty_regex lib $(srcdir) $(FORM_PRIV_H) -fty_num lib $(srcdir) $(FORM_PRIV_H) -fty_int lib $(srcdir) $(FORM_PRIV_H) -fty_enum lib $(srcdir) $(FORM_PRIV_H) -fty_alpha lib $(srcdir) $(FORM_PRIV_H) -fty_alnum lib $(srcdir) $(FORM_PRIV_H) -fty_ipv4 lib $(srcdir) $(FORM_PRIV_H) -frm_data lib $(srcdir) $(FORM_PRIV_H) -frm_win lib $(srcdir) $(FORM_PRIV_H) -frm_user lib $(srcdir) $(FORM_PRIV_H) -frm_opts lib $(srcdir) $(FORM_PRIV_H) -frm_hook lib $(srcdir) $(FORM_PRIV_H) -frm_req_name lib $(srcdir) $(FORM_PRIV_H) -fld_user lib $(srcdir) $(FORM_PRIV_H) -fld_type lib $(srcdir) $(FORM_PRIV_H) -fld_stat 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) fld_def lib $(srcdir) $(FORM_PRIV_H) +fld_dup lib $(srcdir) $(FORM_PRIV_H) +fld_ftchoice lib $(srcdir) $(FORM_PRIV_H) +fld_ftlink lib $(srcdir) $(FORM_PRIV_H) +fld_info lib $(srcdir) $(FORM_PRIV_H) +fld_just lib $(srcdir) $(FORM_PRIV_H) +fld_link lib $(srcdir) $(FORM_PRIV_H) +fld_max lib $(srcdir) $(FORM_PRIV_H) +fld_move lib $(srcdir) $(FORM_PRIV_H) +fld_newftyp lib $(srcdir) $(FORM_PRIV_H) +fld_opts lib $(srcdir) $(FORM_PRIV_H) +fld_pad lib $(srcdir) $(FORM_PRIV_H) +fld_page lib $(srcdir) $(FORM_PRIV_H) +fld_stat lib $(srcdir) $(FORM_PRIV_H) +fld_type lib $(srcdir) $(FORM_PRIV_H) +fld_user lib $(srcdir) $(FORM_PRIV_H) +frm_adabind lib $(srcdir) $(FORM_PRIV_H) +frm_cursor lib $(srcdir) $(FORM_PRIV_H) +frm_data lib $(srcdir) $(FORM_PRIV_H) frm_def lib $(srcdir) $(FORM_PRIV_H) frm_driver lib $(srcdir) $(FORM_PRIV_H) -frm_adabind lib $(srcdir) $(FORM_PRIV_H) +frm_hook lib $(srcdir) $(FORM_PRIV_H) +frm_opts lib $(srcdir) $(FORM_PRIV_H) +frm_page lib $(srcdir) $(FORM_PRIV_H) +frm_post lib $(srcdir) $(FORM_PRIV_H) +frm_req_name lib $(srcdir) $(FORM_PRIV_H) +frm_scale lib $(srcdir) $(FORM_PRIV_H) +frm_sub lib $(srcdir) $(FORM_PRIV_H) +frm_user lib $(srcdir) $(FORM_PRIV_H) +frm_win lib $(srcdir) $(FORM_PRIV_H) +fty_alnum lib $(srcdir) $(FORM_PRIV_H) +fty_alpha lib $(srcdir) $(FORM_PRIV_H) +fty_enum lib $(srcdir) $(FORM_PRIV_H) +fty_int lib $(srcdir) $(FORM_PRIV_H) +fty_ipv4 lib $(srcdir) $(FORM_PRIV_H) +fty_num lib $(srcdir) $(FORM_PRIV_H) +fty_regex lib $(srcdir) $(FORM_PRIV_H) diff --git a/include/Caps b/include/Caps index 3681387a..350219b6 100644 --- a/include/Caps +++ b/include/Caps @@ -1,24 +1,35 @@ -# /*************************************************************************** -# * COPYRIGHT NOTICE * -# **************************************************************************** -# * ncurses is copyright (C) 1992-1995 * -# * Zeyd M. Ben-Halim * -# * zmbenhal@netcom.com * -# * Eric S. Raymond * -# * esr@snark.thyrsus.com * -# * * -# * Permission is hereby granted to reproduce and distribute ncurses * -# * by any means and for any fee, whether alone or as part of a * -# * larger distribution, in source or in binary form, PROVIDED * -# * this notice is included with any such distribution, and is not * -# * removed from any of its header files. Mention of ncurses in any * -# * applications linked with it is highly appreciated. * -# * * -# * ncurses comes AS IS with no warranty, implied or expressed. * -# * * -# ***************************************************************************/ -# -# $Id: Caps,v 1.15 1996/10/05 21:26:18 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 +# and: Eric S. Raymond +# +# $Id: Caps,v 1.16 1998/02/11 12:13:45 tom Exp $ # # This is the master termcap/terminfo capability table. # diff --git a/include/MKparametrized.sh b/include/MKparametrized.sh index a957229d..cbbc3e0d 100755 --- a/include/MKparametrized.sh +++ b/include/MKparametrized.sh @@ -24,7 +24,7 @@ EOF # XENIX acs_* capabilities. Maybe someday we'll dedicate a flag field for # this, that would be cleaner.... -awk <$CAPS ' +${AWK-awk} <$CAPS ' $3 != "str" {next;} $1 ~ /^acs_/ {print "-1,\t/* ", $2, " */"; count++; next;} $0 ~ /#[0-9]/ {print "1,\t/* ", $2, " */"; count++; next;} diff --git a/include/MKterm.h.awk.in b/include/MKterm.h.awk.in index e65b686b..eb7afe70 100644 --- a/include/MKterm.h.awk.in +++ b/include/MKterm.h.awk.in @@ -1,27 +1,39 @@ BEGIN { - - print "/***************************************************************************" - print "* COPYRIGHT NOTICE *" - print "****************************************************************************" - print "* ncurses is copyright (C) 1992-1995 *" - print "* Zeyd M. Ben-Halim *" - print "* zmbenhal@netcom.com *" - print "* Eric S. Raymond *" - print "* esr@snark.thyrsus.com *" - print "* *" - print "* Permission is hereby granted to reproduce and distribute ncurses *" - print "* by any means and for any fee, whether alone or as part of a *" - print "* larger distribution, in source or in binary form, PROVIDED *" - print "* this notice is included with any such distribution, and is not *" - print "* removed from any of its header files. Mention of ncurses in any *" - print "* applications linked with it is highly appreciated. *" - print "* *" - print "* ncurses comes AS IS with no warranty, implied or expressed. *" - print "* *" - print "***************************************************************************/" - print "" - print "/* $Id: MKterm.h.awk.in,v 1.17 1997/02/08 21:20:22 tom Exp $ */" + print "/****************************************************************************" + print " * Copyright (c) 1998 Free Software Foundation, Inc. *" + print " * *" + print " * Permission is hereby granted, free of charge, to any person obtaining a *" + print " * copy of this software and associated documentation files (the *" + print " * "Software"), to deal in the Software without restriction, including *" + print " * without limitation the rights to use, copy, modify, merge, publish, *" + print " * distribute, distribute with modifications, sublicense, and/or sell *" + print " * copies of the Software, and to permit persons to whom the Software is *" + print " * furnished to do so, subject to the following conditions: *" + print " * *" + print " * The above copyright notice and this permission notice shall be included *" + print " * in all copies or substantial portions of the Software. *" + print " * *" + print " * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *" + print " * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *" + print " * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *" + print " * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *" + print " * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *" + print " * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *" + print " * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *" + print " * *" + print " * Except as contained in this notice, the name(s) of the above copyright *" + print " * holders shall not be used in advertising or otherwise to promote the *" + print " * sale, use or other dealings in this Software without prior written *" + print " * authorization. *" + print " ****************************************************************************/" + print "" + print "/****************************************************************************/" + print "/* Author: Zeyd M. Ben-Halim 1992,1995 */" + print "/* and: Eric S. Raymond */" + print "/****************************************************************************/" + print "" + print "/* $Id: MKterm.h.awk.in,v 1.23 1998/02/11 12:13:46 tom Exp $ */" print "" print "/*" print "** term.h -- Definition of struct term" @@ -33,6 +45,10 @@ BEGIN { print "#undef NCURSES_VERSION" print "#define NCURSES_VERSION \"@NCURSES_MAJOR@.@NCURSES_MINOR@\"" print "" + print "#ifdef __cplusplus" + print "extern \"C\" {" + print "#endif" + print "" print "/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H" print " * and BROKEN_LINKER definition (based on the system for which this was configured)." print " */" @@ -53,6 +69,9 @@ BEGIN { print "#define BROKEN_LINKER 0/*default*/" print "#endif" print "" + print "#ifndef NCURSES_CONST" + print "#define NCURSES_CONST /* nothing */" + print "#endif" print "" print "/* Assume Posix termio if we have the header and function */" print "#if HAVE_TERMIOS_H && HAVE_TCGETATTR" @@ -158,15 +177,12 @@ END { print " short Filedes; /* file description being written to */" print " TTY Ottyb, /* original state of the terminal */" print " Nttyb; /* current state of the terminal */" + print " int _baudrate; /* used to compute padding */" print "} TERMINAL;" print "" print "extern TERMINAL *cur_term;" print "" print "" - print "#ifdef __cplusplus" - print "extern \"C\" {" - print "#endif" - print "" print "#if BROKEN_LINKER" print "#define boolnames _nc_boolnames()" print "#define boolcodes _nc_boolcodes()" @@ -178,31 +194,33 @@ END { print "#define strcodes _nc_strcodes()" print "#define strfnames _nc_strfnames()" print "" - print "extern char * const *_nc_boolnames(void);" - print "extern char * const *_nc_boolcodes(void);" - print "extern char * const *_nc_boolfnames(void);" - print "extern char * const *_nc_numnames(void);" - print "extern char * const *_nc_numcodes(void);" - print "extern char * const *_nc_numfnames(void);" - print "extern char * const *_nc_strnames(void);" - print "extern char * const *_nc_strcodes(void);" - print "extern char * const *_nc_strfnames(void);" + print "extern NCURSES_CONST char * const *_nc_boolnames(void);" + print "extern NCURSES_CONST char * const *_nc_boolcodes(void);" + print "extern NCURSES_CONST char * const *_nc_boolfnames(void);" + print "extern NCURSES_CONST char * const *_nc_numnames(void);" + print "extern NCURSES_CONST char * const *_nc_numcodes(void);" + print "extern NCURSES_CONST char * const *_nc_numfnames(void);" + print "extern NCURSES_CONST char * const *_nc_strnames(void);" + print "extern NCURSES_CONST char * const *_nc_strcodes(void);" + print "extern NCURSES_CONST char * const *_nc_strfnames(void);" print "" print "#else" print "" - print "extern char *const boolnames[];" - print "extern char *const boolcodes[];" - print "extern char *const boolfnames[];" - print "extern char *const numnames[];" - print "extern char *const numcodes[];" - print "extern char *const numfnames[];" - print "extern char *const strnames[];" - print "extern char *const strcodes[];" - print "extern char *const strfnames[];" + print "extern NCURSES_CONST char *const boolnames[];" + print "extern NCURSES_CONST char *const boolcodes[];" + print "extern NCURSES_CONST char *const boolfnames[];" + print "extern NCURSES_CONST char *const numnames[];" + print "extern NCURSES_CONST char *const numcodes[];" + print "extern NCURSES_CONST char *const numfnames[];" + print "extern NCURSES_CONST char *const strnames[];" + print "extern NCURSES_CONST char *const strcodes[];" + print "extern NCURSES_CONST char *const strfnames[];" print "" print "#endif" print "" print "/* internals */" + print "extern int _nc_set_curterm(TTY *buf);" + print "extern int _nc_get_curterm(TTY *buf);" print "extern int _nc_read_entry(const char * const, char * const, TERMTYPE *const);" print "extern int _nc_read_file_entry(const char *const, TERMTYPE *);" print "extern char *_nc_first_name(const char *const);" @@ -214,20 +232,24 @@ END { print "extern TERMINAL *set_curterm(TERMINAL *);" print "extern int del_curterm(TERMINAL *);" print "" - print "/* entry points */" + print "/* miscellaneous entry points */" print "extern int putp(const char *);" print "extern int restartterm(const char *, int, int *);" print "extern int setupterm(const char *,int,int *);" + print "extern int tputs(const char *, int, int (*)(int));" + print "" + print "/* terminfo entry points */" + print "extern int tigetflag(const char *);" + print "extern int tigetnum(const char *);" + print "extern char *tigetstr(const char *);" + print "extern char *tparm(const char *, ...);" + print "" + print "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */" print "extern int tgetent(char *, const char *);" print "extern int tgetflag(const char *);" print "extern int tgetnum(const char *);" print "extern char *tgetstr(const char *, char **);" print "extern char *tgoto(const char *, int, int);" - print "extern int tigetflag(const char *);" - print "extern int tigetnum(const char *);" - print "extern char *tigetstr(const char *);" - print "extern char *tparm(const char *, ...);" - print "extern int tputs(const char *, int, int (*)(int));" print "" print "#ifdef __cplusplus" print "}" diff --git a/include/Makefile.in b/include/Makefile.in index f5d521e0..724be6d5 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,23 +1,34 @@ -# $Id: Makefile.in,v 1.17 1997/04/05 23:38:51 tom Exp $ -################################################################################ -# Copyright 1996,1997 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: Makefile.in,v 1.22 1998/02/11 12:13:46 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# # Makefile for ncurses source code. # # This makes/installs ncurses include-files @@ -41,8 +52,9 @@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ AWK = @AWK@ +LN_S = @LN_S@ -VERSION = @nc_cv_rel_version@ +VERSION = @cf_cv_rel_version@ # These files are generated by the configure script CONFIG_SRC = \ @@ -59,6 +71,7 @@ AUTO_SRC = \ ################################################################################ all \ +sources \ install :: $(AUTO_SRC) term.h: $(srcdir)/Caps MKterm.h.awk @@ -69,7 +82,7 @@ hashsize.h: $(srcdir)/Caps $(srcdir)/MKhashsize.sh sh $(srcdir)/MKhashsize.sh $(srcdir)/Caps >$@ parametrized.h: $(srcdir)/Caps $(srcdir)/MKparametrized.sh - sh $(srcdir)/MKparametrized.sh $(srcdir)/Caps >$@ + AWK=$(AWK) sh $(srcdir)/MKparametrized.sh $(srcdir)/Caps >$@ tags: ctags *.[ch] @@ -78,7 +91,7 @@ TAGS: etags *.[ch] mostlyclean :: - -rm -f tags TAGS *~ + -rm -f core tags TAGS *~ *.ln *.atac trace clean :: mostlyclean -rm -f $(AUTO_SRC) diff --git a/include/capdefaults.c b/include/capdefaults.c index a7ceda19..1e226157 100644 --- a/include/capdefaults.c +++ b/include/capdefaults.c @@ -1,25 +1,37 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ -/* $Id: capdefaults.c,v 1.4 1996/08/18 00:56:09 tom Exp $ */ +/* $Id: capdefaults.c,v 1.7 1998/02/11 12:13:45 tom Exp $ */ /* * Compute obsolete capabilities. The reason this is an include file @@ -34,7 +46,6 @@ char *sp; int capval; -#define VALID_STRING(s) ((s) && s != CANCELLED_STRING) #define EXTRACT_DELAY(str) (sp = strchr(str, '*'), sp ? atoi(sp+1) : 0) /* current (4.4BSD) capabilities marked obsolete */ @@ -57,8 +68,12 @@ termcap_reset = reset_1string; reset_1string = (char *)NULL; } +#if USE_XMC_SUPPORT if (magic_cookie_glitch_ul < 0 && magic_cookie_glitch && VALID_STRING(enter_underline_mode)) magic_cookie_glitch_ul = magic_cookie_glitch; +#else + magic_cookie_glitch_ul = -1; +#endif /* totally obsolete capabilities */ linefeed_is_newline = VALID_STRING(newline) diff --git a/include/config_h.in b/include/config_h.in deleted file mode 100644 index b4c65508..00000000 --- a/include/config_h.in +++ /dev/null @@ -1,26 +0,0 @@ -/****************************************************************************** - * Copyright 1995 by Thomas E. Dickey * - * All Rights Reserved. * - * * - * Permission to use, copy, modify, and distribute this software and its * - * documentation for any purpose and without fee is hereby granted, provided * - * that the above copyright notice appear in all copies and that both that * - * copyright notice and this permission notice appear in supporting * - * documentation, and that the name of the above listed copyright holder(s) * - * not be used in advertising or publicity pertaining to distribution of the * - * software without specific, written prior permission. THE ABOVE LISTED * - * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * - * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - ******************************************************************************/ -/* - * This is a template-file used to generate the "ncurses_cfg.h" file. - * - * Rather than list every definition, the configuration script substitutes - * the definitions that it finds using 'sed'. - */ -@DEFS@ diff --git a/include/curses.h.in b/include/curses.h.in index 43e474ba..2562f728 100644 --- a/include/curses.h.in +++ b/include/curses.h.in @@ -1,30 +1,50 @@ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ - -/* $Id: curses.h.in,v 1.44 1997/04/20 01:32:08 tom Exp $ */ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* $Id: curses.h.in,v 1.60 1998/02/11 12:13:46 tom Exp $ */ #ifndef __NCURSES_H #define __NCURSES_H + #define CURSES 1 #define CURSES_H 1 +/* This should be defined for the enhanced functionality to be visible. + * However, none of the wide-character (enhanced) functionality is implemented. + * So we do not define it (yet). +#define _XOPEN_CURSES 1 + */ + /* These are defined only in curses.h, and are used for conditional compiles */ #define NCURSES_VERSION_MAJOR @NCURSES_MAJOR@ #define NCURSES_VERSION_MINOR @NCURSES_MINOR@ @@ -46,9 +66,7 @@ #define NCURSES_CONST /* nothing */ #endif -#ifndef _UNCTRL_H -typedef unsigned long chtype; -#endif +typedef unsigned @cf_cv_typeof_chtype@ chtype; #include #include @@ -68,8 +86,8 @@ typedef unsigned long chtype; #undef TRUE #undef FALSE -#define CXX_BUILTIN_BOOL @nc_cv_builtin_bool@ -#define CXX_TYPE_OF_BOOL @nc_cv_type_of_bool@ +#define CXX_BUILTIN_BOOL @cf_cv_builtin_bool@ +#define CXX_TYPE_OF_BOOL @cf_cv_type_of_bool@ #if defined(__cplusplus) && CXX_BUILTIN_BOOL #define TRUE ((CXX_TYPE_OF_BOOL)true) @@ -86,26 +104,25 @@ extern "C" { /* * XSI attributes. In the ncurses implementation, they are identical to the - * A_ attributes because attr_t is just an int. The XSI Curses attr_* and - * wattr_* entry points are all mapped to attr* and wattr* entry points. + * A_ attributes. */ -#define WA_ATTRIBUTES 0xffffff00 -#define WA_NORMAL 0x00000000 -#define WA_STANDOUT 0x00010000 -#define WA_UNDERLINE 0x00020000 -#define WA_REVERSE 0x00040000 -#define WA_BLINK 0x00080000 -#define WA_DIM 0x00100000 -#define WA_BOLD 0x00200000 -#define WA_ALTCHARSET 0x00400000 -#define WA_INVIS 0x00800000 -#define WA_PROTECT 0x01000000 -#define WA_HORIZONTAL 0x02000000 /* XSI Curses attr -- not yet used */ -#define WA_LEFT 0x04000000 /* XSI Curses attr -- not yet used */ -#define WA_LOW 0x08000000 /* XSI Curses attr -- not yet used */ -#define WA_RIGHT 0x10000000 /* XSI Curses attr -- not yet used */ -#define WA_TOP 0x20000000 /* XSI Curses attr -- not yet used */ -#define WA_VERTICAL 0x40000000 /* XSI Curses attr -- not yet used */ +#define WA_ATTRIBUTES A_ATTRIBUTES +#define WA_NORMAL A_NORMAL +#define WA_STANDOUT A_STANDOUT +#define WA_UNDERLINE A_UNDERLINE +#define WA_REVERSE A_REVERSE +#define WA_BLINK A_BLINK +#define WA_DIM A_DIM +#define WA_BOLD A_BOLD +#define WA_ALTCHARSET A_ALTCHARSET +#define WA_INVIS A_INVIS +#define WA_PROTECT A_PROTECT +#define WA_HORIZONTAL A_HORIZONTAL +#define WA_LEFT A_LEFT +#define WA_LOW A_LOW +#define WA_RIGHT A_RIGHT +#define WA_TOP A_TOP +#define WA_VERTICAL A_VERTICAL /* colors */ extern int COLORS; @@ -149,7 +166,7 @@ extern chtype acs_map[]; #define ACS_DARROW (acs_map['.']) /* arrow pointing down */ #define ACS_UARROW (acs_map['-']) /* arrow pointing up */ #define ACS_BOARD (acs_map['h']) /* board of squares */ -#define ACS_LANTERN (acs_map['I']) /* lantern symbol */ +#define ACS_LANTERN (acs_map['i']) /* lantern symbol */ #define ACS_BLOCK (acs_map['0']) /* solid square block */ /* * These aren't documented, but a lot of System Vs have them anyway @@ -233,7 +250,16 @@ typedef struct cchar_t; #endif /* _XOPEN_SOURCE_EXTENDED */ -struct _win_st { +struct ldat +{ + chtype *text; /* text of the line */ + short firstchar; /* first changed character in the line */ + short lastchar; /* last changed character in the line */ + short oldindex; /* index of the line at last update */ +}; + +struct _win_st +{ short _cury, _curx; /* current cursor position */ /* window location and size */ @@ -258,15 +284,7 @@ struct _win_st { bool _use_keypad; /* process function keys into KEY_ symbols? */ int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ - /* the actual line data */ - struct ldat - { - chtype *text; /* text of the line */ - short firstchar; /* first changed character in the line */ - short lastchar; /* last changed character in the line */ - short oldindex; /* index of the line at last update */ - } - *_line; + struct ldat *_line; /* the actual line data */ /* global screen state */ short _regtop; /* top line of scrolling region */ @@ -288,9 +306,13 @@ struct _win_st { short _yoffset; /* real begy is _begy + _yoffset */ }; -extern WINDOW *stdscr, *curscr, *newscr; +extern WINDOW *stdscr; +extern WINDOW *curscr; +extern WINDOW *newscr; -extern int LINES, COLS, TABSIZE; +extern int LINES; +extern int COLS; +extern int TABSIZE; /* * This global was an undocumented feature under AIX curses. @@ -298,9 +320,11 @@ extern int LINES, COLS, TABSIZE; extern int ESCDELAY; /* ESC expire time in milliseconds */ /* non-XSI extensions (dickey@clark.net) */ +extern int define_key (char *, int); +extern int keyok (int, bool); extern int resizeterm (int, int); -extern int wresize (WINDOW *, int, int); extern int use_default_colors (void); +extern int wresize (WINDOW *, int, int); extern char ttytype[]; /* needed for backward compatibility */ @@ -308,8 +332,9 @@ extern char ttytype[]; /* needed for backward compatibility */ * GCC (and some other compilers) define '__attribute__'; we're using this * macro to alert the compiler to flag inconsistencies in printf/scanf-like * function calls. Just in case '__attribute__' isn't defined, make a dummy. + * G++ doesn't accept it anyway. */ -#if !defined(__GNUC__) && !defined(__attribute__) +#if defined(__cplusplus) || (!defined(__GNUC__) && !defined(__attribute__)) #define __attribute__(p) /* nothing */ #endif @@ -387,6 +412,7 @@ extern int clearok(WINDOW *,bool); /* implemented */ extern int clrtobot(void); /* generated */ extern int clrtoeol(void); /* generated */ extern int color_content(short,short*,short*,short*); /* implemented */ +extern int color_set(short,void*); /* missing */ extern int COLOR_PAIR(int); /* generated */ extern int copywin(const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */ extern int curs_set(int); /* implemented */ @@ -404,6 +430,7 @@ extern int echo(void); /* implemented */ extern int echochar(const chtype); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED extern int echo_wchar(const cchar_t *); /* missing */ +extern int erasewchar(wchar_t*); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ extern int endwin(void); /* implemented */ extern char erasechar(void); /* implemented */ @@ -427,7 +454,7 @@ extern int getstr(char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED extern int get_wch(wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern WINDOW *getwin(FILE *); /* not in XPG4 */ +extern WINDOW *getwin(FILE *); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED extern int get_wstr(wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ @@ -621,7 +648,7 @@ extern int overlay(const WINDOW*,WINDOW *); /* implemented */ extern int overwrite(const WINDOW*,WINDOW *); /* implemented */ extern int pair_content(short,short*,short*); /* implemented */ extern int PAIR_NUMBER(int); /* generated */ -extern int pechochar(WINDOW *, chtype); /* implemented */ +extern int pechochar(WINDOW *, const chtype); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED extern int pecho_wchar(WINDOW *, const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ @@ -655,18 +682,12 @@ extern int setcchar(cchar_t *, wchar_t *, attr_t, short, const void *); /* missi extern int setscrreg(int,int); /* generated */ extern SCREEN *set_term(SCREEN *); /* implemented */ extern int slk_attroff(const attr_t); /* implemented */ -#ifdef _XOPEN_SOURCE_EXTENDED -extern int slk_attr_off(attr_t); /* missing */ -#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int slk_attr_off(attr_t); /* generated:WIDEC */ extern int slk_attron(const attr_t); /* implemented */ -#ifdef _XOPEN_SOURCE_EXTENDED -extern int slk_attr_on(attr_t); /* missing */ -#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int slk_attr_on(attr_t); /* generated:WIDEC */ extern int slk_attrset(const attr_t); /* implemented */ extern attr_t slk_attr(void); /* implemented */ -#ifdef _XOPEN_SOURCE_EXTENDED -extern int slk_attr_set(attr_t); /* missing */ -#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int slk_attr_set(attr_t); /* generated:WIDEC */ extern int slk_clear(void); /* implemented */ extern int slk_init(int); /* implemented */ extern char *slk_label(int); /* implemented */ @@ -684,7 +705,8 @@ extern int start_color(void); /* implemented */ extern WINDOW *subpad(WINDOW *, int, int, int, int); /* implemented */ extern WINDOW *subwin(WINDOW *,int,int,int,int); /* implemented */ extern int syncok(WINDOW *, bool); /* implemented */ -extern attr_t termattrs(void); /* implemented */ +extern chtype termattrs(void); /* implemented */ +extern attr_t term_attrs(void); /* missing */ extern char *termname(void); /* implemented */ extern int tigetflag(const char *); /* implemented */ extern int tigetnum(const char *); /* implemented */ @@ -698,9 +720,7 @@ extern int unget_wch(const wchar_t *); /* missing */ extern int untouchwin(WINDOW *); /* generated */ extern void use_env(bool); /* implemented */ extern int vidattr(chtype); /* implemented */ -#ifdef _XOPEN_SOURCE_EXTENDED -extern int vid_attr(attr_t); /* missing */ -#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int vid_attr(attr_t); /* generated:WIDEC */ extern int vidputs(chtype, int (*)(int)); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED extern int vid_puts(attr_t, int (*)(int)); /* missing */ @@ -732,7 +752,7 @@ extern int wattr_on(WINDOW *, const attr_t); /* implemented */ extern int wattr_off(WINDOW *, const attr_t); /* implemented */ extern int wattr_set(WINDOW *, attr_t); /* generated */ extern int wbkgd(WINDOW *,const chtype); /* implemented */ -extern void wbkgdset(WINDOW *,chtype); /* generated */ +extern void wbkgdset(WINDOW *,chtype); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED extern int wbkgrndset(WINDOW *,const cchar_t *); /* missing */ extern int wbkgrnd(WINDOW *,const cchar_t *); /* missing */ @@ -745,6 +765,7 @@ extern int wchgat(WINDOW *, int, attr_t, short, const void *);/* implemented */ extern int wclear(WINDOW *); /* implemented */ extern int wclrtobot(WINDOW *); /* implemented */ extern int wclrtoeol(WINDOW *); /* implemented */ +extern int wcolor_set(WINDOW*,short,void*); /* missing */ extern void wcursyncup(WINDOW *); /* implemented */ extern int wdelch(WINDOW *); /* implemented */ extern int wdeleteln(WINDOW *); /* generated */ @@ -817,27 +838,45 @@ extern int wvline_set(WINDOW *, const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ /* attributes */ -#define A_ATTRIBUTES 0xffffff00 -#define A_NORMAL 0x00000000 -#define A_STANDOUT 0x00010000 -#define A_UNDERLINE 0x00020000 -#define A_REVERSE 0x00040000 -#define A_BLINK 0x00080000 -#define A_DIM 0x00100000 -#define A_BOLD 0x00200000 -#define A_ALTCHARSET 0x00400000 -#define A_INVIS 0x00800000 -#define A_PROTECT 0x01000000 -#define A_HORIZONTAL 0x02000000 /* XSI Curses attr -- not yet used */ -#define A_LEFT 0x04000000 /* XSI Curses attr -- not yet used */ -#define A_LOW 0x08000000 /* XSI Curses attr -- not yet used */ -#define A_RIGHT 0x10000000 /* XSI Curses attr -- not yet used */ -#define A_TOP 0x20000000 /* XSI Curses attr -- not yet used */ -#define A_VERTICAL 0x40000000 /* XSI Curses attr -- not yet used */ -#define A_CHARTEXT 0x000000ff -#define A_COLOR 0x0000ff00 -#define COLOR_PAIR(n) ((n) << 8) -#define PAIR_NUMBER(a) (((a) & A_COLOR) >> 8) + +#define NCURSES_BITS(mask,shift) ((mask) << ((shift) + @cf_cv_widec_shift@)) + +#define A_NORMAL 0L +#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) +#define A_STANDOUT NCURSES_BITS(@cf_cv_1UL@,8) +#define A_UNDERLINE NCURSES_BITS(@cf_cv_1UL@,9) +#define A_REVERSE NCURSES_BITS(@cf_cv_1UL@,10) +#define A_BLINK NCURSES_BITS(@cf_cv_1UL@,11) +#define A_DIM NCURSES_BITS(@cf_cv_1UL@,12) +#define A_BOLD NCURSES_BITS(@cf_cv_1UL@,13) +#define A_ALTCHARSET NCURSES_BITS(@cf_cv_1UL@,14) +#define A_INVIS NCURSES_BITS(@cf_cv_1UL@,15) + +/* Tradeoff on 32-bit machines ('protect' vs widec). The others (e.g., left + * highlight are not implemented in any terminal descriptions, anyway. + */ +#if ((16 + @cf_cv_widec_shift@) < @cf_cv_shift_limit@) +#define A_PROTECT NCURSES_BITS(@cf_cv_1UL@,16) +#define A_HORIZONTAL NCURSES_BITS(@cf_cv_1UL@,17) +#define A_LEFT NCURSES_BITS(@cf_cv_1UL@,18) +#define A_LOW NCURSES_BITS(@cf_cv_1UL@,19) +#define A_RIGHT NCURSES_BITS(@cf_cv_1UL@,20) +#define A_TOP NCURSES_BITS(@cf_cv_1UL@,21) +#define A_VERTICAL NCURSES_BITS(@cf_cv_1UL@,22) +#else +#define A_PROTECT 0L +#define A_HORIZONTAL 0L +#define A_LEFT 0L +#define A_LOW 0L +#define A_RIGHT 0L +#define A_TOP 0L +#define A_VERTICAL 0L +#endif + +#define COLOR_PAIR(n) NCURSES_BITS(n, 0) +#define PAIR_NUMBER(a) (((a) & A_COLOR) >> @cf_cv_widec_shift@) /* * pseudo functions @@ -854,27 +893,28 @@ extern int wvline_set(WINDOW *, const cchar_t *, int); /* missing */ #define nocrmode() nocbreak() #define gettmode() -#define getyx(win,y,x) (y = (win)->_cury, x = (win)->_curx) -#define getbegyx(win,y,x) (y = (win)->_begy, x = (win)->_begx) -#define getmaxyx(win,y,x) (y = (win)->_maxy + 1, x = (win)->_maxx + 1) -#define getparyx(win,y,x) (y = (win)->_pary, x = (win)->_parx) +#define getyx(win,y,x) (y = (win)?(win)->_cury:ERR, x = (win)?(win)->_curx:ERR) +#define getbegyx(win,y,x) (y = (win)?(win)->_begy:ERR, x = (win)?(win)->_begx:ERR) +#define getmaxyx(win,y,x) (y = (win)?((win)->_maxy + 1):ERR, x = (win)?((win)->_maxx + 1):ERR) +#define getparyx(win,y,x) (y = (win)?(win)->_pary:ERR, x = (win)?(win)->_parx:ERR) #define getsyx(y,x) getyx(stdscr, y, x) #define setsyx(y,x) (stdscr->_cury = y, stdscr->_curx = x) -#define wbkgdset(win, ch) \ - (((win)->_attrs = (((win)->_attrs & ~((win)->_bkgd & A_ATTRIBUTES)) | \ - ((ch) & A_ATTRIBUTES))), \ - ((win)->_bkgd = (ch))) - /* It seems older SYSV curses versions define these */ -#define getattrs(win) ((win)->_attrs) -#define getmaxx(win) ((win)->_maxx + 1) -#define getmaxy(win) ((win)->_maxy + 1) - -#define winch(win) ((win)->_line[(win)->_cury].text[(win)->_curx]) +#define getattrs(win) ((win)?(win)->_attrs:A_NORMAL) +#define getcurx(win) ((win)?(win)->_curx:ERR) +#define getcury(win) ((win)?(win)->_cury:ERR) +#define getbegx(win) ((win)?(win)->_begx:ERR) +#define getbegy(win) ((win)?(win)->_begy:ERR) +#define getmaxx(win) ((win)?((win)->_maxx + 1):ERR) +#define getmaxy(win) ((win)?((win)->_maxy + 1):ERR) +#define getparx(win) ((win)?(win)->_parx:ERR) +#define getpary(win) ((win)?(win)->_pary:ERR) + +#define winch(win) ((win)?(win)->_line[(win)->_cury].text[(win)->_curx]:0) #define wstandout(win) (wattr_set(win,A_STANDOUT)) #define wstandend(win) (wattr_set(win,A_NORMAL)) -#define wattr_set(win,at) ((win)->_attrs = (at)) +#define wattr_set(win,at) ((win)?((win)->_attrs = (at)):0) #define wattron(win,at) wattr_on(win, at) #define wattroff(win,at) wattr_off(win, at) @@ -882,9 +922,9 @@ extern int wvline_set(WINDOW *, const cchar_t *, int); /* missing */ #define scroll(win) wscrl(win,1) -#define touchwin(win) wtouchln((win), 0, (win)->_maxy + 1, 1) +#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1) #define touchline(win, s, c) wtouchln((win), s, c, 1) -#define untouchwin(win) wtouchln((win), 0, (win)->_maxy + 1, 0) +#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0) #define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0) #define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) @@ -1054,6 +1094,10 @@ extern int wvline_set(WINDOW *, const cchar_t *, int); /* missing */ #define mvwinwstr(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winnwstr(stdscr,c,-1)) #define mvwvline_set(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : wvline_set(win,c,n)) +#define slk_attr_off(a) slk_attroff(a) +#define slk_attr_on(a) slk_attron(a) +#define slk_attr_set(a) slk_attrset(a) +#define vid_attr(a) vidattr(a) #define vline_set(c,n) vhline_set(stdscr,c,n) #define waddwstr(win,wstr,n) waddnwstr(win,wstr,-1) #define wattr_get(win) ((win)->_attrs) @@ -1176,6 +1220,7 @@ extern int wvline_set(WINDOW *, const cchar_t *, int); /* missing */ #define KEY_SUSPEND 0627 /* Suspend */ #define KEY_UNDO 0630 /* Undo */ #define KEY_MOUSE 0631 /* Mouse event has occurred */ +#define KEY_RESIZE 0632 /* Terminal resize event */ #define KEY_MAX 0777 /* Maximum key value */ /* mouse interface */ @@ -1233,7 +1278,7 @@ MEVENT; extern int getmouse(MEVENT *); extern int ungetmouse(MEVENT *); extern mmask_t mousemask(mmask_t, mmask_t *); -extern bool wenclose(WINDOW *, int, int); +extern bool wenclose(const WINDOW *, int, int); extern int mouseinterval(int); /* other non-XSI functions */ @@ -1272,6 +1317,7 @@ extern void trace(const unsigned int); #if defined(TRACE) || defined(NCURSES_TEST) extern int _nc_optimize_enable; /* enable optimizations */ +extern const char *_nc_visbuf(const char *); #define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ #define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ #define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ diff --git a/include/edit_cfg.sh b/include/edit_cfg.sh index cc6efcac..baa31f68 100755 --- a/include/edit_cfg.sh +++ b/include/edit_cfg.sh @@ -1,49 +1,66 @@ #!/bin/sh -# $Id: edit_cfg.sh,v 1.6 1997/04/06 01:54:44 tom Exp $ -################################################################################ -# Copyright 1996,1997 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: edit_cfg.sh,v 1.9 1998/02/11 12:13:46 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# # Edit the default value of the term.h file based on the autoconf-generated # values: # # $1 = ncurses_cfg.h # $2 = term.h # +BAK=save$$ +TMP=edit$$ +trap "rm -f $BAK $TMP" 0 1 2 5 15 for name in \ HAVE_TCGETATTR \ HAVE_TERMIOS_H \ HAVE_TERMIO_H \ + NCURSES_CONST \ BROKEN_LINKER do - mv $2 $2.bak - if ( grep "[ ]$name[ ]" $1 2>&1 >/dev/null ) + mv $2 $BAK + if ( grep "[ ]$name[ ]" $1 2>&1 >$TMP ) then - sed -e 's/define '$name'.*$/define '$name' 1/' $2.bak >$2 + sed -e 's@#define '$name'.*$@'"`cat $TMP`@" $BAK >$2 + elif test "$name" = "NCURSES_CONST" ; then + sed -e 's/define '$name'.*$/define '$name' \/\*nothing\*\//' $BAK >$2 else - sed -e 's/define '$name'.*$/define '$name' 0/' $2.bak >$2 + sed -e 's/define '$name'.*$/define '$name' 0/' $BAK >$2 fi - if (cmp -s $2 $2.bak) + if (cmp -s $2 $BAK) then echo '** same: '$name - mv $2.bak $2 + mv $BAK $2 else echo '** edit: '$name - rm -f $2.bak + rm -f $BAK fi done diff --git a/include/headers b/include/headers index 581f8b7f..2a185c21 100644 --- a/include/headers +++ b/include/headers @@ -1,22 +1,33 @@ -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +############################################################################## +# Copyright (c) 1998 Free 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 1996 +# term.h curses.h unctrl.h diff --git a/include/nc_alloc.h b/include/nc_alloc.h index 362e41dd..54a706e1 100644 --- a/include/nc_alloc.h +++ b/include/nc_alloc.h @@ -1,23 +1,35 @@ -/****************************************************************************** - * Copyright 1996,1997 by Thomas E. Dickey * - * All Rights Reserved. * - * * - * Permission to use, copy, modify, and distribute this software and its * - * documentation for any purpose and without fee is hereby granted, provided * - * that the above copyright notice appear in all copies and that both that * - * copyright notice and this permission notice appear in supporting * - * documentation, and that the name of the above listed copyright holder(s) * - * not be used in advertising or publicity pertaining to distribution of the * - * software without specific, written prior permission. THE ABOVE LISTED * - * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * - * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - ******************************************************************************/ -/* $Id: nc_alloc.h,v 1.4 1997/02/15 18:51:39 tom Exp $ */ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1996,1997 * + ****************************************************************************/ +/* $Id: nc_alloc.h,v 1.5 1998/02/11 12:13:45 tom Exp $ */ #ifndef NC_ALLOC_included #define NC_ALLOC_included 1 diff --git a/include/nc_panel.h b/include/nc_panel.h new file mode 100644 index 00000000..dbb20fa1 --- /dev/null +++ b/include/nc_panel.h @@ -0,0 +1,66 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + + +/* + * $Id: nc_panel.h,v 1.2 1998/02/11 12:13:45 tom Exp $ + * + * nc_panel.h + * + * Headerfile to provide an interface for the panel layer into + * the SCREEN structure of the ncurses core. + */ + +#ifndef NC_PANEL_H +#define NC_PANEL_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +struct panel; /* Forward Declaration */ + +struct panelhook { + struct panel* top_panel; + struct panel* bottom_panel; + struct panel* stdscr_pseudo_panel; +}; + +/* Retrieve the panelhook of the current screen */ +extern struct panelhook* _nc_panelhook(void); + +#ifdef __cplusplus +} +#endif + +#endif /* NC_PANEL_H */ diff --git a/include/ncurses_cfg.hin b/include/ncurses_cfg.hin new file mode 100644 index 00000000..f80fb83f --- /dev/null +++ b/include/ncurses_cfg.hin @@ -0,0 +1,56 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1997 * + ****************************************************************************/ +/* + * $Id: ncurses_cfg.hin,v 1.2 1998/02/11 12:13:46 tom Exp $ + * + * This is a template-file used to generate the "ncurses_cfg.h" file. + * + * Rather than list every definition, the configuration script substitutes + * the definitions that it finds using 'sed'. You need a patch (971222) + * to autoconf 2.12 to do this. + */ +#ifndef NC_CONFIG_H +#define NC_CONFIG_H +@DEFS@ + + /* The C compiler may not treat these properly but C++ has to */ +#ifdef __cplusplus +#undef const +#undef inline +#else +#if defined(lint) || defined(TRACE) +#undef inline +#define inline /* nothing */ +#endif +#endif + +#endif /* NC_CONFIG_H */ diff --git a/include/term_entry.h b/include/term_entry.h index 9045774f..ada2791b 100644 --- a/include/term_entry.h +++ b/include/term_entry.h @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* diff --git a/include/termcap.h.in b/include/termcap.h.in index adae0b74..618b0a9b 100644 --- a/include/termcap.h.in +++ b/include/termcap.h.in @@ -1,24 +1,37 @@ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ - -/* $Id: termcap.h.in,v 1.4 1997/02/08 21:50:39 tom Exp $ */ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* $Id: termcap.h.in,v 1.5 1998/02/11 12:13:45 tom Exp $ */ #ifndef _TERMCAP_H #define _TERMCAP_H 1 diff --git a/include/tic.h b/include/tic.h index b7485310..e8660958 100644 --- a/include/tic.h +++ b/include/tic.h @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* * tic.h - Global variables and structures for the terminfo @@ -28,6 +40,10 @@ #ifndef __TIC_H #define __TIC_H +#ifdef __cplusplus +extern "C" { +#endif + #include /* for the _tracef() prototype, ERR/OK, bool defs */ /* @@ -59,9 +75,24 @@ */ #define MAGIC 0432 /* first two bytes of a compiled entry */ -#define MAX_NAME_SIZE 127 /* maximum legal name field size */ + +/* + * The "maximum" here is misleading; XSI guarantees minimum values, which a + * given implementation may exceed. + */ +#define MAX_NAME_SIZE 512 /* maximum legal name field size (XSI:127) */ #define MAX_ENTRY_SIZE 4096 /* maximum legal entry size */ -#define MAX_ALIAS 14 /* maximum size of individual name or alias */ + +/* The maximum size of individual name or alias is guaranteed in XSI to + * be 14, since that corresponds to the older filename lengths. Newer + * systems allow longer aliases, though not many terminal descriptions + * are written to use them. + */ +#if HAVE_LONG_FILE_NAMES +#define MAX_ALIAS 32 /* POSIX minimum for PATH_MAX */ +#else +#define MAX_ALIAS 14 /* SVr3 filename length */ +#endif /* location of user's personal info directory */ #define PRIVATE_INFO "%s/.terminfo" /* plug getenv("HOME") into %s */ @@ -143,6 +174,8 @@ extern const struct name_table_entry *_nc_get_table(bool); #define CANCELLED_NUMERIC -2 #define CANCELLED_STRING (char *)-1 +#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING) + /* termcap entries longer than this may break old binaries */ #define MAX_TERMCAP_LENGTH 1023 @@ -183,9 +216,18 @@ extern void _nc_err_abort(const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETUR extern void _nc_warning(const char *const,...) GCC_PRINTFLIKE(1,2); extern bool _nc_suppress_warnings; +/* comp_expand.c: expand string into readable form */ +extern char *_nc_tic_expand(const char *, bool); + +/* comp_scan.c: decode string from readable form */ +extern char _nc_trans_string(char *); + /* captoinfo.c: capability conversion */ -extern char *_nc_captoinfo(char *const, char *, int const); -extern char *_nc_infotocap(char *const, char *, int const); +extern char *_nc_captoinfo(const char *, const char *, int const); +extern char *_nc_infotocap(const char *, const char *, int const); + +/* lib_tputs.c */ +extern int _nc_nulls_sent; /* Add one for every null sent */ /* comp_main.c: compiler main */ extern const char *_nc_progname; @@ -196,4 +238,8 @@ extern const char *_nc_tic_dir(const char *); /* write_entry.c */ extern int _nc_tic_written(void); +#ifdef __cplusplus +} +#endif + #endif /* __TIC_H */ diff --git a/include/unctrl.h.in b/include/unctrl.h.in index b3c3c1e1..cc10079f 100644 --- a/include/unctrl.h.in +++ b/include/unctrl.h.in @@ -1,22 +1,35 @@ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* * unctrl.h @@ -24,14 +37,9 @@ * Display a printable version of a control character. * Control characters are displayed in caret notation (^x), DELETE is displayed * as ^?. Printable characters are displayed as is. - * - * The returned pointer points to a static buffer which gets overwritten by - * each call. Therefore, you must copy the resulting string to a safe place - * before calling unctrl() again. - * */ -/* $Id: unctrl.h.in,v 1.5 1997/04/26 23:04:09 tom Exp $ */ +/* $Id: unctrl.h.in,v 1.8 1998/02/11 12:13:45 tom Exp $ */ #ifndef _UNCTRL_H #define _UNCTRL_H 1 @@ -45,6 +53,7 @@ extern "C" { #include +#undef unctrl extern NCURSES_CONST char *unctrl(chtype); #ifdef __cplusplus diff --git a/install-sh b/install-sh index ab74c882..89fc9b09 100755 --- a/install-sh +++ b/install-sh @@ -1,4 +1,4 @@ -#!/bin/sh +#! /bin/sh # # install - install a program, script, or datafile # This comes from X11R5. diff --git a/man/Makefile.in b/man/Makefile.in index b4dbbd33..f0607f56 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -1,23 +1,34 @@ -# $Id: Makefile.in,v 1.20 1996/08/04 01:16:40 tom Exp $ -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: Makefile.in,v 1.25 1998/02/11 12:13:49 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# # Makefile for ncurses manual pages. # # NOTE: When you add or rename a man page, make sure you update both @@ -37,20 +48,27 @@ ticdir = $(datadir)/terminfo INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ -all: terminfo.5 +all \ +sources: terminfo.5 $(INSTALL_PREFIX)$(mandir) : $(srcdir)/../mkinstalldirs $@ install install.man : terminfo.5 $(INSTALL_PREFIX)$(mandir) - sh ./edit_man.sh $(INSTALL_PREFIX)$(mandir) terminfo.5 $(srcdir)/*.[0-9]* + sh ./edit_man.sh installing $(INSTALL_PREFIX)$(mandir) terminfo.5 $(srcdir)/*.[0-9]* + +uninstall uninstall.man : + -sh ./edit_man.sh removing $(INSTALL_PREFIX)$(mandir) terminfo.5 $(srcdir)/*.[0-9]* # We compose terminfo.5 from the real sources... CAPLIST=$(srcdir)/../include/Caps terminfo.5: $(srcdir)/terminfo.head $(CAPLIST) $(srcdir)/terminfo.tail Makefile $(srcdir)/MKterminfo.sh sh $(srcdir)/MKterminfo.sh $(srcdir)/terminfo.head $(CAPLIST) $(srcdir)/terminfo.tail >terminfo.5 -clean mostlyclean: +mostlyclean : + -rm -f core tags TAGS *~ *.ln *.atac trace + +clean: mostlyclean rm -f terminfo.5 distclean realclean: clean diff --git a/man/curs_addch.3x b/man/curs_addch.3x index d00bd1b4..9d3ac6f4 100644 --- a/man/curs_addch.3x +++ b/man/curs_addch.3x @@ -1,4 +1,5 @@ '\" t +.\" $Id: curs_addch.3x,v 1.10 1997/12/13 22:37:23 tom Exp $ .TH curs_addch 3X "" .SH NAME \fBaddch\fR, \fBwaddch\fR, \fBmvaddch\fR, \fBmvwaddch\fR, @@ -75,8 +76,8 @@ ACS_TTEE + top tee ACS_HLINE - horizontal line ACS_VLINE | vertical line ACS_PLUS + plus -ACS_S1 - scan line 1 -ACS_S9 \&_ scan line 9 +ACS_S1 - scan line 1 +ACS_S9 \&_ scan line 9 ACS_DIAMOND + diamond ACS_CKBOARD : checker board (stipple) ACS_DEGREE ' degree symbol @@ -89,11 +90,11 @@ ACS_UARROW ^ arrow pointing up ACS_BOARD # board of squares ACS_LANTERN # lantern symbol ACS_BLOCK # solid square block -ACS_S3 - scan line 3 -ACS_S7 - scan line 7 +ACS_S3 - scan line 3 +ACS_S7 - scan line 7 ACS_LEQUAL < less-than-or-equal-to ACS_GEQUAL > greater-than-or-equal-to -ACS_PI * greek pi +ACS_PI * greek pi ACS_NEQUAL ! not-equal ACS_STERLING f pound-sterling symbol .TE diff --git a/man/curs_attr.3x b/man/curs_attr.3x index d9568a5f..ed062093 100644 --- a/man/curs_attr.3x +++ b/man/curs_attr.3x @@ -1,4 +1,5 @@ -.\" $Id: curs_attr.3x,v 1.12 1997/01/05 01:14:33 tom Exp $ +'\" t +.\" $Id: curs_attr.3x,v 1.14 1997/12/13 22:38:46 tom Exp $ .TH curs_attr 3X "" .SH NAME \fBattroff\fR, \fBwattroff\fR, \fBattron\fR, \fBwattron\fR, @@ -84,7 +85,7 @@ than the remaining window width means to change attributes all the way to the end of the current line. The \fBwchgat\fR function generalizes this to any window; the \fBmvwchgat\fR function does a cursor move before acting. In these functions, the color argument is a color-pair index (as in the first argument -of \fIinit_pair\fR, see \fBcurs_color\fR(3x)). The \fBopts\fR argument is not +of \fIinit_pair\fR, see \fBcurs_color\fR(3X)). The \fBopts\fR argument is not presently used, but is reserved for the future (leave it \fBNULL\fR). .SS Attributes The following video attributes, defined in \fB\fR, can be passed to diff --git a/man/curs_color.3x b/man/curs_color.3x index b228ebaa..271c5dcd 100644 --- a/man/curs_color.3x +++ b/man/curs_color.3x @@ -1,4 +1,4 @@ -.\" $Id: curs_color.3x,v 1.8 1997/01/19 02:50:30 tom Exp $ +.\" $Id: curs_color.3x,v 1.9 1997/12/06 22:06:00 tom Exp $ .TH curs_color 3X "" .SH NAME \fBstart_color\fR, \fBinit_pair\fR, @@ -129,7 +129,7 @@ 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 \fBcurs_bkgd\fR(3x). +scrolling operations, see \fBcurs_bkgd\fR(3X). Several caveats apply on 386 and 486 machines with VGA-compatible graphics: diff --git a/man/curs_getch.3x b/man/curs_getch.3x index 092c8b78..c621338a 100644 --- a/man/curs_getch.3x +++ b/man/curs_getch.3x @@ -1,4 +1,5 @@ -.\" $Id: curs_getch.3x,v 1.10 1997/01/05 11:57:54 Jesse.Thilo Exp $ +'\" t +.\" $Id: curs_getch.3x,v 1.12 1997/12/13 22:39:05 tom Exp $ .TH curs_getch 3X "" .SH NAME \fBgetch\fR, \fBwgetch\fR, \fBmvgetch\fR, @@ -121,6 +122,7 @@ KEY_FIND/Find key KEY_HELP/Help key KEY_MARK/Mark key KEY_MESSAGE/Message key +KEY_MOUSE/Mouse event read KEY_MOVE/Move key KEY_NEXT/Next object key KEY_OPEN/Open key @@ -130,6 +132,7 @@ KEY_REDO/Redo key 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 @@ -227,10 +230,14 @@ interrupts \fBgetch\fR and causes it to return ERR with \fBerrno\fR set to interrupt \fBgetch\fR. The \fBhas_key\fR function is unique to \fBncurses\fR. We recommend that -any code using it be conditionalized on the NCURSES feature macro. +any code using it be conditionalized on the \fBNCURSES_VERSION\fR feature macro. .SH SEE ALSO -\fBcurses\fR(3X), \fBcurs_inopts\fR(3X), \fBcurs_move\fR(3X), +\fBcurses\fR(3X), +\fBcurs_inopts\fR(3X), +\fBcurs_mouse\fR(3X), +\fBcurs_move\fR(3X), \fBcurs_refresh\fR(3X). +\fBresizeterm\fR(3X). .\"# .\"# The following sets edit modes for GNU EMACS .\"# Local Variables: diff --git a/man/curs_inch.3x b/man/curs_inch.3x index 9cfb6cef..adea2b59 100644 --- a/man/curs_inch.3x +++ b/man/curs_inch.3x @@ -1,4 +1,5 @@ -.\" $Id: curs_inch.3x,v 1.7 1997/01/05 01:29:23 tom Exp $ +'\" t +.\" $Id: curs_inch.3x,v 1.8 1997/12/13 22:36:42 tom Exp $ .TH curs_inch 3X "" .SH NAME \fBinch\fR, \fBwinch\fR, \fBmvinch\fR, \fBmvwinch\fR @@ -28,7 +29,7 @@ The following bit-masks may be AND-ed with characters returned by \fBwinch\fR. l l . \fBA_CHARTEXT\fR Bit-mask to extract character \fBA_ATTRIBUTES\fR Bit-mask to extract attributes -\fBA_COLOR\fR Bit-mask to extract color-pair field information +\fBA_COLOR\fR Bit-mask to extract color-pair field information .TE .SH NOTES Note that all of these routines may be macros. diff --git a/man/curs_inchstr.3x b/man/curs_inchstr.3x index 75c02b2f..27aa4569 100644 --- a/man/curs_inchstr.3x +++ b/man/curs_inchstr.3x @@ -31,7 +31,7 @@ the last argument, return a leading substring at most \fIn\fR characters long (exclusive of the trailing (chtype)0). Constants defined in \fB\fR can be used with the \fB&\fR (logical AND) operator to extract the character or the attribute alone from any position -in the \fIchstr\fR [see curs_inch(3X)]. +in the \fIchstr\fR [see \fBcurs_inch\fR(3X)]. .SH RETURN VALUE All routines return the integer \fBERR\fR upon failure and an integer value other than \fBERR\fR upon successful completion (the number of characters diff --git a/man/curs_inopts.3x b/man/curs_inopts.3x index 64d0dad4..4c8ce18d 100644 --- a/man/curs_inopts.3x +++ b/man/curs_inopts.3x @@ -1,3 +1,4 @@ +.\" $Id: curs_inopts.3x,v 1.7 1997/12/14 01:12:04 tom Exp $ .TH curs_inopts 3X "" .SH NAME \fBcbreak\fR, \fBnocbreak\fR, \fBecho\fR, @@ -53,7 +54,8 @@ mode. Initially the terminal may or may not be in \fBcbreak\fR mode, as the mode is inherited; therefore, a program should call \fBcbreak\fR or \fBnocbreak\fR explicitly. Most interactive programs using \fBcurses\fR set the \fBcbreak\fR -mode. Note that \fBcbreak\fR overrides \fBraw\fR. [See curs_getch(3X) for a +mode. Note that \fBcbreak\fR overrides \fBraw\fR. +[See \fBcurs_getch\fR(3X) for a discussion of how these routines interact with \fBecho\fR and \fBnoecho\fR.] The \fBecho\fR and \fBnoecho\fR routines control whether characters typed by @@ -61,7 +63,8 @@ the user are echoed by \fBgetch\fR as they are typed. Echoing by the tty driver is always disabled, but initially \fBgetch\fR 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 \fBnoecho\fR. [See curs_getch(3X) for a +they disable echoing by calling \fBnoecho\fR. +[See \fBcurs_getch\fR(3X) for a discussion of how these routines interact with \fBcbreak\fR and \fBnocbreak\fR.] diff --git a/man/curs_kernel.3x b/man/curs_kernel.3x index ffba687f..7ea34b7c 100644 --- a/man/curs_kernel.3x +++ b/man/curs_kernel.3x @@ -3,7 +3,7 @@ \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 \fBxscurses\fR routines +\fBcurs_set\fR, \fBnapms\fR - low-level \fBcurses\fR routines .SH SYNOPSIS \fB#include \fR @@ -70,7 +70,7 @@ at the beginning, do its manipulation of its own windows, do a \fBdoupdate\fR. The \fBripoffline\fR routine provides access to the same facility that -\fBslk_init\fR [see curs_slk(3X)] uses to reduce the size of the +\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 \fBnewterm\fR is called. If \fIline\fR is positive, a line is removed from the top of \fBstdscr\fR; if \fIline\fR is negative, a line is diff --git a/man/curs_mouse.3x b/man/curs_mouse.3x index ad7d601d..1bc30870 100644 --- a/man/curs_mouse.3x +++ b/man/curs_mouse.3x @@ -1,4 +1,5 @@ '\" t +.'" $Id: curs_mouse.3x,v 0.7 1997/12/13 22:36:24 tom Exp $ .TH curs_mouse 3X "" .SH NAME \fBgetmouse\fR, \fBungetmouse\fR, @@ -30,7 +31,7 @@ MEVENT;\fR .br .SH DESCRIPTION These functions provide an interface to mouse events from -\fBncurses\fR(3x). Mouse events are represented by \fBKEY_MOUSE\fR +\fBncurses\fR(3X). Mouse events are represented by \fBKEY_MOUSE\fR pseudo-key values in the \fBwgetch\fR input stream. To make mouse events visible, use the \fBmousemask\fR function. This will set @@ -51,24 +52,24 @@ l l _ _ l l. \fIName\fR \fIDescription\fR -BUTTON1_PRESSED mouse button 1 down +BUTTON1_PRESSED mouse button 1 down BUTTON1_RELEASED mouse button 1 up -BUTTON1_CLICKED mouse button 1 clicked +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_PRESSED mouse button 2 down BUTTON2_RELEASED mouse button 2 up -BUTTON2_CLICKED mouse button 2 clicked +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_PRESSED mouse button 3 down BUTTON3_RELEASED mouse button 3 up -BUTTON3_CLICKED mouse button 3 clicked +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_PRESSED mouse button 4 down BUTTON4_RELEASED mouse button 4 up -BUTTON4_CLICKED mouse button 4 clicked +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 @@ -112,7 +113,7 @@ termination. All routines return the integer \fBERR\fR upon failure or \fBOK\fR upon successful completion. .SH PORTABILITY -These calls were designed for \fBncurses\fR(3x), and are not found in SVr4 +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. The feature macro \fBNCURSES_MOUSE_VERSION\fR is provided so the preprocessor @@ -124,11 +125,11 @@ incremented. The order of the \fBMEVENT\fR structure members is not guaranteed. Additional fields may be added to the structure in the future. -Under \fBncurses\fR(3x), these calls are implemented using either +Under \fBncurses\fR(3X), these calls are implemented using either xterm's built-in mouse-tracking API or Alessandro Rubini's gpm server. If you are using something other than xterm there is no gpm daemon running on your machine, mouse events will not be visible to -\fBncurses\fR(3x) (and the \fBwmousemask\fR function will always +\fBncurses\fR(3X) (and the \fBwmousemask\fR function will always return \fB0\fR). The z member in the event structure is not presently used. It is intended diff --git a/man/curs_outopts.3x b/man/curs_outopts.3x index d8e4189a..30906151 100644 --- a/man/curs_outopts.3x +++ b/man/curs_outopts.3x @@ -1,3 +1,4 @@ +.\" $Id: curs_outopts.3x,v 1.10 1998/02/07 21:56:39 tom Exp $ .TH curs_outopts 3X "" .SH NAME \fBclearok\fR, \fBidlok\fR, \fBidcok immedok\fR, @@ -118,6 +119,10 @@ enabled, any window modification triggering a scroll also forced a physical refresh. XSI Curses does not require this, and \fBncurses\fR avoids doing it in order to perform better vertical-motion optimization at \fBwrefresh\fR time. + +The XSI Curses standard does not mention that the cursor should be +made invisible as a side-effect of \fBleaveok\fR. +SVr4 curses does this. .SH NOTES Note that \fBclearok\fR, \fBleaveok\fR, \fBscrollok\fR, \fBidcok\fR, \fBnl\fR, \fBnonl\fR and \fBsetscrreg\fR may be macros. diff --git a/man/curs_print.3x b/man/curs_print.3x index 19851b99..20e9ce53 100644 --- a/man/curs_print.3x +++ b/man/curs_print.3x @@ -1,3 +1,4 @@ +.'" $Id: curs_print.3x,v 1.2 1997/12/06 22:07:19 tom Exp $ .TH curs_print 3X "" .SH NAME \fBmcprint\fR - ship binary data to printer @@ -30,7 +31,7 @@ Couldn't allocate sufficient memory to buffer the printer write. When \fBmcprint\fR succeeds, it returns the number of characters actually sent to the printer. .SH PORTABILITY -The \fBmcprint\fR call was designed for \fBncurses\fR(3x), and is not found +The \fBmcprint\fR call was designed for \fBncurses\fR(3X), and is not found in SVr4 curses, 4.4BSD curses, or any other previous version of curses. .SH BUGS Padding in the \fBmc5p\fR, \fBmc4\fR and \fBmc5\fR capabilities will not be diff --git a/man/curs_refresh.3x b/man/curs_refresh.3x index 77bae2ee..e00fc92e 100644 --- a/man/curs_refresh.3x +++ b/man/curs_refresh.3x @@ -1,3 +1,4 @@ +.\" $Id: curs_refresh.3x,v 1.6 1997/11/29 20:11:26 tom Exp $ .TH curs_refresh 3X "" .SH NAME \fBrefresh\fR, \fBwrefresh\fR, \fBwnoutrefresh\fR, @@ -55,10 +56,9 @@ changed. (But see the section on \fBPORTABILITY\fR below for a warning about exploiting this behavior.) 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) then does a refresh -of the window. The routine \fBredrawwin\fR() touches the entire window and then -refreshes it. +are corrupted and should be thrown away before anything is written over them. +It touches the indicated lines (marking them changed). +The routine \fBredrawwin\fR() touches the entire window. .SH RETURN VALUE 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 diff --git a/man/curs_scanw.3x b/man/curs_scanw.3x index 6ce1c0d2..48144ac3 100644 --- a/man/curs_scanw.3x +++ b/man/curs_scanw.3x @@ -1,3 +1,4 @@ +.\" $Id: curs_scanw.3x,v 1.6 1997/12/14 01:04:36 tom Exp $ .TH curs_scanw 3X "" .SH NAME \fBscanw\fR, \fBwscanw\fR, \fBmvscanw\fR, @@ -39,7 +40,7 @@ The XSI Curses standard, Issue 4 describes these functions. The function \fBvwscanw\fR is marked TO BE WITHDRAWN, and is to be replaced by a function \fBvw_scanw\fR using the \fB\fR interface. .SH SEE ALSO -\fBcurses\fR(3X), \fBcurs_getstr\fR, \fBcurs_printw\fR, \fBscanf\fR(3S) +\fBcurses\fR(3X), \fBcurs_getstr\fR(3X), \fBcurs_printw\fR(3X), \fBscanf\fR(3S) .\"# .\"# The following sets edit modes for GNU EMACS .\"# Local Variables: diff --git a/man/curs_termcap.3x b/man/curs_termcap.3x index 23a3ba06..77e340e2 100644 --- a/man/curs_termcap.3x +++ b/man/curs_termcap.3x @@ -43,7 +43,7 @@ The \fBtgetstr\fR routine returns the string entry for \fIid\fR. Use The \fBtgoto\fR routine instantiates the parameters into the given capability. The output from this routine is to be passed to \fBtputs\fR. -The \fBtputs\fR routine is described on the curs_\fBterminfo\fR(3X) manual +The \fBtputs\fR routine is described on the \fBcurs_terminfo\fR(3X) manual page. It can retrieve capabilities by either termcap or terminfo name. .SH RETURN VALUE @@ -71,7 +71,7 @@ Neither the XSI Curses standard nor the SVr4 man pages documented the return values of \fBtgetent\fR correctly, though all three were in fact returned ever since SVr1. .SH SEE ALSO -\fBcurses\fR(3X), \fBcurs_terminfo(\*n), putc(3S).\fR +\fBcurses\fR(3X), \fBterminfo\fR(\*n), \fBputc\fR(3S). .\"# .\"# The following sets edit modes for GNU EMACS .\"# Local Variables: diff --git a/man/curs_terminfo.3x b/man/curs_terminfo.3x index 1b31a02d..fa3fd0d8 100644 --- a/man/curs_terminfo.3x +++ b/man/curs_terminfo.3x @@ -1,4 +1,4 @@ -.\" $Id: curs_terminfo.3x,v 1.6 1996/06/15 22:45:50 tom Exp $ +.\" $Id: curs_terminfo.3x,v 1.7 1997/08/30 12:48:49 tom Exp $ .TH curs_terminfo 3X "" .ds n 5 .SH NAME @@ -24,8 +24,6 @@ interfaces to terminfo database .br \fBchar *tparm(const char *str, ...);\fR .br -\fBchar *tparam(const char *str, char *buffer, int size, ...);\fR -.br \fBint tputs(const char *str, int affcnt, int (*putc)(int));\fR .br \fBint putp(const char *str);\fR @@ -125,10 +123,6 @@ The \fBtparm\fR routine instantiates the string \fIstr\fR with parameters \fIpi\fR. A pointer is returned to the result of \fIstr\fR with the parameters applied. -The \fBtparam\fR routine is included for compatibility with the GNU termcap -implementation. It works like \fBtparm\fR but you specify a buffer and buffer -size to be filled with the expanded string. - The \fBtputs\fR routine applies padding information to the string \fIstr\fR and outputs it. The \fIstr\fR must be a terminfo string variable or the return value from \fBtparm\fR, \fBtgetstr\fR, or diff --git a/man/define_key.3x b/man/define_key.3x new file mode 100644 index 00000000..79a82052 --- /dev/null +++ b/man/define_key.3x @@ -0,0 +1,69 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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 1997 +.\" +.\" $Id: define_key.3x,v 1.4 1998/02/11 12:13:48 tom Exp $ +.TH define_key 3X "" +. +.SH NAME +\fBdefine_key\fP \- define a keycode +. +.SH SYNOPSIS +\fB#include \fP + +\fBint define_key(char *definition, int keycode);\fP +. +.SH DESCRIPTION +This is an extension to the curses library. +It permits an application to define keycodes with their corresponding control +strings, so that the ncurses library will interpret them just as it would +the predefined codes in the terminfo database. +.PP +If the given string is null, any existing definition for the keycode is +removed. +. +.SH RETURN VALUE +The keycode must be greater than zero, else ERR is returned. +. +.SH 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 conditioned using NCURSES_VERSION. +. +.SH SEE ALSO +\fBkeyok\fR(3X). +. +.SH AUTHOR +Thomas Dickey. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/dft_fgbg.3x b/man/dft_fgbg.3x index 92196b75..a3bf14b4 100644 --- a/man/dft_fgbg.3x +++ b/man/dft_fgbg.3x @@ -1,27 +1,38 @@ -.\"***************************************************************************** -.\" Copyright 1997 by Thomas E. Dickey * -.\" All Rights Reserved. * -.\" * -.\" Permission to use, copy, modify, and distribute this software and its * -.\" documentation for any purpose and without fee is hereby granted, provided * -.\" that the above copyright notice appear in all copies and that both that * -.\" copyright notice and this permission notice appear in supporting * -.\" documentation, and that the name of the above listed copyright holder(s) * -.\" not be used in advertising or publicity pertaining to distribution of the * -.\" software without specific, written prior permission. THE ABOVE LISTED * -.\" COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * -.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * -.\" EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * -.\" SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * -.\" RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * -.\" CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * -.\" CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * -.\"***************************************************************************** -.\" $Id: dft_fgbg.3x,v 1.1 1997/01/19 02:51:30 tom Exp $ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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 1997 +.\" +.\" $Id: dft_fgbg.3x,v 1.5 1998/02/11 12:13:48 tom Exp $ .TH use_default_colors 3X "" . .SH NAME -\fBuse_default_colors\fP \- use terminal's default colors +\fBdft_fgbg\fR \- use terminal's default colors . .SH SYNOPSIS \fB#include \fP @@ -50,7 +61,7 @@ If the \fIinitialize_pair\fP capability is found, this causes an error as well. . .SH NOTES -Associated with this extension, the \fBinit_pair\fP(3x) function accepts +Associated with this extension, the \fBinit_pair\fR(3X) function accepts negative arguments to specify default foreground or background colors. . @@ -60,7 +71,7 @@ Version 7, BSD or System V implementations. It is recommended that any code depending on them be conditioned using NCURSES_VERSION. . .SH SEE ALSO -\fBcurs_color\fP(3x), +\fBcurs_color\fR(3X), \fBded\fP(1). . .SH AUTHOR diff --git a/man/form.3x b/man/form.3x index 36ce7612..c7c751cb 100644 --- a/man/form.3x +++ b/man/form.3x @@ -1,25 +1,26 @@ '\" t -.TH forms 3X "" +.\" $Id: form.3x,v 0.8 1997/12/14 01:44:04 tom Exp $ +.TH form 3X "" .SH NAME -\fBforms\fR - curses extension for programming forms +\fBform\fR - curses extension for programming forms .SH SYNOPSIS \fB#include \fR .br .SH DESCRIPTION -The \fBforms\fR library provides terminal-independent facilities for composing +The \fBform\fR library provides terminal-independent facilities for composing form screens on character-cell terminals. The library includes: field routines, which create and modify form fields; and form routines, which group fields into forms, display forms on the screen, and handle interaction with the user. -The \fBforms\fR library uses the \fBcurses\fR libraries, and a curses +The \fBform\fR library uses the \fBcurses\fR libraries, and a curses initialization routine such as \fBinitscr\fR must be called before using any of -these functions. To use the \fBforms\fR library, link with the options +these functions. To use the \fBform\fR library, link with the options \fB-lform -lcurses\fR. .SS Current Default Values for Field Attributes -The \fBforms\fR library maintains a default value for field attributes. You +The \fBform\fR library maintains a default value for field attributes. You can get or set this default by calling the appropriate \fBget_\fR or \fBset_\fR routine with a \fBNULL\fR field pointer. Changing this default with a \fBset_\fR function affects future field creations, but does not change the @@ -35,77 +36,77 @@ l l l l . \fBcurses\fR Routine Name Manual Page Name = -\fBcurrent_field\fR form_page(3X) -\fBdata_ahead\fR form_data(3X) -\fBdata_behind\fR form_data(3X) -\fBdup_field\fR form_field_new(3X) -\fBdynamic_fieldinfo\fR form_field_info(3X) -\fBfield_arg\fR form_field_validation(3X) -\fBfield_back\fR form_field_attributes(3X) -\fBfield_buffer\fR form_field_buffer(3X) -\fBfield_count\fR form_field(3X) -\fBfield_fore\fR form_field_attributes(3X) -\fBfield_index\fR form_page(3X) -\fBfield_info\fR form_field_info(3X) -\fBfield_init\fR form_hook(3X) -\fBfield_just\fR form_field_just(3X) -\fBfield_opts\fR form_field_opts(3X) -\fBfield_opts_off\fR form_field_opts(3X) -\fBfield_opts_on\fR form_field_opts(3X) -\fBfield_pad\fR form_field_attributes(3X) -\fBfield_status\fR form_field_buffer(3X) -\fBfield_term\fR form_hook(3X) -\fBfield_type\fR form_field_validation(3X) -\fBfield_userptr\fR form_field_userptr(3X) -\fBform_driver\fR form_driver(3X) -\fBform_fields\fR form_field(3X) -\fBform_init\fR form_hook(3X) -\fBform_opts\fR form_opts(3X) -\fBform_opts_off\fR form_opts(3X) -\fBform_opts_on\fR form_opts(3X) -\fBform_page\fR form_page(3X) -\fBform_request_by_name\fR form_requestname(3X) -\fBform_request_name\fR form_requestname(3X) -\fBform_sub\fR form_win(3X) -\fBform_term\fR form_hook(3X) -\fBform_userptr\fR form_userptr(3X) -\fBform_win\fR form_win(3X) -\fBfree_field\fR form_field_new(3X) -\fBfree_form\fR form_new(3X) -\fBlink_field\fR form_field_new(3X) -\fBlink_fieldtype\fR link_fieldtype(3X) -\fBmove_field\fR form_field(3X) -\fBnew_field\fR form_field_new(3X) -\fBnew_form\fR form_new(3X) -\fBnew_page\fR form_new_page(3X) -\fBpos_form_cursor\fR form_cursor(3X) -\fBpost_form\fR form_post(3X) -\fBscale_form\fR form_win(3X) -\fBset_current_field\fR form_page(3X) -\fBset_field_back\fR form_field_attributes(3X) -\fBset_field_buffer\fR form_field_buffer(3X) -\fBset_field_fore\fR form_field_attributes(3X) -\fBset_field_init\fR form_hook(3X) -\fBset_field_just\fR form_field_just(3X) -\fBset_field_opts\fR form_field_opts(3X) -\fBset_field_pad\fR form_field_attributes(3X) -\fBset_field_status\fR form_field_buffer(3X) -\fBset_field_term\fR form_hook(3X) -\fBset_field_type\fR form_field_validation(3X) -\fBset_field_userptr\fR form_field_userptr(3X) -\fBset_fieldtype_arg\fR form_fieldtype(3X) -\fBset_fieldtype_choice\fR form_fieldtype(3X) -\fBset_form_fields\fR form_field(3X) -\fBset_form_init\fR form_hook(3X) -\fBset_form_opts\fR form_field_opts(3X) -\fBset_form_page\fR form_page(3X) -\fBset_form_sub\fR form_win(3X) -\fBset_form_term\fR form_hook(3X) -\fBset_form_userptr\fR form_userptr(3X) -\fBset_form_win\fR form_win(3X) -\fBset_max_field\fR form_field_buffer(3X) -\fBset_new_page\fR form_new_page(3X) -\fBunpost_form\fR form_post(3X) +current_field \fBform_page\fR(3X) +data_ahead \fBform_data\fR(3X) +data_behind \fBform_data\fR(3X) +dup_field \fBform_field_new\fR(3X) +dynamic_fieldinfo \fBform_field_info\fR(3X) +field_arg \fBform_field_validation\fR(3X) +field_back \fBform_field_attributes\fR(3X) +field_buffer \fBform_field_buffer\fR(3X) +field_count \fBform_field\fR(3X) +field_fore \fBform_field_attributes\fR(3X) +field_index \fBform_page\fR(3X) +field_info \fBform_field_info\fR(3X) +field_init \fBform_hook\fR(3X) +field_just \fBform_field_just\fR(3X) +field_opts \fBform_field_opts\fR(3X) +field_opts_off \fBform_field_opts\fR(3X) +field_opts_on \fBform_field_opts\fR(3X) +field_pad \fBform_field_attributes\fR(3X) +field_status \fBform_field_buffer\fR(3X) +field_term \fBform_hook\fR(3X) +field_type \fBform_field_validation\fR(3X) +field_userptr \fBform_field_userptr\fR(3X) +form_driver \fBform_driver\fR(3X) +form_fields \fBform_field\fR(3X) +form_init \fBform_hook\fR(3X) +form_opts \fBform_opts\fR(3X) +form_opts_off \fBform_opts\fR(3X) +form_opts_on \fBform_opts\fR(3X) +form_page \fBform_page\fR(3X) +form_request_by_name \fBform_requestname\fR(3X) +form_request_name \fBform_requestname\fR(3X) +form_sub \fBform_win\fR(3X) +form_term \fBform_hook\fR(3X) +form_userptr \fBform_userptr\fR(3X) +form_win \fBform_win\fR(3X) +free_field \fBform_field_new\fR(3X) +free_form \fBform_new\fR(3X) +link_field \fBform_field_new\fR(3X) +link_fieldtype \fBform_fieldtype\fR(3X) +move_field \fBform_field\fR(3X) +new_field \fBform_field_new\fR(3X) +new_form \fBform_new\fR(3X) +new_page \fBform_new_page\fR(3X) +pos_form_cursor \fBform_cursor\fR(3X) +post_form \fBform_post\fR(3X) +scale_form \fBform_win\fR(3X) +set_current_field \fBform_page\fR(3X) +set_field_back \fBform_field_attributes\fR(3X) +set_field_buffer \fBform_field_buffer\fR(3X) +set_field_fore \fBform_field_attributes\fR(3X) +set_field_init \fBform_hook\fR(3X) +set_field_just \fBform_field_just\fR(3X) +set_field_opts \fBform_field_opts\fR(3X) +set_field_pad \fBform_field_attributes\fR(3X) +set_field_status \fBform_field_buffer\fR(3X) +set_field_term \fBform_hook\fR(3X) +set_field_type \fBform_field_validation\fR(3X) +set_field_userptr \fBform_field_userptr\fR(3X) +set_fieldtype_arg \fBform_fieldtype\fR(3X) +set_fieldtype_choice \fBform_fieldtype\fR(3X) +set_form_fields \fBform_field\fR(3X) +set_form_init \fBform_hook\fR(3X) +set_form_opts \fBform_field_opts\fR(3X) +set_form_page \fBform_page\fR(3X) +set_form_sub \fBform_win\fR(3X) +set_form_term \fBform_hook\fR(3X) +set_form_userptr \fBform_userptr\fR(3X) +set_form_win \fBform_win\fR(3X) +set_max_field \fBform_field_buffer\fR(3X) +set_new_page \fBform_new_page\fR(3X) +unpost_form \fBform_post\fR(3X) .TE .SH RETURN VALUE Routines that return pointers return \fBNULL\fR on error. Routines that return diff --git a/man/form_driver.3x b/man/form_driver.3x index 6a6acc7b..b5f269b5 100644 --- a/man/form_driver.3x +++ b/man/form_driver.3x @@ -1,4 +1,4 @@ -'\" t +.'" $Id: form_driver.3x,v 0.5 1997/12/14 01:26:33 tom Exp $ .TH form_driver 3X "" .SH NAME \fBform_driver\fR - command-processing loop of the form system @@ -226,7 +226,7 @@ Contents of field is invalid. \fBE_REQUEST_DENIED\fR The form driver could not process the request. .SH SEE ALSO -\fBcurses\fR(3X), \fBforms\fR(3x). +\fBcurses\fR(3X), \fBform\fR(3X). .SH NOTES The header file \fB\fR automatically includes the header files \fB\fR. diff --git a/man/form_field_buffer.3x b/man/form_field_buffer.3x index d1a32aaa..b1cbe60f 100644 --- a/man/form_field_buffer.3x +++ b/man/form_field_buffer.3x @@ -19,7 +19,7 @@ int set_max_field(FIELD *field, int max); The function \fBset_field_buffer\fR sets the numbered buffer of the given field to contain a given string. Buffer 0 is the displayed value of the field; other numbered buffers may be allocated by applications through the \fBnbuf\fR -argument of (see \fBfield_new\fR(3X)) but are not manipulated by the forms +argument of (see \fBform_field_new\fR(3X)) but are not manipulated by the forms library. The function \fBfield_buffer\fR returns the foreground attribute. The function \fBset_field_status\fR sets the associated status flag of diff --git a/man/form_field_new.3x b/man/form_field_new.3x index af2dcad5..601a1d5e 100644 --- a/man/form_field_new.3x +++ b/man/form_field_new.3x @@ -1,3 +1,4 @@ +.'" $Id: form_field_new.3x,v 0.6 1997/12/06 22:07:19 tom Exp $ '\" t .TH form_field_new 3X "" .SH NAME @@ -54,7 +55,7 @@ These routines emulate the System V forms library. They were not supported on Version 7 or BSD versions. It may be unwise to count on the set of attributes copied by -\fBdup_field\fR(3x) being portable; the System V forms library documents are +\fBdup_field\fR(3X) being portable; the System V forms library documents are not very explicit on what gets copied and was not. .SH AUTHORS Juergen Pfeifer. Manual pages and adaptation for new curses by Eric diff --git a/man/form_field_opts.3x b/man/form_field_opts.3x index d3dc8db1..189ad000 100644 --- a/man/form_field_opts.3x +++ b/man/form_field_opts.3x @@ -33,7 +33,8 @@ suppressed, .TP 5 O_ACTIVE The field is visited during processing. If this option is off, the field will -not be reachable by navigation keys. +not be reachable by navigation keys. Please notice that an invisible field +appears to be inactive also. .TP 5 O_PUBLIC The field contents are displayed as data is entered. diff --git a/man/form_field_userptr.3x b/man/form_field_userptr.3x index f2d7bd9d..e6becce6 100644 --- a/man/form_field_userptr.3x +++ b/man/form_field_userptr.3x @@ -5,9 +5,9 @@ .SH SYNOPSIS \fB#include \fR .br -int set_field_userptr(FIELD *field, const void*userptr); +int set_field_userptr(FIELD *field, void*userptr); .br -const void *field_userptr(const FIELD *field); +void *field_userptr(const FIELD *field); .br .SH DESCRIPTION Every form field has a field that can be used to hold application-specific data diff --git a/man/form_field_validation.3x b/man/form_field_validation.3x index 8fee91d0..e67c4135 100644 --- a/man/form_field_validation.3x +++ b/man/form_field_validation.3x @@ -1,4 +1,4 @@ -'\" t +.'" $Id: form_field_validation.3x,v 0.9 1997/12/06 22:08:27 tom Exp $ .TH form_field_validation 3X "" .SH NAME \fBform_field_validation\fR - data type validation for fields @@ -54,7 +54,7 @@ For details of the precision handling see \fBprintf's\fR man-page. TYPE_REGEXP Regular expression data. Requires a regular expression \fB(char *)\fR third argument; the data is valid if the regular expression matches it. Regular expressions -are in the format of \fBregcomp\fR(3x) and \fBregexec\fR(3X). Please notice +are in the format of \fBregcomp\fR(3X) and \fBregexec\fR(3X). Please notice that the regular expression must match the whole field. If you have for example an eight character wide field, a regular expression "^[0-9]*$" always means that you have to fill all eight positions with digits. If you want to diff --git a/man/form_fieldtype.3x b/man/form_fieldtype.3x index a6697eed..217efa68 100644 --- a/man/form_fieldtype.3x +++ b/man/form_fieldtype.3x @@ -46,7 +46,10 @@ list of arguments you give \fBset_field_type\fR when attaching validation to a field; its job is to bundle these into an allocated argument-block object which can later be passed to validation predicated. The other two hook arguments should copy and free argument-block structures. They will -be used by the forms-driver code. +be used by the forms-driver code. You must supply the \fImak_arg\fR function, +the other two are optional, you may supply NULL for them. In this case it +is assumed, that \fImak_arg\fR doesn't allocate memory but simply loads the +argument into a single scalar value. The form driver requests \fBREQ_NEXT_CHOICE\fR and \fBREQ_PREV_CHOICE\fR assume that the possible values of a field form an ordered set, and provide the forms diff --git a/man/form_userptr.3x b/man/form_userptr.3x index b32963d4..b5c16bd6 100644 --- a/man/form_userptr.3x +++ b/man/form_userptr.3x @@ -5,9 +5,9 @@ .SH SYNOPSIS \fB#include \fR .br -int set_form_userptr(FORM *form, const void *userptr); +int set_form_userptr(FORM *form, void *userptr); .br -const void* form_userptr(const FORM *form); +void* form_userptr(const FORM *form); .br .SH DESCRIPTION Every form and every form item has a field that can be used to hold diff --git a/man/infocmp.1m b/man/infocmp.1m index 3c714e57..563f5971 100644 --- a/man/infocmp.1m +++ b/man/infocmp.1m @@ -1,5 +1,5 @@ '\" t -.\" $Id: infocmp.1m,v 1.12 1997/01/05 00:47:22 tom Exp $ +.\" $Id: infocmp.1m,v 1.13 1997/12/06 22:14:28 tom Exp $ .TH infocmp 1M "" .ds n 5 .ds d @DATADIR@/terminfo @@ -283,10 +283,10 @@ 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 -r -RBSD. .SH BUGS -The -F option of \fBinfocmp\fR(1m) should be a \fBtoe\fR(1m) mode. +The -F 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), +\fBinfocmp\fR(1M), \fBcaptoinfo\fR(1M), \fBinfotocap\fR(1M), +\fBtic\fR(1M), \fBtoe\fR(1M), \fBcurses\fR(3X), \fBterminfo\fR(\*n). .SH AUTHOR Eric S. Raymond diff --git a/man/keyok.3x b/man/keyok.3x new file mode 100644 index 00000000..370af42b --- /dev/null +++ b/man/keyok.3x @@ -0,0 +1,70 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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 1997 +.\" +.\" $Id: keyok.3x,v 1.4 1998/02/11 12:13:47 tom Exp $ +.TH keyok 3X "" +. +.SH NAME +\fBkeyok\fP \- enable or disable a keycode +. +.SH SYNOPSIS +\fB#include \fP + +\fBint keyok(int keycode, bool enable);\fP +. +.SH DESCRIPTION +This is an extension to the curses library. +It permits an application to disable specific keycodes, rather than +use the \fIkeypad\fP function to disable all keycodes. +Keys that have been disabled can be reenabled. +. +.SH RETURN VALUE +The keycode must be greater than zero, else ERR is returned. +If it does not correspond to a defined key, then ERR is returned. +If the \fIenable\fP parameter is true, then the key must have been disabled, +and vice versa. +Otherwise, the function returns OK. +. +.SH 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 conditioned using NCURSES_VERSION. +. +.SH SEE ALSO +\fBdefine_key\fR(3X). +. +.SH AUTHOR +Thomas Dickey. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/make_sed.sh b/man/make_sed.sh new file mode 100755 index 00000000..c6c37c25 --- /dev/null +++ b/man/make_sed.sh @@ -0,0 +1,83 @@ +#!/bin/sh +# $Id: make_sed.sh,v 1.5 1998/02/11 12:13:48 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1997 +# +# Construct a sed-script to perform renaming within man-pages. Originally +# written in much simpler form, this one accounts for the common cases of +# section-names in man-pages. + +if test $# != 1 ; then + echo '? expected a single filename' + exit 1 +fi + +COL=col$$ +INPUT=input$$ +UPPER=upper$$ +SCRIPT=script$$ +RESULT=result$$ +rm -f $UPPER $SCRIPT $RESULT +trap "rm -f $COL.* $INPUT $UPPER $SCRIPT $RESULT" 0 1 2 5 15 +fgrep -v \# $1 | \ +sed -e 's/[ ]\+/ /g' >$INPUT + +for F in 1 2 3 4 +do +sed -e 's/\./ /g' $INPUT | \ +cut -f $F > $COL.$F +done +for F in 2 4 +do + tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ <$COL.$F >$UPPER + mv $UPPER $COL.$F +done +paste $COL.* | \ +sed -e 's/^/s\/\\$UPPER + +# Do the TH lines +sed -e 's/\//\/TH /' \ + -e 's/ / /' \ + -e 's/ / ""\/TH /' \ + -e 's/ / /' \ + -e 's/\/$/ ""\//' \ + $UPPER >>$RESULT + +# Do the embedded references +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 f60f94ed..b7cb95de 100644 --- a/man/man_db.renames +++ b/man/man_db.renames @@ -1,8 +1,8 @@ -# $Id: man_db.renames,v 0.4 1996/09/07 14:53:01 tom Exp $ +# $Id: man_db.renames,v 0.10 1997/12/14 00:25:28 tom Exp $ # Manual-page renamings for the man_db program # -captoinfo.1m captoinfo.1m -clear.1 clear.1m +captoinfo.1m captoinfo.1 +clear.1 clear.1 curs_addch.3x addch.3ncurses curs_addchstr.3x addchstr.3ncurses curs_addstr.3x addstr.3ncurses @@ -34,7 +34,8 @@ curs_print.3x print.3ncurses curs_printw.3x printw.3ncurses curs_refresh.3x refresh.3ncurses curs_scanw.3x scanw.3ncurses -curs_scr_dmp.3x scr_dmp.3ncurses +curs_scr_dmp.3x scr_dump.3ncurses +curs_scr_dump.3x scr_dump.3ncurses curs_scroll.3x scroll.3ncurses curs_slk.3x slk.3ncurses curs_termattrs.3x termattrs.3ncurses @@ -43,6 +44,9 @@ curs_terminfo.3x terminfo.3ncurses curs_touch.3x touch.3ncurses curs_util.3x util.3ncurses curs_window.3x window.3ncurses +curses.3x ncurses.3ncurses +define_key.3x define_key.3ncurses +dft_fgbg.3x dft_fgbg.3ncurses form.3x form.3form form_cursor.3x cursor.3form form_data.3x data.3form @@ -66,7 +70,8 @@ form_post.3x post.3form form_requestname.3x requestname.3form form_userptr.3x userptr.3form form_win.3x win.3form -infocmp.1m infocmp.1m +infocmp.1m infocmp.1 +keyok.3x keyok.3ncurses menu.3x menu.3menu menu_attribs.3x attribs.3menu menu_cursor.3x cursor.3menu @@ -96,8 +101,8 @@ resizeterm.3x resizeterm.3ncurses term.5 term.5 term.7 term.7 terminfo.5 terminfo.5 -tic.1m tic.1m -toe.1m toe.1m +tic.1m tic.1 +toe.1m toe.1 tput.1 tput.1 tset.1 tset.1 wresize.3x wresize.3ncurses diff --git a/man/menu.3x b/man/menu.3x index ace2b7d3..3403ba30 100644 --- a/man/menu.3x +++ b/man/menu.3x @@ -1,25 +1,25 @@ '\" t -.\" $Id: menu.3x,v 1.9 1997/01/05 01:23:39 tom Exp $ -.TH menus 3X "" +.\" $Id: menu.3x,v 1.10 1997/12/14 01:45:52 tom Exp $ +.TH menu 3X "" .SH NAME -\fBmenus\fR - curses extension for programming menus +\fBmenu\fR - curses extension for programming menus .SH SYNOPSIS \fB#include \fR .br .SH DESCRIPTION -The \fBmenus\fR library provides terminal-independent facilities for composing +The \fBmenu\fR library provides terminal-independent facilities for composing menu systems on character-cell terminals. The library includes: item routines, which create and modify menu items; and menu routines, which group items into menus, display menus on the screen, and handle interaction with the user. -The \fBmenus\fR library uses the \fBcurses\fR libraries, and a curses +The \fBmenu\fR library uses the \fBcurses\fR libraries, and a curses initialization routine such as \fBinitscr\fR must be called before using any of -these functions. To use the \fBmenus\fR library, link with the options +these functions. To use the \fBmenu\fR library, link with the options \fB-lmenu -lcurses\fR. .SS Current Default Values for Item Attributes -The \fBmenus\fR library maintains a default value for item attributes. You can +The \fBmenu\fR library maintains a default value for item attributes. You can get or set this default by calling the appropriate \fBget_\fR or \fBset_\fR routine with a \fBNULL\fR item pointer. Changing this default with a \fBset_\fR function affects future item creations, but does not change the @@ -34,70 +34,70 @@ the manual page on which it is described. l l . \fBcurses\fR Routine Name Manual Page Name = -\fBcurrent_item\fR mitem_current(3X) -\fBfree_item\fR mitem_new(3X) -\fBfree_menu\fR menu_new(3X) -\fBitem_count\fR menu_items(3X) -\fBitem_description\fR mitem_name(3X) -\fBitem_index\fR mitem_current(3X) -\fBitem_init\fR menu_hook(3X) -\fBitem_name\fR mitem_name(3X) -\fBitem_opts\fR mitem_opts(3X) -\fBitem_opts_off\fR mitem_opts(3X) -\fBitem_opts_on\fR mitem_opts(3X) -\fBitem_term\fR menu_hook(3X) -\fBitem_userptr\fR mitem_userptr(3X) -\fBitem_value\fR mitem_value(3X) -\fBitem_visible\fR mitem_visible(3X) -\fBmenu_back\fR menu_attribs(3X) -\fBmenu_driver\fR menu_driver(3X) -\fBmenu_fore\fR menu_attribs(3X) -\fBmenu_format\fR menu_format(3X) -\fBmenu_grey\fR menu_attribs(3X) -\fBmenu_init\fR menu_hook(3X) -\fBmenu_items\fR menu_items(3X) -\fBmenu_mark\fR menu_mark(3X) -\fBmenu_opts\fR menu_opts(3X) -\fBmenu_opts_off\fR menu_opts(3X) -\fBmenu_opts_on\fR menu_opts(3X) -\fBmenu_pad\fR menu_attribs(3X) -\fBmenu_pattern\fR menu_pattern(3X) -\fBmenu_request_by_name\fR menu_requestname(3X) -\fBmenu_request_name\fR menu_requestname(3X) -\fBmenu_spacing\fR menu_spacing(3X) -\fBmenu_sub\fR menu_win(3X) -\fBmenu_term\fR menu_hook(3X) -\fBmenu_userptr\fR menu_userptr(3X) -\fBmenu_win\fR menu_win(3X) -\fBnew_item\fR mitem_new(3X) -\fBnew_menu\fR menu_new(3X) -\fBpos_menu_cursor\fR menu_cursor(3X) -\fBpost_menu\fR menu_post(3X) -\fBscale_menu\fR menu_win(3X) -\fBset_current_item\fR menu_current_item(3X) -\fBset_item_init\fR menu_hook(3X) -\fBset_item_opts\fR mitem_opts(3X) -\fBset_item_term\fR menu_hook(3X) -\fBset_item_userptr\fR mitem_userptr(3X) -\fBset_item_value\fR mitem_value(3X) -\fBset_menu_back\fR menu_attribs(3X) -\fBset_menu_fore\fR menu_attribs(3X) -\fBset_menu_format\fR menu_format(3X) -\fBset_menu_grey\fR menu_attribs(3X) -\fBset_menu_init\fR menu_hook(3X) -\fBset_menu_items\fR menu_items(3X) -\fBset_menu_mark\fR menu_mark(3X) -\fBset_menu_opts\fR mitem_opts(3X) -\fBset_menu_pad\fR menu_attribs(3X) -\fBset_menu_pattern\fR menu_pattern(3X) -\fBset_menu_spacing\fR menu_spacing(3X) -\fBset_menu_sub\fR menu_win(3X) -\fBset_menu_term\fR menu_hook(3X) -\fBset_menu_userptr\fR menu_userptr(3X) -\fBset_menu_win\fR menu_win(3X) -\fBset_top_row\fR mitem_current(3X) -\fBtop_row\fR mitem_current(3X) -\fBunpost_menu\fR menu_post(3X) +current_item \fBmitem_current\fR(3X) +free_item \fBmitem_new\fR(3X) +free_menu \fBmenu_new\fR(3X) +item_count \fBmenu_items\fR(3X) +item_description \fBmitem_name\fR(3X) +item_index \fBmitem_current\fR(3X) +item_init \fBmenu_hook\fR(3X) +item_name \fBmitem_name\fR(3X) +item_opts \fBmitem_opts\fR(3X) +item_opts_off \fBmitem_opts\fR(3X) +item_opts_on \fBmitem_opts\fR(3X) +item_term \fBmenu_hook\fR(3X) +item_userptr \fBmitem_userptr\fR(3X) +item_value \fBmitem_value\fR(3X) +item_visible \fBmitem_visible\fR(3X) +menu_back \fBmenu_attribs\fR(3X) +menu_driver \fBmenu_driver\fR(3X) +menu_fore \fBmenu_attribs\fR(3X) +menu_format \fBmenu_format\fR(3X) +menu_grey \fBmenu_attribs\fR(3X) +menu_init \fBmenu_hook\fR(3X) +menu_items \fBmenu_items\fR(3X) +menu_mark \fBmenu_mark\fR(3X) +menu_opts \fBmenu_opts\fR(3X) +menu_opts_off \fBmenu_opts\fR(3X) +menu_opts_on \fBmenu_opts\fR(3X) +menu_pad \fBmenu_attribs\fR(3X) +menu_pattern \fBmenu_pattern\fR(3X) +menu_request_by_name \fBmenu_requestname\fR(3X) +menu_request_name \fBmenu_requestname\fR(3X) +menu_spacing \fBmenu_spacing\fR(3X) +menu_sub \fBmenu_win\fR(3X) +menu_term \fBmenu_hook\fR(3X) +menu_userptr \fBmenu_userptr\fR(3X) +menu_win \fBmenu_win\fR(3X) +new_item \fBmitem_new\fR(3X) +new_menu \fBmenu_new\fR(3X) +pos_menu_cursor \fBmenu_cursor\fR(3X) +post_menu \fBmenu_post\fR(3X) +scale_menu \fBmenu_win\fR(3X) +set_current_item \fBmitem_current\fR(3X) +set_item_init \fBmenu_hook\fR(3X) +set_item_opts \fBmitem_opts\fR(3X) +set_item_term \fBmenu_hook\fR(3X) +set_item_userptr \fBmitem_userptr\fR(3X) +set_item_value \fBmitem_value\fR(3X) +set_menu_back \fBmenu_attribs\fR(3X) +set_menu_fore \fBmenu_attribs\fR(3X) +set_menu_format \fBmenu_format\fR(3X) +set_menu_grey \fBmenu_attribs\fR(3X) +set_menu_init \fBmenu_hook\fR(3X) +set_menu_items \fBmenu_items\fR(3X) +set_menu_mark \fBmenu_mark\fR(3X) +set_menu_opts \fBmitem_opts\fR(3X) +set_menu_pad \fBmenu_attribs\fR(3X) +set_menu_pattern \fBmenu_pattern\fR(3X) +set_menu_spacing \fBmenu_spacing\fR(3X) +set_menu_sub \fBmenu_win\fR(3X) +set_menu_term \fBmenu_hook\fR(3X) +set_menu_userptr \fBmenu_userptr\fR(3X) +set_menu_win \fBmenu_win\fR(3X) +set_top_row \fBmitem_current\fR(3X) +top_row \fBmitem_current\fR(3X) +unpost_menu \fBmenu_post\fR(3X) .TE .SH RETURN VALUE Routines that return pointers return \fBNULL\fR on error. Routines that return diff --git a/man/menu_driver.3x b/man/menu_driver.3x index d6485356..3643703f 100644 --- a/man/menu_driver.3x +++ b/man/menu_driver.3x @@ -1,4 +1,4 @@ -'\" t +.'" $Id: menu_driver.3x,v 1.5 1997/12/14 01:28:42 tom Exp $ .TH menu_driver 3X "" .SH NAME \fBmenu_driver\fR - command-processing loop of the menu system @@ -104,7 +104,7 @@ Character failed to match. \fBE_REQUEST_DENIED\fR The menu driver could not process the request. .SH SEE ALSO -\fBcurses\fR(3X), \fBmenus\fR(3x). +\fBcurses\fR(3X), \fBmenu\fR(3X). .SH NOTES The header file \fB\fR automatically includes the header files \fB\fR. diff --git a/man/menu_format.3x b/man/menu_format.3x index a901a065..1931f798 100644 --- a/man/menu_format.3x +++ b/man/menu_format.3x @@ -11,8 +11,9 @@ int menu_format(const MENU *menu, int *rows, int *cols); .br .SH DESCRIPTION The function \fBset_menu_format\fR sets the maximum display size of the given -window. If this size is too small to display all menu items, the menu will be -made scrollable. +menu. If this size is too small to display all menu items, the menu will be +made scrollable. If this size is larger than the menus subwindow and the +subwindow is too small to display all menu items, \fBpost_menu()\fR will fail. The default format is 16 rows, 1 column. Calling \fBset_menu_format\fR with a null menu pointer will change this default. A zero row or column argument to diff --git a/man/menu_pattern.3x b/man/menu_pattern.3x index 30bc5279..417fd1d4 100644 --- a/man/menu_pattern.3x +++ b/man/menu_pattern.3x @@ -1,4 +1,4 @@ -'\" t +.'" $Id: menu_pattern.3x,v 1.4 1997/12/06 22:10:02 tom Exp $ .TH menu_pattern 3X "" .SH NAME \fBmenu_pattern\fR - get and set a menu's pattern buffer @@ -12,7 +12,7 @@ char *menu_pattern(const MENU *menu); .SH DESCRIPTION Every menu has an associated pattern match buffer. As input events that are printable ASCII characters come in, they are appended to this match buffer -and tested for a match, as described in \fBmenu_driver\fR(3x). +and tested for a match, as described in \fBmenu_driver\fR(3X). The function \fBset_menu_pattern\fR sets the pattern buffer for the given menu and tries to find the first matching item. If it succeeds, that item becomes diff --git a/man/menu_post.3x b/man/menu_post.3x index 0cf8dfd3..cfe45b29 100644 --- a/man/menu_post.3x +++ b/man/menu_post.3x @@ -35,7 +35,8 @@ The menu has already been posted. Routine was called from an initialization or termination function. .TP 5 \fBE_NO_ROOM\fR -Menu is too large for its window. +Menu is too large for its window. You should consider to use +\fBset_menu_format()\fR to solve the problem. .TP 5 \fBE_NOT_POSTED\fR The menu has not been posted. diff --git a/man/menu_userptr.3x b/man/menu_userptr.3x index 30afd616..48040e3d 100644 --- a/man/menu_userptr.3x +++ b/man/menu_userptr.3x @@ -5,9 +5,9 @@ .SH SYNOPSIS \fB#include \fR .br -int set_menu_userptr(MENU *menu, const void *userptr); +int set_menu_userptr(MENU *menu, void *userptr); .br -const void *menu_userptr(const MENU *menu); +void *menu_userptr(const MENU *menu); .br .SH DESCRIPTION Every menu and every menu item has a field that can be used to hold diff --git a/man/mitem_new.3x b/man/mitem_new.3x index e61febfa..c08d05ed 100644 --- a/man/mitem_new.3x +++ b/man/mitem_new.3x @@ -11,9 +11,14 @@ int free_item(ITEM *item); .br .SH DESCRIPTION The function \fBnew_item\fR allocates a new item and initializes it from the -\fBname\fR and \fBdescription\fR pointers. +\fBname\fR and \fBdescription\fR pointers. Please notice that the item stores +only the pointers to the name and description. Those pointers must be valid +during the lifetime of the item. So you should be very carefull with names +or descriptions allocated on the stack of some routines. .br -The function \fBfree_item\fR de-allocates an item. +The function \fBfree_item\fR de-allocates an item. Please notice that it +is the responsibility of the application to release the memory for the +name or the description of the item. .SH RETURN VALUE The function \fBnew_item\fR returns \fBNULL\fR on error. diff --git a/man/mitem_userptr.3x b/man/mitem_userptr.3x index 931b50d4..f3a4007c 100644 --- a/man/mitem_userptr.3x +++ b/man/mitem_userptr.3x @@ -5,9 +5,9 @@ .SH SYNOPSIS \fB#include \fR .br -int set_item_userptr(ITEM *item, const void *userptr); +int set_item_userptr(ITEM *item, void *userptr); .br -const void *item_userptr(const ITEM *item); +void *item_userptr(const ITEM *item); .br .SH DESCRIPTION Every menu item has a field that can be used to hold application-specific data diff --git a/man/mitem_value.3x b/man/mitem_value.3x index 7738767b..a18a014c 100644 --- a/man/mitem_value.3x +++ b/man/mitem_value.3x @@ -1,4 +1,4 @@ -'\" t +.'" $Id: mitem_value.3x,v 1.3 1997/12/06 22:07:49 tom Exp $ .TH mitem_value 3X "" .SH NAME \fBmitem_value\fR - set and get menu item values @@ -11,7 +11,7 @@ bool item_value(const ITEM *item); .br .SH DESCRIPTION If you turn off the menu option \fBO_ONEVALUE\fR (e.g., with -\fBset_menu_opts\fR or \fBmenu_opts_off\fR; see \fBmenu_opts\fR(3x)), the menu +\fBset_menu_opts\fR or \fBmenu_opts_off\fR; see \fBmenu_opts\fR(3X)), the menu becomes multi-valued; that is, more than one item may simultaneously be selected. diff --git a/man/ncurses.3x b/man/ncurses.3x index 0386dba4..4330fc80 100644 --- a/man/ncurses.3x +++ b/man/ncurses.3x @@ -1,4 +1,5 @@ -.\" $Id: ncurses.3x,v 1.19 1997/01/05 00:42:39 tom Exp $ +'\" t +.\" $Id: ncurses.3x,v 1.23 1998/02/15 02:05:44 tom Exp $ .TH ncurses 3X "" .ds n 5 .ds d @DATADIR@/terminfo @@ -62,7 +63,7 @@ default window called \fBstdscr\fR, which is the size of the terminal screen, is supplied. Others may be created with \fBnewwin\fR. Note that \fBcurses\fR does not handle overlapping windows, that's done by -the \fBpanels(3x)\fR library. This means that you can either use +the \fBpanel\fR(3X) library. This means that you can either use \fBstdscr\fR or divide the screen into tiled windows and not using \fBstdscr\fR at all. Mixing the two will result in unpredictable, and undesired, effects. @@ -83,7 +84,7 @@ about the character may also be stored with each character. Special windows called \fIpads\fR may also be manipulated. These are windows which are not constrained to the size of the screen and whose contents need not -be completely displayed. See curs_pad(3X) for more information. +be completely displayed. See \fBcurs_pad\fR(3X) for more information. In addition to drawing characters on the screen, video attributes and colors may be supported, causing the characters to show up in such modes as @@ -168,273 +169,276 @@ l l l l . \fBcurses\fR Routine Name/Manual Page Name = -addch/curs_addch(3X) -addchnstr/curs_addchstr(3X) -addchstr/curs_addchstr(3X) -addnstr/curs_addstr(3X) -addstr/curs_addstr(3X) -attroff/curs_attr(3X) -attron/curs_attr(3X) -attrset/curs_attr(3X) -baudrate/curs_termattrs(3X) -beep/curs_beep(3X) -bkgd/curs_bkgd(3X) -bkgdset/curs_bkgd(3X) -border/curs_border(3X) -box/curs_border(3X) -can_change_color/curs_color(3X) -cbreak/curs_inopts(3X) -clear/curs_clear(3X) -clearok/curs_outopts(3X) -clrtobot/curs_clear(3X) -clrtoeol/curs_clear(3X) -color_content/curs_color(3X) -copywin/curs_overlay(3X) -curs_set/curs_kernel(3X) -def_prog_mode/curs_kernel(3X) -def_shell_mode/curs_kernel(3X) -del_curterm/curs_terminfo(3X) -delay_output/curs_util(3X) -delch/curs_delch(3X) -deleteln/curs_deleteln(3X) -delscreen/curs_initscr(3X) -delwin/curs_window(3X) -derwin/curs_window(3X) -doupdate/curs_refresh(3X) -dupwin/curs_window(3X) -echo/curs_inopts(3X) -echochar/curs_addch(3X) -endwin/curs_initscr(3X) -erase/curs_clear(3X) -erasechar/curs_termattrs(3X) -filter/curs_util(3X) -flash/curs_beep(3X) -flushinp/curs_util(3X) -getbegyx/curs_getyx(3X) -getch/curs_getch(3X) -getmaxyx/curs_getyx(3X) -getmouse/curs_mouse(3X)* -getparyx/curs_getyx(3X) -getstr/curs_getstr(3X) -getsyx/curs_kernel(3X) -getwin/curs_util(3X) -getyx/curs_getyx(3X) -halfdelay/curs_inopts(3X) -has_colors/curs_color(3X) -has_ic/curs_termattrs(3X) -has_il/curs_termattrs(3X) -has_key/curs_getch(3X)* -hline/curs_border(3X) -idcok/curs_outopts(3X) -idlok/curs_outopts(3X) -immedok/curs_outopts(3X) -inch/curs_inch(3X) -inchnstr/curs_inchstr(3X) -inchstr/curs_inchstr(3X) -init_color/curs_color(3X) -init_pair/curs_color(3X) -initscr/curs_initscr(3X) -innstr/curs_instr(3X) -insch/curs_insch(3X) -insdelln/curs_deleteln(3X) -insertln/curs_deleteln(3X) -insnstr/curs_insstr(3X) -insstr/curs_insstr(3X) -instr/curs_instr(3X) -intrflush/curs_inopts(3X) -is_linetouched/curs_touch(3X) -is_wintouched/curs_touch(3X) -isendwin/curs_initscr(3X) -keyname/curs_util(3X) -keypad/curs_inopts(3X) -killchar/curs_termattrs(3X) -leaveok/curs_outopts(3X) -longname/curs_termattrs(3X) -mcprint/curs_print(3X)* -meta/curs_inopts(3X) -mouseinterval/curs_mouse(3X)* -mousemask/curs_mouse(3X)* -move/curs_move(3X) -mvaddch/curs_addch(3X) -mvaddchnstr/curs_addchstr(3X) -mvaddchstr/curs_addchstr(3X) -mvaddnstr/curs_addstr(3X) -mvaddstr/curs_addstr(3X) -mvcur/curs_terminfo(3X) -mvdelch/curs_delch(3X) -mvderwin/curs_window(3X) -mvgetch/curs_getch(3X) -mvgetstr/curs_getstr(3X) -mvinch/curs_inch(3X) -mvinchnstr/curs_inchstr(3X) -mvinchstr/curs_inchstr(3X) -mvinnstr/curs_instr(3X) -mvinsch/curs_insch(3X) -mvinsnstr/curs_insstr(3X) -mvinsstr/curs_insstr(3X) -mvinstr/curs_instr(3X) -mvprintw/curs_printw(3X) -mvscanw/curs_scanw(3X) -mvwaddch/curs_addch(3X) -mvwaddchnstr/curs_addchstr(3X) -mvwaddchstr/curs_addchstr(3X) -mvwaddnstr/curs_addstr(3X) -mvwaddstr/curs_addstr(3X) -mvwdelch/curs_delch(3X) -mvwgetch/curs_getch(3X) -mvwgetstr/curs_getstr(3X) -mvwin/curs_window(3X) -mvwinch/curs_inch(3X) -mvwinchnstr/curs_inchstr(3X) -mvwinchstr/curs_inchstr(3X) -mvwinnstr/curs_instr(3X) -mvwinsch/curs_insch(3X) -mvwinsnstr/curs_insstr(3X) -mvwinsstr/curs_insstr(3X) -mvwinstr/curs_instr(3X) -mvwprintw/curs_printw(3X) -mvwscanw/curs_scanw(3X) -napms/curs_kernel(3X) -newpad/curs_pad(3X) -newterm/curs_initscr(3X) -newwin/curs_window(3X) -nl/curs_outopts(3X) -nocbreak/curs_inopts(3X) -nodelay/curs_inopts(3X) -noecho/curs_inopts(3X) -nonl/curs_outopts(3X) -noqiflush/curs_inopts(3X) -noraw/curs_inopts(3X) -notimeout/curs_inopts(3X) -overlay/curs_overlay(3X) -overwrite/curs_overlay(3X) -pair_content/curs_color(3X) -pechochar/curs_pad(3X) -pnoutrefresh/curs_pad(3X) -prefresh/curs_pad(3X) -printw/curs_printw(3X) -putp/curs_terminfo(3X) -putwin/curs_util(3X) -qiflush/curs_inopts(3X) -raw/curs_inopts(3X) -redrawwin/curs_refresh(3X) -refresh/curs_refresh(3X) -reset_prog_mode/curs_kernel(3X) -reset_shell_mode/curs_kernel(3X) -resetty/curs_kernel(3X) -resizeterm/resizeterm(3x)* -restartterm/curs_terminfo(3X) -ripoffline/curs_kernel(3X) -savetty/curs_kernel(3X) -scanw/curs_scanw(3X) -scr_dump/curs_scr_dump(3X) -scr_init/curs_scr_dump(3X) -scr_restore/curs_scr_dump(3X) -scr_set/curs_scr_dump(3X) -scrl/curs_scroll(3X) -scroll/curs_scroll(3X) -scrollok/curs_outopts(3X) -set_curterm/curs_terminfo(3X) -set_term/curs_initscr(3X) -setscrreg/curs_outopts(3X) -setsyx/curs_kernel(3X) -setterm/curs_terminfo(3X) -setupterm/curs_terminfo(3X) -slk_attr/curs_slk(3X)* -slk_attroff/curs_slk(3X) -slk_attron/curs_slk(3X) -slk_attrset/curs_slk(3X) -slk_clear/curs_slk(3X) -slk_init/curs_slk(3X) -slk_label/curs_slk(3X) -slk_noutrefresh/curs_slk(3X) -slk_refresh/curs_slk(3X) -slk_restore/curs_slk(3X) -slk_set/curs_slk(3X) -slk_touch/curs_slk(3X) -standend/curs_attr(3X) -standout/curs_attr(3X) -start_color/curs_color(3X) -subpad/curs_pad(3X) -subwin/curs_window(3X) -syncok/curs_window(3X) -termattrs/curs_termattrs(3X) -termname/curs_termattrs(3X) -tgetent/curs_termcap(3X) -tgetflag/curs_termcap(3X) -tgetnum/curs_termcap(3X) -tgetstr/curs_termcap(3X) -tgoto/curs_termcap(3X) -tigetflag/curs_terminfo(3X) -tigetnum/curs_terminfo(3X) -tigetstr/curs_terminfo(3X) -timeout/curs_inopts(3X) -touchline/curs_touch(3X) -touchwin/curs_touch(3X) -tparm/curs_terminfo(3X) -tputs/curs_termcap(3X) -tputs/curs_terminfo(3X) -typeahead/curs_inopts(3X) -unctrl/curs_util(3X) -ungetch/curs_getch(3X) -ungetmouse/curs_mouse(3X)* -untouchwin/curs_touch(3X) -use_env/curs_util(3X) -vidattr/curs_terminfo(3X) -vidputs/curs_terminfo(3X) -vline/curs_border(3X) -vwprintw/curs_printw(3X) -vwscanw/curs_scanw(3X) -waddch/curs_addch(3X) -waddchnstr/curs_addchstr(3X) -waddchstr/curs_addchstr(3X) -waddnstr/curs_addstr(3X) -waddstr/curs_addstr(3X) -wattroff/curs_attr(3X) -wattron/curs_attr(3X) -wattrset/curs_attr(3X) -wbkgd/curs_bkgd(3X) -wbkgdset/curs_bkgd(3X) -wborder/curs_border(3X) -wclear/curs_clear(3X) -wclrtobot/curs_clear(3X) -wclrtoeol/curs_clear(3X) -wcursyncup/curs_window(3X) -wdelch/curs_delch(3X) -wdeleteln/curs_deleteln(3X) -wechochar/curs_addch(3X) -wenclose/curs_mouse(3X)* -werase/curs_clear(3X) -wgetch/curs_getch(3X) -wgetnstr/curs_getstr(3X) -wgetstr/curs_getstr(3X) -whline/curs_border(3X) -winch/curs_inch(3X) -winchnstr/curs_inchstr(3X) -winchstr/curs_inchstr(3X) -winnstr/curs_instr(3X) -winsch/curs_insch(3X) -winsdelln/curs_deleteln(3X) -winsertln/curs_deleteln(3X) -winsnstr/curs_insstr(3X) -winsstr/curs_insstr(3X) -winstr/curs_instr(3X) -wmove/curs_move(3X) -wnoutrefresh/curs_refresh(3X) -wprintw/curs_printw(3X) -wredrawln/curs_refresh(3X) -wrefresh/curs_refresh(3X) -wresize/wresize(3x)* -wscanw/curs_scanw(3X) -wscrl/curs_scroll(3X) -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) -wvline/curs_border(3X) +addch/\fBcurs_addch\fR(3X) +addchnstr/\fBcurs_addchstr\fR(3X) +addchstr/\fBcurs_addchstr\fR(3X) +addnstr/\fBcurs_addstr\fR(3X) +addstr/\fBcurs_addstr\fR(3X) +attroff/\fBcurs_attr\fR(3X) +attron/\fBcurs_attr\fR(3X) +attrset/\fBcurs_attr\fR(3X) +baudrate/\fBcurs_termattrs\fR(3X) +beep/\fBcurs_beep\fR(3X) +bkgd/\fBcurs_bkgd\fR(3X) +bkgdset/\fBcurs_bkgd\fR(3X) +border/\fBcurs_border\fR(3X) +box/\fBcurs_border\fR(3X) +can_change_color/\fBcurs_color\fR(3X) +cbreak/\fBcurs_inopts\fR(3X) +clear/\fBcurs_clear\fR(3X) +clearok/\fBcurs_outopts\fR(3X) +clrtobot/\fBcurs_clear\fR(3X) +clrtoeol/\fBcurs_clear\fR(3X) +color_content/\fBcurs_color\fR(3X) +copywin/\fBcurs_overlay\fR(3X) +curs_set/\fBcurs_kernel\fR(3X) +def_prog_mode/\fBcurs_kernel\fR(3X) +def_shell_mode/\fBcurs_kernel\fR(3X) +define_key/\fBdefine_key\fR(3X)* +del_curterm/\fBcurs_terminfo\fR(3X) +delay_output/\fBcurs_util\fR(3X) +delch/\fBcurs_delch\fR(3X) +deleteln/\fBcurs_deleteln\fR(3X) +delscreen/\fBcurs_initscr\fR(3X) +delwin/\fBcurs_window\fR(3X) +derwin/\fBcurs_window\fR(3X) +doupdate/\fBcurs_refresh\fR(3X) +dupwin/\fBcurs_window\fR(3X) +echo/\fBcurs_inopts\fR(3X) +echochar/\fBcurs_addch\fR(3X) +endwin/\fBcurs_initscr\fR(3X) +erase/\fBcurs_clear\fR(3X) +erasechar/\fBcurs_termattrs\fR(3X) +filter/\fBcurs_util\fR(3X) +flash/\fBcurs_beep\fR(3X) +flushinp/\fBcurs_util\fR(3X) +getbegyx/\fBcurs_getyx\fR(3X) +getch/\fBcurs_getch\fR(3X) +getmaxyx/\fBcurs_getyx\fR(3X) +getmouse/\fBcurs_mouse\fR(3X)* +getparyx/\fBcurs_getyx\fR(3X) +getstr/\fBcurs_getstr\fR(3X) +getsyx/\fBcurs_kernel\fR(3X) +getwin/\fBcurs_util\fR(3X) +getyx/\fBcurs_getyx\fR(3X) +halfdelay/\fBcurs_inopts\fR(3X) +has_colors/\fBcurs_color\fR(3X) +has_ic/\fBcurs_termattrs\fR(3X) +has_il/\fBcurs_termattrs\fR(3X) +has_key/\fBcurs_getch\fR(3X)* +hline/\fBcurs_border\fR(3X) +idcok/\fBcurs_outopts\fR(3X) +idlok/\fBcurs_outopts\fR(3X) +immedok/\fBcurs_outopts\fR(3X) +inch/\fBcurs_inch\fR(3X) +inchnstr/\fBcurs_inchstr\fR(3X) +inchstr/\fBcurs_inchstr\fR(3X) +init_color/\fBcurs_color\fR(3X) +init_pair/\fBcurs_color\fR(3X) +initscr/\fBcurs_initscr\fR(3X) +innstr/\fBcurs_instr\fR(3X) +insch/\fBcurs_insch\fR(3X) +insdelln/\fBcurs_deleteln\fR(3X) +insertln/\fBcurs_deleteln\fR(3X) +insnstr/\fBcurs_insstr\fR(3X) +insstr/\fBcurs_insstr\fR(3X) +instr/\fBcurs_instr\fR(3X) +intrflush/\fBcurs_inopts\fR(3X) +is_linetouched/\fBcurs_touch\fR(3X) +is_wintouched/\fBcurs_touch\fR(3X) +isendwin/\fBcurs_initscr\fR(3X) +keyname/\fBcurs_util\fR(3X) +keyok/\fBkeyok\fR(3X)* +keypad/\fBcurs_inopts\fR(3X) +killchar/\fBcurs_termattrs\fR(3X) +leaveok/\fBcurs_outopts\fR(3X) +longname/\fBcurs_termattrs\fR(3X) +mcprint/\fBcurs_print\fR(3X)* +meta/\fBcurs_inopts\fR(3X) +mouseinterval/\fBcurs_mouse\fR(3X)* +mousemask/\fBcurs_mouse\fR(3X)* +move/\fBcurs_move\fR(3X) +mvaddch/\fBcurs_addch\fR(3X) +mvaddchnstr/\fBcurs_addchstr\fR(3X) +mvaddchstr/\fBcurs_addchstr\fR(3X) +mvaddnstr/\fBcurs_addstr\fR(3X) +mvaddstr/\fBcurs_addstr\fR(3X) +mvcur/\fBcurs_terminfo\fR(3X) +mvdelch/\fBcurs_delch\fR(3X) +mvderwin/\fBcurs_window\fR(3X) +mvgetch/\fBcurs_getch\fR(3X) +mvgetstr/\fBcurs_getstr\fR(3X) +mvinch/\fBcurs_inch\fR(3X) +mvinchnstr/\fBcurs_inchstr\fR(3X) +mvinchstr/\fBcurs_inchstr\fR(3X) +mvinnstr/\fBcurs_instr\fR(3X) +mvinsch/\fBcurs_insch\fR(3X) +mvinsnstr/\fBcurs_insstr\fR(3X) +mvinsstr/\fBcurs_insstr\fR(3X) +mvinstr/\fBcurs_instr\fR(3X) +mvprintw/\fBcurs_printw\fR(3X) +mvscanw/\fBcurs_scanw\fR(3X) +mvwaddch/\fBcurs_addch\fR(3X) +mvwaddchnstr/\fBcurs_addchstr\fR(3X) +mvwaddchstr/\fBcurs_addchstr\fR(3X) +mvwaddnstr/\fBcurs_addstr\fR(3X) +mvwaddstr/\fBcurs_addstr\fR(3X) +mvwdelch/\fBcurs_delch\fR(3X) +mvwgetch/\fBcurs_getch\fR(3X) +mvwgetstr/\fBcurs_getstr\fR(3X) +mvwin/\fBcurs_window\fR(3X) +mvwinch/\fBcurs_inch\fR(3X) +mvwinchnstr/\fBcurs_inchstr\fR(3X) +mvwinchstr/\fBcurs_inchstr\fR(3X) +mvwinnstr/\fBcurs_instr\fR(3X) +mvwinsch/\fBcurs_insch\fR(3X) +mvwinsnstr/\fBcurs_insstr\fR(3X) +mvwinsstr/\fBcurs_insstr\fR(3X) +mvwinstr/\fBcurs_instr\fR(3X) +mvwprintw/\fBcurs_printw\fR(3X) +mvwscanw/\fBcurs_scanw\fR(3X) +napms/\fBcurs_kernel\fR(3X) +newpad/\fBcurs_pad\fR(3X) +newterm/\fBcurs_initscr\fR(3X) +newwin/\fBcurs_window\fR(3X) +nl/\fBcurs_outopts\fR(3X) +nocbreak/\fBcurs_inopts\fR(3X) +nodelay/\fBcurs_inopts\fR(3X) +noecho/\fBcurs_inopts\fR(3X) +nonl/\fBcurs_outopts\fR(3X) +noqiflush/\fBcurs_inopts\fR(3X) +noraw/\fBcurs_inopts\fR(3X) +notimeout/\fBcurs_inopts\fR(3X) +overlay/\fBcurs_overlay\fR(3X) +overwrite/\fBcurs_overlay\fR(3X) +pair_content/\fBcurs_color\fR(3X) +pechochar/\fBcurs_pad\fR(3X) +pnoutrefresh/\fBcurs_pad\fR(3X) +prefresh/\fBcurs_pad\fR(3X) +printw/\fBcurs_printw\fR(3X) +putp/\fBcurs_terminfo\fR(3X) +putwin/\fBcurs_util\fR(3X) +qiflush/\fBcurs_inopts\fR(3X) +raw/\fBcurs_inopts\fR(3X) +redrawwin/\fBcurs_refresh\fR(3X) +refresh/\fBcurs_refresh\fR(3X) +reset_prog_mode/\fBcurs_kernel\fR(3X) +reset_shell_mode/\fBcurs_kernel\fR(3X) +resetty/\fBcurs_kernel\fR(3X) +resizeterm/\fBresizeterm\fR(3X)* +restartterm/\fBcurs_terminfo\fR(3X) +ripoffline/\fBcurs_kernel\fR(3X) +savetty/\fBcurs_kernel\fR(3X) +scanw/\fBcurs_scanw\fR(3X) +scr_dump/\fBcurs_scr_dump\fR(3X) +scr_init/\fBcurs_scr_dump\fR(3X) +scr_restore/\fBcurs_scr_dump\fR(3X) +scr_set/\fBcurs_scr_dump\fR(3X) +scrl/\fBcurs_scroll\fR(3X) +scroll/\fBcurs_scroll\fR(3X) +scrollok/\fBcurs_outopts\fR(3X) +set_curterm/\fBcurs_terminfo\fR(3X) +set_term/\fBcurs_initscr\fR(3X) +setscrreg/\fBcurs_outopts\fR(3X) +setsyx/\fBcurs_kernel\fR(3X) +setterm/\fBcurs_terminfo\fR(3X) +setupterm/\fBcurs_terminfo\fR(3X) +slk_attr/\fBcurs_slk\fR(3X)* +slk_attroff/\fBcurs_slk\fR(3X) +slk_attron/\fBcurs_slk\fR(3X) +slk_attrset/\fBcurs_slk\fR(3X) +slk_clear/\fBcurs_slk\fR(3X) +slk_init/\fBcurs_slk\fR(3X) +slk_label/\fBcurs_slk\fR(3X) +slk_noutrefresh/\fBcurs_slk\fR(3X) +slk_refresh/\fBcurs_slk\fR(3X) +slk_restore/\fBcurs_slk\fR(3X) +slk_set/\fBcurs_slk\fR(3X) +slk_touch/\fBcurs_slk\fR(3X) +standend/\fBcurs_attr\fR(3X) +standout/\fBcurs_attr\fR(3X) +start_color/\fBcurs_color\fR(3X) +subpad/\fBcurs_pad\fR(3X) +subwin/\fBcurs_window\fR(3X) +syncok/\fBcurs_window\fR(3X) +termattrs/\fBcurs_termattrs\fR(3X) +termname/\fBcurs_termattrs\fR(3X) +tgetent/\fBcurs_termcap\fR(3X) +tgetflag/\fBcurs_termcap\fR(3X) +tgetnum/\fBcurs_termcap\fR(3X) +tgetstr/\fBcurs_termcap\fR(3X) +tgoto/\fBcurs_termcap\fR(3X) +tigetflag/\fBcurs_terminfo\fR(3X) +tigetnum/\fBcurs_terminfo\fR(3X) +tigetstr/\fBcurs_terminfo\fR(3X) +timeout/\fBcurs_inopts\fR(3X) +touchline/\fBcurs_touch\fR(3X) +touchwin/\fBcurs_touch\fR(3X) +tparm/\fBcurs_terminfo\fR(3X) +tputs/\fBcurs_termcap\fR(3X) +tputs/\fBcurs_terminfo\fR(3X) +typeahead/\fBcurs_inopts\fR(3X) +unctrl/\fBcurs_util\fR(3X) +ungetch/\fBcurs_getch\fR(3X) +ungetmouse/\fBcurs_mouse\fR(3X)* +untouchwin/\fBcurs_touch\fR(3X) +use_default_colors/\fBdft_fgbg\fR(3X)* +use_env/\fBcurs_util\fR(3X) +vidattr/\fBcurs_terminfo\fR(3X) +vidputs/\fBcurs_terminfo\fR(3X) +vline/\fBcurs_border\fR(3X) +vwprintw/\fBcurs_printw\fR(3X) +vwscanw/\fBcurs_scanw\fR(3X) +waddch/\fBcurs_addch\fR(3X) +waddchnstr/\fBcurs_addchstr\fR(3X) +waddchstr/\fBcurs_addchstr\fR(3X) +waddnstr/\fBcurs_addstr\fR(3X) +waddstr/\fBcurs_addstr\fR(3X) +wattroff/\fBcurs_attr\fR(3X) +wattron/\fBcurs_attr\fR(3X) +wattrset/\fBcurs_attr\fR(3X) +wbkgd/\fBcurs_bkgd\fR(3X) +wbkgdset/\fBcurs_bkgd\fR(3X) +wborder/\fBcurs_border\fR(3X) +wclear/\fBcurs_clear\fR(3X) +wclrtobot/\fBcurs_clear\fR(3X) +wclrtoeol/\fBcurs_clear\fR(3X) +wcursyncup/\fBcurs_window\fR(3X) +wdelch/\fBcurs_delch\fR(3X) +wdeleteln/\fBcurs_deleteln\fR(3X) +wechochar/\fBcurs_addch\fR(3X) +wenclose/\fBcurs_mouse\fR(3X)* +werase/\fBcurs_clear\fR(3X) +wgetch/\fBcurs_getch\fR(3X) +wgetnstr/\fBcurs_getstr\fR(3X) +wgetstr/\fBcurs_getstr\fR(3X) +whline/\fBcurs_border\fR(3X) +winch/\fBcurs_inch\fR(3X) +winchnstr/\fBcurs_inchstr\fR(3X) +winchstr/\fBcurs_inchstr\fR(3X) +winnstr/\fBcurs_instr\fR(3X) +winsch/\fBcurs_insch\fR(3X) +winsdelln/\fBcurs_deleteln\fR(3X) +winsertln/\fBcurs_deleteln\fR(3X) +winsnstr/\fBcurs_insstr\fR(3X) +winsstr/\fBcurs_insstr\fR(3X) +winstr/\fBcurs_instr\fR(3X) +wmove/\fBcurs_move\fR(3X) +wnoutrefresh/\fBcurs_refresh\fR(3X) +wprintw/\fBcurs_printw\fR(3X) +wredrawln/\fBcurs_refresh\fR(3X) +wrefresh/\fBcurs_refresh\fR(3X) +wresize/\fBwresize\fR(3X)* +wscanw/\fBcurs_scanw\fR(3X) +wscrl/\fBcurs_scroll\fR(3X) +wsetscrreg/\fBcurs_outopts\fR(3X) +wstandend/\fBcurs_attr\fR(3X) +wstandout/\fBcurs_attr\fR(3X) +wsyncdown/\fBcurs_window\fR(3X) +wsyncup/\fBcurs_window\fR(3X) +wtimeout/\fBcurs_inopts\fR(3X) +wtouchln/\fBcurs_touch\fR(3X) +wvline/\fBcurs_border\fR(3X) .TE .SH RETURN VALUE Routines that return an integer return \fBERR\fR upon failure and an @@ -474,8 +478,8 @@ value of \fBTERMCAP_FILE\fR otherwise. Versions of \fBcurses\fR compiled on PC clones support display of the PC ROM characters (including ROM characters 0-31, which stock SVr4 curses cannot -display). See the EXTENSIONS sections of \fBcurs_addch\fR(3x) and -\fBcurs_attr\fR(3x). +display). See the EXTENSIONS sections of \fBcurs_addch\fR(3X) and +\fBcurs_attr\fR(3X). The \fBcurses\fR library includes facilities for capturing mouse events on certain terminals (including xterm). See the \fBcurs_mouse\fR(3X) diff --git a/man/panel.3x b/man/panel.3x index cfa170ef..b82162b2 100644 --- a/man/panel.3x +++ b/man/panel.3x @@ -1,3 +1,4 @@ +.\" $Id: panel.3x,v 1.8 1997/12/14 01:49:25 tom Exp $ .TH panel 3X "" .ds n 5 .ds d @DATADIR@/terminfo @@ -39,7 +40,7 @@ panel - panel stack extension for curses \fBint del_panel(PANEL *pan)\fR .br .SH DESCRIPTION -Panels are curses(3X) windows with the added feature of +Panels are \fBcurses\fR(3X) windows with the added feature of depth. Panel functions allow the use of stacked windows and ensure the proper portions of each window and the curses \fBstdscr\fR window are hidden or displayed when panels are added, moved, modified or removed. @@ -51,7 +52,7 @@ A window is associated with every panel. The panel routines enable you to create, move, hides, and show panels, as well as position a panel at any desired location in the stack. .P -Panel routines are a functional layer added to curses(3X), make only +Panel routines are a functional layer added to \fBcurses\fR(3X), make only high-level curses calls, and work anywhere terminfo curses does. .SH FUNCTIONS .TP @@ -97,7 +98,7 @@ to move a panel window. \fBreplace_panel(pan,window)\fR replaces the current window of panel with \fBwindow\fR (useful, for example if you want to resize a panel; if you're using \fBncurses\fR, -you can call \fBreplace_panel\fR on the output of \fBwresize\fR(3x)). +you can call \fBreplace_panel\fR on the output of \fBwresize\fR(3X)). It does not change the position of the panel in the stack. .TP \fBpanel_above(pan)\fR @@ -146,10 +147,8 @@ interface for the panels library libpanel.a the panels library itself .SH SEE ALSO -curses(3X) +\fBcurses\fR(3X) .SH AUTHOR Originally written by Warren Tucker , primarily to assist in porting u386mon to systems without a native panels library. Repackaged for ncurses by Zeyd ben-Halim. - - diff --git a/man/resizeterm.3x b/man/resizeterm.3x index ceb49e3d..ba5ac983 100644 --- a/man/resizeterm.3x +++ b/man/resizeterm.3x @@ -1,23 +1,34 @@ -.\"***************************************************************************** -.\" Copyright 1996 by Thomas E. Dickey * -.\" All Rights Reserved. * -.\" * -.\" Permission to use, copy, modify, and distribute this software and its * -.\" documentation for any purpose and without fee is hereby granted, provided * -.\" that the above copyright notice appear in all copies and that both that * -.\" copyright notice and this permission notice appear in supporting * -.\" documentation, and that the name of the above listed copyright holder(s) * -.\" not be used in advertising or publicity pertaining to distribution of the * -.\" software without specific, written prior permission. THE ABOVE LISTED * -.\" COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * -.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * -.\" EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * -.\" SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * -.\" RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * -.\" CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * -.\" CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * -.\"***************************************************************************** -.\" $Id: resizeterm.3x,v 1.3 1996/12/28 20:00:50 tom Exp $ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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 1996,1997 +.\" +.\" $Id: resizeterm.3x,v 1.6 1998/02/11 12:13:48 tom Exp $ .TH resizeterm 3X "" . .SH NAME @@ -56,8 +67,16 @@ While this function is intended to be used to support a signal handler context where \fBmalloc\fR or \fBrealloc\fR may have been interrupted, since it uses those functions. . +.PP +If ncurses is configured to supply its own SIGWINCH handler, +the \fBresizeterm\fR function ungetch's a \fBKEY_RESIZE\fR which +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. +. .SH SEE ALSO -\fBwresize\fR(3x). +\fBwresize\fR(3X). . .SH AUTHOR Thomas Dickey (from an equivalent function written in 1988 for BSD curses). diff --git a/man/term.5 b/man/term.5 index 3ac1fa86..ae0e260c 100644 --- a/man/term.5 +++ b/man/term.5 @@ -170,7 +170,7 @@ The name field cannot exceed 128 bytes. .SH FILES \*d/*/* compiled terminal capability data base .SH "SEE ALSO" -curses(3X), terminfo(\*n). +\fBcurses\fR(3X), \fBterminfo\fR(\*n). .\"# .\"# The following sets edit modes for GNU EMACS .\"# Local Variables: diff --git a/man/term.7 b/man/term.7 index 9d0f6d35..f73ba2c6 100644 --- a/man/term.7 +++ b/man/term.7 @@ -1,3 +1,4 @@ +.\" $Id: term.7,v 1.7 1997/12/14 01:50:43 tom Exp $ .TH TERM 7 .ds n 5 .ds d @DATADIR@/terminfo @@ -166,7 +167,7 @@ tty line initialization (AT&T-like UNIXes). /etc/ttys tty line initialization (BSD-like UNIXes). .SH "SEE ALSO" -curses(3X), terminfo(\*n), term(\*d). +\fBcurses\fR(3X), \fBterminfo\fR(\*n), \fBterm\fR(\*d). .\"# .\"# The following sets edit modes for GNU EMACS .\"# Local Variables: diff --git a/man/terminfo.head b/man/terminfo.head index b024f578..00a85106 100644 --- a/man/terminfo.head +++ b/man/terminfo.head @@ -1,4 +1,4 @@ -.\" $Id: terminfo.head,v 1.6 1997/01/05 01:03:16 tom Exp $ +.\" $Id: terminfo.head,v 1.7 1997/12/14 01:49:17 tom Exp $ .TH TERMINFO 5 "" "" "File Formats" .ds n 5 .ds d @DATADIR@/terminfo @@ -9,10 +9,10 @@ terminfo \- terminal capability data base .SH DESCRIPTION .I Terminfo is a data base describing terminals, used by screen-oriented programs such as -.IR nvi (1), -.IR rogue (1) +\fBnvi\fR(1), +\fBrogue\fR(1) and libraries such as -.IR curses (3X). +\fBcurses\fR(3X). .I Terminfo describes terminals by giving a set of capabilities which they have, by specifying how to perform screen operations, and by diff --git a/man/terminfo.tail b/man/terminfo.tail index 5101ec3b..5a0e0e4a 100644 --- a/man/terminfo.tail +++ b/man/terminfo.tail @@ -1,4 +1,4 @@ -.\" $Id: terminfo.tail,v 1.12 1996/09/21 23:23:19 tom Exp $ +.\" $Id: terminfo.tail,v 1.15 1997/12/14 01:50:06 tom Exp $ .\" Beginning of terminfo.tail file .ps +1 .PP @@ -451,7 +451,7 @@ and .B 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 \fBncurses\fR\fR(3x) library does this synthesis +(Note that the \fBncurses\fR(3X) library does this synthesis automatically, so you need not compose insert/delete strings for an entry with \fBcsr\fR). .PP @@ -1375,7 +1375,7 @@ Supports both the SVr4 set and the AIX extensions. \*d/?/* files containing terminal descriptions .SH "SEE ALSO" -tic(1m), curses(3X), printf(3S), term(\*n). +\fBtic\fR(1M), \fBcurses\fR(3X), \fBprintf\fR(3S), \fBterm\fR(\*n). .SH AUTHORS Zeyd M. Ben-Halim, Eric S. Raymond. Descends from the original pcurses by Pavel Curtis. diff --git a/man/tic.1m b/man/tic.1m index 9bb1c0e5..95f80697 100644 --- a/man/tic.1m +++ b/man/tic.1m @@ -1,10 +1,16 @@ +.\" $Id: tic.1m,v 1.18 1998/01/17 21:11:30 tom Exp $ .TH tic 1M "" .ds n 5 .ds d @DATADIR@/terminfo .SH NAME \fBtic\fR - the \fIterminfo\fR entry-description compiler .SH SYNOPSIS -\fBtic\fR [\fB-v\fR[\fIn\fR]] [\fB-w\fR[\fIn\fR]] [\fB-1hcpICNRrsTu\fR] [\fB-e\fR \fInames\fR] \fIfile\fR +\fBtic\fR +[\fB-v\fR[\fIn\fR]] +[\fB-w\fR[\fIn\fR]] +[\fB-1hcpICNRrsTu\fR] +[\fB-e\fR \fInames\fR] +[\fB-o\fR \fIdir\fR] \fIfile\fR .br .SH DESCRIPTION The command \fBtic\fR translates a \fBterminfo\fR file from source @@ -68,7 +74,7 @@ using the long C variable names listed in <\fBterm.h\fR> .TP \fB-C\fR Force source translation to termcap format. Note: this differs from the -C -option of \fIinfocmp\fR(1m) in that it does not merely translate capability +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. @@ -201,7 +207,7 @@ System V does not compile entries to or read entries from your \fB\*d/?/*\fR Compiled terminal description database. .SH SEE ALSO -\fBinfocmp\fR(1m), \fBcaptoinfo\fR(1m), \fBinfotocap\fR(1m), \fBtoe\fR(1m), +\fBinfocmp\fR(1M), \fBcaptoinfo\fR(1M), \fBinfotocap\fR(1M), \fBtoe\fR(1M), \fBcurses\fR(3X), \fBterminfo\fR(\*n). .\"# .\"# The following sets edit modes for GNU EMACS diff --git a/man/toe.1m b/man/toe.1m index a032217c..d5e61478 100644 --- a/man/toe.1m +++ b/man/toe.1m @@ -1,3 +1,4 @@ +.\" $Id: toe.1m,v 0.6 1997/12/06 22:14:57 tom Exp $ .TH toe 1M "" .ds n 5 .ds d @DATADIR@/terminfo @@ -42,7 +43,7 @@ prints out the version of the program in use on standard error and exits. \fB\*d/?/*\fR Compiled terminal description database. .SH SEE ALSO -\fBtic\fR(1m), \fBinfocmp\fR(1m), \fBcaptoinfo\fR(1m), \fBinfotocap\fR(1m), +\fBtic\fR(1M), \fBinfocmp\fR(1M), \fBcaptoinfo\fR(1M), \fBinfotocap\fR(1M), \fBcurses\fR(3X), \fBterminfo\fR(\*n). .\"# .\"# The following sets edit modes for GNU EMACS diff --git a/man/tset.1 b/man/tset.1 index 99a55f8b..fe79d180 100644 --- a/man/tset.1 +++ b/man/tset.1 @@ -208,7 +208,7 @@ stty(1), tty(4), termcap(5), ttys(5), -environ(7), +environ(7) .\"# .\"# The following sets edit modes for GNU EMACS .\"# Local Variables: diff --git a/man/wresize.3x b/man/wresize.3x index 50537aef..70eb47ac 100644 --- a/man/wresize.3x +++ b/man/wresize.3x @@ -1,23 +1,34 @@ -.\"***************************************************************************** -.\" Copyright 1996 by Thomas E. Dickey * -.\" All Rights Reserved. * -.\" * -.\" Permission to use, copy, modify, and distribute this software and its * -.\" documentation for any purpose and without fee is hereby granted, provided * -.\" that the above copyright notice appear in all copies and that both that * -.\" copyright notice and this permission notice appear in supporting * -.\" documentation, and that the name of the above listed copyright holder(s) * -.\" not be used in advertising or publicity pertaining to distribution of the * -.\" software without specific, written prior permission. THE ABOVE LISTED * -.\" COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * -.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * -.\" EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * -.\" SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * -.\" RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * -.\" CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * -.\" CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * -.\"***************************************************************************** -.\" $Id: wresize.3x,v 1.2 1996/09/07 14:51:04 tom Exp $ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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 1996 +.\" +.\" $Id: wresize.3x,v 1.4 1998/02/11 12:13:48 tom Exp $ .TH wresize 3X "" . .SH NAME @@ -48,7 +59,7 @@ The caller must ensure that the window's dimensions fit within the actual screen dimensions. . .SH SEE ALSO -\fBresizeterm\fR(3x). +\fBresizeterm\fR(3X). . .SH AUTHOR Thomas Dickey (from an equivalent function written in 1988 for BSD curses). diff --git a/menu/Makefile.in b/menu/Makefile.in index bfe248fd..39800589 100644 --- a/menu/Makefile.in +++ b/menu/Makefile.in @@ -1,23 +1,34 @@ -# $Id: Makefile.in,v 1.16 1997/02/15 17:10:04 tom Exp $ -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: Makefile.in,v 1.23 1998/02/11 12:13:50 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# # Makefile for menu source code. # # This makes the following: @@ -43,6 +54,7 @@ libdir = @libdir@ includedir = @includedir@ INSTALL = @INSTALL@ +INSTALL_LIB = @INSTALL@ @INSTALL_LIB@ INSTALL_DATA = @INSTALL_DATA@ AR = @AR@ @@ -72,9 +84,10 @@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) LINK = $(CC) LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ +SHLIB_LIST = -lncurses @SHLIB_LIST@ MK_SHARED_LIB = @MK_SHARED_LIB@ -REL_VERSION = @nc_cv_rel_version@ -ABI_VERSION = @nc_cv_abi_version@ +REL_VERSION = @cf_cv_rel_version@ +ABI_VERSION = @cf_cv_abi_version@ RANLIB = @RANLIB@ @@ -84,8 +97,16 @@ LINT = @LINT@ LINT_OPTS = @LINT_OPTS@ LINT_LIBS = -lmenu -lncurses @LIBS@ +AUTO_SRC = \ + ../include/menu.h \ + ../include/eti.h \ + ../include/mf_common.h + ################################################################################ -all :: ../include/menu.h ../include/eti.h ../include/mf_common.h $(LIBRARIES) +all \ +install :: $(AUTO_SRC) $(LIBRARIES) + +sources : $(AUTO_SRC) $(INSTALL_PREFIX)$(libdir) : $(srcdir)/../mkinstalldirs $@ @@ -104,10 +125,8 @@ $(INSTALL_PREFIX)$(libdir) : MENU_PRIV_H = \ $(srcdir)/menu.priv.h \ - $(srcdir)/menu.h \ - $(srcdir)/mf_common.h \ - ../include/curses.h \ - $(srcdir)/eti.h + $(AUTO_SRC) \ + ../include/curses.h tags: ctags *.[ch] @@ -115,15 +134,15 @@ tags: TAGS: etags *.[ch] -clean :: - -rm -f tags TAGS *~ ../include/menu.h ../include/eti.h \ - ../include/mf_common.h +mostlyclean :: + -rm -f core tags TAGS *~ *.ln *.atac trace + +clean :: mostlyclean + -rm -f $(AUTO_SRC) distclean :: clean -rm -f Makefile -mostlyclean :: clean - realclean :: distclean ############################################################################### diff --git a/menu/READ.ME b/menu/READ.ME index eb5a64cd..829cb459 100644 --- a/menu/READ.ME +++ b/menu/READ.ME @@ -2,13 +2,9 @@ This is a clone of the menu library that is available with typical System V curses implementations (ETI). It is modelled after the documentation that comes for this library with -a 386 based SVR4 implementation (ESIX). This system was used together -with an NCR3000 system to compile the clone using original curses -implementation and to run various programs to check the compatibility of -this clone with the original libmenu library. +a 386 based SVR4 implementation (ESIX). -The development environment was an ELF based Linux system, the German -Unifix distribution (aka Linux FT). +The development environment was and is an ELF based Linux system. For things that still need doing, see the TO-DO file in the top-level directory. diff --git a/menu/eti.h b/menu/eti.h index 63028e84..a45d0b9c 100644 --- a/menu/eti.h +++ b/menu/eti.h @@ -1,24 +1,34 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses Extended Terminal Interface (ETI) is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ #ifndef _ETI_ERRNO_H_ #define _ETI_ERRNO_H_ diff --git a/menu/headers b/menu/headers index bb1ebe73..3fe0be08 100644 --- a/menu/headers +++ b/menu/headers @@ -1,21 +1,32 @@ -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +############################################################################## +# Copyright (c) 1998 Free 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 1996 +# $(srcdir)/eti.h $(srcdir)/menu.h diff --git a/menu/llib-lmenu b/menu/llib-lmenu index 0116f4c5..3623b85e 100644 --- a/menu/llib-lmenu +++ b/menu/llib-lmenu @@ -1,28 +1,58 @@ -/****************************************************************************** - * Copyright 1996 by Thomas E. Dickey * - * All Rights Reserved. * - * * - * Permission to use, copy, modify, and distribute this software and its * - * documentation for any purpose and without fee is hereby granted, provided * - * that the above copyright notice appear in all copies and that both that * - * copyright notice and this permission notice appear in supporting * - * documentation, and that the name of the above listed copyright holder(s) * - * not be used in advertising or publicity pertaining to distribution of the * - * software without specific, written prior permission. THE ABOVE LISTED * - * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * - * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - ******************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1996,1997 * + ****************************************************************************/ /* LINTLIBRARY */ -/* ./m_attribs.c */ +/* ./m_adabind.c */ #include "menu.priv.h" +#undef _nc_ada_normalize_menu_opts +void _nc_ada_normalize_menu_opts( + int *opt) + { /* void */ } + +#undef _nc_ada_normalize_item_opts +void _nc_ada_normalize_item_opts( + int *opt) + { /* void */ } + +#undef _nc_get_item +ITEM *_nc_get_item( + const MENU *menu, + int idx) + { return(*(ITEM **)0); } + +/* ./m_attribs.c */ + #undef set_menu_fore int set_menu_fore( MENU *menu, @@ -56,17 +86,6 @@ chtype menu_grey( const MENU *menu) { return(*(chtype *)0); } -#undef set_menu_pad -int set_menu_pad( - MENU *menu, - int pad) - { return(*(int *)0); } - -#undef menu_pad -int menu_pad( - const MENU *menu) - { return(*(int *)0); } - /* ./m_cursor.c */ #undef pos_menu_cursor @@ -76,15 +95,11 @@ int pos_menu_cursor( /* ./m_driver.c */ -#undef menu_pattern -char *menu_pattern( - const MENU *menu) - { return(*(char **)0); } - -#undef set_menu_pattern -int set_menu_pattern( +#undef _nc_Match_Next_Character_In_Item_Name +int _nc_Match_Next_Character_In_Item_Name( MENU *menu, - const char *p) + int ch, + ITEM **item) { return(*(int *)0); } #undef menu_driver @@ -213,17 +228,6 @@ int item_index( const ITEM *item) { return(*(int *)0); } -#undef set_top_row -int set_top_row( - MENU *menu, - int row) - { return(*(int *)0); } - -#undef top_row -int top_row( - const MENU *menu) - { return(*(int *)0); } - /* ./m_item_nam.c */ #undef item_name @@ -285,18 +289,31 @@ Item_Options item_opts( const ITEM *item) { return(*(Item_Options *)0); } +/* ./m_item_top.c */ + +#undef set_top_row +int set_top_row( + MENU *menu, + int row) + { return(*(int *)0); } + +#undef top_row +int top_row( + const MENU *menu) + { return(*(int *)0); } + /* ./m_item_use.c */ #undef set_item_userptr int set_item_userptr( ITEM *item, - const void *userptr) + void *userptr) { return(*(int *)0); } #undef item_userptr -const void *item_userptr( +void *item_userptr( const ITEM *item) - { return(*(const void **)0); } + { return(*(void **)0); } /* ./m_item_val.c */ @@ -373,6 +390,32 @@ Menu_Options menu_opts( const MENU *menu) { return(*(Menu_Options *)0); } +/* ./m_pad.c */ + +#undef set_menu_pad +int set_menu_pad( + MENU *menu, + int pad) + { return(*(int *)0); } + +#undef menu_pad +int menu_pad( + const MENU *menu) + { return(*(int *)0); } + +/* ./m_pattern.c */ + +#undef menu_pattern +char *menu_pattern( + const MENU *menu) + { return(*(char **)0); } + +#undef set_menu_pattern +int set_menu_pattern( + MENU *menu, + const char *p) + { return(*(int *)0); } + /* ./m_post.c */ #undef _nc_Post_Item @@ -408,6 +451,15 @@ int menu_request_by_name( const char *str) { return(*(int *)0); } +/* ./m_scale.c */ + +#undef scale_menu +int scale_menu( + const MENU *menu, + int *rows, + int *cols) + { return(*(int *)0); } + /* ./m_spacing.c */ #undef set_menu_spacing @@ -426,18 +478,31 @@ int menu_spacing( int *s_col) { return(*(int *)0); } +/* ./m_sub.c */ + +#undef set_menu_sub +int set_menu_sub( + MENU *menu, + WINDOW *win) + { return(*(int *)0); } + +#undef menu_sub +WINDOW *menu_sub( + const MENU *menu) + { return(*(WINDOW **)0); } + /* ./m_userptr.c */ #undef set_menu_userptr int set_menu_userptr( MENU *menu, - const void *userptr) + void *userptr) { return(*(int *)0); } #undef menu_userptr -const void *menu_userptr( +void *menu_userptr( const MENU *menu) - { return(*(const void **)0); } + { return(*(void **)0); } /* ./m_win.c */ @@ -451,33 +516,3 @@ int set_menu_win( WINDOW *menu_win( const MENU *menu) { return(*(WINDOW **)0); } - -#undef set_menu_sub -int set_menu_sub( - MENU *menu, - WINDOW *win) - { return(*(int *)0); } - -#undef menu_sub -WINDOW *menu_sub( - const MENU *menu) - { return(*(WINDOW **)0); } - -#undef scale_menu -int scale_menu( - const MENU *menu, - int *rows, - int *cols) - { return(*(int *)0); } - -/* ./m_adabind.c */ - -#undef _nc_ada_normalize_menu_opts -void _nc_ada_normalize_menu_opts( - int *opt) - { /* void */ } - -#undef _nc_ada_normalize_item_opts -void _nc_ada_normalize_item_opts( - int *opt) - { /* void */ } diff --git a/menu/m_adabind.c b/menu/m_adabind.c index 63735b3d..a6167c2c 100644 --- a/menu/m_adabind.c +++ b/menu/m_adabind.c @@ -1,24 +1,34 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** * Module m_adabind.c * @@ -28,12 +38,12 @@ ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_adabind.c,v 1.4 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_adabind.c,v 1.6 1998/02/11 12:13:50 tom Exp $") /* Prototypes for the functions in this module */ -void _nc_ada_normalize_menu_opts (int *opt); -void _nc_ada_normalize_item_opts (int *opt); - +void _nc_ada_normalize_menu_opts (int *opt); +void _nc_ada_normalize_item_opts (int *opt); +ITEM* _nc_get_item(const MENU*, int); void _nc_ada_normalize_menu_opts (int *opt) { @@ -44,3 +54,12 @@ void _nc_ada_normalize_item_opts (int *opt) { *opt = ALL_ITEM_OPTS & (*opt); } + +ITEM* _nc_get_item(const MENU* menu, int idx) { + if (menu && menu->items && idx>=0 && (idxnitems)) + { + return menu->items[idx]; + } + else + return (ITEM*)0; +} diff --git a/menu/m_attribs.c b/menu/m_attribs.c index 00b18776..93baee42 100644 --- a/menu/m_attribs.c +++ b/menu/m_attribs.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_attribs * +* Module m_attribs * * Control menus display attributes * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_attribs.c,v 1.4 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_attribs.c,v 1.6 1998/02/11 12:13:49 tom Exp $") /* Macro to redraw menu if it is posted and changed */ #define Refresh_Menu(menu) \ @@ -128,45 +138,4 @@ GEN_MENU_ATTR_SET_FCT( grey ) | Return Values : Attribute value +--------------------------------------------------------------------------*/ GEN_MENU_ATTR_GET_FCT( grey ) - -/*--------------------------------------------------------------------------- -| Facility : libnmenu -| Function : int set_menu_pad(MENU *menu, int pad) -| -| Description : Set the character to be used to separate the item name -| from its description. This must be a printable -| character. -| -| Return Values : E_OK - success -| E_BAD_ARGUMENT - an invalid value has been passed -+--------------------------------------------------------------------------*/ -int set_menu_pad(MENU *menu, int pad) -{ - bool do_refresh = !(menu); - - if (!isprint((unsigned char)pad)) - RETURN(E_BAD_ARGUMENT); - - Normalize_Menu( menu ); - menu->pad = pad; - - if (do_refresh) - Refresh_Menu( menu ); - - RETURN(E_OK); -} - -/*--------------------------------------------------------------------------- -| Facility : libnmenu -| Function : int menu_pad(const MENU *menu) -| -| Description : Return the value of the padding character -| -| Return Values : The pad character -+--------------------------------------------------------------------------*/ -int menu_pad(const MENU * menu) -{ - return (Normalize_Menu( menu ) -> pad); -} - /* m_attribs.c ends here */ diff --git a/menu/m_cursor.c b/menu/m_cursor.c index 9ad0b12e..ca08f5e3 100644 --- a/menu/m_cursor.c +++ b/menu/m_cursor.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_cursor * +* Module m_cursor * * Correctly position a menus cursor * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_cursor.c,v 1.7 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_cursor.c,v 1.9 1998/02/11 12:13:50 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu diff --git a/menu/m_driver.c b/menu/m_driver.c index 5e86843c..5e47beac 100644 --- a/menu/m_driver.c +++ b/menu/m_driver.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_driver and menu_pattern * -* Central dispatching routine and pattern matching handling * +* Module m_driver * +* Central dispatching routine * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_driver.c,v 1.8 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_driver.c,v 1.10 1998/02/11 12:13:49 tom Exp $") /* Macros */ @@ -78,7 +88,7 @@ static bool Is_Sub_String( /*--------------------------------------------------------------------------- | Facility : libnmenu -| Function : static int Match_Next_Character_In_Item_Name( +| Function : int _nc_Match_Next_Character_In_Item_Name( | MENU *menu, | int ch, | ITEM **item) @@ -101,7 +111,7 @@ static bool Is_Sub_String( | Return Values : E_OK - an item matching the pattern was found | E_NO_MATCH - nothing found +--------------------------------------------------------------------------*/ -static int Match_Next_Character_In_Item_Name(MENU *menu, int ch, ITEM **item) +int _nc_Match_Next_Character_In_Item_Name(MENU *menu, int ch, ITEM **item) { bool found = FALSE, passed = FALSE; int idx, last; @@ -176,81 +186,6 @@ static int Match_Next_Character_In_Item_Name(MENU *menu, int ch, ITEM **item) RETURN(E_NO_MATCH); } -/*--------------------------------------------------------------------------- -| Facility : libnmenu -| Function : char *menu_pattern(const MENU *menu) -| -| Description : Return the value of the pattern buffer. -| -| Return Values : NULL - if there is no pattern buffer allocated -| EmptyString - if there is a pattern buffer but no -| pattern is stored -| PatternString - as expected -+--------------------------------------------------------------------------*/ -char *menu_pattern(const MENU * menu) -{ - return (menu ? (menu->pattern ? menu->pattern : "") : (char *)0); -} - -/*--------------------------------------------------------------------------- -| Facility : libnmenu -| Function : int set_menu_pattern(MENU *menu, const char *p) -| -| Description : Set the match pattern for a menu and position to the -| first item that matches. -| -| Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid menu or pattern pointer -| E_NOT_CONNECTED - no items connected to menu -| E_BAD_STATE - menu in user hook routine -| E_NO_MATCH - no item matches pattern -+--------------------------------------------------------------------------*/ -int set_menu_pattern(MENU *menu, const char *p) -{ - ITEM *matchitem; - int matchpos; - - if (!menu || !p) - RETURN(E_BAD_ARGUMENT); - - if (!(menu->items)) - RETURN(E_NOT_CONNECTED); - - 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) - _nc_Link_Items(menu); - - matchpos = menu->toprow; - matchitem = menu->curitem; - assert(matchitem); - - while(*p) - { - if ( !isprint(*p) || - (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); - RETURN(E_OK); -} - /*--------------------------------------------------------------------------- | Facility : libnmenu | Function : int menu_driver(MENU *menu, int c) @@ -449,7 +384,7 @@ int menu_driver(MENU * menu, int c) /*==================*/ assert(menu->pattern); if (menu->pattern[0]) - result = Match_Next_Character_In_Item_Name(menu,0,&item); + result = _nc_Match_Next_Character_In_Item_Name(menu,0,&item); else { if ((item->index+1)nitems) @@ -468,7 +403,7 @@ int menu_driver(MENU * menu, int c) /*==================*/ assert(menu->pattern); if (menu->pattern[0]) - result = Match_Next_Character_In_Item_Name(menu,BS,&item); + result = _nc_Match_Next_Character_In_Item_Name(menu,BS,&item); else { if (item->index) @@ -492,7 +427,7 @@ int menu_driver(MENU * menu, int c) else { /* not a command */ if ( !(c & ~((int)MAX_REGULAR_CHARACTER)) && isprint(c) ) - result = Match_Next_Character_In_Item_Name( menu, c, &item ); + result = _nc_Match_Next_Character_In_Item_Name( menu, c, &item ); else result = E_UNKNOWN_COMMAND; } diff --git a/menu/m_format.c b/menu/m_format.c index 71b974df..35fdb116 100644 --- a/menu/m_format.c +++ b/menu/m_format.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_format * +* Module m_format * * Set and get maximum numbers of rows and columns in menus * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_format.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_format.c,v 1.7 1998/02/11 12:13:49 tom Exp $") #define minimum(a,b) ((a)<(b) ? (a): (b)) diff --git a/menu/m_global.c b/menu/m_global.c index 9d0ba0ac..09b45727 100644 --- a/menu/m_global.c +++ b/menu/m_global.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_global * +* Module m_global * * Globally used internal routines and the default menu and item structures * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_global.c,v 1.7 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_global.c,v 1.9 1998/02/11 12:13:49 tom Exp $") MENU _nc_Default_Menu = { 16, /* Nr. of chars high */ diff --git a/menu/m_hook.c b/menu/m_hook.c index a30900cd..fc5ce441 100644 --- a/menu/m_hook.c +++ b/menu/m_hook.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_hook * +* Module m_hook * * Assign application specific routines for automatic invocation by menus * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_hook.c,v 1.4 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_hook.c,v 1.6 1998/02/11 12:13:49 tom Exp $") /* "Template" macro to generate function to set application specific hook */ #define GEN_HOOK_SET_FUNCTION( typ, name ) \ diff --git a/menu/m_item_cur.c b/menu/m_item_cur.c index 9881666f..36a7818e 100644 --- a/menu/m_item_cur.c +++ b/menu/m_item_cur.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_item_cur * +* Module m_item_cur * * Set and get current menus item * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_item_cur.c,v 1.7 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_item_cur.c,v 1.9 1998/02/11 12:13:49 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -93,64 +103,4 @@ int item_index(const ITEM *item) return (item && item->imenu) ? item->index : ERR; } -/*--------------------------------------------------------------------------- -| Facility : libnmenu -| Function : int set_top_row(MENU *menu, int row) -| -| Description : Makes the speified row the top row in the menu -| -| Return Values : E_OK - success -| E_BAD_ARGUMENT - not a menu pointer or invalid row -| E_NOT_CONNECTED - there are no items for the menu -+--------------------------------------------------------------------------*/ -int set_top_row(MENU * menu, int row) -{ - ITEM *item; - - if (menu) - { - if ( menu->status & _IN_DRIVER ) - RETURN(E_BAD_STATE); - if (menu->items == (ITEM **)0) - RETURN(E_NOT_CONNECTED); - - 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) - _nc_Link_Items(menu); - - 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); -} - -/*--------------------------------------------------------------------------- -| Facility : libnmenu -| Function : int top_row(const MENU *) -| -| Description : Return the top row of the menu -| -| Return Values : The row number or ERR if there is no row -+--------------------------------------------------------------------------*/ -int top_row(const MENU * menu) -{ - if (menu && menu->items && *(menu->items)) - { - assert( (menu->toprow>=0) && (menu->toprow < menu->rows) ); - return menu->toprow; - } - else - return(ERR); -} - /* m_item_cur.c ends here */ diff --git a/menu/m_item_nam.c b/menu/m_item_nam.c index c18f9477..4bfab978 100644 --- a/menu/m_item_nam.c +++ b/menu/m_item_nam.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_item_nam * +* Module m_item_nam * * Get menus item name and description * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_item_nam.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_item_nam.c,v 1.7 1998/02/11 12:13:49 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu diff --git a/menu/m_item_new.c b/menu/m_item_new.c index 0d0e9844..21caaa14 100644 --- a/menu/m_item_new.c +++ b/menu/m_item_new.c @@ -1,34 +1,44 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_item_new * +* Module m_item_new * * Create and destroy menu items * -* Set and get marker string for menu +* Set and get marker string for menu * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_item_new.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_item_new.c,v 1.8 1998/02/11 12:13:50 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -79,35 +89,13 @@ ITEM *new_item(const char *name, const char *description) *item = _nc_Default_Item; /* hope we have struct assignment */ item->name.length = strlen(name); - item->name.str = (char *)malloc(1 + item->name.length); - if (item->name.str) - { - strcpy(item->name.str, name); - } - else - { - free(item); - SET_ERROR( E_SYSTEM_ERROR ); - return (ITEM *)0; - } - + item->name.str = name; + if (description && (*description != '\0') && Is_Printable_String(description)) { item->description.length = strlen(description); - item->description.str = - (char *)malloc(1 + item->description.length); - if (item->description.str) - { - strcpy(item->description.str, description); - } - else - { - free(item->name.str); - free(item); - SET_ERROR( E_SYSTEM_ERROR ); - return (ITEM *)0; - } + item->description.str = description; } else { @@ -140,10 +128,6 @@ int free_item(ITEM * item) if (item->imenu) RETURN( E_CONNECTED ); - if (item->name.str) - free(item->name.str); - if (item->description.str) - free (item->description.str); free(item); RETURN( E_OK ); diff --git a/menu/m_item_opt.c b/menu/m_item_opt.c index 0d30b08d..14a52b44 100644 --- a/menu/m_item_opt.c +++ b/menu/m_item_opt.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_item_opt * +* Module m_item_opt * * Menus item option routines * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_item_opt.c,v 1.4 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_item_opt.c,v 1.6 1998/02/11 12:13:49 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu diff --git a/menu/m_item_top.c b/menu/m_item_top.c new file mode 100644 index 00000000..88256560 --- /dev/null +++ b/menu/m_item_top.c @@ -0,0 +1,102 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +/*************************************************************************** +* Module m_item_top * +* Set and get top menus item * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_item_top.c,v 1.2 1998/02/11 12:13:50 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_top_row(MENU *menu, int row) +| +| Description : Makes the speified row the top row in the menu +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - not a menu pointer or invalid row +| E_NOT_CONNECTED - there are no items for the menu ++--------------------------------------------------------------------------*/ +int set_top_row(MENU * menu, int row) +{ + ITEM *item; + + if (menu) + { + if ( menu->status & _IN_DRIVER ) + RETURN(E_BAD_STATE); + if (menu->items == (ITEM **)0) + RETURN(E_NOT_CONNECTED); + + 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) + _nc_Link_Items(menu); + + 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); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int top_row(const MENU *) +| +| Description : Return the top row of the menu +| +| Return Values : The row number or ERR if there is no row ++--------------------------------------------------------------------------*/ +int top_row(const MENU * menu) +{ + if (menu && menu->items && *(menu->items)) + { + assert( (menu->toprow>=0) && (menu->toprow < menu->rows) ); + return menu->toprow; + } + else + return(ERR); +} + +/* m_item_top.c ends here */ diff --git a/menu/m_item_use.c b/menu/m_item_use.c index e4fcf15c..4e36b21a 100644 --- a/menu/m_item_use.c +++ b/menu/m_item_use.c @@ -1,44 +1,54 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_item_use * +* Module m_item_use * * Associate application data with menu items * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_item_use.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_item_use.c,v 1.8 1998/02/11 12:13:50 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu -| Function : int set_item_userptr(ITEM *item, const void *userptr) +| Function : int set_item_userptr(ITEM *item, void *userptr) | | Description : Set the pointer that is reserved in any item to store | application relevant informations. | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -int set_item_userptr(ITEM * item, const void * userptr) +int set_item_userptr(ITEM * item, void * userptr) { Normalize_Item(item)->userptr = userptr; RETURN( E_OK ); @@ -46,7 +56,7 @@ int set_item_userptr(ITEM * item, const void * userptr) /*--------------------------------------------------------------------------- | Facility : libnmenu -| Function : const void *item_userptr(const ITEM *item) +| Function : void *item_userptr(const ITEM *item) | | Description : Return the pointer that is reserved in any item to store | application relevant informations. @@ -54,7 +64,7 @@ int set_item_userptr(ITEM * item, const void * userptr) | Return Values : Value of the pointer. If no such pointer has been set, | NULL is returned. +--------------------------------------------------------------------------*/ -const void *item_userptr(const ITEM * item) +void *item_userptr(const ITEM * item) { return Normalize_Item(item)->userptr; } diff --git a/menu/m_item_val.c b/menu/m_item_val.c index 9bb79e59..06e766d5 100644 --- a/menu/m_item_val.c +++ b/menu/m_item_val.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_item_val * +* Module m_item_val * * Set and get menus item values * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_item_val.c,v 1.4 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_item_val.c,v 1.6 1998/02/11 12:13:49 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu diff --git a/menu/m_item_vis.c b/menu/m_item_vis.c index cea7b7ef..b4406012 100644 --- a/menu/m_item_vis.c +++ b/menu/m_item_vis.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_item_vis * +* Module m_item_vis * * Tell if menu item is visible * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_item_vis.c,v 1.6 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_item_vis.c,v 1.8 1998/02/11 12:13:49 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu diff --git a/menu/m_items.c b/menu/m_items.c index 677a0110..461fedf0 100644 --- a/menu/m_items.c +++ b/menu/m_items.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_items * +* Module m_items * * Connect and disconnect items to and from menus * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_items.c,v 1.4 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_items.c,v 1.6 1998/02/11 12:13:49 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu diff --git a/menu/m_new.c b/menu/m_new.c index 66837061..9707b12f 100644 --- a/menu/m_new.c +++ b/menu/m_new.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_new * +* Module m_new * * Creation and destruction of new menus * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_new.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_new.c,v 1.7 1998/02/11 12:13:49 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu diff --git a/menu/m_opts.c b/menu/m_opts.c index 55085901..2de719d2 100644 --- a/menu/m_opts.c +++ b/menu/m_opts.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_opts * +* Module m_opts * * Menus option routines * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_opts.c,v 1.6 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_opts.c,v 1.8 1998/02/11 12:13:49 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu diff --git a/menu/m_pad.c b/menu/m_pad.c new file mode 100644 index 00000000..2235a484 --- /dev/null +++ b/menu/m_pad.c @@ -0,0 +1,90 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +/*************************************************************************** +* Module m_pad * +* Control menus padding character * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_pad.c,v 1.2 1998/02/11 12:13:50 tom Exp $") + +/* Macro to redraw menu if it is posted and changed */ +#define Refresh_Menu(menu) \ + if ( (menu) && ((menu)->status & _POSTED) )\ + {\ + _nc_Draw_Menu( menu );\ + _nc_Show_Menu( menu );\ + } + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_pad(MENU *menu, int pad) +| +| Description : Set the character to be used to separate the item name +| from its description. This must be a printable +| character. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - an invalid value has been passed ++--------------------------------------------------------------------------*/ +int set_menu_pad(MENU *menu, int pad) +{ + bool do_refresh = (menu != (MENU*)0); + + if (!isprint((unsigned char)pad)) + RETURN(E_BAD_ARGUMENT); + + Normalize_Menu( menu ); + menu->pad = pad; + + if (do_refresh) + Refresh_Menu( menu ); + + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int menu_pad(const MENU *menu) +| +| Description : Return the value of the padding character +| +| Return Values : The pad character ++--------------------------------------------------------------------------*/ +int menu_pad(const MENU * menu) +{ + return (Normalize_Menu( menu ) -> pad); +} + +/* m_pad.c ends here */ diff --git a/menu/m_pattern.c b/menu/m_pattern.c new file mode 100644 index 00000000..54d72a55 --- /dev/null +++ b/menu/m_pattern.c @@ -0,0 +1,117 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +/*************************************************************************** +* Module m_pattern * +* Pattern matching handling * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_pattern.c,v 1.2 1998/02/11 12:13:50 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : char *menu_pattern(const MENU *menu) +| +| Description : Return the value of the pattern buffer. +| +| Return Values : NULL - if there is no pattern buffer allocated +| EmptyString - if there is a pattern buffer but no +| pattern is stored +| PatternString - as expected ++--------------------------------------------------------------------------*/ +char *menu_pattern(const MENU * menu) +{ + return (menu ? (menu->pattern ? menu->pattern : "") : (char *)0); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_pattern(MENU *menu, const char *p) +| +| Description : Set the match pattern for a menu and position to the +| first item that matches. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid menu or pattern pointer +| E_NOT_CONNECTED - no items connected to menu +| E_BAD_STATE - menu in user hook routine +| E_NO_MATCH - no item matches pattern ++--------------------------------------------------------------------------*/ +int set_menu_pattern(MENU *menu, const char *p) +{ + ITEM *matchitem; + int matchpos; + + if (!menu || !p) + RETURN(E_BAD_ARGUMENT); + + if (!(menu->items)) + RETURN(E_NOT_CONNECTED); + + 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) + _nc_Link_Items(menu); + + matchpos = menu->toprow; + matchitem = menu->curitem; + assert(matchitem); + + while(*p) + { + if ( !isprint(*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); + RETURN(E_OK); +} + +/* m_pattern.c ends here */ diff --git a/menu/m_post.c b/menu/m_post.c index b9f0bd4a..3838bb6a 100644 --- a/menu/m_post.c +++ b/menu/m_post.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_post * +* Module m_post * * Write or erase menus from associated subwindows * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_post.c,v 1.12 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_post.c,v 1.14 1998/02/11 12:13:49 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu diff --git a/menu/m_req_name.c b/menu/m_req_name.c index 13c9e31f..1ce78895 100644 --- a/menu/m_req_name.c +++ b/menu/m_req_name.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_request_name * +* Module m_request_name * * Routines to handle external names of menu requests * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_req_name.c,v 1.8 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_req_name.c,v 1.10 1998/02/11 12:13:50 tom Exp $") static const char *request_names[ MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1 ] = { "LEFT_ITEM" , diff --git a/menu/m_scale.c b/menu/m_scale.c new file mode 100644 index 00000000..608afe6a --- /dev/null +++ b/menu/m_scale.c @@ -0,0 +1,71 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +/*************************************************************************** +* Module m_scale * +* Menu scaling routine * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_scale.c,v 1.2 1998/02/11 12:13:50 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int scale_menu(const MENU *menu) +| +| Description : Returns the minimum window size necessary for the +| subwindow of menu. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid menu pointer +| E_NOT_CONNECTED - no items are connected to menu ++--------------------------------------------------------------------------*/ +int scale_menu(const MENU *menu, int *rows, int *cols) +{ + if (!menu) + RETURN( E_BAD_ARGUMENT ); + + if (menu->items && *(menu->items)) + { + if (rows) + *rows = menu->height; + if (cols) + *cols = menu->width; + RETURN(E_OK); + } + else + RETURN( E_NOT_CONNECTED ); +} + +/* m_scale.c ends here */ + diff --git a/menu/m_spacing.c b/menu/m_spacing.c index 7f690b27..0697dbb4 100644 --- a/menu/m_spacing.c +++ b/menu/m_spacing.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_spacing * +* Module m_spacing * * Routines to handle spacing between entries * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_spacing.c,v 1.7 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_spacing.c,v 1.9 1998/02/11 12:13:49 tom Exp $") #define MAX_SPC_DESC ((TABSIZE) ? (TABSIZE) : 8) #define MAX_SPC_COLS ((TABSIZE) ? (TABSIZE) : 8) diff --git a/menu/m_sub.c b/menu/m_sub.c new file mode 100644 index 00000000..353c733c --- /dev/null +++ b/menu/m_sub.c @@ -0,0 +1,80 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +/*************************************************************************** +* Module m_sub * +* Menus subwindow association routines * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_sub.c,v 1.2 1998/02/11 12:13:50 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_sub(MENU *menu, WINDOW *win) +| +| Description : Sets the subwindow of the menu. +| +| Return Values : E_OK - success +| E_POSTED - menu is already posted ++--------------------------------------------------------------------------*/ +int set_menu_sub(MENU *menu, WINDOW *win) +{ + if (menu) + { + 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); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : WINDOW *menu_sub(const MENU *menu) +| +| Description : Returns a pointer to the subwindow of the menu +| +| Return Values : NULL on error, otherwise a pointer to the window ++--------------------------------------------------------------------------*/ +WINDOW *menu_sub(const MENU * menu) +{ + const MENU* m = Normalize_Menu(menu); + return Get_Menu_Window(m); +} + +/* m_sub.c ends here */ diff --git a/menu/m_userptr.c b/menu/m_userptr.c index 9ac73b9f..fdfeccae 100644 --- a/menu/m_userptr.c +++ b/menu/m_userptr.c @@ -1,44 +1,54 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_userptr * +* Module m_userptr * * Associate application data with menus * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_userptr.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_userptr.c,v 1.8 1998/02/11 12:13:50 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu -| Function : int set_menu_userptr(MENU *menu, const void *userptr) +| Function : int set_menu_userptr(MENU *menu, void *userptr) | | Description : Set the pointer that is reserved in any menu to store | application relevant informations. | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -int set_menu_userptr(MENU * menu, const void * userptr) +int set_menu_userptr(MENU * menu, void * userptr) { Normalize_Menu(menu)->userptr = userptr; RETURN( E_OK ); @@ -46,7 +56,7 @@ int set_menu_userptr(MENU * menu, const void * userptr) /*--------------------------------------------------------------------------- | Facility : libnmenu -| Function : char *menu_userptr(const MENU *menu) +| Function : void *menu_userptr(const MENU *menu) | | Description : Return the pointer that is reserved in any menu to | store application relevant informations. @@ -54,7 +64,7 @@ int set_menu_userptr(MENU * menu, const void * userptr) | Return Values : Value of the pointer. If no such pointer has been set, | NULL is returned +--------------------------------------------------------------------------*/ -const void *menu_userptr(const MENU * menu) +void *menu_userptr(const MENU * menu) { return( Normalize_Menu(menu)->userptr); } diff --git a/menu/m_win.c b/menu/m_win.c index 2cc5c236..2bcba55c 100644 --- a/menu/m_win.c +++ b/menu/m_win.c @@ -1,33 +1,43 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** -* Module menu_win * -* Menus window and subwindow association routines * +* Module m_win * +* Menus window association routines * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$Id: m_win.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") +MODULE_ID("$Id: m_win.c,v 1.7 1998/02/11 12:13:49 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -67,70 +77,4 @@ WINDOW *menu_win(const MENU *menu) return (m->userwin ? m->userwin : stdscr); } -/*--------------------------------------------------------------------------- -| Facility : libnmenu -| Function : int set_menu_sub(MENU *menu, WINDOW *win) -| -| Description : Sets the subwindow of the menu. -| -| Return Values : E_OK - success -| E_POSTED - menu is already posted -+--------------------------------------------------------------------------*/ -int set_menu_sub(MENU *menu, WINDOW *win) -{ - if (menu) - { - 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); -} - -/*--------------------------------------------------------------------------- -| Facility : libnmenu -| Function : WINDOW *menu_sub(const MENU *menu) -| -| Description : Returns a pointer to the subwindow of the menu -| -| Return Values : NULL on error, otherwise a pointer to the window -+--------------------------------------------------------------------------*/ -WINDOW *menu_sub(const MENU * menu) -{ - const MENU* m = Normalize_Menu(menu); - return Get_Menu_Window(m); -} - -/*--------------------------------------------------------------------------- -| Facility : libnmenu -| Function : int scale_menu(const MENU *menu) -| -| Description : Returns the minimum window size necessary for the -| subwindow of menu. -| -| Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid menu pointer -| E_NOT_CONNECTED - no items are connected to menu -+--------------------------------------------------------------------------*/ -int scale_menu(const MENU *menu, int *rows, int *cols) -{ - if (!menu) - RETURN( E_BAD_ARGUMENT ); - - if (menu->items && *(menu->items)) - { - if (rows) - *rows = menu->height; - if (cols) - *cols = menu->width; - RETURN(E_OK); - } - else - RETURN( E_NOT_CONNECTED ); -} - /* m_win.c ends here */ diff --git a/menu/menu.h b/menu/menu.h index b63c7406..03c3cbc8 100644 --- a/menu/menu.h +++ b/menu/menu.h @@ -1,24 +1,34 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ #ifndef ETI_MENU #define ETI_MENU @@ -46,7 +56,7 @@ typedef int Item_Options; typedef struct { - char* str; + const char* str; unsigned short length; } TEXT; @@ -55,7 +65,7 @@ typedef struct tagITEM TEXT name; /* name of menu item */ TEXT description; /* description of item, optional in display */ struct tagMENU *imenu; /* Pointer to parent menu */ - const void *userptr; /* Pointer to user defined per item data */ + void *userptr; /* Pointer to user defined per item data */ Item_Options opt; /* Item options */ short index; /* Item number if connected to a menu */ short y; /* y and x location of item in menu */ @@ -107,7 +117,7 @@ typedef struct tagMENU Menu_Hook iteminit; Menu_Hook itemterm; - const void *userptr; /* Pointer to menus user data */ + void *userptr; /* Pointer to menus user data */ char *mark; /* Pointer to marker string */ Menu_Options opt; /* Menu options */ @@ -178,10 +188,10 @@ extern const char *item_description(const ITEM *), *menu_mark(const MENU *), *menu_request_name(int); -extern char *menu_pattern(const MENU *); +extern char *menu_pattern(const MENU *); -extern const void *menu_userptr(const MENU *), - *item_userptr(const ITEM *); +extern void *menu_userptr(const MENU *), + *item_userptr(const ITEM *); extern chtype menu_back(const MENU *), menu_fore(const MENU *), @@ -204,7 +214,7 @@ extern int free_item(ITEM *), set_item_init(MENU *,void(*)(MENU *)), set_item_opts(ITEM *,Item_Options), set_item_term(MENU *,void(*)(MENU *)), - set_item_userptr(ITEM *, const void *), + set_item_userptr(ITEM *, void *), set_item_value(ITEM *,bool), set_menu_back(MENU *,chtype), set_menu_fore(MENU *,chtype), @@ -218,7 +228,7 @@ extern int free_item(ITEM *), set_menu_pattern(MENU *,const char *), set_menu_sub(MENU *,WINDOW *), set_menu_term(MENU *,void(*)(MENU *)), - set_menu_userptr(MENU *,const void *), + set_menu_userptr(MENU *,void *), set_menu_win(MENU *,WINDOW *), set_top_row(MENU *,int), top_row(const MENU *), diff --git a/menu/menu.priv.h b/menu/menu.priv.h index e478e0c0..fb39c779 100644 --- a/menu/menu.priv.h +++ b/menu/menu.priv.h @@ -1,24 +1,34 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /*************************************************************************** * Module menu.priv.h * @@ -97,3 +107,4 @@ extern bool _nc_Connect_Items(MENU *, ITEM **); extern void _nc_Disconnect_Items(MENU *); extern void _nc_New_TopRow_and_CurrentItem(MENU *,int, ITEM *); extern void _nc_Link_Items(MENU *); +extern int _nc_Match_Next_Character_In_Item_Name(MENU*,int,ITEM**); diff --git a/menu/mf_common.h b/menu/mf_common.h index 1e0b3caf..a98bee58 100644 --- a/menu/mf_common.h +++ b/menu/mf_common.h @@ -1,24 +1,34 @@ -/*-----------------------------------------------------------------------------+ -| The ncurses menu library is Copyright (C) 1995-1997 | -| by Juergen Pfeifer | -| All Rights Reserved. | -| | -| Permission to use, copy, modify, and distribute this software and its | -| documentation for any purpose and without fee is hereby granted, provided | -| that the above copyright notice appear in all copies and that both that | -| copyright notice and this permission notice appear in supporting | -| documentation, and that the name of the above listed copyright holder(s) not | -| be used in advertising or publicity pertaining to distribution of the | -| software without specific, written prior permission. | -| | -| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | -| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | -| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | -| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | -| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | -| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | -| THE USE OR PERFORMANCE OF THIS SOFTWARE. | -+-----------------------------------------------------------------------------*/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ /* Common internal header for menu and form library */ @@ -31,15 +41,12 @@ #include #include #include +#include -#if !HAVE_EXTERN_ERRNO +#if DECL_ERRNO extern int errno; #endif -#if HAVE_EXTERN_ERRNO -#include -#endif - /* in case of debug version we ignore the suppression of assertions */ #ifdef TRACE # ifdef NDEBUG @@ -60,6 +67,7 @@ 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) ) /* The few common values in the status fields for menus and forms */ diff --git a/menu/modules b/menu/modules index 53eab5a9..b97165b8 100644 --- a/menu/modules +++ b/menu/modules @@ -1,23 +1,38 @@ -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: modules,v 1.13 1998/02/11 12:13:50 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# + +@ base # Library objects +m_adabind lib $(srcdir) $(MENU_PRIV_H) m_attribs lib $(srcdir) $(MENU_PRIV_H) m_cursor lib $(srcdir) $(MENU_PRIV_H) m_driver lib $(srcdir) $(MENU_PRIV_H) @@ -28,15 +43,19 @@ m_item_cur lib $(srcdir) $(MENU_PRIV_H) m_item_nam lib $(srcdir) $(MENU_PRIV_H) m_item_new lib $(srcdir) $(MENU_PRIV_H) m_item_opt lib $(srcdir) $(MENU_PRIV_H) +m_item_top lib $(srcdir) $(MENU_PRIV_H) m_item_use lib $(srcdir) $(MENU_PRIV_H) m_item_val lib $(srcdir) $(MENU_PRIV_H) m_item_vis lib $(srcdir) $(MENU_PRIV_H) m_items lib $(srcdir) $(MENU_PRIV_H) m_new lib $(srcdir) $(MENU_PRIV_H) m_opts lib $(srcdir) $(MENU_PRIV_H) +m_pad lib $(srcdir) $(MENU_PRIV_H) +m_pattern lib $(srcdir) $(MENU_PRIV_H) m_post lib $(srcdir) $(MENU_PRIV_H) 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_userptr lib $(srcdir) $(MENU_PRIV_H) m_win lib $(srcdir) $(MENU_PRIV_H) -m_adabind lib $(srcdir) $(MENU_PRIV_H) diff --git a/misc/Makefile.in b/misc/Makefile.in index 147e8537..2b6d2e62 100644 --- a/misc/Makefile.in +++ b/misc/Makefile.in @@ -1,23 +1,34 @@ -# $Id: Makefile.in,v 1.13 1996/06/23 00:54:27 tom Exp $ -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: Makefile.in,v 1.20 1998/02/11 12:13:52 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# # Makefile for ncurses miscellany directory # # This makes/installs the terminfo database @@ -34,7 +45,7 @@ SHELL = /bin/sh THIS = Makefile -NC_MFLAGS = @nc_cv_makeflags@ +CF_MFLAGS = @cf_cv_makeflags@ @SET_MAKE@ INSTALL_PREFIX = @INSTALL_PREFIX@ @@ -54,6 +65,8 @@ INSTALL_DATA = @INSTALL_DATA@ ################################################################################ all: +sources: + install: install.data install.data: $(INSTALL_PREFIX)$(libdir) \ @@ -61,7 +74,7 @@ install.data: $(INSTALL_PREFIX)$(libdir) \ $(INSTALL_PREFIX)$(tabsetdir) sh $(srcdir)/run_tic.sh $(bindir) $(srcdir) $(ticdir) $(INSTALL_PREFIX) @cd $(srcdir)/tabset && \ - sh -c 'for i in *; do \ + sh -c 'for i in `echo * | fgrep -v CVS | fgrep -v RCS`; do \ echo installing $$i; \ $(INSTALL_DATA) $$i $(INSTALL_PREFIX)$(tabsetdir); done' @@ -70,18 +83,24 @@ $(INSTALL_PREFIX)$(tabsetdir) \ $(INSTALL_PREFIX)$(ticdir) : $(srcdir)/../mkinstalldirs $@ +uninstall: uninstall.data + +uninstall.data: + -cd $(INSTALL_PREFIX)$(ticdir) && rm -rf * + -cd $(INSTALL_PREFIX)$(tabsetdir) && rm -rf * + tags: TAGS: -clean :: - -rm -f tags TAGS *~ +mostlyclean: + -rm -f core tags TAGS *~ *.ln *.atac trace + +clean :: mostlyclean distclean: clean -rm -f Makefile -mostlyclean: clean - realclean: distclean ############################################################################### diff --git a/misc/emx.src b/misc/emx.src new file mode 100644 index 00000000..59072089 --- /dev/null +++ b/misc/emx.src @@ -0,0 +1,810 @@ +# $Id: emx.src,v 1.4 1998/02/01 00:03:44 tom Exp $ +# This is a reformatted copy of the terminfo source for OS/2 EMX from +# Juan Jose Garcia Ripoll . +# http://www.arrakis.es/~worm/ +#---------------------------------------------------------------------------- +# +# This section describes terminal classes and maker brands that are still +# quite common. +# + +#### Specials +# +# Special "terminals". These are used to label tty lines when you don't +# know what kind of terminal is on it. The characteristics of an unknown +# terminal are the lowest common denominator - they look about like a ti 700. +# + +dumb|80-column dumb tty, + am, + cols#80, + bel=^G, + cr=^M, + cud1=^J, + ind=^J, +unknown|unknown terminal type, + gn, + use=dumb, +lpr|printer|line printer, + hc, + os, + cols#132, + lines#66, + bel=^G, + cr=^M, + cub1=^H, + cud1=^J, + ff=^L, + ind=^J, +glasstty|classic glass tty interpreting ASCII control characters, + am, + cols#80, + bel=^G, + clear=^L, + cr=^M, + cub1=^H, + cud1=^J, + ht=^I, + kbs=^H, + kcub1=^H, + kcud1=^J, + nel=^M^J, + +#### ANSI.SYS/ISO 6429/ECMA-48 Capabilities +# +# See the end-of-file comment for more on these. +# + +# The IBM PC alternate character set. Plug this into any Intel console entry. +# We use \E[11m for rmacs rather than \E[12m so the string can use the +# ROM graphics for control characters such as the diamond, up- and down-arrow. +# This works with the System V, Linux, and BSDI consoles. It's a safe bet this +# will work with any Intel console, they all seem to have inherited \E[11m +# from the ANSI.SYS de-facto standard. +klone+acs|alternate character set for ansi.sys displays, + acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, + rmacs=\E[10m, + smacs=\E[11m, + +# Highlight controls corresponding to the ANSI.SYS standard. Most +# console drivers for Intel boxes obey these. Makes the same assumption +# about \E[11m as klone+acs. True ANSI/ECMA-48 would have , +# , but this isn't a documented feature of ANSI.SYS. +klone+sgr|attribute control for ansi.sys displays, + blink=\E[5m, + bold=\E[1m, + invis=\E[8m, + rev=\E[7m, + rmacs=\E[10m, + rmpch=\E[10m, + rmso=\E[m, + rmul=\E[m, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, + sgr0=\E[0;10m, + smacs=\E[11m, + smpch=\E[11m, + smso=\E[7m, + smul=\E[4m, + +# Highlight controls corresponding to the ANSI.SYS standard. *All* +# console drivers for Intel boxes obey these. Does not assume \E[11m will +# work; uses \E[12m instead, which is pretty bulletproof but loses you the ACS +# diamond and arrow characters under curses. +klone+sgr-dumb|attribute control for ansi.sys displays (no ESC [ 11 m), + blink=\E[5m, + bold=\E[1m, + invis=\E[8m, + rev=\E[7m, + rmacs=\E[10m, + rmso=\E[m, + rmul=\E[m, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;12%;m, + sgr0=\E[0;10m, + smacs=\E[12m, + smso=\E[7m, + smul=\E[4m, + +# ANSI.SYS color control. +# The DOS 5 manual asserts that these sequences meet the ISO 6429 standard. +klone+color|color control for ansi.sys and ISO6429-compatible displays, + colors#8, + ncv#3, + pairs#64, + op=\E[37;40m, + 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, + +#### ANSI/ECMA-48 terminals and terminal emulators +# +# See near the end of this file for details on ANSI conformance. +# Don't mess with these entries! Lots of other entries depend on them! +# +# This section lists entries in a least-capable to most-capable order. +# if you're in doubt about what `ANSI' matches yours, try them in that +# order and back off from the first that breaks. + +ansi-mini|any ansi terminal with pessimistic assumptions, + am, + cols#80, + it#8, + lines#24, + clear=\E[H\E[2J$<50>, + cub1=\E[D, + cud1=\E[B, + cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, + cuu1=\E[A, + el=\E[K, + home=\E[H, + ht=^I, + +# +# ANSI.SYS entries +# +# This completely describes the sequences specified in the DOS 2.1 ANSI.SYS +# documentation (except for the keyboard key reassignment feature, which +# doen't fit the model well). The klone+acs sequences were valid +# though undocumented. The capability is untested but should work for +# keys F1-F10 (%p1 values outside this range will yield unpredictable results). +# From: Eric S. Raymond Nov 7 1995 +ansi.sys-old|ANSI.SYS under PC-DOS 2.1, + am, + mir, + msgr, + xon, + cols#80, + lines#25, + clear=\E[2J, + cub1=^H, + cud1=\E[B, + cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, + cuu1=\E[A, + el=\E[k, + home=\E[H, + is2=\E[m\E[?7h, + kcub1=^H, + kcud1=^J, + kcuf1=^L, + kcuu1=^K, + khome=^^, + pfkey=\E[0;%p1%{58}%+%d;%p2"%s", + rc=\E[u, + rmam=\E[?7l, + sc=\E[s, + smam=\E[?7h, + u6=\E[%i%d;%dR, + u7=\E[6n, + use=klone+color, + use=klone+acs, + use=klone+sgr, +ansi.sys|ANSI.SYS 3.1 and later versions, + el=\E[K, + use=ansi.sys-old, + +### EMX termcap.dat compatibility modes +# +# Keypad: Home=\0G Up=\0H PrPag=\0I +# ka1,kh kcuu1 kpp,ka3 +# +# Left=\0K 5=\0L Right=\0M +# kcub1 kb2 kcuf1 +# +# End=\0O Down=\0P NxPag=\0Q +# kc1,kend kcud1 kc3,knp +# +# Ins=\0R Del=\0S +# kich1 kdch1 +# +# On keyboard with 12 function keys, +# shifted f-keys: F13-F24 +# control f-keys: F25-F36 +# alt f-keys: F37-F48 +# The shift/control/alt keys do not modify each other, but alt overrides both, +# and control overrides shift. +# +# Also (possibly only EMX, so we don't put it in ansi.sys, etc): set the +# no_color_video to inform the application that standout(1), underline(2) +# reverse(4) and invisible(64) don't work with color. +emx-base|DOS special keys, + ncv#71, + bel=^G, + ka1=\0G, + ka3=\0I, + kb2=\0L, + kbs=^H, + kc1=\0O, + kc3=\0Q, + kcbt=\0^O, + kcub1=\0K, + kcud1=\0P, + kcuf1=\0M, + kcuu1=\0H, + kdch1=\0S, + kend=\0O, + kf1=\0;, + kf10=\0D, + kf11=\0\205, + kf12=\0\206, + kf13=\0T, + kf14=\0U, + kf15=\0V, + kf16=\0W, + kf17=\0X, + kf18=\0Y, + kf19=\0Z, + kf2=\0<, + kf20=\0[, + kf21=\0\\, + kf22=\0], + kf23=\0\207, + kf24=\0\210, + kf25=\0\^, + kf26=\0_, + kf27=\0`, + kf28=\0a, + kf29=\0b, + kf3=\0=, + kf30=\0c, + kf31=\0d, + kf32=\0e, + kf33=\0f, + kf34=\0g, + kf35=\0\211, + kf36=\0\212, + kf37=\0h, + kf38=\0i, + kf39=\0j, + kf4=\0>, + kf40=\0k, + kf41=\0l, + kf42=\0m, + kf43=\0n, + kf44=\0o, + kf45=\0p, + kf46=\0q, + kf47=\0\213, + kf48=\0\214, + kf5=\0?, + kf6=\0@, + kf7=\0A, + kf8=\0B, + kf9=\0C, + khome=\0G, + kich1=\0R, + knp=\0Q, + kpp=\0I, + use=ansi.sys, +# +# To properly translate termcap.dat -> terminfo.src remember these +# equivalences: +# ti <-> smcup string to start programs using cup(termcap) +# te <-> rmcup string to end programs using cup +# so <-> smso begin standout mode +# se <-> rmso exit standout mode +# us <-> smul begin underline mode +# ue <-> rmul exit underline mode +# mb <-> blink turn on blinking +# md <-> bold turn on extra bright (bold) mode +# mr <-> rev turn on reverse video mode +# me <-> sgr0 turn off all atributes +# +# On my terminal, \E[4m looks dim. +ansi|ANSI.SYS color, + blink=\E[5m, + bold=\E[1m, + rev=\E[7m, + rmcup=\E[0m, + rmso=\E[0m, + rmul@, + sgr0=\E[0m, + smcup=\E[0;30;47m, + smso=\E[7m, + smul@, + use=emx-base, +window|ANSI.SYS window, + blink=\E[5m, + bold=\E[1;37;47m, + rev=\E[1;37;47m, + rmcup=\E[0m, + rmso=\E[0;30;47m, + rmul=\E[0;30;47m, + sgr0=\E[0;30;47m, + smcup=\E[0;30;47m, + smso=\E[1;37;47m, + smul=\E[1;31;47m, + use=emx-base, +mono|ANSI.SYS mono, + blink=\E[5m, + bold=\E[1m, + rev=\E[7m, + rmcup=\E[0m, + rmso=\E[m, + rmul=\E[m, + sgr0=\E[m, + smcup=\E[0m, + smso=\E[1m, + smul=\E[4m, + use=emx-base, +# same as mono, but use reverse video for standout (nice for Emacs) +rmono|ANSI.SYS reverse mono, + smso=\E[7m, + use=mono, +# same as mono, but use a readable color for underlining +mono2|ANSI.SYS mono2, + rmul=\E[0m, + smul=\E[1;31;40m, + use=mono, +# nice colors for Emacs (white on blue, mode line white on cyan) +ansi-color-2|ANSI.SYS color 2, + rmcup=\E[0m, + rmso=\E[0;37;44m, + rmul=\E[0m, + sgr0=\E[0;37;44m, + smcup=\E[0;37;44m, + smso=\E[1;37;46m, + smul=\E[1;31;40m, + use=ansi, +# nice colors for Emacs (white on black, mode line black on cyan) +ansi-color-3|ANSI.SYS color 3, + rmcup=\E[0m, + rmso=\E[0m, + rmul=\E[0m, + sgr0=\E[0m, + smcup=\E[0m, + smso=\E[30;46m, + smul=\E[1;31;40m, + use=ansi, + +#### X terminal emulators +# +# X10/6.6 11/7/86, minus alternate screen, plus (csr) +# (xterm: ":MT:" changed to ":km:"; added / based on init string; +# removed (hs, eslok, tsl=\E[?E\E[?%i%dT, fsl=\E[?F, dsl=\E[?E) +# as these seem not to work -- esr) +x10term|vs100-x10|xterm terminal emulator (X10 window system), + am, + km, + mir, + msgr, + xenl, + xon, + cols#80, + it#8, + lines#65, + bold=\E[1m, + clear=\E[H\E[2J, + csr=\E[%i%p1%d;%p2%dr, + 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, + home=\E[H, + ht=^I, + il=\E[%p1%dL, + il1=\E[L, + ind=^J, + is2=\E\E[m\E[?7h\E[?1;4l, + kbs=^H, + kcub1=\EOD, + kcud1=\EOB, + kcuf1=\EOC, + kcuu1=\EOA, + kf1=\EOP, + kf2=\EOQ, + kf3=\EOR, + kf4=\EOS, + rev=\E[7m, + ri=\EM, + rmam=\E[?7l, + rmir=\E[4l, + rmkx=\E[?1l\E>, + rmso=\E[m, + rmul=\E[m, + sgr0=\E[m, + smam=\E[?7h, + smir=\E[4h, + smkx=\E[?1h\E=, + smso=\E[7m, + smul=\E[4m, +# X11R6 xterm. This is known good for the XFree86 version under Linux. +# It is *way* more featureful than the stock X consortium entry (has acsc, +# for starters). The key is actually the \E[M prefix returned by +# xterm's internal mouse-tracking facility; ncurses will interpret the +# following three bytes of mouse status information. +# From: Eric S. Raymond 14 Dec 1995 +xterm|vs100|xterm terminal emulator (X11R6 Window System), + am, + km, + mir, + msgr, + xenl, + xon, + cols#80, + it#8, + lines#65, + acsc=++\,\,--..00II``aaffgghhjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, + bold=\E[1m, + 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, + ed=\E[J, + el=\E[K, + enacs=\E(B\E)0, + home=\E[H, + ht=^I, + ich=\E[%p1%d@, + ich1=\E[@, + il=\E[%p1%dL, + il1=\E[L, + ind=^J, + is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, + kbs=^H, + kcub1=\EOD, + kcud1=\EOB, + kcuf1=\EOC, + kcuu1=\EOA, + kend=\EOe, + 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~, + khome=\EO\0, + kich1=\E[2~, + kmous=\E[M, + knp=\E[6~, + kpp=\E[5~, + 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>, + rmso=\E[m, + rmul=\E[m, + rs1=^O, + rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E<, + sc=\E7, + 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[3k, + u6=\E[%i%d;%dR, + u7=\E[6n, + u8=\E[?1;2c, + u9=\E[c, +xterm-bold|xterm terminal emulator (X11R6 Window System) standout w/bold, + smso=\E[1m, + use=xterm, +xterms|vs100s|xterm terminal emulator (small screen 24x80), + cols#80, + lines#24, + use=xterm, +# (kterm: this had extension capabilities ":KJ:TY=ascii:" -- esr) +kterm|kterm kanji terminal emulator (X window system), + eslok, + hs, + csr=\E[%i%p1%d;%p2%dr, + dsl=\E[?H, + fsl=\E[?F, + rc=\E8, + sc=\E7, + tsl=\E[?E\E[?%i%dT, + use=xterm, + +# See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file +xterm-nic|xterm with ich/ich1 suppressed for non-curses programs, + ich@, + ich1@, + use=xterm, + +# Should work with the color xterm on the X11R6 contrib tape. +# Assumes the xterm attribute default is black on white. +# From: Eric S. Raymond March 4 1996 +xterm-color|xterm with color support, + op=\E[30;47m, + use=xterm, + use=klone+color, + +# From: Thomas Dickey 13 Dec 1995 +rxvt|rxvt terminal emulator, + kend=\EOw, + khome=\E[H, + kmous@, + use=xterm, + use=klone+color, + +# From: David J. MacKenzie 20 Apr 1995 +# Here's a termcap entry I've been using for xterm_color, which comes +# with BSD/OS 2.0, and the X11R6 contrib tape too I think. Besides the +# color stuff, I also have a status line defined as the window manager +# title bar. [I have translated it to terminfo -- ESR] +xterm-pcolor|xterm with color used for highlights and status line, + hs, + wsl#40, + bold=\E[1m\E[43m, + dsl=\E]0;\007, + fsl=^G, + rev=\E[7m\E[34m, + smso=\E[7m\E[31m, + smul=\E[4m\E[42m, + tsl=\E]0;, + use=xterm, + +# HP ships this, except for the pb#9600 which was merged in from BSD termcap. +hpterm|X-hpterm|hp X11 terminal emulator, + am, + da, + db, + mir, + xhp, + cols#80, + lh#2, + lines#24, + lm#0, + lw#8, + nlab#8, + pb#9600, + xmc#0, + bel=^G, + bold=\E&dB, + cbt=\Ei, + clear=\E&a0y0C\EJ, + cr=^M, + cub1=^H, + cud1=\EB, + cuf1=\EC, + cup=\E&a%p1%dy%p2%dC, + cuu1=\EA, + dch1=\EP, + dim=\E&dH, + dl1=\EM, + ed=\EJ$<1>, + el=\EK, + hpa=\E&a%p1%dC, + ht=^I, + hts=\E1, + il1=\EL, + ind=^J, + kbs=^H, + kclr=\EJ, + kctab=\E2, + kcub1=\ED, + kcud1=\EB, + kcuf1=\EC, + kcuu1=\EA, + kdch1=\EP, + kdl1=\EM, + ked=\EJ, + kel=\EK, + kf1=\Ep, + kf2=\Eq, + kf3=\Er, + kf4=\Es, + kf5=\Et, + kf6=\Eu, + kf7=\Ev, + kf8=\Ew, + khome=\Eh, + khts=\E1, + kich1=\EQ, + kil1=\EL, + kind=\ES, + kll=\EF, + knp=\EU, + kpp=\EV, + kri=\ET, + krmir=\ER, + ktbc=\E3, + meml=\El, + memu=\Em, + pfkey=\E&f%p1%dk%p2%l%dL%p2%s, + pfloc=\E&f1a%p1%dk%p2%l%dL%p2%s, + pfx=\E&f2a%p1%dk%p2%l%dL%p2%s, + pln=\E&f%p1%dk%p2%l%dd0L%p2%s, + rev=\E&dB, + ri=\ET, + rmacs=^O, + rmir=\ER, + rmkx=\E&s0A, + rmln=\E&j@, + rmso=\E&d@, + rmul=\E&d@, + sgr=\E&d%?%p7%t%'s'%c%;%p1%p3%|%p6%|%{2}%*%p2%{4}%*%+%p4%+%p5%{8}%*%+%'@'%+%c%?%p9%t%'\016'%c%e%'\017'%c%;, + sgr0=\E&d@, + smacs=^N, + smir=\EQ, + smkx=\E&s1A, + smln=\E&jB, + smso=\E&dJ, + smul=\E&dD, + tbc=\E3, + vpa=\E&a%p1%dY, + +# This entry describes an xterm with Sun-style function keys enabled +# via the X resource setting "xterm*sunFunctionKeys:true" +# To understand / note that L1,L2 and F11,F12 are the same. +# The ... keys are L3-L10. We don't set +# because we want it to be seen as . +# The ... keys are R1-R15. We treat some of these in accordance +# with their Sun keyboard labels instead. +# From: Simon J. Gerraty 10 Jan 1996 +xterm-sun|xterm with sunFunctionKeys true, + kb2=\E[218z, + kcpy=\E[197z, + kend=\E[220z, + kf1=\E[224z, + kf10=\E[233z, + kf11=\E[192z, + kf12=\E[193z, + kf13=\E[194z, + kf14=\E[195z, + kf15=\E[196z, + kf17=\E[198z, + kf18=\E[199z, + kf19=\E[200z, + kf2=\E[225z, + kf20=\E[201z, + kf3=\E[226z, + kf31=\E[208z, + kf32=\E[209z, + kf33=\E[210z, + kf34=\E[211z, + kf35=\E[212z, + kf36=\E[213z, + kf38=\E[215z, + kf4=\E[227z, + kf40=\E[217z, + kf42=\E[219z, + kf44=\E[221z, + kf5=\E[228z, + kf6=\E[229z, + kf7=\E[230z, + kf8=\E[231z, + kf9=\E[232z, + kfnd=\E[200z, + khlp=\E[196z, + khome=\E[214z, + kich1=\E[2z, + knp=\E[222z, + kpp=\E[216z, + kund=\E[195z, + use=xterm, +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. +emu|emu native mode, + 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, + cvvis=\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, + 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, diff --git a/misc/hackguide.doc b/misc/hackguide.doc index 11bcd707..1dd3f491 100644 --- a/misc/hackguide.doc +++ b/misc/hackguide.doc @@ -162,10 +162,9 @@ If autoconf Fails How to Report Bugs - The reporting address for bugs is ncurses@bsdi.com. This is a - majordomo list; to join, write to ncurses-request@mailgate.bsdi.com - with a message containing the line: - + The reporting address for bugs is bug-ncurses@gnu.org. This is a + majordomo list; to join, write to ncurses-request@gnu.org with a + message containing the line: subscribe @ The ncurses code is maintained by a small group of volunteers. While diff --git a/misc/hackguide.html b/misc/hackguide.html index 0bbbd6d1..9cd317b9 100644 --- a/misc/hackguide.html +++ b/misc/hackguide.html @@ -1,6 +1,6 @@ @@ -199,9 +199,9 @@ announcement document to WWW pretty trivial.

    How to Report Bugs

    The reporting address for bugs is -ncurses@bsdi.com. +bug-ncurses@gnu.org. This is a majordomo list; to join, write -to ncurses-request@mailgate.bsdi.com with a message containing the line: +to ncurses-request@gnu.org with a message containing the line:
                  subscribe <name>@<host.domain>
     
    @@ -850,6 +850,6 @@ The package kernel could be made smaller.


    Eric S. Raymond <esr@snark.thyrsus.com>
    -(Note: This is not the bug address!) +(Note: This is not the bug address!) diff --git a/misc/makellib b/misc/makellib index 4a571d60..fe9f99f1 100755 --- a/misc/makellib +++ b/misc/makellib @@ -1,24 +1,35 @@ #!/bin/sh -################################################################################ -# Copyright 1996,1997 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ -# $Id: makellib,v 1.6 1997/03/02 01:28:36 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# +# $Id: makellib,v 1.7 1998/02/11 12:13:50 tom Exp $ # System-dependent wrapper for 'lint' that creates a lint-library via the # following method (XXX is the name of the library): # a. If the file llib-lXXX doesn't exist, create it using the make-rule diff --git a/misc/ncurses-intro.doc b/misc/ncurses-intro.doc index 4dcb8905..ada9b08d 100644 --- a/misc/ncurses-intro.doc +++ b/misc/ncurses-intro.doc @@ -175,9 +175,12 @@ Scope of This Document The ncurses package was originated by Pavel Curtis. The original maintainer of the package is Zeyd Ben-Halim . Eric S. Raymond wrote many of the new features - in versions after 1.8.1 and wrote most of this introduction. The - current primary maintainers are Thomas Dickey and - Juergen Pfeifer. + in versions after 1.8.1 and wrote most of this introduction. Jürgen + Pfeifer wrote all of the menu and forms code as well as the Ada95 + binding. Ongoing work is being done by Thomas Dickey and Jürgen + Pfeifer. Florian La Roche acts as the maintainer for the Free Software + Foundation, which holds the copyright on ncurses. Contact the current + maintainers at bug-ncurses@gnu.org. This document also describes the panels extension library, similarly modeled on the SVr4 panels facility. This library allows you to @@ -188,8 +191,7 @@ Scope of This Document Finally, this document describes in detail the menus and forms extension libraries, also cloned from System V, which support easy - construction and sequences of menus and fill-in forms. This code was - contributed to the project by Jürgen Pfeifer. + construction and sequences of menus and fill-in forms. Terminology @@ -220,7 +222,6 @@ An Overview of Curses In order to use the library, it is necessary to have certain types and variables defined. Therefore, the programmer must have a line: - #include at the top of the program source. The screen package uses the Standard @@ -282,7 +283,6 @@ An Overview of Curses order to avoid clumsiness, most I/O routines can be preceded by the prefix 'mv' and the desired (y, x) coordinates prepended to the arguments to the function. For example, the calls - move(y, x); addch(ch); @@ -304,7 +304,6 @@ An Overview of Curses The curses library sets some variables describing the terminal capabilities. - type name description ------------------------------------------------------------------ int LINES number of lines on the terminal @@ -947,7 +946,6 @@ Compiling With the Panels Library Your panels-using modules must import the panels library declarations with - #include and must be linked explicitly with the panels library using an -lpanel @@ -1051,7 +1049,6 @@ Miscellaneous Other Facilities Compiling With the menu Library Your menu-using modules must import the menu library declarations with - #include and must be linked explicitly with the menus library using an -lmenu @@ -1244,7 +1241,6 @@ Miscellaneous Other Features Compiling With the form Library Your form-using modules must import the form library declarations with - #include and must be linked explicitly with the forms library using an -lform @@ -1474,7 +1470,6 @@ chtype new_page(FIELD *field); /* field to query */ 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 */ @@ -1585,7 +1580,6 @@ Field User Pointer Each field structure contains one character pointer slot that is not used by the forms library. It is intended to be used by applications to store private per-field data. You can manipulate it with: - int set_field_userptr(FIELD *field, /* field to alter */ char *userptr); /* mode to set */ @@ -1795,7 +1789,6 @@ char *field_buffer(FIELD *field, /* field to query */ by the user's editing actions on that field. It's sometimes useful to be able to set the value of the zero-numbered (or some other) buffer from your application: - int set_field_buffer(FIELD *field, /* field to alter */ int bufindex, /* number of buffer to alter */ char *value); /* string value to set */ @@ -1880,7 +1873,6 @@ int scale_form(FORM *form, /* form to query */ The form dimensions are passed back in the locations pointed to by the arguments. Once you have this information, you can use it to declare of windows, then use one of these functions: - int set_form_win(FORM *form, /* form to alter */ WINDOW *win); /* frame window to connect */ diff --git a/misc/ncurses-intro.html b/misc/ncurses-intro.html index 9ab84885..a2e01492 100644 --- a/misc/ncurses-intro.html +++ b/misc/ncurses-intro.html @@ -1,11 +1,11 @@ Writing Programs with NCURSES - + @@ -220,12 +220,18 @@ maintainer of the package is <esr@snark.thyrsus.com> wrote many of the new features in versions after 1.8.1 and wrote most of this introduction. -The current primary maintainers are +Jürgen Pfeifer +wrote all of the menu and forms code as well as the +Ada95 binding. +Ongoing work is being done by Thomas Dickey -<dickey@clark.net> and -Juergen Pfeifer. -<Juergen.Pfeifer@T-Online.de> +Jürgen Pfeifer. +Florian La Roche +acts as the maintainer for the Free Software Foundation, which holds the +copyright on ncurses. +Contact the current maintainers at +bug-ncurses@gnu.org.

    This document also describes the panels extension library, @@ -237,8 +243,7 @@ their visibility in the natural way (handling window overlaps).

    Finally, this document describes in detail the menus and forms extension libraries, also cloned from System V, which support easy construction and sequences of menus and fill-in -forms. This code was contributed to the project by -Jürgen Pfeifer.

    +forms.

    Terminology

    diff --git a/misc/run_tic.sh b/misc/run_tic.sh index 4dcbd79a..9ac65b4d 100755 --- a/misc/run_tic.sh +++ b/misc/run_tic.sh @@ -1,24 +1,35 @@ #!/bin/sh -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ -# $Id: run_tic.sh,v 1.8 1996/12/01 05:10:08 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996 +# +# $Id: run_tic.sh,v 1.9 1998/02/11 12:13:50 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. # diff --git a/misc/shlib b/misc/shlib index afed335d..1845a62e 100755 --- a/misc/shlib +++ b/misc/shlib @@ -1,24 +1,35 @@ #!/bin/sh -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ -# $Id: shlib,v 1.3 1996/06/17 21:45:36 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996 +# +# $Id: shlib,v 1.4 1998/02/11 12:13:50 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, diff --git a/misc/tdlint b/misc/tdlint index 287b8e1c..869a34bf 100755 --- a/misc/tdlint +++ b/misc/tdlint @@ -1,24 +1,35 @@ #!/bin/sh -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ -# $Id: tdlint,v 1.3 1996/07/15 00:47:21 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996 +# +# $Id: tdlint,v 1.4 1998/02/11 12:13:50 tom Exp $ # # Lint-script that allows user's own lint libraries, in addition to the ones # installed in the system. diff --git a/misc/terminfo.src b/misc/terminfo.src index 496be629..fedfe67e 100644 --- a/misc/terminfo.src +++ b/misc/terminfo.src @@ -1,6 +1,6 @@ ######## TERMINAL TYPE DESCRIPTIONS SOURCE FILE # -# Version 10.1.1 +# Version 10.2.0 # terminfo syntax # # Eric S. Raymond (current maintainer) @@ -24,7 +24,7 @@ # termcap/terminfo versions. # # Pointers to related resources (including the ncurses distribution) may -# be found at . +# be found at . # # INTERNATIONALIZATION: # @@ -290,7 +290,7 @@ glasstty|classic glass tty interpreting ASCII control characters, # will work with any Intel console, they all seem to have inherited \E[11m # from the ANSI.SYS de-facto standard. klone+acs|alternate character set for ansi.sys displays, - acsc=`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~q\304r\362s_t\303u\264v\301w\302x\263y\371z\372{\373|\374}\375~\376.\031-\030\,\021+^P0\333p\304r\304y\363z\362{\343|\330}\234, + acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, rmacs=\E[10m, smacs=\E[11m, # Highlight controls corresponding to the ANSI.SYS standard. Most @@ -315,10 +315,10 @@ klone+sgr-dumb|attribute control for ansi.sys displays (no ESC [ 11 m), sgr0=\E[0;10m, smacs=\E[12m, smso=\E[7m, smul=\E[4m, use=klone+acs, -# KOI8 (RFC1489) alternate character set -# From: Qing Long , 24 Feb 1996. +# KOI8-R (RFC1489) acs (alternate character set) +# From: QingLong , 24 Feb 1996. klone+koi8acs|alternate character set for ansi.sys displays with KOI8 charset, - acsc=l\202m\204k\203j\205u\207t\206v\210w\211q\200x\201n\212o\213s\214p\216r\217`\004a\237f\234g\232~\225.\037-\036+\020\,\021h\222I\2200\215y\230z\231{\267}L|\274, + acsc=+\020\,\021-\036.^_0\215`\004a\237f\234g\232h\222i\220j\205k\203l\202m\204n\212o\213p\216q\0r\217s\214t\206u\207v\210w\211x\201y\230z\231{\267|\274}L~\225, rmacs=\E[10m, smacs=\E[11m, # ANSI.SYS color control. The setab/setaf caps depend on the coincidence @@ -330,7 +330,7 @@ klone+koi8acs|alternate character set for ansi.sys displays with KOI8 charset, # They match a subset of ECMA-48. klone+color|color control for ansi.sys and ISO6429-compatible displays, colors#8, ncv#3, pairs#64, - op=\E[37;40m, setb=\E[4%p1%dm, setf=\E[3%p1%dm, + op=\E[37;40m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, # This is better than klone+color, it doesn't assume white-on-black as the # default color pair, but many `ANSI' terminals don't grok the cap. @@ -523,6 +523,31 @@ nansi.sysk|nansisysk|PC-DOS Public Domain NANSI.SYS with keypad redefined for vi #### ANSI console types # +#### BeOS entry for Terminal program. Seems to be almost ANSI +# +beterm|BeOS Terminal, + am, eo, mir, msgr, xenl, xon, + colors#8, cols#80, it#8, lines#25, pairs#64, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, + dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, flash=\E[?5h\E[?5l$<200/>, 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, invis=\E[8m, kb2=\E[G, + kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kend=\E[4~, kf1=\E[11~, kf10=\E[20~, kf11=\E[21~, + kf12=\E[22~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, + kf5=\E[15~, kf6=\E[16~, kf7=\E[17~, kf8=\E[18~, kf9=\E[19~, + khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kspd=^Z, + nel=^M^J, op=\E[m, rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, + rmso=\E[m, rmul=\E[24m, rs1=\Ec, sc=\E7, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, setb=\E[%p1%'('%+%cm, + setf=\E[%p1%{30}%+%cm, sgr0=\E[0;10m, smir=\E[4h, + smso=\E[7m, smul=\E[4m, tbc=\E[3g, u6=\E[%i%p1%d;%p2%dR, + u7=\E[6n, u8=\E[?6c, u9=\E[c, vpa=\E[%i%p1%dd, + # This entry is good for the 1.2.13 version of the Linux console driver. # # Note: there are numerous broken linux entries out there, which didn't screw @@ -553,10 +578,10 @@ nansi.sysk|nansisysk|PC-DOS Public Domain NANSI.SYS with keypad redefined for vi # 1.9.9. All linux kernels since 1.2.13 (at least) set the screen size # themselves; this entry assumes that capability. # -# From: Eric S. Raymond 15 Dec 1995 linux|linux console, am, bce, eo, mir, msgr, xenl, xon, - it#8, + it#8, ncv@, + acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, bel=^G, civis=\E[?25l, clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, @@ -583,9 +608,11 @@ linux-m|Linux console no color, setab@, setaf@, setb@, setf@, use=linux, linux-c-nc|linux console 1.3.x hack for ncurses only, ccc, - initc=\E]P%p1%x%p2%02x%p3%02x%p4%02x, oc=\E]R, use=linux, + initc=\E]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/%02x%p4%{255}%*%{1000}%/%02x, + oc=\E]R, + use=linux, # From: Dennis Henriksen , 9 July 1996 -linux-c|linux console 1.3.6+, with private palette for each virtual console, +linux-c|linux console 1.3.6+ with private palette for each virtual console, ccc, colors#8, pairs#64, initc=\E]P%?%p1%{9}%>%t%p1%{10}%-%p'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%;, @@ -598,7 +625,14 @@ linux-nic|linux with ich/ich1 suppressed for non-curses programs, use=linux, # This assumes you have used setfont(8) to load one of the Linux koi8-r fonts. +# acsc entry from Pavel Roskin" , 29 Sep 1997. linux-koi8|linux with koi8 alternate character set, + acsc=+\020\,\021-\030.^Y0\215`\004a\221f\234g\237h\220i\276j\205k\203l\202m\204n\212o~p\0q\0r\0s_t\206u\207v\211w\210x\201y\230z\231{\267|\274~\224, + use=linux, use=klone+koi8acs, + +# Another entry for KOI8-r with QingLong's acsc. +# (which one better complies the standard?) +linux-koi8r|linux with koi8-r alternate character set, use=linux, use=klone+koi8acs, # SCO console and SOS-Syscons console for 386bsd @@ -665,7 +699,74 @@ pc6300plus|AT&T 6300 plus, nel=^M^J, rev=\E[7m, rmso=\E[m, rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -# +# From: Benjamin C. W. Sittler +# +# I have a UNIX PC which I use as a terminal attached to my Linux PC. +# Unfortunately, the UNIX PC terminfo entry that comes with ncurses +# is broken. All the special key sequences are broken, making it unusable +# with Emacs. The problem stems from the following: +# +# The UNIX PC has a plethora of keys (103 of them, and there's no numeric +# keypad!), loadable fonts, and strange highlighting modes ("dithered" +# half-intensity, "smeared" bold, and real strike-out, for example.) It also +# uses resizable terminal windows, but the bundled terminal program always +# uses an 80x24 window (and doesn't support seem to support a 132-column +# mode.) +# +# HISTORY: The UNIX PC was one of the first machines with a GUI, and used a +# library which was a superset of SVr3.5 curses (called tam, for "terminal +# access method".) tam includes support for real, overlapping windows, +# onscreen function key labels, and bitmap graphics. But since the primary +# user interface on the UNIX PC was a GUI program (ua, for "user +# assistant",) and remote administration was considered important for the +# machine, tam also supported VT100-compatible terminals attached to the +# serial port or used across the StarLan network. To simulate the extra keys +# not present on a VT100, users could press ESC and a two-letter sequence, +# such as u d (Undo) or U D (Shift-Undo.) These two-letter sequences, +# however, were not the same as those sent by the actual Undo key. The +# actual Undo key sends ESC 0 s unshifted, and ESC 0 S shifted, for example. +# (If you're interested in adding some of the tam calls to ncurses, btw, I +# have the full documentation and several programs which use tam. It also +# used an extended terminfo format to describe key sequences, special +# highlighting modes, etc.) +# +# KEYS: This means that ncurses would quite painful on the UNIX PC, since +# there are two sequences for every key-modifier combination (local keyboard +# sequence and remote "VT100" sequence.) But I doubt many people are trying +# to use ncurses on the UNIX PC, since ncurses doesn't properly handle the +# GUI. Unfortunately, the terminfo entry (and the termcap, too, I presume) +# seem to have been built from the manual describing the VT100 sequences. +# This means it doesn't work for a real live UNIX PC. +# +# FONTS: The UNIX PC also has a strange interpretation of "alternate +# character set". Rather than the VT100 graphics you might expect, it allows +# up to 8 custom fonts to be loaded at any given time. This means that +# programs expecting VT100 graphics will usually be disappointed. For this +# reason I have disabled the smacs/rmacs sequences, but they could easily be +# re-enabled. Here are the relevant control sequences (from the ESCAPE(7) +# manpage), should you wish to do so: +# +# SGR10 - Select font 0 - ESC [ 10 m or SO +# SGR11 - Select font 1 - ESC [ 11 m or SI +# SGR12 - Select font 2 - ESC [ 12 m +# ... (etc.) +# SGR17 - Select font 7 - ESC [ 17 m +# +# Graphics for line drawing are not reliably found at *any* character +# location because the UNIX PC has dynamically reloadable fonts. I use font +# 0 for regular text and font 1 for italics, but this is by no means +# universal. So ASCII line drawing is in order if smacs/rmacs are enabled. +# +# MISC: The cursor visible/cursor invisible sequences were swapped in the +# distributed terminfo. +# +# To ameliorate these problems (and fix a few highlighting bugs) I rewrote +# the UNIX PC terminfo entry. The modified version works great with Lynx, +# Emacs, and XEmacs running on my Linux PC and displaying on the UNIX PC +# attached by serial cable. In Emacs, even the Undo key works, and many +# applications can now use the F1-F8 keys. +# +# esr's notes: # Terminfo entry for the AT&T Unix PC 7300 # from escape(7) in Unix PC 7300 Manual. # Somewhat similar to a vt100-am (but different enough @@ -716,36 +817,35 @@ pc6300plus|AT&T 6300 plus, # they're confirmed by the man page for the System V display---esr) # att7300|unixpc|pc7300|3b1|s4|AT&T UNIX PC Model 7300, - am, xenl, xon, + am, xon, cols#80, it#8, lines#24, - acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, bold=\E[7m, cbt=\E^I, civis=\E[=C, clear=\E[2J\E[H, - cnorm=\E[=1C, cr=^M, cub=\E[%p1%dD, 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, - dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, - el=\E[0K, home=\E[H, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, - ind=^J, invis=\E[9m, is1=^O, kBEG=\EBG, kCAN=\ECN, kCPY=\ECP, - kCRT=\ECR, kDC=\EDC, kDL=\EDL, kEND=\EEN, kEOL=\ECI, - kFND=\EFI, kHLP=\EHL, kHOM=\EHM, kIC=\ENJ, kLFT=\EBW, - kMOV=\EMV, kNXT=\ENX, kOPT=\EOT, kPRV=\EPV, kRDO=\ERO, - kRIT=\EFW, kRPL=\ERP, kSAV=\ESV, kUND=\EUD, kbeg=\Ebg, - kbs=^H, kcan=\Ecn, kcbt=\E^I, kclo=\Ecl, kclr=\Ece, - kcmd=\Ecm, kcpy=\Ecp, kcrt=\Ecr, kcub1=\E[D, kcud1=\E[B, - kcuf1=\E[C, kcuu1=\E[A, kdch1=\Edc, ked=\Ece, kel=\Eci, - kend=\Een, kext=\Eex, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, - kf5=\E5, kf6=\E6, kf7=\E7, kf8=\E8, kfnd=\Efi, khlp=\Ehl, - khome=\Ehm, kich1=\Eim, kind=\Erd, kmov=\Emv, kmrk=\Emk, - knp=\Epg, knxt=\Enx, kopn=\Eop, kopt=\Eot, kpp=\EPG, - kprt=\Epr, kprv=\Epv, krdo=\Ero, kref=\Ere, krfr=\Erf, - kri=\Eru, krpl=\Erp, krst=\Ers, ksav=\Esv, kslt=\Esl, - kund=\Eud, nel=\EE, rev=\E[7m, ri=\EM, rmacs=\E[10m, - rmso=\E[m, rmul=\E[m, sgr0=\E[0;10m, smacs=\E[11m, - smso=\E[7m, smul=\E[4m, + bel=^G, blink=\E[9m, bold=\E[1m, cbt=\E^I, civis=\E[=1C, + clear=\E[2J\E[H, cnorm=\E[=0C, cr=^M, 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, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, + ed=\E[0J, el=\E[0K, home=\E[H, ich1=\E[@, il=\E[%p1%dL, + il1=\E[L, ind=^J, invis=\E[9m, is1=\017\E[=1w, kBEG=\ENB, + kCAN=\EOW, kCPY=\END, kCRT=\EON, kDC=\ENF, kDL=\ENE, + kEND=\ENN, kEOL=\EOA, kFND=\EOX, kHLP=\EOM, kHOM=\ENM, + kIC=\ENJ, kLFT=\ENK, kMOV=\ENC, kNXT=\ENH, kOPT=\EOR, + kPRV=\ENG, kRDO=\EOT, kRIT=\ENL, kRPL=\EOY, kSAV=\EOO, + kUND=\EOS, kbeg=\ENb, kbs=^H, kcan=\EOw, kcbt=\E[Z, + kclo=\EOV, kclr=\E[J, kcmd=\EOu, kcpy=\ENd, kcrt=\EOn, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\ENf, + ked=\E[J, kel=\EOa, kend=\E0, kext=\EOk, kf1=\EOc, kf2=\EOd, + kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, + kfnd=\EOx, khlp=\EOm, khome=\E[H, kich1=\ENj, kind=\E[B, + kmov=\ENc, kmrk=\ENi, knp=\E[U, knxt=\ENh, kopn=\EOv, + kopt=\EOr, kpp=\E[V, kprt=\EOz, kprv=\ENg, krdo=\EOt, + kref=\EOb, krfr=\ENa, kri=\E[A, krpl=\EOy, krst=\EOB, + ksav=\EOo, kslt=\ENI, kund=\EOs, nel=\EE, rev=\E[7m, ri=\EM, + rmso=\E[m, rmul=\E[m, sgr0=\E[0;10m, smso=\E[7m, + smul=\E[4m, -# From: davis@unidata.ucar.edu +# From: Stefan Stapelberg , 24 Feb 1997 # (iris-ansi: added rmam/smam based on init string -- esr) -iris-ansi|iris-ansi-net|IRIS emulating ANSI terminal, +iris-ansi|IRIS emulating 40 line ANSI terminal (almost VT100), am, cols#80, it#8, lines#40, bel=^G, bold=\E[1m, clear=\E[H\E[2J, @@ -773,6 +873,17 @@ iris-ansi-ap|IRIS ANSI in application-keypad mode, kf12=\E[012q, rmkx=\E>, smkx=\E=, use=iris-ansi, +# From the man-page, this is a quasi-vt100 emulator that runs on SGI's IRIX +# (T.Dickey 98/1/24) +iris-color|xwsh|IRIX ANSI with color, + ncv#33, + csr=\E[%i%p1%d;%p2%dr, dch=\E[%p1%dP, dim=\E[2m, + ech=\E[%p1%dX, ich=\E[%p1%d@, rc=\E8, ritm=\E[23m, + rmul=\E[24m, rs1=\Ec, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sitm=\E[3m, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, + use=klone+color, use=iris-ansi-ap, + # The following is a version of the ibm-pc entry distributed with PC/IX, # (Interactive Systems' System 3 for the Big Blue), modified by Richard # McIntosh at UCB/CSM. The :pt: and :uc: have been removed from the original, @@ -821,7 +932,7 @@ ibmpcx|xenix|ibmx|IBM PC xenix console display, qnx|qnx4|qnx console, daisy, km, mir, msgr, xhpa, xt, colors#8, cols#80, it#4, lines#25, ncv#3, pairs#8, - acsc=l\332m\300k\277j\331q\304x\263u\264t\303n\305v\301w\302O\333a\261o\337s\334, + acsc=O\333a\261j\331k\277l\332m\300n\305o\337q\304s\334t\303u\264v\301w\302x\263, bel=^G, blink=\E{, bold=\E<, civis=\Ey0, clear=\EH\EJ, cnorm=\Ey1, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cup=\EY%p1%' '%+%c%p2%' '%+%c, cuu1=\EA, cvvis=\Ey2, @@ -835,39 +946,38 @@ qnx|qnx4|qnx console, kOPT=\377\372, kPRT=\377\275, kPRV=\377\262, kRDO=\377\315, kRES=\377\374, kRIT=\377\266, kRPL=\377\373, kSAV=\377\307, kSPD=\377\303, - kUND=\377\337, kbeg=\377\300, kcan=\377\243, - kcbt=\377\200, kclo=\377\343, kclr=\377\341, - kcmd=\377\245, kcpy=\377\265, kcrt=\377\305, - kctab=\377\237, kcub1=\377\244, kcud1=\377\251, - kcuf1=\377\246, kcuu1=\377\241, kdch1=\377\254, - kdl1=\377\274, ked=\377\314, kel=\377\310, kend=\377\250, - kent=\377\320, kext=\377\270, kf1=\377\201, - kf10=\377\212, kf11=\377\256, kf12=\377\257, - kf13=\377\213, kf14=\377\214, kf15=\377\215, - kf16=\377\216, kf17=\377\217, kf18=\377\220, - kf19=\377\221, kf2=\377\202, kf20=\377\222, - kf21=\377\223, kf22=\377\224, kf23=\377\333, - kf24=\377\334, kf25=\377\225, kf26=\377\226, - kf27=\377\227, kf28=\377\230, kf29=\377\231, - kf3=\377\203, kf30=\377\232, kf31=\377\233, - kf32=\377\234, kf33=\377\235, kf34=\377\236, - kf35=\377\276, kf36=\377\277, kf37=\377\321, - kf38=\377\322, kf39=\377\323, kf4=\377\204, - kf40=\377\324, kf41=\377\325, kf42=\377\326, - kf43=\377\327, kf44=\377\330, kf45=\377\331, - kf46=\377\332, kf47=\377\316, kf48=\377\317, - kf5=\377\205, kf6=\377\206, kf7=\377\207, kf8=\377\210, - kf9=\377\211, kfnd=\377\346, khlp=\377\350, - khome=\377\240, khts=\377\342, kich1=\377\253, - kil1=\377\273, kind=\377\261, kmov=\377\351, - kmrk=\377\355, kmsg=\377\345, knp=\377\252, - knxt=\377\312, kopn=\377\357, kopt=\377\353, - kpp=\377\242, kprt=\377\255, kprv=\377\302, - krdo=\377\336, kref=\377\354, kres=\377\360, - krfr=\377\347, kri=\377\271, krmir=\377\313, - krpl=\377\362, krst=\377\352, ksav=\377\361, - kslt=\377\247, kspd=\377\335, ktbc=\377\344, - kund=\377\365, mvpa=\E!%p1%02d, op=\ER, + kUND=\377\337, kbeg=\377\300, kcan=\377\243, kcbt=\377\0, + kclo=\377\343, kclr=\377\341, kcmd=\377\245, + kcpy=\377\265, kcrt=\377\305, kctab=\377\237, + kcub1=\377\244, kcud1=\377\251, kcuf1=\377\246, + kcuu1=\377\241, kdch1=\377\254, kdl1=\377\274, + ked=\377\314, kel=\377\310, kend=\377\250, kent=\377\320, + kext=\377\270, kf1=\377\201, kf10=\377\212, + kf11=\377\256, kf12=\377\257, kf13=\377\213, + kf14=\377\214, kf15=\377\215, kf16=\377\216, + kf17=\377\217, kf18=\377\220, kf19=\377\221, + kf2=\377\202, kf20=\377\222, kf21=\377\223, + kf22=\377\224, kf23=\377\333, kf24=\377\334, + kf25=\377\225, kf26=\377\226, kf27=\377\227, + kf28=\377\230, kf29=\377\231, kf3=\377\203, + kf30=\377\232, kf31=\377\233, kf32=\377\234, + kf33=\377\235, kf34=\377\236, kf35=\377\276, + kf36=\377\277, kf37=\377\321, kf38=\377\322, + kf39=\377\323, kf4=\377\204, kf40=\377\324, + kf41=\377\325, kf42=\377\326, kf43=\377\327, + kf44=\377\330, kf45=\377\331, kf46=\377\332, + kf47=\377\316, kf48=\377\317, kf5=\377\205, kf6=\377\206, + kf7=\377\207, kf8=\377\210, kf9=\377\211, kfnd=\377\346, + khlp=\377\350, khome=\377\240, khts=\377\342, + kich1=\377\253, kil1=\377\273, kind=\377\261, + kmov=\377\351, kmrk=\377\355, kmsg=\377\345, + knp=\377\252, knxt=\377\312, kopn=\377\357, + kopt=\377\353, kpp=\377\242, kprt=\377\255, + kprv=\377\302, krdo=\377\336, kref=\377\354, + kres=\377\360, krfr=\377\347, kri=\377\271, + krmir=\377\313, krpl=\377\362, krst=\377\352, + ksav=\377\361, kslt=\377\247, kspd=\377\335, + ktbc=\377\344, kund=\377\365, mvpa=\E!%p1%02d, op=\ER, rep=\Eg%p2%' '%+%c%p1%c, rev=\E(, ri=\EI, rmcup=\Eh\ER, rmso=\E), rmul=\E], rs1=\ER, setb=\E@%p1%Pb%gb%gf%d%d, setf=\E@%p1%Pf%gb%gf%d%d, @@ -891,7 +1001,7 @@ qnx|qnx4|qnx console, pcvtXX|pcvt vt200 emulator (DEC VT220), am, km, mir, msgr, xenl, it#8, vt#3, - acsc=llmmkkjjuuttvvwwqqxxnnoosspprr``aaffgg~~..--++\,\,hhII00yyzz, + acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz~~, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, 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, @@ -982,9 +1092,12 @@ x68k|x68k-ite|NetBSD/x68k ITE, # Bug? The ech and el1 attributes appear to move the cursor in some cases; for # instance el1 does if the cursor is moved to the right margin first. Removed # by T.Dickey 97/5/3 (ech=\E[%p1%dX, el1=\E[1K) +# +# Setting colors turns off reverse; we cannot guarantee order, so use ncv. +# Note that this disables standout with color. cons25w|ansiw|ansi80x25-raw|freebsd console (25-line raw mode), am, bce, bw, eo, msgr, npc, - colors#8, cols#80, it#8, lines#25, pairs#64, + colors#8, cols#80, it#8, lines#25, ncv#5, pairs#64, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, cr=^M, 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, @@ -1001,7 +1114,7 @@ cons25w|ansiw|ansi80x25-raw|freebsd console (25-line raw mode), rmso=\E[m, rs1=\E[x\E[m\Ec, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[m, smso=\E[7m, vpa=\E[%i%p1%dd, cons25|ansis|ansi80x25|freebsd console (25-line ansi mode), - acsc=l\332m\300k\277j\331u\264t\303v\301w\302q\304x\263n\305`\004a\260f\370g\361~\371.\031-\030h\261I^U0\333y\363z\362, + 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@, @@ -1023,7 +1136,7 @@ cons60|ansi80x60|freebsd console (60-line ansi mode), cons60-m|ansi80x60-mono|freebsd console (60-line mono ansi mode), lines#60, use=cons25-m, cons25r|pc3r|ibmpc3r|cons25-koi8-r|freebsd console w/koi8-r cyrillic, - acsc=q\200x\201m\204v\211j\205t\206n\212u\207l\202w\210k\203y\230z\231f\234~\225a\220h\221`\004.\031-\030I^U0\215, + acsc=-\030.^Y0\215`\004a\220f\234h\221i\025j\205k\203l\202m\204n\212q\0t\206u\207v\211w\210x\201y\230z\231~\225, use=cons25w, cons25r-m|pc3r-m|ibmpc3r-mono|cons25-koi8r-m|freebsd console w/koi8-r cyrillic (mono), colors@, pairs@, @@ -1038,7 +1151,7 @@ cons60r-m|cons60-koi8r-m|freebsd console w/koi8-r cyrillic (60-line mono), lines#60, use=cons25r-m, # ISO 8859-1 FreeBSD console cons25l1|cons25-iso8859|freebsd console w/iso 8859-1 chars, - acsc=l\215m\216k\214j\213u\226t\225v\227w\230q\222x\231n\217o\220s\224p\221r\223`\201a\202f\207g\210~\237.\031-\030+\253\,\273I\247y\232z\233, + acsc=+\253\,\273-\030.\031`\201a\202f\207g\210i\247j\213k\214l\215m\216n\217o\220p\221q\222r\223s\224t\225u\226v\227w\230x\231y\232z\233~\237, use=cons25w, cons25l1-m|cons25-iso-m|freebsd console w/iso 8859-1 chars (mono), colors@, pairs@, @@ -1061,7 +1174,7 @@ cons60l1-m|cons60-iso-m|freebsd console w/iso 8859-1 chars (60-line mono), origpc3|origibmpc3|IBM PC 386BSD Console, am, bw, eo, xon, cols#80, lines#25, - acsc=l\332q\304k\277x\263j\331m\300w\302u\264v\301t\303n\305, + acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, bold=\E[7m, clear=\Ec, cub1=^H, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, ed=\E[J, el=\E[K, home=\E[H, ind=\E[S, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, @@ -1125,11 +1238,12 @@ ibmpc3|pc3-bold|IBM PC BSD/386 Console with bold instead of underline, # are kept available at ftp://gatekeeper.dec.com/pub/DEC/termcaps. # # In October 1995 DEC sold its terminals business, including the VT and Dorio -# line and trademark, to SunRiver Data Systems. +# line and trademark, to SunRiver Data Systems. SunRiver has since changed +# its name to Boundless Technologies; see http://www.boundless.com. # + # (The , , and capabilities aren't in DEC's official # entry -- esr) - vt52|dec vt52, cols#80, it#8, lines#24, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, @@ -1222,7 +1336,7 @@ vt52|dec vt52, # (and even then, whenever it can be arranged!) you should set # INTERLACE_OFF # -# (I added / based on the init string, also -- esr) +# (vt100: I added / based on the init string, also . -- esr) vt100|vt100-am|dec vt100 (w/advanced video), am, msgr, xenl, xon, cols#80, it#8, lines#24, vt#3, @@ -1246,6 +1360,8 @@ vt100|vt100-am|dec vt100 (w/advanced video), smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, vt100nam|vt100-nam|vt100 no automargins, am@, xenl@, use=vt100-am, +vt100-vb|dec vt100 (w/advanced video) & no beep, + bel@, flash=\E[?5h\E[?5l, use=vt100, # Ordinary vt100 in 132 column ("wide") mode. vt100-w|vt100-w-am|dec vt100 132 cols (w/advanced video), @@ -1290,7 +1406,7 @@ 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, - lines#132, + cols#132, rs3=\E[?3h, use=vt102, # Many brain-dead PC comm programs that pretend to be `vt100-compatible' @@ -1391,6 +1507,7 @@ vt220-nam|v200-nam|VT220 in vt100 mode with no auto margins, am@, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h, use=vt220, +# This is misnamed (see xterm-8bit for an example of 8-bit controls) vt220-8|dec vt220 8 bit terminal, am, mc5i, mir, msgr, xenl, xon, cols#80, it#8, lines#24, @@ -1417,6 +1534,35 @@ vt220-8|dec vt220 8 bit terminal, rmul=\E[24m, rs1=\E[?3l, sc=\E7, sgr0=\E[m, smacs=^N, smam=\E[?7h, smir=\E[4h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, +# vt220 termcap written Tue Oct 25 20:41:10 1988 by Alex Latzko +# (not an official DEC entry!) +# The problem with real vt220 terminals is they don't send escapes when in +# in vt220 mode. This can be gotten around two ways. 1> don't send +# escapes or 2> put the vt220 into vt100 mode and use all the nifty +# features of vt100 advanced video which it then has. +# +# This entry takes the view of putting a vt220 into vt100 mode so +# you can use the escape key in emacs and everything else which needs it. +# +# You probably don't want to use this on a VMS machine since VMS will think +# it has a vt220 and will get fouled up coming out of emacs +# +# From: Alexander Latzko , 30 Dec 1996 +vt200-js|vt220-js|dec vt200 series with jump scroll, + am, + cols#80, + bel=^G, clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=^J, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, + il1=\E[L, ind=\ED, + is2=\E[61"p\E[H\E[?3l\E[?4l\E[?1l\E[?5l\E[?6l\E[?7h\E[?8h\E[?25h\E>\E[m, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=^M\ED, + rf=/usr/lib/tabset/vt100, ri=\EM, rmdc=, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[27m$<5/>, rmul=\E[24m, + rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, smdc=, + smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m$<5/>, smul=\E[4m, + # This was DEC's vt320. Use the purpose-built one below instead #vt320|DEC VT320 in vt100 emulation mode, # use=vt220, @@ -1606,7 +1752,11 @@ vt420|DEC VT420, smkx=\E=, smso=\E[7m, smul=\E[4m, # -# DECUDK +# 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 +# emulators define these): +# # if (key < 16) then value = key; # else if (key < 21) then value = key + 1; # else if (key < 25) then value = key + 2; @@ -1614,6 +1764,10 @@ vt420|DEC VT420, # else if (key < 30) then value = key + 4; # else value = key + 5; # +# The string must be the hexadecimal equivalent, e.g., "5052494E" for "PRINT". +# There's no provision in terminfo for emitting a string in this format, so the +# application has to know it. +# vt420pc|DEC VT420 w/PC keyboard, kdch1=\177, kend=\E[4~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[11;2~, kf14=\E[12;2~, @@ -1748,7 +1902,7 @@ z340|zstem vt340 terminal emulator 132col 42line, is2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;42r\E[42;1H, rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;42r\E[42;1H, use=vt320-w, -z340-nam|zstem vt340 terminal emulator 132col 42line, +z340-nam|zstem vt340 terminal emulator 132col 42line (no automatic margins), am@, is2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;42r\E[42;1H, rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;42r\E[42;1H, @@ -1833,21 +1987,22 @@ xterm-r6|xterm-old|xterm X11R6 version, rs2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, sc=\E7, sgr0=\E[m, smacs=^N, smcup=\E7\E[?47h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, -# This is the stock xterm entry supplied with XFree86 3.2 +# This is the base xterm entry for the xterm supplied with XFree86 3.2 & up. # The name has been changed and some aliases have been removed. -xterm-xf86-v32|xterm terminal emulator (X Window System), +xterm-xf86-v32|xterm terminal emulator (XFree86 3.2 Window System), am, bce, km, mir, msgr, xenl, colors#8, cols#80, it#8, lines#24, pairs#64, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[2J, - 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, ech=\E[%p1%dX, ed=\E[J, - el=\E[K, el1=\E[1K, enacs=\E(B\E)0, flash=\E[?5h\E[?5l, - 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, + bel=^G, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[2J, 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, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, + enacs=\E(B\E)0, flash=\E[?5h\E[?5l, 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, is2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, ka1=\EOw, ka3=\EOu, kb2=\EOy, kbeg=\EOE, kbs=^H, kc1=\EOq, kc3=\EOs, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, @@ -1870,11 +2025,86 @@ xterm-xf86-v32|xterm terminal emulator (X Window System), smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, vpa=\E[%i%p1%dd, +# This is the stock xterm entry supplied with XFree86 3.3, which uses VT100 +# codes for F1-F4 except while in VT220 mode. +xterm-xf86-v33|xterm terminal emulator (XFree86 3.3 Window System), + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + use=xterm-xf86-v32, + +# This beta version will probably be released in XFree86 4.0 in 1998. +# Besides providing printer support, it exploits a new feature that allows +# xterm to use terminfo-based descriptions with the titeInhibit resource. +xterm-xf86-v40|xterm terminal emulator (XFree86 4.0 Window System), + mc5i, + mc0=\E[i, mc4=\E[4i, mc5=\E[5i, rmcup=\E[?1047l\E[?1048l, + rs1=\Ec, smcup=\E[?1048h\E[?1047h, + use=xterm-xf86-v33, + +# From: David J. MacKenzie , 14 Nov 1997 +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 from XFree86 3.3 (T.Dickey) +xterm-16color|xterm with 16 colors like aixterm, + colors#16, ncv#32, pairs#256, + setab@, setaf@, + setb=%p1%{8}%/%{6}%*%{4}%+\E[%d%p1%{8}%m%Pa%?%ga%{1}%=%t4%e%ga%{3}%=%t6%e%ga%{4}%=%t1%e%ga%{6}%=%t3%e%ga%d%;m, + setf=%p1%{8}%/%{6}%*%{3}%+\E[%d%p1%{8}%m%Pa%?%ga%{1}%=%t4%e%ga%{3}%=%t6%e%ga%{4}%=%t1%e%ga%{6}%=%t3%e%ga%d%;m, + use=xterm-xf86-v40, + +# 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. +# To use it, your decTerminalID resource must be set to 200 or above. +# +# HTS \E H \210 +# RI \E M \215 +# SS3 \E O \217 +# CSI \E [ \233 +# +xterm-8bit|xterm terminal emulator 8-bit controls (X Window System), + am, bce, km, mc5i, mir, msgr, xenl, + colors#8, cols#80, it#8, lines#24, pairs#64, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, 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, + cvvis=\233?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\233?5l, home=\233H, hpa=\233%i%p1%dG, + ht=^I, hts=\210, ich=\233%p1%d@, ich1=\233@, il=\233%p1%dL, + il1=\233L, ind=^J, + is2=\E7\E G\233r\233m\233?7h\233?1;3;4;6l\2334l\E8\E>, + ka1=\217w, ka3=\217u, kb2=\217y, kbeg=\217E, kbs=^H, + kc1=\217q, kc3=\217s, kcub1=\217D, kcud1=\217B, + kcuf1=\217C, kcuu1=\217A, kdch1=\2333~, kend=\217F, + kent=\217M, kf1=\23311~, kf10=\23321~, kf11=\23323~, + kf12=\23324~, kf13=\23325~, kf14=\23326~, kf15=\23328~, + kf16=\23329~, kf17=\23331~, kf18=\23332~, kf19=\23333~, + kf2=\23312~, kf20=\23334~, kf3=\23313~, kf4=\23314~, + kf5=\23315~, kf6=\23317~, kf7=\23318~, kf8=\23319~, + kf9=\23320~, kfnd=\2331~, khome=\217H, kich1=\2332~, + kmous=\233M, knp=\2336~, kpp=\2335~, kslt=\2334~, + 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=\2332J\233?47l\E8, rmir=\2334l, + rmkx=\233?1l\E>, rmso=\23327m, rmul=\23324m, rs1=\Ec, + rs2=\E7\E[62"p\E G\233r\233m\233?7h\233?1;3;4;6l\2334l\E8\E>, + 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%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr0=\233m^O, smacs=^N, smam=\233?7h, smcup=\E7\233?47h, + smir=\2334h, smkx=\233?1h\E=, smso=\2337m, smul=\2334m, + tbc=\2333g, vpa=\233%i%p1%dd, + # This is xterm for ncurses. It mainly adds mappings for more high-half # characters. Note that these will only work for fixed-width fonts. -# Once XFree86 3.2 is established, we'll switch this to use=xterm-xf86-v32 xterm|vs100|xterms|xterm terminal emulator (X Window System), - acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++\,\,II00, + acsc=++\,\,--..00``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, kmous=\E[M, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, use=xterm-r6, @@ -1902,9 +2132,10 @@ xterm-bold|xterm terminal emulator (X11R6 Window System) standout w/bold, # -- Kenji Rikitake) kterm|kterm kanji terminal emulator (X window system), eslok, hs, - csr=\E[%i%p1%d;%p2%dr, dsl=\E[?H, enacs=\E(B, fsl=\E[?F, - rc=\E8, sc=\E7, tsl=\E[?E\E[?%i%dT, - use=xterm, + acsc@, csr=\E[%i%p1%d;%p2%dr, dsl=\E[?H, enacs@, fsl=\E[?F, + kmous=\E[M, op=\E[39;49m, rc=\E8, rmacs@, sc=\E7, smacs@, + tsl=\E[?E\E[?%i%dT, + use=xterm-r6, use=klone+color, # See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file xterm-nic|xterm with ich/ich1 suppressed for non-curses programs, ich@, ich1@, @@ -1945,10 +2176,24 @@ color_xterm|cx|cx100|color_xterm color terminal emulator for X, smcup=\E[?1;41s\E[?1;41h\E=, smir=\E[4h, smso=\E[7m, smul=\E[4m, -# From: Mark Olesen & Thomas Dickey 13 Jul 1996 -rxvt|reduced xterm terminal (X Window System), - am, bce, km, mir, msgr, xenl, xon, - colors#8, cols#80, it#8, lines#24, pairs#64, +# From: Thomas Dickey 04 Oct 1997 +# Updated: Oezguer Kesim 02 Nov 1997 +# Notes: +# rxvt 2.21b uses +# smacs=\E(B\E)U^N, rmacs=\E(B\E)0^O, +# but some applications don't work with that. +# It also has an AIX extension +# box2=lqkxjmwuvtn, +# and +# ech=\E[%p1%dX, +# but the latter does not work correctly. +# +# 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". +rxvt-basic|rxvt terminal base (X Window System), + am, bce, eo, km, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, @@ -1956,30 +2201,33 @@ rxvt|reduced xterm terminal (X Window System), 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, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, - enacs=\E(B\E)0, flash=\E[?5h\E[?5l, 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, is1=\E[?47l\E=\E[?1l, + 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, ka1=\EOq, ka3=\EOs, kb2=\EOr, kbs=^H, - kc1=\EOp, kc3=\EOn, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, - kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[8~, kent=\EOM, - kf0=\E[21~, 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[7~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, - op=\E[39m\E[49m, rc=\E8, rev=\E[7m, ri=\EM, - rmacs=\E(B\E)0\017, rmcup=\E[?47l\E8, rmir=\E[4l, + kPRV=\E[5$, kRIT=\E[c, ka1=\EOw, ka3=\EOy, kb2=\EOu, kbs=^H, + kc1=\EOq, kc3=\EOs, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kel=\E[8\^, + kend=\E[8~, kent=\EOM, kf0=\E[21~, 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[?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>, - sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[m, - smacs=\E(B\E)U\016, smcup=\E7\E[?47h, smir=\E[4h, - smkx=\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, - vpa=\E[%i%p1%dd, + 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, +rxvt|rxvt terminal emulator (X Window System), + colors#8, pairs#64, + op=\E[39;49m, setab=\E[%p1%{40}%+%dm, + setaf=\E[%p1%{30}%+%dm, sgr0=\E[m\017, use=rxvt-basic, # From: David J. MacKenzie 20 Apr 1995 # Here's a termcap entry I've been using for xterm_color, which comes @@ -1989,11 +2237,11 @@ rxvt|reduced xterm terminal (X Window System), xterm-pcolor|xterm with color used for highlights and status line, bold=\E[1m\E[43m, rev=\E[7m\E[34m, smso=\E[7m\E[31m, smul=\E[4m\E[42m, - use=xterm+sl, use=xterm, + use=xterm+sl, use=xterm-r6, # HP ships this, except for the pb#9600 which was merged in from BSD termcap. # (hpterm: added empty , we have no idea what ACS chars look like --esr) -xhpterm|X-hpterm|hp X11 terminal emulator, +hpterm|X-hpterm|hp X11 terminal emulator, am, da, db, mir, xhp, cols#80, lh#2, lines#24, lm#0, lw#8, nlab#8, pb#9600, xmc#0, acsc=, bel=^G, bold=\E&dB, cbt=\Ei, clear=\E&a0y0C\EJ, cr=^M, @@ -2038,18 +2286,19 @@ xterm-sun|xterm with sunFunctionKeys true, 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 (emu). +# This is for the extensible terminal emulator on the X11R6 contrib tape. +# (emu: I changed / to / -- esr) emu|emu native mode, mir, msgr, xon, colors#15, cols#80, it#8, lines#24, pairs#64, vt#200, - acsc=a\202f\260g261j\213k\214l\215m\216n\217o\220q\222s\224t\225u\226v\227w\230x\231~\244, + 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, cvvis=\Ea, dch=\EI%p1%d;, dch1=\EI1;, dl=\ER%p1%d;, dl1=\ER1;, ech=\Ej%p1%d;, ed=\EN, - el=\EK, el1=\EL, enacs=\200, home=\EE0;0;, ht=^I, hts=\Eh, + 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, @@ -2058,12 +2307,48 @@ emu|emu native mode, 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=\200, rmir=\EX, rmso=\ES, rmul=\ES, - rs2=\ES\Es0;\Er0;, - setab=\Es%i%p1%d; setaf=\Er%i%p1%d;, sgr0=\ES, - smacs=\200, smir=\EY, smso=\ES\ET, smul=\ES\EV, tbc=\Ej, + rev=\ES\ET, ri=\EF, rmacs=\0, rmir=\EX, rmso=\ES, rmul=\ES, + rs2=\ES\Es0;\Er0;, setb=\Es%i%p1%d;, setf=\Er%i%p1%d;, + sgr0=\ES, smacs=\0, smir=\EY, smso=\ES\ET, smul=\ES\EV, + tbc=\Ej, -######## UNIX VIRTUAL TERMINALS AND VIRTUAL CONSOLES +######## MGR +# +# MGR is a Bell Labs window system lighter-weight than X. +# These entries describe MGR's xterm-equivalent. +# They are courtesy of Vincent Broman 14 Jan 1997 +# + +mgr|Bellcore MGR (non X) window system terminal emulation, + am, km, + bel=^G, bold=\E2n, civis=\E9h, clear=^L, cnorm=\Eh, cr=^M, + csr=\E%p1%d;%p2%dt, cub1=^H, cud1=\Ef, cuf1=\Er, + cup=\E%p2%d;%p1%dM, cuu1=\Eu, cvvis=\E0h, + dch=\E%p1%dE$<5>, dch1=\EE, dl=\E%p1%dd$<3*>, + dl1=\Ed$<3>, ed=\EC, el=\Ec, hd=\E1;2f, ht=^I, hu=\E1;2u, + ich=\E%p1%dA$<5>, ich1=\EA, il=\E%p1%da$<3*>, + il1=\Ea$<3>, ind=^J, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, nel=^M^J, rev=\E1n, rmam=\E5S, + rmso=\E0n, rmul=\E0n, sgr0=\E0n, smam=\E5s, smso=\E1n, + smul=\E4n, +mgr-sun|Mgr window with Sun keyboard, + ka1=\E[214z, ka3=\E[216z, kb2=\E[218z, kc1=\E[220z, + kc3=\E[222z, kcpy=\E197z, kend=\E[220z, kent=\E[250z, + kf1=\E[224z, kf10=\E[233z, kf11=\E[234z, kf12=\E[235z, + kf2=\E[225z, kf3=\E[226z, kf4=\E[227z, kf5=\E[228z, + kf6=\E[229z, kf7=\E[230z, kf8=\E[231z, kf9=\E[232z, + kfnd=\E[200z, khlp=\E[207z, khome=\E[214z, knp=\E[222z, + kopn=\E[198z, kpp=\E[216z, kund=\E[195z, + use=mgr, +mgr-linux|Mgr window with Linux keyboard, + ka1=\E[H, ka3=\E[5~, kb2=\E[G, kc1=\E[Y, kc3=\E[6~, + kdch1=\E[3~, kend=\E[4~, kf0=\E[[J, kf1=\E[[A, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf2=\E[[B, kf3=\E[[C, kf4=\E[[D, + kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, knp=\E[6~, kpp=\E[5~, + use=mgr, + +######## UNIX VIRTUAL TERMINALS, VIRTUAL CONSOLES, AND TELNET CLIENTS # # Columbus UNIX virtual terminal. This terminal also appears in @@ -2081,6 +2366,7 @@ cbunix|cb unix virtual terminal, vremote|virtual remote terminal, am@, cols#79, use=cbunix, + pty|4bsd pseudo teletype, cup=\EG%p1%{32}%+%c%p2%{32}%+%c, rmso=\Eb$, rmul=\Eb!, smso=\Ea$, smul=\Ea!, @@ -2109,7 +2395,7 @@ eterm|gnu emacs term.el terminal emulation, screen|VT 100/ANSI X3.64 virtual terminal, am, km, mir, msgr, xenl, colors#8, cols#80, it#8, lines#24, pairs#64, - acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++\,\,hhII00, + acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, 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, @@ -2132,7 +2418,7 @@ screen|VT 100/ANSI X3.64 virtual terminal, screen-w|VT 100/ANSI X3.64 virtual terminal with 132 cols, cols#132, use=screen, -screen2|VT 100/ANSI X3.64 virtual terminal, +screen2|old VT 100/ANSI X3.64 virtual terminal, cols#80, it#8, lines#24, cbt=\E[Z, clear=\E[2J\E[H, cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, @@ -2146,7 +2432,7 @@ screen2|VT 100/ANSI X3.64 virtual terminal, rmul=\E[24m, rs1=\Ec, sc=\E7, sgr0=\E[m, smir=\E[4h, smso=\E[3m, smul=\E[4m, tbc=\E[3g, # (screen3: removed unknown ":xv:LP:G0:" -- esr) -screen3|VT 100/ANSI X3.64 virtual terminal, +screen3|older VT 100/ANSI X3.64 virtual terminal, km, mir, msgr, cols#80, it#8, lines#24, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, @@ -2162,9 +2448,33 @@ screen3|VT 100/ANSI X3.64 virtual terminal, sc=\E7, sgr0=\E[m, smir=\E[4h, smkx=\E=, smso=\E[3m, smul=\E[4m, tbc=\E[3g, +#### Pilot Pro Palm-Top +# +# From: Jason Downs , 15 Jun 1997 (Top Gun Telnet's author) +pilot|tgtelnet|Top Gun Telnet on the Palm Pilot Professional, + am, xenl, + cols#39, lines#16, + bel=^G, clear=\Ec, cr=^M, cub1=^H, cud1=^J, + cup=\Em%p1%{32}%+%c%p2%{32}%+%c, home=\Em\s\s, ht=^I, + ind=^J, kbs=^H, kcub1=^H, kcud1=^J, knp=^L, kpp=^K, nel=\Em~\s, + rmso=\EB, smso=\Eb, + ######## WORKSTATION CONSOLES # +#### Alpha consoles +# + +# This is from the OSF/1 Release 1.0 termcap file +pccons|pcconsole|ANSI (mostly) Alpha PC console terminal emulation, + am, xon, + cols#80, lines#25, + bel=^G, clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + el=\E[K, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, + nel=^M^J, rev=\E[7m, rmso=\E[m, sgr0=\E[m, smso=\E[7m, + #### Sun consoles # @@ -2181,23 +2491,23 @@ oldsun|Sun Microsystems Workstation console, rmso=\E[m, sgr0=\E[m, smso=\E[7m, # From: Alexander Lukyanov , 14 Nov 1995 # capability later corrected by J.T. Conklin +# SGR 1, 4 aren't supported - removed bold/underline (T.Dickey 17 Jan 1998) sun-il|Sun Microsystems console with working insert-line, am, km, msgr, cols#80, lines#34, - bel=^G, bold=\E[1m, 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, kb2=\E[218z, kbs=^H, kcub1=\E[D, - kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, - kend=\E[220z, kf1=\E[224z, kf10=\E[233z, kf11=\E[234z, - kf12=\E[235z, kf2=\E[225z, kf3=\E[226z, kf4=\E[227z, - kf5=\E[228z, kf6=\E[229z, 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=\E[m, rs2=\E[s, + bel=^G, bold@, 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, + kb2=\E[218z, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kdch1=\177, kend=\E[220z, kf1=\E[224z, + kf10=\E[233z, kf11=\E[234z, kf12=\E[235z, kf2=\E[225z, + kf3=\E[226z, kf4=\E[227z, kf5=\E[228z, kf6=\E[229z, + 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=\E[4m, + sgr0=\E[m, smso=\E[7m, smul@, u8=\E[1t, u9=\E[11t, # On a SparcStation 5, / flake out on the last line. # Unfortunately, without them the terminal has no way to scroll. sun-ss5|Sun SparcStation 5 console, @@ -2315,7 +2625,145 @@ nextshell|NeXT Shell application, bel=^G, cr=^M, cub1=^H, cud1=^J, ht=^I, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, -### Common Desktop Environment +### Sony NEWS workstations +# + +# (news-unk: this had :KB=news: -- esr) +news-unk|SONY NEWS vt100 emulator common entry, + am, xenl, + cols#80, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dl=\E[%p1%dM, dl1=\E[M, + ed=\E[J, el=\E[K, home=\E[H, ht=^I, + if=/usr/lib/tabset/vt100, il=\E[%p1%dL, il1=\E[L, + is2=\E[?7h\E[?1l\E[?3l\E7\E8, kbs=^H, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOY, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, + kf8=\EOW, kf9=\EOX, rc=\E8, rev=\E[7m, ri=\EM, + rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, sc=\E7, sgr0=\E[m, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, +# +# (news-29: this had :TY=ascii: --esr) +news-29, + lines#29, use=news-unk, +# (news-29-euc: this had :TY=euc: --esr) +news-29-euc, + use=news-29, +# (news-29-sjis: this had :TY=sjis: --esr) +news-29-sjis, + use=news-29, +# +# (news-33: this had :TY=ascii: --esr) +news-33, + lines#33, use=news-unk, +# (news-33-euc: this had :TY=euc: --esr) +news-33-euc, + use=news-33, +# (news-33-sjis: this had :TY=sjis: --esr) +news-33-sjis, + use=news-33, +# +# (news-42: this had :TY=ascii: --esr) +news-42, + lines#42, use=news-unk, +# (news-42-euc: this had :TY=euc: --esr) +news-42-euc, + use=news-42, +# (news-42-sjis: this had :TY=sjis: --esr) +news-42-sjis, + use=news-42, +# +# NEWS-OS old termcap entry +# +# (news-old-unk: this had :KB=news:TY=sjis: --esr) +news-old-unk|SONY NEWS vt100 emulator common entry, + am, xenl, + cols#80, vt#3, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[;H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, + home=\E[H, ht=^I, if=/usr/lib/tabset/vt100, kbs=^H, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, rc=\E8, rev=\E[7m, ri=\EM, + rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, sc=\E7, sgr0=\E[m, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, +# +# (nwp512: this had :DE=^H:, which I think means --esr) +nwp512|news|nwp514|news40|vt100-bm|sony vt100 emulator 40 lines, + lines#40, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;40r\E8, use=news-old-unk, +# +# (nwp512-a: this had :TY=ascii: and the alias vt100-bm --esr) +nwp512-a|nwp514-a|news-a|news42|news40-a|sony vt100 emulator 42 line, + + +s, + lines#42, + is2=\E[?7h\E[?1l\E[?3l\E7\E[1;42r\E8, use=news-old-unk, +# +# (nwp-512-o: this had :KB=nwp410:DE=^H: I interpret the latter as . --esr) +nwp512-o|nwp514-o|news-o|news40-o|vt100-bm-o|sony vt100 emulator 40 lines, + lines#40, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;40r\E8, use=news-old-unk, +# +# (nwp513: this had :DE=^H: and the alias vt100-bm --esr) +nwp513|nwp518|nwe501|newscbm|news31|sony vt100 emulator 33 lines, + lines#31, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;31r\E8, use=news-old-unk, +# +# (nwp513-a: this had :TY=ascii: and :DE=^H:, which I interpret as ; --esr) +# also the alias vt100-bm. +nwp513-a|nwp518-a|nwe501-a|nwp251-a|newscbm-a|news31-a|newscbm33|news33|sony vt100 emulator 33 lines, + lines#33, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;33r\E8, use=news-old-unk, +# +# (nwp513-o: had :DE=^H:, I think that's ; also the alias vt100-bm --esr) +nwp513-o|nwp518-o|nwe501-o|nwp251-o|newscbm-o|news31-o|sony vt100 emulator 33 lines, + lines#31, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;31r\E8, use=news-old-unk, +# +# (news28: this had :DE=^H:, I think that's , and :KB=nws1200: --esr) +news28|sony vt100 emulator 28 lines, + lines#28, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;28r\E8, use=news-old-unk, +# +# (news29: this had :TY=ascii:KB=nws1200:\ --esr) +news29|news28-a|sony vt100 emulator 29 lines, + lines#29, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;29r\E8, use=news-old-unk, +# +# (news511: this had :TY=sjis: --esr) +nwp511|nwp-511|nwp-511 vt100, + am, xenl, + cols#80, lines#24, + clear=\E[;H\E[2J$<20/>, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A$<2/>, dl1=\E[M, + ed=\E[J$<30/>, el=\E[K$<3/>, + flash=\E[?5h\0\0\0\0\0\0\0\0\0\0\0\0\0\E[?5l, + il1=\E[L, is2=\E[?5l\E[?1l\E>\E[?7h\E[?8h, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, + kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\E#W, khome=\E[H, + ri=\EM$<5/>, rmso=\E[m$<2/>, rmul=\E[m$<2/>, + smso=\E[7m$<2/>, smul=\E[4m$<2/>, +# (news517: this had :TY=sjis:. --esr) +nwp517|nwp-517|nwp-517 vt200 80 cols 30 rows, + eslok, hs, + cols#80, lines#30, + dsl=\E[1$~, fsl=\E[0$}, + is2=\E7\E[r\E8\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + tsl=\E[1$}\E[;%df, + use=vt200, +# (news517-w: this had :TY=sjis:. --esr) +nwp517-w|nwp-517-w|nwp-517 vt200 132 cols 50 rows, + eslok, hs, + cols#132, lines#50, + dsl=\E[1$~, fsl=\E[0$}, + is2=\E7\E[r\E8\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h, + tsl=\E[1$}\E[;%df, + use=vt200, + +#### Common Desktop Environment # # This ships with Sun's CDE in Solaris 2.5 @@ -2348,6 +2796,115 @@ dtterm|CDE desktop terminal, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, +### Non-Unix Consoles +# + +# Except for the "-emx" suffixes, these are as distributed with EMX 0.9b, +# a Unix-style environment used on OS/2. (Note that the suffix makes some +# names longer than 14 characters, the nominal maximum). +# +# Removed: rmacs=\E[10m, smacs=\E[11m, because OS/2 does not implement acs. +ansi-emx|ANSI.SYS color, + am, bce, eo, mir, msgr, xenl, xon, + colors#16, cols#80, it#8, lines#25, pairs#64, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[1;33;44m\E[H\E[J, cnorm=\E[?25h, cr=^M, cub1=^H, + cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch=\E[%p1%dp, ed=\E[J, el=\E[K, flash=\E[?5h\E[?5l, + home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, ind=^J, + kb2=\E[G, kbs=^H, kcub1=\0K, kcud1=\0P, kcuf1=\0M, kcuu1=\0H, + kf0=\0D, kf1=\0;, kf2=\0<, kf3=\0=, kf4=\0>, kf5=\0?, kf6=\0@, + kf7=\0A, kf8=\0B, kf9=\0C, khome=\0G, kich1=\0R, kll=\0O, + knp=\0Q, kpp=\0I, kspd=^Z, nel=^M^J, rev=\E[5;37;41m, + rmir=\E[4l, rmpch=\E[10m, rmso=\E[0;44m\E[1;33m, + rmul=\E[0;44m\E[1;33m, rs1=\Ec, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, sgr0=\E[0m\E[1;33;44m, smir=\E[4h, + smpch=\E[11m, smso=\E[0;31;47m, smul=\E[1;31;44m, + tbc=\E[3g, u8=\E[?6c, u9=\E[c, +ansi-color-2-emx|ANSI.SYS color 2, + am, bce, eo, mir, msgr, xenl, xon, + colors#16, cols#80, it#8, lines#25, pairs#64, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[0;37;44m\E[H\E[J, cnorm=\E[?25h, cr=^M, cub1=^H, + cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch=\E[%p1%dp, ed=\E[J, el=\E[K, flash=\E[?5h\E[?5l, + home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, ind=^J, + kb2=\E[G, kbs=^H, kcub1=\0K, kcud1=\0P, kcuf1=\0M, kcuu1=\0H, + kf0=\0D, kf1=\0;, kf2=\0<, kf3=\0=, kf4=\0>, kf5=\0?, kf6=\0@, + kf7=\0A, kf8=\0B, kf9=\0C, khome=\0G, kich1=\0R, kll=\0O, + knp=\0Q, kpp=\0I, kspd=^Z, nel=^M^J, rev=\E[1;37;46m, + rmir=\E[4l, rmpch=\E[10m, rmso=\E[0;37;44m, + rmul=\E[0;37;44m, rs1=\Ec, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, sgr0=\E[0;37;44m, smir=\E[4h, + smpch=\E[11m, smso=\E[1;37;46m, smul=\E[1;36;44m, + tbc=\E[3g, u8=\E[?6c, u9=\E[c, +ansi-color-3-emx|ANSI.SYS color 3, + am, bce, eo, mir, msgr, xenl, xon, + colors#16, cols#80, it#8, lines#25, pairs#64, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[0;37;40m\E[H\E[J, cnorm=\E[?25h, cr=^M, cub1=^H, + cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch=\E[%p1%dp, ed=\E[J, el=\E[K, flash=\E[?5h\E[?5l, + home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, ind=^J, + kb2=\E[G, kbs=^H, kcub1=\0K, kcud1=\0P, kcuf1=\0M, kcuu1=\0H, + kf0=\0D, kf1=\0;, kf2=\0<, kf3=\0=, kf4=\0>, kf5=\0?, kf6=\0@, + kf7=\0A, kf8=\0B, kf9=\0C, khome=\0G, kich1=\0R, kll=\0O, + knp=\0Q, kpp=\0I, kspd=^Z, nel=^M^J, rev=\E[1;37;46m, + rmir=\E[4l, rmpch=\E[10m, rmso=\E[0;37;40m, + rmul=\E[0;37;40m, rs1=\Ec, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, sgr0=\E[0;10m, smir=\E[4h, + smpch=\E[11m, smso=\E[1;37;46m, smul=\E[0;36;40m, + tbc=\E[3g, u8=\E[?6c, u9=\E[c, +mono-emx|stupid monochrome ansi terminal with only one kind of emphasis, + am, + cols#80, it#8, lines#24, + clear=\E[H\E[2J$<50>, cub1=\E[D, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, + ht=^I, kb2=\E[G, kbs=^H, kcub1=\0K, kcud1=\0P, kcuf1=\0M, + kcuu1=\0H, kf0=\0D, kf1=\0;, kf2=\0<, kf3=\0=, kf4=\0>, + kf5=\0?, kf6=\0@, kf7=\0A, kf8=\0B, kf9=\0C, khome=\0G, + kich1=\0R, kll=\0O, knp=\0Q, kpp=\0I, nel=^M^J, rev=\E[7m, + sgr0=\E[0m, + +# This entry fits the Windows NT console when the _POSIX_TERM environment +# variable is set to 'on'. While the Windows NT POSIX console is seldom used, +# the Telnet client supplied with both the Windows for WorkGroup 3.11 TCP/IP +# stack and the Win32 (i.e., Windows 95 and Windows NT 3.1 or later) operating +# systems is not, and (surprise!) they match very well. +# +# See: MS Knowledge Base item Q108581, dated 13-MAY-1997, titled "Setting Up +# VI POSIX Editor for Windows NT 3.1". True to Microsoft form, not only +# are the installation instructions a pile of mind-numbing bureaucratese, +# but the termcap entry is actually broken and unusable as given; the :do: +# capability is misspelled "d". +# +# To use this, you need to a bunch of environment variables: +# +# SET _POSIX_TERM=on +# SET TERM=ansi +# SET TERMCAP=location of termcap file in POSIX file format +# which is case-sensitive. +# e.g. SET TERMCAP=//D/RESKIT35/posix/termcap +# SET TMP=//C/TEMP +# +# Important note: setting the TMP environment variable in POSIX style renders +# it incompatible with a lot of other applications, including Visual C++. So +# you should have a separate command window just for vi. All the other +# variables may be permanently set in the Control Panel\System applet. +# +# You can find out more about the restrictions of this facility at +# . +# +# From: Federico Bianchi , 15 Jan 1997 +ansi-nt|psx_ansi|Microsoft Windows NT console POSIX ANSI mode, + am, bw, msgr, + cols#80, it#8, lines#25, + bel=^G, clear=\E[2J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, + home=\E[H, ht=^I, ind=\E[S, kbs=^H, kcub1=\E[D, kcud1=\E[V, + kcuf1=\E[C, kcuu1=\E[A, nel=\r\E[S, rc=\E[u, rev=\E[7m, + ri=\E[T, rmso=\E[m, sc=\E[s, sgr0=\E[0m, smso=\E[7m, + ######## COMMON TERMINAL TYPES # # This section describes terminal classes and maker brands that are still @@ -2419,7 +2976,7 @@ altos4|alt4|altos-4|altos IV, altos7|alt7|altos VII, am, mir, cols#80, lines#24, xmc#0, - acsc=l2m1k3j5t4u9v=w0q\:x6n8, blink=\EG2, bold=\EGt, + acsc=j5k3l2m1n8q\:t4u9v=w0x6, blink=\EG2, bold=\EGt, clear=\E+^^, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, dim=\EGp, dl=\ER, ed=\EY, el=\ET, home=^^, ht=^I, il1=\EE, @@ -2741,7 +3298,7 @@ newhpkeyboard|generic entry for HP extended keyboard, newhp|generic entry for new hewlett packard terminals, am, bw, mir, xhp, xon, cols#80, lines#24, pb#4800, - acsc=T1R!U2S"W3O#V4P$t5u6w7v8\:'9(LQKWlRkT5I3@2[MAJSmFjGdHQ;Y+Z*X\:4>q\,x.n/, + acsc=2[3@4>5I9(\:'JSKWLQMAO#P$Q;R!S"T1U2V4W3X\:Y+Z*dHjGkTlRmFn/q\,t5u6v8w7x., bel=^G, blink=\E&dA, bold=\E&dF, cbt=\Ei, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cuu1=\EA, dch1=\EP$<2>, dim=\E&dH, dl1=\EM, ed=\EJ, el=\EK, ht=\011$<2>, hts=\E1, il1=\EL, ind=^J, @@ -2839,7 +3396,7 @@ hp2624b-10p-p|hewlett packard 2624 B w/ extra memory & printer, hp+color|hp with colors, ccc, colors#16, ncv#17, pairs#7, - initp=\E&v%?%p2%{1000}%=%t1%e.%p2%d%;a\n%?%p3%{1000}%=%t1%e.%p3%d%;b\n%?%p4%{1000}%=%t1%e.%p4%d%;c\n%?%p5%{1000}%=%t1%e.%p5%d%;x\n%?%p6%{1000}%=%t1%e.%p6%d%;y\n%?%p7%{1000}%=%t1%e.%p7%d%;z\n%p1%dI, + initp=\E&v%?%p2%{1000}%=%t1%e.%p2%d%;a%?%p3%{1000}%=%t1%e.%p3%d%;b%?%p4%{1000}%=%t1%e.%p4%d%;c%?%p5%{1000}%=%t1%e.%p5%d%;x%?%p6%{1000}%=%t1%e.%p6%d%;y%?%p7%{1000}%=%t1%e.%p7%d%;z%p1%dI, oc=\E&v0m1a1b1c0I\E&v1a1I\E&v1b2I\E&v1a1b3I\E&v1c4I\E&v1a1c5I\E&v1b1c6I\E&v1x1y7I, op=\E&v0S, scp=\E&v%p1%dS, @@ -2864,7 +3421,7 @@ hp2397a|hp2397|hewlett packard 2397A color terminal, hpansi|hp700|hewlett packard 700/44 in HP-PCterm mode, am, eo, xenl, xon, cols#80, lines#25, - acsc=k\277l\332m\300j\331n\305w\302q\304u\264t\303v\301x\263, + acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, bel=^G, cbt=\E[Z, civis=\E[?25l, clear=\E[2J\E[H, cnorm=\E[?25h, cr=^M, cub1=\E[D, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, @@ -3093,13 +3650,11 @@ dku7003|Honeywell Bull DKU 7003 all features described, # emulations (usually their stupidest, and usually labeled adm3, though # these `adm3' emulations normally have adm3a+ capabilities). # -# WARNING: Some early ADM terminals (including the ADM3 and ADM5) are -# reputed to have had the weird `feature' that sending them a ^G would trigger -# a diagnostic dump to screen if one of the more obscure RS-232 pins -# (variously reported as 22 or as `Ring Indicator') was being held high during -# receipt of the ^G. If you have a real ADM and think you've run into this, -# check it out with a breakout box and tell us if this rumor is correct! -# A quick fix might be to drop back to a cheesy 4-wire cable. +# WARNING: Some early ADM terminals (including the ADM3 and ADM5) had a +# `diagnostic feature' that sending them a ^G while pin 22 (`Ring Indicator') +# was being held to ground would trigger a send of the top line on the screen. +# A quick fix might be to drop back to a cheesy 4-wire cable with pin 22 +# hanging in the air. # adm1a|adm1|lsi adm1a, @@ -3211,7 +3766,7 @@ adm22|lsi adm22, bel=^G, cbt=\EI, clear=\E+, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, dl1=\ER, ed=\Ey, el=\Et, home=^^, ht=\Ei, ich1=\EQ, il1=\EE, - is2=\E%\014\014\014\016\003\200\003\002\003\002\200\200\200\200\200\200\200\200\200\200\200, + is2=\E%\014\014\014\016\003\0\003\002\003\002\0\0\0\0\0\0\0\0\0\0\0, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, khome=^^, lf1=F1, lf2=F2, lf3=F3, lf4=F4, lf5=F5, @@ -3816,7 +4371,7 @@ tvi921|televideo model 921 with sysline same as page & real vi function, # without the beeper # (tvi92B: removed :ko=bt: before translation, I see no backtab cap; # also added empty to suppress tic warning -- esr) -tvi92B|televideo model 921 with sysline same as page & real vi function, +tvi92B|televideo model 921 with sysline same as page & real vi function & no beeper, am, hs, xenl, xhp, cols#80, lines#24, xmc#0, acsc=, clear=^Z, cnorm=\E.3, cr=^M, cub1=^H, cud1=^V, cuf1=^L, @@ -3827,7 +4382,7 @@ tvi92B|televideo model 921 with sysline same as page & real vi function, invis@, is2=\El\E"\EF1\E.3\017\EA\E<, kbs=^H, kclr=^Z, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER$<1*/>, ked=\EY, kel=\ET, kich1=\EQ, kil1=\EE, - nel=^M^J, rmacs=\E%, rmir=, smacs=\E$, smir=, tsl=\Ef\EG0, + nel=^M^J, rmacs=\E%, smacs=\E$, tsl=\Ef\EG0, use=adm+sgr, # (tvi92D: removed :ko=bt: before translation, I see no backtab cap -- esr) tvi92D|tvi92B with DTR instead of XON/XOFF & better padding, @@ -4112,13 +4667,13 @@ tvi925-hi|TeleVideo Model 925 with half intensity standout mode, tvi950|televideo 950, am, hs, mir, msgr, xenl, xon, cols#80, it#8, lines#24, xmc#1, - acsc=d\rc\014e\nb\011i\013, bel=^G, cbt=\EI, clear=\E*, + acsc=b\011c\014d\re\ni\013, bel=^G, cbt=\EI, clear=\E*, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, dl1=\ER, dsl=\Eg\Ef\r, ed=\Ey, el=\Et, flash=\Eb$<200/>\Ed, fsl=^M, home=^^, ht=^I, hts=\E1, ich1=\EQ, il1=\EE, ind=^J, invis@, - is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\El\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\011\Ex3\200\200\Ex4\r\200\Ef\r, + is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\El\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\Ef\r, kbs=^H, kcbt=\EI, kclr=\E*, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\Ey, kel=\Et, kf0=^A0\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, @@ -4140,7 +4695,7 @@ tvi950|televideo 950, # set local (no send) edit keys (\Ek) when exiting vi # tvi950-2p|televideo950 w/2 pages, - is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\011\Ex3\200\200\Ex4\r\200\E\\2\E-07 \011, + is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\\2\E-07 \011, rmcup=\E\\2\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, smkx=\El, use=tvi950, @@ -4155,7 +4710,7 @@ tvi950-2p|televideo950 w/2 pages, # place cursor at 0,24,1 (\E-07 ) # tvi950-4p|televideo950 w/4 pages, - is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\011\Ex3\200\200\Ex4\r\200\E\\3\E-07 \011, + is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\\3\E-07 \011, rmcup=\E\\3\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, smkx=\El, use=tvi950, @@ -4167,12 +4722,12 @@ tvi950-4p|televideo950 w/4 pages, # tvi950-rv|televideo950 rev video, flash=\Ed$<200/>\Eb, - is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\El\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\011\Ex3\200\200\Ex4\r\200, use=tvi950, + is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\El\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0, use=tvi950, # tvi950-rv-2p uses the appropriate entries from 950-2p and 950-rv tvi950-rv-2p|televideo950 rev video w/2 pages, flash=\Ed$<200/>\Eb, - is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\011\Ex3\200\200\Ex4\r\200\E\\2\E-07\s, + is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\\2\E-07\s, rmcup=\E\\2\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, smkx=\El, use=tvi950, @@ -4180,7 +4735,7 @@ tvi950-rv-2p|televideo950 rev video w/2 pages, # tvi950-rv uses the appropriate entries from 950-4p and 950-rv tvi950-rv-4p|televideo950 rev video w/4 pages, flash=\Ed$<200/>\Eb, - is2=\EDF\EC\Eb\EG0\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\011\Ex3\200\200\Ex4\r\200\E\\3\E-07\s, + is2=\EDF\EC\Eb\EG0\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\\3\E-07\s, rmcup=\E\\3\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, smkx=\El, use=tvi950, @@ -4203,7 +4758,7 @@ tvi955|televideo 955, is2=\E[=3l\EF1\Ed\EG0\E[=5l\E%\El, kctab=\E2, khts=\E1, knp=\EK, kpp=\EJ, krmir=\EQ, ktbc=\E3, mc0=\EP, rmacs=\E%, rmam=\E[=7l, rmxon=^N, - rs1=\EDF\EC\Eg\Er\EO\E'\E(\Ew\EX\Ee \017\E0P\E6\200\E0p\E4\200\Ef\r, + rs1=\EDF\EC\Eg\Er\EO\E'\E(\Ew\EX\Ee \017\E0P\E6\0\E0p\E4\0\Ef\r, sgr0=\EG0\E[=5l, smacs=\E$, smam=\E[=7h, smxon=^O, use=tvi950, tvi955-w|955-w|televideo955 w/132 cols, @@ -4237,7 +4792,7 @@ tvi970|televideo 970, smcup=\E[?20l\E[?7h\E[1Q, smir=\E[4h, smso=\E[7m, smul=\E[4m, vpa=\E[%i%p1%dd, tvi970-vb|televideo 970 with visual bell, - flash=\E[?5h\200\200\200\200\200\200\200\200\200\200\200\200\200\E[?5l, use=tvi970, + flash=\E[?5h\0\0\0\0\0\0\0\0\0\0\0\0\0\E[?5l, use=tvi970, tvi970-2p|televideo 970 with using 2 pages of memory, rmcup=\E[H\E[J\E[V, smcup=\E[U\E[?20l\E[?7h\E[1Q, use=tvi970, @@ -4264,7 +4819,7 @@ tvi9065|televideo 9065, am, bw, chts, hs, mc5i, mir, msgr, xenl, xon, cols#80, it#8, lh#1, lines#25, lm#0, lw#9, ma#4, nlab#8, vt#0, wnum#0, wsl#30, - acsc=0_'rjhkglfmeniopxjqksqtmulvown, bel=^G, + acsc='r0_jhkglfmeniopqksqtmulvownxj, bel=^G, blink=\EG2, bold=\EG\,, cbt=\EI, civis=\E.0, clear=^Z, cnorm=\E.3, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^V, cuf=\E[%p1%dC, cuf1=^L, @@ -4289,10 +4844,10 @@ tvi9065|televideo 9065, rep=\E[%p2%db%p1%c, rev=\EG4, rf=/usr/share/tabset/stdcrt, ri=\Ej, rin=\E[%p1%dT, rmacs=\E%, rmam=\E[=7l, rmcup=\E.3\Er\E[1;25r\E[25;0H, - rmdc=\200, rmir=\Er, rmln=\E[4;1v, rmso=\EG0, rmul=\EG0, + rmdc=\0, rmir=\Er, rmln=\E[4;1v, rmso=\EG0, rmul=\EG0, rmxon=^N, rs1=\EC\EDF\E[0;0v\E[8;1v\E[=65l, - rs2=\E.b\E[10;20v\E[14;1v\E[3;0v\E[7;0v\E[=11.h\E[=12.h\E[=13.h\E[=14.h\E[=15l\E[=20h\E[=60l\E[=61h\E[=9l\E[=10l\E[=21l\E[=23l\E[=3l\E_40\E_50\En\Ew\Ee \Ex0\200\200\Ex1\200\200\Ex2\200\200\Ex3\200\200\Ex4\200\200\E1, - rs3=\E[=19h\E.3\E9\E0O\200\200\200\200\200\E0o\200\200\200\200\200\E0J\177\200\200\200\200, + rs2=\E.b\E[10;20v\E[14;1v\E[3;0v\E[7;0v\E[=11.h\E[=12.h\E[=13.h\E[=14.h\E[=15l\E[=20h\E[=60l\E[=61h\E[=9l\E[=10l\E[=21l\E[=23l\E[=3l\E_40\E_50\En\Ew\Ee \Ex0\0\0\Ex1\0\0\Ex2\0\0\Ex3\0\0\Ex4\0\0\E1, + rs3=\E[=19h\E.3\E9\E0O\0\0\0\0\0\E0o\0\0\0\0\0\E0J\177\0\0\0\0, sgr=\EG0%?%p1%t\EGt%;%?%p2%t\EG8%;%?%p3%t\EG4%;%?%p4%t\EG2%;%?%p5%t\EGp%;%?%p6%t\EG\,%;%?%p7%t\EG1%;%?%p9%t\E$%e\E%%%;, sgr0=\EG0, smacs=\E$, smam=\E=7h, smcup=\E.2, smdc=\Er, smir=\Eq, smln=\E[4;2v, smso=\EGt, smul=\EG8, smxon=^O, @@ -4374,8 +4929,8 @@ vi200|visual 200, kf7=\E?w, kf8=\E?x, kf9=\E?y, khome=\EH, khts=\E1, kich1=\Ei, kil1=\EL, krmir=\Ej, mc0=\EH\E], mc4=\EX, mc5=\EW, ri=\EI, rmacs=\EG, rmkx=\E>, rmso=\E3, - rs1=\E3\Eb\Ej\E\\\El\EG\Ec\Ek\EX, sgr0=\E3\Eb, - smacs=\EF, smkx=\E=, smso=\E4, tbc=\Eg, + rs1=\E3\Eb\Ej\E\El\EG\Ec\Ek\EX, sgr0=\E3\Eb, smacs=\EF, + smkx=\E=, smso=\E4, tbc=\Eg, # The older Visuals didn't come with function keys. This entry uses # and so that the keypad keys can be used as function keys. # If your version of vi doesn't support function keys you may want @@ -4465,20 +5020,14 @@ vi603|visual603|visual 603, # # Wyse sales can be reached by phone at 1-800-GET-WYSE. Tech support is at # (800)-800-WYSE (option 5 gets you a human). There's a Web page at the -# obvious address, http://www.wyse.com. +# obvious address, . They keep terminfo entries at +# . # # Wyse bought out Link Technology, Inc. in 1990 and closed it down in 1995. # They now own the Qume and Amdek brands, too. So these are the people to # talk with about all Link, Qume, and Amdek terminals. # -# Wyse has a BBS containing termcap and terminfo stuff for their terminals -# (though this may not last long -- I expect the Web will kill it off by -# mid-1997 or so). According to their tech support, at 800-800-9973, it's -# at 408-922-4400 thru 4405. The 4400 modem is flaky as of 5/96, so -# call 4401 etc. Come in at 9600 hard; don't use autospeed sense. -# -# All the following entries until (but not including) wy520 are direct from -# Wyse technical support and represent their best knowledge as of January 1995. +# These entries include a few small fixes. # I canceled the bel capacities in the vb entries. # I made two trivial syntax fixes in the wyse30 entry. # I made some entries relative to adm+sgr. @@ -4523,10 +5072,11 @@ wy30-mc|wyse30-mc|wyse 30 with magic cookies, msgr@, ma@, xmc#1, blink=\EG2, dim=\EGp, prot=\EG0\E), rmacs=\EG0\EH\003, - rmcup=\EG0, + rmcup=\EG0, rmso=\EG0, sgr=\EG%'0'%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, sgr0=\EG0\E(\EH\003, smacs=\EG0\EH\002, smcup=, - use=wy30, use=adm+sgr, + smso=\EG4, use=wy30, + use=adm+sgr, # The mandatory pause used by does not work with # older versions of terminfo. If you see this effect then # unset xon and delete the / from the delay. @@ -4563,7 +5113,7 @@ wy50|wyse50|Wyse 50, pfx=\Ez%p1%'?'%+%c%p2%s\177, pln=\Ez%p1%'/'%+%c%p2%s\r, prot=\E`7\E), rev=\E`6\E), ri=\Ej, rmacs=\EH^C, rmir=\Er, rmln=\EA11, rmso=\E(, - sgr=%?%p1%p3%|%t\E`6\E)\n%e%p5%p8%|%t\E`7\E)%e\E(%;\n%?%p9%t\EH\002%e\EH\003%;, + sgr=%?%p1%p3%|%t\E`6\E)%e%p5%p8%|%t\E`7\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, sgr0=\E(\EH\003, smacs=\EH^B, smir=\Eq, smln=\EA10, smso=\E`6\E), tbc=\E0, tsl=\EF, # @@ -4578,8 +5128,8 @@ wy50|wyse50|Wyse 50, wy50-mc|wyse50-mc|wyse 50 with magic cookies, msgr@, ma@, xmc#1, - blink=\EG2, dim=\EGp, prot=\EG0\E), rmacs=\EG0\EH\003, - rmcup=\EG0, + blink=\EG2, dim=\EGp, prot=\EG0\E), rev=\EG4, + rmacs=\EG0\EH\003, rmcup=\EG0, rmso=\EG0, sgr=\EG%'0'%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, sgr0=\EG0\E(\EH\003, smacs=\EG0\EH\002, smcup=, smso=\EGt, use=wy50, @@ -4637,8 +5187,8 @@ wy350|wyse350|Wyse 350, pfx=\Ez%p1%'?'%+%c%p2%s\177, pln=\Ez%p1%'/'%+%c%p2%s\r, prot=\EG0\E), ri=\Ej, rmacs=\EG0\EH\003, rmir=\Er, rmln=\EA11, setb=, - setf=%?%p1%{0}%=%t%{76}\n%e%p1%{1}%=%t%{64}\n%e%p1%{2}%=%t%{8}\n%e%p1%{3}%=%t%{72}\n%e%p1%{4}%=%t%{4}\n%e%p1%{5}%=%t%{68}\n%e%p1%{6}%=%t%{12}\n%e%p1%{7}%=%t%{0}\n%;%PC\n\EG%gC%gA%+%'0'%+%c, - sgr=%{0}%?%p4%t%{2}%|%;\n%?%p7%t%{1}%|%;%PA\n\EG%?%gC%t%gC%e\n%{0}%?%p1%t%{4}%|%;\n%?%p2%t%{8}%|%;\n%?%p3%t%{4}%|%;\n%?%p5%t%{64}%|%;\n%;%gA%+%'0'%+%c\n%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, + setf=%?%p1%{0}%=%t%{76}%e%p1%{1}%=%t%{64}%e%p1%{2}%=%t%{8}%e%p1%{3}%=%t%{72}%e%p1%{4}%=%t%{4}%e%p1%{5}%=%t%{68}%e%p1%{6}%=%t%{12}%e%p1%{7}%=%t%{0}%;%PC\EG%gC%gA%+%'0'%+%c, + sgr=%{0}%?%p4%t%{2}%|%;%?%p7%t%{1}%|%;%PA\EG%?%gC%t%gC%e%{0}%?%p1%t%{4}%|%;%?%p2%t%{8}%|%;%?%p3%t%{4}%|%;%?%p5%t%{64}%|%;%;%gA%+%'0'%+%c%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, sgr0=\EG0\E(\EH\003%{0}%PA%{0}%PC, smacs=\EG0\EH\002, smir=\Eq, smln=\EA10, tbc=\E0, tsl=\EF, use=adm+sgr, @@ -4675,7 +5225,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>, @@ -4699,8 +5249,9 @@ wy120|wyse120|wy150|wyse150|Wyse 120/150, rs3=\EwG\Ee($<100>, sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%'0'%?%p2%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, - smcup=\Ew0, smir=\Eq, smln=\EA10, smso=\EGt, - smxon=\Ec21\ntbc=\E0, tsl=\EF, use=adm+sgr, + smcup=\Ew0, smir=\Eq, smln=\EA10, smso=\EGt, smxon=\Ec21, + tbc=\E0, tsl=\EF, + use=adm+sgr, # wy120-w|wyse120-w|wy150-w|wyse150-w|wyse 120/150 132-column, cols#132, lw#7, nlab#16, wsl#97, @@ -4756,7 +5307,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, @@ -4891,7 +5442,7 @@ wy99gt-w-vb|wy99gt-wvb|wyse99gt-wvb|Wyse 99gt 132-column visible bell, 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>, @@ -4977,9 +5528,9 @@ wy75|wyse75|wyse 75, 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$<3*>, dch1=\E[P$<3>, dim=\E[0t\E[2m, dl=\E[%p1%dM$<1*>, - dl1=\E[M, dsl=\E[>\\\,\001\001\E[>-\001\001, + dl1=\E[M, dsl=\E[>\,\001\001\E[>-\001\001, ech=\E[%p1%dX, ed=\E[J$<30>, el=\E[K$<3>, el1=\E[1K$<3>, - enacs=\E)0, flash=\E[30h\E\\\,\E[30l$<250>, fsl=^A, + enacs=\E)0, flash=\E[30h\E\,\E[30l$<250>, fsl=^A, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@$<1*>, il=\E[%p1%dL$<2*>, il1=\E[L$<2>, ind=\n$<2>, ip=$<1>, @@ -5001,7 +5552,7 @@ wy75|wyse75|wyse 75, sgr=%?%p5%t\E[0t%;%?%p3%p1%|%t\E[1t%;%?%p2%t\E[2t%;%?%p4%t\E[3t%;%?%p1%p2%p3%p4%p5%|%|%|%|%t\E[7m%e\E[m%;%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, smkx=\E[?1l\E[?7h\E=, smso=\E[1t\E[7m, smul=\E[2t\E[4m, - tbc=\E[3g, tsl=\E[>\\\,\001, + tbc=\E[3g, tsl=\E[>\,\001, # # This terminal description uses the non-hidden attribute mode # (with magic cookie). @@ -5048,7 +5599,7 @@ wy85|wyse85|wyse 85, dch=\E[%p1%dP$<3*>, dch1=\E[P$<3>, dim=\E[2m, dl=\E[%p1%dM$<3*>, dl1=\E[M$<3>, dsl=\E[40l, ech=\E[%p1%dX, ed=\E[J$<110>, el=\E[K$<1>, el1=\E[1K, - enacs=\E)0, flash=\E[30h\E\\\,\E[30l$<300>, + enacs=\E)0, flash=\E[30h\E\,\E[30l$<300>, fsl=\E[1;24r\E8, home=\E[H, ht=\011$<1>, hts=\EH, ich=\E[%p1%d@$<4*>, il=\E[%p1%dL$<5*>, il1=\E[L$<5>, ind=\n$<3>, invis=\E[8m, ip=$<3>, is1=\E[62;1"p\E[?5W, @@ -5073,7 +5624,7 @@ wy85|wyse85|wyse 85, # # Wyse 85 with visual bell. wy85-vb|wyse85-vb|wyse 85 with visible bell, - bel@, flash=\E[30h\E\\\,\E[30l$<300>, use=wy85, + bel@, flash=\E[30h\E\,\E[30l$<300>, use=wy85, # # Wyse 85 in 132-column mode. wy85-w|wyse85-w|wyse 85 in 132-column mode, @@ -5108,7 +5659,7 @@ wy185|wyse185|wyse 185, dim=\E[2m, dl=\E[%p1%dM$<2*>, dl1=\E[M$<2>, dsl=\E7\E[99;0H\E[K\E8, ech=\E[%p1%dX, ed=\E[J$<40>, el=\E[K, el1=\E[1K, enacs=\E)0, - flash=\E[30h\E\\\,\E[30l$<100>, fsl=\E[1;24r\E8, + flash=\E[30h\E\,\E[30l$<100>, fsl=\E[1;24r\E8, home=\E[H, hpa=\E[%i%p1%d`, ht=^I, hts=\EH, ich=\E[%p1%d@$<2>, il=\E[%p1%dL$<3*>, il1=\E[L$<3>, ind=\n$<2>, invis=\E[8m, ip=$<4>, is1=\E[?5W, @@ -5161,7 +5712,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>, @@ -5289,16 +5840,16 @@ wy370-nk|wyse 370 without function keys, dclk=\E[31h, dim=\E[2m, dl=\E[%p1%dM$<2*>, dl1=\E[M$<2>, dsl=\E[40l, ech=\E[%p1%dX$<.1*>, ed=\E[J$<40>, el=\E[K$<10>, el1=\E[1K$<12>, enacs=\E)0, - flash=\E[30h\E\\\,\E[30l$<300>, fsl=\E[1;24r\E8, + flash=\E[30h\E\,\E[30l$<300>, fsl=\E[1;24r\E8, home=\E[H, hpa=\E[%i%p1%d`, ht=\011$<1>, hts=\EH, ich=\E[%p1%d@$<1*>, il=\E[%p1%dL$<2*>, il1=\E[L$<2>, ind=\n$<2>, - initc=\E[66;%p1%d;\n%?%p2%{250}%<%t%{0}\n%e%p2%{500}%<%t%{16}\n%e%p2%{750}%<%t%{32}%e%{48}%;\n%?%p3%{250}%<%t%{0}\n%e%p3%{500}%<%t%{4}\n%e%p3%{750}%<%t%{8}%e%{12}%;\n%?%p4%{250}%<%t%{0}\n%e%p4%{500}%<%t%{1}\n%e%p4%{750}%<%t%{2}%e%{3}%;%{1}%+%+%+%dw, + initc=\E[66;%p1%d;%?%p2%{250}%<%t%{0}%e%p2%{500}%<%t%{16}%e%p2%{750}%<%t%{32}%e%{48}%;%?%p3%{250}%<%t%{0}%e%p3%{500}%<%t%{4}%e%p3%{750}%<%t%{8}%e%{12}%;%?%p4%{250}%<%t%{0}%e%p4%{500}%<%t%{1}%e%p4%{750}%<%t%{2}%e%{3}%;%{1}%+%+%+%dw, invis=\E[8m, ip=$<1>, is1=\E[90;1"p\E[?5W$<6>, is2=\E[2;4;20;30;40l\E[?1;10;16l\E[12h\E[?7;8;25h, is3=\E>\017\E)0\E(B\E[63;0w\E[m, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, - oc=\E[60w\E[63;0w\n\E[66;1;4w\n\E[66;2;13w\n\E[66;3;16w\n\E[66;4;49w\n\E[66;5;51w\n\E[66;6;61w\n\E[66;7;64w, + oc=\E[60w\E[63;0w\E[66;1;4w\E[66;2;13w\E[66;3;16w\E[66;4;49w\E[66;5;51w\E[66;6;61w\E[66;7;64w, op=\E[m, rc=\E8, rev=\E[7m, ri=\EM$<2>, rmacs=^O, rmam=\E[?7l, rmclk=\E[31l, rmcup=\E[ R, rmir=\E[4l, rmkx=\E>, rmso=\E[27m, rmul=\E[24m, @@ -5359,7 +5910,7 @@ wy370-w|Wyse 370 in 132-column mode, # # Wyse 370 in 132-column mode with visual bell. wy370-wvb|Wyse 370 with visible bell 132-columns, - flash=\E[30h\E\\\,\E[30l$<300>, + flash=\E[30h\E\,\E[30l$<300>, use=wy370-w, wy370-rv|Wyse 370 reverse video, rs3=\E[32h\E[?5h, use=wy370, @@ -5370,7 +5921,7 @@ wy99gt-tek|Wyse 99gt Tektronix 4010/4014 emulator, am, os, cols#74, lines#35, bel=^G, clear=\E^L, cr=^M, cub1=^H, cud1=^J, cuf1=\s, - cup=\035%{3040}%{89}%p1%*%-%Py\n%p2%{55}%*%Px\n%gy%{128}%/%{31}%&%{32}%+%c\n%gy%{3}%&%{4}%*%gx%{3}%&%+%{96}%+%c\n%gy%{004}%/%{31}%&%{96}%+%c\n%gx%{128}%/%{31}%&%{32}%+%c\n%gx%{004}%/%{31}%&%{64}%+%c\037, + cup=\035%{3040}%{89}%p1%*%-%Py%p2%{55}%*%Px%gy%{128}%/%{31}%&%{32}%+%c%gy%{3}%&%{4}%*%gx%{3}%&%+%{96}%+%c%gy%{004}%/%{31}%&%{96}%+%c%gx%{128}%/%{31}%&%{32}%+%c%gx%{004}%/%{31}%&%{64}%+%c\037, cuu1=^K, ff=^L, hd=\036HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH\037, home=^]7`x @\037, @@ -5380,7 +5931,7 @@ wy99gt-tek|Wyse 99gt Tektronix 4010/4014 emulator, # Wyse 160 Tektronix 4010/4014 emulator, # wy160-tek|Wyse 160 Tektronix 4010/4014 emulator, - cup=\035%{3103}%{91}%p1%*%-%Py\n%p2%{55}%*%Px\n%gy%{128}%/%{31}%&%{32}%+%c\n%gy%{3}%&%{4}%*%gx%{3}%&%+%{96}%+%c\n%gy%{004}%/%{31}%&%{96}%+%c\n%gx%{128}%/%{31}%&%{32}%+%c\n%gx%{004}%/%{31}%&%{64}%+%c\037, + cup=\035%{3103}%{91}%p1%*%-%Py%p2%{55}%*%Px%gy%{128}%/%{31}%&%{32}%+%c%gy%{3}%&%{4}%*%gx%{3}%&%+%{96}%+%c%gy%{004}%/%{31}%&%{96}%+%c%gx%{128}%/%{31}%&%{32}%+%c%gx%{004}%/%{31}%&%{64}%+%c\037, home=^]8`g @\037, use=wy99gt-tek, # @@ -5390,7 +5941,7 @@ wy370-tek|Wyse 370 Tektronix 4010/4014 emulator, am, os, cols#80, lines#36, bel=^G, clear=\E^L, cr=^M, cub1=^H, cud1=^J, cuf1=\s, - cup=\035%{775}%{108}%p1%*%{5}%/%-%Py\n%p2%{64}%*%{4}%+%{5}%/%Px\n%gy%{32}%/%{31}%&%{32}%+%c\n%gy%{31}%&%{96}%+%c\n%gx%{32}%/%{31}%&%{32}%+%c\n%gx%{31}%&%{64}%+%c\037, + cup=\035%{775}%{108}%p1%*%{5}%/%-%Py%p2%{64}%*%{4}%+%{5}%/%Px%gy%{32}%/%{31}%&%{32}%+%c%gy%{31}%&%{96}%+%c%gx%{32}%/%{31}%&%{32}%+%c%gx%{31}%&%{64}%+%c\037, cuu1=^K, ff=^L, hd=\036HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH\037, home=^]8g @\037, @@ -5471,7 +6022,7 @@ wy520-24|wyse520-24|wyse 520 with 24 data lines, # # Wyse 520 with visual bell. wy520-vb|wyse520-vb|wyse 520 with visible bell, - flash=\E[30h\E\\\,\E[30l$<100>, use=wy520, + flash=\E[30h\E\,\E[30l$<100>, use=wy520, # # Wyse 520 in 132-column mode. wy520-w|wyse520-w|wyse 520 in 132-column mode, @@ -5482,7 +6033,7 @@ wy520-w|wyse520-w|wyse 520 in 132-column mode, # # Wyse 520 in 132-column mode with visual bell. wy520-wvb|wyse520-wvb|wyse 520 with visible bell 132-columns, - flash=\E[30h\E\\\,\E[30l$<100>, + flash=\E[30h\E\,\E[30l$<100>, use=wy520-w, # # @@ -5495,7 +6046,7 @@ wy520-wvb|wyse520-wvb|wyse 520 with visible bell 132-columns, # - Delete : delete a character (have to change interrupt character # to CTRL-C: stty intr '^c') for it to work since the # Delete key sends 7FH. -wy520-epc|wyse520-epc|wyse 520 with EPC kb, +wy520-epc|wyse520-epc|wyse 520 with EPC keyboard, kdch1=\177, kel=\E[4~, kend=\E[4~, kf0=\E[21~, kf1=\E[11~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, khome=\E[H, use=wy520, @@ -5508,11 +6059,11 @@ wy520-epc-24|wyse520-pc-24|wyse 520 with 24 data lines, # # Wyse 520 with visual bell. wy520-epc-vb|wyse520-pc-vb|wyse 520 with visible bell, - flash=\E[30h\E\\\,\E[30l$<100>, + flash=\E[30h\E\,\E[30l$<100>, use=wy520-epc, # # Wyse 520 in 132-column mode. -wy520-epc-w|wyse520-epc-w|wyse 520 in 132-column mode, +wy520-epc-w|wyse520-epc-w|wyse 520 in 132-column mode with EPC keyboard, cols#132, wsl#132, dch=\E[%p1%dP$<7>, dch1=\E[P$<7>, ich=\E[%p1%d@$<7>, ip=$<7>, rs2=\E[35h\E[?3h, @@ -5520,7 +6071,7 @@ wy520-epc-w|wyse520-epc-w|wyse 520 in 132-column mode, # # Wyse 520 in 132-column mode with visual bell. wy520-epc-wvb|wyse520-p-wvb|wyse 520 with visible bell 132-columns, - flash=\E[30h\E\\\,\E[30l$<100>, + flash=\E[30h\E\,\E[30l$<100>, use=wy520-epc-w, # # Wyse 520 in 80-column, 36 lines @@ -5536,7 +6087,7 @@ wy520-48|wyse520-48|wyse 520 with 48 data lines, dsl@, fsl@, rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r, tsl@, use=wy520, # # Wyse 520 in 132-column, 36 lines -wy520-36w|wyse520-36w|wyse 520 with 36 data lines, +wy520-36w|wyse520-36w|wyse 520 with 132 columns and 36 data lines, cols#132, wsl#132, rs2=\E[?3h, rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r\E[132$|, use=wy520-36, @@ -5549,19 +6100,19 @@ wy520-48w|wyse520-48w|wyse 520 with 48 data lines, # # # Wyse 520 in 80-column, 36 lines with EPC keyboard -wy520-36pc|wyse520-36pc|wyse 520 with 36 data lines, +wy520-36pc|wyse520-36pc|wyse 520 with 36 data lines and EPC keyboard, hs@, lines#36, dsl@, fsl@, rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r, tsl@, use=wy520-epc, # # Wyse 520 in 80-column, 48 lines with EPC keyboard -wy520-48pc|wyse520-48pc|wyse 520 with 48 data lines, +wy520-48pc|wyse520-48pc|wyse 520 with 48 data lines and EPC keyboard, hs@, lines#48, dsl@, fsl@, rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r, tsl@, use=wy520-epc, # # Wyse 520 in 132-column, 36 lines with EPC keyboard -wy520-36wpc|wyse520-36wpc|wyse 520 with 36 data lines, +wy520-36wpc|wyse520-36wpc|wyse 520 with 36 data lines and EPC keyboard, cols#132, wsl#132, rs2=\E[?3h, rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r\E[132$|, use=wy520-36pc, @@ -5575,7 +6126,7 @@ wy520-48wpc|wyse520-48wpc|wyse 520 with 48 data lines, # From: John Gilmore # (wyse-vp: removed , there's no such # file and we don't know what is -- esr) -wyse-vp|wyse|Wyse 50 in ADDS Viewpoint emulation mode with "enhance" on, +wyse-vp|Wyse 50 in ADDS Viewpoint emulation mode with "enhance" on, am, cols#80, it#8, lines#24, bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^F, @@ -5598,7 +6149,7 @@ wy100q|Wyse 100 for Quotron, cbt=\EI, clear=^Z, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, dl1=\ER, ed=\EY, el=\ET, home=^^, il1=\EE, invis@, - is2=\E`\:\200\EC\EDF\E0\E'\E(\EA21, kcub1=^H, kcud1=^J, + is2=\E`\:\0\EC\EDF\E0\E'\E(\EA21, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, ri=\Ej, rmir=\Er, smir=\Eq, use=adm+sgr, @@ -5755,6 +6306,43 @@ vt320-k311|dec vt320 series as defined by kermit 3.11, # I wrote these entries while looking at the Avatar spec. I don't have # the facilities to test them. Let me know if they work, or don't. # +# Avatar escapes not used by these entries (because maybe you're smarter +# and more motivated than I am and can figure out how to wrap terminfo +# around some of them, and because they are weird enough to be funny): +# level 0: +# ^L -- clear window/reset current attribute to default +# ^V^A%p1%c -- set current color attribute, parameter decodes as follows: +# +# bit: 6 5 4 3 2 1 0 +# | | | | | +# +---+---+ | +---+---+ +# | | | +# | | foreground color +# | foreground intensity +# background color +# level 0+: +# ^V^J%p1%c%p2%c%p3%c%p4%c%p5%c -- scroll (p2,p3) to (p4,p5) up by p1 lines +# ^V^K%p1%c%p2%c%p3%c%p4%c%p5%c -- scroll (p2,p3) to (p4,p5) down by p1 lines +# ^V^L%p1%c%p2%c%p3%c -- clear p2 lines and p3 cols w/attr %p1 +# ^V^M%p1%c%p2%c%p3%c%p4%c -- fill p3 lines & p4 cols w/char p2+attr %p1 +# (^V^L and ^V^M set the current attribute as a side-effect.) +# ^V ^Y [...] -- repeat pattern. specifies the number of bytes +# in the pattern, the number of times the pattern +# should be repeated. If either value is 0, no-op. +# The pattern can contain Avatar console codes, +# including other ^V ^Y patterns. +# level 1: +# ^V^O -- clockwise mode on; turn print direction right each time you +# hit a window edge (yes, really). Turned off by CR +# ^V^P -- no-op +# ^V^Q%c -- query the driver +# ^V^R -- driver reset +# ^V^S -- Sound tone (PC-specific) +# ^V^T -- change highlight at current cursor poition to %c +# ^V^U%p1%c%p2%c -- highlight window with attribute +# ^V^V%p1%c%p2%c%p3%c%p4%c%p5%c +# -- define window +# # From: Eric S. Raymond 1 Nov 1995 # (The ///// capabilities exist only to # tell ncurses that the corresponding highlights exist; it should use , @@ -5764,20 +6352,55 @@ avatar0|avatar terminal emulator level 0, cols#80, it#8, lines#25, blink=^A^V\177, 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\200, rep=\031%p1%c%p2%d, rev=^A^Vp, + 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, # From: Eric S. Raymond 1 Nov 1995 avatar0+|avatar terminal emulator level 0+, - dch1=^V^N, rmir=\026\n\200\200\200\200, smir=^V^I, use=avatar0, + dch1=^V^N, rmir=\026\n\0\0\0\0, smir=^V^I, use=avatar0, # From: Eric S. Raymond 1 Nov 1995 avatar|avatar1|avatar terminal emulator level 1, civis=^V'^B, cnorm=^V'^A, cvvis=^V^C, dl1=^V-, il1=^V+, rmam=^V", rmir=^V^P, smam=^V$, use=avatar0+, +#### RBcomm +# +# RBComm is a lean and mean terminal emulator written by the Interrupt List +# maintainer, Ralf Brown. It was fairly popular in the late DOS years (early +# '90s), especially in the BBS world, and still has some loyal users due to +# its very small memory footprint and to a cute macro language. +rbcomm|IBM PC with RBcomm and EMACS keybindings, + am, bw, mir, msgr, xenl, + cols#80, it#8, lines#25, + 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, + 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=, + rmir=^], rmkx=\E>, rmso=^U, rmul=^U, + rs1=\017\E(B\E)0\025\E[?3l\E[>8g, sc=\E7, sgr0=\E[m, + smcup=, smdc=, smir=^\, smkx=\E=, smso=^R, smul=^T, +rbcomm-nam|IBM PC with RBcomm without autowrap, + am@, + bel=^G, cr=^M, cud1=^J, ht=^I, ind=^J, + is2=\017\035\E(B\E)0\E[?7l\E[?3l\E[>8g, kbs=^H, + kcub1=^H, kcud1=^J, nel=^M^J, + use=rbcomm, +rbcomm-w|IBM PC with RBcomm in 132 column mode, + cols#132, + bel=^G, cr=^M, cud1=^J, ht=^I, ind=^J, + is2=\017\035\E(B\E)0\E[?7h\E[?3h\E[>8g, kbs=^H, + kcub1=^H, kcud1=^J, nel=^M^J, + use=rbcomm, + ######## OLDER TERMINAL TYPES # # This section is devoted to older commercial terminal brands that are now @@ -5788,8 +6411,9 @@ avatar|avatar1|avatar terminal emulator level 1, # # This section also includes Teletype-branded VDTs. # -# The AT&T/Teletype terminals group was sold to SunRiver Data Systems; for -# details, see the header comment on the ADDS section. +# The AT&T/Teletype terminals group was sold to SunRiver Data Systems (now +# Boundless Technologies); for details, see the header comment on the ADDS +# section. # # These are AT&T's official terminfo entries. All-caps aliases have been # removed. @@ -5829,7 +6453,7 @@ att2350|AT&T 2350 Video Information Terminal 80 column mode, att5410v1|att4410v1|tty5410v1|AT&T 4410/5410 80 columns - version 1, am, hs, mir, msgr, xon, cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, - acsc=``aaffhhggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~00++--\,\,.., + acsc=++\,\,--..00``aaffgghhjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[2;7m, clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dim=\E[2m, @@ -6196,7 +6820,7 @@ att4426|tty4426|teletype 4426S, att510a|bct510a|AT&T 510A Personal Terminal, am, mir, msgr, xenl, xon, cols#80, lh#2, lines#24, lw#7, nlab#8, - acsc=hrisjjkkllmmnnqqttuuvvwwxx{{||}}~~-f\,h.e+g`b, + acsc=+g\,h-f.e`bhrisjjkkllmmnnqqttuuvvwwxx{{||}}~~, bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, civis=\E[11;0|, clear=\E[H\E[J, cnorm=\E[11;3|, cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[1B, @@ -6229,7 +6853,7 @@ att510a|bct510a|AT&T 510A Personal Terminal, att510d|bct510d|AT&T 510D Personal Terminal, am, da, db, mir, msgr, xenl, xon, cols#80, lh#2, lines#24, lm#48, lw#7, nlab#8, - acsc=hrisjjkkllmmnnqqttuuvvwwxx{{||}}~~-f\,h.e+g`b, + acsc=+g\,h-f.e`bhrisjjkkllmmnnqqttuuvvwwxx{{||}}~~, bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, clear=\E[H\E[J, cnorm=\E[11;3|, cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[1B, cuf=\E[%p1%dC, @@ -6260,7 +6884,7 @@ att510d|bct510d|AT&T 510D Personal Terminal, att500|att513|AT&T 513 using page mode, am, chts, mir, msgr, xenl, xon, cols#80, lh#2, lines#24, lw#8, nlab#8, - acsc=hrisjjkkllmmnnqqttuuvvwwxx{{||}}~~-f\,h.e+g`b, + acsc=+g\,h-f.e`bhrisjjkkllmmnnqqttuuvvwwxx{{||}}~~, bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, clear=\E[H\E[J, cnorm=\E[11;0|, cr=^M, csr=%i\E[%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, @@ -6422,7 +7046,7 @@ att605|AT&T 605 80 column 102key keyboard, smir=\E[4h, smln=\E[p, smso=\E[7m, smul=\E[4m, tsl=\E7\E[25;%i%p1%dx, att605-pc|ATT 605 in pc term mode, - acsc=k\277l\332m\300j\331n\305w\302q\304u\264t\303v\301x\263, + acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, cbt=\E[Z, cub1=\E[D, cud1=\E[B, cuf1=\E[C, cuu1=\E[A, dch1=\E[P, dl1=\E[M, ich1=\E[@, il=\E[L, il1=\E[L, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, @@ -7108,7 +7732,7 @@ aas1901|Ann Arbor K4080 w/S1901 mod, am, cols#80, lines#40, bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^_, cuu1=^N, - home=^K, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, ll=^O\200c, + home=^K, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, ll=^O\0c, nel=^M^J, # If you're using the GNU termcap library, add @@ -7205,7 +7829,7 @@ aaa-30-s-rv|aaa-s-rv|ann arbor ambassador/30 lines+status+reverse video, aaa-s-ctxt|aaa-30-s-ctxt|ann arbor ambassador/30 lines+status+save context, rmcup=\E[60;1;0;30p\E[59;1H\E[K, smcup=\E[30;1H\E[K\E[30;1;0;30p, use=aaa-30-s, -aaa-s-rv-ctxt|aaa-30-s-rv-ct|ann arbor ambassador/30 lines+status+save context, +aaa-s-rv-ctxt|aaa-30-s-rv-ct|ann arbor ambassador/30 lines+status+save context+reverse video, rmcup=\E[60;1;0;30p\E[59;1H\E[K, smcup=\E[30;1H\E[K\E[30;1;0;30p, use=aaa-30-s-rv, aaa|aaa-30|ambas|ambassador|ann arbor ambassador/30 lines, @@ -7330,17 +7954,18 @@ aaa-rv-unk|ann arbor unknown type, # ADDS itself is long gone. ADDS was bought by NCR, and the same group made # ADDS and NCR terminals. When AT&T and NCR merged, the engineering for # terminals was merged again. Then AT&T sold the terminal business to -# SunRiver. The engineers from Teletype, AT&T terminals, ADDS, -# and NCR (who are still there as of early 1995) are at: +# SunRiver, which later changed its name to Boundless Technologies. The +# engineers from Teletype, AT&T terminals, ADDS, and NCR (who are still there +# as of early 1995) are at: # -# SunRiver Data Systems +# Boundless Technologies # 100 Marcus Boulevard # Hauppauge, NY 11788-3762 # Vox: (800)-231-5445 # Fax: (516)-342-7378 # # Their voice mail used to describe the place as "SunRiver (formerly ADDS)". -# In 1995 SunRiver acquired DEC's terminals business. +# In 1995 Boundless acquired DEC's terminals business. # # Regent: lowest common denominator, works on all regents. @@ -7480,7 +8105,7 @@ cit101|citc|C.itoh fast vt100, # The following termcap entry was created from the Callan cd100 entry. The # last two lines (with the capabilities in caps) are used by RM-cobol to allow # full selection of combinations of reverse video, underline, and blink. -# (cit101e: emoved unknown :f0=\EOp:f1=\EOq:f2=\EOr:f3=\EOs:f4=\EOt:f5=\EOu:\ +# (cit101e: removed unknown :f0=\EOp:f1=\EOq:f2=\EOr:f3=\EOs:f4=\EOt:f5=\EOu:\ # f6=\EOv:f7=\EOw:f8=\EOx:f9=\EOy:AB=\E[0;5m:AL=\E[m:AR=\E[0;7m:AS=\E[0;5;7m:\ # :NB=\E[0;1;5m:NM=\E[0;1m:NR=\E[0;1;7m:NS=\E[0;1;5;7m: -- esr) cit101e|C. Itoh CIT-101e, @@ -7495,13 +8120,50 @@ cit101e|C. Itoh CIT-101e, kf7=\EOM, kf8=\EOn, rc=\E8, ri=\EM, rmacs=^O, rmir=\E[4l, rmkx=\E>, rmso=\E[m, rmul=\E[m, sc=\E7, smacs=^N, smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, +# From: David S. Lawyer, June 1997: +# The CIT 101-e was made in Japan in 1983-4 and imported by CIE +# Terminals in Irvine, CA. It was part of CITOH Electronics. In the +# late 1980's CIT Terminals went out of business. +# There is no need to use the initialization string is=... (by invoking +# tset or setterm etc.) provided that the terminal has been manually set +# up (and the setup saved with ^S) to be compatible with this termcap. To be +# compatible it should be in ANSI mode (not VT52). A set-up that +# works is to set all the manually setable stuff to factory defaults +# by pressing ^D in set-up mode. Then increse the brighness with the +# up-arrow key since the factory default will likely be dim on an old +# terminal. Then change any options you want (provided that they are +# compatible with the termcap). For my terminal I set: Screen +# Background: light; Keyclicks: silent; Auto wraparound: on; CRT saver: +# on. I also set up mine for parity (but you may not need it). Then +# save the setup with ^S. +# +cit101e-rv|Citoh CIT-101e (sets reverse video), + am, eo, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[1v, + clear=\E[H\E[J, cnorm=\E[0;3;4v, 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[3;5v, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, flash=\E[?5l\E[?5h$<200/>, + 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=\E<\E>\E[?1l\E[?3l\E[?4l\E[?5h\E[?7h\E[?8h\E[3g\E[>5g\E(B\E[m\E[20l\E[1;24r\E[24;1H, + kbs=\177, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=\EE, rc=\E8, + rev=\E[7m, ri=\EM, rin=\E[%p1%dT, rmir=\E[4l, rmso=\E[m, + rmul=\E[m, rs1=\Ec\E[?7h\E[>5g, sc=\E7, sgr0=\E[m, + smcup=\E[>5g\E[?7h\E[?5h, smir=\E[4h, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, u6=\E[%i%p1%d;%p2%dR, u7=\E[6n, + u8=\E[?6c, u9=\E[c, cit101e-n|CIT-101e w/o am, am@, cvvis=\E[?1l\E[?4l\E[?7l, kbs=^H, kcub1=^H, kcud1=^J, use=cit101e, -cit101e-132|CIT-101e, 132 cols, +cit101e-132|CIT-101e with 132 cols, cols#132, kbs=^H, kcub1=^H, kcud1=^J, use=cit101e, -cit101e-n132|CIT-101e, 132 cols w/o am, +cit101e-n132|CIT-101e with 132 cols w/o am, am@, cols#132, cvvis=\E[?1l\E[?4l\E[?7l, kbs=^H, kcub1=^H, kcud1=^J, use=cit101e, @@ -7633,7 +8295,7 @@ cdc721-esc|Control Data 721, cuf1=^X, cup=\002%p2%{32}%+%c%p1%{32}%+%c, cuu1=^W, dch1=^^N, dim=^\, dl1=^^Q, ed=^^P, el=^K, home=^Y, hts=^^^RW, ich1=^^O, il1=^^R, ind=\036W =\036U, invis=^^^R[, - is2=\036\022B\003\036\035\017\022\025\035\036E\036\022H\036\022J\036\022L\036\022N\036\022P\036\022Q\036\022\\\036\022\^\036\022b\036\022i\036W =\036\022Z\036\011C1-` `!k/o, + is2=\036\022B\003\036\035\017\022\025\035\036E\036\022H\036\022J\036\022L\036\022N\036\022P\036\022Q\036\022\036\022\^\036\022b\036\022i\036W =\036\022Z\036\011C1-` `!k/o, kbs=^H, kcub1=^H, kcud1=^Z, kcuf1=^X, kcuu1=^W, kf0=^^q, kf1=^^r, kf2=^^s, kf3=^^t, kf4=^^u, kf5=^^v, kf6=^^w, kf7=^^x, kf8=^^y, kf9=^^z, khome=^Y, ll=^B =, rev=^^D, @@ -7666,7 +8328,7 @@ cdc721-esc|Control Data 721, visa50|geveke visa 50 terminal in ansi 80 character mode, bw, mir, msgr, cols#80, lines#25, - acsc=0_aaffggjjkkllmmnnqqttuuvvwwxxh ooss, bel=^G, + acsc=0_aaffggh jjkkllmmnnooqqssttuuvvwwxx, bel=^G, blink=\E[5m, 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=\E[D, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, @@ -7744,7 +8406,7 @@ c108|concept108|c108-8p|concept108-8p|concept 108 w/8 pages, c108-4p|concept108-4p|concept 108 w/4 pages, eslok, hs, xon, pb@, - acsc=l\\qLkTxUmMjE, cnorm=\Ew, cr=^M, + acsc=jEkTl\\mMqLxU, cnorm=\Ew, cr=^M, cup=\Ea%p1%?%p1%{95}%>%t\001%{96}%-%;%{32}%+%c%p2%?%p2%{95}%>%t\001%{96}%-%;%{32}%+%c, cvvis=\EW, dch1=\E 1$<16*>, dsl=\E ;\177, fsl=\Ee\E z\s, ind=^J, is1=\EK\E!\E F, @@ -7811,13 +8473,13 @@ c100|concept100|concept|c104|c100-4p|hds concept 100, ed=\E\005$<16*>, el=\E\025$<16>, flash=\Ek$<200>\EK, ht=\011$<8>, il1=\E\022$<3*>, ind=^J, invis=\EH, ip=$<16*>, is1=\EK, - is2=\EU\Ef\E7\E5\E8\El\ENH\E\200\Eo&\200\Eo'\E\Eo!\200\E\007!\E\010A@ \E4#\:"\E\:a\E4#;"\E\:b\E4#<"\E\:c, + is2=\EU\Ef\E7\E5\E8\El\ENH\E\0\Eo&\0\Eo'\E\Eo!\0\E\007!\E\010A@ \E4#\:"\E\:a\E4#;"\E\:b\E4#<"\E\:c, is3=\Ev $<6>\Ep\n, kbs=^H, kcbt=\E', kctab=\E_, kcub1=\E>, kcud1=\E<, kcuf1=\E=, kcuu1=\E;, kdch1=\E^Q, kdl1=\E^B, ked=\E^C, kel=\E^S, kf1=\E5, kf2=\E6, kf3=\E7, kf4=\E8, kf5=\E9, kf6=\E\:a, kf7=\E\:b, kf8=\E\:c, khome=\E?, khts=\E], kich1=\E^P, kil1=\E^R, kind=\E[, knp=\E-, kpp=\E., - kri=\E\\, krmir=\E\200, mc4=\036o \E\EQ!\EYP\027, + kri=\E\\, krmir=\E\0, mc4=\036o \E\EQ!\EYP\027, mc5=\EQ"\EY(\027\EYD\Eo \036, prot=\EI, rep=\Er%p1%c%p2%{32}%+%c$<.2*>, rev=\ED, rmcup=\Ev $<6>\Ep\r\n, rmir=\E\s\s, rmkx=\Ex, @@ -7832,6 +8494,283 @@ oc100|oconcept|c100-1p|old 1 page concept 100, in, is3@, use=c100, +# From: Walter Skorski , 16-oct-1996. +# Lots of notes, originally inline, but ncurses doesn't grok that. +# +# am: not available in power on mode, but turned on with \E[=107;207h in +# is2=. Also, \E=124l in is2= could have been used to prevent needing +# to specify xenl:, but that would have rendered the last space on the +# last line useless. +# bw: Not available in power on mode, but turned on with \E[=107;207h in +# is2=. +# clear: Could be done with \E[2J alone, except that vi (and probably most +# other programs) assume that this also homes the cursor. +# dsl: Go to window 2, go to the beginning of the line, use a line feed to +# scroll the window, and go back to window 1. +# is2: the string may cause a warning to be issued by tic that it +# found a very long line and that it suspects that a comma is missing +# somewhere. This warning can be ignored (unless it comes up more than +# once). The initialization string contains the following commands: +# +# [Setup mode items changed from factory defaults:] +# \E)0 set alternate character set to +# graphics +# ^O set character set to default +# [In case it wasn't] +# \E[m turn off all attributes +# [In case they weren't off] +# \E[=107; cursor wrap and +# 207h character wrap on +# \E[90;3u set Fkey definitions to "transmit" +# defaults +# \E[92;3u set cursor key definitions to +# "transmit" defaults +# \E[43;1u set shift F13 to transmit... +# \177\E$P\177 +# \E[44;1u set shift F14 to transmit... +# \177\E$Q\177 +# \E[45;1u set shift F15 to transmit... +# \177\E$R\177 +# \E[46;1u set shift F16 to transmit... +# \177\E$S\177 +# \E[200;1u set shift up to transmit... +# \177\E$A\177 +# \E[201;1u set shift down to transmit... +# \177\E$B\177 +# \E[202;1u set shift right to transmit... +# \177\E$C\177 +# \E[203;1u set shift left to transmit... +# \177\E$D\177 +# \E[204;1u set shift home to transmit... +# \177\E$H\177 +# \E[212;1u set backtab to transmit... +# \177\E$I\177 +# \E[213;1u set shift backspace to transmit... +# \177\E$^H\177 +# \E[214;1u set shift del to transmit... +# "\E$\177" +# [Necessary items not mentioned in setup mode:] +# \E[2!w move to window 2 +# \E[25;25w define window as line 25 of memory +# \E[!w move to window 1 +# \E[2*w show current line of window 2 as +# status line +# \E[2+x set meta key to use high bit +# \E[;3+} move underline to bottom of character +# +# All Fkeys are set to their default transmit definitions with \E[90;3u +# in is2=. IMPORTANT: to use this terminal definition, the "quit" stty +# setting MUST be redefined or deactivated, because the default is +# contained in almost all of this terminal's Fkey strings! If for some +# reason "quit" cannot be altered, the Fkeys can, but it would be +# necessary to change ^| to ^] in all of these definitions, and add +# \E[2;029!t to is2. +# lines: is set to 24 because this terminal refuses to treat the 25th +# line normally. +# ll: Not available in power on mode, but turned on with \E[=107;207h in +# is2=. +# lm: Pointless, given that this definition locks a single screen of +# memory into view, but what the hey... +# rmso: Could use \E[1;7!{ to turn off only bold and reverse (leaving any +# other attributes alone), but some programs expect this to turn off +# everything. +# rmul: Could use \E[4!{ to turn off only underline (leaving any other +# attributes alone), but some programs expect this to turn off +# everything. +# sgr: Attributes are set on this terminal with the string \E[ followed by +# a list of attribute code numbers (in decimal, separated by +# semicolons), followed by the character m. The attribute code +# numbers are: +# 1 for bold; +# 2 for dim (which is ignored in power on mode); +# 4 for underline; +# 5 for blinking; +# 7 for inverse; +# 8 for not displayable; and +# =99 for protected (except that there are strange side +# effects to protected characters which make them inadvisable). +# The mapping of terminfo parameters to attributes is as follows: +# %p1 (standout) = bold and inverse together; +# %p2 (underline) = underline; +# %p3 (reverse) = inverse; +# %p4 (blink) = blinking; +# %p5 (dim) is ignored; +# %p6 (bold) = bold; +# %p7 (invisible) = not displayable; +# %p8 (protected) is ignored; and +# %p9 (alt char set) = alt char set. +# The code to do this is: +# \E[0 OUTPUT \E[0 +# %?%p1%p6%O IF (standout; bold) OR +# %t;1 THEN OUTPUT ;1 +# %; ENDIF +# %?%p2 IF underline +# %t;4 THEN OUTPUT ;4 +# %; ENDIF +# %?%p4 IF blink +# %t;5 THEN OUTPUT ;5 +# %; ENDIF +# %?%p1%p3%O IF (standout; reverse) OR +# %t;7 THEN OUTPUT ;7 +# %; ENDIF +# %?%p7 IF invisible +# %t;8 THEN OUTPUT ;8 +# %; ENDIF +# m OUTPUT m +# %?%p9 IF altcharset +# %t^N THEN OUTPUT ^N +# %e^O ELSE OUTPUT ^O +# %; ENDIF +# sgr0: Everything is turned off (including alternate character set), since +# there is no way of knowing what it is that the program wants turned +# off. +# smul: The "underline" attribute is reconfigurable to an overline or +# strikethru, or (as done with \E[;3+} in is2=), to a line at the true +# bottom of the character cell. This was done to allow for more readable +# underlined characters, and to be able to distinguish between an +# underlined space, an underscore, and an underlined underscore. +# xenl: Terminal can be configured to not need this, but this "glitch" +# behavior is actually preferable with autowrap terminals. +# +# Parameters kf31= thru kf53= actually contain the strings sent by the shifted +# Fkeys. There are no parameters for shifted Fkeys in terminfo. The is2 +# string modifies the 'O' in kf43 to kf46 to a '$'. +# +# kcbt was originally ^I but redefined in is2=. +# kHOM was \E[H originally but redefined in is2=, as were a number of +# other keys. +# kDC was originally \177 but redefined in is2=. +# +# kbs: Shift was also ^H originally but redefined as \E$^H in is2=. +# tsl: Go to window 2, then do an hpa=. +# +#------- flash=\E[8;3!}^G\E[3;3!} +#------- flash=\E[?5h$<100>\E[?5l +# There are two ways to flash the screen, both of which have their drawbacks. +# The first is to set the bell mode to video, transmit a bell character, and +# set the bell mode back - but to what? There is no way of knowing what the +# user's old bell setting was before we messed with it. Worse, the command to +# set the bell mode also sets the key click volume, and there is no way to say +# "leave that alone", or to know what it's set to, either. +# The second way to do a flash is to set the screen to inverse video, pad for a +# tenth of a second, and set it back - but like before, there's no way to know +# that the screen wasn't ALREADY in inverse video, or that the user may prefer +# it that way. The point is moot anyway, since vi (and probably other +# programs) assume that by defining flash=, you want the computer to use it +# INSTEAD of bel=, rather than as a secondary type of signal. +# +#------- cvvis=\E[+{ +# The is the power on setting, which is also as visible as the cursor +# gets. +#------- wind=\E[%i%p1%d;%p2%d;%p3%{1}%+%d;%p4%{1}%+%dw +# Windowing is possible, but not defined here because it is also used to +# emulate status line functions. Allowing a program to set a window could +# clobber the status line or render it unusable. There is additional memory, +# but screen scroll functions are destructive and do not make use of it. +# +#------- dim= Not available in power on mode. +# You have a choice of defining low intensity characters as "half bright" and +# high intensity as "normal", or defining low as "normal" and high as "bold". +# No matter which you choose, only one of either "half bright" or "bold" is +# available at any time, so taking the time to override the default is +# pointless. +# +#------- prot=\E[=0;99m +# Not defined, because it appears to have some strange side effects. +#------- pfkey=%?%p1%{24}%<%p1%{30}%>%p1%{54}%<%A%O%t\E[%p1%du\177%p2%s\177%; +#------- pfloc=%?%p1%{24}%<%p1%{30}%>%p1%{54}%<%A%O%t\E[%p1%du\177%p2%s\177%; +#------- pfx=%?%p1%{24}%<%p1%{30}%>%p1%{54}%<%A%O%t\E[%p1%d;1u\177%p2%s\177%; +# Available, but making them available to programs is inadvisable. +# The code to do this is: +# %?%p1%{24}%< IF ((key; 24) <; +# %p1%{30}%> ((key; 30) >; +# %p1%{54}%< (key; 54) < +# %A ) AND +# %O ) OR +# [that is, "IF key < 24 OR (key > 30 AND key < 54)",] +# %t\E[ THEN OUTPUT \E[ +# %p1%d OUTPUT (key) as decimal +# [next line applies to pfx only] +# ;1 OUTPUT ;1 +# u OUTPUT u +# \177 OUTPUT \177 +# %p2%s OUTPUT (string) as string +# \177 OUTPUT \177 +# [DEL chosen as delimiter, but could be any character] +# [implied: ELSE do nothing] +# %; ENDIF +# +#------- rs2= +# Not defined since anything it might do could be done faster and easier with +# either Meta-Shift-Reset or the main power switch. +# +#------- smkx=\E[1!z +#------- rmkx=\E[!z +# These sequences apply to the cursor and setup keys only, not to the +# numeric keypad. But it doesn't matter anyway, since making these +# available to programs is inadvisable. +# For the key definitions below, all sequences beginning with \E$ are +# custom and programmed into the terminal via is2. \E$ also has no +# meaning to any other terminal. +# +#------- cmdch=\E[;%p1%d!t +# Available, but making it available to programs is inadvisable. +#------- smxon=\E[1*q +# Available, but making it available to programs is inadvisable. +# Terminal will send XON/XOFF on buffer overflow. +#------- rmxon=\E[*q +# Available, but making it available to programs is inadvisable. +# Terminal will not notify on buffer overflow. +#------- smm=\E[2+x +#------- rmm=\E[+x +# Available, but making them available to programs is inadvisable. +# +# Printing: +# It's not made clear in the manuals, but based on other ansi/vt type +# terminals, it's a good guess that this terminal is capable of both +# "transparent print" (which doesn't copy data to the screen, and +# therefore needs mc5i: specified to say so) and "auxilliary print" +# (which does duplicate printed data on the screen, in which case mc4= +# and mc5= should use the \E[?4i and \E[?5i strings instead). + +hds200|Human Designed Systems HDS200, + am, bw, eslok, hs, km, mc5i, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, lm#0, + acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, + blink=\E[0;5m, bold=\E[0;1m, cbt=\E[Z, civis=\E[6+{, + clear=\E[H\E[J, cnorm=\E[+{, cr=^M, + 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, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + dsl=\E[2!w\r\n\E[!w, ed=\E[J, el=\E[K, el1=\E[1K, + fsl=\E[!w, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, + ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, + invis=\E[0;8m, + is2=\E)0\017\E[m\E[=107;207h\E[90;3u\E[92;3u\E[43;1u\177\E$P\177\E[44;1u\177\E$Q\177\E[45;1u\177\E$R\177\E[46;1u\177\E$S\177\E[200;1u\177\E$A\177\E[201;1u\177\E$B\177\E[202;1u\177\E$C\177\E[203;1u\177\E$D\177\E[204;1u\177\E$H\177\E[212;1u\177\E$I\177\E[213;1u\177\E$\010\177\E[214;1u"\E$\177"\E[2!w\E[25;25w\E[!w\E[2*w\E[2+x\E[;3+}, + kDC=\E$\177, kHOM=\E$H, kLFT=\E$D, kRIT=\E$C, kbs=^H, + kcbt=\E$I, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\177, kent=^M, kf1=^\001\r, kf10=^\010\r, + kf11=^\011\r, kf12=^\012\r, kf13=\EOP, kf14=\EOQ, + kf15=\EOR, kf16=\EOS, kf17=^\017\r, kf18=^\018\r, + kf19=^\019\r, kf2=^\002\r, kf20=^\020\r, kf21=^\021\r, + kf22=^\022\r, kf23=^\023\r, kf3=^\003\r, kf31=^\031\r, + kf32=^\032\r, kf33=^\033\r, kf34=^\034\r, kf35=^\035\r, + kf36=^\036\r, kf37=^\037\r, kf38=^\038\r, kf39=^\039\r, + kf4=^\004\r, kf40=^\040\r, kf41=^\041\r, kf42=^\042\r, + kf43=\E$P, kf44=\E$Q, kf45=\E$R, kf46=\E$S, kf47=^\047\r, + kf48=^\048\r, kf49=^\049\r, kf5=^\005\r, kf50=^\050\r, + kf51=^\051\r, kf52=^\052\r, kf53=^\053\r, kf6=^\006\r, + kf7=^\007\r, kf8=^\008\r, kf9=^\009\r, khome=\E[H, + kind=\E[T, knp=\E[U, kpp=\E[V, kri=\E[S, ll=\E[H\E[A, + mc0=\E[i, mc4=\E[4i, mc5=\E[5i, nel=\E[E, rc=\E8, + rev=\E[0;7m, ri=\EM, rmacs=^O, rmir=\E[4l, rmso=\E[m\017, + rmul=\E[m\017, sc=\E7, + sgr=\E[0%?%p1%p6%O%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%O%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smir=\E[4h, smso=\E[0;1;7m, + smul=\E[0;4m, tbc=\E[3g, tsl=\E[2!w\E[%i%p1%dG, + vpa=\E[%i%p1%dd, + # through included to specify padding needed in raw mode. # (avt-ns: added empty to suppress a tic warning --esr) avt-ns|concept avt no status line, @@ -7913,10 +8852,10 @@ contel300|contel320|c300|Contel Business Systems C-300 or C-320, hts=\E1, ich1=\EN, il1=\EL$<5.5*>, ind=^J, ip=$<5.5*>, kbs=^H, kf0=\ERJ, kf1=\ERA, kf2=\ERB, kf3=\ERC, kf4=\ERD, kf5=\ERE, kf6=\ERF, kf7=\ERG, kf8=\ERH, kf9=\ERI, ll=\EH\EA, - rmso=\E!\200, sgr0=\E!\200, smso=\E!\r, tbc=\E3, + rmso=\E!\0, sgr0=\E!\0, smso=\E!\r, tbc=\E3, # Contel c301 and c321 terminals. contel301|contel321|c301|c321|Contel Business Systems C-301 or C-321, - flash@, ich1@, ip@, rmso=\E!\200$<20>, smso=\E!\r$<20>, + flash@, ich1@, ip@, rmso=\E!\0$<20>, smso=\E!\r$<20>, use=contel300, #### Data General (dg) @@ -7954,7 +8893,7 @@ dg210|dg-ansi|Data General 210/211, dg211|Data General d211, cnorm=^L, cvvis=^L^R, ht=^I, ind@, kbs=^Y, kf0@, kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, kf9@, lf0@, nel=^M^Z, rmcup=^L, - rmso=\036E$<\200/>, smcup=^L^R, smso=\036D$<5/>, + rmso=\036E$<\0/>, smcup=^L^R, smso=\036D$<5/>, use=dg200, # dg450 from cornell dg450|dg6134|data general 6134, @@ -7995,9 +8934,8 @@ dg6053|dg100|data general 6053, cup=\020%p2%c%p1%c, cuu1=^W, cvvis=^L^R, el=^K, home=^H, ht=^I, is2=^R, kbs=^Y, kcub1=^Y, kcud1=^Z, kcuf1=^X, kcuu1=^W, kf0=^^q, kf1=^^r, kf2=^^s, kf3=^^t, kf4=^^u, kf5=^^v, kf6=^^w, - kf7=^^x, kf8=^^y, kf9=^^z, khome=^H, rmcup=^L, rmso=\200^^E, - rmul=^U, smcup=^L^R, smso=\200\200\200\200\200\036D, - smul=^T, + kf7=^^x, kf8=^^y, kf9=^^z, khome=^H, rmcup=^L, rmso=\0^^E, + rmul=^U, smcup=^L^R, smso=\0\0\0\0\0\036D, smul=^T, #### Datamedia (dm) # @@ -8041,6 +8979,8 @@ dm1520|dm1521|datamedia 1520, cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], home=^Y, ht=^I, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^\, kcuu1=^_, khome=^Y, +# dm2500: this terminal has both and . Applications using +# termcap/terminfo directly (rather than through ncurses) might be confused. dm2500|datamedia2500|datamedia 2500, cols#80, lines#24, bel=^G, clear=^^^^\177, cub1=^H, cud1=^J, cuf1=^\, @@ -8493,10 +9433,10 @@ superbee-xsb|beehive super bee, cuf1=\EC, cup=\EF%p2%3d%p1%3d, cuu1=\EA$<3>, dch1=\EP$<3>, dl1=\EM$<100>, ed=\EJ$<3>, el=\EK$<3>, home=\EH, ht=^I, hts=\E1, - ind=\n\200\200\200\n\200\200\200\EA\EK\200\200\200\ET\ET, - is2=\EH\EJ, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, - kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, - kf8=\Ew, khome=\EH, rmso=\E_3, sgr0=\E_3, smso=\E_1, tbc=\E3, + ind=\n\0\0\0\n\0\0\0\EA\EK\0\0\0\ET\ET, is2=\EH\EJ, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kf1=\Ep, kf2=\Eq, + kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, + khome=\EH, rmso=\E_3, sgr0=\E_3, smso=\E_1, tbc=\E3, # This loses on lines > 80 chars long, use at your own risk superbeeic|super bee with insert char, ich1=, rmir=\ER, smir=\EQ, use=superbee-xsb, @@ -8739,7 +9679,7 @@ ibm3151|i3151|IBM 3151, ibm3161|ibm3163|wy60-316X|wyse60-316X|IBM 3161/3163 display, am, mir, msgr, cols#80, it#8, lines#24, - acsc=l\354q\361k\353x\370j\352m\355w\367u\365v\366t\364n\356, + acsc=j\352k\353l\354m\355n\356q\361t\364u\365v\366w\367x\370, bel=^G, blink=\E4D, bold=\E4H, clear=\EH\EJ, cr=^M, cub1=\ED, cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EQ, dl1=\EO, ed=\EJ, el=\EI, home=\EH, ind=^J, @@ -8753,7 +9693,7 @@ ibm3161|ibm3163|wy60-316X|wyse60-316X|IBM 3161/3163 display, kf4=\Ed\r, kf5=\Ee\r, kf6=\Ef\r, kf7=\Eg\r, kf8=\Eh\r, kf9=\Ei\r, khome=\EH, khts=\E0, kich1=\EP \010, kil1=\EN, ktbc=\E 1, rev=\E4A, rmcup=\E>A, rmso=\E4@, rmul=\E4@, - sgr=\E4%'@'%?%p1%t%'A'%|%;\n%?%p2%t%'B'%|%;\n%?%p3%t%'A'%|%;\n%?%p4%t%'D'%|%;\n%?%p5%t%'@'%|%;\n%?%p6%t%'H'%|%;\n%?%p7%t%'P'%|%;%c\n%?%p9%t\E>A%e\E<@%;, + sgr=\E4%'@'%?%p1%t%'A'%|%;%?%p2%t%'B'%|%;%?%p3%t%'A'%|%;%?%p4%t%'D'%|%;%?%p5%t%'@'%|%;%?%p6%t%'H'%|%;%?%p7%t%'P'%|%;%c%?%p9%t\E>A%e\E<@%;, sgr0=\E4@\E<@, smcup=\E>A, smso=\E4A, smul=\E4B, # How the 3164 sgr string works: @@ -8789,15 +9729,16 @@ ibmmono|ibm5151|IBM workstation monochrome, bold=\EZ, dl1=\EM, dsl=\Ej\EY8 \EI\Ek, fsl=\Ek, il1=\EL, invis=\EF\Ef0;\Eb0;, kbs=^H, kf0=\E<, kf1=\ES, kf2=\ET, kf3=\EU, kf4=\EV, kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, kf9=\EY, - khome=\EH, kich1=\200, kind=\EE, knp=\EE, kpp=\Eg, kri=\EG, + khome=\EH, kich1=\0, kind=\EE, knp=\EE, kpp=\Eg, kri=\EG, lf0=f10, rev=\Ep, ri=\EA, rmso=\Ez, rmul=\Ew, sgr0=\Ew\Eq\Ez\EB, smso=\EZ, smul=\EW, tsl=\Ej\EY8%+ \Eo, use=ibm3101, ibmega|ibm5154|IBM Enhanced Color Display, cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, use=ibmmono, -ibmega-c|ibm5154-c|IBM Enhanced Color Display, - rmso=\EB, rmul=\EB, smso=\EF\Ef3;, smul=\EF\Ef2;, use=ibmmono, +ibmega-c|ibm5154-c|IBM Enhanced Color Display with standout and underline, + rmso=\EB, rmul=\EB, smso=\EF\Ef3;, smul=\EF\Ef2;, + use=ibmmono, ibmvga-c|IBM VGA display color termcap, cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, @@ -8876,7 +9817,7 @@ ibm8514|IBM 8514 color display, cr=^M, cud1=^J, dsl=\Ej\EYI \EI\Ek, fsl=\Ek, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, tsl=\Ej\EYI%+ \Eo, use=ibmega, -ibm8514-c|IBM 8514 color display, +ibm8514-c|IBM 8514 color display with standout and underline, eslok, hs, lines#41, cr=^M, cud1=^J, dsl=\Ej\EYI \EI\Ek, fsl=\Ek, ht=^I, ind=^J, @@ -8890,12 +9831,12 @@ ibm8514-c|IBM 8514 color display, # aixterm-m|IBM AIXterm Monochrome Terminal Emulator, eslok, hs, - acsc=llqqkkxxjjmmwwuuvvttnn, bold=\E[1m, dsl=\E[?E, + acsc=jjkkllmmnnqqttuuvvwwxx, bold=\E[1m, dsl=\E[?E, fsl=\E[?F, ri@, s0ds=\E(B, s1ds=\E(0, sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, sgr0=\E[0;10m\E(B, tsl=\E[?%p1%dT, use=ibm6153, -aixterm-m-old|IBM AIXterm Monochrome Terminal Emulator, +aixterm-m-old|old IBM AIXterm Monochrome Terminal Emulator, eslok, hs, bold=\E[1m, dsl=\E[?E, fsl=\E[?F, ri@, sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, @@ -9057,7 +9998,7 @@ kt7|kimtron model kt-7, kt7ix|kimtron model kt-7 or 70 in IX mode, am, bw, cols#80, it#8, lines#25, - acsc=lZm@k?jYt4uCvAwBqDx3nE, bel=^G, blink=\EG2, cbt=\EI, + acsc=jYk?lZm@nEqDt4uCvAwBx3, bel=^G, blink=\EG2, cbt=\EI, civis=\E.0, clear=\E*, cnorm=\E.3, cr=^M, cub1=^H, cud1=^V, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, dim=\EG@, dl1=\ER, dsl=\Ef\r, ed=\EY, el=\ET, fsl=^M, @@ -9166,7 +10107,7 @@ prism4|p4|P4|MDC Prism-4, cnorm=^]\342, cr=^M, cub1=^H, cud1=^J, cuf1=^F, cup=\013%p1%' '%+%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, cuu1=^Z, dim=^CA, dsl=\035\343\035\345, ed=\EJ, el=\EK, - fsl=^]\345, home=^A^J, + fsl=^]\345, home=^A, hpa=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, ind=^J, invis=^CH, kbs=^H, khome=^A, mc0=\EU, mc4=\ET, mc5=\ER, rev=^CD, rmso=^C\s, rmul=^C\s, @@ -9379,7 +10320,7 @@ p8gl|prism8gl|McDonnell-Douglas Prism-8 alternate definition, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^A, lf1=F1, lf10=F10, lf2=F2, lf3=F3, lf4=F4, lf5=F5, lf6=F6, lf7=F7, lf8=F8, lf9=F9, nel=^J^M, - pad=\200, rev=^CD, rmso=^C\s, rmul=^C\s, sgr0=^C\s, smso=^CE, + pad=\0, rev=^CD, rmso=^C\s, rmul=^C\s, sgr0=^C\s, smso=^CE, smul=^C0, #### Microterm (act, mime) @@ -9627,7 +10568,7 @@ owl|pe1200|perkin elmer 1200, hts=\E1, ich1=\EN, il1=\EL$<5.5*>, ind=^J, ip=$<5.5*>, kbs=^H, kf0=\ERJ, kf1=\ERA, kf2=\ERB, kf3=\ERC, kf4=\ERD, kf5=\ERE, kf6=\ERF, kf7=\ERG, kf8=\ERH, kf9=\ERI, ll=\EH\EA, - rmso=\E!\200, sgr0=\E!\200, smso=\E!^H, tbc=\E3, + rmso=\E!\0, sgr0=\E!\0, smso=\E!^H, tbc=\E3, pe1251|pe6300|pe6312|perkin elmer 1251, am, cols#80, it#8, lines#24, pb#300, vt#8, xmc#1, @@ -9645,14 +10586,14 @@ pe7000m|perkin elmer 7000 series monochrome monitor, bel=^G, cbt=\E!Y, clear=\EK, cr=^M, cub1=\ED, cud1=\EB, cuf1=\EC, cup=\ES%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, el=\EI, home=\EH, ind=^J, - is1=\E!\200\EW 7o\Egf\ES7\s, kbs=^H, kcub1=\E!V, - kcud1=\E!U, kcuf1=\E!W, kcuu1=\E!T, kf0=\E!\200, kf1=\E!^A, + is1=\E!\0\EW 7o\Egf\ES7\s, kbs=^H, kcub1=\E!V, + kcud1=\E!U, kcuf1=\E!W, kcuu1=\E!T, kf0=\E!\0, kf1=\E!^A, kf10=\E!^J, kf2=\E!^B, kf3=\E!^C, kf4=\E!^D, kf5=\E!^E, kf6=\E!^F, kf7=\E!^G, kf8=\E!^H, kf9=\E!^I, khome=\E!S, ll=\ES7\s, ri=\ER, pe7000c|perkin elmer 7000 series colour monitor, - is1=\E!\200\EW 7o\Egf\Eb0\Ec7\ES7\s, rmso=\Eb0, - rmul=\E!\200, smso=\Eb2, smul=\E!\s, + is1=\E!\0\EW 7o\Egf\Eb0\Ec7\ES7\s, rmso=\Eb0, + rmul=\E!\0, smso=\Eb2, smul=\E!\s, use=pe7000m, #### Sperry Univac @@ -9727,7 +10668,7 @@ dmterm|deskmate terminal, dt100|dt-100|Tandy DT-100 terminal, xon, cols#80, lines#24, xmc#1, - acsc=kkllmmjjnnwwvvttuuqqxx, bel=^G, civis=\E[?25l, + acsc=jjkkllmmnnqqttuuvvwwxx, bel=^G, civis=\E[?25l, clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, csr=\E[%p1%2d;%p2%2dr, cub1=^H, cud1=\E[B, cuf1=\E[C, cup=\010\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, @@ -9744,7 +10685,7 @@ dt100w|dt-100w|Tandy DT-100 terminal (wide mode), dt110|Tandy DT-110 emulating ansi, xon, cols#80, lines#24, - acsc=kkllmmjjnnwwvvuuttqqxx, bel=^G, civis=\E[?25l, + acsc=jjkkllmmnnqqttuuvvwwxx, bel=^G, civis=\E[?25l, clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[0B, cuf1=\E[C, cup=\010\E[%i%p1%d;%p2%dH, cuu1=\E[0A, dch1=\E[0P, @@ -9998,7 +10939,7 @@ tek4105a|Tektronix 4105, # and factory color maps. After setting these modes, save them with NVSAVE. No # delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! # "IC" cannot be used in combination with "im" & "ei". -tek4106brl|tek4107brl|tek4109brl|Tektronix 4106, 4107, or 4109, +tek4106brl|tek4107brl|tek4109brl|Tektronix 4106 4107 or 4109, msgr, xon, cols#80, it#8, lines#32, vt#3, acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, @@ -10220,16 +11161,16 @@ tek4205|tektronix 4205, dch1=\E[1P, dim=\E[=1;<6m, dl1=\E[1M, ech=\E%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, home=\E[H, ht=^I, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[1L, ind=\ED, - initc=\E%%!0\n\ETF4\n%?%p1%{0}%=%t0\n%e%p1%{1}%=%t4\n%e%p1%{2}%=%t3\n%e%p1%{3}%=%t5\n%e%p1%{4}%=%t2\n%e%p1%{5}%=%t6\n%e%p1%{6}%=%t7\n%e1%;\n%?%p2%{125}%<%t0\n%e%p2%{250}%<%tA2\n%e%p2%{375}%<%tA?\n%e%p2%{500}%<%tC8\n%e%p2%{625}%<%tD4\n%e%p2%{750}%<%tE1\n%e%p2%{875}%<%tE\:\n%eF4%;\n%?%p3%{125}%<%t0\n%e%p3%{250}%<%tA2\n%e%p3%{375}%<%tA?\n%e%p3%{500}%<%tC8\n%e%p3%{625}%<%tD4\n%e%p3%{750}%<%tE1\n%e%p3%{875}%<%tE\:\n%eF4%;\n%?%p4%{125}%<%t0\n%e%p4%{250}%<%tA2\n%e%p4%{375}%<%tA?\n%e%p4%{500}%<%tC8\n%e%p4%{625}%<%tD4\n%e%p4%{750}%<%tE1\n%e%p4%{875}%<%tE\:\n%eF4%;\n\E%%!1, + initc=\E%%!0\ETF4%?%p1%{0}%=%t0%e%p1%{1}%=%t4%e%p1%{2}%=%t3%e%p1%{3}%=%t5%e%p1%{4}%=%t2%e%p1%{5}%=%t6%e%p1%{6}%=%t7%e1%;%?%p2%{125}%<%t0%e%p2%{250}%<%tA2%e%p2%{375}%<%tA?%e%p2%{500}%<%tC8%e%p2%{625}%<%tD4%e%p2%{750}%<%tE1%e%p2%{875}%<%tE\:%eF4%;%?%p3%{125}%<%t0%e%p3%{250}%<%tA2%e%p3%{375}%<%tA?%e%p3%{500}%<%tC8%e%p3%{625}%<%tD4%e%p3%{750}%<%tE1%e%p3%{875}%<%tE\:%eF4%;%?%p4%{125}%<%t0%e%p4%{250}%<%tA2%e%p4%{375}%<%tA?%e%p4%{500}%<%tC8%e%p4%{625}%<%tD4%e%p4%{750}%<%tE1%e%p4%{875}%<%tE\:%eF4%;\E%%!1, invis=\E[=6;<5, is1=\E%!0\ETM1\E%!1\E[m, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\EOA, kf1=\EOB, kf2=\EOC, kf3=\EOD, kf4=\EP, kf5=\EQ, kf6=\ER, kf7=\ES, - oc=\E%!0\n\ETFB0\n0000\n1F4F4F4\n2F400\n30F40\n4A4C, cuu1=^I, dl1=^_1, ed=^K, el=^D, home=^A, il1=^_0, kcub1=^H, kcud1=^J, kcuf1=^I, kcuu1=^L, rev=^_\s, rmso=^_!, rmul=^_#, - sgr0=\037!\E\:\200, smso=^_\s, smul=^_", + sgr0=\037!\E\:\0, smso=^_\s, smul=^_", # (trs2: removed obsolete ":nl=^_:" -- esr) trs2|trsII|trs80II|Radio Shack Model II using P&T CP/M, am, msgr, @@ -10628,7 +11569,7 @@ trs2|trsII|trs80II|Radio Shack Model II using P&T CP/M, trs16|trs-80 model 16 console, am, cols#80, it#8, lines#24, - acsc=l_mbk`javewcquxs, bel=^G, civis=\ERc, clear=^L, + acsc=jak`l_mbquvewcxs, bel=^G, civis=\ERc, clear=^L, cnorm=\ERC, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EQ, dl1=\EM, ed=\EJ, el=\EK, home=\EH, ht=^I, ich1=\EP, il1=\EL, @@ -10699,7 +11640,7 @@ st52|Atari ST with VT52 emulation, # :k0=\E9~: map F10 to k0 - could have F0-9 -> k0-9, but ... F10 was 'k;' # (amiga: removed obsolete :kn#10:, # also added empty to suppress a warning --esr) -amiga-old|Amiga ANSI, +amiga|Amiga ANSI, am, bw, xenl, cols#80, lines#24, acsc=, bel=^G, blink=\E[7;2m, bold=\E[1m, cbt=\E[Z, @@ -10717,8 +11658,10 @@ amiga-old|Amiga ANSI, smso=\E[7m, smul=\E[4m, # From: Hans Verkuil , 4 Dec 1995 -# (amiga: added empty to suppress a warning --esr) -amiga|Amiga ANSI, +# (amiga: added empty to suppress a warning. +# I'm told this entry screws up badly with AS225, the Amiga +# TCP/IP package once from Commodore, and now sold by InterWorks.--esr) +amiga-h|Hans Verkuil's Amiga ANSI, bw, msgr, cols#80, lines#24, acsc=, bel=^G, blink=\2337;2m, bold=\2331m, cbt=\233Z, @@ -10843,9 +11786,11 @@ minix|minix console (v1.7), kf5=\E[G, khome=\E[H, lf0=End, lf1=PgUp, lf2=PgDn, lf3=Num +, lf4=Num -, lf5=Num 5, nel=^M^J, rev=\E[7m, ri=\EM, rmso=\E[0m, rmul=\E[0m, sgr0=\E[0m, smso=\E[7m, smul=\E[4m, +# Corrected Jan 14, 1997 by Vincent Broman minix-old|minix console (v1.5), + xon, cols#80, it#8, lines#25, - blink=\E[5m, bold=\E[1m, clear=\E[H\E[0J, cr=^M, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[0J, cr=^M, 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, dch=\E[%p1%dP, dch1=\E[P, @@ -10855,6 +11800,10 @@ minix-old|minix console (v1.5), kf0=\E[Y, kf1=\E[V, kf2=\E[U, kf3=\E[T, kf4=\E[S, kf5=\E[G, khome=\E[H, nel=^M^J, rev=\E[7m, ri=\EM, rmso=\E[0m, rmul=\E[0m, sgr0=\E[0m, smso=\E[7m, smul=\E[4m, +# The linewrap option can be specified by editing /usr/include/minix/config.h +# before recompiling the minix 1.5 kernel. +minix-old-am|minix console with linewrap, + am, use=minix-old, pc-minix|minix console on an Intel box, use=klone+acs, use=minix, @@ -10890,6 +11839,28 @@ pc-venix|venix|IBM PC console running Venix, # If you know anything more about any of these, please tell me. # +# The MAI Basic Four computer was obsolete at the end of the 1980s. +# It may be used as a terminal by putting it in "line" mode as seen on +# one of the status lines. +# Initialization is similar to CIT80. will set ANSI mode for you. +# Hardware tabs set by at 8-spacing. Auto line wrap causes glitches so +# wrap mode is reset by . Using =\E[S caused errors so I +# used \ED instead. +# From: bf347@lafn.org (David Lawyer), 28 Jun 1997 +mai|basic4|MAI Basic Four in ansi mode, + am, da, db, mir, msgr, + cols#82, it#8, lines#25, + bel=^G, blink=\E[5m, bold=\E[1m, clear=^]^_, cnorm=\E[?7h, + cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=^X, + cup=\E[%i%p1%d;%p2%dH, cuu1=^Z, cvvis=\E[?7l, dch1=\E[1P, + dl1=\E[M, ed=^_, el=^^, home=^], ht=^I, + if=/usr/lib/tabset/vt100, il1=\E[L, ind=\ED, + is2=\E>\E[?1h\E[?7h\E[?5l\017\E(B\E[m\E[20l\E[1;24r\E[24;1H, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, + kf7=\EOV, kf8=\EOW, nel=^M\ED, rc=\E8, rev=\E[7m, ri=\E[T, + rmir=\E[4l, rmso=\E[m, rmul=\E[m, sc=\E7, sgr0=\E[m, + smir=\E[4h, smso=\E[7m, smul=\E[4m, # basis from Peter Harrison, Computer Graphics Lab, San Francisco # ucbvax!ucsfmis!harrison ...uucp / ucbvax!ucsfmis!harrison@BERKELEY ...ARPA # (basis: removed obsolete ":ma=^K^P^R^L^L :nl=5000*^J:" -- esr) @@ -10916,20 +11887,36 @@ xerox820|x820|Xerox 820, #### Videotex and teletext # -# standard-issue France Telecom minitel terminal (made by Philips) -# (m2-nam: had unknown :zd=\E[1m:zb=\E[5m:zc=lkmjqxtuwvn:; also deleted -# unnecessary :ug#0:sg#0: and added to quiet tic. -- esr) -m2-nam|minitel|minitel-2|minitel-2-nam|France Telecom Minitel, - xenl, - cols#80, it#8, lines#24, - acsc=, clear=\E[H\E[J, cub1=^H, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, - ed=\E[J, el=\E[K, home=\E[H, ht=^I, il1=\E[L, ind=^J, ip=$<7/>, - is2=\E[1;24r\E[24;1H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, - kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, - khome=\E[H, ri=\EM, rmacs=\E(B, rmir=\E[4l, rmso=\E[m, - rmul=\E[m, sgr0=\E[m, smacs=\E(0, smir=\E[4h, smso=\E[7m, - smul=\E[4m, +# \E\:1} switch to te'le'informatique mode (ascii terminal/ISO 6429) +# \E[?3l 80 columns +# \E[?4l scrolling on +# \E[12h local echo off +# \Ec reset: G0 U.S. charset (to get #,@,{,},...), 80 cols, clear screen +# \E)0 G1 DEC set (line graphics) +# +# From: Igor Tamitegama , 18 Jan 1997 +m2-nam|minitel|minitel-2|minitel-2-nam|France Telecom Minitel 2 mode te'le'informatique, + eslok, hs, xenl, + cols#80, it#8, lines#24, wsl#72, xmc#0, + acsc=aaffggjjkkllmmnnooqqssttuuvvwwxx, bel=^G, + blink=\E[5m, bold=\E[1m, civis=\E[<1h, clear=\E[H\E[J, + cnorm=\E[<1l, cr=^M, 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, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, flash=^G, fsl=^J, + home=\E[H, ht=^I, il=\E[%p1%dL, il1=\E[L, ind=^J, indn=^J, + ip=$<7/>, is1=\E\:1}\Ec\E[?4l\E[12h, is2=\Ec\E[12h\E)0, + is3=\E[?3l kbs=\010, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kdl1=\E[M, kf0=\EOp, + kf1=\EOq, kf10=\EOp, kf2=\EOr, kf3=\EOs, kf4=\EOt, kf5=\EOu, + kf6=\EOv, kf7=\EOw, kf8=\EOx, kf9=\EOy, khome=\E[H, + kich1=\E[4h, kil1=\E[4l, knp=\EOn, kpp=\EOR, ll=\E[24;80H, + mc0=\E[i, nel=^M^J, rc=\E8, rev=\E[7m, ri=\EM, rin=\EM, + rmacs=^O, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, + rs1=\Ec\E[?4l\E[12h, rs2=\Ec\E)0, sc=\E7, sgr0=\E[m, + smacs=^N, smir=\E[4h, smso=\E[7m, smul=\E[4m, tsl=^_@A, + u6=\E[%i%d;%dR, u7=\E[6n, ######## OBSOLETE VDT TYPES # @@ -11005,6 +11992,18 @@ oblit|ojerq|first version of blit rom, # The parent company, best known as the architects of the Internet, is # still around. # +# Jeff DelPapa writes: +# The bitgraph was a large white box that contained a monochrome bitmap +# display, and a 68000 to run it. You could download code and run it on +# the cpu, it had 128kb (I think) of memory. I used one in the late +# 70's, sure beat a vt100. It had one strange feature tho -- it used +# the cpu to bitblt pixels to scroll, it took longer than the refresh +# rate, and looked like a rubber sheet stretching, then snapping +# upwards. It had everything the early mac had, except a floppy drive a +# small screen (it had a 17" crisp beauty) and a real OS. They (Bolt +# Beranek and Neuman) sold at most a few hundred of them to the real +# world. DOD may have bought more... +# # Entries for the BitGraph terminals. The problem # with scrolling in vi can only be fixed by getting BBN to put @@ -11070,7 +12069,7 @@ cg7900|chromatics|chromatics 7900, rmcup=\001W0\,40\,85\,48\,\014\001W0\,0\,85\,48\,\001M0\,40\,, rmso=\001C1\,\001c2\,, smcup=\001P0\001O1\001R1\001C4\,\001c0\,\014\001M0\,42\,WARNING DOUBLE ENTER ESCAPE and \025\001C1\,\001c2\,\001W0\,0\,79\,39\,, - smso=\001C4\,\001c7\,, uc=\001\001_\001\200, + smso=\001C4\,\001c7\,, uc=\001\001_\001\0, #### Computer Automation # @@ -11118,6 +12117,49 @@ dp3360|datapoint|datapoint 3360, bel=^G, clear=^]^_, cr=^M, cub1=^H, cud1=^J, cuf1=^X, cuu1=^Z, ed=^_, el=^^, home=^], ind=^J, +# From: Jan Willem Stumpel , 11 May 1997 +# The Datapoint 8242 Workstation was sold at least between 1985 +# and 1989. To make the terminal work with this entry, press +# CONTROL-INT-INT to take the terminal off-line, and type (opt). +# Set the options AUTO ROLL, ROLL DN, and ESC KBD on, and AUTO +# CR/LF off. Use control-shift-[] as escape key, control-I as tab, +# shift-F1 to shift-F5 as F6 to F10 (unshifted F1 to F5 are in +# fact unusable because the strings sent by the terminal conflict +# with other keys). +# The terminal is capable of displaying "box draw" characters. +# For each graphic character you must send 2 ESC's (\E\E) followed +# by a control character as follows: +# character meaning +# ========= ======= +# ctrl-E top tee +# ctrl-F right tee +# ctrl-G bottom tee +# ctrl-H left tee +# ctrl-I cross +# ctrl-J top left corner +# ctrl-K top right corner +# ctrl-L bottom left corner +# ctrl-M bottom right corner +# ctrl-N horizontal line +# ctrl-O vertical line +# Unfortunately this cannot be fitted into the termcap/terminfo +# description scheme. +dp8242|datapoint 8242, + msgr, + cols#80, lines#25, + bel=^G, civis=^Y, clear=\025\E\004\027\030, cnorm=^X, + cr=^M, cub1=^H, cud1=^J, + cup=\011%p2%'\0'%+%c%p1%'\0'%+%c, dl1=\E^Z, ed=^W, el=^V, + home=^U, ht=^I, il1=\E^T, ind=^C, + is1=\E\014\E\016\0\230\0\317\025\027\030\E\004, + kbs=^H, kcub1=^D, kcud1=^B, kcuf1=^F, kcuu1=^E, kf1=^G\Ee, + kf10=\EK\Ea, kf2=^I\Ed, kf3=^J\Ec, kf4=^J\Eb, kf5=^S\Ea, + kf6=\EO\Ee, kf7=\EN\Ed, kf8=\EM\Ec, kf9=\EL\Eb, nel=^M^J, + rep=\E\023%p1%c%p2%c, ri=^K, rmso=\E^D, rmul=\E^D, + rs1=\E\014\E\016\0\230\0\317\025\027\030\E\004, + smso=\E^E, smul=\E^F, + wind=\E\014\E\016%p1%'\0'%+%c%p2%'\0'%+%c%p3%'\0'%+%c%p4%'\0'%+%c\025, + #### DEC terminals (Obsolete types: DECwriter and vt40/42/50) # # These entries are DEC's official terminfos for its older terminals. @@ -11191,7 +12233,6 @@ dw2|decwriter|dw|decwriter II, hc, os, cols#132, bel=^G, cr=^M, cub1=^H, cud1=^J, ind=^J, kbs=^H, - # \E(B Use U.S. character set (otherwise # => british pound !) # \E[20l Disable "linefeed newline" mode (else puts \r after \n,\f,\v) # \E[w 10 char/in pitch @@ -11348,28 +12389,38 @@ h19-a|h19a|heath-ansi|heathkit-a|heathkit h19 ansi mode, smacs=\E[10m, smam=\E[?7h, smir=\E[4h, smso=\E[7m, h19-bs|heathkit w/keypad shifted, rmkx=\Eu, smkx=\Et, use=h19-b, -h19-smul|heathkit w/keypad shifted/underscore cursor, +h19-us|h19us|h19-smul|heathkit w/keypad shifted/underscore cursor, rmkx=\Eu, smkx=\Et, use=h19-u, # (h19: merged in from BSDI hp19-e entry>; # also added empty to suppress a tic warning --esr) +# From: Tim Pierce , 23 Feb 1998 +# Tim tells us that: +# I have an old Zenith-19 terminal at home that still gets a lot of use. +# This terminal suffers from the same famous insert-mode padding lossage +# that has been acknowledged for the Z29 terminal. Emacs is nearly +# unusable on this box, since even a half-scroll up or down the window +# causes flaming terminal death. +# +# On the Z19, the only way I have found around this problem is to remove +# the :al: and :dl: entries entirely. No amount of extra padding will +# help (I have tried up to 20000). Removing and +# makes Emacs a little slower, but it remains in the land of the living. +# Big win. h19|heath|h19-b|heathkit|heath-19|z19|zenith|heathkit h19, am, eslok, hs, mir, msgr, cols#80, it#8, lines#24, acsc=, bel=^G, clear=\EE, cnorm=\Ey4, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, - cvvis=\Ex4, dch1=\EN, dl1=\EM$<1*>, ed=\EJ, el=\EK, - fsl=\Ek\Ey5, home=\EH, ht=^I, il1=\EL$<1*>, ind=^J, - ip=<1.5/>, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, - kcuu1=\EA, kf1=\ES, kf2=\ET, kf3=\EU, kf4=\EV, kf5=\EW, - kf6=\EP, kf7=\EQ, kf8=\ER, khome=\EH, lf6=blue, lf7=red, - lf8=white, ri=\EI, rmacs=\EG, rmir=\EO, rmso=\Eq, smacs=\EF, - smir=\E@, smso=\Ep, tsl=\Ej\Ex5\EY8%p1%{32}%+%c\Eo\Eo, + cvvis=\Ex4, dch1=\EN, ed=\EJ, el=\EK, fsl=\Ek\Ey5, home=\EH, + ht=^I, ind=^J, ip=<1.5/>, kbs=^H, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, kf1=\ES, kf2=\ET, kf3=\EU, kf4=\EV, + kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, khome=\EH, lf6=blue, + lf7=red, lf8=white, ri=\EI, rmacs=\EG, rmir=\EO, rmso=\Eq, + smacs=\EF, smir=\E@, smso=\Ep, + tsl=\Ej\Ex5\EY8%p1%{32}%+%c\Eo\Eo, h19-u|heathkit with underscore cursor, cnorm@, cvvis@, use=h19-b, -h19-us|h19us|heathkit w/keypad shifted/underscore cursor, - rmkx=\Eu, smkx=\Et, - use=h19-u, h19-g|h19g|heathkit w/block cursor, cnorm=\Ex4, use=h19-b, alto-h19|altoh19|altoheath|alto-heath|alto emulating heathkit h19, @@ -11470,7 +12521,7 @@ z29a-nkc-uc|h29a-nkc-uc|z29 ansi mode with underscore cursor and no keyclick, z39-a|z39a|zenith39-a|zenith39-ansi|Zenith 39 in ANSI mode, am, eslok, hs, mc5i, mir, msgr, xon, cols#80, lines#24, - acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx~~0a, bel=^G, + acsc=0a``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[1Z, civis=\E[>5h, clear=\E[2J\E[H, cnorm=\E[>5l, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, @@ -11486,9 +12537,9 @@ z39-a|z39a|zenith39-a|zenith39-ansi|Zenith 39 in ANSI mode, kf8=\EOR, kf9=\EOX, khlp=\E[~, khome=\E[H, ll=\E[24;1H, mc0=\E[?19h\E[i, mc4=\E[4i, mc5=\E[5i, rc=\E[u, rev=\E[7m, rmacs=\E(B, rmir=\E[4l, rmkx=\E[>7l, rmso=\E[0m, - rmul=\E[0m, rs2=\E<\Ec\200, sc=\E[s, sgr0=\E[0m, - smacs=\E(0, smir=\E[4h, smkx=\E[>7h, smso=\E[7m, - smul=\E[4m, tbc=\E[3g, tsl=\E[s\E[>1h\E[25;%i%p1%dH, + rmul=\E[0m, rs2=\E<\Ec\0, sc=\E[s, sgr0=\E[0m, smacs=\E(0, + smir=\E[4h, smkx=\E[>7h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + tsl=\E[s\E[>1h\E[25;%i%p1%dH, # From: Brad Brahms z100|h100|z110|z-100|h-100|heath/zenith z-100 pc with color monitor, @@ -11635,7 +12686,17 @@ graphos-30|graphos III with 30 lines, # Vox: (617)-890-5796. # # However, if you call that number today you'll get an insurance company. -# I think Modgraph is long gone. +# I have mail from "Michael Berman, V.P. Sales, Modgraph" dated +# 26 Feb 1997 that says: +# +# Modgraph GX-1000, replaced by GX-2000. Both are out of production, have been +# for ~7 years. Modgraph still in business. Products are rugged laptop and +# portable PC's and specialized CRT and LCD monitors (rugged, rack-mount +# panel-mount etc). I can be emailed at sonfour@aol.com +# +# Peter D. Smith notes that his modgraph manual was +# dated 1984. According to the manual, it featured Tek 4010/4014 +# graphics and DEC VT100/VT52 + ADM-3A emulation with a VT220-style keyboard. # modgraph|mod24|modgraph terminal emulating vt100, @@ -11699,7 +12760,7 @@ modgraph48|mod|Modgraph w/48 lines, mt70|mt-70|Morrow MD-70; native Morrow mode, am, mir, msgr, xon, cols#80, it#8, lines#24, - acsc=+z\,{.yOi-x`|jGkFlEmDnHtLuKvNwMxIqJ, bel=^G, + acsc=+z\,{-x.yOi`|jGkFlEmDnHqJtLuKvNwMxI, bel=^G, cbt=\EI, civis=\E"0, clear=^Z, cnorm=\E"2, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<1>, cuu1=^K, dch1=\EW, dim=\EG2, dl1=\ER, ed=\EY, el=\ET$<10>, @@ -11757,7 +12818,7 @@ omron|Omron 8025AG, # "reset", "tset", or "tabs" utilities (use rt6221-w, 160 columns, for this). # Note that the Control-E key is useless on this brain-damaged terminal. No # delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! -rt6221|Ramtek 6221, 80x24, +rt6221|Ramtek 6221 80x24, msgr, xon, cols#80, it#8, lines#24, vt#3, acsc=, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[>5l, @@ -11775,7 +12836,7 @@ rt6221|Ramtek 6221, 80x24, sc=\E7, sgr0=\E[m, smacs=^N, smkx=\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, # [TO DO: Check out: short forms of ho/cl and ll; reset (\Ec)]. -rt6221-w|Ramtek 6221, 160x48, +rt6221-w|Ramtek 6221 160x48, cols#160, lines#48, ll=\E[48;1H, use=rt6221, @@ -12024,7 +13085,7 @@ t10|teleray 10 special, clear=\Ej$<30/>, cub1=^H, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EQ, dl1=\EM, ed=\EJ, el=\EK, home=\EH, ht=^I, ich1=\EP, il1=\EL, - ind=\Eq, pad=\200, ri=\Ep, rmso=\ER@, rmul=\ER@, smso=\ERD, + ind=\Eq, pad=\0, ri=\Ep, rmso=\ER@, rmul=\ER@, smso=\ERD, smul=\ERH, # teleray 16 - map the arrow keys for vi/rogue, shifted to up/down page, and # back/forth words. Put the function keys (f1-f10) where they can be @@ -12092,7 +13153,7 @@ ti916-132|Texas Instruments 916 VDT vt220 132 column, # # Texas Instruments 916 VDT 8859/1 8 bit control 132 column mode # -ti916-8-132|Texas Instruments 916 VDT vt220 132 column, +ti916-8-132|Texas Instruments 916 VDT 8-bit vt220 132 column, cols#132, use=ti916-8, ti924|Texas Instruments 924 VDT 8859/1 7 bit CTRL, am, xon, @@ -12263,7 +13324,7 @@ apollo_color|apollo color display, # Convergent AWS workstation from Gould/SEL UTX/32 via BRL # (aws: removed unknown :dn=^K: -- esr) -aws|Convergent Technologies AWS workstation under UTX,Xenix, +aws|Convergent Technologies AWS workstation under UTX and Xenix, am, cols#80, lines#28, xmc#0, acsc=, clear=^L, cud1=^K, cuf1=^R, cup=\EC%p2%c%p1%c, @@ -12323,7 +13384,7 @@ qdss|qdcons|qdss glass tty, fos|fortune|Fortune system, am, bw, cols#80, lines#25, - acsc=l m"k(j*v%w#q&x-, bel=^G, blink=\EN, civis=\E], + acsc=j*k(l m"q&v%w#x-, bel=^G, blink=\EN, civis=\E], clear=\014$<20>, cnorm=\E\\, cr=^M, cub1=^H, cud1=\n$<3>, cup=\034C%p1%{32}%+%c%p2%{32}%+%c, cuu1=\013$<3>, cvvis=\E\:, dch1=\034W$<5>, dl1=\034R$<15>, @@ -12406,11 +13467,11 @@ ctrm|C terminal emulator, kcud1=\Ew\r, kcuf1=\Ev\r, kcuu1=\Et\r, kf1=\Ep\r, kf2=\Eq\r, kf3=\Er\r, kf4=\Es\r, kf5=\Et\r, kf6=\Eu\r, kf7=\Ev\r, kf8=\Ew\r, khome=\Ep\r, - op=\E&bn\E&bB\E&bG\E&bR\n%{0}%PX%{0}%PY%{0}%PZ\n%{1}%PW%{1}%PV%{1}%PU, + op=\E&bn\E&bB\E&bG\E&bR%{0}%PX%{0}%PY%{0}%PZ%{1}%PW%{1}%PV%{1}%PU, rev=%?%gB%{0}%=%t\E&dB%{1}%PB%;, rmir=\ER, rmkx=\E&jA, - setb=\E&bn\n%?%gA%t\E&dA%;\n%?%gB%t\E&dB%;\n%?%gH%t\E&dH%;\n%?%gU%t\E&bR%;\n%?%gV%t\E&bG%;\n%?%gW%t\E&bB%;\n\n%?%p1%{1}%&%t\E&bb%{1}%e%{0}%;%PZ\n%?%p1%{2}%&%t\E&bg%{1}%e%{0}%;%PY\n%?%p1%{4}%&%t\E&br%{1}%e%{0}%;%PX, - setf=\E&bn\n%?%gA%t\E&dA%;\n%?%gB%t\E&dB%;\n%?%gH%t\E&dH%;\n%?%gX%t\E&br%;\n%?%gY%t\E&bg%;\n%?%gZ%t\E&bb%;\n\n%?%p1%{1}%&%t\E&bB%{1}%e%{0}%;%PW\n%?%p1%{2}%&%t\E&bG%{1}%e%{0}%;%PV\n%?%p1%{4}%&%t\E&bR%{1}%e%{0}%;%PU, - sgr=\E&d@%{0}%PA%{0}%PB%{0}%PD%{0}%PH\n%?%p1%p3%p5%|%|%t\E&dB%{1}%PB%;\n%?%p4%t\E&dA%{1}%PA%;\n%?%p6%t\E&dH%{1}%PH%;\n%?%p2%t\E&dD%;, + setb=\E&bn%?%gA%t\E&dA%;%?%gB%t\E&dB%;%?%gH%t\E&dH%;%?%gU%t\E&bR%;%?%gV%t\E&bG%;%?%gW%t\E&bB%;%?%p1%{1}%&%t\E&bb%{1}%e%{0}%;%PZ%?%p1%{2}%&%t\E&bg%{1}%e%{0}%;%PY%?%p1%{4}%&%t\E&br%{1}%e%{0}%;%PX, + setf=\E&bn%?%gA%t\E&dA%;%?%gB%t\E&dB%;%?%gH%t\E&dH%;%?%gX%t\E&br%;%?%gY%t\E&bg%;%?%gZ%t\E&bb%;%?%p1%{1}%&%t\E&bB%{1}%e%{0}%;%PW%?%p1%{2}%&%t\E&bG%{1}%e%{0}%;%PV%?%p1%{4}%&%t\E&bR%{1}%e%{0}%;%PU, + sgr=\E&d@%{0}%PA%{0}%PB%{0}%PD%{0}%PH%?%p1%p3%p5%|%|%t\E&dB%{1}%PB%;%?%p4%t\E&dA%{1}%PA%;%?%p6%t\E&dH%{1}%PH%;%?%p2%t\E&dD%;, sgr0=\E&d@%{0}%PA%{0}%PB%{0}%PH, smir=\EQ, smkx=\E&jB, smso=\E&dD, smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, @@ -12421,7 +13482,7 @@ ctrm|C terminal emulator, gs6300|emots|AT&T PC6300 with EMOTS terminal emulator, am, bce, msgr, xon, colors#8, cols#80, it#8, lines#24, pairs#63, - acsc=\,\,..--++``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + acsc=++\,\,--..``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, 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, @@ -12433,7 +13494,7 @@ gs6300|emots|AT&T PC6300 with EMOTS terminal emulator, kf4=\E[23s, kf5=\E[2s, kf6=\E[22s, kf7=\E[3s, kf8=\E[21s, khome=\E[H, mc4=\E[4i, mc5=\E[5i, op=\E[?;m, rev=\E[7m, ri=\E[L, rmacs=\E[10m, rs1=\Ec, setb=\E[?;%p1%dm, - setf=\E[?%?%p1%{0}%=%t0\n%e%p1%{1}%=%t2\n%e%p1%{1}%-%d%;m, + setf=\E[?%?%p1%{0}%=%t0%e%p1%{1}%=%t2%e%p1%{1}%-%d%;m, sgr0=\E[m\E[10m, smacs=\E[11m, smso=\E[1m, smul=\E[4m, # From: 29 Oct 85 05:40:18 GMT @@ -12525,7 +13586,7 @@ diablo1640-lm|diablo-lm|xerox-lm|diablo 1640 with indented left margin, diablo1740-lm|630-lm|1730-lm|x1700-lm|diablo 1740 printer, use=diablo1640-lm, # DTC 382 with VDU. Has no so we fake it with . Standout -# works but won't go away without dynamite . +# works but won't go away without dynamite . # The terminal has tabs, but I'm getting tired of fighting the braindamage. # If no tab is set or the terminal's in a bad mood, it glitches the screen # around all of memory. Note that return puts a blank ("a return character") @@ -12544,7 +13605,7 @@ dtc382|DTC 382, cuf1=^PR, cup=\020\021%p2%c%p1%c, cuu1=^P^L, cvvis=^PB, dch1=^X, dl1=^P^S, ed=\020\025\020\023\020\023, el=^P^U, home=^P^R, il1=^P^Z, ind=^J, pad=\177, rmcup=, rmir=^Pi, - rmul=^P \200, smcup=\020\035$<20>, smir=^PI, smul=^P ^P, + rmul=^P \0, smcup=\020\035$<20>, smir=^PI, smul=^P ^P, dtc300s|DTC 300s, hc, os, cols#132, @@ -12644,7 +13705,7 @@ digilog|digilog 333, dwk|dwk-vt|dwk terminal, am, cols#80, it#8, lines#24, - acsc=lJmFkCjXtEuPv\\wKqUxWnNo~s_`+a\:f'g#~_\\\,Q+\^.M-Sh#I#0\177, + acsc=+\^\,Q-S.M0\177`+a\:f'g#h#i#jXkClJmFnNo~qUs_tEuPv\\wKxW~_, bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cup=\EY%p1%' '%+%c%p2%' '%+%c, cuu1=\EA, dch1=\EP, ed=\EJ, el=\EK, home=\EH, ht=^I, ich1=\EQ, ind=^J, kbs=\177, @@ -12748,9 +13809,8 @@ v3220|LANPAR Vision II model 3220/3221/3222, # are present; the symptom is doubled characters in an update using insert. # These applications are technically correct; in both 4.3BSD termcap and # terminfo, you're not actually supposed to specify both ich/ich1 and rmir/smir -# unless the terminal needs both. 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. +# unless the terminal needs both. To my knowledge, no terminal still in this +# file requires both other than the very obsolete dm2500. # # For ncurses-based applications this is not a problem, as ncurses uses # one or the other as appropriate but never mixes the two. Therefore we @@ -13894,14 +14954,44 @@ v3220|LANPAR Vision II model 3220/3221/3222, # * Back off the xterm entry to use r6 as a base. # 9.13.22 (Sat Nov 30 11:51:31 EST 1996): # * Added dec-vt220 at Adrian Garside's request. -# -# 10.1.0 (Sun Dec 29 02:36:31 EST 1996): +# 9.13.23 (Fri Feb 21 16:36:06 EST 1997): +# * Replaced minitel-2 entry. +# * Added MGR, ansi-nt. # * Minor corrections to xterm entries. # * Replaced EWAN telnet entry. # * Dropped the reorder script generator. It was a fossil. -# 10.1.1 (Sat May 3 21:41:27 EDT 1997): -# * Use setaf/setab consistently with SVr4. -# * Remove ech, el1 from cons25w, they do not work in FreeBSD 2.1.5 +# 9.13.24 (Sun Feb 23 20:55:23 EST 1997): +# * Thorsten Lockert added termcap `bs' to a lot of types, working from +# the 4.4BSD Lite2 file. +# 9.13.25 (Fri Jun 20 12:33:36 EDT 1997): +# * Added Datapoint 8242, pilot, ansi_psx, rbcomm, vt220js. +# * Updated iris-ansi; corrected vt102-w. +# * Switch base xterm entry to 3.3 level. +# 9.13.26 (Mon Jun 30 22:45:45 EDT 1997) +# * Added basic4. +# * Removed rmir/smir from tv92B. +# +# 10.2.0 (Sat Feb 28 12:47:36 EST 1998): +# * Added Thomas Dickey's acsc string for linux. +# * Merged in BeOS, iris-color, hds200, xterm-xf86-v40, xterm-8bit, +# and emx entries. +# * Replaced unixpc entry with Benjamin Sittler's corrected version. +# * Replaced xterm/rxvt/emu/syscons entries with Thomas Dickey's +# versions. +# * Added u8/u9, removed rmul/smul from sun-il. +# * 4.2 tic allows us to use \0 instead of \200 now. +# * Merged in Pavel Roskin's acsc for linux-koi8 +# * Corrected some erroneous \\\s to \. +# * 4.2 ncurses has been changed to use setaf/setab, consistent w/SysV. +# * II -> ii in pcvtXX, screen, xterm. +# * Removed \n chars following ANSI escapes in sgr & friends. +# * Updated Wyse entries. +# * h19 corrections from Tim Pierce. +# * Noted that the dm2500 has both ich and smir. +# * added pccons for the Alpha under OSF/1. +# * Added Sony NEWS workstation entries and cit101e-rv. +# * Reverted `amiga'; to Kent Polk's version, as I'm told +# the Verkuil entry messes up with Amiga Telnet. # # The following sets edit modes for GNU EMACS # Local Variables: diff --git a/mk-0th.awk b/mk-0th.awk index a4a3a543..b7a40fdc 100644 --- a/mk-0th.awk +++ b/mk-0th.awk @@ -1,23 +1,34 @@ -# $Id: mk-0th.awk,v 1.3 1996/12/01 00:27:23 tom Exp $ -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: mk-0th.awk,v 1.7 1998/02/11 12:13:52 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# # Generate list of sources for a library, together with lint/lintlib rules # # Variables: @@ -29,20 +40,23 @@ BEGIN { print "" found = 0; } - !/^#/ { - if ( $2 == "lib" ) + !/^[@#]/ { + if ( $0 != "" ) { if ( found == 0 ) { printf "C_SRC =" - found = 1 + if ( $2 == "lib" ) + found = 1 + else + found = 2 } printf " \\\n\t%s/%s.c", $3, $1 } } END { print "" - if ( found != 0 ) + if ( found == 1 ) { print "" printf "# Producing llib-l%s is time-consuming, so there's no direct-dependency for\n", name @@ -64,6 +78,7 @@ END { } else { + print "" print "lintlib :" print "\t@echo no action needed" } diff --git a/mk-1st.awk b/mk-1st.awk index 235ceab0..c35933bd 100644 --- a/mk-1st.awk +++ b/mk-1st.awk @@ -1,29 +1,44 @@ -# $Id: mk-1st.awk,v 1.20 1997/05/05 21:28:17 tom Exp $ -################################################################################ -# Copyright 1996,1997 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: mk-1st.awk,v 1.35 1998/02/11 12:13:53 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# # Generate list of objects for a given model library # Variables: # name (library name, e.g., "ncurses", "panel", "forms", "menus") # 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") +# target (cross-compile target, if any) # DoLinks ("yes" or "no", flag to add symbolic links) # rmSoLocs ("yes" or "no", flag to add extra clean target) # overwrite ("yes" or "no", flag to add link to libcurses.a @@ -39,13 +54,18 @@ function symlink(src,dst) { printf "$(LN_S) %s %s; ", src, dst } } -function sharedlinks(directory) { +function sharedlinks(directory, add) { if ( end_name != lib_name ) { - printf "\tcd %s && (", directory abi_name = sprintf("%s.$(ABI_VERSION)", lib_name); - symlink(end_name, abi_name); - symlink(abi_name, lib_name); - printf ")\n" + if (add) { + printf "\tcd %s && (", directory + symlink(end_name, abi_name); + symlink(abi_name, lib_name); + printf ")\n" + } else { + printf "\t-@rm -f %s/%s\n", directory, abi_name + printf "\t-@rm -f %s/%s\n", directory, lib_name + } } } function removelinks() { @@ -61,17 +81,40 @@ function installed_name() { } } BEGIN { - print "" - print "# generated by mk-1st.awk" - print "" - found = 0; + found = 0 + using = 0 } - !/^#/ { - if ( $2 == "lib" || $2 == "progs" ) + /^@/ { + using = 0 + if (subset == "none") { + using = 1 + } else if (index(subset,$2) > 0) { + if (using == 0) { + if (found == 0) { + print "" + print "# generated by mk-1st.awk" + print "" + } + using = 1 + } + if ( subset == "termlib") { + name = "tinfo" + OBJS = MODEL "_T" + } else { + OBJS = MODEL + } + } + } + !/^[@#]/ { + if (using \ + && ( $2 == "lib" \ + || $2 == "progs" \ + || $2 == "c++" \ + || $2 == "tack" )) { if ( found == 0 ) { - printf "%s_OBJS =", MODEL + printf "%s_OBJS =", OBJS if ( $2 == "lib" ) found = 1 else @@ -84,12 +127,12 @@ END { print "" if ( found != 0 ) { - printf "\n$(%s_OBJS) : %s\n", MODEL, depend + printf "\n$(%s_OBJS) : %s\n", OBJS, depend } if ( found == 1 ) { print "" - lib_name = sprintf("lib%s%s", name, suffix) + lib_name = sprintf("%s%s%s", prefix, name, suffix) if ( MODEL == "SHARED" ) { if ( DoLinks == "yes" ) { @@ -97,10 +140,10 @@ END { } else { end_name = lib_name; } - printf "../lib/%s : $(%s_OBJS)\n", lib_name, MODEL - print "\t@-rm -f $@" - printf "\t$(MK_SHARED_LIB) $(%s_OBJS)\n", MODEL - sharedlinks("../lib") + printf "../lib/%s : $(%s_OBJS)\n", lib_name, OBJS + print "\t-@rm -f $@" + printf "\t$(MK_SHARED_LIB) $(%s_OBJS)\n", OBJS + sharedlinks("../lib", 1) print "" if ( end_name != lib_name ) { printf "../lib/%s : ../lib/%s\n", end_name, lib_name @@ -110,30 +153,48 @@ END { print "install.libs \\" printf "install.%s :: $(INSTALL_PREFIX)$(libdir) ../lib/%s\n", name, end_name printf "\t@echo installing ../lib/%s as $(INSTALL_PREFIX)$(libdir)/%s \n", lib_name, end_name - printf "\t-rm -f $(INSTALL_PREFIX)$(libdir)/%s \n", end_name - printf "\t$(INSTALL) ../lib/%s $(INSTALL_PREFIX)$(libdir)/%s \n", lib_name, end_name - sharedlinks("$(INSTALL_PREFIX)$(libdir)") + printf "\t-@rm -f $(INSTALL_PREFIX)$(libdir)/%s \n", end_name + printf "\t$(INSTALL_LIB) ../lib/%s $(INSTALL_PREFIX)$(libdir)/%s \n", lib_name, end_name + sharedlinks("$(INSTALL_PREFIX)$(libdir)", 1) if ( overwrite == "yes" && name == "ncurses" ) { ovr_name = sprintf("libcurses%s", suffix) printf "\t@echo linking %s to %s\n", ovr_name, lib_name - printf "\t-rm -f $(INSTALL_PREFIX)$(libdir)/%s \n", ovr_name + printf "\t-@rm -f $(INSTALL_PREFIX)$(libdir)/%s \n", ovr_name printf "\t(cd $(INSTALL_PREFIX)$(libdir) && $(LN_S) %s %s)\n", lib_name, ovr_name } - printf "\t- ldconfig\n" + if ( ldconfig != "" ) { + printf "\t- test -z \"$(INSTALL_PREFIX)\" && %s\n", ldconfig + } + print "" + print "uninstall \\" + print "uninstall.libs \\" + printf "uninstall.%s ::\n", name + printf "\t@echo uninstalling $(INSTALL_PREFIX)$(libdir)/%s \n", end_name + printf "\t-@rm -f $(INSTALL_PREFIX)$(libdir)/%s\n", end_name + sharedlinks("$(INSTALL_PREFIX)$(libdir)", 0) + if ( overwrite == "yes" && name == "ncurses" ) + { + ovr_name = sprintf("libcurses%s", suffix) + printf "\t-@rm -f $(INSTALL_PREFIX)$(libdir)/%s \n", ovr_name + } if ( rmSoLocs == "yes" ) { print "" print "mostlyclean \\" print "clean ::" - printf "\t@-rm -f so_locations\n" + printf "\t-@rm -f so_locations\n" } } else { end_name = lib_name; - printf "../lib/%s : $(%s_OBJS)\n", lib_name, MODEL + printf "../lib/%s : $(%s_OBJS)\n", lib_name, OBJS printf "\t$(AR) $(AR_OPTS) $@ $?\n" printf "\t$(RANLIB) $@\n" + if ( target == "vxworks" ) + { + printf "\t$(LD) $(LD_OPTS) $? -o $(@:.a=.o)\n" + } print "" print "install \\" print "install.libs \\" @@ -143,23 +204,50 @@ END { if ( overwrite == "yes" && lib_name == "libncurses.a" ) { printf "\t@echo linking libcurses.a to libncurses.a \n" - printf "\t-rm -f $(INSTALL_PREFIX)$(libdir)/libcurses.a \n" + printf "\t-@rm -f $(INSTALL_PREFIX)$(libdir)/libcurses.a \n" printf "\t(cd $(INSTALL_PREFIX)$(libdir) && $(LN_S) libncurses.a libcurses.a)\n" } printf "\t$(RANLIB) $(INSTALL_PREFIX)$(libdir)/%s\n", lib_name + if ( target == "vxworks" ) + { + printf "\t@echo installing ../lib/lib%s.o as $(INSTALL_PREFIX)$(libdir)/lib%s.o\n", name, name + printf "\t$(INSTALL_DATA) ../lib/lib%s.o $(INSTALL_PREFIX)$(libdir)/lib%s.o\n", name, name + } + print "" + print "uninstall \\" + print "uninstall.libs \\" + printf "uninstall.%s ::\n", name + printf "\t@echo uninstalling $(INSTALL_PREFIX)$(libdir)/%s \n", lib_name + printf "\t-@rm -f $(INSTALL_PREFIX)$(libdir)/%s\n", lib_name + if ( overwrite == "yes" && lib_name == "libncurses.a" ) + { + printf "\t@echo linking libcurses.a to libncurses.a \n" + printf "\t-@rm -f $(INSTALL_PREFIX)$(libdir)/libcurses.a \n" + } + if ( target == "vxworks" ) + { + printf "\t@echo uninstalling $(INSTALL_PREFIX)$(libdir)/lib%s.o\n", name + printf "\t-@rm -f $(INSTALL_PREFIX)$(libdir)/lib%s.o\n", name + } } print "" - print "mostlyclean \\" print "clean ::" printf "\trm -f ../lib/%s\n", lib_name - printf "\trm -f $(%s_OBJS)\n", MODEL + print "" + print "mostlyclean::" + printf "\trm -f $(%s_OBJS)\n", OBJS + print "" + print "clean ::" + printf "\trm -f $(%s_OBJS)\n", OBJS removelinks(); } else if ( found == 2 ) { print "" - print "mostlyclean \\" + print "mostlyclean::" + printf "\trm -f $(%s_OBJS)\n", OBJS + print "" print "clean ::" - printf "\trm -f $(%s_OBJS)\n", MODEL + printf "\trm -f $(%s_OBJS)\n", OBJS } } diff --git a/mk-2nd.awk b/mk-2nd.awk index cc1db565..9240b470 100644 --- a/mk-2nd.awk +++ b/mk-2nd.awk @@ -1,23 +1,34 @@ -# $Id: mk-2nd.awk,v 1.7 1996/12/01 00:26:51 tom Exp $ -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: mk-2nd.awk,v 1.10 1998/02/11 12:13:53 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# # Generate compile-rules for the modules that we are using in libraries or # programs. We are listing them explicitly because we have turned off the # suffix rules (to force compilation with the appropriate flags). We could use @@ -28,6 +39,7 @@ # model # 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") # # Fields in src/modules: # $1 = module name @@ -37,39 +49,57 @@ # Fields in src/modules past $3 are dependencies # BEGIN { - print "" - print "# generated by mk-2nd.awk" - print "" + found = 0 + using = 0 } - !/^#/ { - if ( $1 != "" ) { - print "" - if ( $2 == "c++" ) { - compile="CXX" - suffix=".cc" - } else { - compile="CC" - suffix=".c" + /^@/ { + using = 0 + if (subset == "none") { + using = 1 + } else if (index(subset,$2) > 0) { + if (using == 0) { + if (found == 0) { + print "" + print "# generated by mk-2nd.awk" + print "" + } + using = 1 + } } - 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 - print "" - if ( echo == "yes" ) - atsign="" - else { - atsign="@" - printf "\t@echo 'compiling %s (%s)'\n", $1, model - } - if ( $3 == "." || srcdir == "." ) - printf "\t%scd ../%s; $(%s) $(CFLAGS_%s) -c ../%s/%s%s", atsign, model, compile, MODEL, name, $1, suffix - else - printf "\t%scd ../%s; $(%s) $(CFLAGS_%s) -c %s/%s%s", atsign, model, compile, MODEL, $3, $1, suffix - } else { - printf "%s", $1 - for (n = 2; n <= NF; n++) printf " %s", $n } - print "" + !/^[@#]/ { + if ($0 != "" \ + && using != 0) { + found = 1 + if ( $1 != "" ) { + print "" + if ( $2 == "c++" ) { + compile="CXX" + suffix=".cc" + } else { + compile="CC" + suffix=".c" + } + 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 + print "" + if ( echo == "yes" ) + atsign="" + else { + atsign="@" + printf "\t@echo 'compiling %s (%s)'\n", $1, model + } + if ( $3 == "." || srcdir == "." ) + printf "\t%scd ../%s; $(%s) $(CFLAGS_%s) -c ../%s/%s%s", atsign, model, compile, MODEL, name, $1, suffix + else + printf "\t%scd ../%s; $(%s) $(CFLAGS_%s) -c %s/%s%s", atsign, model, compile, MODEL, $3, $1, suffix + } else { + printf "%s", $1 + for (n = 2; n <= NF; n++) printf " %s", $n + } + print "" + } } END { - print "" + print "" } diff --git a/mkinstalldirs b/mkinstalldirs index 91f6d04e..b2e45ea2 100755 --- a/mkinstalldirs +++ b/mkinstalldirs @@ -1,10 +1,11 @@ -#!/bin/sh +#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Last modified: 1994-03-25 # Public domain +umask 022 errstatus=0 for file in ${1+"$@"} ; do diff --git a/ncurses.lsm b/ncurses.lsm deleted file mode 100644 index 46dc4bd8..00000000 --- a/ncurses.lsm +++ /dev/null @@ -1,30 +0,0 @@ -Begin3 -Title: ncurses -Version: 4.1 -Entered-date: 05MAY97 -Description: SVr4 and XSI-Curses compatible curses library and terminfo - tools including tic, infocmp, captoinfo. The library can - be configured to fall back to reading /etc/termcap for - backward compatibility with BSD curses, but the distribution - includes a copy of the master terminfo database. Supports - color, multiple highlights, forms-drawing characters, and - automatic recognition of keypad and function-key sequences. - Extensions include resizable windows and mouse support on both - xterm and Linux console using the gpm library. C++ binding - (not supported) and example. Ada95 binding and examples. - Includes man pages, test programs. Approved to replace 4.4BSD - curses, June 1995. -Keywords: curses, interface, screen, library -Author: zmbenhal@netcom.com (Zeyd Ben-Halim) - dickey@clark.net (Thomas Dickey) - esr@snark.thyrsus.com (Eric S. Raymond) - juergen.pfeifer@T-Online.de (Juergen Pfeifer) -Maintained-by: dickey@clark.net (Thomas Dickey) - juergen.pfeifer@T-Online.de (Juergen Pfeifer) -Primary-site: ftp.clark.net /pub/dickey/ncurses - ncurses-4.1.tar.gz -Platforms: Portable to any ANSI/POSIX system. -Alternate-site: ftp.netcom.com /pub/zm/zmbenhal/ncurses -Alternate-site: prep.ai.mit.edu /pub/gnu -Copying-policy: BSD-like. -End diff --git a/ncurses/MKcaptab.awk b/ncurses/MKcaptab.awk index d028cb2d..7c2b58cc 100644 --- a/ncurses/MKcaptab.awk +++ b/ncurses/MKcaptab.awk @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: MKcaptab.awk,v 1.9 1997/04/05 23:38:24 tom Exp $ +# $Id: MKcaptab.awk,v 1.10 1997/09/11 17:40:46 tom Exp $ AWK=${1-awk} DATA=${2-../include/Caps} @@ -13,7 +13,6 @@ cat <<'EOF' #include #include #include -#include EOF diff --git a/ncurses/MKexpanded.sh b/ncurses/MKexpanded.sh index 53624449..c0fca5f2 100755 --- a/ncurses/MKexpanded.sh +++ b/ncurses/MKexpanded.sh @@ -1,24 +1,35 @@ -#!/bin/sh -################################################################################ -# Copyright 1997 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ -# $Id: MKexpanded.sh,v 1.4 1997/05/10 20:21:58 tom Exp $ +#! /bin/sh +############################################################################## +# Copyright (c) 1998 Free 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 1997 +# +# $Id: MKexpanded.sh,v 1.6 1998/02/11 12:13:54 tom Exp $ # # Script to generate 'expanded.c', a dummy source that contains functions # corresponding to complex macros used in this library. By making functions, @@ -57,10 +68,6 @@ cat >$TMP <" print "#include " - print "#include " + print "#include " print "#include " + print "#include " print "" print "struct kn {" print "\tconst char *name;" @@ -14,7 +16,10 @@ BEGIN { print "const struct kn key_names[] = {" } -{printf "\t{\"%s\", %s,},\n", $1, $2;} +/^[^#]/ { +# printf "\t{ \"%s\",%*s%s },\n", $1, 16-length($1), " ", $1; + printf "\t{ \"%s\",%s },\n", $1, $1; + } END { print "};" @@ -22,11 +27,28 @@ END { print "const char *keyname(int c)" print "{" print "int i, size = sizeof(key_names)/sizeof(struct kn);" + print "static char name[5];" + print "char *p;" print "" - print "\tfor (i = 0; i < size; i++) {" - print "\t\tif (key_names[i].code == c) return key_names[i].name;" + print "\tfor (i = 0; i < size; i++)" + print "\t\tif (key_names[i].code == c)" + print "\t\t\treturn key_names[i].name;" + print "\tif (c >= 256) return \"UNKNOWN KEY\";" + print "\tp = name;" + print "\tif (c >= 128) {" + print "\t\tstrcpy(p, \"M-\");" + print "\t\tp += 2;" + print "\t\tc -= 128;" print "\t}" - print "\treturn NULL;" + print "\tif (c < 0)" + print "\t\tsprintf(p, \"%d\", c);" + print "\telse if (c < 32)" + print "\t\tsprintf(p, \"^%c\", c + '@');" + print "\telse if (c == 127)" + print "\t\tstrcpy(p, \"^?\");" + print "\telse" + print "\t\tsprintf(p, \"%c\", c);" + print "\treturn name;" print "}" print "" } diff --git a/ncurses/MKkeys.awk b/ncurses/MKkeys.awk deleted file mode 100644 index 669c455e..00000000 --- a/ncurses/MKkeys.awk +++ /dev/null @@ -1 +0,0 @@ -{printf "\tadd_to_try(%s, %s);\n", $1, $2;} diff --git a/ncurses/MKlib_gen.sh b/ncurses/MKlib_gen.sh index a08dc0a0..0a29c608 100755 --- a/ncurses/MKlib_gen.sh +++ b/ncurses/MKlib_gen.sh @@ -2,7 +2,7 @@ # # MKlib_gen.sh -- generate sources from curses.h macro definitions # -# ($Id: MKlib_gen.sh,v 1.9 1997/05/10 23:48:19 tom Exp $) +# ($Id: MKlib_gen.sh,v 1.11 1998/01/17 14:16:52 Juan.Jose.Garcia.Ripoll Exp $) # # The XSI Curses standard requires all curses entry points to exist as # functions, even though many definitions would normally be shadowed @@ -28,8 +28,12 @@ preprocessor="$1 -I../include" AWK="$2" +ED1=sed1$$.sed +ED2=sed2$$.sed +ED3=sed3$$.sed +AW1=awk1$$.awk TMP=gen$$.c -trap "rm -f $TMP" 0 1 2 5 15 +trap "rm -f $ED1 $ED2 $ED3 $AW1 $TMP" 0 1 2 5 15 (cat < @@ -38,32 +42,76 @@ trap "rm -f $TMP" 0 1 2 5 15 DECLARATIONS EOF -sed -n -e "/^extern.*generated/s/^extern \([^;]*\);.*/\1/p" \ -| sed \ - -e "/(void)/b nc" \ - -e "s/,/ a1% /" \ - -e "s/,/ a2% /" \ - -e "s/,/ a3% /" \ - -e "s/,/ a4% /" \ - -e "s/,/ a5% /" \ - -e "s/,/ a6% /" \ - -e "s/,/ a7% /" \ - -e "s/,/ a8% /" \ - -e "s/,/ a9% /" \ - -e "s/,/ a10% /" \ - -e "s/,/ a11% /" \ - -e "s/,/ a12% /" \ - -e "s/,/ a13% /" \ - -e "s/,/ a14% /" \ - -e "s/,/ a15% /" \ - -e "s/*/ * /g" \ - -e "s/%/ , /g" \ - -e "s/)/ z)/" \ - -e ":nc" \ - -e "/(/s// ( /" \ - -e "s/)/ )/" \ -| $AWK '{ - print "\n" +cat >$ED1 <$ED2 <$ED3 <$AW1 <<\EOF1 +BEGIN { + skip=0; + } + /^P_#if/ { + print "\n" + print $0 + skip=0; + } + /^P_#endif/ { + print $0 + skip=1; + } + $0 !~ /^P_/ { + if (skip) + print "\n" + skip=1; print "M_" $2 print $0; @@ -171,7 +219,10 @@ sed -n -e "/^extern.*generated/s/^extern \([^;]*\);.*/\1/p" \ print "%%returnVoid;" print "}"; } -' ) \ +EOF1 + +sed -n -f $ED1 | sed -f $ED2 \ +| $AWK -f $AW1 ) \ | sed \ -e '/^\([a-z_][a-z_]*\) /s//\1 gen_/' >$TMP $preprocessor $TMP 2>/dev/null \ @@ -182,15 +233,13 @@ BEGIN { print " * It is generated by MKlib_gen.sh." print " *" print " * This is a file of trivial functions generated from macro" - print " * definitions in curses.h in order to satisfy the XSI Curses" - print " * requirement that every macro also exist as a callable" - print " * function." + print " * definitions in curses.h to satisfy the XSI Curses requirement" + print " * that every macro also exist as a callable function." print " *" print " * It will never be linked unless you call one of the entry" print " * points with its normal macro definition disabled. In that" print " * case, if you have no shared libraries, it will indirectly" print " * pull most of the rest of the library into your link image." - print " * Cope with it." print " */" print "#include " print "" @@ -198,14 +247,7 @@ BEGIN { /^DECLARATIONS/ {start = 1; next;} {if (start) print $0;} ' \ -| sed \ - -e 's/ */ /g' \ - -e 's/ */ /g' \ - -e 's/ ,/,/g' \ - -e 's/ )/)/g' \ - -e 's/ gen_/ /' \ - -e 's/^M_/#undef /' \ - -e '/^%%/s// /' \ +| sed -f $ED3 \ | sed \ -e 's/^.*T_CALLED.*returnCode( \([a-z].*) \));/ return \1;/' \ -e 's/^.*T_CALLED.*returnCode( \((wmove.*) \));/ return \1;/' diff --git a/ncurses/MKnames.awk b/ncurses/MKnames.awk index 33075095..de118227 100644 --- a/ncurses/MKnames.awk +++ b/ncurses/MKnames.awk @@ -1,10 +1,14 @@ -# $Id: MKnames.awk,v 1.8 1997/05/10 16:11:33 tom Exp $ +# $Id: MKnames.awk,v 1.9 1997/10/18 19:57:23 tom Exp $ BEGIN { print "/* This file was generated by MKnames.awk */" > "namehdr" print "" > "namehdr" print "#include " > "namehdr" print "" > "namehdr" + print "#ifdef __cplusplus" > "namehdr" + print "#define extern IT NCURSES_CONST char * const" > "namehdr" + print "#else" > "namehdr" print "#define IT NCURSES_CONST char * const" > "namehdr" + print "#endif" > "namehdr" print "" > "namehdr" print "#if BROKEN_LINKER" > "namehdr" print "#include " > "namehdr" diff --git a/ncurses/MKunctrl.awk b/ncurses/MKunctrl.awk index 34d8cd3b..5fef6682 100644 --- a/ncurses/MKunctrl.awk +++ b/ncurses/MKunctrl.awk @@ -1,29 +1,42 @@ -# $Id: MKunctrl.awk,v 1.3 1997/04/26 23:04:45 tom Exp $ -################################################################################ -# Copyright 1997 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: MKunctrl.awk,v 1.5 1998/02/11 12:13:55 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1997 +# BEGIN { print "/* generated by MKunctrl.awk */" print print "#include " print + print "#undef unctrl" + print } END { print "NCURSES_CONST char *unctrl(register chtype ch)" diff --git a/ncurses/Makefile.in b/ncurses/Makefile.in index c76ec188..132b98ea 100644 --- a/ncurses/Makefile.in +++ b/ncurses/Makefile.in @@ -1,23 +1,34 @@ -# $Id: Makefile.in,v 1.28 1997/05/10 20:21:06 tom Exp $ -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: Makefile.in,v 1.46 1998/02/11 12:13:57 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# # Makefile for ncurses source code. # # This makes the following: @@ -37,7 +48,9 @@ SHELL = /bin/sh THIS = Makefile -NC_MFLAGS = @nc_cv_makeflags@ +x = @PROG_EXT@ + +CF_MFLAGS = @cf_cv_makeflags@ @SET_MAKE@ MODEL = @DFT_LWR_MODEL@ @@ -52,6 +65,7 @@ datadir = @datadir@ ticdir = $(datadir)/terminfo INSTALL = @INSTALL@ +INSTALL_LIB = @INSTALL@ @INSTALL_LIB@ INSTALL_DATA = @INSTALL_DATA@ AR = @AR@ @@ -70,6 +84,10 @@ CPPFLAGS = -I../ncurses -I$(srcdir) @CPPFLAGS@ \ CCFLAGS = $(CPPFLAGS) $(CFLAGS) +HOSTCC = @CC@ +HOSTCCFLAGS = @CFLAGS@ $(CPPFLAGS) +HOSTLDFLAGS = @LDFLAGS@ @LIBS@ + CFLAGS_NORMAL = $(CCFLAGS) CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE CFLAGS_PROFILE = $(CCFLAGS) -pg @@ -80,9 +98,10 @@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) LINK = $(CC) LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ +SHLIB_LIST = @SHLIB_LIST@ MK_SHARED_LIB = @MK_SHARED_LIB@ -REL_VERSION = @nc_cv_rel_version@ -ABI_VERSION = @nc_cv_abi_version@ +REL_VERSION = @cf_cv_rel_version@ +ABI_VERSION = @cf_cv_abi_version@ RANLIB = @RANLIB@ @@ -92,6 +111,8 @@ LINT = @LINT@ LINT_OPTS = @LINT_OPTS@ LINT_LIBS = -lncurses @LIBS@ +FALLBACK_LIST = @FALLBACK_LIST@ + AUTO_SRC = \ ../include/nomacros.h \ ./comp_captab.c \ @@ -104,8 +125,20 @@ AUTO_SRC = \ ./names.c \ ./unctrl.c +TEST_DEPS = @LIB_PREFIX@ncurses@DFT_DEP_SUFFIX@ +TEST_ARGS = -L../lib -lncurses +TEST_LDFLAGS = @LD_MODEL@ $(TEST_ARGS) @LIBS@ @EXTRA_LIBS@ @LOCAL_LDFLAGS@ @LDFLAGS@ + +TEST_PROGS = \ + captoinfo$x \ + hardscroll$x \ + hashmap$x \ + lib_mvcur$x + ################################################################################ -all :: ../lib $(AUTO_SRC) $(LIBRARIES) +all :: $(AUTO_SRC) ../lib $(LIBRARIES) + +sources: $(AUTO_SRC) $(INSTALL_PREFIX)$(libdir) : $(srcdir)/../mkinstalldirs $@ @@ -113,7 +146,7 @@ $(INSTALL_PREFIX)$(libdir) : ../lib : ; mkdir $@ ./fallback.c : $(srcdir)/MKfallback.sh - sh $(srcdir)/MKfallback.sh >$@ + sh $(srcdir)/MKfallback.sh $(FALLBACK_LIST) >$@ ./lib_gen.c : $(srcdir)/MKlib_gen.sh ../include/curses.h sh $(srcdir)/MKlib_gen.sh "$(CPP)" "$(AWK)" <../include/curses.h >$@ @@ -122,19 +155,24 @@ $(INSTALL_PREFIX)$(libdir) : sh $(srcdir)/MKlib_gen.sh "$(CPP)" "$(AWK)" <../include/curses.h | \ fgrep undef >$@ -keys.tries: $(srcdir)/keys.list - $(AWK) -f $(srcdir)/MKkeys.awk $(srcdir)/keys.list > keys.tries +keys.tries: make_keys$x $(srcdir)/keys.list + ./make_keys $(srcdir)/keys.list > keys.tries + +make_keys$x : \ + $(srcdir)/make_keys.c \ + ./names.c + $(HOSTCC) -o $@ $(HOSTCCFLAGS) $(srcdir)/make_keys.c $(HOSTLDFLAGS) -make_hash : \ +make_hash$x : \ $(srcdir)/comp_hash.c \ ../include/hashsize.h - $(CC) -o $@ $(CCFLAGS) -DMAIN_PROGRAM $(srcdir)/comp_hash.c $(LDFLAGS) + $(HOSTCC) -o $@ $(HOSTCCFLAGS) -DMAIN_PROGRAM $(srcdir)/comp_hash.c $(HOSTLDFLAGS) ./expanded.c : $(srcdir)/MKexpanded.sh sh $(srcdir)/MKexpanded.sh "$(CPP)" $(CPPFLAGS) ./comp_captab.c: \ - make_hash \ + make_hash$x \ ../include/hashsize.h \ $(srcdir)/MKcaptab.awk sh $(srcdir)/MKcaptab.awk $(AWK) $(srcdir)/../include/Caps > $@ @@ -158,10 +196,12 @@ TAGS: etags *.[ch] mostlyclean :: - -rm -f tags TAGS *~ + -rm -f core tags TAGS *~ *.ln *.atac trace + -rm -f $(TEST_PROGS) clean :: mostlyclean -rm -f $(AUTO_SRC) + -rm -f make_keys -rm -f make_hash distclean :: clean @@ -173,7 +213,26 @@ realclean :: distclean ../include/hashsize.h \ ../include/parametrized.h \ ../include/term.h : - cd ../include; $(MAKE) $(NC_MFLAGS) + cd ../include; $(MAKE) $(CF_MFLAGS) + +# These rules build test-programs for the modules that have test-drivers +test_progs : $(TEST_PROGS) + +captoinfo$x : $(srcdir)/captoinfo.c $(TEST_DEPS) + @ECHO_LINK@ $(CC) -o $@ $(CCFLAGS) -DMAIN $(srcdir)/captoinfo.c $(TEST_LDFLAGS) + +hardscroll$x : $(srcdir)/hardscroll.c $(TEST_DEPS) + @ECHO_LINK@ $(CC) -o $@ $(CCFLAGS) -DSCROLLDEBUG $(srcdir)/hardscroll.c $(TEST_LDFLAGS) + +hashmap$x : $(srcdir)/hashmap.c $(TEST_DEPS) + @ECHO_LINK@ $(CC) -o $@ $(CCFLAGS) -DHASHDEBUG $(srcdir)/hashmap.c $(TEST_LDFLAGS) + +lib_mvcur$x : $(srcdir)/lib_mvcur.c $(TEST_DEPS) \ + ../@DFT_OBJ_SUBDIR@/dump_entry.o + @ECHO_LINK@ $(CC) -o $@ $(CCFLAGS) -DNCURSES_TEST -I$(srcdir)/../progs $(srcdir)/lib_mvcur.c ../@DFT_OBJ_SUBDIR@/dump_entry.o $(TEST_LDFLAGS) + +../@DFT_OBJ_SUBDIR@/dump_entry.o: + cd ../progs && $(MAKE) ../@DFT_OBJ_SUBDIR@/dump_entry.o: ############################################################################### # The remainder of this file is automatically generated during configuration diff --git a/ncurses/SigAction.h b/ncurses/SigAction.h index 3e4f5786..efa3df22 100644 --- a/ncurses/SigAction.h +++ b/ncurses/SigAction.h @@ -1,32 +1,56 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ - - -/* This file exists to handle non-POSIX systems which don't have , +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * $Id: SigAction.h,v 1.4 1998/02/11 12:13:55 tom Exp $ + * + * This file exists to handle non-POSIX systems which don't have , * and usually no sigaction() nor */ #ifndef _SIGACTION_H #define _SIGACTION_H +#if HAVE_SIGACTION + +#if !HAVE_TYPE_SIGACTION +typedef struct sigaction sigaction_t; +#endif + +#else /* !HAVE_SIGACTION */ + +#if HAVE_SIGVEC + #if HAVE_LIBC_H #include #endif @@ -80,4 +104,6 @@ extern int sigsuspend (sigset_t *mask); extern int sigdelset (sigset_t *mask, int sig); extern int sigaddset (sigset_t *mask, int sig); -#endif +#endif /* HAVE_SIGVEC */ +#endif /* HAVE_SIGACTION */ +#endif /* !defined(_SIGACTION_H) */ diff --git a/ncurses/alloc_entry.c b/ncurses/alloc_entry.c index 27f21d0f..169e71cd 100644 --- a/ncurses/alloc_entry.c +++ b/ncurses/alloc_entry.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -36,7 +48,7 @@ #include #include -MODULE_ID("$Id: alloc_entry.c,v 1.12 1997/02/01 22:59:47 tom Exp $") +MODULE_ID("$Id: alloc_entry.c,v 1.13 1998/02/11 12:13:53 tom Exp $") #define MAX_STRTAB 4096 /* documented maximum entry size */ diff --git a/ncurses/captoinfo.c b/ncurses/captoinfo.c index a70c7687..387fabd3 100644 --- a/ncurses/captoinfo.c +++ b/ncurses/captoinfo.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ @@ -82,7 +94,7 @@ #include #include -MODULE_ID("$Id: captoinfo.c,v 1.15 1996/12/21 14:24:06 tom Exp $") +MODULE_ID("$Id: captoinfo.c,v 1.17 1998/02/11 12:13:54 tom Exp $") #define MAX_PUSHED 16 /* max # args we can push onto the stack */ #define MAX_ENTRY 2048 /* maximum chars in a translated capability */ @@ -152,7 +164,7 @@ static void pop(void) param++; } -static int cvtchar(register char *sp) +static int cvtchar(register const char *sp) /* convert a character to a terminfo push */ { unsigned char c = 0; @@ -252,12 +264,12 @@ static void getparm(int parm, int n) char *_nc_captoinfo( /* convert a termcap string to terminfo format */ -register char *const cap, /* relevant terminfo capability index */ -register char *s, /* string value of the capability */ +register const char *cap, /* relevant terminfo capability index */ +register const char *s, /* string value of the capability */ int const parametrized) /* do % translations if 1, pad translations if >=0 */ { static char line[MAX_ENTRY]; - char *capstart; + const char *capstart; stackptr = 0; onstack = 0; @@ -269,7 +281,7 @@ int const parametrized) /* do % translations if 1, pad translations if >=0 */ dp = line; /* skip the initial padding (if we haven't been told not to) */ - capstart = (char *)NULL; + capstart = 0; if (s == 0) s = ""; if (parametrized >= 0 && isdigit(*s)) @@ -541,12 +553,14 @@ int const parametrized) /* do % translations if 1, pad translations if >=0 */ char *_nc_infotocap( /* convert a terminfo string to termcap format */ -register char *const cap GCC_UNUSED, /* relevant termcap capability index */ -register char *str, /* string value of the capability */ +register const char *cap GCC_UNUSED, /* relevant termcap capability index */ +register const char *str, /* string value of the capability */ int const parametrized) /* do % translations if 1, pad translations if >=0 */ { int seenone = 0, seentwo = 0, saw_m = 0, saw_n = 0; - char *padding, ch1 = 0, ch2 = 0; + const char *padding; + const char *trimmed = 0; + char ch1 = 0, ch2 = 0; char *bufptr = init_string(); char temp[256]; @@ -558,14 +572,14 @@ int const parametrized) /* do % translations if 1, pad translations if >=0 */ while (isdigit(*padding) || *padding == '.' || *padding == '*') padding--; if (*padding == '<' && *--padding == '$') - *padding = '\0'; + trimmed = padding; padding += 2; while (isdigit(*padding) || *padding == '.' || *padding == '*') bufptr = save_char(bufptr, *padding++); } - for (; *str; str++) + for (; *str && str != trimmed; str++) { int c1, c2; char *cp; @@ -723,7 +737,7 @@ int const parametrized) /* do % translations if 1, pad translations if >=0 */ } } else if (*str >= '3') - return((char *)NULL); + return(0); break; case 'i': @@ -732,7 +746,7 @@ int const parametrized) /* do % translations if 1, pad translations if >=0 */ break; default: - return((char *)NULL); + return(0); } /* endswitch (*str) */ } /* endelse (*str == '%') */ @@ -767,7 +781,7 @@ int main(int argc, char *argv[]) char buf[BUFSIZ]; ++curr_line; - if (fgets(buf, sizeof(buf), stdin) == (char *)NULL) + if (fgets(buf, sizeof(buf), stdin) == 0) break; buf[strlen(buf) - 1] = '\0'; _nc_set_source(buf); diff --git a/ncurses/comp_error.c b/ncurses/comp_error.c index 8c4089d3..8517e9a3 100644 --- a/ncurses/comp_error.c +++ b/ncurses/comp_error.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -29,9 +41,11 @@ #include -MODULE_ID("$Id: comp_error.c,v 1.12 1996/12/21 14:24:06 tom Exp $") +MODULE_ID("$Id: comp_error.c,v 1.14 1998/02/11 12:13:53 tom Exp $") -bool _nc_suppress_warnings; +bool _nc_suppress_warnings; +int _nc_curr_line; /* current line # in input */ +int _nc_curr_col; /* current column # in input */ static const char *sourcename; static char termtype[MAX_NAME_SIZE+1]; @@ -58,7 +72,7 @@ static inline void where_is_problem(void) { fprintf (stderr, "\"%s\"", sourcename); if (_nc_curr_line >= 0) - fprintf (stderr, ", line %d", _nc_curr_line); + fprintf (stderr, ", line %d", _nc_curr_line); if (_nc_curr_col >= 0) fprintf (stderr, ", col %d", _nc_curr_col); if (termtype[0]) diff --git a/ncurses/comp_expand.c b/ncurses/comp_expand.c new file mode 100644 index 00000000..6cdf188a --- /dev/null +++ b/ncurses/comp_expand.c @@ -0,0 +1,137 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1998 * + ****************************************************************************/ + +#include + +#include +#include + +MODULE_ID("$Id: comp_expand.c,v 1.4 1998/02/11 12:14:00 tom Exp $") + +static int trailing_spaces(const char *src) +{ + while (*src == ' ') + src++; + return *src == 0; +} + +/* this deals with differences over whether 0x7f and 0x80..0x9f are controls */ +#define CHAR_OF(s) (*(unsigned const char *)(s)) +#define REALCTL(s) (CHAR_OF(s) < 127 && iscntrl(CHAR_OF(s))) +#define REALPRINT(s) (CHAR_OF(s) < 127 && isprint(CHAR_OF(s))) + +char *_nc_tic_expand(const char *srcp, bool tic_format) +{ +static char * buffer; +static size_t length; + +int bufp; +const char *ptr, *str = VALID_STRING(srcp) ? srcp : ""; +bool islong = (strlen(str) > 3); +size_t need = (2 + strlen(str)) * 4; +int ch; + + if (buffer == 0) { + buffer = malloc(length = need); + } else if (need > length) { + buffer = realloc(buffer, length = need); + } + + bufp = 0; + ptr = str; + while ((ch = (*str & 0xff)) != 0) { + if (ch == '%' && REALPRINT(str+1)) { + buffer[bufp++] = *str++; + buffer[bufp++] = *str; + } + else if (ch == 128) { + buffer[bufp++] = '\\'; + buffer[bufp++] = '0'; + } + else if (ch == '\033') { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'E'; + } + else if (ch == '\\' && tic_format && (str == srcp || str[-1] != '^')) { + buffer[bufp++] = '\\'; + buffer[bufp++] = '\\'; + } + else if (ch == ' ' && tic_format && (str == srcp || trailing_spaces(str))) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 's'; + } + else if ((ch == ',' || ch == ':' || ch == '^') && tic_format) { + buffer[bufp++] = '\\'; + buffer[bufp++] = ch; + } + else if (REALPRINT(str) && (ch != ',' && ch != ':' && !(ch == '!' && !tic_format) && ch != '^')) + buffer[bufp++] = ch; +#if 0 /* FIXME: this would be more readable (in fact the whole 'islong' logic should be removed) */ + else if (ch == '\b') { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'b'; + } + else if (ch == '\f') { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'f'; + } + else if (ch == '\t' && islong) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 't'; + } +#endif + else if (ch == '\r' && (islong || (strlen(srcp) > 2 && str[1] == '\0'))) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'r'; + } + else if (ch == '\n' && islong) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'n'; + } +#define UnCtl(c) ((c) + '@') + else if (REALCTL(str) && ch != '\\' && (!islong || isdigit(str[1]))) + { + (void) sprintf(&buffer[bufp], "^%c", UnCtl(ch)); + bufp += 2; + } + else + { + (void) sprintf(&buffer[bufp], "\\%03o", ch); + bufp += 4; + } + + str++; + } + + buffer[bufp] = '\0'; + return(buffer); +} diff --git a/ncurses/comp_hash.c b/ncurses/comp_hash.c index c44a55d0..bd9d52d7 100644 --- a/ncurses/comp_hash.c +++ b/ncurses/comp_hash.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -37,7 +49,7 @@ #define DEBUG(level, params) /*nothing*/ #endif -MODULE_ID("$Id: comp_hash.c,v 1.15 1997/04/26 18:16:19 tom Exp $") +MODULE_ID("$Id: comp_hash.c,v 1.16 1998/02/11 12:13:53 tom Exp $") static int hash_function(const char *); diff --git a/ncurses/comp_parse.c b/ncurses/comp_parse.c index 45e347a2..1b7ae1e8 100644 --- a/ncurses/comp_parse.c +++ b/ncurses/comp_parse.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ @@ -43,7 +55,7 @@ #include #include -MODULE_ID("$Id: comp_parse.c,v 1.18 1996/12/21 14:24:06 tom Exp $") +MODULE_ID("$Id: comp_parse.c,v 1.21 1998/02/11 12:14:00 tom Exp $") static void sanity_check(TERMTYPE *); @@ -487,6 +499,30 @@ static void sanity_check(TERMTYPE *tp) ANDMISSING(label_off, label_on) PAIRED(display_clock, remove_clock) ANDMISSING(set_color_pair, initialize_pair) + + /* Some checks that we should make, but don't want to confuse people + * with. Put those under the tic -v option so we can still get them. + */ + if (_nc_tracing) { + + /* + * From XSI & O'Reilly, we gather that sc/rc are required if csr is + * given, because the cursor position after the scrolling operation is + * performed is undefined. + */ + ANDMISSING(change_scroll_region, save_cursor) + ANDMISSING(change_scroll_region, restore_cursor) + + /* + * Some non-curses applications (e.g., jove) get confused if we have + * both ich/ich1 and smir/rmir. Let's be nice and warn about that, + * too, even though ncurses handles it. + */ + if ((PRESENT(enter_insert_mode) || PRESENT(exit_insert_mode)) + && (PRESENT(insert_character) || PRESENT(parm_ich))) { + _nc_warning("non-curses applications may be confused by ich/ich1 with smir/rmir"); + } + } #undef PAIRED #undef ANDMISSING } diff --git a/ncurses/comp_scan.c b/ncurses/comp_scan.c index 9b15823e..e1258905 100644 --- a/ncurses/comp_scan.c +++ b/ncurses/comp_scan.c @@ -1,22 +1,35 @@ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* * comp_scan.c --- Lexical scanner for terminfo compiler. @@ -36,7 +49,7 @@ #include #include -MODULE_ID("$Id: comp_scan.c,v 1.21 1997/04/24 10:37:34 tom Exp $") +MODULE_ID("$Id: comp_scan.c,v 1.30 1998/02/11 12:14:00 tom Exp $") /* * Maximum length of string capability we'll accept before raising an error. @@ -47,8 +60,6 @@ MODULE_ID("$Id: comp_scan.c,v 1.21 1997/04/24 10:37:34 tom Exp $") #define iswhite(ch) (ch == ' ' || ch == '\t') int _nc_syntax; /* termcap or terminfo? */ -int _nc_curr_line; /* current line # in input */ -int _nc_curr_col; /* current column # in input */ long _nc_curr_file_pos; /* file offset of current line */ long _nc_comment_start; /* start of comment range before name */ long _nc_comment_end; /* end of comment range before name */ @@ -68,7 +79,6 @@ static char pushname[MAX_NAME_SIZE+1]; static int next_char(void); static long stream_pos(void); static bool end_of_stream(void); -static char trans_string(char *); static void push_back(char c); /* Assume we may be looking at a termcap-style continuation */ @@ -343,7 +353,7 @@ start_token: break; case '=': - ch = trans_string(ptr); + ch = _nc_trans_string(ptr); if (ch != separator) _nc_warning("Missing separator"); _nc_curr_token.tk_name = buffer; @@ -436,13 +446,14 @@ end_of_token: * */ -static char -trans_string(char *ptr) +char +_nc_trans_string(char *ptr) { int count = 0; int number; int i, c; chtype ch, last_ch = '\0'; +bool ignored = FALSE; while ((ch = c = next_char()) != (chtype)separator && c != EOF) { if ((_nc_syntax == SYN_TERMCAP) && c == '\n') @@ -456,10 +467,13 @@ chtype ch, last_ch = '\0'; _nc_warning("Illegal ^ character - %s", _tracechar((unsigned char)ch)); } - if (ch == '?') + if (ch == '?') { *(ptr++) = '\177'; - else - *(ptr++) = (char)(ch & 037); + } else { + if ((ch &= 037) == 0) + ch = 128; + *(ptr++) = (char)(ch); + } } else if (ch == '\\') { ch = c = next_char(); @@ -494,6 +508,8 @@ chtype ch, last_ch = '\0'; case 'E': case 'e': *(ptr++) = '\033'; break; + case 'a': *(ptr++) = '\007'; break; + case 'l': case 'n': *(ptr++) = '\n'; break; @@ -509,7 +525,7 @@ chtype ch, last_ch = '\0'; case '\\': *(ptr++) = '\\'; break; - case '^': *(ptr++) = '^'; break; + case '^': *(ptr++) = '^'; break; case ',': *(ptr++) = ','; break; @@ -525,13 +541,18 @@ chtype ch, last_ch = '\0'; } /* endswitch (ch) */ } /* endelse (ch < '0' || ch > '7') */ } /* end else if (ch == '\\') */ - else { + else if (ch == '\n' && (_nc_syntax == SYN_TERMINFO)) { + /* newlines embedded in a terminfo string are ignored */ + ignored = TRUE; + } else { *(ptr++) = (char)ch; } - count ++; - - last_ch = ch; + if (!ignored) { + last_ch = ch; + count ++; + } + ignored = FALSE; if (count > MAXCAPLEN) _nc_warning("Very long string found. Missing separator?"); @@ -549,7 +570,7 @@ chtype ch, last_ch = '\0'; * get_token() call. */ -void _nc_push_token(int class) +void _nc_push_token(int tokclass) { /* * This implementation is kind of bogus, it will fail if we ever do @@ -557,7 +578,7 @@ void _nc_push_token(int class) * relies on the fact that curr_tok is static storage that nothing * but get_token() touches. */ - pushtype = class; + pushtype = tokclass; _nc_get_type(pushname); DEBUG(3, ("pushing token: `%s', class %d", @@ -648,6 +669,7 @@ next_char(void) * don't forget to hack push_back() correspondingly. */ static char line[LEXBUFSIZ]; + size_t len; do { _nc_curr_file_pos = ftell(yyin); @@ -665,6 +687,18 @@ next_char(void) 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') { + bufptr[len-2] = '\n'; + bufptr[len-1] = '\0'; + } + } } first_column = (bufptr == bufstart); @@ -690,7 +724,8 @@ static long stream_pos(void) static bool end_of_stream(void) /* are we at end of input? */ { - return (yyin ? feof(yyin) : (bufptr && *bufptr == '\0')); + return ((yyin ? feof(yyin) : (bufptr && *bufptr == '\0')) + ? TRUE : FALSE); } /* comp_scan.c ends here */ diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h index 5ebf73b9..30ce3fbf 100644 --- a/ncurses/curses.priv.h +++ b/ncurses/curses.priv.h @@ -1,27 +1,39 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* - * $Id: curses.priv.h,v 1.61 1997/04/26 20:54:54 tom Exp $ + * $Id: curses.priv.h,v 1.101 1998/02/11 12:13:57 tom Exp $ * * curses.priv.h * @@ -33,9 +45,13 @@ #ifndef CURSES_PRIV_H #define CURSES_PRIV_H 1 +#ifdef __cplusplus +extern "C" { +#endif + #include -#ifdef USE_RCS_IDS +#if USE_RCS_IDS #define MODULE_ID(id) static const char Ident[] = id; #else #define MODULE_ID(id) /*nothing*/ @@ -74,10 +90,12 @@ #include -#if !HAVE_EXTERN_ERRNO +#if DECL_ERRNO extern int errno; #endif +#include + /* Some systems have a broken 'select()', but workable 'poll()'. Use that */ #if HAVE_POLL && HAVE_SYS_STROPTS_H && HAVE_POLL_H #define USE_FUNC_POLL 1 @@ -92,18 +110,53 @@ extern int errno; #define USE_GPM_SUPPORT 0 #endif +/* QNX mouse support */ +#if defined(__QNX__) && !defined(__QNXNTO__) +#define USE_QNX_MOUSE 1 +#else +#define USE_QNX_MOUSE 0 +#endif + +#define DEFAULT_MAXCLICK 166 +#define EV_MAX 8 /* size of mouse circular event queue */ + /* - * ht/cbt expansion flakes out randomly under Linux 1.1.47, but only when - * we're throwing control codes at the screen at high volume. To see this, - * re-enable TABS_OK and run worm for a while. Other systems probably don't - * want to define this either due to uncertainties about tab delays and - * expansion in raw mode. + * If we don't have signals to support it, don't add a sigwinch handler. + * In any case, resizing is an extended feature. Use it if we've got it. */ -#undef TABS_OK /* OK to use tab/backtab for local motions? */ +#ifndef NCURSES_EXT_FUNCS +#undef HAVE_SIZECHANGE +#endif + +#if HAVE_SIZECHANGE +#define USE_SIZECHANGE 1 +#else +#undef USE_SIGWINCH +#endif /* - * The internal types (e.g., struct screen) must precede , otherwise - * we cannot construct lint-libraries (structures must be fully-defined). + * As currently coded, hashmap relies on the scroll-hints logic. + */ +#if !USE_SCROLL_HINTS +#if USE_HASHMAP +#define USE_SCROLL_HINTS 1 +#else +#define USE_SCROLL_HINTS 0 +#endif +#endif + +#if USE_SCROLL_HINTS +#define if_USE_SCROLL_HINTS(stmt) stmt +#else +#define if_USE_SCROLL_HINTS(stmt) /*nothing*/ +#endif + +/* + * Note: ht/cbt expansion flakes out randomly under Linux 1.1.47, but only + * when we're throwing control codes at the screen at high volume. To see + * this, re-enable USE_HARD_TABS and run worm for a while. Other systems + * probably don't want to define this either due to uncertainties about tab + * delays and expansion in raw mode. */ struct tries { @@ -113,30 +166,6 @@ struct tries { unsigned short value; /* code of string so far. 0 if none. */ }; -/* - * Structure for soft labels. - */ - -typedef struct -{ - char *text; /* text for the label */ - char *form_text; /* formatted text (left/center/...) */ - int x; /* x coordinate of this field */ - char dirty; /* this label has changed */ - char visible; /* field is visible */ -} slk_ent; - -typedef struct { - char dirty; /* all labels have changed */ - char hidden; /* soft labels are hidden */ - struct _win_st *win; - slk_ent *ent; - char *buffer; /* buffer for labels */ - short maxlab; /* number of available labels */ - short labcnt; /* number of allocated labels */ - short maxlen; /* length of labels */ -} SLK; - /* * Definitions for color pairs */ @@ -157,7 +186,38 @@ color_t; #define MAXCOLUMNS 135 #define MAXLINES 66 -#define FIFO_SIZE MAXLINES +#define FIFO_SIZE MAXCOLUMNS+2 /* for nocbreak mode input */ + +#define ACS_LEN 128 + +#define WINDOWLIST struct _win_list + +#include /* we'll use -Ipath directive to get the right one! */ + +/* + * Structure for soft labels. + */ + +typedef struct +{ + char *text; /* text for the label */ + char *form_text; /* formatted text (left/center/...) */ + int x; /* x coordinate of this field */ + char dirty; /* this label has changed */ + char visible; /* field is visible */ +} slk_ent; + +typedef struct { + char dirty; /* all labels have changed */ + char hidden; /* soft labels are hidden */ + struct _win_st *win; + slk_ent *ent; + char* buffer; /* buffer for labels */ + short maxlab; /* number of available labels */ + short labcnt; /* number of allocated labels */ + short maxlen; /* length of labels */ + chtype attr; /* soft label attribute */ +} SLK; struct screen { int _ifd; /* input file ptr for screen */ @@ -169,14 +229,21 @@ struct screen { short _columns; /* screen columns */ short _lines_avail; /* lines available for stdscr */ short _topstolen; /* lines stolen from top */ - struct _win_st *_curscr; /* current screen */ - struct _win_st *_newscr; /* virtual screen to be updated to */ - struct _win_st *_stdscr; /* screen's full-window context */ + + WINDOW *_curscr; /* current screen */ + WINDOW *_newscr; /* virtual screen to be updated to */ + WINDOW *_stdscr; /* screen's full-window context */ + struct tries *_keytry; /* "Try" for use with keypad mode */ + struct tries *_key_ok; /* Disabled keys via keyok(,FALSE) */ + int _tried; /* keypad mode was initialized */ + unsigned int _fifo[FIFO_SIZE]; /* input push-back buffer */ - signed char _fifohead, /* head of fifo queue */ + short _fifohead, /* head of fifo queue */ _fifotail, /* tail of fifo queue */ - _fifopeek; /* where to peek for next char */ + _fifopeek, /* where to peek for next char */ + _fifohold; /* set if breakout marked */ + int _endwin; /* are we out of window mode? */ unsigned long _current_attr; /* terminal attribute current set */ int _coloron; /* is color enabled? */ @@ -190,7 +257,6 @@ struct screen { int _echo; /* True if echo on */ int _use_meta; /* use the meta key? */ SLK *_slk; /* ptr to soft key struct / NULL */ - int _baudrate; /* used to compute padding */ /* cursor movement costs; units are 10ths of milliseconds */ int _char_padding; /* cost of character put */ @@ -198,10 +264,10 @@ struct screen { int _cup_cost; /* cost of (cursor_address) */ int _home_cost; /* cost of (cursor_home) */ int _ll_cost; /* cost of (cursor_to_ll) */ -#ifdef TABS_OK +#if USE_HARD_TABS int _ht_cost; /* cost of (tab) */ int _cbt_cost; /* cost of (backtab) */ -#endif /* TABS_OK */ +#endif /* USE_HARD_TABS */ int _cub1_cost; /* cost of (cursor_left) */ int _cuf1_cost; /* cost of (cursor_right) */ int _cud1_cost; /* cost of (cursor_down) */ @@ -229,22 +295,70 @@ struct screen { int _carriage_return_length; int _cursor_home_length; int _cursor_to_ll_length; + int _scrolling; /* 1 if terminal's smart enough to */ + /* 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 */ int _pair_count; /* count of color pairs */ int _default_color; /* use default colors */ + chtype _xmc_suppress; /* attributes to suppress if xmc */ + chtype _xmc_triggers; /* attributes to process if xmc */ + chtype _acs_map[ACS_LEN]; + + /* + * These data correspond to the state of the idcok() and idlok() + * functions. A caveat is in order here: the XSI and SVr4 + * documentation specify that these functions apply to the window which + * is given as an argument. However, ncurses implements this logic + * only for the newscr/curscr update process, _not_ per-window. + */ + bool _nc_sp_idlok; + bool _nc_sp_idcok; +#define _nc_idlok SP->_nc_sp_idlok +#define _nc_idcok SP->_nc_sp_idcok + + /* + * These are the data that support the mouse interface. + */ + int _maxclick; + bool (*_mouse_event) (SCREEN *); + bool (*_mouse_inline)(SCREEN *); + bool (*_mouse_parse) (int); + void (*_mouse_resume)(SCREEN *); + void (*_mouse_wrap) (SCREEN *); + int _mouse_fd; /* file-descriptor, if any */ + + /* + * This supports automatic resizing + */ +#if USE_SIZECHANGE + int (*_resize)(int,int); +#endif + + /* + * These are data that support the proper handling of the panel stack on an + * per screen basis. + */ + struct panelhook _panelHook; + /* + * Linked-list of all windows, to support '_nc_resizeall()' and + * '_nc_freeall()' + */ + WINDOWLIST *_nc_sp_windows; +#define _nc_windows SP->_nc_sp_windows + + bool _sig_winch; + SCREEN *_next_screen; }; -/* Ncurses' public interface follows the internal types */ -#include /* we'll use -Ipath directive to get the right one! */ +extern SCREEN *_nc_screen_chain; #ifdef NCURSES_NOMACROS #include #endif -#define WINDOWLIST struct _win_list WINDOWLIST { WINDOWLIST *next; WINDOW *win; @@ -304,6 +418,7 @@ typedef struct { #define CHANGED -1 +#define SIZEOF(v) (sizeof(v)/sizeof(v[0])) #define typeCalloc(type,elts) (type *)calloc(elts,sizeof(type)) #define FreeIfNeeded(p) if(p != 0) free(p) #define FreeAndNull(p) free(p); p = 0 @@ -324,38 +439,38 @@ typedef struct { #define T(a) TR(TRACE_CALLS, a) #define TPUTS_TRACE(s) _nc_tputs_trace = s; #define TRACE_RETURN(value,type) return _nc_retrace_##type(value) -#define returnWin(code) TRACE_RETURN(code,win) -#define returnPtr(code) TRACE_RETURN(code,ptr) +#define returnAttr(code) TRACE_RETURN(code,attr_t) #define returnCode(code) TRACE_RETURN(code,int) +#define returnPtr(code) TRACE_RETURN(code,ptr) #define returnVoid T((T_RETURN(""))); return +#define returnWin(code) TRACE_RETURN(code,win) extern unsigned _nc_tracing; extern WINDOW * _nc_retrace_win(WINDOW *); +extern attr_t _nc_retrace_attr_t(attr_t); extern char *_nc_retrace_ptr(char *); extern const char *_nc_tputs_trace; extern const char *_nc_visbuf(const char *); extern const char *_nc_visbuf2(int, const char *); extern int _nc_retrace_int(int); extern long _nc_outchars; +extern void _nc_fifo_dump(void); #else #define T(a) #define TR(n, a) #define TPUTS_TRACE(s) -#define returnWin(code) return code +#define returnAttr(code) return code #define returnCode(code) return code +#define returnPtr(code) return code #define returnVoid return +#define returnWin(code) return code #endif #define _trace_key(ch) ((ch > KEY_MIN) ? keyname(ch) : _tracechar((unsigned char)ch)) #define ALL_BUT_COLOR ((chtype)~(A_COLOR)) #define IGNORE_COLOR_OFF FALSE - - -/* Macro to put together character and attribute info and return it. - If colors are in the attribute, they have precedence. */ -#define ch_or_attr(ch,at) \ - ((PAIR_NUMBER(at) > 0) ? \ - ((((chtype)ch) & ALL_BUT_COLOR) | (at)) : ((((chtype)ch) | (at)))) +#define NONBLANK_ATTR (A_BOLD|A_DIM|A_BLINK) +#define XMC_CHANGES(c) ((c) & SP->_xmc_suppress) #define toggle_attr_on(S,at) \ @@ -394,8 +509,23 @@ extern long _nc_outchars; ? (SP->_ich1_cost * count) \ : INFINITY)) +#if USE_XMC_SUPPORT +#define UpdateAttrs(c) if (SP->_current_attr != AttrOf(c)) { \ + attr_t chg = SP->_current_attr; \ + vidattr(AttrOf(c)); \ + if (magic_cookie_glitch > 0 \ + && XMC_CHANGES((chg ^ SP->_current_attr))) { \ + T(("%s @%d before glitch %d,%d", \ + __FILE__, __LINE__, \ + SP->_cursrow, \ + SP->_curscol)); \ + _nc_do_xmc_glitch(chg); \ + } \ + } +#else #define UpdateAttrs(c) if (SP->_current_attr != AttrOf(c)) \ vidattr(AttrOf(c)); +#endif /* * Check whether the given character can be output by clearing commands. This @@ -403,16 +533,11 @@ extern long _nc_outchars; * as A_REVERSE. All attribute flags which don't affect appearance of a space * or can be output by clearing (A_COLOR in case of bce-terminal) are excluded. */ -#define NONBLANK_ATTR (A_BOLD|A_DIM|A_BLINK) #define can_clear_with(ch) \ ((ch & ~(NONBLANK_ATTR|(back_color_erase ? A_COLOR:0))) == BLANK) #ifdef NCURSES_EXPANDED -#undef ch_or_attr -#define ch_or_attr(ch,at) _nc_ch_or_attr(ch,at) -extern chtype _nc_ch_or_attr(chtype, attr_t); - #undef toggle_attr_on #define toggle_attr_on(S,at) _nc_toggle_attr_on(&(S), at) extern void _nc_toggle_attr_on(attr_t *, attr_t); @@ -443,8 +568,24 @@ extern void _nc_expanded(void); #endif +/* doupdate.c */ +#if USE_XMC_SUPPORT +extern void _nc_do_xmc_glitch(attr_t); +#endif + +/* hardscroll.c */ +#if defined(TRACE) || defined(SCROLLDEBUG) +extern void _nc_linedump(void); +#endif + +/* hardscroll.c */ +#if defined(TRACE) || defined(SCROLLDEBUG) +extern void _nc_linedump(void); +#endif + /* lib_acs.c */ extern void init_acs(void); /* no prefix, this name is traditional */ +extern int _nc_msec_cost(const char *const, int); /* used by 'tack' program */ /* lib_mvcur.c */ #define INFINITY 1000000 /* cost: too high to use */ @@ -452,43 +593,54 @@ extern void init_acs(void); /* no prefix, this name is traditional */ extern void _nc_mvcur_init(void); extern void _nc_mvcur_resume(void); extern void _nc_mvcur_wrap(void); -extern int _nc_mvcur_scrolln(int, int, int, int); + +extern int _nc_scrolln(int, int, int, int); + +extern void _nc_screen_init(void); +extern void _nc_screen_resume(void); +extern void _nc_screen_wrap(void); /* lib_mouse.c */ -extern void _nc_mouse_init(SCREEN *); -extern bool _nc_mouse_event(SCREEN *); -extern bool _nc_mouse_inline(SCREEN *); -extern bool _nc_mouse_parse(int); -extern void _nc_mouse_wrap(SCREEN *); -extern void _nc_mouse_resume(SCREEN *); -extern int _nc_max_click_interval; -extern int _nc_mouse_fd(void); +extern int _nc_has_mouse(void); + +/* safe_sprintf.c */ +extern char * _nc_printf_string(const char *fmt, va_list ap); + +/* softscroll.c */ +extern void _nc_setup_scroll(void); +extern void _nc_perform_scroll(void); + +/* tries.c */ +extern void _nc_add_to_try(struct tries **tree, char *str, unsigned short code); +extern char *_nc_expand_try(struct tries *tree, unsigned short code, size_t len); +extern int _nc_remove_key(struct tries **tree, unsigned short code); /* elsewhere ... */ extern WINDOW *_nc_makenew(int, int, int, int, int); +extern char *_nc_trace_buf(int, size_t); extern chtype _nc_background(WINDOW *); extern chtype _nc_render(WINDOW *, chtype); -extern char *_nc_trace_buf(int, size_t); -extern int _nc_initscr(void); extern int _nc_keypad(bool); extern int _nc_outch(int); extern int _nc_setupscreen(short, short const, FILE *); extern int _nc_timed_wait(int, int, int *); extern int _nc_waddch_nosync(WINDOW *, const chtype); -extern void _nc_backspace(WINDOW *win); -extern void _nc_do_color(int, int (*)(int)); -extern void _nc_freeall(void); +extern void _nc_do_color(int, bool, int (*)(int)); extern void _nc_free_and_exit(int); +extern void _nc_freeall(void); extern void _nc_freewin(WINDOW *win); -extern void _nc_get_screensize(void); extern void _nc_hash_map(void); extern void _nc_outstr(const char *str); extern void _nc_scroll_optimize(void); -extern void _nc_scroll_window(WINDOW *, int const, short const, short const); +extern void _nc_scroll_window(WINDOW *, int const, short const, short const, chtype); extern void _nc_set_buffer(FILE *ofp, bool buffered); extern void _nc_signal_handler(bool); extern void _nc_synchook(WINDOW *win); +#if USE_SIZECHANGE +extern void _nc_update_screensize(void); +#endif + /* * On systems with a broken linker, define 'SP' as a function to force the * linker to pull in the data-only module with 'SP'. @@ -503,16 +655,12 @@ extern SCREEN *_nc_screen(void); extern int _nc_alloc_screen(void); extern void _nc_set_screen(SCREEN *); #else +/* current screen is private data; avoid possible linking conflicts too */ extern SCREEN *SP; #define _nc_alloc_screen() ((SP = typeCalloc(SCREEN, 1)) != 0) #define _nc_set_screen(sp) SP = sp #endif -#if !HAVE_USLEEP -extern int _nc_usleep(unsigned int); -#define usleep(msecs) _nc_usleep(msecs) -#endif - /* * We don't want to use the lines or columns capabilities internally, * because if the application is running multiple screens under @@ -525,6 +673,17 @@ extern int _nc_usleep(unsigned int); extern int _nc_slk_format; /* != 0 if slk_init() called */ extern int _nc_slk_initialize(WINDOW *, int); +/* + * Some constants related to SLK's + */ +#define MAX_SKEY_OLD 8 /* count of soft keys */ +#define MAX_SKEY_LEN_OLD 8 /* max length of soft key text */ +#define MAX_SKEY_PC 12 /* This is what most PC's have */ +#define MAX_SKEY_LEN_PC 5 + +#define MAX_SKEY (SLK_STDFMT ? MAX_SKEY_OLD : MAX_SKEY_PC) +#define MAX_SKEY_LEN (SLK_STDFMT ? MAX_SKEY_LEN_OLD : MAX_SKEY_LEN_PC) + /* Macro to check whether or not we use a standard format */ #define SLK_STDFMT (_nc_slk_format < 3) /* Macro to determine height of label window */ @@ -532,10 +691,8 @@ extern int _nc_slk_initialize(WINDOW *, int); extern int _nc_ripoffline(int line, int (*init)(WINDOW *,int)); -#define UNINITIALISED ((struct tries * ) -1) - -extern bool _nc_idlok, _nc_idcok; - -extern WINDOWLIST *_nc_windows; +#ifdef __cplusplus +} +#endif #endif /* CURSES_PRIV_H */ diff --git a/ncurses/define_key.c b/ncurses/define_key.c new file mode 100644 index 00000000..20dd3e73 --- /dev/null +++ b/ncurses/define_key.c @@ -0,0 +1,54 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1997 * + ****************************************************************************/ + +#include + +MODULE_ID("$Id: define_key.c,v 1.2 1998/02/11 12:13:54 tom Exp $") + +int +define_key(char *str, int keycode) +{ + int code = ERR; + + T((T_CALLED("define_key(%s,%d)"), _nc_visbuf(str), keycode)); + if (keycode > 0) { + if (has_key(keycode)) { + if (_nc_remove_key(&(SP->_keytry), keycode)) + code = OK; + } + if (str != 0) { + (void) _nc_add_to_try(&(SP->_keytry), str, keycode); + code = OK; + } + } + returnCode(code); +} diff --git a/ncurses/fifo_defs.h b/ncurses/fifo_defs.h new file mode 100644 index 00000000..f4dd7be3 --- /dev/null +++ b/ncurses/fifo_defs.h @@ -0,0 +1,59 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * Common macros for lib_getch.c, lib_ungetch.c + * + * $Id: fifo_defs.h,v 1.2 1998/02/11 12:13:56 tom Exp $ + */ + +#ifndef FIFO_DEFS_H +#define FIFO_DEFS_H 1 + +#define head SP->_fifohead +#define tail SP->_fifotail +/* peek points to next uninterpreted character */ +#define peek SP->_fifopeek + +#define h_inc() { head == FIFO_SIZE-1 ? head = 0 : head++; if (head == tail) head = -1, tail = 0;} +#define h_dec() { head == 0 ? head = FIFO_SIZE-1 : head--; if (head == tail) tail = -1;} +#define t_inc() { tail == FIFO_SIZE-1 ? tail = 0 : tail++; if (tail == head) tail = -1;} +#define t_dec() { tail == 0 ? tail = FIFO_SIZE-1 : tail--; if (head == tail) fifo_clear();} +#define p_inc() { peek == FIFO_SIZE-1 ? peek = 0 : peek++;} + +#define cooked_key_in_fifo() (head!=-1 && peek!=head) +#define raw_key_in_fifo() (head!=-1 && peek!=tail) + +#undef HIDE_EINTR + +#endif /* FIFO_DEFS_H */ diff --git a/ncurses/hardscroll.c b/ncurses/hardscroll.c index ea2b693d..f37008e7 100644 --- a/ncurses/hardscroll.c +++ b/ncurses/hardscroll.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /****************************************************************************** @@ -92,59 +104,9 @@ be moved out of order. THE ALGORITHM -First, mark each line on the real screen that is *not* carried over to the -virtual screen discarded (that is, with a -1 oldnum index). - -Second, optionally run through each virtual line with a non -1 oldnum. If the -line is sufficiently changed, mark it -1 (we don't want to move it). The exact -test for "sufficiently changed" is not relevant to the control flow of this -algorithm. Cases the test should detect are those in which rewriting -the line from whatever might be on the real screen would be cheaper than the -move. Blank lines on a terminal with clear-to-eol probably meet this test. - -Here is pseudo-code for the remainder of the algorithm: - - repeat -1: first = 0; -2: no_hunk_moved = TRUE; - - # on each pass, try to find a movable hunk -3: while (first < screen_depth) - - # scan for start of hunk -4: while (oldnum field of first == -1) - first++ - - # if we have no hunk, quit this pass -5: if (first >= screen_depth) - break; - - # we found a hunk -6: last = (end of longest continues oldnum range starting here) - -7: ofirst = (first line's oldnum, where it was on real screen) -8: olast = (last line's oldnum, where it was on real screen) - - # figure the hunk's displacement -9: disp = first - (first virtual line's oldnum field) - - # does the hunk want to move? -10: if (disp != 0) - # is the hunk movable without destroying info? -11: if (real [ofirst+disp, olast+disp] are all in range or DISCARDED) -12: if (disp > 0) -13: scroll real [ofirst, olast+disp] down by disp - (mark [ofirst, olast+disp] DISCARDED) -14: else if (disp < 0) -15: scroll real [ofirst+disp, olast] up by disp - (mark [ofirst+disp, olast] DISCARDED) -16: no_hunk_moved = FALSE - - # done trying to move this hunk -17: first = last + 1; - end while - until -18: no_hunk_moved; # quit when a complete pass finds no movable hunks +The scrolling is done in two passes. The first pass is from top to bottom +scroling hunks UP. The second one is from bottom to top scrolling hunks DOWN. +Obviously enough, no lines to be scrolled will be destroyed. (lav) HOW TO TEST THIS: @@ -178,197 +140,115 @@ a representative sample of cases: AUTHOR Eric S. Raymond , November 1994 + New algorithm by Alexander V. Lukyanov , Aug 1997 *****************************************************************************/ #include -MODULE_ID("$Id: hardscroll.c,v 1.17 1997/02/15 22:33:12 tom Exp $") - -#if defined(TRACE) || defined(SCROLLDEBUG) -void _nc_linedump(void); -#endif /* defined(TRACE) || defined(SCROLLDEBUG) */ - -/* if only this number of lines is carried over, nuke the screen and redraw */ -#define CLEAR_THRESHOLD 3 +MODULE_ID("$Id: hardscroll.c,v 1.29 1998/02/11 12:13:57 tom Exp $") #if defined(SCROLLDEBUG) || defined(HASHDEBUG) -#define LINES 24 -int oldnums[LINES], reallines[LINES]; +int oldnums[MAXLINES]; #define OLDNUM(n) oldnums[n] -#define REAL(m) reallines[m] #undef T #define T(x) (void) printf x ; (void) putchar('\n'); #else #include #define OLDNUM(n) newscr->_line[n].oldindex -#define REAL(m) curscr->_line[m].oldindex #ifndef _NEWINDEX #define _NEWINDEX -1 #endif /* _NEWINDEX */ #endif /* defined(SCROLLDEBUG) || defined(HASHDEBUG) */ -static bool all_discarded(int const top, int const bottom, int const disp) -/* has the given range of real lines been marked discarded? */ -{ - int n; - - for (n = top + disp; n <= bottom + disp; n++) - if (REAL(n) != _NEWINDEX && !(REAL(n) <= bottom && REAL(n) >= top)) - return(FALSE); - - return(TRUE); -} void _nc_scroll_optimize(void) /* scroll optimization to transform curscr to newscr */ { - bool no_hunk_moved; /* no hunk moved on this pass? */ - int n, new_lines; -#if defined(TRACE) || defined(SCROLLDEBUG) - int pass = 0; -#endif /* defined(TRACE) || defined(SCROLLDEBUG) */ + int i; + int start, end, shift; TR(TRACE_ICALLS, ("_nc_scroll_optimize() begins")); - /* mark any line not carried over with _NEWINDEX */ - for (n = 0; n < LINES; n++) - REAL(n) += (MAXLINES + 1); - for (n = 0; n < LINES; n++) - if (OLDNUM(n) != _NEWINDEX - && REAL(OLDNUM(n)) >= MAXLINES) - REAL(OLDNUM(n)) -= (MAXLINES + 1); - for (n = new_lines = 0; n < LINES; n++) - if (REAL(n) > MAXLINES) - { - REAL(n) = _NEWINDEX; - new_lines++; - } - - /* - * ^F in vi (which scrolls forward by LINES-2 in the file) exposes - * a weakness in this design. Ideally, vertical motion - * optimization should cost its actions and then force a - * ClrUpdate() and complete redraw if that would be faster than - * the scroll. Unfortunately, this would be a serious pain to - * arrange; hence, this hack. If there are few enough lines - * carried over, don't bother with the scrolling, we just nuke the - * screen and redraw the whole thing. Keith Bostic argues that - * this will be a win on strictly visual grounds even if the - * resulting update is theoretically sub-optimal. Experience - * with vi says he's probably right. - */ - if (LINES - new_lines <= CLEAR_THRESHOLD) - { - T(("too few lines carried over, nuking screen")); -#if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) - clearok(stdscr, TRUE); -#endif /* !defined(SCROLLDEBUG) && !defined(HASHDEBUG) */ - return; - } - #ifdef TRACE - TR(TRACE_UPDATE | TRACE_MOVE, ("After real line marking:")); if (_nc_tracing & (TRACE_UPDATE | TRACE_MOVE)) _nc_linedump(); #endif /* TRACE */ - /* time to shuffle lines to do scroll optimization */ - do { - int first; /* first line of current hunk */ - int last; /* last line of current hunk */ - int ofirst; /* oldnum index of first line */ - int olast; /* oldnum index of last line */ - int disp; /* hunk displacement */ - - TR(TRACE_UPDATE | TRACE_MOVE, ("Pass %d:", pass++)); - - first = 0; /* start scan at top line */ - no_hunk_moved = TRUE; - - while (first < LINES) - { - /* find the beginning of a hunk */ - while (first < LINES && OLDNUM(first) == _NEWINDEX) - first++; - if (first >= LINES) - break; - - /* find the end of the hunk */ - for (last = first; last < LINES; last++) - if (last == LINES - 1 || OLDNUM(last + 1) != OLDNUM(last) + 1) - break; - - /* find the corresponding range on the old screen */ - ofirst = OLDNUM(first); - olast = OLDNUM(last); - - /* compute the hunk's displacement */ - disp = first - OLDNUM(first); - - TR(TRACE_UPDATE | TRACE_MOVE, ("found hunk: first = %2d, last = %2d, ofirst = %2d, olast = %2d, disp = %2d", - first, last, ofirst, olast, disp)); - - /* OK, time to try to move the hunk? */ - if (disp != 0) - if (all_discarded(ofirst, olast, disp)) - { - int m; - - if (disp > 0) - olast += disp; - else /* (disp < 0) */ - ofirst += disp; - - TR(TRACE_UPDATE | TRACE_MOVE, ("scroll [%d, %d] by %d", ofirst, olast, -disp)); + /* pass 1 - from top to bottom scrolling up */ + for (i = 0; i < screen_lines; ) + { + while (i < screen_lines && (OLDNUM(i) == _NEWINDEX || OLDNUM(i) <= i)) + i++; + if (i >= screen_lines) + break; + + shift = OLDNUM(i) - i; /* shift > 0 */ + start = i; + + i++; + while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i == shift) + i++; + end = i-1 + shift; + + TR(TRACE_UPDATE | TRACE_MOVE, ("scroll [%d, %d] by %d", start, end, shift)); #if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) - if (_nc_mvcur_scrolln(-disp, ofirst, olast, LINES - 1) == ERR) - break; - _nc_scroll_window(curscr, -disp, ofirst, olast); + if (_nc_scrolln(shift, start, end, screen_lines - 1) == ERR) + { + TR(TRACE_UPDATE | TRACE_MOVE, ("unable to scroll")); + continue; + } #endif /* !defined(SCROLLDEBUG) && !defined(HASHDEBUG) */ + } - for (m = ofirst; m <= olast; m++) - { - REAL(m) = _NEWINDEX; + /* pass 2 - from bottom to top scrolling down */ + for (i = screen_lines-1; i >= 0; ) + { + while (i >= 0 && (OLDNUM(i) == _NEWINDEX || OLDNUM(i) >= i)) + i--; + if (i < 0) + break; + + shift = OLDNUM(i) - i; /* shift < 0 */ + end = i; + + i--; + while (i >= 0 && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i == shift) + i--; + start = i+1 - (-shift); + + TR(TRACE_UPDATE | TRACE_MOVE, ("scroll [%d, %d] by %d", start, end, shift)); #if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) - /* - * This will tell the second stage of the optimizer - * that every line in the hunk on the real screen has - * been changed. - */ - curscr->_line[m].firstchar = 0; - curscr->_line[m].lastchar = curscr->_maxx; -#endif /* !defined(SCROLLDEBUG) && !defined(HASHDEBUG) */ - } - for (m = first; m <= last; m++) - OLDNUM(m) = _NEWINDEX; - - no_hunk_moved = FALSE; - } - - /* OK, done with this hunk */ - first = last + 1; + if (_nc_scrolln(shift, start, end, screen_lines - 1) == ERR) + { + TR(TRACE_UPDATE | TRACE_MOVE, ("unable to scroll")); + continue; } - } while - (!no_hunk_moved); +#endif /* !defined(SCROLLDEBUG) && !defined(HASHDEBUG) */ + } } #if defined(TRACE) || defined(SCROLLDEBUG) void _nc_linedump(void) /* dump the state of the real and virtual oldnum fields */ { + static size_t have; + static char *buf; + int n; - char buf[BUFSIZ]; + size_t want = (screen_lines + 1) * 4; - (void) strcpy(buf, "real"); - for (n = 0; n < LINES; n++) - (void) sprintf(buf + strlen(buf), " %02d", REAL(n)); - TR(TRACE_UPDATE | TRACE_MOVE, (buf)); + if (have < want) + buf = malloc(have = want); (void) strcpy(buf, "virt"); - for (n = 0; n < LINES; n++) + for (n = 0; n < screen_lines; n++) (void) sprintf(buf + strlen(buf), " %02d", OLDNUM(n)); TR(TRACE_UPDATE | TRACE_MOVE, (buf)); +#if NO_LEAKS + free(buf); + have = 0; +#endif } #endif /* defined(TRACE) || defined(SCROLLDEBUG) */ @@ -379,16 +259,15 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { char line[BUFSIZ], *st; +#ifdef TRACE _nc_tracing = TRACE_MOVE; +#endif for (;;) { int n; - for (n = 0; n < LINES; n++) - { - reallines[n] = n; + for (n = 0; n < screen_lines; n++) oldnums[n] = _NEWINDEX; - } /* grab the test vector */ if (fgets(line, sizeof(line), stdin) == (char *)NULL) diff --git a/ncurses/hashmap.c b/ncurses/hashmap.c index 184ff1d7..7a929f89 100644 --- a/ncurses/hashmap.c +++ b/ncurses/hashmap.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /****************************************************************************** @@ -35,11 +47,8 @@ vertical-motion optimizer portion of the update logic (see hardscroll.c). Line pairs are recognized by applying a modified Heckel's algorithm, sped up by hashing. If a line hash is unique in both screens, those -lines must be a pair. If the hashes of the two lines immediately following -lines known to be a pair are the same, the following lines are also a pair. -We apply these rules repeatedly until no more pairs are found. The -modifications stem from the fact that there may already be oldindex info -associated with the virtual screen, which has to be respected. +lines must be a pair. Then if the lines just before or after the pair +are the same or similar, they are a pair too. We don't worry about false pairs produced by hash collisions, on the assumption that such cases are rare and will only make the latter stages @@ -59,13 +68,12 @@ AUTHOR #include -MODULE_ID("$Id: hashmap.c,v 1.12 1997/05/03 20:30:06 tom Exp $") +MODULE_ID("$Id: hashmap.c,v 1.24 1998/02/11 12:13:55 tom Exp $") #ifdef HASHDEBUG -#define LINES 24 #define TEXTWIDTH 1 -int oldnums[LINES], reallines[LINES]; -static chtype oldtext[LINES][TEXTWIDTH], newtext[LINES][TEXTWIDTH]; +int oldnums[MAXLINES], reallines[MAXLINES]; +static chtype oldtext[MAXLINES][TEXTWIDTH], newtext[MAXLINES][TEXTWIDTH]; #define OLDNUM(n) oldnums[n] #define REAL(m) reallines[m] #define OLDTEXT(n) oldtext[n] @@ -84,67 +92,216 @@ static chtype oldtext[LINES][TEXTWIDTH], newtext[LINES][TEXTWIDTH]; #endif /* _NEWINDEX */ #endif /* HASHDEBUG */ -/* Chris Torek's hash function (from his DB package). */ -static inline unsigned long hash4(const void *key, size_t len) +static inline unsigned long hash(chtype *text) { - register long h, loop; - register unsigned const char *k; - -#define HASH4a h = (h << 5) - h + *k++; -#define HASH4b h = (h << 5) + h + *k++; -#define HASH4 HASH4b - h = 0; - k = (unsigned const char *)key; - if (len > 0) { - loop = (len + 8 - 1) >> 3; - switch (len & (8 - 1)) { - case 0: - do { /* All fall throughs */ - HASH4; - case 7: - HASH4; - case 6: - HASH4; - case 5: - HASH4; - case 4: - HASH4; - case 3: - HASH4; - case 2: - HASH4; - case 1: - HASH4; - } while (--loop); - } + int i; + chtype ch; + unsigned long result = 0; + for (i = TEXTWIDTH; i>0; i--) + { + ch = *text++; + result += (result<<5) + ch + (ch>>16); } - return ((unsigned long)h); + return result; } -static inline unsigned long hash(chtype *text) +/* approximate update cost */ +static int update_cost(chtype *from,chtype *to) { - return(hash4(text, TEXTWIDTH*sizeof(*text))); + int cost=0; + int i; + + for (i=TEXTWIDTH; i>0; i--) + if (*from++ != *to++) + cost++; + + return cost; } +static int update_cost_from_blank(chtype *to) +{ + int cost=0; + int i; -void _nc_hash_map(void) + /* FIXME: ClrBlank should be used */ + for (i=TEXTWIDTH; i>0; i--) + if (BLANK != *to++) + cost++; + + return cost; +} + +/* + * Returns true when moving line 'from' to line 'to' seems to be cost + * effective. 'blank' indicates whether the line 'to' would become blank. + */ +static inline bool cost_effective(const int from, const int to, const bool blank) { - typedef struct + int new_from; + + if (from == to) + return FALSE; + + new_from = OLDNUM(from); + if (new_from == _NEWINDEX) + new_from = from; + + /* + * On the left side of >= is the cost before moving; + * on the right side -- cost after moving. + */ + return (((blank ? update_cost_from_blank(NEWTEXT(to)) + : update_cost(OLDTEXT(to),NEWTEXT(to))) + + update_cost(OLDTEXT(new_from),NEWTEXT(from))) + >= ((new_from==from ? update_cost_from_blank(NEWTEXT(from)) + : update_cost(OLDTEXT(new_from),NEWTEXT(from))) + + update_cost(OLDTEXT(from),NEWTEXT(to)))) ? TRUE : FALSE; +} + + +typedef struct +{ + unsigned long hashval; + int oldcount, newcount; + int oldindex, newindex; +} + sym; + +static sym *hashtab=0; +static int lines_alloc=0; +static long *oldhash=0; +static long *newhash=0; + +static void grow_hunks(void) +{ + int start, end, shift; + int back_limit, forward_limit; /* limits for cells to fill */ + int back_ref_limit, forward_ref_limit; /* limits for refrences */ + int i; + int next_hunk; + + /* + * This is tricky part. We have unique pairs to use as anchors. + * Use these to deduce the presence of spans of identical lines. + */ + back_limit = 0; + back_ref_limit = 0; + + i = 0; + while (i < screen_lines && OLDNUM(i) == _NEWINDEX) + i++; + for ( ; i < screen_lines; i=next_hunk) { - unsigned long hashval; - int oldcount, newcount; - int oldindex, newindex; + start = i; + shift = OLDNUM(i) - i; + + /* get forward limit */ + i = start+1; + while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i == shift) + i++; + end = i; + while (i < screen_lines && OLDNUM(i) == _NEWINDEX) + i++; + next_hunk = i; + forward_limit = i; + if (i >= screen_lines || OLDNUM(i) >= i) + forward_ref_limit = i; + else + forward_ref_limit = OLDNUM(i); + + i = start-1; + /* grow back */ + if (shift < 0) + back_limit = back_ref_limit + (-shift); + while (i >= back_limit) + { + if(newhash[i] == oldhash[i+shift] + || cost_effective(i+shift, i, shift<0)) + { + OLDNUM(i) = i+shift; + TR(TRACE_UPDATE | TRACE_MOVE, + ("connected new line %d to old line %d (backward continuation)", + i, i+shift)); + } + else + { + TR(TRACE_UPDATE | TRACE_MOVE, + ("not connecting new line %d to old line %d (backward continuation)", + i, i+shift)); + break; + } + i--; + } + + i = end; + /* grow forward */ + if (shift > 0) + forward_limit = forward_ref_limit - shift; + while (i < forward_limit) + { + if(newhash[i] == oldhash[i+shift] + || cost_effective(i+shift, i, shift>0)) + { + OLDNUM(i) = i+shift; + TR(TRACE_UPDATE | TRACE_MOVE, + ("connected new line %d to old line %d (forward continuation)", + i, i+shift)); + } + else + { + TR(TRACE_UPDATE | TRACE_MOVE, + ("not connecting new line %d to old line %d (forward continuation)", + i, i+shift)); + break; + } + i++; + } + + back_ref_limit = back_limit = i; + if (shift > 0) + back_ref_limit += shift; } - sym; - sym hashtab[MAXLINES*2], *sp; +} + +void _nc_hash_map(void) +{ + sym *sp; register int i; - long oldhash[MAXLINES], newhash[MAXLINES]; - bool keepgoing; + int start, shift, size; + + + if (screen_lines > lines_alloc) + { + if (hashtab) + free (hashtab); + hashtab = malloc (sizeof(*hashtab)*(screen_lines+1)*2); + if (!hashtab) + { + if (oldhash) + FreeAndNull(oldhash); + lines_alloc = 0; + return; + } + + if (oldhash) + free (oldhash); + oldhash = malloc (sizeof(*oldhash)*screen_lines*2); + if (!oldhash) + { + if (hashtab) + FreeAndNull(hashtab); + lines_alloc = 0; + return; + } + + lines_alloc = screen_lines; + } + newhash = oldhash + screen_lines; /* two arrays in the same memory block */ /* * Set up and count line-hash values. */ - memset(hashtab, '\0', sizeof(sym) * MAXLINES); - for (i = 0; i < LINES; i++) + memset(hashtab, '\0', sizeof(*hashtab)*(screen_lines+1)*2); + for (i = 0; i < screen_lines; i++) { unsigned long hashval = hash(OLDTEXT(i)); @@ -156,7 +313,7 @@ void _nc_hash_map(void) sp->oldcount++; sp->oldindex = i; } - for (i = 0; i < LINES; i++) + for (i = 0; i < screen_lines; i++) { unsigned long hashval = hash(NEWTEXT(i)); @@ -173,13 +330,14 @@ void _nc_hash_map(void) /* * Mark line pairs corresponding to unique hash pairs. - * Note: we only do this where the new line doesn't - * already have a valid oldindex -- this way we preserve the - * information left in place by the software scrolling functions. + * + * We don't mark lines with offset 0, because it can make fail + * extending hunks by cost_effective. Otherwise, it does not + * have any side effects. */ for (sp = hashtab; sp->hashval; sp++) if (sp->oldcount == 1 && sp->newcount == 1 - && OLDNUM(sp->newindex) == _NEWINDEX) + && sp->oldindex != sp->newindex) { TR(TRACE_UPDATE | TRACE_MOVE, ("new line %d is hash-identical to old line %d (unique)", @@ -187,42 +345,44 @@ void _nc_hash_map(void) OLDNUM(sp->newindex) = sp->oldindex; } + grow_hunks(); + /* - * Now for the tricky part. We have unique pairs to use as anchors. - * Use these to deduce the presence of spans of identical lines. + * Eliminate bad or impossible shifts -- this includes removing + * those hunks which could not grow because of conflicts, as well + * those which are to be moved too far, they are likely to destroy + * more than carry. */ - do { - keepgoing = FALSE; - - for (i = 0; i < LINES-1; i++) - if (OLDNUM(i) != _NEWINDEX && OLDNUM(i+1) == _NEWINDEX) - { - if (OLDNUM(i) + 1 < LINES - && newhash[i+1] == oldhash[OLDNUM(i) + 1]) - { - OLDNUM(i+1) = OLDNUM(i) + 1; - TR(TRACE_UPDATE | TRACE_MOVE, - ("new line %d is hash-identical to old line %d (forward continuation)", - i+1, OLDNUM(i) + 1)); - keepgoing = TRUE; - } - } - - for (i = 0; i < LINES-1; i++) - if (OLDNUM(i) != _NEWINDEX && OLDNUM(i-1) == _NEWINDEX) + for (i = 0; i < screen_lines; ) + { + while (i < screen_lines && OLDNUM(i) == _NEWINDEX) + i++; + if (i >= screen_lines) + break; + start = i; + shift = OLDNUM(i) - i; + i++; + while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i == shift) + i++; + size = i - start; + if (size <= abs(shift)) + { + while (start < i) { - if (OLDNUM(i) - 1 >= 0 - && newhash[i-1] == oldhash[OLDNUM(i) - 1]) - { - OLDNUM(i-1) = OLDNUM(i) - 1; - TR(TRACE_UPDATE | TRACE_MOVE, - ("new line %d is hash-identical to old line %d (backward continuation)", - i-1, OLDNUM(i) - 1)); - keepgoing = TRUE; - } + OLDNUM(start) = _NEWINDEX; + start++; } - } while - (keepgoing); + } + } + + /* After clearing invalid hunks, try grow the rest. */ + grow_hunks(); + +#if NO_LEAKS + FreeAndNull(hashtab); + FreeAndNull(oldhash); + lines_alloc = 0; +#endif } #ifdef HASHDEBUG @@ -230,18 +390,19 @@ void _nc_hash_map(void) int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { - extern void _nc_linedump(void); char line[BUFSIZ], *st; int n; - for (n = 0; n < LINES; n++) + for (n = 0; n < screen_lines; n++) { reallines[n] = n; oldnums[n] = _NEWINDEX; oldtext[n][0] = newtext[n][0] = '.'; } +#ifdef TRACE _nc_tracing = TRACE_MOVE; +#endif for (;;) { /* grab a test command */ @@ -255,7 +416,7 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) break; case 'l': /* get initial line number vector */ - for (n = 0; n < LINES; n++) + for (n = 0; n < screen_lines; n++) { reallines[n] = n; oldnums[n] = _NEWINDEX; @@ -269,9 +430,9 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) break; case 'n': /* use following letters as text of new lines */ - for (n = 0; n < LINES; n++) + for (n = 0; n < screen_lines; n++) newtext[n][0] = '.'; - for (n = 0; n < LINES; n++) + for (n = 0; n < screen_lines; n++) if (line[n+1] == '\n') break; else @@ -279,9 +440,9 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) break; case 'o': /* use following letters as text of old lines */ - for (n = 0; n < LINES; n++) + for (n = 0; n < screen_lines; n++) oldtext[n][0] = '.'; - for (n = 0; n < LINES; n++) + for (n = 0; n < screen_lines; n++) if (line[n+1] == '\n') break; else @@ -289,14 +450,16 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) break; case 'd': /* dump state of test arrays */ +#ifdef TRACE _nc_linedump(); +#endif (void) fputs("Old lines: [", stdout); - for (n = 0; n < LINES; n++) + for (n = 0; n < screen_lines; n++) putchar(oldtext[n][0]); putchar(']'); putchar('\n'); (void) fputs("New lines: [", stdout); - for (n = 0; n < LINES; n++) + for (n = 0; n < screen_lines; n++) putchar(newtext[n][0]); putchar(']'); putchar('\n'); @@ -305,7 +468,9 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) case 'h': /* apply hash mapper and see scroll optimization */ _nc_hash_map(); (void) fputs("Result:\n", stderr); +#ifdef TRACE _nc_linedump(); +#endif _nc_scroll_optimize(); (void) fputs("Done.\n", stderr); break; diff --git a/ncurses/keyok.c b/ncurses/keyok.c new file mode 100644 index 00000000..a0947d9e --- /dev/null +++ b/ncurses/keyok.c @@ -0,0 +1,69 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1997 * + ****************************************************************************/ + +#include + +MODULE_ID("$Id: keyok.c,v 1.2 1998/02/11 12:13:54 tom Exp $") + +/* + * Enable (or disable) ncurses' interpretation of a keycode by adding (or + * removing) the corresponding 'tries' entry. + * + * Do this by storing a second tree of tries, which records the disabled keys. + * The simplest way to copy is to make a function that returns the string (with + * nulls set to 0200), then use that to reinsert the string into the + * corresponding tree. + */ + +int keyok(int c, bool flag) +{ + int code = ERR; + char *s; + + T((T_CALLED("keyok(%d,%d)"), c, flag)); + if (flag) { + if ((s = _nc_expand_try(SP->_key_ok, c, 0)) != 0 + && _nc_remove_key(&(SP->_key_ok), c)) { + _nc_add_to_try(&(SP->_keytry), s, c); + free(s); + code = OK; + } + } else { + if ((s = _nc_expand_try(SP->_keytry, c, 0)) != 0 + && _nc_remove_key(&(SP->_keytry), c)) { + _nc_add_to_try(&(SP->_key_ok), s, c); + free(s); + code = OK; + } + } + returnCode(code); +} diff --git a/ncurses/keys.list b/ncurses/keys.list index f9e3dd65..c11300bd 100644 --- a/ncurses/keys.list +++ b/ncurses/keys.list @@ -1,150 +1,158 @@ -key_a1 KEY_A1 -key_a3 KEY_A3 -key_b2 KEY_B2 -key_backspace KEY_BACKSPACE -key_beg KEY_BEG -key_btab KEY_BTAB -key_c1 KEY_C1 -key_c3 KEY_C3 -key_cancel KEY_CANCEL -key_catab KEY_CATAB -key_clear KEY_CLEAR -key_close KEY_CLOSE -key_command KEY_COMMAND -key_copy KEY_COPY -key_create KEY_CREATE -key_ctab KEY_CTAB -key_dc KEY_DC -key_dl KEY_DL -key_down KEY_DOWN -key_eic KEY_EIC -key_end KEY_END -key_enter KEY_ENTER -key_eol KEY_EOL -key_eos KEY_EOS -key_exit KEY_EXIT -key_f0 KEY_F(0) -key_f1 KEY_F(1) -key_f2 KEY_F(2) -key_f3 KEY_F(3) -key_f4 KEY_F(4) -key_f5 KEY_F(5) -key_f6 KEY_F(6) -key_f7 KEY_F(7) -key_f8 KEY_F(8) -key_f9 KEY_F(9) -key_f10 KEY_F(10) -key_f11 KEY_F(11) -key_f12 KEY_F(12) -key_f13 KEY_F(13) -key_f14 KEY_F(14) -key_f15 KEY_F(15) -key_f16 KEY_F(16) -key_f17 KEY_F(17) -key_f18 KEY_F(18) -key_f19 KEY_F(19) -key_f20 KEY_F(20) -key_f21 KEY_F(21) -key_f22 KEY_F(22) -key_f23 KEY_F(23) -key_f24 KEY_F(24) -key_f25 KEY_F(25) -key_f26 KEY_F(26) -key_f27 KEY_F(27) -key_f28 KEY_F(28) -key_f29 KEY_F(29) -key_f30 KEY_F(30) -key_f31 KEY_F(31) -key_f32 KEY_F(32) -key_f33 KEY_F(33) -key_f34 KEY_F(34) -key_f35 KEY_F(35) -key_f36 KEY_F(36) -key_f37 KEY_F(37) -key_f38 KEY_F(38) -key_f39 KEY_F(39) -key_f40 KEY_F(40) -key_f41 KEY_F(41) -key_f42 KEY_F(42) -key_f43 KEY_F(43) -key_f44 KEY_F(44) -key_f45 KEY_F(45) -key_f46 KEY_F(46) -key_f47 KEY_F(47) -key_f48 KEY_F(48) -key_f49 KEY_F(49) -key_f50 KEY_F(50) -key_f51 KEY_F(51) -key_f52 KEY_F(52) -key_f53 KEY_F(53) -key_f54 KEY_F(54) -key_f55 KEY_F(55) -key_f56 KEY_F(56) -key_f57 KEY_F(57) -key_f58 KEY_F(58) -key_f59 KEY_F(59) -key_f60 KEY_F(60) -key_f61 KEY_F(61) -key_f62 KEY_F(62) -key_f63 KEY_F(63) -key_find KEY_FIND -key_help KEY_HELP -key_home KEY_HOME -key_ic KEY_IC -key_il KEY_IL -key_left KEY_LEFT -key_ll KEY_LL -key_mark KEY_MARK -key_message KEY_MESSAGE -key_move KEY_MOVE -key_next KEY_NEXT -key_npage KEY_NPAGE -key_open KEY_OPEN -key_options KEY_OPTIONS -key_ppage KEY_PPAGE -key_previous KEY_PREVIOUS -key_print KEY_PRINT -key_redo KEY_REDO -key_reference KEY_REFERENCE -key_refresh KEY_REFRESH -key_replace KEY_REPLACE -key_restart KEY_RESTART -key_resume KEY_RESUME -key_right KEY_RIGHT -key_save KEY_SAVE -key_sbeg KEY_SBEG -key_scancel KEY_SCANCEL -key_scommand KEY_SCOMMAND -key_scopy KEY_SCOPY -key_screate KEY_SCREATE -key_sdc KEY_SDC -key_sdl KEY_SDL -key_select KEY_SELECT -key_send KEY_SEND -key_seol KEY_SEOL -key_sexit KEY_SEXIT -key_sf KEY_SF -key_sfind KEY_SFIND -key_shelp KEY_SHELP -key_shome KEY_SHOME -key_sic KEY_SIC -key_sleft KEY_SLEFT -key_smessage KEY_SMESSAGE -key_smove KEY_SMOVE -key_snext KEY_SNEXT -key_soptions KEY_SOPTIONS -key_sprevious KEY_SPREVIOUS -key_sprint KEY_SPRINT -key_sr KEY_SR -key_sredo KEY_SREDO -key_sreplace KEY_SREPLACE -key_sright KEY_SRIGHT -key_srsume KEY_SRSUME -key_ssave KEY_SSAVE -key_ssuspend KEY_SSUSPEND -key_stab KEY_STAB -key_sundo KEY_SUNDO -key_suspend KEY_SUSPEND -key_undo KEY_UNDO -key_up KEY_UP -key_mouse KEY_MOUSE +# $Id: keys.list,v 1.5 1997/10/25 21:05:24 tom Exp $ +# The first column is the #define symbol that is in curses.h +# The second column is the term.h symbol, for terminfo +# Not all keycodes have corresponding terminfo capabilities. +KEY_A1 key_a1 +KEY_A3 key_a3 +KEY_B2 key_b2 +KEY_BACKSPACE key_backspace +KEY_BEG key_beg +KEY_BREAK +KEY_BTAB key_btab +KEY_C1 key_c1 +KEY_C3 key_c3 +KEY_CANCEL key_cancel +KEY_CATAB key_catab +KEY_CLEAR key_clear +KEY_CLOSE key_close +KEY_COMMAND key_command +KEY_COPY key_copy +KEY_CREATE key_create +KEY_CTAB key_ctab +KEY_DC key_dc +KEY_DL key_dl +KEY_DOWN key_down +KEY_EIC key_eic +KEY_END key_end +KEY_ENTER key_enter +KEY_EOL key_eol +KEY_EOS key_eos +KEY_EXIT key_exit +KEY_F(0) key_f0 +KEY_F(1) key_f1 +KEY_F(10) key_f10 +KEY_F(11) key_f11 +KEY_F(12) key_f12 +KEY_F(13) key_f13 +KEY_F(14) key_f14 +KEY_F(15) key_f15 +KEY_F(16) key_f16 +KEY_F(17) key_f17 +KEY_F(18) key_f18 +KEY_F(19) key_f19 +KEY_F(2) key_f2 +KEY_F(20) key_f20 +KEY_F(21) key_f21 +KEY_F(22) key_f22 +KEY_F(23) key_f23 +KEY_F(24) key_f24 +KEY_F(25) key_f25 +KEY_F(26) key_f26 +KEY_F(27) key_f27 +KEY_F(28) key_f28 +KEY_F(29) key_f29 +KEY_F(3) key_f3 +KEY_F(30) key_f30 +KEY_F(31) key_f31 +KEY_F(32) key_f32 +KEY_F(33) key_f33 +KEY_F(34) key_f34 +KEY_F(35) key_f35 +KEY_F(36) key_f36 +KEY_F(37) key_f37 +KEY_F(38) key_f38 +KEY_F(39) key_f39 +KEY_F(4) key_f4 +KEY_F(40) key_f40 +KEY_F(41) key_f41 +KEY_F(42) key_f42 +KEY_F(43) key_f43 +KEY_F(44) key_f44 +KEY_F(45) key_f45 +KEY_F(46) key_f46 +KEY_F(47) key_f47 +KEY_F(48) key_f48 +KEY_F(49) key_f49 +KEY_F(5) key_f5 +KEY_F(50) key_f50 +KEY_F(51) key_f51 +KEY_F(52) key_f52 +KEY_F(53) key_f53 +KEY_F(54) key_f54 +KEY_F(55) key_f55 +KEY_F(56) key_f56 +KEY_F(57) key_f57 +KEY_F(58) key_f58 +KEY_F(59) key_f59 +KEY_F(6) key_f6 +KEY_F(60) key_f60 +KEY_F(61) key_f61 +KEY_F(62) key_f62 +KEY_F(63) key_f63 +KEY_F(7) key_f7 +KEY_F(8) key_f8 +KEY_F(9) key_f9 +KEY_FIND key_find +KEY_HELP key_help +KEY_HOME key_home +KEY_IC key_ic +KEY_IL key_il +KEY_LEFT key_left +KEY_LL key_ll +KEY_MARK key_mark +KEY_MESSAGE key_message +KEY_MOUSE key_mouse +KEY_MOVE key_move +KEY_NEXT key_next +KEY_NPAGE key_npage +KEY_OPEN key_open +KEY_OPTIONS key_options +KEY_PPAGE key_ppage +KEY_PREVIOUS key_previous +KEY_PRINT key_print +KEY_REDO key_redo +KEY_REFERENCE key_reference +KEY_REFRESH key_refresh +KEY_REPLACE key_replace +KEY_RESET +KEY_RESIZE +KEY_RESTART key_restart +KEY_RESUME key_resume +KEY_RIGHT key_right +KEY_SAVE key_save +KEY_SBEG key_sbeg +KEY_SCANCEL key_scancel +KEY_SCOMMAND key_scommand +KEY_SCOPY key_scopy +KEY_SCREATE key_screate +KEY_SDC key_sdc +KEY_SDL key_sdl +KEY_SELECT key_select +KEY_SEND key_send +KEY_SEOL key_seol +KEY_SEXIT key_sexit +KEY_SF key_sf +KEY_SFIND key_sfind +KEY_SHELP key_shelp +KEY_SHOME key_shome +KEY_SIC key_sic +KEY_SLEFT key_sleft +KEY_SMESSAGE key_smessage +KEY_SMOVE key_smove +KEY_SNEXT key_snext +KEY_SOPTIONS key_soptions +KEY_SPREVIOUS key_sprevious +KEY_SPRINT key_sprint +KEY_SR key_sr +KEY_SREDO key_sredo +KEY_SREPLACE key_sreplace +KEY_SRESET +KEY_SRIGHT key_sright +KEY_SRSUME key_srsume +KEY_SSAVE key_ssave +KEY_SSUSPEND key_ssuspend +KEY_STAB key_stab +KEY_SUNDO key_sundo +KEY_SUSPEND key_suspend +KEY_UNDO key_undo +KEY_UP key_up diff --git a/ncurses/lib_acs.c b/ncurses/lib_acs.c index bacfe058..a1f7c03f 100644 --- a/ncurses/lib_acs.c +++ b/ncurses/lib_acs.c @@ -1,32 +1,44 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ #include #include /* ena_acs, acs_chars */ -MODULE_ID("$Id: lib_acs.c,v 1.8 1997/04/24 11:04:07 tom Exp $") +MODULE_ID("$Id: lib_acs.c,v 1.13 1998/02/11 12:13:57 tom Exp $") -chtype acs_map[128]; +chtype acs_map[ACS_LEN]; void init_acs(void) { @@ -79,7 +91,7 @@ void init_acs(void) #endif /* ena_acs */ #ifdef acs_chars -#define ALTCHAR(c) (TextOf(c) | A_ALTCHARSET) +#define ALTCHAR(c) ((chtype)(((unsigned char)(c)) | A_ALTCHARSET)) if (acs_chars != NULL) { size_t i = 0; @@ -92,7 +104,7 @@ void init_acs(void) case 'q':case 'x':case 'n':case 'o': case 's':case '`':case 'a':case 'f': case 'g':case '~':case ',':case '+': - case '.':case '-':case 'h':case 'I': + case '.':case '-':case 'h':case 'i': case '0':case 'p':case 'r':case 'y': case 'z':case '{':case '|':case '}': acs_map[(unsigned int)acs_chars[i]] = @@ -105,7 +117,6 @@ void init_acs(void) } } #ifdef TRACE -#define SIZEOF(v) (sizeof(v)/sizeof(v[0])) /* Show the equivalent mapping, noting if it does not match the * given attribute, whether by re-ordering or duplication. */ diff --git a/ncurses/lib_adabind.c b/ncurses/lib_adabind.c index aea6f1a5..e049b2b0 100644 --- a/ncurses/lib_adabind.c +++ b/ncurses/lib_adabind.c @@ -1,35 +1,48 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Juergen Pfeifer 1996,1997 * + ****************************************************************************/ /* -** lib_adabind.c -** -** Some small wrappers to ease the implementation of an Ada95 -** binding. Especially functionalities only available as macros -** in (n)curses are wrapped here by functions. -** See the documentation and copyright notices in the ../Ada95 -** subdirectory. +// lib_adabind.c +// +// Some small wrappers to ease the implementation of an Ada95 +// binding. Especially functionalities only available as macros +// in (n)curses are wrapped here by functions. +// See the documentation and copyright notices in the ../Ada95 +// subdirectory. */ #include "curses.priv.h" +MODULE_ID("$Id: lib_adabind.c,v 1.7 1998/02/11 12:13:59 tom Exp $") + /* In (n)curses are a few functionalities that can't be expressed as // functions, because for historic reasons they use as macro argument // variable names that are "out" parameters. For those macros we provide @@ -37,18 +50,18 @@ */ /* Prototypes for the functions in this module */ -int _nc_ada_getmaxyx (WINDOW *win, int *y, int *x); -int _nc_ada_getbegyx (WINDOW *win, int *y, int *x); -int _nc_ada_getyx (WINDOW *win, int *y, int *x); -int _nc_ada_getparyx (WINDOW *win, int *y, int *x); -int _nc_ada_isscroll (WINDOW *win); -int _nc_ada_coord_transform (WINDOW *win, int *Y, int *X, int dir); +int _nc_ada_getmaxyx (const WINDOW *win, int *y, int *x); +int _nc_ada_getbegyx (const WINDOW *win, int *y, int *x); +int _nc_ada_getyx (const WINDOW *win, int *y, int *x); +int _nc_ada_getparyx (const WINDOW *win, int *y, int *x); +int _nc_ada_isscroll (const WINDOW *win); +int _nc_ada_coord_transform (const WINDOW *win, int *Y, int *X, int dir); void _nc_ada_mouse_event (mmask_t m, int *b, int *s); int _nc_ada_mouse_mask (int button, int state, mmask_t *mask); void _nc_ada_unregister_mouse (void); +int _nc_ada_vcheck (int major, int minor); - -int _nc_ada_getmaxyx (WINDOW *win, int *y, int *x) +int _nc_ada_getmaxyx (const WINDOW *win, int *y, int *x) { if (win && y && x) { @@ -59,7 +72,7 @@ int _nc_ada_getmaxyx (WINDOW *win, int *y, int *x) return ERR; } -int _nc_ada_getbegyx (WINDOW *win, int *y, int *x) +int _nc_ada_getbegyx (const WINDOW *win, int *y, int *x) { if (win && y && x) { @@ -70,7 +83,7 @@ int _nc_ada_getbegyx (WINDOW *win, int *y, int *x) return ERR; } -int _nc_ada_getyx (WINDOW *win, int *y, int *x) +int _nc_ada_getyx (const WINDOW *win, int *y, int *x) { if (win && y && x) { @@ -81,7 +94,7 @@ int _nc_ada_getyx (WINDOW *win, int *y, int *x) return ERR; } -int _nc_ada_getparyx (WINDOW *win, int *y, int *x) +int _nc_ada_getparyx (const WINDOW *win, int *y, int *x) { if (win && y && x) { @@ -92,12 +105,12 @@ int _nc_ada_getparyx (WINDOW *win, int *y, int *x) return ERR; } -int _nc_ada_isscroll (WINDOW *win) +int _nc_ada_isscroll (const WINDOW *win) { return win ? (win->_scroll ? TRUE : FALSE) : ERR; } -int _nc_ada_coord_transform( WINDOW *win, int *Y, int *X, int dir) +int _nc_ada_coord_transform (const WINDOW *win, int *Y, int *X, int dir) { if (win && Y && X) { @@ -213,8 +226,21 @@ int _nc_ada_mouse_mask ( int button, int state, mmask_t *mask ) return OK; } -void _nc_ada_unregister_mouse (void) +/* + * Allow Ada to check whether or not we are the correct library version + * for the binding. It calls this routine with the version it requests + * and this routine returns a 1 if it is a correct version, a 2 if the + * major version is correct but the minor version of the library differs + * and a 0 if the versions don't match. + */ +int _nc_ada_vcheck (int major, int minor) { - _nc_mouse_wrap(SP); + if (major==NCURSES_VERSION_MAJOR) { + if (minor==NCURSES_VERSION_MINOR) + return 1; + else + return 2; + } + else + return 0; } - diff --git a/ncurses/lib_addch.c b/ncurses/lib_addch.c index e2e58190..859c9caa 100644 --- a/ncurses/lib_addch.c +++ b/ncurses/lib_addch.c @@ -1,66 +1,47 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* ** lib_addch.c ** -** The routines waddch(), wattr_on(), wattr_off(), wchgat(). +** The routine waddch(). ** */ #include #include -MODULE_ID("$Id: lib_addch.c,v 1.30 1997/04/12 17:45:55 tom Exp $") - -int wattr_on(WINDOW *win, const attr_t at) -{ - T((T_CALLED("wattr_on(%p,%s)"), win, _traceattr(at))); - T(("... current %s", _traceattr(win->_attrs))); - toggle_attr_on(win->_attrs,at); - returnCode(OK); -} - -int wattr_off(WINDOW *win, const attr_t at) -{ - T((T_CALLED("wattr_off(%p,%s)"), win, _traceattr(at))); - T(("... current %s", _traceattr(win->_attrs))); - toggle_attr_off(win->_attrs,at); - returnCode(OK); -} - -int wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED) -{ - int i; - - T((T_CALLED("wchgat(%p,%d,%s,%d)"), win, n, _traceattr(attr), color)); - - toggle_attr_on(attr,COLOR_PAIR(color)); - - for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++) - win->_line[win->_cury].text[i] - = ch_or_attr(TextOf(win->_line[win->_cury].text[i]),attr); - - returnCode(OK); -} +MODULE_ID("$Id: lib_addch.c,v 1.39 1998/02/11 12:13:57 tom Exp $") /* * Ugly microtweaking alert. Everything from here to end of module is @@ -72,14 +53,29 @@ int wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UN * window sync hook, for use by string-put functions. */ +/* Return bit mask for clearing color pair number if given ch has color */ +#define COLOR_MASK(ch) (~(chtype)((ch)&A_COLOR?A_COLOR:0)) + static inline chtype render_char(WINDOW *win, chtype ch) /* compute a rendition of the given char correct for the current context */ { - if (TextOf(ch) == ' ') - ch = ch_or_attr(ch, win->_bkgd); - else if (!(ch & A_ATTRIBUTES)) - ch = ch_or_attr(ch, (win->_bkgd & A_ATTRIBUTES)); - TR(TRACE_VIRTPUT, ("bkg = %#lx -> ch = %#lx", win->_bkgd, ch)); + chtype a = win->_attrs; + + if (ch == ' ') + { + /* color in attrs has precedence over bkgd */ + ch = a | (win->_bkgd & COLOR_MASK(a)); + } + else + { + /* color in attrs has precedence over bkgd */ + a |= (win->_bkgd & A_ATTRIBUTES) & COLOR_MASK(a); + /* color in ch has precedence */ + ch |= (a & COLOR_MASK(ch)); + } + + TR(TRACE_VIRTPUT, ("bkg = %lx, attrs = %lx -> ch = %lx", win->_bkgd, + win->_attrs, ch)); return(ch); } @@ -87,18 +83,17 @@ static inline chtype render_char(WINDOW *win, chtype ch) chtype _nc_background(WINDOW *win) /* make render_char() visible while still allowing us to inline it below */ { - return(render_char(win, BLANK)); + return (win->_bkgd); } chtype _nc_render(WINDOW *win, chtype ch) /* make render_char() visible while still allowing us to inline it below */ { - chtype c = render_char(win,ch); - return (ch_or_attr(c,win->_attrs)); + return render_char(win, ch); } /* check if position is legal; if not, return error */ -#ifdef NDEBUG /* treat this like an assertion */ +#ifndef NDEBUG /* treat this like an assertion */ #define CHECK_POSITION(win, x, y) \ if (y > win->_maxy \ || x > win->_maxx \ @@ -116,12 +111,12 @@ chtype _nc_render(WINDOW *win, chtype ch) static inline int waddch_literal(WINDOW *win, chtype ch) { -register int x, y; + int x; + struct ldat *line; x = win->_curx; - y = win->_cury; - CHECK_POSITION(win, x, y); + CHECK_POSITION(win, x, win->_cury); /* * If we're trying to add a character at the lower-right corner more @@ -134,21 +129,20 @@ register int x, y; } ch = render_char(win, ch); - ch = ch_or_attr(ch,win->_attrs); TR(TRACE_VIRTPUT, ("win attr = %s", _traceattr(win->_attrs))); - if (win->_line[y].text[x] != ch) { - if (win->_line[y].firstchar == _NOCHANGE) - win->_line[y].firstchar = win->_line[y].lastchar = x; - else if (x < win->_line[y].firstchar) - win->_line[y].firstchar = x; - else if (x > win->_line[y].lastchar) - win->_line[y].lastchar = x; - - } - - win->_line[y].text[x++] = ch; - TR(TRACE_VIRTPUT, ("(%d, %d) = %s", y, x, _tracechtype(ch))); + line = win->_line+win->_cury; + + if (line->firstchar == _NOCHANGE) + line->firstchar = line->lastchar = x; + else if (x < line->firstchar) + line->firstchar = x; + else if (x > line->lastchar) + line->lastchar = x; + + line->text[x++] = ch; + + TR(TRACE_VIRTPUT, ("(%d, %d) = %s", win->_cury, x, _tracechtype(ch))); if (x > win->_maxx) { /* * The _WRAPPED flag is useful only for telling an application @@ -161,42 +155,37 @@ register int x, y; * add a character to the lower-right corner. */ win->_flags |= _WRAPPED; - if (++y > win->_regbottom) { - y = win->_regbottom; - x = win->_maxx; - if (win->_scroll) - scroll(win); - else { - win->_curx = x; - win->_cury = y; + if (++win->_cury > win->_regbottom) { + win->_cury = win->_regbottom; + win->_curx = win->_maxx; + if (!win->_scroll) return (ERR); - } + scroll(win); } - x = 0; + win->_curx = 0; + return (OK); } - win->_curx = x; - win->_cury = y; - return OK; } static inline -int waddch_nosync(WINDOW *win, const chtype c) +int waddch_nosync(WINDOW *win, const chtype ch) /* the workhorse function -- add a character to the given window */ { -register chtype ch = c; -register int x, y; + int x, y; + int t; + const char *s; + + if ((ch & A_ALTCHARSET) + || ((t = TextOf(ch)) > 127) + || ((s = unctrl(t))[1] == 0)) + return waddch_literal(win, ch); x = win->_curx; y = win->_cury; - CHECK_POSITION(win, x, y); - - if (ch & A_ALTCHARSET) - goto noctrl; - - switch ((int)TextOf(ch)) { + switch (t) { case '\t': x += (TABSIZE-(x%TABSIZE)); @@ -206,8 +195,9 @@ register int x, y; */ if ((! win->_scroll && (y == win->_regbottom)) || (x <= win->_maxx)) { + chtype blank = (' ' | AttrOf(ch)); while (win->_curx < x) { - if (waddch_literal(win, (' ' | AttrOf(ch))) == ERR) + if (waddch_literal(win, blank) == ERR) return(ERR); } break; @@ -241,18 +231,16 @@ register int x, y; win->_flags &= ~_WRAPPED; break; case '\b': - if (x > 0) { - x--; - win->_flags &= ~_WRAPPED; - } + if (x == 0) + return (OK); + x--; + win->_flags &= ~_WRAPPED; break; default: - if (is7bits(TextOf(ch)) && iscntrl(TextOf(ch))) - return(waddstr(win, unctrl((unsigned char)ch))); - - /* FALLTHRU */ - noctrl: - return waddch_literal(win, ch); + while (*s) + if (waddch_literal(win, (*s++)|AttrOf(ch)) == ERR) + return ERR; + return(OK); } win->_curx = x; @@ -281,7 +269,7 @@ int waddch(WINDOW *win, const chtype ch) TR(TRACE_VIRTPUT|TRACE_CCALLS, (T_CALLED("waddch(%p, %s)"), win, _tracechtype(ch))); - if (waddch_nosync(win, ch) != ERR) + if (win && (waddch_nosync(win, ch) != ERR)) { _nc_synchook(win); code = OK; @@ -297,7 +285,7 @@ int wechochar(WINDOW *win, const chtype ch) TR(TRACE_VIRTPUT|TRACE_CCALLS, (T_CALLED("wechochar(%p, %s)"), win, _tracechtype(ch))); - if (waddch_literal(win, ch) != ERR) + if (win && (waddch_nosync(win, ch) != ERR)) { bool save_immed = win->_immed; win->_immed = TRUE; diff --git a/ncurses/lib_addstr.c b/ncurses/lib_addstr.c index 363d2787..42e4a21d 100644 --- a/ncurses/lib_addstr.c +++ b/ncurses/lib_addstr.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* ** lib_addstr.c @@ -28,7 +40,7 @@ #include -MODULE_ID("$Id: lib_addstr.c,v 1.11 1997/03/08 21:38:52 tom Exp $") +MODULE_ID("$Id: lib_addstr.c,v 1.14 1998/02/11 12:13:54 tom Exp $") int waddnstr(WINDOW *win, const char *const astr, int n) @@ -37,24 +49,23 @@ unsigned const char *str = (unsigned const char *)astr; int code = ERR; T((T_CALLED("waddnstr(%p,%s,%d)"), win, _nc_visbuf(astr), n)); - T(("... current %s", _traceattr(win->_attrs))); - - if (str != 0) { - - TR(TRACE_VIRTPUT, ("str is not null")); - code = OK; - if (n < 0) - n = (int)strlen(astr); - - while((n-- > 0) && (*str != '\0')) { - TR(TRACE_VIRTPUT, ("*str = %#x", *str)); - if (_nc_waddch_nosync(win, (chtype)*str++) == ERR) { - code = ERR; - break; - } - } + + if (win && (str != 0)) { + T(("... current %s", _traceattr(win->_attrs))); + TR(TRACE_VIRTPUT, ("str is not null")); + code = OK; + if (n < 0) + n = (int)strlen(astr); + + while((n-- > 0) && (*str != '\0')) { + TR(TRACE_VIRTPUT, ("*str = %#x", *str)); + if (_nc_waddch_nosync(win, (chtype)*str++) == ERR) { + code = ERR; + break; + } + } + _nc_synchook(win); } - _nc_synchook(win); TR(TRACE_VIRTPUT, ("waddnstr returns %d", code)); returnCode(code); } @@ -62,29 +73,41 @@ int code = ERR; int waddchnstr(WINDOW *win, const chtype *const astr, int n) { -short oy = win->_cury; -short ox = win->_curx; -const chtype *str = (const chtype *)astr; +short y = win->_cury; +short x = win->_curx; int code = OK; - T((T_CALLED("waddchnstr(%p,%p,%d)"), win, str, n)); + T((T_CALLED("waddchnstr(%p,%p,%d)"), win, astr, n)); + + if (!win) + returnCode(ERR); if (n < 0) { + const chtype *str; n = 0; - while (*str++ != 0) + for (str=(const chtype *)astr; *str!=0; str++) n++; - str = (const chtype *)astr; } + if (n > win->_maxx - x + 1) + n = win->_maxx - x + 1; + if (n == 0) + returnCode(code); - while(n-- > 0) { - if (_nc_waddch_nosync(win, *str++) == ERR) { - code = ERR; - break; - } + if (win->_line[y].firstchar == _NOCHANGE) + { + win->_line[y].firstchar = x; + win->_line[y].lastchar = x+n-1; + } + else + { + if (x < win->_line[y].firstchar) + win->_line[y].firstchar = x; + if (x+n-1 > win->_line[y].lastchar) + win->_line[y].lastchar = x+n-1; } + + memcpy(win->_line[y].text+x, astr, n*sizeof(*astr)); - win->_curx = ox; - win->_cury = oy; _nc_synchook(win); returnCode(code); } diff --git a/ncurses/lib_baudrate.c b/ncurses/lib_baudrate.c index 333fd035..dca02ff7 100644 --- a/ncurses/lib_baudrate.c +++ b/ncurses/lib_baudrate.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -28,7 +40,7 @@ #include #include /* cur_term, pad_char */ -MODULE_ID("$Id: lib_baudrate.c,v 1.7 1997/04/26 17:41:48 tom Exp $") +MODULE_ID("$Id: lib_baudrate.c,v 1.11 1998/02/11 12:13:58 tom Exp $") /* * int @@ -58,37 +70,32 @@ static struct speed const speeds[] = { {B2400, 2400}, {B4800, 4800}, {B9600, 9600}, -#define MAX_BAUD B9600 #ifdef B19200 -#undef MAX_BAUD -#define MAX_BAUD B19200 {B19200, 19200}, #else #ifdef EXTA -#define MAX_BAUD EXTA {EXTA, 19200}, #endif #endif #ifdef B38400 -#undef MAX_BAUD -#define MAX_BAUD B38400 {B38400, 38400}, #else #ifdef EXTB -#define MAX_BAUD EXTB {EXTB, 38400}, #endif #endif #ifdef B57600 -#undef MAX_BAUD -#define MAX_BAUD B57600 {B57600, 57600}, #endif #ifdef B115200 -#undef MAX_BAUD -#define MAX_BAUD B115200 {B115200, 115200}, #endif +#ifdef B230400 + {B230400, 230400}, +#endif +#ifdef B460800 + {B460800, 460800}, +#endif }; int @@ -108,7 +115,7 @@ char *debug_rate; * that take into account costs that depend on baudrate. */ #ifdef TRACE - if (!isatty(fileno(SP->_ofp)) + if (SP && !isatty(fileno(SP->_ofp)) && (debug_rate = getenv("BAUDRATE")) != 0) { if (sscanf(debug_rate, "%d", &ret) != 1) ret = 9600; @@ -122,14 +129,14 @@ char *debug_rate; #else ret = cur_term->Nttyb.sg_ospeed; #endif - if(ret < 0 || ret > MAX_BAUD) + if(ret < 0 || (speed_t)ret > speeds[SIZEOF(speeds)-1].s) returnCode(ERR); - SP->_baudrate = ERR; - for (i = 0; i < (sizeof(speeds) / sizeof(struct speed)); i++) + cur_term->_baudrate = ERR; + for (i = 0; i < SIZEOF(speeds); i++) if (speeds[i].s == (speed_t)ret) { - SP->_baudrate = speeds[i].sp; + cur_term->_baudrate = speeds[i].sp; break; } - returnCode(SP->_baudrate); + returnCode(cur_term->_baudrate); } diff --git a/ncurses/lib_beep.c b/ncurses/lib_beep.c index 71d4b964..042aa971 100644 --- a/ncurses/lib_beep.c +++ b/ncurses/lib_beep.c @@ -1,36 +1,48 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* * beep.c * - * Routines beep() and flash() + * The routine beep(). * */ #include #include /* beep, flash */ -MODULE_ID("$Id: lib_beep.c,v 1.3 1997/02/02 00:27:01 tom Exp $") +MODULE_ID("$Id: lib_beep.c,v 1.5 1998/02/11 12:13:55 tom Exp $") /* * beep() @@ -55,27 +67,3 @@ int beep(void) else returnCode(ERR); } - -/* - * flash() - * - * Flash the current terminal's screen if possible. If not, - * sound the audible bell if one exists. - * - */ - -int flash(void) -{ - T((T_CALLED("flash()"))); - - /* FIXME: should make sure that we are not in altchar mode */ - if (flash_screen) { - TPUTS_TRACE("flash_screen"); - returnCode(putp(flash_screen)); - } else if (bell) { - TPUTS_TRACE("bell"); - returnCode(putp(bell)); - } - else - returnCode(ERR); -} diff --git a/ncurses/lib_bkgd.c b/ncurses/lib_bkgd.c index 1bf03870..410ee058 100644 --- a/ncurses/lib_bkgd.c +++ b/ncurses/lib_bkgd.c @@ -1,52 +1,86 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ #include -MODULE_ID("$Id: lib_bkgd.c,v 1.7 1997/04/12 17:44:37 tom Exp $") +MODULE_ID("$Id: lib_bkgd.c,v 1.12 1998/02/11 12:13:54 tom Exp $") + +void wbkgdset(WINDOW *win, chtype ch) +{ + T((T_CALLED("wbkgdset(%p,%s)"), win, _tracechtype(ch))); + + if (win) { + chtype off = AttrOf(win->_bkgd); + chtype on = AttrOf(ch); + + toggle_attr_off(win->_attrs,off); + toggle_attr_on (win->_attrs,on); + + if (TextOf(ch)==0) + ch |= BLANK; + win->_bkgd = ch; + } + returnVoid; +} int wbkgd(WINDOW *win, const chtype ch) { -int x, y; -chtype old_bkgd = getbkgd(win); -chtype new_bkgd = ch; - - T((T_CALLED("wbkgd(%p,%s)"), win, _tracechtype(new_bkgd))); - - if (TextOf(new_bkgd) == 0) - new_bkgd |= BLANK; - wbkgdset(win, new_bkgd); - wattrset(win, AttrOf(new_bkgd)); - - for (y = 0; y <= win->_maxy; y++) { - for (x = 0; x <= win->_maxx; x++) { - if (win->_line[y].text[x] == old_bkgd) - win->_line[y].text[x] = new_bkgd; - else - win->_line[y].text[x] = - TextOf(win->_line[y].text[x]) - | AttrOf(new_bkgd); - } - } - touchwin(win); - _nc_synchook(win); - returnCode(OK); + int code = ERR; + int x, y; + chtype new_bkgd = ch; + + T((T_CALLED("wbkgd(%p,%s)"), win, _tracechtype(new_bkgd))); + + if (win) { + chtype old_bkgd = getbkgd(win); + + wbkgdset(win, new_bkgd); + wattrset(win, AttrOf(win->_bkgd)); + + for (y = 0; y <= win->_maxy; y++) { + for (x = 0; x <= win->_maxx; x++) { + if (win->_line[y].text[x] == old_bkgd) + win->_line[y].text[x] = win->_bkgd; + else + win->_line[y].text[x] = + _nc_render(win,(A_ALTCHARSET & + AttrOf(win->_line[y].text[x])) + | TextOf(win->_line[y].text[x])); + } + } + touchwin(win); + _nc_synchook(win); + code = OK; + } + returnCode(code); } diff --git a/ncurses/lib_box.c b/ncurses/lib_box.c index c3288254..bcd96416 100644 --- a/ncurses/lib_box.c +++ b/ncurses/lib_box.c @@ -1,39 +1,48 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* ** lib_box.c ** -** line drawing routines: -** wborder() -** whline() -** wvline() +** The routine wborder(). ** */ #include -MODULE_ID("$Id: lib_box.c,v 1.7 1997/04/12 17:51:49 tom Exp $") +MODULE_ID("$Id: lib_box.c,v 1.10 1998/02/11 12:13:56 tom Exp $") int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br) @@ -52,6 +61,9 @@ short endx, endy; _tracechtype2(7,bl), _tracechtype2(8,br))); + if (!win) + returnCode(ERR); + if (ls == 0) ls = ACS_VLINE; if (rs == 0) rs = ACS_VLINE; if (ts == 0) ts = ACS_HLINE; @@ -96,65 +108,3 @@ short endx, endy; _nc_synchook(win); returnCode(OK); } - -int whline(WINDOW *win, chtype ch, int n) -{ -short line; -short start; -short end; - - T((T_CALLED("whline(%p,%s,%d)"), win, _tracechtype(ch), n)); - - line = win->_cury; - start = win->_curx; - end = start + n - 1; - if (end > win->_maxx) - end = win->_maxx; - - if (win->_line[line].firstchar == _NOCHANGE || win->_line[line].firstchar > start) - win->_line[line].firstchar = start; - if (win->_line[line].lastchar == _NOCHANGE || win->_line[line].lastchar < start) - win->_line[line].lastchar = end; - - if (ch == 0) - ch = ACS_HLINE; - ch = _nc_render(win, ch); - - while ( end >= start) { - win->_line[line].text[end] = ch; - end--; - } - - returnCode(OK); -} - -int wvline(WINDOW *win, chtype ch, int n) -{ -short row, col; -short end; - - T((T_CALLED("wvline(%p,%s,%d)"), win, _tracechtype(ch), n)); - - row = win->_cury; - col = win->_curx; - end = row + n - 1; - if (end > win->_maxy) - end = win->_maxy; - - if (ch == 0) - ch = ACS_VLINE; - ch = _nc_render(win, ch); - - while(end >= row) { - win->_line[end].text[col] = ch; - if (win->_line[end].firstchar == _NOCHANGE || win->_line[end].firstchar > col) - win->_line[end].firstchar = col; - if (win->_line[end].lastchar == _NOCHANGE || win->_line[end].lastchar < col) - win->_line[end].lastchar = col; - end--; - } - - _nc_synchook(win); - returnCode(OK); -} - diff --git a/ncurses/lib_chgat.c b/ncurses/lib_chgat.c new file mode 100644 index 00000000..7690ae4a --- /dev/null +++ b/ncurses/lib_chgat.c @@ -0,0 +1,62 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_chgat.c +** +** The routine wchgat(). +** +*/ + +#include + +MODULE_ID("$Id: lib_chgat.c,v 1.2 1998/02/11 12:14:00 tom Exp $") + +int wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED) +{ + int i; + + T((T_CALLED("wchgat(%p,%d,%s,%d)"), win, n, _traceattr(attr), color)); + + if (win) { + toggle_attr_on(attr,COLOR_PAIR(color)); + + for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++) + win->_line[win->_cury].text[i] + = TextOf(win->_line[win->_cury].text[i]) | attr; + + returnCode(OK); + } + else + returnCode(ERR); +} diff --git a/ncurses/lib_clear.c b/ncurses/lib_clear.c index e6485d59..9c07cf08 100644 --- a/ncurses/lib_clear.c +++ b/ncurses/lib_clear.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* ** lib_clear.c @@ -28,15 +40,16 @@ #include -MODULE_ID("$Id: lib_clear.c,v 1.3 1997/02/01 23:18:18 tom Exp $") +MODULE_ID("$Id: lib_clear.c,v 1.5 1998/02/11 12:13:53 tom Exp $") int wclear(WINDOW *win) { - T((T_CALLED("wclear(%p)"), win)); +int code = ERR; - werase(win); - - win->_clear = TRUE; + T((T_CALLED("wclear(%p)"), win)); - returnCode(OK); + if ((code = werase(win))!=ERR) + win->_clear = TRUE; + + returnCode(code); } diff --git a/ncurses/lib_clearok.c b/ncurses/lib_clearok.c new file mode 100644 index 00000000..cc904b1d --- /dev/null +++ b/ncurses/lib_clearok.c @@ -0,0 +1,56 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + + +/* +** lib_clearok.c +** +** The routine clearok. +** +*/ + +#include + +MODULE_ID("$Id: lib_clearok.c,v 1.2 1998/02/11 12:14:00 tom Exp $") + +int clearok(WINDOW *win, bool flag) +{ + T((T_CALLED("clearok(%p,%d)"), win, flag)); + + if (win) { + win->_clear = flag; + returnCode(OK); + } + else + returnCode(ERR); +} diff --git a/ncurses/lib_clrbot.c b/ncurses/lib_clrbot.c index 3f0ebda9..9dac8c27 100644 --- a/ncurses/lib_clrbot.c +++ b/ncurses/lib_clrbot.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* ** lib_clrbot.c @@ -28,45 +40,40 @@ #include -MODULE_ID("$Id: lib_clrbot.c,v 1.9 1997/02/01 23:18:18 tom Exp $") +MODULE_ID("$Id: lib_clrbot.c,v 1.13 1998/02/11 12:13:54 tom Exp $") int wclrtobot(WINDOW *win) { -chtype *ptr, *end, *maxx = NULL; -short y, startx, minx; +int code = ERR; +chtype blank; +chtype *ptr, *end; +short y, startx; T((T_CALLED("wclrtobot(%p)"), win)); - startx = win->_curx; - - T(("clearing from y = %d to y = %d with maxx = %d", win->_cury, win->_maxy, win->_maxx)); - - for (y = win->_cury; y <= win->_maxy; y++) { - minx = _NOCHANGE; - end = &win->_line[y].text[win->_maxx]; - - for (ptr = &win->_line[y].text[startx]; ptr <= end; ptr++) { - chtype blank = _nc_background(win); - - if (*ptr != blank) { - maxx = ptr; - if (minx == _NOCHANGE) - minx = ptr - win->_line[y].text; - *ptr = blank; - } - } - - if (minx != _NOCHANGE) { - if (win->_line[y].firstchar > minx - || win->_line[y].firstchar == _NOCHANGE) - win->_line[y].firstchar = minx; - - if (win->_line[y].lastchar < maxx - win->_line[y].text) - win->_line[y].lastchar = maxx - win->_line[y].text; - } - - startx = 0; + if (win) { + startx = win->_curx; + + T(("clearing from y = %d to y = %d with maxx = %d", win->_cury, win->_maxy, win->_maxx)); + + for (y = win->_cury; y <= win->_maxy; y++) { + end = &win->_line[y].text[win->_maxx]; + + blank = _nc_background(win); + for (ptr = &win->_line[y].text[startx]; ptr <= end; ptr++) + *ptr = blank; + + if (win->_line[y].firstchar > startx + || win->_line[y].firstchar == _NOCHANGE) + win->_line[y].firstchar = startx; + + win->_line[y].lastchar = win->_maxx; + + startx = 0; + } + _nc_synchook(win); + code = OK; } - _nc_synchook(win); - returnCode(OK); + returnCode(code); } + diff --git a/ncurses/lib_clreol.c b/ncurses/lib_clreol.c index 47dd89a4..a418c509 100644 --- a/ncurses/lib_clreol.c +++ b/ncurses/lib_clreol.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -29,49 +41,54 @@ #include -MODULE_ID("$Id: lib_clreol.c,v 1.9 1997/02/01 23:22:54 tom Exp $") +MODULE_ID("$Id: lib_clreol.c,v 1.14 1998/02/11 12:13:55 tom Exp $") int wclrtoeol(WINDOW *win) { -chtype *maxx, *ptr, *end; -short y, x, minx; +int code = ERR; +chtype blank; +chtype *ptr, *end; +short y, x; T((T_CALLED("wclrtoeol(%p)"), win)); - y = win->_cury; - x = win->_curx; + if (win) { - /* - * We don't want to clear if we just wrapped the cursor. There's no - * point in clearing if we're not on a legal position, either. - */ - if (win->_flags & _WRAPPED - || y > win->_maxy - || x > win->_maxx) - returnCode(ERR); + y = win->_cury; + x = win->_curx; - end = &win->_line[y].text[win->_maxx]; - minx = _NOCHANGE; - maxx = &win->_line[y].text[x]; - - for (ptr = maxx; ptr <= end; ptr++) { - chtype blank = _nc_background(win); - - if (*ptr != blank) { - maxx = ptr; - if (minx == _NOCHANGE) - minx = ptr - win->_line[y].text; - *ptr = blank; - } - } - - if (minx != _NOCHANGE) { - if (win->_line[y].firstchar > minx || win->_line[y].firstchar == _NOCHANGE) - win->_line[y].firstchar = minx; - - if (win->_line[y].lastchar < maxx - win->_line[y].text) - win->_line[y].lastchar = maxx - win->_line[y].text; + /* + * If we have just wrapped the cursor, the clear applies to the new + * line, unless we are at the lower right corner. + */ + if (win->_flags & _WRAPPED + && y < win->_maxy) { + win->_flags &= ~_WRAPPED; + } + + /* + * There's no point in clearing if we're not on a legal position, + * either. + */ + if (win->_flags & _WRAPPED + || y > win->_maxy + || x > win->_maxx) + returnCode(ERR); + + blank = _nc_background(win); + end = &win->_line[y].text[win->_maxx]; + + for (ptr = &win->_line[y].text[x]; ptr <= end; ptr++) + *ptr = blank; + + if (win->_line[y].firstchar > win->_curx + || win->_line[y].firstchar == _NOCHANGE) + win->_line[y].firstchar = win->_curx; + + win->_line[y].lastchar = win->_maxx; + + _nc_synchook(win); + code = OK; } - _nc_synchook(win); - returnCode(OK); + returnCode(code); } diff --git a/ncurses/lib_color.c b/ncurses/lib_color.c index 0f2d5b33..cf86420d 100644 --- a/ncurses/lib_color.c +++ b/ncurses/lib_color.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* lib_color.c * @@ -29,7 +41,13 @@ #include -MODULE_ID("$Id: lib_color.c,v 1.17 1997/05/03 19:16:05 tom Exp $") +MODULE_ID("$Id: lib_color.c,v 1.24 1998/02/11 12:13:58 tom Exp $") + +/* + * Only 8 ANSI colors are defined; the ISO 6429 control sequences work only + * for 8 values (0-7). + */ +#define MAX_ANSI_COLOR 8 /* * These should be screen structure members. They need to be globals for @@ -39,17 +57,24 @@ MODULE_ID("$Id: lib_color.c,v 1.17 1997/05/03 19:16:05 tom Exp $") int COLOR_PAIRS; int COLORS; +/* + * 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. + */ +#define RGB_ON 680 +#define RGB_OFF 0 + static const color_t cga_palette[] = { - /* R G B */ - {0, 0, 0}, /* COLOR_BLACK */ - {1000, 0, 0}, /* COLOR_RED */ - {0, 1000, 0}, /* COLOR_GREEN */ - {1000, 1000, 0}, /* COLOR_YELLOW */ - {0, 0, 1000}, /* COLOR_BLUE */ - {1000, 0, 1000}, /* COLOR_MAGENTA */ - {0, 1000, 1000}, /* COLOR_CYAN */ - {1000, 1000, 1000}, /* COLOR_WHITE */ + /* R G B */ + {RGB_OFF, RGB_OFF, RGB_OFF}, /* COLOR_BLACK */ + {RGB_ON, RGB_OFF, RGB_OFF}, /* COLOR_RED */ + {RGB_OFF, RGB_ON, RGB_OFF}, /* COLOR_GREEN */ + {RGB_ON, RGB_ON, RGB_OFF}, /* COLOR_YELLOW */ + {RGB_OFF, RGB_OFF, RGB_ON}, /* COLOR_BLUE */ + {RGB_ON, RGB_OFF, RGB_ON}, /* COLOR_MAGENTA */ + {RGB_OFF, RGB_ON, RGB_ON}, /* COLOR_CYAN */ + {RGB_ON, RGB_ON, RGB_ON}, /* COLOR_WHITE */ }; static const color_t hls_palette[] = { @@ -118,11 +143,12 @@ int start_color(void) } #ifdef hue_lightness_saturation +/* This function was originally written by Daniel Weaver */ static void rgb2hls(short r, short g, short b, short *h, short *l, short *s) /* convert RGB to HLS system */ { short min, max, t; - + if ((min = g < r ? g : r) > b) min = b; if ((max = g > r ? g : r) < b) max = b; @@ -220,14 +246,8 @@ int init_color(short color, short r, short g, short b) if (color < 0 || color >= COLORS) returnCode(ERR); -#ifdef hue_lightness_saturation - if (hue_lightness_saturation == TRUE) - if (r < 0 || r > 360 || g < 0 || g > 100 || b < 0 || b > 100) - returnCode(ERR); - if (hue_lightness_saturation == FALSE) -#endif /* hue_lightness_saturation */ - if (r < 0 || r > 1000 || g < 0 || g > 1000 || b < 0 || b > 1000) - returnCode(ERR); + if (r < 0 || r > 1000 || g < 0 || g > 1000 || b < 0 || b > 1000) + returnCode(ERR); #ifdef hue_lightness_saturation if (hue_lightness_saturation) @@ -256,19 +276,19 @@ int init_color(short color, short r, short g, short b) bool can_change_color(void) { T((T_CALLED("can_change_color()"))); - returnCode(can_change != 0); + returnCode ((can_change != 0) ? TRUE : FALSE); } bool has_colors(void) { T((T_CALLED("has_colors()"))); - returnCode((orig_pair != NULL || orig_colors != NULL) - && (max_colors != -1) && (max_pairs != -1) - && - (((set_foreground != NULL) && (set_background != NULL)) - || ((set_a_foreground != NULL) && (set_a_background != NULL)) - || set_color_pair) - ); + returnCode (((orig_pair != NULL || orig_colors != NULL) + && (max_colors != -1) && (max_pairs != -1) + && (((set_foreground != NULL) + && (set_background != NULL)) + || ((set_a_foreground != NULL) + && (set_a_background != NULL)) + || set_color_pair)) ? TRUE : FALSE); } int color_content(short color, short *r, short *g, short *b) @@ -277,9 +297,9 @@ int color_content(short color, short *r, short *g, short *b) if (color < 0 || color > COLORS) returnCode(ERR); - *r = SP->_color_table[color].red; - *g = SP->_color_table[color].green; - *b = SP->_color_table[color].blue; + if (r) *r = SP->_color_table[color].red; + if (g) *g = SP->_color_table[color].green; + if (b) *b = SP->_color_table[color].blue; returnCode(OK); } @@ -289,8 +309,8 @@ int pair_content(short pair, short *f, short *b) if ((pair < 0) || (pair > COLOR_PAIRS)) returnCode(ERR); - *f = ((SP->_color_pairs[pair] >> C_SHIFT) & C_MASK); - *b = (SP->_color_pairs[pair] & C_MASK); + if (f) *f = ((SP->_color_pairs[pair] >> C_SHIFT) & C_MASK); + if (b) *b = (SP->_color_pairs[pair] & C_MASK); returnCode(OK); } @@ -311,10 +331,13 @@ static int toggled_colors(int c) return c; } -void _nc_do_color(int pair, int (*outc)(int)) +void _nc_do_color(int pair, bool reverse, int (*outc)(int)) { short fg, bg; + if (reverse) + pair = -pair; + if (pair == 0) { if (orig_pair) @@ -333,6 +356,11 @@ void _nc_do_color(int pair, int (*outc)(int)) else { pair_content(pair, &fg, &bg); + if (reverse) { + short xx = fg; + fg = bg; + bg = xx; + } T(("setting colors: pair = %d, fg = %d, bg = %d", pair, fg, bg)); @@ -351,7 +379,7 @@ void _nc_do_color(int pair, int (*outc)(int)) } if (fg != C_MASK) { - if (set_a_foreground) + if (set_a_foreground && fg <= MAX_ANSI_COLOR) { TPUTS_TRACE("set_a_foreground"); tputs(tparm(set_a_foreground, fg), 1, outc); @@ -364,7 +392,7 @@ void _nc_do_color(int pair, int (*outc)(int)) } if (bg != C_MASK) { - if (set_a_background) + if (set_a_background && bg <= MAX_ANSI_COLOR) { TPUTS_TRACE("set_a_background"); tputs(tparm(set_a_background, bg), 1, outc); diff --git a/ncurses/lib_cur_term.c b/ncurses/lib_cur_term.c new file mode 100644 index 00000000..c757decd --- /dev/null +++ b/ncurses/lib_cur_term.c @@ -0,0 +1,81 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1997 * + ****************************************************************************/ +/* + * Module that "owns" the 'cur_term' variable: + * + * TERMINAL *set_curterm(TERMINAL *) + * int del_curterm(TERMINAL *) + */ + +#include +#include /* TTY, cur_term */ + +MODULE_ID("$Id: lib_cur_term.c,v 1.2 1998/02/11 12:13:55 tom Exp $") + +TERMINAL *cur_term; + +int _nc_get_curterm(TTY *buf) +{ + if (cur_term == 0 + || GET_TTY(cur_term->Filedes, buf) != 0) + return(ERR); + return (OK); +} + +int _nc_set_curterm(TTY *buf) +{ + if (cur_term == 0 + || SET_TTY(cur_term->Filedes, buf) != 0) + return(ERR); + return (OK); +} + +TERMINAL *set_curterm(TERMINAL *term) +{ + TERMINAL *oldterm = cur_term; + + cur_term = term; + return oldterm; +} + +int del_curterm(TERMINAL *term) +{ + T((T_CALLED("del_curterm(%p)"), term)); + + if (term != 0) { + FreeIfNeeded(term->type.str_table); + FreeIfNeeded(term->type.term_names); + free(term); + returnCode(OK); + } + returnCode(ERR); +} diff --git a/ncurses/lib_data.c b/ncurses/lib_data.c index 57f41294..baa1db81 100644 --- a/ncurses/lib_data.c +++ b/ncurses/lib_data.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* ** lib_data.c @@ -28,24 +40,17 @@ #include -MODULE_ID("$Id: lib_data.c,v 1.8 1997/01/18 23:02:54 tom Exp $") - -WINDOW *stdscr, *curscr, *newscr; +MODULE_ID("$Id: lib_data.c,v 1.13 1998/02/11 12:14:00 tom Exp $") /* - * Linked-list of all windows, to support '_nc_resizeall()' and '_nc_freeall()' + * OS/2's native linker complains if we don't initialize public data when + * constructing a dll (reported by J.J.G.Ripoll). */ -WINDOWLIST *_nc_windows; +WINDOW *stdscr = 0; +WINDOW *curscr = 0; +WINDOW *newscr = 0; -/* - * These data correspond to the state of the idcok() and idlok() functions. A - * caveat is in order here: the XSI and SVr4 documentation specify that these - * functions apply to the window which is given as an argument. However, - * ncurses implements this logic only for the newscr/curscr update process, - * _not_ per-window. - */ -bool _nc_idcok = TRUE; -bool _nc_idlok = FALSE; +SCREEN *_nc_screen_chain = 0; /* * The variable 'SP' will be defined as a function on systems that cannot link diff --git a/ncurses/lib_delch.c b/ncurses/lib_delch.c index 16d89430..6dc6fef4 100644 --- a/ncurses/lib_delch.c +++ b/ncurses/lib_delch.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* ** lib_delch.c @@ -28,31 +40,35 @@ #include -MODULE_ID("$Id: lib_delch.c,v 1.5 1997/02/01 23:18:18 tom Exp $") +MODULE_ID("$Id: lib_delch.c,v 1.7 1998/02/11 12:13:53 tom Exp $") int wdelch(WINDOW *win) { +int code = ERR; chtype *temp1, *temp2; chtype *end; chtype blank = _nc_background(win); T((T_CALLED("wdelch(%p)"), win)); - end = &win->_line[win->_cury].text[win->_maxx]; - temp2 = &win->_line[win->_cury].text[win->_curx + 1]; - temp1 = temp2 - 1; - - while (temp1 < end) + if (win) { + end = &win->_line[win->_cury].text[win->_maxx]; + temp2 = &win->_line[win->_cury].text[win->_curx + 1]; + temp1 = temp2 - 1; + + while (temp1 < end) *temp1++ = *temp2++; - - *temp1 = blank; - - win->_line[win->_cury].lastchar = win->_maxx; - - if (win->_line[win->_cury].firstchar == _NOCHANGE - || win->_line[win->_cury].firstchar > win->_curx) + + *temp1 = blank; + + win->_line[win->_cury].lastchar = win->_maxx; + + if (win->_line[win->_cury].firstchar == _NOCHANGE + || win->_line[win->_cury].firstchar > win->_curx) win->_line[win->_cury].firstchar = win->_curx; - - _nc_synchook(win); - returnCode(OK); + + _nc_synchook(win); + code = OK; + } + returnCode(code); } diff --git a/ncurses/lib_delwin.c b/ncurses/lib_delwin.c index f35ec4e9..7bab0c77 100644 --- a/ncurses/lib_delwin.c +++ b/ncurses/lib_delwin.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* ** lib_delwin.c @@ -28,7 +40,7 @@ #include -MODULE_ID("$Id: lib_delwin.c,v 1.8 1997/02/01 23:22:54 tom Exp $") +MODULE_ID("$Id: lib_delwin.c,v 1.9 1998/02/11 12:13:53 tom Exp $") static bool have_children(WINDOW *win) { diff --git a/ncurses/lib_dft_fgbg.c b/ncurses/lib_dft_fgbg.c index 075b27a9..a2dfbd21 100644 --- a/ncurses/lib_dft_fgbg.c +++ b/ncurses/lib_dft_fgbg.c @@ -1,26 +1,38 @@ -/****************************************************************************** - * Copyright 1997 by Thomas E. Dickey * - * All Rights Reserved. * - * * - * Permission to use, copy, modify, and distribute this software and its * - * documentation for any purpose and without fee is hereby granted, provided * - * that the above copyright notice appear in all copies and that both that * - * copyright notice and this permission notice appear in supporting * - * documentation, and that the name of the above listed copyright holder(s) * - * not be used in advertising or publicity pertaining to distribution of the * - * software without specific, written prior permission. THE ABOVE LISTED * - * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * - * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - ******************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1997 * + ****************************************************************************/ #include #include -MODULE_ID("$Id: lib_dft_fgbg.c,v 1.2 1997/02/02 01:45:36 tom Exp $") +MODULE_ID("$Id: lib_dft_fgbg.c,v 1.3 1998/02/11 12:13:54 tom Exp $") /* * Modify the behavior of color-pair 0 so that the library doesn't assume that diff --git a/ncurses/lib_doupdate.c b/ncurses/lib_doupdate.c index 20ac96c5..b0daf4fc 100644 --- a/ncurses/lib_doupdate.c +++ b/ncurses/lib_doupdate.c @@ -1,22 +1,35 @@ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /*----------------------------------------------------------------- @@ -37,7 +50,7 @@ #define USE_TRACE_TIMES 0 #endif -#if HAVE_SYS_TIME_H && ! SYSTEM_LOOKS_LIKE_SCO +#if HAVE_SYS_TIME_H && HAVE_SYS_TIME_SELECT #include #endif @@ -54,9 +67,15 @@ #endif #endif +#ifdef __BEOS__ +/* BeOS select() only works on sockets. Use the tty hack instead */ +#include +#define select check_select +#endif + #include -MODULE_ID("$Id: lib_doupdate.c,v 1.60 1997/05/03 19:32:55 Alexander.V.Lukyanov Exp $") +MODULE_ID("$Id: lib_doupdate.c,v 1.98 1998/02/11 12:14:00 tom Exp $") /* * This define controls the line-breakout optimization. Every once in a @@ -67,7 +86,7 @@ MODULE_ID("$Id: lib_doupdate.c,v 1.60 1997/05/03 19:32:55 Alexander.V.Lukyanov E * Note: Input-check-and-abort is no longer done if the screen is being * updated from scratch. This is a feature, not a bug. */ -#define CHECK_INTERVAL 6 +#define CHECK_INTERVAL 5 /* * Enable checking to see if doupdate and friends are tracking the true @@ -77,11 +96,10 @@ MODULE_ID("$Id: lib_doupdate.c,v 1.60 1997/05/03 19:32:55 Alexander.V.Lukyanov E /* #define POSITION_DEBUG */ static inline chtype ClrBlank ( WINDOW *win ); -static inline chtype ClrSetup ( WINDOW *scr ); static int ClrBottom(int total); static int InsStr( chtype *line, int count ); -static void ClearScreen( void ); -static void ClrUpdate( WINDOW *scr ); +static void ClearScreen( chtype blank ); +static void ClrUpdate( WINDOW *win ); static void DelChar( int count ); static void TransformLine( int const lineno ); @@ -175,6 +193,16 @@ static inline void PutAttrChar(chtype ch) static bool check_pending(void) /* check for pending input */ { + bool have_pending = FALSE; + + /* + * Only carry out this check when the flag is zero, otherwise we'll + * have the refreshing slow down drastically (or stop) if there's an + * unread character available. + */ + if(SP->_fifohold != 0) + return FALSE; + if (SP->_checkfd >= 0) { #if USE_FUNC_POLL struct pollfd fds[1]; @@ -182,8 +210,7 @@ static bool check_pending(void) fds[0].events = POLLIN; if (poll(fds, 1, 0) > 0) { - fflush(SP->_ofp); - return TRUE; + have_pending = TRUE; } #elif HAVE_SELECT fd_set fdset; @@ -196,11 +223,14 @@ static bool check_pending(void) FD_SET(SP->_checkfd, &fdset); if (select(SP->_checkfd+1, &fdset, NULL, NULL, &ktimeout) > 0) { - fflush(SP->_ofp); - return TRUE; + have_pending = TRUE; } #endif } + if (have_pending) { + SP->_fifohold = 5; + fflush(SP->_ofp); + } return FALSE; } @@ -214,73 +244,82 @@ static void callPutChar(chtype const); #define callPutChar(ch) PutChar(ch) #endif -static inline void PutChar(chtype const ch) -/* insert character, handling automargin stuff */ +static inline void PutChar(chtype const ch); /* forward declaration */ + +/* put char at lower right corner */ +static void PutCharLR(chtype const ch) { - if (!(SP->_cursrow == screen_lines-1 && SP->_curscol == screen_columns-1 - && auto_right_margin && !eat_newline_glitch)) + if (!auto_right_margin) { - PutAttrChar(ch); /* normal case */ + /* we can put the char directly */ + PutAttrChar(ch); } - else if (!auto_right_margin /* maybe we can suppress automargin */ - || (enter_am_mode && exit_am_mode)) + else if (enter_am_mode && exit_am_mode) { - bool old_am = auto_right_margin; + /* we can suppress automargin */ + TPUTS_TRACE("exit_am_mode"); + putp(exit_am_mode); - if (old_am) - { - TPUTS_TRACE("exit_am_mode"); - putp(exit_am_mode); - } PutAttrChar(ch); - if (old_am) - { - TPUTS_TRACE("enter_am_mode"); - putp(enter_am_mode); - } + + TPUTS_TRACE("enter_am_mode"); + putp(enter_am_mode); } - else + else if ((enter_insert_mode && exit_insert_mode) + || insert_character || parm_ich) { GoTo(screen_lines-1,screen_columns-2); callPutChar(ch); GoTo(screen_lines-1,screen_columns-2); - if (InsStr(newscr->_line[screen_lines-1].text+screen_columns-2,1)==ERR) - return; + InsStr(newscr->_line[screen_lines-1].text+screen_columns-2,1); } +} - if (SP->_curscol >= screen_columns) +static void wrap_cursor(void) +{ + if (eat_newline_glitch) { - if (eat_newline_glitch) - { - /* - * xenl can manifest two different ways. The vt100 - * way is that, when you'd expect the cursor to wrap, - * it stays hung at the right margin (on top of the - * character just emitted) and doesn't wrap until the - * *next* graphic char is emitted. The c100 way is - * to ignore LF received just after an am wrap. - * - * An aggressive way to handle this would be to - * emit CR/LF after the char and then assume the wrap - * is done, you're on the first position of the next - * line, and the terminal out of its weird state. - * Here it's safe to just tell the code that the - * cursor is in hyperspace and let the next mvcur() - * call straighten things out. - */ - SP->_curscol = -1; - SP->_cursrow = -1; - } - else if (auto_right_margin) - { - SP->_curscol = 0; - SP->_cursrow++; - } - else - { - SP->_curscol--; - } + /* + * xenl can manifest two different ways. The vt100 + * way is that, when you'd expect the cursor to wrap, + * it stays hung at the right margin (on top of the + * character just emitted) and doesn't wrap until the + * *next* graphic char is emitted. The c100 way is + * to ignore LF received just after an am wrap. + * + * An aggressive way to handle this would be to + * emit CR/LF after the char and then assume the wrap + * is done, you're on the first position of the next + * line, and the terminal out of its weird state. + * Here it's safe to just tell the code that the + * cursor is in hyperspace and let the next mvcur() + * call straighten things out. + */ + SP->_curscol = -1; + SP->_cursrow = -1; + } + else if (auto_right_margin) + { + SP->_curscol = 0; + SP->_cursrow++; } + else + { + SP->_curscol--; + } +} + +static inline void PutChar(chtype const ch) +/* insert character, handling automargin stuff */ +{ + if (SP->_cursrow == screen_lines-1 && SP->_curscol == screen_columns-1) + PutCharLR(ch); + else + PutAttrChar(ch); + + if (SP->_curscol >= screen_columns) + wrap_cursor(); + #ifdef POSITION_DEBUG position_check(SP->_cursrow, SP->_curscol, "PutChar"); #endif /* POSITION_DEBUG */ @@ -298,7 +337,7 @@ static inline void PutChar(chtype const ch) * * This code is optimized using ech and rep. */ -static inline int EmitRange(const chtype *ntext, int num) +static int EmitRange(const chtype *ntext, int num) { int i; @@ -431,7 +470,7 @@ static void callPutChar(chtype const ch) { \ win->_line[row].firstchar = _NOCHANGE; \ win->_line[row].lastchar = _NOCHANGE; \ - win->_line[row].oldindex = row; \ + if_USE_SCROLL_HINTS(win->_line[row].oldindex = row); \ } int doupdate(void) @@ -457,25 +496,33 @@ struct tms before, after; _nc_signal_handler(FALSE); - if (SP->_endwin == TRUE) { - - T(("coming back from shell mode")); - reset_prog_mode(); + if (SP->_fifohold) + SP->_fifohold--; +#if USE_SIZECHANGE + if (SP->_endwin || SP->_sig_winch) + { /* * This is a transparent extension: XSI does not address it, - * and applications need not know that ncurses can do it. + * and applications need not know that ncurses can do it. * * Check if the terminal size has changed while curses was off * (this can happen in an xterm, for example), and resize the * ncurses data structures accordingly. */ - _nc_get_screensize(); - resizeterm(LINES, COLS); + _nc_update_screensize(); + } +#endif + + if (SP->_endwin) { + + T(("coming back from shell mode")); + reset_prog_mode(); _nc_mvcur_resume(); - _nc_mouse_resume(SP); - newscr->_clear = TRUE; + _nc_screen_resume(); + SP->_mouse_resume(SP); + SP->_endwin = FALSE; } @@ -498,6 +545,7 @@ struct tms before, after; * guaranteed room for its cookie). If not, nuke the added * attributes out of the span. */ +#if USE_XMC_SUPPORT if (magic_cookie_glitch > 0) { int j, k; attr_t rattr = A_NORMAL; @@ -509,8 +557,10 @@ struct tms before, after; chtype turnon = AttrOf(newscr->_line[i].text[j]) & ~rattr; /* is an attribute turned on here? */ - if (turnon == 0) + if (turnon == 0) { + rattr = AttrOf(newscr->_line[i].text[j]); continue; + } T(("At (%d, %d): from %s...", i, j, _traceattr(rattr))); T(("...to %s",_traceattr(turnon))); @@ -521,7 +571,7 @@ struct tms before, after; * ensure there's enough room to set the attribute before * the first non-blank in the run. */ -#define SAFE(a) !((a) & ~NONBLANK_ATTR) +#define SAFE(a) !((a) & (chtype)~NONBLANK_ATTR) if (TextOf(newscr->_line[i].text[j])==' ' && SAFE(turnon)) { newscr->_line[i].text[j] &= ~turnon; @@ -537,11 +587,13 @@ struct tms before, after; if (!failed) { bool end_onscreen = FALSE; - int m, n = -1; + int m, n = j; /* find end of span, if it's onscreen */ for (m = i; m < screen_lines; m++) - for (n = j; n < screen_columns; n++) + { + for ( ; n < screen_columns; n++) + { if (AttrOf(newscr->_line[m].text[n]) == rattr) { end_onscreen = TRUE; @@ -549,6 +601,9 @@ struct tms before, after; _traceattr(turnon),m,n)); goto foundit; } + } + n = 0; + } T(("Range attributed with %s ends offscreen", _traceattr(turnon))); foundit:; @@ -566,7 +621,7 @@ struct tms before, after; while (n >= 0 && TextOf(lastline[n]) == ' ' && SAFE(AttrOf(lastline[n]))) - lastline[n--] &=~ turnon; + lastline[n--] &= ~turnon; /* check that there's enough room at end of span */ for (k = 1; k <= magic_cookie_glitch; k++) @@ -579,18 +634,22 @@ struct tms before, after; if (failed) { - int p, q; + int p, q = j; T(("Clearing %s beginning at (%d, %d)", _traceattr(turnon), i, j)); /* turn off new attributes over span */ for (p = i; p < screen_lines; p++) - for (q = j; q < screen_columns; q++) + { + for ( ; q < screen_columns; q++) + { if (AttrOf(newscr->_line[p].text[q]) == rattr) goto foundend; - else - newscr->_line[p].text[q] &=~ turnon; + newscr->_line[p].text[q] &= ~turnon; + } + q = 0; + } foundend:; } else @@ -618,36 +677,63 @@ struct tms before, after; } #endif /* TRACE */ } +#endif /* USE_XMC_SUPPORT */ nonempty = 0; if (curscr->_clear) { /* force refresh ? */ + /* yes, clear all & update */ T(("clearing and updating curscr")); - ClrUpdate(newscr); /* yes, clear all & update */ + if (is_wintouched(newscr)) + ClrUpdate(newscr); + else + ClrUpdate(curscr); curscr->_clear = FALSE; /* reset flag */ + newscr->_clear = FALSE; /* reset flag */ } else if (newscr->_clear) { T(("clearing and updating newscr")); ClrUpdate(newscr); newscr->_clear = FALSE; } else { - int changedlines; + int changedlines = CHECK_INTERVAL; + + if(check_pending()) + goto cleanup; nonempty = min(screen_lines, newscr->_maxy+1); -#if 0 /* still 5% slower 960928 */ + + if (SP->_scrolling) { +#if USE_HASHMAP #if defined(TRACE) || defined(NCURSES_TEST) if (_nc_optimize_enable & OPTIMIZE_HASHMAP) #endif /*TRACE */ _nc_hash_map(); +#elif !USE_SCROLL_HINTS + _nc_setup_scroll(); #endif #if defined(TRACE) || defined(NCURSES_TEST) if (_nc_optimize_enable & OPTIMIZE_SCROLL) #endif /*TRACE */ +#if USE_SCROLL_HINTS || USE_HASHMAP _nc_scroll_optimize(); +#else + _nc_perform_scroll(); +#endif + } - if (clr_eos) - nonempty = ClrBottom(nonempty); + nonempty = ClrBottom(nonempty); T(("Transforming lines, nonempty %d", nonempty)); - for (i = changedlines = 0; i < nonempty; i++) { + for (i = 0; i < nonempty; i++) { + /* + * Here is our line-breakout optimization. + */ + if (changedlines == CHECK_INTERVAL) + { + if (check_pending()) + goto cleanup; + changedlines = 0; + } + /* * newscr->line[i].firstchar is normally set * by wnoutrefresh. curscr->line[i].firstchar @@ -666,13 +752,6 @@ struct tms before, after; MARK_NOCHANGE(newscr,i) if (i <= curscr->_maxy) MARK_NOCHANGE(curscr,i) - - /* - * Here is our line-breakout optimization. - */ - if ((changedlines % CHECK_INTERVAL) == CHECK_INTERVAL-1 - && check_pending()) - goto cleanup; } } @@ -716,9 +795,7 @@ struct tms before, after; * * Returns the attributed character that corresponds to the "cleared" * screen. If the terminal has the back-color-erase feature, this will be - * colored according to the wbkgd() call. (Other attributes are - * unspecified, hence assumed to be reset in accordance with - * 'ClrSetup()'). + * colored according to the wbkgd() call. * * We treat 'curscr' specially because it isn't supposed to be set directly * in the wbkgd() call. Assume 'stdscr' for this case. @@ -735,64 +812,37 @@ chtype blank = BLANK; } /* - * ClrSetup(win) - * - * Ensures that if the terminal recognizes back-color-erase, that we - * set the video attributes to match the window's background color - * before an erase operation. - */ -static inline chtype ClrSetup (WINDOW *win) -{ - if (back_color_erase) - vidattr(BCE_BKGD(win) & BCE_ATTRS); - return ClrBlank(win); -} - -/* -** ClrUpdate(scr) +** ClrUpdate(win) ** ** Update by clearing and redrawing the entire screen. ** */ -static void ClrUpdate(WINDOW *scr) +static void ClrUpdate(WINDOW *win) { -int i = 0, j = 0; -int lastNonBlank; -chtype blank = ClrSetup(scr); - - T(("ClrUpdate(%p) called", scr)); - ClearScreen(); - - if (scr != curscr) { - for (i = 0; i < screen_lines ; i++) - for (j = 0; j < screen_columns; j++) - curscr->_line[i].text[j] = blank; + int i; + chtype blank = ClrBlank(win); + int nonempty = min(screen_lines, newscr->_maxy+1); + + T(("ClrUpdate() called")); + + if (win == curscr) { + /* discard updates */ + for (i = 0; i < screen_lines ; i++) { + memcpy( newscr->_line[i].text, + curscr->_line[i].text, + screen_columns * sizeof(chtype)); + } } + ClearScreen(blank); + T(("updating screen from scratch")); - for (i = 0; i < min(screen_lines, scr->_maxy + 1); i++) { - lastNonBlank = scr->_maxx; - while (lastNonBlank >= 0 - && scr->_line[i].text[lastNonBlank] == blank) - lastNonBlank--; + nonempty = ClrBottom(nonempty); - if (lastNonBlank >= 0) { - if (lastNonBlank > screen_columns) - lastNonBlank = screen_columns; - GoTo(i, 0); - PutRange(curscr->_line[i].text, - scr->_line[i].text, i, 0, lastNonBlank); - } - } - - if (scr != curscr) { - for (i = 0; i < screen_lines ; i++) - memcpy(curscr->_line[i].text, - scr->_line[i].text, - screen_columns * sizeof(chtype)); - } + for (i = 0; i < nonempty; i++) + TransformLine(i); } /* @@ -832,6 +882,31 @@ bool needclear = FALSE; } } +/* +** ClrToEOS(blank) +** +** Clear to end of screen, starting at the cursor position +*/ + +static void ClrToEOS(chtype blank) +{ +int row, col; + + UpdateAttrs(blank); + TPUTS_TRACE("clr_eos"); + row = SP->_cursrow; + tputs(clr_eos, screen_lines-row, _nc_outch); + + for (col = SP->_curscol; col < screen_columns; col++) + curscr->_line[row].text[col] = blank; + + for (row++; row < screen_lines; row++) + { + for (col = 0; col < screen_columns; col++) + curscr->_line[row].text[col] = blank; + } +} + /* * ClrBottom(total) * @@ -850,7 +925,7 @@ int last = min(screen_columns, newscr->_maxx+1); size_t length = sizeof(chtype) * last; chtype blank = newscr->_line[total-1].text[last-1]; /* lower right char */ - if(!can_clear_with(blank)) + if(!clr_eos || !can_clear_with(blank)) return total; if (tstLine == 0) @@ -866,20 +941,15 @@ chtype blank = newscr->_line[total-1].text[last-1]; /* lower right char */ for (row = total-1; row >= 0; row--) { if (memcmp(tstLine, newscr->_line[row].text, length)) break; - if (newscr->_line[row].firstchar != _NOCHANGE) + if (memcmp(tstLine, curscr->_line[row].text, length)) top = row; } - if (top < total) { + /* don't use clr_eos for just one line if clr_eol available */ + if (top < total-1 || (top < total && !clr_eol && !clr_bol)) { GoTo(top,0); - UpdateAttrs(blank); - TPUTS_TRACE("clr_eos"); - putp(clr_eos); - while (total-- > top) { - for (col = 0; col <= curscr->_maxx; col++) - curscr->_line[total].text[col] = blank; - } - total++; + ClrToEOS(blank); + total = top; } } #if NO_LEAKS @@ -932,6 +1002,59 @@ bool attrchanged = FALSE; GoTo(lineno, firstChar); ClrToEOL(ClrBlank(curscr)); PutRange(oldLine, newLine, lineno, 0, (screen_columns-1)); +#if USE_XMC_SUPPORT + +#define NEW(r,c) newscr->_line[r].text[c] +#define xmc_turn_on(a,b) ((((a)^(b)) & ~(a) & SP->_xmc_triggers) != 0) +#define xmc_turn_off(a,b) xmc_turn_on(b,a) + + /* + * This is a very simple loop to paint characters which may have the + * magic cookie glitch embedded. It doesn't know much about video + * attributes which are continued from one line to the next. It + * assumes that we have filtered out requests for attribute changes + * that do not get mapped to blank positions. + * + * FIXME: we are not keeping track of where we put the cookies, so this + * will work properly only once, since we may overwrite a cookie in a + * following operation. + */ + } else if (magic_cookie_glitch > 0) { + GoTo(lineno, firstChar); + for (n = 0; n < screen_columns; n++) { + int m = n + magic_cookie_glitch; + + /* check for turn-on: + * If we are writing an attributed blank, where the + * previous cell is not attributed. + */ + if (TextOf(newLine[n]) == ' ' + && ((n > 0 + && xmc_turn_on(newLine[n-1], newLine[n])) + || (n == 0 + && lineno > 0 + && xmc_turn_on(NEW(lineno-1,screen_columns-1), newLine[n])))) { + n = m; + } + + PutChar(newLine[n]); + + /* check for turn-off: + * If we are writing an attributed non-blank, where the + * next cell is blank, and not attributed. + */ + if (TextOf(newLine[n]) != ' ' + && ((n+1 < screen_columns + && xmc_turn_off(newLine[n], newLine[n+1])) + || (n+1 >= screen_columns + && lineno+1 < screen_lines + && xmc_turn_off(newLine[n], NEW(lineno+1,0))))) { + n = m; + } + + } +#undef NEW +#endif } else { chtype blank; @@ -958,10 +1081,20 @@ bool attrchanged = FALSE; if (nFirstChar > oFirstChar + SP->_el1_cost) { - GoTo(lineno, nFirstChar - 1); - UpdateAttrs(blank); - TPUTS_TRACE("clr_bol"); - putp(clr_bol); + if (nFirstChar >= screen_columns && SP->_el_cost <= SP->_el1_cost) + { + GoTo(lineno, 0); + UpdateAttrs(blank); + TPUTS_TRACE("clr_eol"); + putp(clr_eol); + } + else + { + GoTo(lineno, nFirstChar - 1); + UpdateAttrs(blank); + TPUTS_TRACE("clr_bol"); + putp(clr_bol); + } while (firstChar < nFirstChar) oldLine[firstChar++] = blank; @@ -977,7 +1110,7 @@ bool attrchanged = FALSE; { /* find the last differing character */ nLastChar = screen_columns - 1; - + while (nLastChar > firstChar && newLine[nLastChar] == oldLine[nLastChar]) nLastChar--; @@ -1003,11 +1136,11 @@ bool attrchanged = FALSE; nLastChar--; if((nLastChar == firstChar) - && (SP->_el_cost < (screen_columns - nLastChar))) { + && (SP->_el_cost < (oLastChar - nLastChar))) { GoTo(lineno, firstChar); - ClrToEOL(blank); if(newLine[firstChar] != blank ) PutChar(newLine[firstChar]); + ClrToEOL(blank); } else if( newLine[nLastChar] != oldLine[oLastChar] || !(_nc_idcok && has_ic()) ) { GoTo(lineno, firstChar); @@ -1080,18 +1213,20 @@ bool attrchanged = FALSE; } /* -** ClearScreen() +** ClearScreen(blank) ** ** Clear the physical screen and put cursor at home ** */ -static void ClearScreen(void) +static void ClearScreen(chtype blank) { + int i, j; T(("ClearScreen() called")); if (clear_screen) { + UpdateAttrs(blank); TPUTS_TRACE("clear_screen"); putp(clear_screen); SP->_cursrow = SP->_curscol = 0; @@ -1102,22 +1237,32 @@ static void ClearScreen(void) SP->_cursrow = SP->_curscol = -1; GoTo(0,0); + UpdateAttrs(blank); TPUTS_TRACE("clr_eos"); putp(clr_eos); } else if (clr_eol) { SP->_cursrow = SP->_curscol = -1; - while (SP->_cursrow < screen_lines) { - GoTo(SP->_cursrow, 0); + for (i = 0; i < screen_lines; i++) { + GoTo(i, 0); + UpdateAttrs(blank); TPUTS_TRACE("clr_eol"); putp(clr_eol); } GoTo(0,0); + } else { + T(("cannot clear screen")); + return; + } + + for (i = 0; i < screen_lines; i++) { + for (j = 0; j < screen_columns; j++) + curscr->_line[i].text[j] = blank; } + T(("screen cleared")); } - /* ** InsStr(line, count) ** @@ -1206,3 +1351,395 @@ void _nc_outstr(const char *str) _nc_outchars += strlen(str); #endif /* TRACE */ } + +/* + * Physical-scrolling support + * + * This code was adapted from Keith Bostic's hardware scrolling + * support for 4.4BSD curses. I (esr) translated it to use terminfo + * capabilities, narrowed the call interface slightly, and cleaned + * up some convoluted tests. I also added support for the memory_above + * memory_below, and non_dest_scroll_region capabilities. + * + * For this code to work, we must have either + * change_scroll_region and scroll forward/reverse commands, or + * insert and delete line capabilities. + * When the scrolling region has been set, the cursor has to + * be at the last line of the region to make the scroll up + * happen, or on the first line of region to scroll down. + * + * This code makes one aesthetic decision in the opposite way from + * BSD curses. BSD curses preferred pairs of il/dl operations + * over scrolls, allegedly because il/dl looked faster. We, on + * the other hand, prefer scrolls because (a) they're just as fast + * on many terminals and (b) using them avoids bouncing an + * unchanged bottom section of the screen up and down, which is + * visually nasty. + * + * (lav): added more cases, used dl/il when bot==maxy and in csr case. + * + * I used assumption that capabilities il/il1/dl/dl1 work inside + * changed scroll region not shifting screen contents outside of it. + * If there are any terminals behaving different way, it would be + * necessary to add some conditions to scroll_csr_forward/backward. + */ + +/* Try to scroll up assuming given csr (miny, maxy). Returns ERR on failure */ +static int scroll_csr_forward(int n, int top, int bot, int miny, int maxy, chtype blank) +{ + int i; + + if (n == 1 && scroll_forward && top == miny && bot == maxy) + { + GoTo(bot, 0); + UpdateAttrs(blank); + TPUTS_TRACE("scroll_forward"); + tputs(scroll_forward, 0, _nc_outch); + } + else if (n == 1 && delete_line && bot == maxy) + { + GoTo(top, 0); + UpdateAttrs(blank); + TPUTS_TRACE("delete_line"); + tputs(delete_line, 0, _nc_outch); + } + else if (parm_index && top == miny && bot == maxy) + { + GoTo(bot, 0); + 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(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(blank); + for (i = 0; i < n; i++) + { + TPUTS_TRACE("scroll_forward"); + tputs(scroll_forward, 0, _nc_outch); + } + } + else if (delete_line && bot == maxy) + { + GoTo(top, 0); + UpdateAttrs(blank); + for (i = 0; i < n; i++) + { + TPUTS_TRACE("delete_line"); + tputs(delete_line, 0, _nc_outch); + } + } + else + return ERR; + + return OK; +} + +/* Try to scroll down assuming given csr (miny, maxy). Returns ERR on failure */ +/* n > 0 */ +static int scroll_csr_backward(int n, int top, int bot, int miny, int maxy, chtype blank) +{ + int i; + + if (n == 1 && scroll_reverse && top == miny && bot == maxy) + { + GoTo(top, 0); + UpdateAttrs(blank); + TPUTS_TRACE("scroll_reverse"); + tputs(scroll_reverse, 0, _nc_outch); + } + else if (n == 1 && insert_line && bot == maxy) + { + GoTo(top, 0); + UpdateAttrs(blank); + TPUTS_TRACE("insert_line"); + tputs(insert_line, 0, _nc_outch); + } + else if (parm_rindex && top == miny && bot == maxy) + { + GoTo(top, 0); + 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(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(blank); + for (i = 0; i < n; i++) + { + TPUTS_TRACE("scroll_reverse"); + tputs(scroll_reverse, 0, _nc_outch); + } + } + else if (insert_line && bot == maxy) + { + GoTo(top, 0); + UpdateAttrs(blank); + for (i = 0; i < n; i++) + { + TPUTS_TRACE("insert_line"); + tputs(insert_line, 0, _nc_outch); + } + } + else + return ERR; + + return OK; +} + +/* scroll by using delete_line at del and insert_line at ins */ +/* n > 0 */ +static int scroll_idl(int n, int del, int ins, chtype blank) +{ + int i; + + if(!((parm_delete_line || delete_line) && (parm_insert_line || insert_line))) + return ERR; + + GoTo(del, 0); + UpdateAttrs(blank); + if (n == 1 && delete_line) + { + TPUTS_TRACE("delete_line"); + tputs(delete_line, 0, _nc_outch); + } + else if (parm_delete_line) + { + TPUTS_TRACE("parm_delete_line"); + tputs(tparm(parm_delete_line, n, 0), n, _nc_outch); + } + else /* if (delete_line) */ + { + for (i = 0; i < n; i++) + { + TPUTS_TRACE("delete_line"); + tputs(delete_line, 0, _nc_outch); + } + } + + GoTo(ins, 0); + UpdateAttrs(blank); + if (n == 1 && insert_line) + { + TPUTS_TRACE("insert_line"); + tputs(insert_line, 0, _nc_outch); + } + else if (parm_insert_line) + { + TPUTS_TRACE("parm_insert_line"); + tputs(tparm(parm_insert_line, n, 0), n, _nc_outch); + } + else /* if (insert_line) */ + { + for (i = 0; i < n; i++) + { + TPUTS_TRACE("insert_line"); + tputs(insert_line, 0, _nc_outch); + } + } + + return OK; +} + +int _nc_scrolln(int n, int top, int bot, int maxy) +/* scroll region from top to bot by n lines */ +{ + chtype blank=ClrBlank(stdscr); + int i; + bool cursor_saved=FALSE; + int res; + + TR(TRACE_MOVE, ("mvcur_scrolln(%d, %d, %d, %d)", n, top, bot, maxy)); + +#if USE_XMC_SUPPORT + /* + * If we scroll, we might remove a cookie. + */ + if (magic_cookie_glitch > 0) { + return (ERR); + } +#endif + + if (n > 0) /* scroll up (forward) */ + { + /* + * Explicitly clear if stuff pushed off top of region might + * be saved by the terminal. + */ + if (non_dest_scroll_region || (memory_above && top == 0)) { + for (i = 0; i < n; i++) + { + GoTo(i, 0); + ClrToEOL(BLANK); + } + } + + res = scroll_csr_forward(n, top, bot, 0, maxy, blank); + + if (res == ERR && change_scroll_region) + { + if ((((n==1 && scroll_forward) || parm_index) + && (SP->_cursrow == bot || SP->_cursrow == bot-1)) + && save_cursor && restore_cursor) + { + cursor_saved=TRUE; + TPUTS_TRACE("save_cursor"); + tputs(save_cursor, 0, _nc_outch); + } + TPUTS_TRACE("change_scroll_region"); + tputs(tparm(change_scroll_region, top, bot), 0, _nc_outch); + if (cursor_saved) + { + TPUTS_TRACE("restore_cursor"); + tputs(restore_cursor, 0, _nc_outch); + } + else + { + SP->_cursrow = SP->_curscol = -1; + } + + res = scroll_csr_forward(n, top, bot, top, bot, blank); + + TPUTS_TRACE("change_scroll_region"); + tputs(tparm(change_scroll_region, 0, maxy), 0, _nc_outch); + SP->_cursrow = SP->_curscol = -1; + } + + if (res == ERR && _nc_idlok) + res = scroll_idl(n, top, bot-n+1, blank); + } + else /* (n < 0) - scroll down (backward) */ + { + /* + * Do explicit clear to end of region if it's possible that the + * terminal might hold on to stuff we push off the end. + */ + if (non_dest_scroll_region || (memory_below && bot == maxy)) + { + if (bot == maxy && clr_eos) + { + GoTo(maxy + n, 0); + ClrToEOS(BLANK); + } + else if (clr_eol) + { + for (i = 0; i < -n; i++) + { + GoTo(maxy + n + i, 0); + ClrToEOL(BLANK); + } + } + } + + res = scroll_csr_backward(-n, top, bot, 0, maxy, blank); + + if (res == ERR && change_scroll_region) + { + if (top != 0 && (SP->_cursrow == top || SP->_cursrow == top-1) + && save_cursor && restore_cursor) + { + cursor_saved=TRUE; + TPUTS_TRACE("save_cursor"); + tputs(save_cursor, 0, _nc_outch); + } + TPUTS_TRACE("change_scroll_region"); + tputs(tparm(change_scroll_region, top, bot), 0, _nc_outch); + if (cursor_saved) + { + TPUTS_TRACE("restore_cursor"); + tputs(restore_cursor, 0, _nc_outch); + } + else + { + SP->_cursrow = SP->_curscol = -1; + } + + res = scroll_csr_backward(-n, top, bot, top, bot, blank); + + TPUTS_TRACE("change_scroll_region"); + tputs(tparm(change_scroll_region, 0, maxy), 0, _nc_outch); + SP->_cursrow = SP->_curscol = -1; + } + + if (res == ERR && _nc_idlok) + res = scroll_idl(-n, bot+n+1, top, blank); + } + + if (res == ERR) + return(ERR); + + _nc_scroll_window(curscr, n, top, bot, blank); + + return(OK); +} + + +void _nc_screen_resume() +{ + /* make sure terminal is in a sane known state */ + SP->_current_attr = A_NORMAL; + newscr->_clear = TRUE; + + if (SP->_coloron == TRUE && orig_pair) + putp(orig_pair); + if (exit_attribute_mode) + putp(exit_attribute_mode); + else + { + /* turn off attributes */ + if (exit_alt_charset_mode) + putp(exit_alt_charset_mode); + if (exit_standout_mode) + putp(exit_standout_mode); + if (exit_underline_mode) + putp(exit_underline_mode); + } + if (exit_insert_mode) + putp(exit_insert_mode); + if (enter_am_mode && exit_am_mode) + putp(auto_right_margin ? enter_am_mode : exit_am_mode); +} + +void _nc_screen_init() +{ + _nc_screen_resume(); +} + +/* wrap up screen handling */ +void _nc_screen_wrap() +{ + UpdateAttrs(A_NORMAL); +} + +#if USE_XMC_SUPPORT +void _nc_do_xmc_glitch(attr_t previous) +{ + attr_t chg = XMC_CHANGES(previous ^ SP->_current_attr); + + while (chg != 0) { + if (chg & 1) { + SP->_curscol += magic_cookie_glitch; + if (SP->_curscol >= SP->_columns) + wrap_cursor(); + T(("bumped to %d,%d after cookie", SP->_cursrow, SP->_curscol)); + } + chg >>= 1; + } +} +#endif /* USE_XMC_SUPPORT */ diff --git a/ncurses/lib_echo.c b/ncurses/lib_echo.c new file mode 100644 index 00000000..569ab1a1 --- /dev/null +++ b/ncurses/lib_echo.c @@ -0,0 +1,61 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + + +/* + * echo.c + * + * Routines: + * echo() + * noecho() + * + */ + +#include +#include /* cur_term */ + +MODULE_ID("$Id: lib_echo.c,v 1.2 1998/02/11 12:14:00 tom Exp $") + +int echo(void) +{ + T((T_CALLED("echo()"))); + SP->_echo = TRUE; + returnCode(OK); +} + +int noecho(void) +{ + T((T_CALLED("noecho()"))); + SP->_echo = FALSE; + returnCode(OK); +} diff --git a/ncurses/lib_endwin.c b/ncurses/lib_endwin.c index bb1aab0e..efcc188e 100644 --- a/ncurses/lib_endwin.c +++ b/ncurses/lib_endwin.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -30,39 +42,19 @@ #include #include -MODULE_ID("$Id: lib_endwin.c,v 1.10 1997/02/02 00:36:41 tom Exp $") +MODULE_ID("$Id: lib_endwin.c,v 1.14 1998/02/11 12:13:54 tom Exp $") int endwin(void) { T((T_CALLED("endwin()"))); - SP->_endwin = TRUE; - - _nc_mouse_wrap(SP); - - /* SP->_curs{row,col} may be used later in _nc_mvcur_wrap,save_curs */ - mvcur(-1, -1, SP->_cursrow = screen_lines - 1, SP->_curscol = 0); - - curs_set(1); /* set cursor to normal mode */ - - if (SP->_coloron == TRUE && orig_pair) - putp(orig_pair); - - _nc_mvcur_wrap(); /* wrap up cursor addressing */ - - if (SP && (SP->_current_attr != A_NORMAL)) - vidattr(A_NORMAL); - - /* - * Reset terminal's tab counter. There's a long-time bug that - * if you exit a "curses" program such as vi or more, tab - * forward, and then backspace, the cursor doesn't go to the - * right place. The problem is that the kernel counts the - * escape sequences that reset things as column positions. - * Utter a \r to reset this invisibly. - */ - _nc_outch('\r'); + if (SP) { + SP->_endwin = TRUE; + SP->_mouse_wrap(SP); + _nc_screen_wrap(); + _nc_mvcur_wrap(); /* wrap up cursor addressing */ + } returnCode(reset_shell_mode()); } diff --git a/ncurses/lib_erase.c b/ncurses/lib_erase.c index 2687e1f2..1e4237bf 100644 --- a/ncurses/lib_erase.c +++ b/ncurses/lib_erase.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -29,40 +41,33 @@ #include -MODULE_ID("$Id: lib_erase.c,v 1.7 1997/02/01 23:18:18 tom Exp $") +MODULE_ID("$Id: lib_erase.c,v 1.11 1998/02/11 12:13:54 tom Exp $") int werase(WINDOW *win) { +int code = ERR; int y; -chtype *sp, *end, *start, *maxx = NULL; -short minx; +chtype blank; +chtype *sp, *end, *start; T((T_CALLED("werase(%p)"), win)); - for (y = 0; y <= win->_maxy; y++) { - minx = _NOCHANGE; - start = win->_line[y].text; - end = &start[win->_maxx]; - - maxx = start; - for (sp = start; sp <= end; sp++) { - maxx = sp; - if (minx == _NOCHANGE) - minx = sp - start; - *sp = _nc_background(win); - } - - if (minx != _NOCHANGE) { - if (win->_line[y].firstchar > minx || - win->_line[y].firstchar == _NOCHANGE) - win->_line[y].firstchar = minx; - - if (win->_line[y].lastchar < maxx - win->_line[y].text) - win->_line[y].lastchar = maxx - win->_line[y].text; - } + if (win) { + blank = _nc_background(win); + for (y = 0; y <= win->_maxy; y++) { + start = win->_line[y].text; + end = &start[win->_maxx]; + + for (sp = start; sp <= end; sp++) + *sp = blank; + + win->_line[y].firstchar = 0; + win->_line[y].lastchar = win->_maxx; + } + win->_curx = win->_cury = 0; + win->_flags &= ~_WRAPPED; + _nc_synchook(win); + code = OK; } - win->_curx = win->_cury = 0; - win->_flags &= ~_WRAPPED; - _nc_synchook(win); - returnCode(OK); + returnCode(code); } diff --git a/ncurses/lib_flash.c b/ncurses/lib_flash.c new file mode 100644 index 00000000..49751acc --- /dev/null +++ b/ncurses/lib_flash.c @@ -0,0 +1,69 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + + +/* + * flash.c + * + * The routine flash(). + * + */ + +#include +#include /* beep, flash */ + +MODULE_ID("$Id: lib_flash.c,v 1.2 1998/02/11 12:13:55 tom Exp $") + +/* + * flash() + * + * Flash the current terminal's screen if possible. If not, + * sound the audible bell if one exists. + * + */ + +int flash(void) +{ + T((T_CALLED("flash()"))); + + /* FIXME: should make sure that we are not in altchar mode */ + if (flash_screen) { + TPUTS_TRACE("flash_screen"); + returnCode(putp(flash_screen)); + } else if (bell) { + TPUTS_TRACE("bell"); + returnCode(putp(bell)); + } + else + returnCode(ERR); +} diff --git a/ncurses/lib_freeall.c b/ncurses/lib_freeall.c index 4eaf6599..fe756bb4 100644 --- a/ncurses/lib_freeall.c +++ b/ncurses/lib_freeall.c @@ -1,22 +1,34 @@ -/****************************************************************************** - * Copyright 1996 by Thomas E. Dickey * - * All Rights Reserved. * - * * - * Permission to use, copy, modify, and distribute this software and its * - * documentation for any purpose and without fee is hereby granted, provided * - * that the above copyright notice appear in all copies and that both that * - * copyright notice and this permission notice appear in supporting * - * documentation, and that the name of the above listed copyright holder(s) * - * not be used in advertising or publicity pertaining to distribution of the * - * software without specific, written prior permission. THE ABOVE LISTED * - * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * - * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - ******************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1996,1997 * + ****************************************************************************/ #define HAVE_NC_FREEALL 1 @@ -27,7 +39,7 @@ extern int malloc_errfd; /* FIXME */ #endif -MODULE_ID("$Id: lib_freeall.c,v 1.8 1997/02/15 18:53:43 tom Exp $") +MODULE_ID("$Id: lib_freeall.c,v 1.11 1998/02/11 12:13:57 tom Exp $") static void free_slk(SLK *p) { @@ -95,6 +107,7 @@ void _nc_freeall(void) if (SP != 0) { free_tries (SP->_keytry); + free_tries (SP->_key_ok); free_slk(SP->_slk); FreeIfNeeded(SP->_color_pairs); FreeIfNeeded(SP->_color_table); @@ -108,6 +121,9 @@ void _nc_freeall(void) _nc_free_termtype(&(cur_term->type), TRUE); } +#ifdef TRACE + (void) _nc_trace_buf(-1, 0); +#endif #if HAVE_LIBDBMALLOC malloc_dump(malloc_errfd); #elif HAVE_LIBDMALLOC diff --git a/ncurses/lib_getch.c b/ncurses/lib_getch.c index d59531f2..337cc2ca 100644 --- a/ncurses/lib_getch.c +++ b/ncurses/lib_getch.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* ** lib_getch.c @@ -28,34 +40,21 @@ #include -MODULE_ID("$Id: lib_getch.c,v 1.24 1997/02/15 21:12:16 tom Exp $") - -#define head SP->_fifohead -#define tail SP->_fifotail -#define peek SP->_fifopeek +MODULE_ID("$Id: lib_getch.c,v 1.40 1998/02/11 12:13:58 tom Exp $") -#define h_inc() { head == FIFO_SIZE-1 ? head = 0 : head++; if (head == tail) head = -1, tail = 0;} -#define h_dec() { head == 0 ? head = FIFO_SIZE-1 : head--; if (head == tail) tail = -1;} -#define t_inc() { tail == FIFO_SIZE-1 ? tail = 0 : tail++; if (tail == head) tail = -1;} -#define p_inc() { peek == FIFO_SIZE-1 ? peek = 0 : peek++;} +#include int ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */ -static int fifo_peek(void) +static inline int fifo_peek(void) { - T(("peeking at %d", peek+1)); - return SP->_fifo[++peek]; + int ch = SP->_fifo[peek]; + T(("peeking at %d", peek)); + + p_inc(); + return ch; } -#ifdef TRACE -static inline void fifo_dump(void) -{ -int i; - T(("head = %d, tail = %d, peek = %d", head, tail, peek)); - for (i = 0; i < 10; i++) - T(("char %d = %s", i, _trace_key(SP->_fifo[i]))); -} -#endif /* TRACE */ static inline int fifo_pull(void) { @@ -63,55 +62,48 @@ int ch; ch = SP->_fifo[head]; T(("pulling %d from %d", ch, head)); - h_inc(); + if (peek == head) + { + h_inc(); + peek = head; + } + else + h_inc(); + #ifdef TRACE - if (_nc_tracing & TRACE_IEVENT) fifo_dump(); + if (_nc_tracing & TRACE_IEVENT) _nc_fifo_dump(); #endif return ch; } -int ungetch(int ch) -{ - if (tail == -1) - return ERR; - if (head == -1) { - head = 0; - t_inc() - } else - h_dec(); - - SP->_fifo[head] = ch; - T(("ungetch ok")); -#ifdef TRACE - if (_nc_tracing & TRACE_IEVENT) fifo_dump(); -#endif - return OK; -} - static inline int fifo_push(void) { int n; unsigned int ch; if (tail == -1) return ERR; - /* FALLTHRU */ + +#ifdef HIDE_EINTR again: errno = 0; +#endif + #if USE_GPM_SUPPORT - if ((_nc_mouse_fd() >= 0) + if ((SP->_mouse_fd >= 0) && (_nc_timed_wait(3, -1, (int *)0) & 2)) { - _nc_mouse_event(SP); + SP->_mouse_event(SP); ch = KEY_MOUSE; n = 1; } else #endif { - unsigned char c2; + unsigned char c2=0; n = read(SP->_ifd, &c2, 1); ch = c2; } +#ifdef HIDE_EINTR /* * Under System V curses with non-restarting signals, getch() returns * with value ERR when a handled signal keeps it from completing. @@ -123,20 +115,23 @@ again: */ if (n <= 0 && errno == EINTR) goto again; +#endif if ((n == -1) || (n == 0)) { - T(("read(%d,&ch,1)=%d", SP->_ifd, n)); + T(("read(%d,&ch,1)=%d, errno=%d", SP->_ifd, n, errno)); return ERR; } T(("read %d characters", n)); SP->_fifo[tail] = ch; - if (head == -1) head = tail; + SP->_fifohold = 0; + if (head == -1) + head = peek = tail; t_inc(); T(("pushed %#x at %d", ch, tail)); #ifdef TRACE - if (_nc_tracing & TRACE_IEVENT) fifo_dump(); + if (_nc_tracing & TRACE_IEVENT) _nc_fifo_dump(); #endif return ch; } @@ -151,34 +146,9 @@ int i; static int kgetch(WINDOW *); -void _nc_backspace(WINDOW *win) -{ - if (win->_curx == 0) - { - beep(); - return; - } - - mvwaddstr(curscr, win->_begy + win->_cury + win->_yoffset, - win->_begx + win->_curx, "\b \b"); - waddstr(win, "\b \b"); - - /* - * This used to do the equivalent of _nc_outstr("\b \b"), which - * would fail on terminals with a non-backspace cursor_left - * character. - */ - mvcur(win->_begy + win->_cury + win->_yoffset, - win->_begx + win->_curx, - win->_begy + win->_cury + win->_yoffset, - win->_begx + win->_curx - 1); - _nc_outstr(" "); - mvcur(win->_begy + win->_cury + win->_yoffset, - win->_begx + win->_curx, - win->_begy + win->_cury + win->_yoffset, - win->_begx + win->_curx - 1); - SP->_curscol--; -} +#define wgetch_should_refresh(win) (\ + (is_wintouched(win) || (win->_flags & _HASMOVED)) \ + && !(win->_flags & _ISPAD)) int wgetch(WINDOW *win) @@ -187,6 +157,19 @@ int ch; T((T_CALLED("wgetch(%p)"), win)); + if (!win) + returnCode(ERR); + + if (cooked_key_in_fifo()) + { + if (wgetch_should_refresh(win)) + wrefresh(win); + + ch = fifo_pull(); + T(("wgetch returning (pre-cooked): %#x = %s", ch, _trace_key(ch));) + returnCode(ch); + } + /* * Handle cooked mode. Grab a string from the screen, * stuff its contents in the FIFO queue, and pop off @@ -200,23 +183,15 @@ int ch; wgetnstr(win, buf, MAXCOLUMNS); - for (sp = buf; *sp; sp++) - ungetch(*sp); + /* ungetch in reverse order */ ungetch('\n'); + for (sp = buf+strlen(buf); sp>buf; sp--) + ungetch(sp[-1]); - return(fifo_pull()); + returnCode(fifo_pull()); } - /* this should be eliminated */ - if (!has_ic() - && !win->_scroll - && (SP->_echo) - && (win->_flags & _FULLWIN) - && win->_curx == win->_maxx - && win->_cury == win->_maxy) - returnCode(ERR); - - if ((is_wintouched(win) || (win->_flags & _HASMOVED)) && !(win->_flags & _ISPAD)) + if (wgetch_should_refresh(win)) wrefresh(win); if (!win->_notimeout && (win->_delay >= 0 || SP->_cbreak > 1)) { @@ -224,11 +199,11 @@ int ch; T(("timed delay in wgetch()")); if (SP->_cbreak > 1) - delay = (SP->_cbreak-1) * 100; + delay = (SP->_cbreak - 1) * 100; else delay = win->_delay; - T(("delay is %d microseconds", delay)); + T(("delay is %d milliseconds", delay)); if (head == -1) /* fifo is empty */ if (!_nc_timed_wait(3, delay, (int *)0)) @@ -246,7 +221,7 @@ int ch; * * Note: if the mouse code starts failing to compose * press/release events into clicks, you should probably - * increase _nc_max_click_interval. + * increase the wait with mouseinterval(). */ int runcount = 0; @@ -255,13 +230,13 @@ int ch; if (ch == KEY_MOUSE) { ++runcount; - if (_nc_mouse_inline(SP)) + if (SP->_mouse_inline(SP)) break; } } while (ch == KEY_MOUSE - && (_nc_timed_wait(3, _nc_max_click_interval, (int *)0) - || !_nc_mouse_parse(runcount))); + && (_nc_timed_wait(3, SP->_maxclick, (int *)0) + || !SP->_mouse_parse(runcount))); if (runcount > 0 && ch != KEY_MOUSE) { /* mouse event sequence ended by keystroke, push it */ @@ -276,6 +251,19 @@ int ch; if (ch == ERR) { +#if USE_SIZECHANGE + if(SP->_sig_winch) + { + _nc_update_screensize(); + /* resizeterm can push KEY_RESIZE */ + if(cooked_key_in_fifo()) + { + ch = fifo_pull(); + T(("wgetch returning (pre-cooked): %#x = %s", ch, _trace_key(ch));) + returnCode(ch); + } + } +#endif T(("wgetch returning ERR")); returnCode(ERR); } @@ -295,22 +283,10 @@ int ch; if (!SP->_use_meta) ch &= 0x7f; - if (!(win->_flags & _ISPAD) && SP->_echo) { - /* there must be a simpler way of doing this */ - if (ch == erasechar() || ch == KEY_BACKSPACE || ch == KEY_LEFT) - _nc_backspace(win); - else if (ch < KEY_MIN) { - mvwaddch(curscr, - win->_begy + win->_cury + win->_yoffset, - win->_begx + win->_curx, - ch); - waddch(win, (chtype)ch); - } - else - beep(); - } + if (SP->_echo && ch < KEY_MIN && !(win->_flags & _ISPAD)) + wechochar(win, (chtype)ch); - T(("wgetch returning : %#x = %s", ch, _trace_key(ch));) + T(("wgetch returning : %#x = %s", ch, _trace_key(ch))); returnCode(ch); } @@ -326,6 +302,9 @@ int ch; ** sequence is received by the time the alarm goes off, pass through ** the sequence gotten so far. ** +** This function must be called when there is no cooked keys in queue. +** (that is head==-1 || peek==head) +** */ static int @@ -339,43 +318,60 @@ int timeleft = ESCDELAY; ptr = SP->_keytry; - if (head == -1) { - if ((ch = fifo_push()) == ERR) - return ERR; - peek = 0; - while (ptr != NULL) { - TR(TRACE_IEVENT, ("ch: %s", _trace_key((unsigned char)ch))); - while ((ptr != NULL) && (ptr->ch != (unsigned char)ch)) - ptr = ptr->sibling; + for(;;) + { + if (!raw_key_in_fifo()) + { + if(fifo_push() == ERR) + { + peek = head; /* the keys stay uninterpreted */ + return ERR; + } + } + ch = fifo_peek(); + if (ch >= KEY_MIN) + { + peek = head; + /* assume the key is the last in fifo */ + t_dec(); /* remove the key */ + return ch; + } + + TR(TRACE_IEVENT, ("ch: %s", _trace_key((unsigned char)ch))); + while ((ptr != NULL) && (ptr->ch != (unsigned char)ch)) + ptr = ptr->sibling; #ifdef TRACE - if (ptr == NULL) - {TR(TRACE_IEVENT, ("ptr is null"));} - else - TR(TRACE_IEVENT, ("ptr=%p, ch=%d, value=%d", - ptr, ptr->ch, ptr->value)); + if (ptr == NULL) + {TR(TRACE_IEVENT, ("ptr is null"));} + else + TR(TRACE_IEVENT, ("ptr=%p, ch=%d, value=%d", + ptr, ptr->ch, ptr->value)); #endif /* TRACE */ - if (ptr != NULL) - if (ptr->value != 0) { /* sequence terminated */ - TR(TRACE_IEVENT, ("end of sequence")); - fifo_clear(); - return(ptr->value); - } else { /* go back for another character */ - ptr = ptr->child; - TR(TRACE_IEVENT, ("going back for more")); - } else - break; - - TR(TRACE_IEVENT, ("waiting for rest of sequence")); - if (!_nc_timed_wait(3, timeleft, &timeleft)) { - TR(TRACE_IEVENT, ("ran out of time")); - return(fifo_pull()); - } else { - TR(TRACE_IEVENT, ("got more!")); - fifo_push(); - ch = fifo_peek(); - } + if (ptr == NULL) + break; + + if (ptr->value != 0) { /* sequence terminated */ + TR(TRACE_IEVENT, ("end of sequence")); + if (peek == tail) + fifo_clear(); + else + head = peek; + return(ptr->value); + } + + ptr = ptr->child; + + if (!raw_key_in_fifo()) + { + TR(TRACE_IEVENT, ("waiting for rest of sequence")); + if (!_nc_timed_wait(3, timeleft, &timeleft)) { + TR(TRACE_IEVENT, ("ran out of time")); + break; + } } } - return(fifo_pull()); + ch = fifo_pull(); + peek = head; + return ch; } diff --git a/ncurses/lib_getstr.c b/ncurses/lib_getstr.c index aaed1873..33a637ed 100644 --- a/ncurses/lib_getstr.c +++ b/ncurses/lib_getstr.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -30,7 +42,7 @@ #include #include -MODULE_ID("$Id: lib_getstr.c,v 1.11 1997/02/01 23:22:54 tom Exp $") +MODULE_ID("$Id: lib_getstr.c,v 1.19 1998/02/11 12:13:53 tom Exp $") /* * This wipes out the last character, no matter whether it was a tab, control @@ -60,7 +72,7 @@ static char *WipeOut(WINDOW *win, int y, int x, char *first, char *last, bool ec int wgetnstr(WINDOW *win, char *str, int maxlen) { TTY buf; -bool oldnl, oldecho, oldraw, oldcbreak, oldkeypad; +bool oldnl, oldecho, oldraw, oldcbreak; char erasec; char killc; char *oldstr; @@ -69,18 +81,19 @@ int y, x; T((T_CALLED("wgetnstr(%p,%p, %d)"), win, str, maxlen)); - GET_TTY(cur_term->Filedes, &buf); + if (!win) + returnCode(ERR); + + _nc_get_curterm(&buf); oldnl = SP->_nl; oldecho = SP->_echo; oldraw = SP->_raw; oldcbreak = SP->_cbreak; - oldkeypad = win->_use_keypad; nl(); noecho(); noraw(); cbreak(); - keypad(win, TRUE); erasec = erasechar(); killc = killchar(); @@ -101,8 +114,13 @@ int y, x; if (ch == '\n' || ch == '\r' || ch == KEY_DOWN - || ch == KEY_ENTER) + || ch == KEY_ENTER) { + if (oldecho == TRUE + && win->_cury == win->_maxy + && win->_scroll) + wechochar(win, '\n'); break; + } if (ch == erasec || ch == KEY_LEFT || ch == KEY_BACKSPACE) { if (str > oldstr) { str = WipeOut(win, y, x, oldstr, str, oldecho); @@ -117,6 +135,7 @@ int y, x; } else { *str++ = ch; if (oldecho == TRUE) { + int oldy = win->_cury; if (waddch(win, ch) == ERR) { /* * We can't really use the lower-right @@ -127,6 +146,20 @@ int y, x; waddch(win, ' '); str = WipeOut(win, y, x, oldstr, str, oldecho); continue; + } else if (win->_flags & _WRAPPED) { + /* + * If the last waddch forced a wrap & + * scroll, adjust our reference point + * for erasures. + */ + if (win->_scroll + && oldy == win->_maxy + && win->_cury == win->_maxy) { + if (--y <= 0) { + y = 0; + } + } + win->_flags &= ~_WRAPPED; } wrefresh(win); } @@ -147,10 +180,7 @@ int y, x; SP->_raw = oldraw; SP->_cbreak = oldcbreak; - SET_TTY(cur_term->Filedes, &buf); - - if (oldkeypad == FALSE) - keypad(win, FALSE); + _nc_set_curterm(&buf); *str = '\0'; if (ch == ERR) diff --git a/ncurses/lib_hline.c b/ncurses/lib_hline.c new file mode 100644 index 00000000..d3b3f2dc --- /dev/null +++ b/ncurses/lib_hline.c @@ -0,0 +1,81 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + + + +/* +** lib_hline.c +** +** The routine whline(). +** +*/ + +#include + +MODULE_ID("$Id: lib_hline.c,v 1.2 1998/02/11 12:13:55 tom Exp $") + +int whline(WINDOW *win, chtype ch, int n) +{ +int code = ERR; +short line; +short start; +short end; + + T((T_CALLED("whline(%p,%s,%d)"), win, _tracechtype(ch), n)); + + if (win) { + line = win->_cury; + start = win->_curx; + end = start + n - 1; + if (end > win->_maxx) + end = win->_maxx; + + if (win->_line[line].firstchar == _NOCHANGE + || win->_line[line].firstchar > start) + win->_line[line].firstchar = start; + if (win->_line[line].lastchar == _NOCHANGE + || win->_line[line].lastchar < start) + win->_line[line].lastchar = end; + + if (ch == 0) + ch = ACS_HLINE; + ch = _nc_render(win, ch); + + while ( end >= start) { + win->_line[line].text[end] = ch; + end--; + } + code = OK; + } + returnCode(code); +} diff --git a/ncurses/lib_immedok.c b/ncurses/lib_immedok.c new file mode 100644 index 00000000..5590ec9f --- /dev/null +++ b/ncurses/lib_immedok.c @@ -0,0 +1,54 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + + +/* +** lib_immedok.c +** +** The routine immedok. +** +*/ + +#include + +MODULE_ID("$Id: lib_immedok.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +void immedok(WINDOW *win, bool flag) +{ + T((T_CALLED("immedok(%p,%d)"), win, flag)); + + if (win) + win->_immed = flag; + + returnVoid; +} diff --git a/ncurses/lib_inchstr.c b/ncurses/lib_inchstr.c index 1d90a5f6..4779ae09 100644 --- a/ncurses/lib_inchstr.c +++ b/ncurses/lib_inchstr.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -29,16 +41,21 @@ #include -MODULE_ID("$Id: lib_inchstr.c,v 1.5 1997/02/02 01:06:03 tom Exp $") +MODULE_ID("$Id: lib_inchstr.c,v 1.7 1998/02/11 12:13:55 tom Exp $") int winchnstr(WINDOW *win, chtype *str, int n) { - int i; + int i = 0; T((T_CALLED("winchnstr(%p,%p,%d)"), win, str, n)); - for (i = 0; (n < 0 || (i < n)) && (win->_curx + i <= win->_maxx); i++) + if (!str) + returnCode(0); + + if (win) { + for (; (n < 0 || (i < n)) && (win->_curx + i <= win->_maxx); i++) str[i] = win->_line[win->_cury].text[win->_curx + i]; + } str[i] = (chtype)0; returnCode(i); diff --git a/ncurses/lib_initscr.c b/ncurses/lib_initscr.c index 3a995d22..e33f0b34 100644 --- a/ncurses/lib_initscr.c +++ b/ncurses/lib_initscr.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* ** lib_initscr.c @@ -27,42 +39,13 @@ */ #include -#include /* cur_term */ +#include /* for MAX_ALIAS */ #if HAVE_SYS_TERMIO_H #include /* needed for ISC */ #endif -MODULE_ID("$Id: lib_initscr.c,v 1.18 1997/03/08 14:03:59 tom Exp $") - -#ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */ -#define ONLCR 0 -#endif - -/* - * SVr4/XSI Curses specify that hardware echo is turned off in initscr, and not - * restored during the curses session. The library simulates echo in software. - * (The behavior is unspecified if the application enables hardware echo). - * - * The newterm function also initializes terminal settings. - */ -int _nc_initscr(void) -{ - /* for extended XPG4 conformance requires cbreak() at this point */ - /* (SVr4 curses does this anyway) */ - cbreak(); - -#ifdef TERMIOS - cur_term->Nttyb.c_lflag &= ~(ECHO|ECHONL); - cur_term->Nttyb.c_iflag &= ~(ICRNL|INLCR|IGNCR); - cur_term->Nttyb.c_oflag &= ~(ONLCR); -#else - cur_term->Nttyb.sg_flags &= ~(ECHO|CRMOD); -#endif - if ((SET_TTY(cur_term->Filedes, &cur_term->Nttyb)) == -1) - return ERR; - return OK; -} +MODULE_ID("$Id: lib_initscr.c,v 1.21 1998/02/11 12:14:00 tom Exp $") WINDOW *initscr(void) { @@ -74,7 +57,8 @@ const char *name; if (!initialized) { initialized = TRUE; - if ((name = getenv("TERM")) == 0) + if ((name = getenv("TERM")) == 0 + || *name == '\0') name = "unknown"; if (newterm(name, stdout, stdin) == 0) { fprintf(stderr, "Error opening terminal: %s.\n", name); @@ -94,7 +78,7 @@ const char *name; char *termname(void) { char *term = getenv("TERM"); -static char ret[15]; +static char ret[MAX_ALIAS]; T(("termname() called")); diff --git a/ncurses/lib_insch.c b/ncurses/lib_insch.c index 2040b385..ebee1788 100644 --- a/ncurses/lib_insch.c +++ b/ncurses/lib_insch.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ @@ -30,27 +42,31 @@ #include -MODULE_ID("$Id: lib_insch.c,v 1.7 1997/04/12 17:43:02 tom Exp $") +MODULE_ID("$Id: lib_insch.c,v 1.9 1998/02/11 12:13:54 tom Exp $") int winsch(WINDOW *win, chtype c) { +int code = ERR; chtype *temp1, *temp2; chtype *end; T((T_CALLED("winsch(%p, %s)"), win, _tracechtype(c))); - end = &win->_line[win->_cury].text[win->_curx]; - temp1 = &win->_line[win->_cury].text[win->_maxx]; - temp2 = temp1 - 1; + if (win) { + end = &win->_line[win->_cury].text[win->_curx]; + temp1 = &win->_line[win->_cury].text[win->_maxx]; + temp2 = temp1 - 1; - while (temp1 > end) + while (temp1 > end) *temp1-- = *temp2--; - - *temp1 = _nc_render(win, c); - - win->_line[win->_cury].lastchar = win->_maxx; - if (win->_line[win->_cury].firstchar == _NOCHANGE - || win->_line[win->_cury].firstchar > win->_curx) + + *temp1 = _nc_render(win, c); + + win->_line[win->_cury].lastchar = win->_maxx; + if (win->_line[win->_cury].firstchar == _NOCHANGE + || win->_line[win->_cury].firstchar > win->_curx) win->_line[win->_cury].firstchar = win->_curx; - returnCode(OK); + code = OK; + } + returnCode(code); } diff --git a/ncurses/lib_insdel.c b/ncurses/lib_insdel.c index c367c93d..48e108de 100644 --- a/ncurses/lib_insdel.c +++ b/ncurses/lib_insdel.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* ** lib_insdel.c @@ -30,19 +42,21 @@ #include -MODULE_ID("$Id") +MODULE_ID("$Id: lib_insdel.c,v 1.8 1998/02/11 12:13:55 tom Exp $") int winsdelln(WINDOW *win, int n) { - T((T_CALLED("winsdel(%p,%d)"), win, n)); +int code = ERR; - if (n == 0) - returnCode(OK); - - _nc_scroll_window(win, -n, win->_cury, win->_maxy); - touchline(win, win->_cury, win->_maxy - win->_cury + 1); + T((T_CALLED("winsdel(%p,%d)"), win, n)); - _nc_synchook(win); - returnCode(OK); + if (win) { + if (n != 0) { + _nc_scroll_window(win, -n, win->_cury, win->_maxy, _nc_background(win)); + _nc_synchook(win); + } + code = OK; + } + returnCode(code); } diff --git a/ncurses/lib_insstr.c b/ncurses/lib_insstr.c index 5c440b72..0da8c220 100644 --- a/ncurses/lib_insstr.c +++ b/ncurses/lib_insstr.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ @@ -31,33 +43,39 @@ #include #include -MODULE_ID("$Id: lib_insstr.c,v 1.9 1997/02/15 16:09:53 tom Exp $") +MODULE_ID("$Id: lib_insstr.c,v 1.12 1998/02/23 12:12:16 tom Exp $") -int winsnstr(WINDOW *win, const char *str, int n) +int winsnstr(WINDOW *win, const char *s, int n) { -short oy = win->_cury; -short ox = win->_curx; -const char *cp; - - T((T_CALLED("winsstr(%p,%s,%d)"), win, _nc_visbuf(str), n)); - - for (cp = str; *cp && (n <= 0 || (cp - str) < n); cp++) { - if (*cp == '\n' || *cp == '\r' || *cp == '\t' || *cp == '\b') - _nc_waddch_nosync(win, (chtype)(*cp)); - else if (is7bits(*cp) && iscntrl(*cp)) { - winsch(win, ' ' + (chtype)(*cp)); - winsch(win, '^'); - win->_curx += 2; - } else { - winsch(win, (chtype)(*cp)); - win->_curx++; - } - if (win->_curx > win->_maxx) - win->_curx = win->_maxx; - } +int code = ERR; +short oy; +short ox ; +const unsigned char *str = (const unsigned char *)s; +const unsigned char *cp; + + T((T_CALLED("winsnstr(%p,%s,%d)"), win, _nc_visbuf(str), n)); - win->_curx = ox; - win->_cury = oy; - _nc_synchook(win); - returnCode(OK); + if (win && str) { + oy = win->_cury; ox = win->_curx; + for (cp = str; *cp && (n <= 0 || (cp - str) < n); cp++) { + if (*cp == '\n' || *cp == '\r' || *cp == '\t' || *cp == '\b') + _nc_waddch_nosync(win, (chtype)(*cp)); + else if (is7bits(*cp) && iscntrl(*cp)) { + winsch(win, ' ' + (chtype)(*cp)); + winsch(win, '^'); + win->_curx += 2; + } else { + winsch(win, (chtype)(*cp)); + win->_curx++; + } + if (win->_curx > win->_maxx) + win->_curx = win->_maxx; + } + + win->_curx = ox; + win->_cury = oy; + _nc_synchook(win); + code = OK; + } + returnCode(code); } diff --git a/ncurses/lib_instr.c b/ncurses/lib_instr.c index 607a8e09..b3e1d030 100644 --- a/ncurses/lib_instr.c +++ b/ncurses/lib_instr.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -29,28 +41,33 @@ #include -MODULE_ID("$Id: lib_instr.c,v 1.6 1997/05/03 10:51:07 juergen Exp $") +MODULE_ID("$Id: lib_instr.c,v 1.8 1998/02/11 12:13:54 tom Exp $") int winnstr(WINDOW *win, char *str, int n) { - int i, row, col; + int i=0, row, col; T((T_CALLED("winnstr(%p,%p,%d)"), win, str, n)); - getyx(win, row, col); + if (!str) + returnCode(0); + + if (win) { + getyx(win, row, col); - if (n < 0) - n = win->_maxx - win->_curx + 1; + if (n < 0) + n = win->_maxx - win->_curx + 1; - for (i = 0; i < n;) { - str[i++] = TextOf(win->_line[row].text[col]); - if (++col > win->_maxx) { - col = 0; - if (++row > win->_maxy) - break; - } + for (; i < n;) { + str[i++] = TextOf(win->_line[row].text[col]); + if (++col > win->_maxx) { + col = 0; + if (++row > win->_maxy) + break; + } + } } str[i] = '\0'; /* SVr4 does not seem to count the null */ - returnCode(i); } + diff --git a/ncurses/lib_isendwin.c b/ncurses/lib_isendwin.c index 39f90098..0ed2494d 100644 --- a/ncurses/lib_isendwin.c +++ b/ncurses/lib_isendwin.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -29,7 +41,7 @@ #include -MODULE_ID("$Id: lib_isendwin.c,v 1.2 1996/07/30 22:29:50 tom Exp $") +MODULE_ID("$Id: lib_isendwin.c,v 1.3 1998/02/11 12:13:53 tom Exp $") int isendwin(void) { diff --git a/ncurses/lib_kernel.c b/ncurses/lib_kernel.c index 86f87726..56f06a4c 100644 --- a/ncurses/lib_kernel.c +++ b/ncurses/lib_kernel.c @@ -1,30 +1,41 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* * lib_kernel.c * * Misc. low-level routines: - * napms() * reset_prog_mode() * reset_shell_mode() * erasechar() @@ -41,25 +52,19 @@ #include #include /* cur_term */ -MODULE_ID("$Id: lib_kernel.c,v 1.13 1997/02/02 00:33:14 tom Exp $") - -int napms(int ms) -{ - T((T_CALLED("napms(%d)"), ms)); - - usleep(1000*(unsigned)ms); - returnCode(OK); -} +MODULE_ID("$Id: lib_kernel.c,v 1.17 1998/02/11 12:13:57 tom Exp $") int reset_prog_mode(void) { T((T_CALLED("reset_prog_mode()"))); - SET_TTY(cur_term->Filedes, &cur_term->Nttyb); - if (SP && stdscr && stdscr->_use_keypad) - _nc_keypad(TRUE); - - returnCode(OK); + if (cur_term != 0) { + _nc_set_curterm(&cur_term->Nttyb); + if (SP && stdscr && stdscr->_use_keypad) + _nc_keypad(TRUE); + returnCode(OK); + } + returnCode(ERR); } @@ -67,14 +72,15 @@ int reset_shell_mode(void) { T((T_CALLED("reset_shell_mode()"))); - if (SP) - { - fflush(SP->_ofp); - _nc_keypad(FALSE); + if (cur_term != 0) { + if (SP) + { + fflush(SP->_ofp); + _nc_keypad(FALSE); + } + returnCode(_nc_set_curterm(&cur_term->Ottyb)); } - - SET_TTY(cur_term->Filedes, &cur_term->Ottyb); - returnCode(OK); + returnCode(ERR); } /* @@ -89,12 +95,14 @@ erasechar(void) { T((T_CALLED("erasechar()"))); + if (cur_term != 0) { #ifdef TERMIOS - returnCode(cur_term->Ottyb.c_cc[VERASE]); + returnCode(cur_term->Ottyb.c_cc[VERASE]); #else - returnCode(cur_term->Ottyb.sg_erase); + returnCode(cur_term->Ottyb.sg_erase); #endif - + } + returnCode(ERR); } @@ -111,11 +119,14 @@ killchar(void) { T((T_CALLED("killchar()"))); + if (cur_term != 0) { #ifdef TERMIOS - returnCode(cur_term->Ottyb.c_cc[VKILL]); + returnCode(cur_term->Ottyb.c_cc[VKILL]); #else - returnCode(cur_term->Ottyb.sg_kill); + returnCode(cur_term->Ottyb.sg_kill); #endif + } + returnCode(ERR); } @@ -131,22 +142,24 @@ int flushinp(void) { T((T_CALLED("flushinp()"))); + if (cur_term != 0) { #ifdef TERMIOS - tcflush(cur_term->Filedes, TCIFLUSH); + tcflush(cur_term->Filedes, TCIFLUSH); #else - errno = 0; - do { - ioctl(cur_term->Filedes, TIOCFLUSH, 0); - } while - (errno == EINTR); + errno = 0; + do { + ioctl(cur_term->Filedes, TIOCFLUSH, 0); + } while + (errno == EINTR); #endif - if (SP) { - SP->_fifohead = -1; - SP->_fifotail = 0; - SP->_fifopeek = 0; + if (SP) { + SP->_fifohead = -1; + SP->_fifotail = 0; + SP->_fifopeek = 0; + } + returnCode(OK); } - returnCode(OK); - + returnCode(ERR); } /* @@ -160,14 +173,12 @@ int savetty(void) { T((T_CALLED("savetty()"))); - GET_TTY(cur_term->Filedes, &buf); - returnCode(OK); + returnCode(_nc_get_curterm(&buf)); } int resetty(void) { T((T_CALLED("resetty()"))); - SET_TTY(cur_term->Filedes, &buf); - returnCode(OK); + returnCode(_nc_set_curterm(&buf)); } diff --git a/ncurses/lib_leaveok.c b/ncurses/lib_leaveok.c new file mode 100644 index 00000000..063ab447 --- /dev/null +++ b/ncurses/lib_leaveok.c @@ -0,0 +1,60 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + + +/* +** lib_leaveok.c +** +** The routine leaveok. +** +*/ + +#include + +MODULE_ID("$Id: lib_leaveok.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +int leaveok(WINDOW *win, bool flag) +{ + T((T_CALLED("leaveok(%p,%d)"), win, flag)); + + if (win) { + win->_leaveok = flag; + if (flag == TRUE) + curs_set(0); + else + curs_set(1); + returnCode(OK); + } + else + returnCode(ERR); +} diff --git a/ncurses/lib_longname.c b/ncurses/lib_longname.c index 50442996..0b39207e 100644 --- a/ncurses/lib_longname.c +++ b/ncurses/lib_longname.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -29,7 +41,7 @@ #include -MODULE_ID("$Id: lib_longname.c,v 1.5 1996/12/21 14:24:06 tom Exp $") +MODULE_ID("$Id: lib_longname.c,v 1.6 1998/02/11 12:13:53 tom Exp $") char * longname(void) diff --git a/ncurses/lib_mouse.c b/ncurses/lib_mouse.c index 86eaf13e..c4f510db 100644 --- a/ncurses/lib_mouse.c +++ b/ncurses/lib_mouse.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* * This module is intended to encapsulate ncurses's interface to pointing @@ -61,18 +73,18 @@ #endif #endif -MODULE_ID("$Id: lib_mouse.c,v 0.22 1997/02/15 22:33:37 tom Exp $") +MODULE_ID("$Id: lib_mouse.c,v 1.35 1998/02/11 12:13:55 tom Exp $") #define MY_TRACE TRACE_ICALLS|TRACE_IEVENT #define INVALID_EVENT -1 -int _nc_max_click_interval = 166; /* max press/release separation */ - static int mousetype; #define M_XTERM -1 /* use xterm's mouse tracking? */ #define M_NONE 0 /* no mouse device */ #define M_GPM 1 /* use GPM */ +#define M_QNX 2 /* QNX mouse on console */ +#define M_QNX_TERM 3 /* QNX mouse on pterm/xterm (using qansi-m) */ #if USE_GPM_SUPPORT #ifndef LINT @@ -82,8 +94,16 @@ static Gpm_Connect gpm_connect; static mmask_t eventmask; /* current event mask */ +static bool _nc_mouse_parse(int); +static void _nc_mouse_resume(SCREEN *); +static void _nc_mouse_wrap(SCREEN *); + /* maintain a circular list of mouse events */ -#define EV_MAX 8 /* size of circular event queue */ + +/* The definition of the circular list size (EV_MAX), is in curses.priv.h, so + * wgetch() may refer to the size and call _nc_mouse_parse() before circular + * list overflow. + */ static MEVENT events[EV_MAX]; /* hold the last mouse event seen */ static MEVENT *eventp = events; /* next free slot in event queue */ #define NEXT(ep) ((ep == events + EV_MAX - 1) ? events : ep + 1) @@ -101,10 +121,25 @@ static void _trace_slot(const char *tag) } #endif -void _nc_mouse_init(SCREEN *sp GCC_UNUSED) -/* initialize the mouse -- called at screen-setup time */ +/* FIXME: The list of names should be configurable */ +static int is_xterm(const char *name) +{ + return (!strncmp(name, "xterm", 5) + || !strncmp(name, "rxvt", 4) + || !strncmp(name, "kterm", 5) + || !strncmp(name, "color_xterm", 11)); +} + +static void _nc_mouse_init(void) +/* initialize the mouse */ { int i; + static int initialized; + + if (initialized) { + return; + } + initialized = TRUE; TR(MY_TRACE, ("_nc_mouse_init() called")); @@ -112,7 +147,8 @@ void _nc_mouse_init(SCREEN *sp GCC_UNUSED) events[i].id = INVALID_EVENT; /* we know how to recognize mouse events under xterm */ - if (!strncmp(cur_term->type.term_names, "xterm", 5) && key_mouse) + if (key_mouse != 0 + && is_xterm(cur_term->type.term_names)) mousetype = M_XTERM; #if USE_GPM_SUPPORT @@ -123,24 +159,17 @@ void _nc_mouse_init(SCREEN *sp GCC_UNUSED) gpm_connect.defaultMask = ~gpm_connect.eventMask; gpm_connect.minMod = 0; gpm_connect.maxMod = ~0; - if (Gpm_Open (&gpm_connect, 0) >= 0) /* returns the file-descriptor */ + if (Gpm_Open (&gpm_connect, 0) >= 0) { /* returns the file-descriptor */ mousetype = M_GPM; + SP->_mouse_fd = gpm_fd; + } } #endif -} -int _nc_mouse_fd(void) -{ - if (mousetype == M_XTERM) - return -1; -#if USE_GPM_SUPPORT - else if (mousetype == M_GPM) - return gpm_fd; -#endif - return -1; + T(("_nc_mouse_init() set mousetype to %d", mousetype)); } -bool _nc_mouse_event(SCREEN *sp GCC_UNUSED) +static bool _nc_mouse_event(SCREEN *sp GCC_UNUSED) /* query to see if there is a pending mouse event */ { #if USE_GPM_SUPPORT @@ -153,7 +182,7 @@ bool _nc_mouse_event(SCREEN *sp GCC_UNUSED) { eventp->id = 0; /* there's only one mouse... */ - eventp->bstate = 0; + eventp->bstate = 0; switch (ev.type & 0x0f) { case(GPM_DOWN): @@ -172,18 +201,19 @@ bool _nc_mouse_event(SCREEN *sp GCC_UNUSED) eventp->x = ev.x - 1; eventp->y = ev.y - 1; - eventp->z = 0; + eventp->z = 0; /* bump the next-free pointer into the circular list */ eventp = NEXT(eventp); return (TRUE); } #endif + /* xterm: never have to query, mouse events are in the keyboard stream */ return(FALSE); /* no event waiting */ } -bool _nc_mouse_inline(SCREEN *sp) +static bool _nc_mouse_inline(SCREEN *sp) /* mouse report received in the keyboard stream -- parse its info */ { TR(MY_TRACE, ("_nc_mouse_inline() called")); @@ -294,6 +324,9 @@ bool _nc_mouse_inline(SCREEN *sp) /* bump the next-free pointer into the circular list */ eventp = NEXT(eventp); +#if 0 /* this return would be needed for QNX's mods to lib_getch.c */ + return(TRUE); +#endif } return(FALSE); @@ -301,20 +334,47 @@ bool _nc_mouse_inline(SCREEN *sp) static void mouse_activate(bool on) { - if (mousetype == M_XTERM) - { - if (on) - { + _nc_mouse_init(); + + if (on) { + + switch (mousetype) { + case M_XTERM: +#ifdef NCURSES_EXT_FUNCS + keyok(KEY_MOUSE, on); +#endif TPUTS_TRACE("xterm mouse initialization"); putp("\033[?1000h"); + break; +#if USE_GPM_SUPPORT + case M_GPM: + SP->_mouse_fd = gpm_fd; + break; +#endif } - else - { + /* Make runtime binding to cut down on object size of applications that + * do not use the mouse (e.g., 'clear'). + */ + SP->_mouse_event = _nc_mouse_event; + SP->_mouse_inline = _nc_mouse_inline; + SP->_mouse_parse = _nc_mouse_parse; + SP->_mouse_resume = _nc_mouse_resume; + SP->_mouse_wrap = _nc_mouse_wrap; + + } else { + + switch (mousetype) { + case M_XTERM: TPUTS_TRACE("xterm mouse deinitialization"); putp("\033[?1000l"); + break; +#if USE_GPM_SUPPORT + case M_GPM: + break; +#endif } - (void) fflush(SP->_ofp); } + (void) fflush(SP->_ofp); } /************************************************************************** @@ -323,7 +383,7 @@ static void mouse_activate(bool on) * **************************************************************************/ -bool _nc_mouse_parse(int runcount) +static bool _nc_mouse_parse(int runcount) /* parse a run of atomic mouse events into a gesture */ { MEVENT *ep, *runp, *next, *prev = PREV(eventp); @@ -357,13 +417,16 @@ bool _nc_mouse_parse(int runcount) { TR(MY_TRACE, ("_nc_mouse_parse: returning simple mouse event %s at slot %d", _tracemouse(prev), prev-events)); - return (PREV(prev)->id >= 0) ? (PREV(prev)->bstate & eventmask) : 0; + return (prev->id >= 0) + ? ((prev->bstate & eventmask) ? TRUE : FALSE) + : FALSE; } /* find the start of the run */ runp = eventp; - for (n = runcount; n > 0; n--) + for (n = runcount; n > 0; n--) { runp = PREV(runp); + } #ifdef TRACE if (_nc_tracing & TRACE_IEVENT) @@ -536,8 +599,9 @@ bool _nc_mouse_parse(int runcount) * don't match the current event mask. */ for (; runcount; prev = PREV(eventp), runcount--) - if (prev->id == INVALID_EVENT || !(prev->bstate & eventmask)) + if (prev->id == INVALID_EVENT || !(prev->bstate & eventmask)) { eventp = prev; + } #ifdef TRACE if (_nc_tracing & TRACE_IEVENT) @@ -556,19 +620,25 @@ bool _nc_mouse_parse(int runcount) return(PREV(eventp)->id != INVALID_EVENT); } -void _nc_mouse_wrap(SCREEN *sp GCC_UNUSED) +static void _nc_mouse_wrap(SCREEN *sp GCC_UNUSED) /* release mouse -- called by endwin() before shellout/exit */ { TR(MY_TRACE, ("_nc_mouse_wrap() called")); - /* xterm: turn off reporting */ - if (mousetype == M_XTERM && eventmask) - mouse_activate(FALSE); - - /* GPM: pass all mouse events to next client */ + switch (mousetype) { + case M_XTERM: + if (eventmask) + mouse_activate(FALSE); + break; +#if USE_GPM_SUPPORT + /* GPM: pass all mouse events to next client */ + case M_GPM: + break; +#endif + } } -void _nc_mouse_resume(SCREEN *sp GCC_UNUSED) +static void _nc_mouse_resume(SCREEN *sp GCC_UNUSED) /* re-connect to mouse -- called by doupdate() after shellout */ { TR(MY_TRACE, ("_nc_mouse_resume() called")); @@ -589,7 +659,9 @@ void _nc_mouse_resume(SCREEN *sp GCC_UNUSED) int getmouse(MEVENT *aevent) /* grab a copy of the current mouse event */ { - if (aevent && (mousetype == M_XTERM || mousetype == M_GPM)) + T((T_CALLED("getmouse(%p)"), aevent)); + + if (aevent && (mousetype != M_NONE)) { /* compute the current-event pointer */ MEVENT *prev = PREV(eventp); @@ -601,9 +673,9 @@ int getmouse(MEVENT *aevent) _tracemouse(prev), prev-events)); prev->id = INVALID_EVENT; /* so the queue slot becomes free */ - return(OK); + returnCode(OK); } - return(ERR); + returnCode(ERR); } int ungetmouse(MEVENT *aevent) @@ -622,10 +694,15 @@ int ungetmouse(MEVENT *aevent) mmask_t mousemask(mmask_t newmask, mmask_t *oldmask) /* set the mouse event mask */ { + mmask_t result = 0; + + T((T_CALLED("mousemask(%#lx,%p)"), newmask, oldmask)); + if (oldmask) *oldmask = eventmask; - if (mousetype == M_XTERM || mousetype == M_GPM) + _nc_mouse_init(); + if ( mousetype != M_NONE ) { eventmask = newmask & (BUTTON_ALT | BUTTON_CTRL | BUTTON_SHIFT @@ -638,22 +715,22 @@ mmask_t mousemask(mmask_t newmask, mmask_t *oldmask) mouse_activate(eventmask != 0); - return(eventmask); + result = eventmask; } - return(0); + returnCode(result); } -bool wenclose(WINDOW *win, int y, int x) +bool wenclose(const WINDOW *win, int y, int x) /* check to see if given window encloses given screen location */ { if (win) { y -= win->_yoffset; - return (win->_begy <= y && - win->_begx <= x && - (win->_begx + win->_maxx) >= x && - (win->_begy + win->_maxy) >= y); + return ((win->_begy <= y && + win->_begx <= x && + (win->_begx + win->_maxx) >= x && + (win->_begy + win->_maxy) >= y) ? TRUE : FALSE); } return FALSE; } @@ -661,10 +738,23 @@ bool wenclose(WINDOW *win, int y, int x) int mouseinterval(int maxclick) /* set the maximum mouse interval within which to recognize a click */ { - int oldval = _nc_max_click_interval; + int oldval; + + if (SP != 0) { + oldval = SP->_maxclick; + if (maxclick >= 0) + SP->_maxclick = maxclick; + } else { + oldval = DEFAULT_MAXCLICK; + } - _nc_max_click_interval = maxclick; return(oldval); } +/* This may be used by other routines to ask for the existence of mouse + support */ +int _nc_has_mouse(void) { + return (mousetype==M_NONE ? 0:1); +} + /* lib_mouse.c ends here */ diff --git a/ncurses/lib_move.c b/ncurses/lib_move.c index 10d25c73..6f5bddff 100644 --- a/ncurses/lib_move.c +++ b/ncurses/lib_move.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -29,15 +41,16 @@ #include -MODULE_ID("$Id: lib_move.c,v 1.6 1997/02/02 00:00:47 tom Exp $") +MODULE_ID("$Id: lib_move.c,v 1.8 1998/02/11 12:13:53 tom Exp $") int wmove(WINDOW *win, int y, int x) { T((T_CALLED("wmove(%p,%d,%d)"), win, y, x)); - if (x >= 0 && x <= win->_maxx && - y >= 0 && y <= win->_maxy) + if (win && + x >= 0 && x <= win->_maxx && + y >= 0 && y <= win->_maxy) { win->_curx = (short)x; win->_cury = (short)y; diff --git a/ncurses/lib_mvcur.c b/ncurses/lib_mvcur.c index f1389d27..2e9948f9 100644 --- a/ncurses/lib_mvcur.c +++ b/ncurses/lib_mvcur.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -25,7 +37,7 @@ ** ** The routines for moving the physical cursor and scrolling: ** -** void _nc_mvcur_init(void), mvcur_wrap(void) +** void _nc_mvcur_init(void) ** ** void _nc_mvcur_resume(void) ** @@ -33,8 +45,6 @@ ** ** void _nc_mvcur_wrap(void) ** -** int _nc_mvcur_scrolln(int n, int top, int bot, int maxy) -** ** Comparisons with older movement optimizers: ** SVr3 curses mvcur() can't use cursor_to_ll or auto_left_margin. ** 4.4BSD curses can't use cuu/cud/cuf/cub/hpa/vpa/tab/cbt for local @@ -116,10 +126,10 @@ * int _cup_cost; // cost of (cursor_address) * int _home_cost; // cost of (cursor_home) * int _ll_cost; // cost of (cursor_to_ll) - *#ifdef TABS_OK + *#if USE_HARD_TABS * int _ht_cost; // cost of (tab) - * int _cbt_cost; // cost of (backtab) - *#endif TABS_OK + * int _cbt_cost; // cost of (back_tab) + *#endif USE_HARD_TABS * int _cub1_cost; // cost of (cursor_left) * int _cuf1_cost; // cost of (cursor_right) * int _cud1_cost; // cost of (cursor_down) @@ -133,7 +143,7 @@ * int _ech_cost; // cost of (erase_chars) * int _rep_cost; // cost of (repeat_char) * - * The TABS_OK switch controls whether it is reliable to use tab/backtabs + * The USE_HARD_TABS switch controls whether it is reliable to use tab/backtabs * for local motions. On many systems, it's not, due to uncertainties about * tab delays and whether or not tabs will be expanded in raw mode. If you * have parm_right_cursor, tab motions don't win you a lot anyhow. @@ -143,7 +153,7 @@ #include #include -MODULE_ID("$Id: lib_mvcur.c,v 1.37 1997/05/03 22:15:26 Peter.Wemm Exp $") +MODULE_ID("$Id: lib_mvcur.c,v 1.50 1998/02/11 12:13:56 tom Exp $") #define STRLEN(s) (s != 0) ? strlen(s) : 0 @@ -152,9 +162,9 @@ MODULE_ID("$Id: lib_mvcur.c,v 1.37 1997/05/03 22:15:26 Peter.Wemm Exp $") #define CURRENT_COLUMN SP->_curscol /* phys cursor column */ #define REAL_ATTR SP->_current_attr /* phys current attribute */ #define WANT_CHAR(y, x) SP->_newscr->_line[y].text[x] /* desired state */ -#define BAUDRATE SP->_baudrate /* bits per second */ +#define BAUDRATE cur_term->_baudrate /* bits per second */ -#ifdef MAIN +#if defined(MAIN) || defined(NCURSES_TEST) #include static bool profiling = FALSE; @@ -163,9 +173,6 @@ static float diff; #define OPT_SIZE 512 -static void save_curs(void); -static void restore_curs(void); -static int cost_of(const char *const cap, int affcnt); static int normalized_cost(const char *const cap, int affcnt); /**************************************************************************** @@ -178,7 +185,7 @@ static int normalized_cost(const char *const cap, int affcnt); static int trace_cost_of(const char *capname, const char *cap, int affcnt) { - int result = cost_of(cap,affcnt); + int result = _nc_msec_cost(cap,affcnt); TR(TRACE_CHARPUT|TRACE_MOVE, ("CostOf %s %d", capname, result)); return result; } @@ -195,12 +202,12 @@ trace_normalized_cost(const char *capname, const char *cap, int affcnt) #else -#define CostOf(cap,affcnt) cost_of(cap,affcnt); +#define CostOf(cap,affcnt) _nc_msec_cost(cap,affcnt); #define NormalizedCost(cap,affcnt) normalized_cost(cap,affcnt); #endif -static int cost_of(const char *const cap, int affcnt) +int _nc_msec_cost(const char *const cap, int affcnt) /* compute the cost of a given operation */ { if (cap == 0) @@ -240,7 +247,7 @@ static int cost_of(const char *const cap, int affcnt) static int normalized_cost(const char *const cap, int affcnt) /* compute the effective character-count for an operation (round up) */ { - int cost = cost_of(cap, affcnt); + int cost = _nc_msec_cost(cap, affcnt); if (cost != INFINITY) cost = (cost + SP->_char_padding - 1) / SP->_char_padding; return cost; @@ -251,11 +258,8 @@ static void reset_scroll_region(void) { if (change_scroll_region) { - /* change_scroll_region may trash the cursor location */ - save_curs(); TPUTS_TRACE("change_scroll_region"); putp(tparm(change_scroll_region, 0, screen_lines - 1)); - restore_curs(); } } @@ -279,6 +283,15 @@ void _nc_mvcur_resume(void) * a vt100 emulation through xterm. */ reset_scroll_region(); + SP->_cursrow = SP->_curscol = -1; + + /* restore cursor shape */ + if (SP->_cursor != -1) + { + int cursor = SP->_cursor; + SP->_cursor = -1; + curs_set (cursor); + } } void _nc_mvcur_init(void) @@ -296,10 +309,10 @@ void _nc_mvcur_init(void) SP->_cr_cost = CostOf(carriage_return, 0); SP->_home_cost = CostOf(cursor_home, 0); SP->_ll_cost = CostOf(cursor_to_ll, 0); -#ifdef TABS_OK +#if USE_HARD_TABS SP->_ht_cost = CostOf(tab, 0); SP->_cbt_cost = CostOf(back_tab, 0); -#endif /* TABS_OK */ +#endif /* USE_HARD_TABS */ SP->_cub1_cost = CostOf(cursor_left, 0); SP->_cuf1_cost = CostOf(cursor_right, 0); SP->_cud1_cost = CostOf(cursor_down, 0); @@ -377,12 +390,27 @@ void _nc_mvcur_init(void) void _nc_mvcur_wrap(void) /* wrap up cursor-addressing mode */ { - reset_scroll_region(); + /* leave cursor at screen bottom */ + mvcur(-1, -1, screen_lines - 1, 0); + + /* set cursor to normal mode */ + if (SP->_cursor != -1) + curs_set(1); + if (exit_ca_mode) { TPUTS_TRACE("exit_ca_mode"); putp(exit_ca_mode); } + /* + * Reset terminal's tab counter. There's a long-time bug that + * if you exit a "curses" program such as vi or more, tab + * forward, and then backspace, the cursor doesn't go to the + * right place. The problem is that the kernel counts the + * escape sequences that reset things as column positions. + * Utter a \r to reset this invisibly. + */ + _nc_outch('\r'); } /**************************************************************************** @@ -417,7 +445,12 @@ repeated_append (int total, int num, int repeat, char *dst, const char *src) #ifndef NO_OPTIMIZE #define NEXTTAB(fr) (fr + init_tabs - (fr % init_tabs)) -#define LASTTAB(fr) (fr - init_tabs + (fr % init_tabs)) + +/* + * Assume back_tab (CBT) does not wrap backwards at the left margin, return + * a negative value at that point to simplify the loop. + */ +#define LASTTAB(fr) ((fr > 0) ? ((fr - 1) / init_tabs) * init_tabs : -1) /* Note: we'd like to inline this for speed, but GNU C barfs on the attempt. */ @@ -456,7 +489,7 @@ relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) { if (result) result[0] = '\0'; - vcost = repeated_append(vcost, SP->_cud1_cost, n, result, cursor_down); + vcost = repeated_append(0, SP->_cud1_cost, n, result, cursor_down); } } else /* (to_y < from_y) */ @@ -474,7 +507,7 @@ relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) { if (result) result[0] = '\0'; - vcost = repeated_append(vcost, SP->_cuu1_cost, n, result, cursor_up); + vcost = repeated_append(0, SP->_cuu1_cost, n, result, cursor_up); } } @@ -487,7 +520,7 @@ relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) if (to_x != from_x) { - char try[OPT_SIZE]; + char str[OPT_SIZE]; hcost = INFINITY; @@ -513,9 +546,9 @@ relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) { int lhcost = 0; - try[0] = '\0'; + str[0] = '\0'; -#ifdef TABS_OK +#if USE_HARD_TABS /* use hard tabs, if we have them, to do as much as possible */ if (init_tabs > 0 && tab) { @@ -523,7 +556,7 @@ relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) for (fr = from_x; (nxt = NEXTTAB(fr)) <= to_x; fr = nxt) { - lhcost = repeated_append(lhcost, SP->_ht_cost, 1, try, tab); + lhcost = repeated_append(lhcost, SP->_ht_cost, 1, str, tab); if (lhcost == INFINITY) break; } @@ -531,7 +564,7 @@ relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) n = to_x - fr; from_x = fr; } -#endif /* TABS_OK */ +#endif /* USE_HARD_TABS */ #if defined(REAL_ATTR) && defined(WANT_CHAR) /* @@ -558,7 +591,7 @@ relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) char *sp; int i; - sp = try + strlen(try); + sp = str + strlen(str); for (i = 0; i < n; i++) *sp++ = WANT_CHAR(to_y, from_x + i); @@ -568,13 +601,13 @@ relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) else #endif /* defined(REAL_ATTR) && defined(WANT_CHAR) */ { - lhcost = repeated_append(lhcost, SP->_cuf1_cost, n, try, cursor_right); + lhcost = repeated_append(lhcost, SP->_cuf1_cost, n, str, cursor_right); } if (lhcost < hcost) { if (result) - (void) strcpy(result, try); + (void) strcpy(result, str); hcost = lhcost; } } @@ -594,30 +627,30 @@ relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) { int lhcost = 0; - try[0] = '\0'; + str[0] = '\0'; -#ifdef TABS_OK +#if USE_HARD_TABS if (init_tabs > 0 && back_tab) { int nxt, fr; for (fr = from_x; (nxt = LASTTAB(fr)) >= to_x; fr = nxt) { - lhcost = repeated_append(lhcost, SP->_cbt_cost, 1, try, back_tab); + lhcost = repeated_append(lhcost, SP->_cbt_cost, 1, str, back_tab); if (lhcost == INFINITY) break; } - n = to_x - fr; + n = fr - to_x; } -#endif /* TABS_OK */ +#endif /* USE_HARD_TABS */ - lhcost = repeated_append(lhcost, SP->_cub1_cost, n, try, cursor_left); + lhcost = repeated_append(lhcost, SP->_cub1_cost, n, str, cursor_left); if (lhcost < hcost) { if (result) - (void) strcpy(result, try); + (void) strcpy(result, str); hcost = lhcost; } } @@ -649,7 +682,7 @@ onscreen_mvcur(int yold,int xold,int ynew,int xnew, bool ovw) char use[OPT_SIZE], *sp; int tactic = 0, newcost, usecost = INFINITY; -#ifdef MAIN +#if defined(MAIN) || defined(NCURSES_TEST) struct timeval before, after; gettimeofday(&before, NULL); @@ -676,10 +709,9 @@ onscreen_mvcur(int yold,int xold,int ynew,int xnew, bool ovw) * (like, say, local-movement \n getting mapped to some obscure * character because A_ALTCHARSET is on). */ - if (yold == -1 || xold == -1 || - REAL_ATTR != A_NORMAL || NOT_LOCAL(yold, xold, ynew, xnew)) + if (yold == -1 || xold == -1 || NOT_LOCAL(yold, xold, ynew, xnew)) { -#ifdef MAIN +#if defined(MAIN) || defined(NCURSES_TEST) if (!profiling) { (void) fputs("nonlocal\n", stderr); @@ -702,15 +734,12 @@ onscreen_mvcur(int yold,int xold,int ynew,int xnew, bool ovw) } /* tactic #2: use carriage-return + local movement */ - if (yold < screen_lines - 1 && xold < screen_columns - 1) - { - if (carriage_return + if (yold != -1 && carriage_return && ((newcost=relative_move(NULL, yold,0,ynew,xnew, ovw)) != INFINITY) && SP->_cr_cost + newcost < usecost) - { - tactic = 2; - usecost = SP->_cr_cost + newcost; - } + { + tactic = 2; + usecost = SP->_cr_cost + newcost; } /* tactic #3: use home-cursor + local movement */ @@ -736,7 +765,7 @@ onscreen_mvcur(int yold,int xold,int ynew,int xnew, bool ovw) * unless strange wrap behavior indicated by xenl might hose us. */ if (auto_left_margin && !eat_newline_glitch - && yold > 0 && yold < screen_lines - 1 && cursor_left + && yold > 0 && cursor_left && ((newcost=relative_move(NULL, yold-1, screen_columns-1, ynew, xnew, ovw)) != INFINITY) && SP->_cr_cost + SP->_cub1_cost + newcost + newcost < usecost) { @@ -781,7 +810,7 @@ onscreen_mvcur(int yold,int xold,int ynew,int xnew, bool ovw) } #endif /* !NO_OPTIMIZE */ -#ifdef MAIN +#if defined(MAIN) || defined(NCURSES_TEST) gettimeofday(&after, NULL); diff = after.tv_usec - before.tv_usec + (after.tv_sec - before.tv_sec) * 1000000; @@ -861,288 +890,7 @@ int mvcur(int yold, int xold, int ynew, int xnew) return(onscreen_mvcur(yold, xold, ynew, xnew, TRUE)); } - -/**************************************************************************** - * - * Cursor save_restore - * - ****************************************************************************/ - -/* assumption: sc/rc is faster than cursor addressing */ - -static int oy, ox; /* ugh, mvcur_scrolln() needs to see this */ - -static void save_curs(void) -{ - if (save_cursor && restore_cursor) - { - TPUTS_TRACE("save_cursor"); - putp(save_cursor); - } - - oy = CURRENT_ROW; - ox = CURRENT_COLUMN; -} - -static void restore_curs(void) -{ - if (save_cursor && restore_cursor) - { - TPUTS_TRACE("restore_cursor"); - putp(restore_cursor); - } - else - onscreen_mvcur(-1, -1, oy, ox, FALSE); -} - -/**************************************************************************** - * - * Physical-scrolling support - * - ****************************************************************************/ - -static int DoTheScrolling(int n, int top, int bot, int maxy) -/* scroll region from top to bot by n lines */ -{ - int i; - - /* - * This code was adapted from Keith Bostic's hardware scrolling - * support for 4.4BSD curses. I (esr) translated it to use terminfo - * capabilities, narrowed the call interface slightly, and cleaned - * up some convoluted tests. I also added support for the memory_above - * memory_below, and non_dest_scroll_region capabilities. - * - * For this code to work, we must have either - * change_scroll_region and scroll forward/reverse commands, or - * insert and delete line capabilities. - * When the scrolling region has been set, the cursor has to - * be at the last line of the region to make the scroll - * happen. - * - * This code makes one aesthetic decision in the opposite way from - * BSD curses. BSD curses preferred pairs of il/dl operations - * over scrolls, allegedly because il/dl looked faster. We, on - * the other hand, prefer scrolls because (a) they're just as fast - * on many terminals and (b) using them avoids bouncing an - * unchanged bottom section of the screen up and down, which is - * visually nasty. - */ - if (n > 0) - { - /* - * Explicitly clear if stuff pushed off top of region might - * be saved by the terminal. - */ - if (non_dest_scroll_region || (memory_above && top == 0)) { - for (i = 0; i < n; i++) - { - mvcur(-1, -1, i, 0); - TPUTS_TRACE("clr_eol"); - tputs(clr_eol, n, _nc_outch); - } - } - - if (change_scroll_region && (scroll_forward || parm_index)) - { - TPUTS_TRACE("change_scroll_region"); - tputs(tparm(change_scroll_region, top, bot), 0, _nc_outch); - - onscreen_mvcur(-1, -1, bot, 0, TRUE); - - if (parm_index != NULL) - { - TPUTS_TRACE("parm_index"); - tputs(tparm(parm_index, n, 0), n, _nc_outch); - } - else - { - for (i = 0; i < n; i++) - { - TPUTS_TRACE("scroll_forward"); - tputs(scroll_forward, 0, _nc_outch); - } - } - TPUTS_TRACE("change_scroll_region"); - tputs(tparm(change_scroll_region, 0, maxy), 0, _nc_outch); - } - else if (parm_index && top == 0 && bot == maxy) - { - onscreen_mvcur(oy, ox, bot, 0, TRUE); - TPUTS_TRACE("parm_index"); - tputs(tparm(parm_index, n, 0), n, _nc_outch); - } - else if (scroll_forward && top == 0 && bot == maxy) - { - onscreen_mvcur(oy, ox, bot, 0, TRUE); - for (i = 0; i < n; i++) - { - TPUTS_TRACE("scroll_forward"); - tputs(scroll_forward, 0, _nc_outch); - } - } - else if (_nc_idlok - && (parm_delete_line || delete_line) - && (parm_insert_line || insert_line)) - { - onscreen_mvcur(oy, ox, top, 0, TRUE); - - if (parm_delete_line) - { - TPUTS_TRACE("parm_delete_line"); - tputs(tparm(parm_delete_line, n, 0), n, _nc_outch); - } - else - { - for (i = 0; i < n; i++) - { - TPUTS_TRACE("parm_index"); - tputs(delete_line, 0, _nc_outch); - } - } - - onscreen_mvcur(top, 0, bot - n + 1, 0, FALSE); - - /* Push down the bottom region. */ - if (parm_insert_line) - { - TPUTS_TRACE("parm_insert_line"); - tputs(tparm(parm_insert_line, n, 0), n, _nc_outch); - } - else - { - for (i = 0; i < n; i++) - { - TPUTS_TRACE("insert_line"); - tputs(insert_line, 0, _nc_outch); - } - } - } - else - return(ERR); - } - else /* (n < 0) */ - { - /* - * Do explicit clear to end of region if it's possible that the - * terminal might hold on to stuff we push off the end. - */ - if (non_dest_scroll_region || (memory_below && bot == maxy)) - { - if (bot == maxy && clr_eos) - { - mvcur(-1, -1, lines + n, 0); - TPUTS_TRACE("clr_eos"); - tputs(clr_eos, n, _nc_outch); - } - else if (clr_eol) - { - for (i = 0; i < -n; i++) - { - mvcur(-1, -1, lines + n + i, 0); - TPUTS_TRACE("clr_eol"); - tputs(clr_eol, n, _nc_outch); - } - } - } - - if (change_scroll_region && (scroll_reverse || parm_rindex)) - { - TPUTS_TRACE("change_scroll_region"); - tputs(tparm(change_scroll_region, top, bot), 0, _nc_outch); - - onscreen_mvcur(-1, -1, top, 0, TRUE); - - if (parm_rindex) - { - TPUTS_TRACE("parm_rindex"); - tputs(tparm(parm_rindex, -n, 0), -n, _nc_outch); - } - else - { - for (i = n; i < 0; i++) - { - TPUTS_TRACE("scroll_reverse"); - tputs(scroll_reverse, 0, _nc_outch); - } - } - TPUTS_TRACE("change_scroll_region"); - tputs(tparm(change_scroll_region, 0, maxy), 0, _nc_outch); - } - else if (parm_rindex && top == 0 && bot == maxy) - { - onscreen_mvcur(oy, ox, bot + n + 1, 0, TRUE); - - TPUTS_TRACE("parm_rindex"); - tputs(tparm(parm_rindex, -n, 0), -n, _nc_outch); - } - else if (scroll_reverse && top == 0 && bot == maxy) - { - onscreen_mvcur(-1, -1, 0, 0, TRUE); - for (i = n; i < 0; i++) - { - TPUTS_TRACE("scroll_reverse"); - tputs(scroll_reverse, 0, _nc_outch); - } - } - else if (_nc_idlok - && (parm_delete_line || delete_line) - && (parm_insert_line || insert_line)) - { - onscreen_mvcur(oy, ox, bot + n + 1, 0, TRUE); - - if (parm_delete_line) - { - TPUTS_TRACE("parm_delete_line"); - tputs(tparm(parm_delete_line, -n, 0), -n, _nc_outch); - } - else - { - for (i = n; i < 0; i++) - { - TPUTS_TRACE("delete_line"); - tputs(delete_line, 0, _nc_outch); - } - } - - onscreen_mvcur(bot + n + 1, 0, top, 0, FALSE); - - /* Scroll the block down. */ - if (parm_insert_line) - { - TPUTS_TRACE("parm_insert_line"); - tputs(tparm(parm_insert_line, -n, 0), -n, _nc_outch); - } - else - { - for (i = n; i < 0; i++) - { - TPUTS_TRACE("insert_line"); - tputs(insert_line, 0, _nc_outch); - } - } - } - else - return(ERR); - } - - return(OK); -} - -int _nc_mvcur_scrolln(int n, int top, int bot, int maxy) -/* scroll region from top to bot by n lines */ -{ - int code; - - TR(TRACE_MOVE, ("mvcur_scrolln(%d, %d, %d, %d)", n, top, bot, maxy)); - - save_curs(); - code = DoTheScrolling(n, top, bot, maxy); - restore_curs(); - return(code); -} - -#ifdef MAIN +#if defined(MAIN) || defined(NCURSES_TEST) /**************************************************************************** * * Movement optimizer test code @@ -1152,11 +900,11 @@ int _nc_mvcur_scrolln(int n, int top, int bot, int maxy) #include #include -char *_nc_progname = "mvcur"; +const char *_nc_progname = "mvcur"; static unsigned long xmits; -int tputs(const char *string, int affcnt, int (*outc)(int)) +int tputs(const char *string, int affcnt GCC_UNUSED, int (*outc)(int) GCC_UNUSED) /* stub tputs() that dumps sequences in a visible form */ { if (profiling) @@ -1177,7 +925,7 @@ int _nc_outch(int ch) return OK; } -static char tname[BUFSIZ]; +static char tname[MAX_ALIAS]; static void load_term(void) { @@ -1194,9 +942,9 @@ static int roll(int n) return (j % n); } -int main(int argc, char *argv[]) +int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { - (void) strcpy(tname, getenv("TERM")); + (void) strcpy(tname, termname()); load_term(); _nc_setupscreen(lines, columns, stdout); baudrate(); @@ -1232,8 +980,7 @@ int main(int argc, char *argv[]) (void) puts("? -- display this help message"); (void) puts("fy fx ty tx -- (4 numbers) display (fy,fx)->(ty,tx) move"); (void) puts("s[croll] n t b m -- display scrolling sequence"); -(void) printf("r[eload] -- reload terminal info for %s\n", - getenv("TERM")); +(void) printf("r[eload] -- reload terminal info for %s\n", termname()); (void) puts("l[oad] -- load terminal info for type "); (void) puts("d[elete] -- delete named capability"); (void) puts("i[nspect] -- display terminal capabilities"); @@ -1253,7 +1000,7 @@ int main(int argc, char *argv[]) gettimeofday(&after, NULL); printf("\" (%ld msec)\n", - after.tv_usec - before.tv_usec + (after.tv_sec - before.tv_sec) * 1000000); + (long)(after.tv_usec - before.tv_usec + (after.tv_sec - before.tv_sec) * 1000000)); } else if (sscanf(buf, "s %d %d %d %d", &fy, &fx, &ty, &tx) == 4) { @@ -1262,15 +1009,15 @@ int main(int argc, char *argv[]) putchar('"'); gettimeofday(&before, NULL); - _nc_mvcur_scrolln(fy, fx, ty, tx); + _nc_scrolln(fy, fx, ty, tx); gettimeofday(&after, NULL); printf("\" (%ld msec)\n", - after.tv_usec - before.tv_usec + (after.tv_sec - before.tv_sec) * 1000000); + (long)(after.tv_usec - before.tv_usec + (after.tv_sec - before.tv_sec) * 1000000)); } else if (buf[0] == 'r') { - (void) strcpy(tname, getenv("TERM")); + (void) strcpy(tname, termname()); load_term(); } else if (sscanf(buf, "l %s", tname) == 1) @@ -1311,12 +1058,12 @@ int main(int argc, char *argv[]) else if (buf[0] == 'i') { dump_init((char *)NULL, F_TERMINFO, S_TERMINFO, 70, 0); - dump_entry(&cur_term->type, NULL); + dump_entry(&cur_term->type, 0, 0); putchar('\n'); } else if (buf[0] == 'o') { - if (_nc_optime_enable & OPTIMIZE_MVCUR) + if (_nc_optimize_enable & OPTIMIZE_MVCUR) { _nc_optimize_enable &=~ OPTIMIZE_MVCUR; (void) puts("Optimization is now off."); @@ -1415,10 +1162,10 @@ int main(int argc, char *argv[]) (void) printf("cup cost: %d\n", SP->_cup_cost); (void) printf("home cost: %d\n", SP->_home_cost); (void) printf("ll cost: %d\n", SP->_ll_cost); -#ifdef TABS_OK +#if USE_HARD_TABS (void) printf("ht cost: %d\n", SP->_ht_cost); (void) printf("cbt cost: %d\n", SP->_cbt_cost); -#endif /* TABS_OK */ +#endif /* USE_HARD_TABS */ (void) printf("cub1 cost: %d\n", SP->_cub1_cost); (void) printf("cuf1 cost: %d\n", SP->_cuf1_cost); (void) printf("cud1 cost: %d\n", SP->_cud1_cost); diff --git a/ncurses/lib_mvwin.c b/ncurses/lib_mvwin.c index a47bd006..9774d9f5 100644 --- a/ncurses/lib_mvwin.c +++ b/ncurses/lib_mvwin.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ @@ -30,15 +42,55 @@ #include -MODULE_ID("$Id: lib_mvwin.c,v 1.3 1997/02/02 00:20:41 tom Exp $") +MODULE_ID("$Id: lib_mvwin.c,v 1.7 1998/02/11 12:13:55 tom Exp $") int mvwin(WINDOW *win, int by, int bx) { T((T_CALLED("mvwin(%p,%d,%d)"), win, by, bx)); - if (win->_flags & _SUBWIN) + if (!win || (win->_flags & _ISPAD)) returnCode(ERR); + /* Copying subwindows is allowed, but it is expensive... */ + if (win->_flags & _SUBWIN) { + int err = ERR; + WINDOW *parent = win->_parent; + if (parent) + { /* Now comes the complicated and costly part, you should really + * try to avoid to move subwindows. Because a subwindow shares + * the text buffers with its parent, one can't do a simple + * memmove of the text buffers. One has to create a copy, then + * to relocate the subwindow and then to do a copy. + */ + if ((by - parent->_begy == win->_pary) && + (bx - parent->_begx == win->_parx)) + err=OK; /* we don't actually move */ + else { + WINDOW* clone = dupwin(win); + if (clone) { + /* now we have the clone, so relocate win */ + + werase(win); /* Erase the original place */ + wbkgd(win,parent->_bkgd);/* fill with parents background */ + wsyncup(win); /* Tell the parent(s) */ + + err = mvderwin(win, + by - parent->_begy, + bx - parent->_begx); + if (err!=ERR) { + err = copywin(clone,win, + 0, 0, 0, 0, win->_maxy, win->_maxx, 0); + if (ERR!=err) + wsyncup(win); + } + if (ERR==delwin(clone)) + err=ERR; + } + } + } + returnCode(err); + } + if (by + win->_maxy > screen_lines - 1 || bx + win->_maxx > screen_columns - 1 || by < 0 @@ -50,7 +102,7 @@ int mvwin(WINDOW *win, int by, int bx) * that a following call to 'wrefresh()' will paint the window at the * new location. This ensures that if the caller has refreshed another * window at the same location, that this one will be displayed. - */ + */ win->_begy = by; win->_begx = bx; returnCode(touchwin(win)); diff --git a/ncurses/lib_napms.c b/ncurses/lib_napms.c new file mode 100644 index 00000000..eec7b0a2 --- /dev/null +++ b/ncurses/lib_napms.c @@ -0,0 +1,88 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + + +/* + * lib_napms.c + * + * The routine napms. + * + */ + +#include + +#if USE_FUNC_POLL +#include +#include +#if HAVE_SYS_TIME_H +#include +#endif +#elif HAVE_SELECT +#if HAVE_SYS_TIME_H && HAVE_SYS_TIME_SELECT +#include +#endif +#if HAVE_SYS_SELECT_H +#include +#endif +#endif + +MODULE_ID("$Id: lib_napms.c,v 1.4 1998/02/13 10:24:54 jbuhler Exp $") + +int napms(int ms) +{ + T((T_CALLED("napms(%d)"), ms)); + +#if HAVE_NANOSLEEP + { + struct timespec ts; + ts.tv_sec = ms / 1000; + ts.tv_nsec = (ms % 1000) * 1000000; + nanosleep(&ts, NULL); + } +#elif HAVE_USLEEP + usleep(1000*(unsigned)ms); +#elif USE_FUNC_POLL + { + struct pollfd fds[1]; + poll(fds, 0, ms); + } +#elif HAVE_SELECT + { + struct timeval tval; + tval.tv_sec = ms / 1000; + tval.tv_usec = (ms % 1000) * 1000; + select(0, NULL, NULL, NULL, &tval); + } +#endif + returnCode(OK); +} diff --git a/ncurses/lib_newterm.c b/ncurses/lib_newterm.c index aa5b5879..ea5333d8 100644 --- a/ncurses/lib_newterm.c +++ b/ncurses/lib_newterm.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ @@ -30,15 +42,48 @@ #include -#ifdef SVR4_TERMIO +#if defined(SVR4_TERMIO) && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE #endif #include /* clear_screen, cup & friends, cur_term */ -MODULE_ID("$Id: lib_newterm.c,v 1.23 1997/03/30 01:42:01 tom Exp $") +MODULE_ID("$Id: lib_newterm.c,v 1.33 1998/02/11 12:13:57 tom Exp $") + +#ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */ +#define ONLCR 0 +#endif -/* This should be moved to TERMINAL */ +/* + * SVr4/XSI Curses specify that hardware echo is turned off in initscr, and not + * restored during the curses session. The library simulates echo in software. + * (The behavior is unspecified if the application enables hardware echo). + * + * The newterm function also initializes terminal settings, and since initscr + * is supposed to behave as if it calls newterm, we do it here. + */ +static inline int _nc_initscr(void) +{ + /* for extended XPG4 conformance requires cbreak() at this point */ + /* (SVr4 curses does this anyway) */ + cbreak(); + +#ifdef TERMIOS + cur_term->Nttyb.c_lflag &= ~(ECHO|ECHONL); + cur_term->Nttyb.c_iflag &= ~(ICRNL|INLCR|IGNCR); + cur_term->Nttyb.c_oflag &= ~(ONLCR); +#else + cur_term->Nttyb.sg_flags &= ~(ECHO|CRMOD); +#endif + return _nc_set_curterm(&cur_term->Nttyb); +} + +/* + * filter() has to be called before either initscr() or newterm(), so there is + * apparently no way to make this flag apply to some terminals and not others, + * aside from possibly delaying a filter() call until some terminals have been + * initialized. + */ static int filter_mode = FALSE; void filter(void) @@ -49,6 +94,7 @@ void filter(void) SCREEN * newterm(const char *term, FILE *ofp, FILE *ifp) { int errret; +SCREEN* current; #ifdef TRACE char *t = getenv("NCURSES_TRACE"); @@ -60,12 +106,12 @@ char *t = getenv("NCURSES_TRACE"); /* this loads the capability entry, then sets LINES and COLS */ if (setupterm(term, fileno(ofp), &errret) == ERR) - return NULL; + return 0; /* * Check for mismatched graphic-rendition capabilities. Most SVr4 - * terminfo tree contain entries that have rmul or rmso equated to sgr0 - * (Solaris curses copes with those entries). We do this only for + * terminfo trees contain entries that have rmul or rmso equated to + * sgr0 (Solaris curses copes with those entries). We do this only for * curses, since many termcap applications assume that smso/rmso and * smul/rmul are paired, and will not function properly if we remove * rmso or rmul. Curses applications shouldn't be looking at this @@ -92,12 +138,12 @@ char *t = getenv("NCURSES_TRACE"); T(("TABSIZE = %d", TABSIZE)); #ifdef clear_screen - clear_screen = (char *)NULL; - cursor_down = parm_down_cursor = (char *)NULL; - cursor_address = (char *)NULL; - cursor_up = parm_up_cursor = (char *)NULL; - row_address = (char *)NULL; - + clear_screen = 0; + cursor_down = parm_down_cursor = 0; + cursor_address = 0; + cursor_up = parm_up_cursor = 0; + row_address = 0; + cursor_home = carriage_return; #endif /* clear_screen */ } @@ -112,13 +158,17 @@ char *t = getenv("NCURSES_TRACE"); if (_nc_slk_format) { if (ERR==_nc_ripoffline(-SLK_LINES, _nc_slk_initialize)) - return NULL; + return 0; } /* this actually allocates the screen structure, and saves the * original terminal settings. */ - if (_nc_setupscreen(LINES, COLS, ofp) == ERR) - return NULL; + current = SP; + _nc_set_screen(0); + if (_nc_setupscreen(LINES, COLS, ofp) == ERR) { + _nc_set_screen(current); + return 0; + } #ifdef num_labels /* if the terminal type has real soft labels, set those up */ @@ -137,15 +187,25 @@ char *t = getenv("NCURSES_TRACE"); #endif SP->_endwin = FALSE; + /* Check whether we can optimize scrolling under dumb terminals in case + * we do not have any of these capabilities, scrolling optimization + * will be useless. + */ + SP->_scrolling = ((scroll_forward && scroll_reverse) || + ((parm_rindex || parm_insert_line || insert_line) && + (parm_index || parm_delete_line || delete_line))); + baudrate(); /* sets a field in the SP structure */ + SP->_keytry = 0; + /* compute movement costs so we can do better move optimization */ _nc_mvcur_init(); _nc_signal_handler(TRUE); - /* open a connection to the screen's associated mouse, if any */ - _nc_mouse_init(SP); + /* initialize terminal to a sane state */ + _nc_screen_init(); /* Initialize the terminal line settings. */ _nc_initscr(); diff --git a/ncurses/lib_newwin.c b/ncurses/lib_newwin.c index 3fd894d4..d96bf0a4 100644 --- a/ncurses/lib_newwin.c +++ b/ncurses/lib_newwin.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ @@ -30,7 +42,7 @@ #include -MODULE_ID("$Id: lib_newwin.c,v 1.17 1997/02/15 21:46:05 tom Exp $") +MODULE_ID("$Id: lib_newwin.c,v 1.19 1998/02/11 12:13:54 tom Exp $") void _nc_freewin(WINDOW *win) { @@ -236,7 +248,7 @@ bool is_pad = (flags & _ISPAD); win->_line[i].firstchar = 0; win->_line[i].lastchar = num_columns-1; - win->_line[i].oldindex = i; + if_USE_SCROLL_HINTS(win->_line[i].oldindex = i); } if (!is_pad && (begx + num_columns == screen_columns)) { diff --git a/ncurses/lib_nl.c b/ncurses/lib_nl.c new file mode 100644 index 00000000..bb165dbc --- /dev/null +++ b/ncurses/lib_nl.c @@ -0,0 +1,80 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + + +/* + * nl.c + * + * Routines: + * nl() + * nonl() + * + */ + +#include +#include /* cur_term */ + +MODULE_ID("$Id: lib_nl.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +#ifdef __EMX__ +#include +#include +#endif + +int nl(void) +{ + T((T_CALLED("nl()"))); + + SP->_nl = TRUE; + +#ifdef __EMX__ + fflush(SP->_ofp); + _fsetmode(SP->_ofp, "t"); +#endif + + returnCode(OK); +} + +int nonl(void) +{ + T((T_CALLED("nonl()"))); + + SP->_nl = FALSE; + +#ifdef __EMX__ + fflush(SP->_ofp); + _fsetmode(SP->_ofp, "b"); +#endif + + returnCode(OK); +} diff --git a/ncurses/lib_options.c b/ncurses/lib_options.c index e98c2d9d..926a8aec 100644 --- a/ncurses/lib_options.c +++ b/ncurses/lib_options.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -32,7 +44,7 @@ #include /* keypad_xmit, keypad_local, meta_on, meta_off */ /* cursor_visible,cursor_normal,cursor_invisible */ -MODULE_ID("$Id: lib_options.c,v 1.22 1997/05/01 23:46:18 Alexander.V.Lukyanov Exp $") +MODULE_ID("$Id: lib_options.c,v 1.29 1998/02/11 12:13:55 tom Exp $") int has_ic(void) { @@ -53,8 +65,12 @@ int idlok(WINDOW *win, bool flag) { T((T_CALLED("idlok(%p,%d)"), win, flag)); - _nc_idlok = win->_idlok = flag && (has_il() || change_scroll_region); - returnCode(OK); + if (win) { + _nc_idlok = win->_idlok = flag && (has_il() || change_scroll_region); + returnCode(OK); + } + else + returnCode(ERR); } @@ -62,51 +78,12 @@ void idcok(WINDOW *win, bool flag) { T((T_CALLED("idcok(%p,%d)"), win, flag)); - _nc_idcok = win->_idcok = flag && has_ic(); + if (win) + _nc_idcok = win->_idcok = flag && has_ic(); returnVoid; } - -int clearok(WINDOW *win, bool flag) -{ - T((T_CALLED("clearok(%p,%d)"), win, flag)); - - win->_clear = flag; - returnCode(OK); -} - - -void immedok(WINDOW *win, bool flag) -{ - T((T_CALLED("immedok(%p,%d)"), win, flag)); - - win->_immed = flag; - - returnVoid; -} - -int leaveok(WINDOW *win, bool flag) -{ - T((T_CALLED("leaveok(%p,%d)"), win, flag)); - - win->_leaveok = flag; - if (flag == TRUE) - curs_set(0); - else - curs_set(1); - returnCode(OK); -} - - -int scrollok(WINDOW *win, bool flag) -{ - T((T_CALLED("scrollok(%p,%d)"), win, flag)); - - win->_scroll = flag; - returnCode(OK); -} - int halfdelay(int t) { T((T_CALLED("halfdelay(%d)"), t)); @@ -123,69 +100,56 @@ int nodelay(WINDOW *win, bool flag) { T((T_CALLED("nodelay(%p,%d)"), win, flag)); - if (flag == TRUE) - win->_delay = 0; - else win->_delay = -1; - returnCode(OK); + if (win) { + if (flag == TRUE) + win->_delay = 0; + else win->_delay = -1; + returnCode(OK); + } + else + returnCode(ERR); } int notimeout(WINDOW *win, bool f) { T((T_CALLED("notimout(%p,%d)"), win, f)); - win->_notimeout = f; - returnCode(OK); + if (win) { + win->_notimeout = f; + returnCode(OK); + } + else + returnCode(ERR); } int wtimeout(WINDOW *win, int delay) { T((T_CALLED("wtimeout(%p,%d)"), win, delay)); - win->_delay = delay; - returnCode(OK); -} - -static void init_keytry(void); -static void add_to_try(char *, short); - -/* Turn the keypad on/off - * - * Note: we flush the output because changing this mode causes some terminals - * to emit different escape sequences for cursor and keypad keys. If we don't - * flush, then the next wgetch may get the escape sequence that corresponds to - * the terminal state _before_ switching modes. - */ -int _nc_keypad(bool flag) -{ - if (flag && keypad_xmit) - { - TPUTS_TRACE("keypad_xmit"); - putp(keypad_xmit); - (void) fflush(SP->_ofp); + if (win) { + win->_delay = delay; + returnCode(OK); } - else if (! flag && keypad_local) - { - TPUTS_TRACE("keypad_local"); - putp(keypad_local); - (void) fflush(SP->_ofp); - } - - if (SP->_keytry == UNINITIALISED) - init_keytry(); - return(OK); + else + returnCode(ERR); } int keypad(WINDOW *win, bool flag) { T((T_CALLED("keypad(%p,%d)"), win, flag)); - win->_use_keypad = flag; - returnCode(_nc_keypad(flag)); + if (win) { + win->_use_keypad = flag; + returnCode(_nc_keypad(flag)); + } + else + returnCode(ERR); } int meta(WINDOW *win GCC_UNUSED, bool flag) { + /* Ok, we stay relaxed and don't signal an error if win is NULL */ T((T_CALLED("meta(%p,%d)"), win, flag)); SP->_use_meta = flag; @@ -252,121 +216,6 @@ int cursor = SP->_cursor; returnCode(cursor==-1 ? 1 : cursor); } -/* -** init_keytry() -** -** Construct the try for the current terminal's keypad keys. -** -*/ - - -static struct tries *newtry; - -static void init_keytry(void) -{ - newtry = 0; - -/* LINT_PREPRO -#if 0*/ -#include -/* LINT_PREPRO -#endif*/ - - SP->_keytry = newtry; -} - - -static void add_to_try(char *str, short code) -{ -static bool out_of_memory = FALSE; -struct tries *ptr, *savedptr; - - if (! str || out_of_memory) - return; - - if (newtry != 0) { - ptr = savedptr = newtry; - - for (;;) { - while (ptr->ch != (unsigned char) *str - && ptr->sibling != 0) - ptr = ptr->sibling; - - if (ptr->ch == (unsigned char) *str) { - if (*(++str)) { - if (ptr->child != 0) - ptr = ptr->child; - else - break; - } else { - ptr->value = code; - return; - } - } else { - if ((ptr->sibling = typeCalloc(struct tries,1)) == 0) { - out_of_memory = TRUE; - return; - } - - savedptr = ptr = ptr->sibling; - if (*str == '\200') - ptr->ch = '\0'; - else - ptr->ch = (unsigned char) *str; - str++; - ptr->value = 0; - - break; - } - } /* end for (;;) */ - } else { /* newtry == 0 :: First sequence to be added */ - savedptr = ptr = newtry = typeCalloc(struct tries,1); - - if (ptr == 0) { - out_of_memory = TRUE; - return; - } - - if (*str == '\200') - ptr->ch = '\0'; - else - ptr->ch = (unsigned char) *str; - str++; - ptr->value = 0; - } - - /* at this point, we are adding to the try. ptr->child == 0 */ - - while (*str) { - ptr->child = typeCalloc(struct tries,1); - - ptr = ptr->child; - - if (ptr == 0) { - out_of_memory = TRUE; - - ptr = savedptr; - while (ptr != 0) { - savedptr = ptr->child; - free(ptr); - ptr = savedptr; - } - - return; - } - - if (*str == '\200') - ptr->ch = '\0'; - else - ptr->ch = (unsigned char) *str; - str++; - ptr->value = 0; - } - - ptr->value = code; - return; -} - int typeahead(int fd) { T((T_CALLED("typeahead(%d)"), fd)); @@ -384,7 +233,7 @@ int typeahead(int fd) static int has_key_internal(int keycode, struct tries *tp) { - if (!tp) + if (tp == 0) return(FALSE); else if (tp->value == keycode) return(TRUE); @@ -398,3 +247,60 @@ int has_key(int keycode) T((T_CALLED("has_key(%d)"), keycode)); returnCode(has_key_internal(keycode, SP->_keytry)); } + +/* +** init_keytry() +** +** Construct the try for the current terminal's keypad keys. +** +*/ + +static void init_keytry(void) +{ +/* LINT_PREPRO +#if 0*/ +#include +/* LINT_PREPRO +#endif*/ + size_t n; + + /* The SP->_keytry value is initialized in newterm(), where the SP + * structure is created, because we can not tell where keypad() or + * mouse_activate() (which will call keyok()) are first called. + */ + + for (n = 0; n < SIZEOF(table); n++) + if (table[n].offset < STRCOUNT) + _nc_add_to_try(&(SP->_keytry), + CUR Strings[table[n].offset], + table[n].code); +} + +/* Turn the keypad on/off + * + * Note: we flush the output because changing this mode causes some terminals + * to emit different escape sequences for cursor and keypad keys. If we don't + * flush, then the next wgetch may get the escape sequence that corresponds to + * the terminal state _before_ switching modes. + */ +int _nc_keypad(bool flag) +{ + if (flag && keypad_xmit) + { + TPUTS_TRACE("keypad_xmit"); + putp(keypad_xmit); + (void) fflush(SP->_ofp); + } + else if (! flag && keypad_local) + { + TPUTS_TRACE("keypad_local"); + putp(keypad_local); + (void) fflush(SP->_ofp); + } + + if (!SP->_tried) { + init_keytry(); + SP->_tried = TRUE; + } + return(OK); +} diff --git a/ncurses/lib_overlay.c b/ncurses/lib_overlay.c index e63b3672..db2dce1b 100644 --- a/ncurses/lib_overlay.c +++ b/ncurses/lib_overlay.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -29,7 +41,7 @@ #include -MODULE_ID("$Id: lib_overlay.c,v 1.8 1997/04/24 10:34:38 tom Exp $") +MODULE_ID("$Id: lib_overlay.c,v 1.12 1998/02/11 12:13:59 tom Exp $") static int overlap(const WINDOW *const s, WINDOW *const d, int const flag) { @@ -38,6 +50,10 @@ int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol; T(("overlap : sby %d, sbx %d, smy %d, smx %d, dby %d, dbx %d, dmy %d, dmx %d", s->_begy, s->_begx, s->_maxy, s->_maxx, d->_begy, d->_begx, d->_maxy, d->_maxx)); + + if (!s || !d) + returnCode(ERR); + sminrow = max(s->_begy, d->_begy) - s->_begy; smincol = max(s->_begx, d->_begx) - s->_begx; dminrow = max(s->_begy, d->_begy) - d->_begy; @@ -89,10 +105,15 @@ int copywin(const WINDOW *src, WINDOW *dst, { int sx, sy, dx, dy; bool touched; +chtype bk = AttrOf(dst->_bkgd); +chtype mask = ~(chtype)((bk&A_COLOR) ? A_COLOR : 0); T((T_CALLED("copywin(%p, %p, %d, %d, %d, %d, %d, %d, %d)"), src, dst, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, over)); + if (!src || !dst) + returnCode(ERR); + /* make sure rectangle exists in source */ if ((sminrow + dmaxrow - dminrow) > (src->_maxy + 1) || (smincol + dmaxcol - dmincol) > (src->_maxx + 1)) { @@ -117,7 +138,8 @@ bool touched; if ((TextOf(src->_line[sy].text[sx]) != ' ') && (dst->_line[dy].text[dx]!=src->_line[sy].text[sx])) { - dst->_line[dy].text[dx] = src->_line[sy].text[sx]; + dst->_line[dy].text[dx] = + (src->_line[sy].text[sx] & mask) | bk; touched = TRUE; } } diff --git a/ncurses/lib_pad.c b/ncurses/lib_pad.c index fab9fe87..6e797aef 100644 --- a/ncurses/lib_pad.c +++ b/ncurses/lib_pad.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -29,7 +41,7 @@ #include -MODULE_ID("$Id: lib_pad.c,v 1.18 1997/04/12 17:42:52 tom Exp $") +MODULE_ID("$Id: lib_pad.c,v 1.25 1998/02/11 12:13:55 tom Exp $") WINDOW *newpad(int l, int c) { @@ -46,7 +58,7 @@ int i; returnWin(0); for (i = 0; i < l; i++) { - win->_line[i].oldindex = _NEWINDEX; + if_USE_SCROLL_HINTS(win->_line[i].oldindex = _NEWINDEX); if ((win->_line[i].text = typeCalloc(chtype, ((size_t)c))) == 0) { _nc_freewin(win); returnWin(0); @@ -60,13 +72,14 @@ int i; WINDOW *subpad(WINDOW *orig, int l, int c, int begy, int begx) { -WINDOW *win; +WINDOW *win = (WINDOW *)0; T((T_CALLED("subpad(%d, %d)"), l, c)); - if (!(orig->_flags & _ISPAD) || ((win = derwin(orig, l, c, begy, begx)) == NULL)) + if (orig) { + if (!(orig->_flags & _ISPAD) || ((win = derwin(orig, l, c, begy, begx)) == NULL)) returnWin(0); - + } returnWin(win); } @@ -84,6 +97,7 @@ int prefresh(WINDOW *win, int pminrow, int pmincol, int pnoutrefresh(WINDOW *win, int pminrow, int pmincol, int sminrow, int smincol, int smaxrow, int smaxcol) { +const int my_len = 2; /* parameterize the threshold for hardscroll */ short i, j; short m, n; short pmaxrow; @@ -153,7 +167,7 @@ bool wide; * windows). Note that changing this formula will not break any code, * merely change the costs of various update cases. */ - wide = (sminrow <= 1 && win->_maxx >= (newscr->_maxx - 1)); + wide = (smincol < my_len && smaxcol > (newscr->_maxx - my_len)); for (i = pminrow, m = sminrow + win->_yoffset; i <= pmaxrow && m <= newscr->_maxy; @@ -174,17 +188,30 @@ bool wide; } } +#if USE_SCROLL_HINTS if (wide) { int nind = m + displaced; if (oline->oldindex < 0 || nind < sminrow - || nind > smaxrow) + || nind > smaxrow) { nind = _NEWINDEX; + } else if (displaced) { + register struct ldat *pline = &curscr->_line[nind]; + for (j = 0; j <= my_len; j++) { + int k = newscr->_maxx - j; + if (pline->text[j] != nline->text[j] + || pline->text[k] != nline->text[k]) { + nind = _NEWINDEX; + break; + } + } + } nline->oldindex = nind; } +#endif /* USE_SCROLL_HINTS */ oline->firstchar = oline->lastchar = _NOCHANGE; - oline->oldindex = i; + if_USE_SCROLL_HINTS(oline->oldindex = i); } /* @@ -193,10 +220,12 @@ bool wide; * procedure. The only rows that should have an index value are those * that are displayed during this cycle. */ +#if USE_SCROLL_HINTS for (i = pminrow-1; (i >= 0) && (win->_line[i].oldindex >= 0); i--) win->_line[i].oldindex = _NEWINDEX; for (i = pmaxrow+1; (i <= win->_maxy) && (win->_line[i].oldindex >= 0); i++) win->_line[i].oldindex = _NEWINDEX; +#endif win->_begx = smincol; win->_begy = sminrow; @@ -235,14 +264,23 @@ bool wide; returnCode(OK); } -int pechochar(WINDOW *pad, chtype ch) +int pechochar(WINDOW *pad, const chtype ch) { T((T_CALLED("pechochar(%p, %s)"), pad, _tracechtype(ch))); - if (pad->_flags & _ISPAD) - returnCode(ERR); + if (pad == 0) + returnCode(ERR); + + if (!(pad->_flags & _ISPAD)) + returnCode(wechochar(pad,ch)); - waddch(curscr, ch); - doupdate(); + waddch(pad, ch); + prefresh(pad, pad->_pad._pad_y, + pad->_pad._pad_x, + pad->_pad._pad_top, + pad->_pad._pad_left, + pad->_pad._pad_bottom, + pad->_pad._pad_right); + returnCode(OK); } diff --git a/ncurses/lib_print.c b/ncurses/lib_print.c index fec32e82..0ad322b4 100644 --- a/ncurses/lib_print.c +++ b/ncurses/lib_print.c @@ -1,30 +1,42 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ #include #include -MODULE_ID("$Id: lib_print.c,v 1.8 1996/12/21 14:24:06 tom Exp $") +MODULE_ID("$Id: lib_print.c,v 1.9 1998/02/11 12:13:53 tom Exp $") int mcprint(char *data, int len) /* ship binary character data to the printer via mc4/mc5/mc5p */ diff --git a/ncurses/lib_printw.c b/ncurses/lib_printw.c index 874da9ce..a8b49aa5 100644 --- a/ncurses/lib_printw.c +++ b/ncurses/lib_printw.c @@ -1,25 +1,34 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ - - +/**************************************************************************** + * Copyright (c) 1998 Free 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 1997 * + ****************************************************************************/ /* ** lib_printw.c @@ -30,66 +39,72 @@ #include -MODULE_ID("$Id: lib_printw.c,v 1.3 1997/02/16 00:07:23 tom Exp $") +MODULE_ID("$Id: lib_printw.c,v 1.6 1998/02/11 12:13:55 tom Exp $") int printw(const char *fmt, ...) { -va_list argp; -char buf[BUFSIZ]; + va_list argp; + int code; T(("printw(%s,...) called", _nc_visbuf(fmt))); va_start(argp, fmt); - vsprintf(buf, fmt, argp); + code = vwprintw(stdscr, fmt, argp); va_end(argp); - return(waddstr(stdscr, buf)); -} - + return code; +} int wprintw(WINDOW *win, const char *fmt, ...) { -va_list argp; -char buf[BUFSIZ]; + va_list argp; + int code; T(("wprintw(%p,%s,...) called", win, _nc_visbuf(fmt))); va_start(argp, fmt); - vsprintf(buf, fmt, argp); + code = vwprintw(win, fmt, argp); va_end(argp); - return(waddstr(win, buf)); -} - + return code; +} int mvprintw(int y, int x, const char *fmt, ...) { -va_list argp; -char buf[BUFSIZ]; - - va_start(argp, fmt); - vsprintf(buf, fmt, argp); - va_end(argp); - return(move(y, x) == OK ? waddstr(stdscr, buf) : ERR); + va_list argp; + int code = move(y, x); + + if (code != ERR) { + va_start(argp, fmt); + code = vwprintw(stdscr, fmt, argp); + va_end(argp); + } + return code; } - - int mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...) { -va_list argp; -char buf[BUFSIZ]; - - va_start(argp, fmt); - vsprintf(buf, fmt, argp); - va_end(argp); - return(wmove(win, y, x) == OK ? waddstr(win, buf) : ERR); + va_list argp; + int code = wmove(win, y, x); + + if (code != ERR) { + va_start(argp, fmt); + code = vwprintw(win, fmt, argp); + va_end(argp); + } + return code; } int vwprintw(WINDOW *win, const char *fmt, va_list argp) { -char buf[BUFSIZ]; - - vsprintf(buf, fmt, argp); - return(waddstr(win, buf)); + char *buf = _nc_printf_string(fmt, argp); + int code = ERR; + + if (buf != 0) { + code = waddstr(win, buf); +#if USE_SAFE_SPRINTF + free(buf); +#endif + } + return code; } diff --git a/ncurses/lib_raw.c b/ncurses/lib_raw.c index 95f26f62..e2573c72 100644 --- a/ncurses/lib_raw.c +++ b/ncurses/lib_raw.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -25,12 +37,8 @@ * * Routines: * raw() - * echo() - * nl() * cbreak() * noraw() - * noecho() - * nonl() * nocbreak() * qiflush() * noqiflush() @@ -41,9 +49,9 @@ #include #include /* cur_term */ -MODULE_ID("$Id: lib_raw.c,v 1.16 1997/02/02 00:02:32 tom Exp $") +MODULE_ID("$Id: lib_raw.c,v 1.25 1998/02/11 12:13:59 tom Exp $") -#ifdef SVR4_TERMIO +#if defined(SVR4_TERMIO) && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE #endif @@ -51,6 +59,11 @@ MODULE_ID("$Id: lib_raw.c,v 1.16 1997/02/02 00:02:32 tom Exp $") #include /* needed for ISC */ #endif +#ifdef __EMX__ +#include +#include +#endif + /* may be undefined if we're using termio.h */ #ifndef TOSTOP #define TOSTOP 0 @@ -62,11 +75,32 @@ MODULE_ID("$Id: lib_raw.c,v 1.16 1997/02/02 00:02:32 tom Exp $") #define COOKED_INPUT (IXON|BRKINT|PARMRK) #ifdef TRACE + +typedef struct {unsigned int val; const char *name;} BITNAMES; + +static void lookup_bits(char *buf, const BITNAMES *table, const char *label, unsigned int val) +{ + const BITNAMES *sp; + + (void) strcat(buf, label); + (void) strcat(buf, ": {"); + for (sp = table; sp->name; sp++) + if (sp->val != 0 + && (val & sp->val) == sp->val) + { + (void) strcat(buf, sp->name); + (void) strcat(buf, ", "); + } + if (buf[strlen(buf) - 2] == ',') + buf[strlen(buf) - 2] = '\0'; + (void) strcat(buf,"} "); +} + char *_tracebits(void) /* describe the state of the terminal control bits exactly */ { -static char buf[BUFSIZ]; -static const struct {unsigned int val; const char *name;} +char *buf; +static const BITNAMES #ifdef TERMIOS iflags[] = @@ -95,8 +129,10 @@ cflags[] = { {CLOCAL, "CLOCAL"}, {CREAD, "CREAD"}, - {CSIZE, "CSIZE"}, {CSTOPB, "CSTOPB"}, +#if !defined(CS5) || !defined(CS8) + {CSIZE, "CSIZE"}, +#endif {HUPCL, "HUPCL"}, {PARENB, "PARENB"}, {PARODD|PARENB, "PARODD"}, /* concession to readability */ @@ -112,72 +148,41 @@ lflags[] = {ICANON, "ICANON"}, {ISIG, "ISIG"}, {NOFLSH, "NOFLSH"}, -#if TOSTOP != 0 {TOSTOP, "TOSTOP"}, -#endif -#if IEXTEN != 0 {IEXTEN, "IEXTEN"}, -#endif {0, NULL} #define ALLLOCAL (ECHO|ECHONL|ICANON|ISIG|NOFLSH|TOSTOP|IEXTEN) - }, - *sp; + }; + + + buf = _nc_trace_buf(0, + 8 + sizeof(iflags) + + 8 + sizeof(oflags) + + 8 + sizeof(cflags) + + 8 + sizeof(lflags) + + 8); if (cur_term->Nttyb.c_iflag & ALLIN) - { - (void) strcpy(buf, "iflags: {"); - for (sp = iflags; sp->val; sp++) - if ((cur_term->Nttyb.c_iflag & sp->val) == sp->val) - { - (void) strcat(buf, sp->name); - (void) strcat(buf, ", "); - } - if (buf[strlen(buf) - 2] == ',') - buf[strlen(buf) - 2] = '\0'; - (void) strcat(buf,"} "); - } + lookup_bits(buf, iflags, "iflags", cur_term->Nttyb.c_iflag); if (cur_term->Nttyb.c_oflag & ALLOUT) - { - (void) strcat(buf, "oflags: {"); - for (sp = oflags; sp->val; sp++) - if ((cur_term->Nttyb.c_oflag & sp->val) == sp->val) - { - (void) strcat(buf, sp->name); - (void) strcat(buf, ", "); - } - if (buf[strlen(buf) - 2] == ',') - buf[strlen(buf) - 2] = '\0'; - (void) strcat(buf,"} "); - } + lookup_bits(buf, oflags, "oflags", cur_term->Nttyb.c_oflag); if (cur_term->Nttyb.c_cflag & ALLCTRL) - { - (void) strcat(buf, "cflags: {"); - for (sp = cflags; sp->val; sp++) - if ((cur_term->Nttyb.c_cflag & sp->val) == sp->val) - { - (void) strcat(buf, sp->name); - (void) strcat(buf, ", "); - } - if (buf[strlen(buf) - 2] == ',') - buf[strlen(buf) - 2] = '\0'; - (void) strcat(buf,"} "); + lookup_bits(buf, cflags, "cflags", cur_term->Nttyb.c_cflag); + +#if defined(CS5) && defined(CS8) + switch (cur_term->Nttyb.c_cflag & CSIZE) { + case CS5: strcat(buf, "CS5 "); break; + case CS6: strcat(buf, "CS6 "); break; + case CS7: strcat(buf, "CS7 "); break; + case CS8: strcat(buf, "CS8 "); break; + default: strcat(buf, "CSIZE? "); break; } +#endif if (cur_term->Nttyb.c_lflag & ALLLOCAL) - { - (void) strcat(buf, "lflags: {"); - for (sp = lflags; sp->val; sp++) - if ((cur_term->Nttyb.c_lflag & sp->val) == sp->val) - { - (void) strcat(buf, sp->name); - (void) strcat(buf, ", "); - } - if (buf[strlen(buf) - 2] == ',') - buf[strlen(buf) - 2] = '\0'; - (void) strcat(buf,"} "); - } + lookup_bits(buf, lflags, "lflags", cur_term->Nttyb.c_lflag); #else /* reference: ttcompat(4M) on SunOS 4.1 */ @@ -211,21 +216,14 @@ cflags[] = {XTABS, "XTABS"}, {0, NULL} #define ALLCTRL (CBREAK|CRMOD|ECHO|EVENP|LCASE|LLITOUT|ODDP|RAW|TANDEM|XTABS) - }, - *sp; + }; + + buf = _nc_trace_buf(0, + 8 + sizeof(cflags)); if (cur_term->Nttyb.sg_flags & ALLCTRL) { - (void) strcat(buf, "cflags: {"); - for (sp = cflags; sp->val; sp++) - if ((cur_term->Nttyb.sg_flags & sp->val) == sp->val) - { - (void) strcat(buf, sp->name); - (void) strcat(buf, ", "); - } - if (buf[strlen(buf) - 2] == ',') - buf[strlen(buf) - 2] = '\0'; - (void) strcat(buf,"} "); + lookup_bits(buf, cflags, "cflags", cur_term->Nttyb.sg_flags); } #endif @@ -242,23 +240,28 @@ cflags[] = int raw(void) { T((T_CALLED("raw()"))); + if (SP != 0 && cur_term != 0) { - SP->_raw = TRUE; - SP->_cbreak = TRUE; + SP->_raw = TRUE; + SP->_cbreak = TRUE; + +#ifdef __EMX__ + setmode(SP->_ifd, O_BINARY); +#endif #ifdef TERMIOS - BEFORE("raw"); - cur_term->Nttyb.c_lflag &= ~(ICANON|ISIG); - cur_term->Nttyb.c_iflag &= ~(COOKED_INPUT); - cur_term->Nttyb.c_cc[VMIN] = 1; - cur_term->Nttyb.c_cc[VTIME] = 0; - AFTER("raw"); + BEFORE("raw"); + cur_term->Nttyb.c_lflag &= ~(ICANON|ISIG); + cur_term->Nttyb.c_iflag &= ~(COOKED_INPUT); + cur_term->Nttyb.c_cc[VMIN] = 1; + cur_term->Nttyb.c_cc[VTIME] = 0; + AFTER("raw"); #else - cur_term->Nttyb.sg_flags |= RAW; + cur_term->Nttyb.sg_flags |= RAW; #endif - if ((SET_TTY(cur_term->Filedes, &cur_term->Nttyb)) == -1) - returnCode(ERR); - returnCode(OK); + returnCode(_nc_set_curterm(&cur_term->Nttyb)); + } + returnCode(ERR); } int cbreak(void) @@ -267,6 +270,10 @@ int cbreak(void) SP->_cbreak = TRUE; +#ifdef __EMX__ + setmode(SP->_ifd, O_BINARY); +#endif + #ifdef TERMIOS BEFORE("cbreak"); cur_term->Nttyb.c_lflag &= ~ICANON; @@ -278,31 +285,9 @@ int cbreak(void) #else cur_term->Nttyb.sg_flags |= CBREAK; #endif - if ((SET_TTY(cur_term->Filedes, &cur_term->Nttyb)) == -1) - returnCode(ERR); - returnCode(OK); -} - -int echo(void) -{ - T((T_CALLED("echo()"))); - - SP->_echo = TRUE; - - returnCode(OK); -} - - -int nl(void) -{ - T((T_CALLED("nl()"))); - - SP->_nl = TRUE; - - returnCode(OK); + returnCode(_nc_set_curterm( &cur_term->Nttyb)); } - int qiflush(void) { T((T_CALLED("qiflush()"))); @@ -316,10 +301,7 @@ int qiflush(void) BEFORE("qiflush"); cur_term->Nttyb.c_lflag &= ~(NOFLSH); AFTER("qiflush"); - if ((SET_TTY(cur_term->Filedes, &cur_term->Nttyb)) == -1) - returnCode(ERR); - else - returnCode(OK); + returnCode(_nc_set_curterm( &cur_term->Nttyb)); #else returnCode(ERR); #endif @@ -333,6 +315,10 @@ int noraw(void) SP->_raw = FALSE; SP->_cbreak = FALSE; +#ifdef __EMX__ + setmode(SP->_ifd, O_TEXT); +#endif + #ifdef TERMIOS BEFORE("noraw"); cur_term->Nttyb.c_lflag |= ISIG|ICANON; @@ -341,9 +327,7 @@ int noraw(void) #else cur_term->Nttyb.sg_flags &= ~(RAW|CBREAK); #endif - if ((SET_TTY(cur_term->Filedes, &cur_term->Nttyb)) == -1) - returnCode(ERR); - returnCode(OK); + returnCode(_nc_set_curterm( &cur_term->Nttyb)); } @@ -351,7 +335,11 @@ int nocbreak(void) { T((T_CALLED("nocbreak()"))); - SP->_cbreak = 0; + SP->_cbreak = FALSE; + +#ifdef __EMX__ + setmode(SP->_ifd, O_TEXT); +#endif #ifdef TERMIOS BEFORE("nocbreak"); @@ -361,26 +349,7 @@ int nocbreak(void) #else cur_term->Nttyb.sg_flags &= ~CBREAK; #endif - if ((SET_TTY(cur_term->Filedes, &cur_term->Nttyb)) == -1) - returnCode(ERR); - returnCode(OK); -} - -int noecho(void) -{ - T((T_CALLED("noecho()"))); - SP->_echo = FALSE; - returnCode(OK); -} - - -int nonl(void) -{ - T((T_CALLED("nonl()"))); - - SP->_nl = FALSE; - - returnCode(OK); + returnCode(_nc_set_curterm( &cur_term->Nttyb)); } int noqiflush(void) @@ -396,10 +365,7 @@ int noqiflush(void) BEFORE("noqiflush"); cur_term->Nttyb.c_lflag |= NOFLSH; AFTER("noqiflush"); - if ((SET_TTY(cur_term->Filedes, &cur_term->Nttyb)) == -1) - returnCode(ERR); - else - returnCode(OK); + returnCode(_nc_set_curterm( &cur_term->Nttyb)); #else returnCode(ERR); #endif @@ -425,10 +391,7 @@ int intrflush(WINDOW *win GCC_UNUSED, bool flag) else cur_term->Nttyb.c_lflag |= (NOFLSH); AFTER("intrflush"); - if ((SET_TTY(cur_term->Filedes, &cur_term->Nttyb)) == -1) - returnCode(ERR); - else - returnCode(OK); + returnCode(_nc_set_curterm( &cur_term->Nttyb)); #else returnCode(ERR); #endif diff --git a/ncurses/lib_redrawln.c b/ncurses/lib_redrawln.c new file mode 100644 index 00000000..adcdf736 --- /dev/null +++ b/ncurses/lib_redrawln.c @@ -0,0 +1,67 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1997 * + ****************************************************************************/ + +/* + * lib_redrawln.c + * + * The routine wredrawln(). + * + */ + +#include + +MODULE_ID("$Id: lib_redrawln.c,v 1.2 1998/02/11 12:13:57 tom Exp $") + +int wredrawln(WINDOW *win, int beg, int num) +{ +int i; + + T((T_CALLED("wredrawln(%p,%d,%d)"), win, beg, num)); + + if (touchline(win, beg, num) == OK) { + size_t len = win->_maxx * sizeof(chtype); + + /* + * XSI says that wredrawln() tells the library not to base + * optimization on the contents of the lines that are marked. + * We do that by changing the contents to nulls after touching + * the corresponding lines to get the optimizer's attention. + * + * FIXME: this won't work if the application makes further + * updates before the next refresh. + */ + for (i = beg; (i < beg + num) && (i < win->_maxy); i++) { + memset(win->_line[i].text, 0, len); + } + } + returnCode(OK); +} diff --git a/ncurses/lib_refresh.c b/ncurses/lib_refresh.c index c3418bf1..417e6702 100644 --- a/ncurses/lib_refresh.c +++ b/ncurses/lib_refresh.c @@ -1,44 +1,48 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* * lib_refresh.c * - * The routines wredrawln(), wrefresh() and wnoutrefresh(). + * The routines wrefresh() and wnoutrefresh(). * */ #include -MODULE_ID("$Id: lib_refresh.c,v 1.14 1997/02/02 01:05:26 tom Exp $") - -int wredrawln(WINDOW *win, int beg, int num) -{ - T((T_CALLED("wredrawln(%p,%d,%d)"), win, beg, num)); - touchline(win, beg, num); - wrefresh(win); - returnCode(OK); -} +MODULE_ID("$Id: lib_refresh.c,v 1.19 1998/02/11 12:13:59 tom Exp $") int wrefresh(WINDOW *win) { @@ -67,8 +71,8 @@ int code; int wnoutrefresh(WINDOW *win) { short i, j; -short begx = win->_begx; -short begy = win->_begy; +short begx; +short begy; short m, n; bool wide; @@ -85,6 +89,10 @@ bool wide; || (win->_flags & _ISPAD)) returnCode(ERR); + /* put them here so "win == 0" won't break our code */ + begx = win->_begx; + begy = win->_begy; + /* * If 'newscr' has a different background than the window that we're * trying to refresh, we'll have to copy the whole thing. @@ -153,14 +161,16 @@ bool wide; } +#if USE_SCROLL_HINTS if (wide) { int oind = oline->oldindex; nline->oldindex = (oind == _NEWINDEX) ? _NEWINDEX : begy + oind + win->_yoffset; } +#endif /* USE_SCROLL_HINTS */ oline->firstchar = oline->lastchar = _NOCHANGE; - oline->oldindex = i; + if_USE_SCROLL_HINTS(oline->oldindex = i); } if (win->_clear) { diff --git a/ncurses/lib_restart.c b/ncurses/lib_restart.c index 54ee81ea..6dc18314 100644 --- a/ncurses/lib_restart.c +++ b/ncurses/lib_restart.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* * Terminfo-only terminal setup routines: @@ -29,13 +41,13 @@ #include -#ifdef SVR4_TERMIO +#if defined(SVR4_TERMIO) && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE #endif #include /* lines, columns, cur_term */ -MODULE_ID("$Id: lib_restart.c,v 1.11 1997/02/02 01:10:25 tom Exp $") +MODULE_ID("$Id: lib_restart.c,v 1.16 1998/02/11 12:13:57 tom Exp $") #undef tabs @@ -57,15 +69,12 @@ int def_shell_mode(void) { T((T_CALLED("def_shell_mode()"))); - if (cur_term == 0) - returnCode(ERR); - /* * Turn off the XTABS bit in the tty structure if it was on. If XTABS * was on, remove the tab and backtab capabilities. */ - if (GET_TTY(cur_term->Filedes, &cur_term->Ottyb) == -1) + if (_nc_get_curterm(&cur_term->Ottyb) != OK) returnCode(ERR); #ifdef TERMIOS if (cur_term->Ottyb.c_oflag & tabs) @@ -81,10 +90,7 @@ int def_prog_mode(void) { T((T_CALLED("def_prog_mode()"))); - if (cur_term == 0) - returnCode(ERR); - - if (GET_TTY(cur_term->Filedes, &cur_term->Nttyb) == -1) + if (_nc_get_curterm(&cur_term->Nttyb) != OK) returnCode(ERR); #ifdef TERMIOS cur_term->Nttyb.c_oflag &= ~tabs; @@ -127,28 +133,9 @@ int savenl = SP->_nl; reset_prog_mode(); - _nc_get_screensize(); +#if USE_SIZECHANGE + _nc_update_screensize(); +#endif returnCode(OK); } - -TERMINAL *set_curterm(TERMINAL *term) -{ - TERMINAL *oldterm = cur_term; - - cur_term = term; - return oldterm; -} - -int del_curterm(TERMINAL *term) -{ - T((T_CALLED("del_curterm(%p)"), term)); - - if (term != NULL) { - FreeIfNeeded(term->type.str_table); - FreeIfNeeded(term->type.term_names); - free(term); - returnCode(OK); - } - returnCode(ERR); -} diff --git a/ncurses/lib_scanw.c b/ncurses/lib_scanw.c index bf5d5f7e..9148ab33 100644 --- a/ncurses/lib_scanw.c +++ b/ncurses/lib_scanw.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ @@ -30,17 +42,21 @@ #include -MODULE_ID("$Id: lib_scanw.c,v 1.4 1997/02/08 14:45:51 tom Exp $") +MODULE_ID("$Id: lib_scanw.c,v 1.7 1998/02/11 12:13:55 tom Exp $") #if !HAVE_VSSCANF +#if defined(__QNX__) +extern int vsscanf(const char *str, const char *format, __va_list __arg); +#else extern int vsscanf(const char *str, const char *format, ...); #endif +#endif int vwscanw(WINDOW *win, const char *fmt, va_list argp) { char buf[BUFSIZ]; - if (wgetstr(win, buf) == ERR) + if (wgetnstr(win, buf, sizeof(buf)-1) == ERR) return(ERR); return(vsscanf(buf, fmt, argp)); diff --git a/ncurses/lib_screen.c b/ncurses/lib_screen.c index 44716f58..f12b2dec 100644 --- a/ncurses/lib_screen.c +++ b/ncurses/lib_screen.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ #include @@ -26,22 +38,22 @@ #include #include /* exit_ca_mode, non_rev_rmcup */ -MODULE_ID("$Id: lib_screen.c,v 1.7 1997/02/02 00:41:10 tom Exp $") +MODULE_ID("$Id: lib_screen.c,v 1.11 1998/02/11 12:13:56 tom Exp $") static time_t dumptime; WINDOW *getwin(FILE *filep) { - WINDOW try, *nwin; + WINDOW tmp, *nwin; int n; T((T_CALLED("getwin(%p)"), filep)); - (void) fread(&try, sizeof(WINDOW), 1, filep); + (void) fread(&tmp, sizeof(WINDOW), 1, filep); if (ferror(filep)) returnWin(0); - if ((nwin = newwin(try._maxy+1, try._maxx+1, 0, 0)) == 0) + if ((nwin = newwin(tmp._maxy+1, tmp._maxx+1, 0, 0)) == 0) returnWin(0); /* @@ -49,28 +61,28 @@ WINDOW *getwin(FILE *filep) * fields, because the window hierarchy within which they * made sense is probably gone. */ - nwin->_curx = try._curx; - nwin->_cury = try._cury; - nwin->_maxy = try._maxy; - nwin->_maxx = try._maxx; - nwin->_begy = try._begy; - nwin->_begx = try._begx; - nwin->_yoffset = try._yoffset; - nwin->_flags = try._flags & ~(_SUBWIN|_ISPAD); - - nwin->_attrs = try._attrs; - nwin->_bkgd = try._bkgd; - - nwin->_clear = try._clear; - nwin->_scroll = try._scroll; - nwin->_leaveok = try._leaveok; - nwin->_use_keypad = try._use_keypad; - nwin->_delay = try._delay; - nwin->_immed = try._immed; - nwin->_sync = try._sync; - - nwin->_regtop = try._regtop; - nwin->_regbottom = try._regbottom; + nwin->_curx = tmp._curx; + nwin->_cury = tmp._cury; + nwin->_maxy = tmp._maxy; + nwin->_maxx = tmp._maxx; + nwin->_begy = tmp._begy; + nwin->_begx = tmp._begx; + nwin->_yoffset = tmp._yoffset; + nwin->_flags = tmp._flags & ~(_SUBWIN|_ISPAD); + + nwin->_attrs = tmp._attrs; + nwin->_bkgd = tmp._bkgd; + + nwin->_clear = tmp._clear; + nwin->_scroll = tmp._scroll; + nwin->_leaveok = tmp._leaveok; + nwin->_use_keypad = tmp._use_keypad; + nwin->_delay = tmp._delay; + nwin->_immed = tmp._immed; + nwin->_sync = tmp._sync; + + nwin->_regtop = tmp._regtop; + nwin->_regbottom = tmp._regbottom; for (n = 0; n < nwin->_maxy + 1; n++) { @@ -89,23 +101,26 @@ WINDOW *getwin(FILE *filep) int putwin(WINDOW *win, FILE *filep) { - int n; + int code = ERR; + int n; T((T_CALLED("putwin(%p,%p)"), win, filep)); - (void) fwrite(win, sizeof(WINDOW), 1, filep); - if (ferror(filep)) - returnCode(ERR); - - for (n = 0; n < win->_maxy + 1; n++) - { - (void) fwrite(win->_line[n].text, - sizeof(chtype), (size_t)(win->_maxx + 1), filep); - if (ferror(filep)) - returnCode(ERR); + if (win) { + (void) fwrite(win, sizeof(WINDOW), 1, filep); + if (ferror(filep)) + returnCode(code); + + for (n = 0; n < win->_maxy + 1; n++) + { + (void) fwrite(win->_line[n].text, + sizeof(chtype), (size_t)(win->_maxx + 1), filep); + if (ferror(filep)) + returnCode(code); + } + code = OK; } - - returnCode(OK); + returnCode(code); } int scr_restore(const char *file) @@ -114,7 +129,7 @@ int scr_restore(const char *file) T((T_CALLED("scr_restore(%s)"), _nc_visbuf(file))); - if ((fp = fopen(file, "r")) == 0) + if ((fp = fopen(file, "rb")) == 0) returnCode(ERR); else { @@ -131,7 +146,7 @@ int scr_dump(const char *file) T((T_CALLED("scr_dump(%s)"), _nc_visbuf(file))); - if ((fp = fopen(file, "w")) == 0) + if ((fp = fopen(file, "wb")) == 0) returnCode(ERR); else { @@ -154,7 +169,7 @@ int scr_init(const char *file) returnCode(ERR); #endif /* exit_ca_mode */ - if ((fp = fopen(file, "r")) == 0) + if ((fp = fopen(file, "rb")) == 0) returnCode(ERR); else if (fstat(STDOUT_FILENO, &stb) || stb.st_mtime > dumptime) returnCode(ERR); diff --git a/ncurses/lib_scroll.c b/ncurses/lib_scroll.c index acf99384..197bb221 100644 --- a/ncurses/lib_scroll.c +++ b/ncurses/lib_scroll.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ @@ -32,12 +44,11 @@ #include -MODULE_ID("$Id: lib_scroll.c,v 1.11 1997/02/01 23:22:54 tom Exp $") +MODULE_ID("$Id: lib_scroll.c,v 1.16 1998/02/11 12:13:55 tom Exp $") -void _nc_scroll_window(WINDOW *win, int const n, short const top, short const bottom) +void _nc_scroll_window(WINDOW *win, int const n, short const top, short const bottom, chtype blank) { int line, j; -chtype blank = _nc_background(win); size_t to_copy = (size_t)(sizeof(chtype) * (win->_maxx + 1)); TR(TRACE_MOVE, ("_nc_scroll_window(%p, %d, %d, %d)", win, n, top,bottom)); @@ -59,14 +70,12 @@ size_t to_copy = (size_t)(sizeof(chtype) * (win->_maxx + 1)); memcpy(win->_line[line].text, win->_line[line+n].text, to_copy); - win->_line[line].oldindex = win->_line[line+n].oldindex; + if_USE_SCROLL_HINTS(win->_line[line].oldindex = win->_line[line+n].oldindex); } for (line = top; line < top-n; line++) { for (j = 0; j <= win->_maxx; j ++) win->_line[line].text[j] = blank; - win->_line[line].oldindex = _NEWINDEX; - win->_line[line].firstchar = 0; - win->_line[line].lastchar = win->_maxx; + if_USE_SCROLL_HINTS(win->_line[line].oldindex = _NEWINDEX); } } @@ -76,16 +85,15 @@ size_t to_copy = (size_t)(sizeof(chtype) * (win->_maxx + 1)); memcpy(win->_line[line].text, win->_line[line+n].text, to_copy); - win->_line[line].oldindex = win->_line[line+n].oldindex; + if_USE_SCROLL_HINTS(win->_line[line].oldindex = win->_line[line+n].oldindex); } for (line = bottom; line > bottom-n; line--) { for (j = 0; j <= win->_maxx; j ++) win->_line[line].text[j] = blank; - win->_line[line].oldindex = _NEWINDEX; - win->_line[line].firstchar = 0; - win->_line[line].lastchar = win->_maxx; + if_USE_SCROLL_HINTS(win->_line[line].oldindex = _NEWINDEX); } } + touchline(win, top, bottom-top+1); } int @@ -93,7 +101,7 @@ wscrl(WINDOW *win, int n) { T((T_CALLED("wscrl(%p,%d)"), win, n)); - if (! win->_scroll) + if (!win || !win->_scroll) returnCode(ERR); if (n == 0) @@ -103,8 +111,7 @@ wscrl(WINDOW *win, int n) (-n > (win->_regbottom - win->_regtop))) returnCode(ERR); - _nc_scroll_window(win, n, win->_regtop, win->_regbottom); - touchline(win, win->_regtop, (int)(win->_regbottom - win->_regtop + 1)); + _nc_scroll_window(win, n, win->_regtop, win->_regbottom, _nc_background(win)); _nc_synchook(win); returnCode(OK); diff --git a/ncurses/lib_scrollok.c b/ncurses/lib_scrollok.c new file mode 100644 index 00000000..f24eb8eb --- /dev/null +++ b/ncurses/lib_scrollok.c @@ -0,0 +1,56 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + + +/* +** lib_scrollok.c +** +** The routine scrollok. +** +*/ + +#include + +MODULE_ID("$Id: lib_scrollok.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +int scrollok(WINDOW *win, bool flag) +{ + T((T_CALLED("scrollok(%p,%d)"), win, flag)); + + if (win) { + win->_scroll = flag; + returnCode(OK); + } + else + returnCode(ERR); +} diff --git a/ncurses/lib_scrreg.c b/ncurses/lib_scrreg.c index 70696a4b..ddeab249 100644 --- a/ncurses/lib_scrreg.c +++ b/ncurses/lib_scrreg.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ @@ -30,20 +42,21 @@ #include -MODULE_ID("$Id: lib_scrreg.c,v 1.5 1997/02/01 23:22:54 tom Exp $") +MODULE_ID("$Id: lib_scrreg.c,v 1.7 1998/02/11 12:13:53 tom Exp $") int wsetscrreg(WINDOW *win, int top, int bottom) { T((T_CALLED("wsetscrreg(%p,%d,%d)"), win, top, bottom)); - if (top >= 0 && top <= win->_maxy && - bottom >= 0 && bottom <= win->_maxy && - bottom > top) - { - win->_regtop = (short)top; - win->_regbottom = (short)bottom; - - returnCode(OK); - } else - returnCode(ERR); + if (win && + top >= 0 && top <= win->_maxy && + bottom >= 0 && bottom <= win->_maxy && + bottom > top) + { + win->_regtop = (short)top; + win->_regbottom = (short)bottom; + + returnCode(OK); + } else + returnCode(ERR); } diff --git a/ncurses/lib_set_term.c b/ncurses/lib_set_term.c index a34cdc1b..12ac5fd6 100644 --- a/ncurses/lib_set_term.c +++ b/ncurses/lib_set_term.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ @@ -32,7 +44,7 @@ #include /* cur_term */ -MODULE_ID("$Id: lib_set_term.c,v 1.17 1997/05/01 23:46:18 Alexander.V.Lukyanov Exp $") +MODULE_ID("$Id: lib_set_term.c,v 1.37 1998/02/11 12:13:57 tom Exp $") /* * If the output file descriptor is connected to a tty (the typical case) it @@ -105,12 +117,13 @@ SCREEN *oldSP; oldSP = SP; _nc_set_screen(screen); - cur_term = SP->_term; + set_curterm(SP->_term); curscr = SP->_curscr; newscr = SP->_newscr; stdscr = SP->_stdscr; COLORS = SP->_color_count; COLOR_PAIRS = SP->_pair_count; + memcpy(acs_map, SP->_acs_map, sizeof(chtype)*ACS_LEN); T((T_RETURN("%p"), oldSP)); return(oldSP); @@ -130,12 +143,25 @@ static void _nc_free_keytry(struct tries *kt) */ void delscreen(SCREEN *sp) { + SCREEN **scan = &_nc_screen_chain; + T((T_CALLED("delscreen(%p)"), sp)); + while(*scan) + { + if (*scan == sp) + { + *scan = sp->_next_screen; + break; + } + scan = &(*scan)->_next_screen; + } + _nc_freewin(sp->_curscr); _nc_freewin(sp->_newscr); _nc_freewin(sp->_stdscr); _nc_free_keytry(sp->_keytry); + _nc_free_keytry(sp->_key_ok); FreeIfNeeded(sp->_color_table); FreeIfNeeded(sp->_color_pairs); @@ -158,17 +184,29 @@ void delscreen(SCREEN *sp) returnVoid; } -ripoff_t rippedoff[5], *rsp = rippedoff; -#define N_RIPS (int)(sizeof(rippedoff)/sizeof(rippedoff[0])) +static ripoff_t rippedoff[5]; +static ripoff_t *rsp = rippedoff; +#define N_RIPS SIZEOF(rippedoff) + +static bool no_mouse_event (SCREEN *sp GCC_UNUSED) { return FALSE; } +static bool no_mouse_inline(SCREEN *sp GCC_UNUSED) { return FALSE; } +static bool no_mouse_parse (int code GCC_UNUSED) { return TRUE; } +static void no_mouse_resume(SCREEN *sp GCC_UNUSED) { } +static void no_mouse_wrap (SCREEN *sp GCC_UNUSED) { } int _nc_setupscreen(short slines, short const scolumns, FILE *output) /* OS-independent screen initializations */ { -int bottom_stolen = 0, i; +int bottom_stolen = 0; +size_t i; + assert(SP==0); /* has been reset in newterm() ! */ if (!_nc_alloc_screen()) return ERR; + SP->_next_screen = _nc_screen_chain; + _nc_screen_chain = SP; + _nc_set_buffer(output, TRUE); SP->_term = cur_term; SP->_lines = slines; @@ -176,24 +214,67 @@ int bottom_stolen = 0, i; SP->_columns = scolumns; SP->_cursrow = -1; SP->_curscol = -1; - SP->_keytry = UNINITIALISED; SP->_nl = TRUE; SP->_raw = FALSE; SP->_cbreak = FALSE; - SP->_echo = FALSE; + SP->_echo = TRUE; SP->_fifohead = -1; - SP->_fifotail = 0; - SP->_fifopeek = 0; SP->_endwin = TRUE; SP->_ofp = output; - SP->_coloron = 0; - SP->_curscr = 0; - SP->_newscr = 0; - SP->_stdscr = 0; - SP->_topstolen = 0; SP->_cursor = -1; /* cannot know real cursor shape */ + SP->_maxclick = DEFAULT_MAXCLICK; + SP->_mouse_event = no_mouse_event; + SP->_mouse_inline = no_mouse_inline; + SP->_mouse_parse = no_mouse_parse; + SP->_mouse_resume = no_mouse_resume; + SP->_mouse_wrap = no_mouse_wrap; + SP->_mouse_fd = -1; + + /* initialize the panel hooks */ + SP->_panelHook.top_panel = (struct panel*)0; + SP->_panelHook.bottom_panel = (struct panel*)0; + SP->_panelHook.stdscr_pseudo_panel = (struct panel*)0; + + /* + * If we've no magic cookie support, we suppress attributes that xmc + * would affect, i.e., the attributes that affect the rendition of a + * space. Note that this impacts the alternate character set mapping + * as well. + */ + if (magic_cookie_glitch > 0) { + + SP->_xmc_triggers = termattrs() & ( + A_ALTCHARSET | + A_BLINK | + A_BOLD | + A_REVERSE | + A_STANDOUT | + A_UNDERLINE + ); + SP->_xmc_suppress = SP->_xmc_triggers & (chtype)~(A_BOLD); + + T(("magic cookie attributes %s", _traceattr(SP->_xmc_suppress))); +#if USE_XMC_SUPPORT + /* + * To keep this simple, suppress all of the optimization hooks + * except for clear_screen and the cursor addressing. + */ + clr_eol = 0; + clr_eos = 0; + set_attributes = 0; +#else + magic_cookie_glitch = -1; + acs_chars = 0; +#endif + } init_acs(); + memcpy(SP->_acs_map, acs_map, sizeof(chtype)*ACS_LEN); + + _nc_idcok = TRUE; + _nc_idlok = FALSE; + + _nc_windows = 0; /* no windows yet */ T(("creating newscr")); if ((newscr = newwin(slines, scolumns, 0, 0)) == 0) @@ -205,6 +286,9 @@ int bottom_stolen = 0, i; SP->_newscr = newscr; SP->_curscr = curscr; +#if USE_SIZECHANGE + SP->_resize = resizeterm; +#endif newscr->_clear = TRUE; curscr->_clear = FALSE; @@ -235,7 +319,10 @@ int bottom_stolen = 0, i; } SP->_lines_avail -= count; } + rsp->line = 0; } + /* reset the stack */ + rsp = rippedoff; T(("creating stdscr")); assert ((SP->_lines_avail + SP->_topstolen + bottom_stolen) == slines); diff --git a/ncurses/lib_setup.c b/ncurses/lib_setup.c index 9a194b54..88242974 100644 --- a/ncurses/lib_setup.c +++ b/ncurses/lib_setup.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -29,13 +41,13 @@ #include -#ifdef SVR4_TERMIO +#if defined(SVR4_TERMIO) && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE #endif #include /* lines, columns, cur_term */ -MODULE_ID("$Id: lib_setup.c,v 1.24 1997/03/08 21:25:44 tom Exp $") +MODULE_ID("$Id: lib_setup.c,v 1.37 1998/02/11 12:13:56 tom Exp $") /**************************************************************************** * @@ -43,10 +55,42 @@ MODULE_ID("$Id: lib_setup.c,v 1.24 1997/03/08 21:25:44 tom Exp $") * ****************************************************************************/ -#if !defined(sun) || !HAVE_TERMIOS_H -#include +#if HAVE_SIZECHANGE +# if !defined(sun) || !HAVE_TERMIOS_H +# if HAVE_SYS_IOCTL_H +# include +# endif +# endif +#endif + +#if NEED_PTEM_H + /* On SCO, they neglected to define struct winsize in termios.h -- it's only + * in termio.h and ptem.h (the former conflicts with other definitions). + */ +# include +# include +#endif + +/* + * SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS, + * Solaris, IRIX) define TIOCGWINSZ and struct winsize. + */ +#ifdef TIOCGSIZE +# define IOCTL_WINSIZE TIOCGSIZE +# define STRUCT_WINSIZE struct ttysize +# define WINSIZE_ROWS(n) (int)n.ts_lines +# define WINSIZE_COLS(n) (int)n.ts_cols +#else +# ifdef TIOCGWINSZ +# define IOCTL_WINSIZE TIOCGWINSZ +# define STRUCT_WINSIZE struct winsize +# define WINSIZE_ROWS(n) (int)n.ws_row +# define WINSIZE_COLS(n) (int)n.ws_col +# endif #endif +extern TERMINAL *cur_term; + static int _use_env = TRUE; static void do_prototype(void); @@ -58,80 +102,80 @@ void use_env(bool f) int LINES, COLS, TABSIZE; -void _nc_get_screensize(void) -/* set LINES and COLS from the environment and/or terminfo entry */ +static void _nc_get_screensize(int *linep, int *colp) +/* Obtain lines/columns values from the environment and/or terminfo entry */ { -char *rows, *cols; +char *rows, *cols; /* figure out the size of the screen */ T(("screen size: terminfo lines = %d columns = %d", lines, columns)); if (!_use_env) { - LINES = (int)lines; - COLS = (int)columns; + *linep = (int)lines; + *colp = (int)columns; } else /* usually want to query LINES and COLUMNS from environment */ { - LINES = COLS = 0; + *linep = *colp = 0; /* first, look for environment variables */ rows = getenv("LINES"); - if (rows != (char *)NULL) - LINES = atoi(rows); + if (rows != 0) + *linep = atoi(rows); cols = getenv("COLUMNS"); - if (cols != (char *)NULL) - COLS = atoi(cols); - T(("screen size: environment LINES = %d COLUMNS = %d",LINES,COLS)); + if (cols != 0) + *colp = atoi(cols); + T(("screen size: environment LINES = %d COLUMNS = %d",*linep,*colp)); -#if defined(TIOCGWINSZ) && !BROKEN_TIOCGWINSZ +#if HAVE_SIZECHANGE /* if that didn't work, maybe we can try asking the OS */ - if (LINES <= 0 || COLS <= 0) + if (*linep <= 0 || *colp <= 0) { if (isatty(cur_term->Filedes)) { - struct winsize size; + STRUCT_WINSIZE size; errno = 0; do { - if (ioctl(cur_term->Filedes, TIOCGWINSZ, &size) < 0 + if (ioctl(cur_term->Filedes, IOCTL_WINSIZE, &size) < 0 && errno != EINTR) goto failure; } while (errno == EINTR); - LINES = (int)size.ws_row; - COLS = (int)size.ws_col; + *linep = WINSIZE_ROWS(size); + *colp = WINSIZE_COLS(size); } /* FALLTHRU */ failure:; } -#endif /* defined(TIOCGWINSZ) && !defined(BROKEN_TIOCGWINSZ) */ +#endif /* HAVE_SIZECHANGE */ /* if we can't get dynamic info about the size, use static */ - if (LINES <= 0 || COLS <= 0) + if (*linep <= 0 || *colp <= 0) if (lines > 0 && columns > 0) { - LINES = (int)lines; - COLS = (int)columns; + *linep = (int)lines; + *colp = (int)columns; } /* the ultimate fallback, assume fixed 24x80 size */ - if (LINES <= 0 || COLS <= 0) + if (*linep <= 0 || *colp <= 0) { - LINES = 24; - COLS = 80; + *linep = 24; + *colp = 80; } /* * Put the derived values back in the screen-size caps, so * tigetnum() and tgetnum() will do the right thing. */ - lines = (short)LINES; - columns = (short)COLS; + lines = (short)(*linep); + columns = (short)(*colp); } - T(("screen size is %dx%d", LINES, COLS)); + T(("screen size is %dx%d", *linep, *colp)); #ifdef init_tabs if (init_tabs != -1) @@ -143,6 +187,17 @@ char *rows, *cols; } +#if USE_SIZECHANGE +void _nc_update_screensize(void) +{ + int my_lines, my_cols; + + _nc_get_screensize(&my_lines, &my_cols); + if (SP != 0 && SP->_resize != 0) + SP->_resize(my_lines, my_cols); +} +#endif + /**************************************************************************** * * Terminal setup @@ -165,6 +220,7 @@ char *rows, *cols; exit(EXIT_FAILURE);\ } +#if USE_DATABASE static int grab_entry(const char *const tn, TERMTYPE *const tp) /* return 1 if entry found, 0 if not found, -1 if database not accessible */ { @@ -185,6 +241,7 @@ static int grab_entry(const char *const tn, TERMTYPE *const tp) return(status); } +#endif char ttytype[NAMESIZE]; @@ -203,9 +260,9 @@ int status; T((T_CALLED("setupterm(\"%s\",%d,%p)"), tname, Filedes, errret)); - if (tname == NULL) { + if (tname == 0) { tname = getenv("TERM"); - if (tname == NULL) + if (tname == 0 || *tname == '\0') ret_error0(-1, "TERM environment variable not set.\n"); } @@ -213,9 +270,13 @@ int status; term_ptr = typeCalloc(TERMINAL, 1); - if (term_ptr == NULL) + if (term_ptr == 0) ret_error0(-1, "Not enough memory to create terminal structure.\n") ; +#if USE_DATABASE status = grab_entry(tname, &term_ptr->type); +#else + status = 0; +#endif /* try fallback list if entry on disk */ if (status != 1) @@ -238,11 +299,7 @@ int status; ret_error(0, "'%s': unknown terminal type.\n", tname); } - cur_term = term_ptr; - if (generic_type) - ret_error(0, "'%s': I need something more specific.\n", tname); - if (hard_copy) - ret_error(1, "'%s': I can't handle hardcopy terminals.\n", tname); + set_curterm(term_ptr); if (command_character && getenv("CC")) do_prototype(); @@ -259,13 +316,18 @@ int status; Filedes = STDERR_FILENO; cur_term->Filedes = Filedes; - _nc_get_screensize(); + _nc_get_screensize(&LINES, &COLS); if (errret) *errret = 1; T((T_CREATE("screen %s %dx%d"), tname, LINES, COLS)); + if (generic_type) + ret_error(0, "'%s': I need something more specific.\n", tname); + if (hard_copy) + ret_error(1, "'%s': I can't handle hardcopy terminals.\n", tname); + returnCode(OK); } diff --git a/ncurses/lib_slk.c b/ncurses/lib_slk.c index b1124e85..64a943a2 100644 --- a/ncurses/lib_slk.c +++ b/ncurses/lib_slk.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* * lib_slk.c @@ -29,254 +41,32 @@ #include #include /* num_labels, label_*, plab_norm */ -MODULE_ID("$Id: lib_slk.c,v 1.11 1997/01/18 23:06:32 tom Exp $") - -#define MAX_SKEY_OLD 8 /* count of soft keys */ -#define MAX_SKEY_LEN_OLD 8 /* max length of soft key text */ -#define MAX_SKEY_PC 12 /* This is what most PC's have */ -#define MAX_SKEY_LEN_PC 5 +MODULE_ID("$Id: lib_slk.c,v 1.14 1998/02/11 12:13:56 tom Exp $") -#define MAX_SKEY (SLK_STDFMT ? MAX_SKEY_OLD : MAX_SKEY_PC) -#define MAX_SKEY_LEN (SLK_STDFMT ? MAX_SKEY_LEN_OLD : MAX_SKEY_LEN_PC) /* * We'd like to move these into the screen context structure, but cannot, * because slk_init() is called before initscr()/newterm(). */ -int _nc_slk_format; /* one more than format specified in slk_init() */ - -static chtype _slk_attr = A_STANDOUT; /* soft label attribute */ -static SLK *_slk; -static void slk_paint_info(WINDOW *win); - -/* - * Fetch the label text. - */ - -char * -slk_label(int n) -{ - T(("slk_label(%d)", n)); - - if (SP->_slk == NULL || n < 1 || n > SP->_slk->labcnt) - return NULL; - return(SP->_slk->ent[n-1].text); -} - -/* - * Write the soft labels to the soft-key window. - */ - -static void -slk_intern_refresh(SLK *slk) -{ -int i; - for (i = 0; i < slk->labcnt; i++) { - if (slk->dirty || slk->ent[i].dirty) { - if (slk->ent[i].visible) { -#ifdef num_labels - if (num_labels > 0 && SLK_STDFMT) - { - if (i < num_labels) { - TPUTS_TRACE("plab_norm"); - putp(tparm(plab_norm, i, slk->win,slk->ent[i].form_text)); - } - } - else -#endif /* num_labels */ - { - wmove(slk->win,SLK_LINES-1,slk->ent[i].x); - wattrset(slk->win,_slk_attr); - waddnstr(slk->win,slk->ent[i].form_text, MAX_SKEY_LEN); - /* if we simulate SLK's, it's looking much more - natural to use the current ATTRIBUTE also - for the label window */ - wattrset(slk->win,stdscr->_attrs); - } - } - slk->ent[i].dirty = FALSE; - } - } - slk->dirty = FALSE; - -#ifdef num_labels - if (num_labels > 0) - if (slk->hidden) - { - TPUTS_TRACE("label_off"); - putp(label_off); - } - else - { - TPUTS_TRACE("label_on"); - putp(label_on); - } -#endif /* num_labels */ -} - -/* - * Refresh the soft labels. - */ - -int -slk_noutrefresh(void) -{ - T(("slk_noutrefresh()")); - - if (SP->_slk == NULL) - return(ERR); - if (SP->_slk->hidden) - return(OK); - slk_intern_refresh(SP->_slk); - return(wnoutrefresh(SP->_slk->win)); -} - -/* - * Refresh the soft labels. - */ - -int -slk_refresh(void) -{ - T(("slk_refresh()")); - - if (SP->_slk == NULL) - return(ERR); - if (SP->_slk->hidden) - return(OK); - slk_intern_refresh(SP->_slk); - return(wrefresh(SP->_slk->win)); -} - -/* - * Restore the soft labels on the screen. - */ - -int -slk_restore(void) -{ - T(("slk_restore()")); - - if (SP->_slk == NULL) - return(ERR); - SP->_slk->hidden = FALSE; - SP->_slk->dirty = TRUE; - /* we have to repaint info line eventually */ - slk_paint_info(SP->_slk->win); - return slk_refresh(); -} - -/* - * Set soft label text. - */ - -int -slk_set(int i, const char *astr, int format) -{ -SLK *slk = SP->_slk; -size_t len; -const char *str = astr; -const char *p; - - T(("slk_set(%d, \"%s\", %d)", i, str, format)); - - if (slk == NULL || i < 1 || i > slk->labcnt || format < 0 || format > 2) - return(ERR); - if (str == NULL) - str = ""; - - while (isspace(*str)) str++; /* skip over leading spaces */ - p = str; - while (isprint(*p)) p++; /* The first non-print stops */ - - --i; /* Adjust numbering of labels */ - - len = (size_t)(p - str); - if (len > (unsigned)slk->maxlen) - len = slk->maxlen; - if (len==0) - slk->ent[i].text[0] = 0; - else - (void) strncpy(slk->ent[i].text, str, len); - memset(slk->ent[i].form_text,' ', (unsigned)slk->maxlen); - slk->ent[i].text[slk->maxlen] = 0; - /* len = strlen(slk->ent[i].text); */ - - switch(format) { - case 0: /* left-justified */ - memcpy(slk->ent[i].form_text, - slk->ent[i].text, - len); - break; - case 1: /* centered */ - memcpy(slk->ent[i].form_text+(slk->maxlen - len)/2, - slk->ent[i].text, - len); - break; - case 2: /* right-justified */ - memcpy(slk->ent[i].form_text+ slk->maxlen - len, - slk->ent[i].text, - len); - break; - } - slk->ent[i].form_text[slk->maxlen] = 0; - slk->ent[i].dirty = TRUE; - return(OK); -} - -/* - * Force the code to believe that the soft keys have been changed. - */ - -int -slk_touch(void) -{ - T(("slk_touch()")); - - if (SP->_slk == NULL) - return(ERR); - SP->_slk->dirty = TRUE; - return(OK); -} - -/* - * Remove soft labels from the screen. - */ - -int -slk_clear(void) -{ - T(("slk_clear()")); - - if (SP->_slk == NULL) - return(ERR); - SP->_slk->hidden = TRUE; - /* For simulated SLK's it's looks much more natural to - inherit those attributes from the standard screen */ - SP->_slk->win->_bkgd = stdscr->_bkgd; - SP->_slk->win->_attrs = stdscr->_attrs; - werase(SP->_slk->win); - return wrefresh(SP->_slk->win); -} +int _nc_slk_format; /* one more than format specified in slk_init() */ /* * Paint the info line for the PC style SLK emulation. - * + * */ - static void slk_paint_info(WINDOW *win) { if (win && _nc_slk_format==4) { int i; - + mvwhline (win,0,0,0,getmaxx(win)); wmove (win,0,0); - - for (i = 0; i < _slk->maxlab; i++) { + + for (i = 0; i < SP->_slk->maxlab; i++) { if (win && _nc_slk_format==4) { - mvwaddch(win,0,_slk->ent[i].x,'F'); + mvwaddch(win,0,SP->_slk->ent[i].x,'F'); if (i<9) waddch(win,'1'+i); else @@ -293,7 +83,6 @@ slk_paint_info(WINDOW *win) * Initialize soft labels. * Called from newterm() */ - int _nc_slk_initialize(WINDOW *stwin, int cols) { @@ -302,53 +91,53 @@ char *p; T(("slk_initialize()")); - if (_slk) + if (SP->_slk) { /* we did this already, so simply return */ - SP->_slk = _slk; return(OK); } else - if ((SP->_slk = _slk = typeCalloc(SLK, 1)) == 0) + if ((SP->_slk = typeCalloc(SLK, 1)) == 0) return(ERR); - _slk->ent = NULL; - _slk->buffer = NULL; + SP->_slk->ent = NULL; + SP->_slk->buffer = NULL; + SP->_slk->attr = A_STANDOUT; #ifdef num_labels - _slk->maxlab = (num_labels > 0) ? num_labels : MAX_SKEY; - _slk->maxlen = (num_labels > 0) ? label_width * label_height : MAX_SKEY_LEN; - _slk->labcnt = (_slk->maxlab < MAX_SKEY) ? MAX_SKEY : _slk->maxlab; + SP->_slk->maxlab = (num_labels > 0) ? num_labels : MAX_SKEY; + SP->_slk->maxlen = (num_labels > 0) ? label_width * label_height : MAX_SKEY_LEN; + SP->_slk->labcnt = (SP->_slk->maxlab < MAX_SKEY) ? MAX_SKEY : SP->_slk->maxlab; #else - _slk->labcnt = _slk->maxlab = MAX_SKEY; - _slk->maxlen = MAX_SKEY_LEN; + SP->_slk->labcnt = SP->_slk->maxlab = MAX_SKEY; + SP->_slk->maxlen = MAX_SKEY_LEN; #endif /* num_labels */ - _slk->ent = typeCalloc(slk_ent, _slk->labcnt); - if (_slk->ent == NULL) + SP->_slk->ent = typeCalloc(slk_ent, SP->_slk->labcnt); + if (SP->_slk->ent == NULL) goto exception; - p = _slk->buffer = (char*) calloc(2*_slk->labcnt,(1+_slk->maxlen)); - if (_slk->buffer == NULL) + p = SP->_slk->buffer = (char*) calloc(2*SP->_slk->labcnt,(1+SP->_slk->maxlen)); + if (SP->_slk->buffer == NULL) goto exception; - for (i = 0; i < _slk->labcnt; i++) { - _slk->ent[i].text = p; - p += (1 + _slk->maxlen); - _slk->ent[i].form_text = p; - p += (1 + _slk->maxlen); - memset(_slk->ent[i].form_text, ' ', (unsigned)_slk->maxlen); - _slk->ent[i].visible = (i < _slk->maxlab); + for (i = 0; i < SP->_slk->labcnt; i++) { + SP->_slk->ent[i].text = p; + p += (1 + SP->_slk->maxlen); + SP->_slk->ent[i].form_text = p; + p += (1 + SP->_slk->maxlen); + memset(SP->_slk->ent[i].form_text, ' ', (unsigned)(SP->_slk->maxlen)); + SP->_slk->ent[i].visible = (i < SP->_slk->maxlab); } if (_nc_slk_format >= 3) /* PC style */ { - int gap = (cols - 3 * (3 + 4*_slk->maxlen))/2; + int gap = (cols - 3 * (3 + 4*SP->_slk->maxlen))/2; if (gap < 1) gap = 1; - for (i = x = 0; i < _slk->maxlab; i++) { - _slk->ent[i].x = x; - x += _slk->maxlen; + for (i = x = 0; i < SP->_slk->maxlab; i++) { + SP->_slk->ent[i].x = x; + x += SP->_slk->maxlen; x += (i==3 || i==7) ? gap : 1; } if (_nc_slk_format == 4) @@ -356,26 +145,26 @@ char *p; } else { if (_nc_slk_format == 2) { /* 4-4 */ - int gap = cols - (_slk->maxlab * _slk->maxlen) - 6; + int gap = cols - (SP->_slk->maxlab * SP->_slk->maxlen) - 6; if (gap < 1) gap = 1; - for (i = x = 0; i < _slk->maxlab; i++) { - _slk->ent[i].x = x; - x += _slk->maxlen; + for (i = x = 0; i < SP->_slk->maxlab; i++) { + SP->_slk->ent[i].x = x; + x += SP->_slk->maxlen; x += (i == 3) ? gap : 1; } } else { if (_nc_slk_format == 1) { /* 1 -> 3-2-3 */ - int gap = (cols - (_slk->maxlab * _slk->maxlen) - 5) / 2; + int gap = (cols - (SP->_slk->maxlab * SP->_slk->maxlen) - 5) / 2; if (gap < 1) gap = 1; - for (i = x = 0; i < _slk->maxlab; i++) { - _slk->ent[i].x = x; - x += _slk->maxlen; + for (i = x = 0; i < SP->_slk->maxlab; i++) { + SP->_slk->ent[i].x = x; + x += SP->_slk->maxlen; x += (i == 2 || i == 4) ? gap : 1; } } @@ -383,16 +172,16 @@ char *p; goto exception; } } - _slk->dirty = TRUE; - if ((_slk->win = stwin) == NULL) + SP->_slk->dirty = TRUE; + if ((SP->_slk->win = stwin) == NULL) { exception: - if (_slk) + if (SP->_slk) { - FreeIfNeeded(_slk->buffer); - FreeIfNeeded(_slk->ent); - free(_slk); - SP->_slk = _slk = (SLK*)0; + FreeIfNeeded(SP->_slk->buffer); + FreeIfNeeded(SP->_slk->ent); + free(SP->_slk); + SP->_slk = (SLK*)0; return(ERR); } } @@ -400,44 +189,21 @@ char *p; return(OK); } + /* - * Initialize soft labels. Called by the user before initscr(). + * Restore the soft labels on the screen. */ - int -slk_init(int format) -{ - if (format < 0 || format > 3) - return(ERR); - _nc_slk_format = 1 + format; - return(OK); -} - -/* Functions to manipulate the soft-label attribute */ - -int -slk_attrset(const attr_t attr) -{ - _slk_attr = attr; - return(OK); -} - -int -slk_attron(const attr_t attr) +slk_restore(void) { - toggle_attr_on(_slk_attr,attr); - return(OK); -} + T((T_CALLED("slk_restore()"))); -int -slk_attroff(const attr_t attr) -{ - toggle_attr_off(_slk_attr,attr); - return(OK); -} + if (SP->_slk == NULL) + return(ERR); + SP->_slk->hidden = FALSE; + SP->_slk->dirty = TRUE; + /* we have to repaint info line eventually */ + slk_paint_info(SP->_slk->win); -attr_t -slk_attr(void) -{ - return _slk_attr; + returnCode(slk_refresh()); } diff --git a/ncurses/lib_slkatrof.c b/ncurses/lib_slkatrof.c new file mode 100644 index 00000000..2e1b3723 --- /dev/null +++ b/ncurses/lib_slkatrof.c @@ -0,0 +1,55 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * lib_slkatrof.c + * Soft key routines. + * Switch off labels attributes + */ +#include + +MODULE_ID("$Id: lib_slkatrof.c,v 1.3 1998/02/11 12:13:56 tom Exp $") + +int +slk_attroff(const attr_t attr) +{ + T((T_CALLED("slk_attroff(%s)"), _traceattr(attr))); + + if (SP!=0 && SP->_slk!=0) + { + toggle_attr_off(SP->_slk->attr,attr); + returnCode(OK); + } + else + returnCode(ERR); +} diff --git a/ncurses/lib_slkatron.c b/ncurses/lib_slkatron.c new file mode 100644 index 00000000..55527762 --- /dev/null +++ b/ncurses/lib_slkatron.c @@ -0,0 +1,55 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * lib_slkatron.c + * Soft key routines. + * Switch on labels attributes + */ +#include + +MODULE_ID("$Id: lib_slkatron.c,v 1.3 1998/02/11 12:13:56 tom Exp $") + +int +slk_attron(const attr_t attr) +{ + T((T_CALLED("slk_attron(%s)"), _traceattr(attr))); + + if (SP!=0 && SP->_slk!=0) + { + toggle_attr_on(SP->_slk->attr,attr); + returnCode(OK); + } + else + returnCode(ERR); +} diff --git a/ncurses/lib_slkatrset.c b/ncurses/lib_slkatrset.c new file mode 100644 index 00000000..a540491b --- /dev/null +++ b/ncurses/lib_slkatrset.c @@ -0,0 +1,55 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * lib_slkatrset.c + * Soft key routines. + * Set the labels attributes + */ +#include + +MODULE_ID("$Id: lib_slkatrset.c,v 1.3 1998/02/11 12:13:56 tom Exp $") + +int +slk_attrset(const attr_t attr) +{ + T((T_CALLED("slk_attrset(%s)"), _traceattr(attr))); + + if (SP!=0 && SP->_slk!=0) + { + SP->_slk->attr = attr; + returnCode(OK); + } + else + returnCode(ERR); +} diff --git a/ncurses/lib_slkattr.c b/ncurses/lib_slkattr.c new file mode 100644 index 00000000..a1324032 --- /dev/null +++ b/ncurses/lib_slkattr.c @@ -0,0 +1,54 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * lib_slkattr.c + * Soft key routines. + * Fetch the labels attributes + */ +#include + +MODULE_ID("$Id: lib_slkattr.c,v 1.3 1998/02/11 12:13:56 tom Exp $") + +attr_t +slk_attr(void) +{ + T((T_CALLED("slk_attr()"))); + + if (SP!=0 && SP->_slk!=0) + { + returnAttr(SP->_slk->attr); + } + else + returnAttr(0); +} diff --git a/ncurses/lib_slkclear.c b/ncurses/lib_slkclear.c new file mode 100644 index 00000000..42e76a7b --- /dev/null +++ b/ncurses/lib_slkclear.c @@ -0,0 +1,58 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * lib_slkclear.c + * Soft key routines. + * Remove soft labels from the screen. + */ +#include + +MODULE_ID("$Id: lib_slkclear.c,v 1.3 1998/02/11 12:13:56 tom Exp $") + +int +slk_clear(void) +{ + T((T_CALLED("slk_clear()"))); + + if (SP == NULL || SP->_slk == NULL) + returnCode(ERR); + SP->_slk->hidden = TRUE; + /* For simulated SLK's it's looks much more natural to + inherit those attributes from the standard screen */ + SP->_slk->win->_bkgd = stdscr->_bkgd; + SP->_slk->win->_attrs = stdscr->_attrs; + werase(SP->_slk->win); + + returnCode(wrefresh(SP->_slk->win)); +} diff --git a/ncurses/lib_slkinit.c b/ncurses/lib_slkinit.c new file mode 100644 index 00000000..70844260 --- /dev/null +++ b/ncurses/lib_slkinit.c @@ -0,0 +1,51 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * lib_slkinit.c + * Soft key routines. + * Initialize soft labels. Called by the user before initscr(). + */ +#include + +MODULE_ID("$Id: lib_slkinit.c,v 1.3 1998/02/11 12:13:56 tom Exp $") + +int +slk_init(int format) +{ + T((T_CALLED("slk_init(%d)"), format)); + if (format < 0 || format > 3) + returnCode(ERR); + _nc_slk_format = 1 + format; + returnCode(OK); +} diff --git a/ncurses/lib_slklab.c b/ncurses/lib_slklab.c new file mode 100644 index 00000000..03039ad6 --- /dev/null +++ b/ncurses/lib_slklab.c @@ -0,0 +1,51 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * lib_slklab.c + * Soft key routines. + * Fetch the label text. + */ +#include + +MODULE_ID("$Id: lib_slklab.c,v 1.4 1998/02/11 12:13:54 tom Exp $") + +char* +slk_label(int n) +{ + T((T_CALLED("slk_label(%d)"), n)); + + if (SP == NULL || SP->_slk == NULL || n < 1 || n > SP->_slk->labcnt) + returnPtr(0); + returnPtr(SP->_slk->ent[n-1].text); +} diff --git a/ncurses/lib_slkrefr.c b/ncurses/lib_slkrefr.c new file mode 100644 index 00000000..dcdef99a --- /dev/null +++ b/ncurses/lib_slkrefr.c @@ -0,0 +1,126 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * lib_slkrefr.c + * Write SLK window to the (virtual) screen. + */ +#include +#include /* num_labels, label_*, plab_norm */ + +MODULE_ID("$Id: lib_slkrefr.c,v 1.4 1998/02/11 12:13:56 tom Exp $") + +/* + * Write the soft labels to the soft-key window. + */ +static void +slk_intern_refresh(SLK *slk) +{ +int i; + for (i = 0; i < slk->labcnt; i++) { + if (slk->dirty || slk->ent[i].dirty) { + if (slk->ent[i].visible) { +#ifdef num_labels + if (num_labels > 0 && SLK_STDFMT) + { + if (i < num_labels) { + TPUTS_TRACE("plab_norm"); + putp(tparm(plab_norm, i, slk->win,slk->ent[i].form_text)); + } + } + else +#endif /* num_labels */ + { + wmove(slk->win,SLK_LINES-1,slk->ent[i].x); + if (SP && SP->_slk) + wattrset(slk->win,SP->_slk->attr); + waddnstr(slk->win,slk->ent[i].form_text, MAX_SKEY_LEN); + /* if we simulate SLK's, it's looking much more + natural to use the current ATTRIBUTE also + for the label window */ + wattrset(slk->win,stdscr->_attrs); + } + } + slk->ent[i].dirty = FALSE; + } + } + slk->dirty = FALSE; + +#ifdef num_labels + if (num_labels > 0) + if (slk->hidden) + { + TPUTS_TRACE("label_off"); + putp(label_off); + } + else + { + TPUTS_TRACE("label_on"); + putp(label_on); + } +#endif /* num_labels */ +} + +/* + * Refresh the soft labels. + */ +int +slk_noutrefresh(void) +{ + T((T_CALLED("slk_noutrefresh()"))); + + if (SP == NULL || SP->_slk == NULL) + returnCode(ERR); + if (SP->_slk->hidden) + returnCode(OK); + slk_intern_refresh(SP->_slk); + + returnCode(wnoutrefresh(SP->_slk->win)); +} + +/* + * Refresh the soft labels. + */ +int +slk_refresh(void) +{ + T((T_CALLED("slk_refresh()"))); + + if (SP == NULL || SP->_slk == NULL) + returnCode(ERR); + if (SP->_slk->hidden) + returnCode(OK); + slk_intern_refresh(SP->_slk); + + returnCode(wrefresh(SP->_slk->win)); +} diff --git a/ncurses/lib_slkset.c b/ncurses/lib_slkset.c new file mode 100644 index 00000000..27471add --- /dev/null +++ b/ncurses/lib_slkset.c @@ -0,0 +1,95 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * lib_slkset.c + * Set soft label text. + */ +#include +#include + +MODULE_ID("$Id: lib_slkset.c,v 1.3 1998/02/11 12:13:56 tom Exp $") + +int +slk_set(int i, const char *astr, int format) +{ +SLK *slk = SP->_slk; +size_t len; +const char *str = astr; +const char *p; + + T((T_CALLED("slk_set(%d, \"%s\", %d)"), i, str, format)); + + if (slk == NULL || i < 1 || i > slk->labcnt || format < 0 || format > 2) + returnCode(ERR); + if (str == NULL) + str = ""; + + while (isspace(*str)) str++; /* skip over leading spaces */ + p = str; + while (isprint(*p)) p++; /* The first non-print stops */ + + --i; /* Adjust numbering of labels */ + + len = (size_t)(p - str); + if (len > (unsigned)slk->maxlen) + len = slk->maxlen; + if (len==0) + slk->ent[i].text[0] = 0; + else + (void) strncpy(slk->ent[i].text, str, len); + memset(slk->ent[i].form_text,' ', (unsigned)slk->maxlen); + slk->ent[i].text[slk->maxlen] = 0; + /* len = strlen(slk->ent[i].text); */ + + switch(format) { + case 0: /* left-justified */ + memcpy(slk->ent[i].form_text, + slk->ent[i].text, + len); + break; + case 1: /* centered */ + memcpy(slk->ent[i].form_text+(slk->maxlen - len)/2, + slk->ent[i].text, + len); + break; + case 2: /* right-justified */ + memcpy(slk->ent[i].form_text+ slk->maxlen - len, + slk->ent[i].text, + len); + break; + } + slk->ent[i].form_text[slk->maxlen] = 0; + slk->ent[i].dirty = TRUE; + returnCode(OK); +} diff --git a/ncurses/lib_slktouch.c b/ncurses/lib_slktouch.c new file mode 100644 index 00000000..c2829aed --- /dev/null +++ b/ncurses/lib_slktouch.c @@ -0,0 +1,53 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * lib_slktouch.c + * Soft key routines. + * Force the code to believe that the soft keys have been changed. + */ +#include + +MODULE_ID("$Id: lib_slktouch.c,v 1.3 1998/02/11 12:13:56 tom Exp $") + +int +slk_touch(void) +{ + T((T_CALLED("slk_touch()"))); + + if (SP == NULL || SP->_slk == NULL) + returnCode(ERR); + SP->_slk->dirty = TRUE; + + returnCode(OK); +} diff --git a/ncurses/lib_termcap.c b/ncurses/lib_termcap.c index e0fac6f8..d8dcf3e9 100644 --- a/ncurses/lib_termcap.c +++ b/ncurses/lib_termcap.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ #include @@ -27,7 +39,7 @@ #define __INTERNAL_CAPS_VISIBLE #include -MODULE_ID("$Id: lib_termcap.c,v 1.13 1996/12/21 14:24:06 tom Exp $") +MODULE_ID("$Id: lib_termcap.c,v 1.17 1998/02/11 12:13:54 tom Exp $") /* some of the code in here was contributed by: @@ -62,7 +74,7 @@ speed_t speed; #endif T(("calling tgetent")); - setupterm((char *)name, STDOUT_FILENO, &errcode); + setupterm(name, STDOUT_FILENO, &errcode); if (errcode != 1) return(errcode); @@ -125,7 +137,7 @@ speed_t speed; B50, B0, }; -#define MAXSPEED sizeof(speeds)/sizeof(speeds[0]) +#define MAXSPEED SIZEOF(speeds) for (sp = speeds; sp < speeds + MAXSPEED; sp++) { if (sp[0] <= speed) { @@ -161,9 +173,11 @@ int tgetflag(const char *id) int i; T(("tgetflag: %s", id)); - for (i = 0; i < BOOLCOUNT; i++) - if (!strcmp(id, boolcodes[i])) - return cur_term->type.Booleans[i]; + if (cur_term != 0) { + for (i = 0; i < BOOLCOUNT; i++) + if (!strcmp(id, boolcodes[i])) + return cur_term->type.Booleans[i]; + } return ERR; } @@ -181,9 +195,11 @@ int tgetnum(const char *id) int i; T(("tgetnum: %s", id)); - for (i = 0; i < NUMCOUNT; i++) - if (!strcmp(id, numcodes[i])) - return cur_term->type.Numbers[i]; + if (cur_term != 0) { + for (i = 0; i < NUMCOUNT; i++) + if (!strcmp(id, numcodes[i])) + return cur_term->type.Numbers[i]; + } return ERR; } @@ -201,11 +217,13 @@ char *tgetstr(const char *id, char **area GCC_UNUSED) int i; T(("tgetstr: %s", id)); - for (i = 0; i < STRCOUNT; i++) { - T(("trying %s", strcodes[i])); - if (!strcmp(id, strcodes[i])) { - T(("found match : %s", cur_term->type.Strings[i])); - return cur_term->type.Strings[i]; + if (cur_term != 0) { + for (i = 0; i < STRCOUNT; i++) { + T(("trying %s", strcodes[i])); + if (!strcmp(id, strcodes[i])) { + T(("found match : %s", cur_term->type.Strings[i])); + return cur_term->type.Strings[i]; + } } } return NULL; @@ -222,5 +240,5 @@ int i; char *tgoto(const char *string, int x, int y) { - return(tparm((char *)string, y, x)); + return(tparm(string, y, x)); } diff --git a/ncurses/lib_ti.c b/ncurses/lib_ti.c index 41117f0b..b77076f0 100644 --- a/ncurses/lib_ti.c +++ b/ncurses/lib_ti.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ #include @@ -25,7 +37,7 @@ #include #include -MODULE_ID("$Id: lib_ti.c,v 1.7 1996/12/21 14:24:06 tom Exp $") +MODULE_ID("$Id: lib_ti.c,v 1.9 1998/02/11 12:14:00 tom Exp $") int tigetflag(const char *str) { @@ -33,9 +45,10 @@ int i; T(("tigetflag(%s)", str)); - for (i = 0; i < BOOLCOUNT; i++) - if (!strcmp(str, boolnames[i])) - return cur_term->type.Booleans[i]; + if (cur_term != 0) + for (i = 0; i < BOOLCOUNT; i++) + if (!strcmp(str, boolnames[i])) + return cur_term->type.Booleans[i]; return ABSENT_BOOLEAN; } @@ -46,9 +59,10 @@ int i; T(("tigetnum(%s)", str)); - for (i = 0; i < NUMCOUNT; i++) - if (!strcmp(str, numnames[i])) - return cur_term->type.Numbers[i]; + if (cur_term != 0) + for (i = 0; i < NUMCOUNT; i++) + if (!strcmp(str, numnames[i])) + return cur_term->type.Numbers[i]; return CANCELLED_NUMERIC; } @@ -59,9 +73,10 @@ int i; T(("tigetstr(%s)", str)); - for (i = 0; i < STRCOUNT; i++) - if (!strcmp(str, strnames[i])) - return cur_term->type.Strings[i]; + if (cur_term != 0) + for (i = 0; i < STRCOUNT; i++) + if (!strcmp(str, strnames[i])) + return cur_term->type.Strings[i]; return CANCELLED_STRING; } diff --git a/ncurses/lib_touch.c b/ncurses/lib_touch.c index 82ef92c5..f39338d0 100644 --- a/ncurses/lib_touch.c +++ b/ncurses/lib_touch.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* ** lib_touch.c @@ -31,14 +43,14 @@ #include -MODULE_ID("$Id: lib_touch.c,v 1.3 1997/02/02 00:26:15 tom Exp $") +MODULE_ID("$Id: lib_touch.c,v 1.5 1998/02/11 12:13:54 tom Exp $") int is_linetouched(WINDOW *win, int line) { T((T_CALLED("is_linetouched(%p,%d)"), win, line)); /* XSI doesn't define any error */ - if (line > win->_maxy || line < 0) + if (!win || (line > win->_maxy) || (line < 0)) returnCode(ERR); returnCode(win->_line[line].firstchar != _NOCHANGE ? TRUE : FALSE); @@ -50,9 +62,10 @@ int i; T((T_CALLED("is_wintouched(%p)"), win)); - for (i = 0; i <= win->_maxy; i++) - if (win->_line[i].firstchar != _NOCHANGE) - returnCode(TRUE); + if (win) + for (i = 0; i <= win->_maxy; i++) + if (win->_line[i].firstchar != _NOCHANGE) + returnCode(TRUE); returnCode(FALSE); } @@ -62,7 +75,11 @@ int i; T((T_CALLED("wtouchln(%p,%d,%d,%d)"), win, y, n, changed)); + if (!win || (n<0) || (y<0) || (y>win->_maxy)) + returnCode(ERR); + for (i = y; i < y+n; i++) { + if (i>win->_maxy) break; win->_line[i].firstchar = changed ? 0 : _NOCHANGE; win->_line[i].lastchar = changed ? win->_maxx : _NOCHANGE; } diff --git a/ncurses/lib_tparm.c b/ncurses/lib_tparm.c index 26b5691a..02125b67 100644 --- a/ncurses/lib_tparm.c +++ b/ncurses/lib_tparm.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -29,7 +41,7 @@ #include -MODULE_ID("$Id: lib_tparm.c,v 1.18 1997/04/26 18:37:50 tom Exp $") +MODULE_ID("$Id: lib_tparm.c,v 1.22 1998/02/11 12:13:54 tom Exp $") /* * char * @@ -150,6 +162,8 @@ static void save_number(const char *fmt, int number) static inline void save_char(int c) { static char text[2]; + if (c == 0) + c = 0200; text[0] = c; save_text(text); } @@ -174,14 +188,16 @@ static inline char *spop(void) static inline char *tparam_internal(const char *string, va_list ap) { +#define NUM_VARS 26 int param[9]; int popcount; -int variable[26]; +int variable[NUM_VARS]; char len; int number; int level; int x, y; int i; +int varused = -1; register const char *cp; out_used = 0; @@ -329,14 +345,22 @@ register const char *cp; case 'P': string++; - if (*string >= 'a' && *string <= 'z') - variable[*string - 'a'] = npop(); + i = (*string - 'a'); + if (i >= 0 && i < NUM_VARS) { + while (varused < i) + variable[++varused] = 0; + variable[i] = npop(); + } break; case 'g': string++; - if (*string >= 'a' && *string <= 'z') - npush(variable[*string - 'a']); + i = (*string - 'a'); + if (i >= 0 && i < NUM_VARS) { + while (varused < i) + variable[++varused] = 0; + npush(variable[i]); + } break; case '\'': @@ -496,6 +520,11 @@ register const char *cp; string++; } /* endwhile (*string) */ + if (out_buff == 0) + out_buff = calloc(1,1); + if (out_used == 0) + *out_buff = '\0'; + T((T_RETURN("%s"), _nc_visbuf(out_buff))); return(out_buff); } @@ -530,4 +559,4 @@ char *result = 0; va_end(ap); return result; } -#endif /* __UNUSED */ +#endif /* __UNUSED__ */ diff --git a/ncurses/lib_tputs.c b/ncurses/lib_tputs.c index 65fa4d79..e5b4a6bc 100644 --- a/ncurses/lib_tputs.c +++ b/ncurses/lib_tputs.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -33,14 +45,22 @@ #include /* padding_baud_rate, xon_xoff */ #include -MODULE_ID("$Id: lib_tputs.c,v 1.18 1997/02/02 01:52:39 tom Exp $") +MODULE_ID("$Id: lib_tputs.c,v 1.30 1998/02/11 12:14:00 tom Exp $") + +#define OUTPUT ((SP != 0) ? SP->_ofp : stdout) + +int _nc_nulls_sent; /* used by 'tack' program */ + +static int (*my_outch)(int c) = _nc_outch; int delay_output(int ms) { T((T_CALLED("delay_output(%d)"), ms)); - if (SP == 0 || SP->_baudrate <= 0) - returnCode(ERR); + if (cur_term == 0 || cur_term->_baudrate <= 0) { + (void) fflush(OUTPUT); + _nc_timed_wait(0, ms, (int *)0); + } #ifdef no_pad_char else if (no_pad_char) napms(ms); @@ -54,9 +74,11 @@ int delay_output(int ms) null = pad_char[0]; #endif /* pad_char */ - for (nullcount = ms * 1000 / SP->_baudrate; nullcount > 0; nullcount--) - putc(null, SP->_ofp); - (void) fflush(SP->_ofp); + nullcount = ms * cur_term->_baudrate / 10000; + for (_nc_nulls_sent += nullcount; nullcount > 0; nullcount--) + my_outch(null); + if (my_outch == _nc_outch) + (void) fflush(OUTPUT); } returnCode(OK); @@ -68,10 +90,7 @@ int _nc_outch(int ch) _nc_outchars++; #endif /* TRACE */ - if (SP != NULL) - putc(ch, SP->_ofp); - else - putc(ch, stdout); + putc(ch, OUTPUT); return OK; } @@ -82,9 +101,11 @@ int putp(const char *string) int tputs(const char *string, int affcnt, int (*outc)(int)) { -float number; +bool always_delay; +bool normal_delay; +int number; #ifdef BSD_TPUTS -float trailpad; +int trailpad; #endif /* BSD_TPUTS */ #ifdef TRACE @@ -103,27 +124,39 @@ char addrbuf[17]; _nc_tputs_trace = (char *)NULL; } #endif /* TRACE */ - + if (string == ABSENT_STRING || string == CANCELLED_STRING) return ERR; + if (cur_term == 0) { + always_delay = FALSE; + normal_delay = TRUE; + } else { + always_delay = (string == bell) || (string == flash_screen); + normal_delay = + !xon_xoff +#ifdef padding_baud_rate + && padding_baud_rate + && (!cur_term || cur_term->_baudrate >= padding_baud_rate) +#endif + ; + } + #ifdef BSD_TPUTS /* * This ugly kluge deals with the fact that some ancient BSD programs * (like nethack) actually do the likes of tputs("50") to get delays. */ trailpad = 0; - number = 0; - while (isdigit(*string)) { - trailpad = trailpad * 10 + *string - '0'; + trailpad = trailpad * 10 + (*string - '0'); string++; } - + trailpad *= 10; if (*string == '.') { string++; if (isdigit(*string)) { - trailpad += (float) (*string - '0') / 10.; + trailpad += (*string - '0'); string++; } while (isdigit(*string)) @@ -136,6 +169,7 @@ char addrbuf[17]; } #endif /* BSD_TPUTS */ + my_outch = outc; /* redirect delay_output() */ while (*string) { if (*string != '$') (*outc)(*string); @@ -148,30 +182,30 @@ char addrbuf[17]; } else { bool mandatory; - number = 0; string++; - if ((!isdigit(*string) && *string != '.') || !strchr(string, '>')) { (*outc)('$'); (*outc)('<'); continue; } + + number = 0; while (isdigit(*string)) { - number = number * 10 + *string - '0'; + number = number * 10 + (*string - '0'); string++; } - + number *= 10; if (*string == '.') { string++; if (isdigit(*string)) { - number += (float) (*string - '0') / 10.; + number += (*string - '0'); string++; } while (isdigit(*string)) string++; } - mandatory = !xon_xoff; + mandatory = FALSE; while (*string == '*' || *string == '/') { if (*string == '*') { @@ -184,11 +218,11 @@ char addrbuf[17]; } } -#ifdef padding_baud_rate - if (mandatory && number > 0 && padding_baud_rate && (!SP || SP->_baudrate >= padding_baud_rate)) - delay_output(number); -#endif /* padding_baud_rate */ - number = 0; + if (number > 0 + && (always_delay + || normal_delay + || mandatory)) + delay_output(number/10); } /* endelse (*string == '<') */ } /* endelse (*string == '$') */ @@ -203,11 +237,11 @@ char addrbuf[17]; /* * Emit any BSD-style prefix padding that we've accumulated now. */ -#ifdef padding_baud_rate - if (trailpad > 0 && !xon_xoff && padding_baud_rate && (!SP || SP->_baudrate >= padding_baud_rate)) - delay_output(number); -#endif /* padding_baud_rate */ + if (trailpad > 0 + && (always_delay || normal_delay)) + delay_output(trailpad/10); #endif /* BSD_TPUTS */ + my_outch = _nc_outch; return OK; } diff --git a/ncurses/lib_trace.c b/ncurses/lib_trace.c index e1caeff3..a9accd56 100644 --- a/ncurses/lib_trace.c +++ b/ncurses/lib_trace.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* * lib_trace.c - Tracing/Debugging routines @@ -29,7 +41,7 @@ #include -MODULE_ID("$Id: lib_trace.c,v 1.23 1997/05/02 00:13:07 tom Exp $") +MODULE_ID("$Id: lib_trace.c,v 1.25 1998/02/11 12:13:55 tom Exp $") #include #if HAVE_FCNTL_H @@ -121,6 +133,7 @@ va_list ap; bool before = FALSE; bool after = FALSE; int doit = _nc_tracing; +int save_err = errno; if (strlen(fmt) >= sizeof(Called) - 1) { if (!strncmp(fmt, Called, sizeof(Called)-1)) { @@ -155,6 +168,7 @@ int doit = _nc_tracing; if (after && level) level--; + errno = save_err; } /* Trace 'int' return-values */ diff --git a/ncurses/lib_traceatr.c b/ncurses/lib_traceatr.c index 13d96a43..c6023b2b 100644 --- a/ncurses/lib_traceatr.c +++ b/ncurses/lib_traceatr.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ @@ -32,42 +44,10 @@ #include #include /* acs_chars */ -MODULE_ID("$Id: lib_traceatr.c,v 1.20 1997/05/06 11:07:27 tom Exp $") +MODULE_ID("$Id: lib_traceatr.c,v 1.25 1998/02/11 12:14:00 tom Exp $") #define COLOR_OF(c) (c < 0 || c > 7 ? "default" : colors[c].name) -char * _nc_trace_buf(int bufnum, size_t want) -{ - static struct { - char *text; - size_t size; - } *list; - static size_t have; - - if (bufnum < 0) - bufnum = 0; - - if ((size_t)(bufnum+1) > have) { - size_t need = (bufnum + 1) * 2; - size_t used = sizeof(*list) * need; - list = (list == 0) ? malloc(used) : realloc(list, used); - while (need > have) - list[have++].text = 0; - } - - if (list[bufnum].text == 0) - { - list[bufnum].text = malloc(want); - list[bufnum].size = want; - } - else if (want > list[bufnum].size) { - list[bufnum].text = realloc(list[bufnum].text, want); - list[bufnum].size = want; - } - *(list[bufnum].text) = '\0'; - return list[bufnum].text; -} - char *_traceattr2(int bufnum, attr_t newmode) { char *buf = _nc_trace_buf(bufnum, BUFSIZ); @@ -105,7 +85,7 @@ unsigned save_nc_tracing = _nc_tracing; strcpy(tmp++, "{"); - for (n = 0; n < sizeof(names)/sizeof(names[0]); n++) { + for (n = 0; n < SIZEOF(names); n++) { if ((newmode & names[n].val) != 0) { if (buf[1] != '\0') strcat(tmp, "|"); @@ -144,6 +124,13 @@ char *_traceattr(attr_t newmode) return _traceattr2(0, newmode); } +/* Trace 'int' return-values */ +attr_t _nc_retrace_attr_t(attr_t code) +{ + T((T_RETURN("%s"), _traceattr(code))); + return code; +} + char *_tracechtype2(int bufnum, chtype ch) { char *buf = _nc_trace_buf(bufnum, BUFSIZ); @@ -179,7 +166,7 @@ char *found = 0; {'.', "ACS_DARROW"}, /* arrow pointing down */ {'-', "ACS_UARROW"}, /* arrow pointing up */ {'h', "ACS_BOARD"}, /* board of squares */ - {'I', "ACS_LANTERN"}, /* lantern symbol */ + {'i', "ACS_LANTERN"}, /* lantern symbol */ {'0', "ACS_BLOCK"}, /* solid square block */ {'p', "ACS_S3"}, /* scan line 3 */ {'r', "ACS_S7"}, /* scan line 7 */ diff --git a/ncurses/lib_tracechr.c b/ncurses/lib_tracechr.c index 2a4eed71..3e726547 100644 --- a/ncurses/lib_tracechr.c +++ b/ncurses/lib_tracechr.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ diff --git a/ncurses/lib_tracedmp.c b/ncurses/lib_tracedmp.c index e2c3434a..be1cd7cd 100644 --- a/ncurses/lib_tracedmp.c +++ b/ncurses/lib_tracedmp.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* * lib_tracedmp.c - Tracing/Debugging routines @@ -29,7 +41,7 @@ #include -MODULE_ID("$Id: lib_tracedmp.c,v 1.9 1997/01/15 00:39:27 tom Exp $") +MODULE_ID("$Id: lib_tracedmp.c,v 1.11 1998/02/11 12:14:00 tom Exp $") void _tracedump(const char *name, WINDOW *win) { @@ -67,7 +79,7 @@ void _tracedump(const char *name, WINDOW *win) } ep[j] = '\''; ep[j+1] = '\0'; - _tracef(buf); + _tracef("%s", buf); /* dump A_COLOR part, will screw up if there are more than 96 */ havecolors = FALSE; @@ -85,7 +97,7 @@ void _tracedump(const char *name, WINDOW *win) ep[j] = ((win->_line[n].text[j] >> 8) & 0xff) + ' '; ep[j] = '\''; ep[j+1] = '\0'; - _tracef(buf); + _tracef("%s", buf); } for (i = 0; i < 4; i++) @@ -108,7 +120,7 @@ void _tracedump(const char *name, WINDOW *win) ep[j] = hex[(win->_line[n].text[j] & mask) >> ((i + 4) * 4)]; ep[j] = '\''; ep[j+1] = '\0'; - _tracef(buf); + _tracef("%s", buf); } } } diff --git a/ncurses/lib_tracemse.c b/ncurses/lib_tracemse.c index b88ecd97..9a64dfbb 100644 --- a/ncurses/lib_tracemse.c +++ b/ncurses/lib_tracemse.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ @@ -31,7 +43,7 @@ #include -MODULE_ID("$Id: lib_tracemse.c,v 1.4 1996/12/21 14:24:06 tom Exp $") +MODULE_ID("$Id: lib_tracemse.c,v 1.5 1998/02/11 12:13:53 tom Exp $") char *_tracemouse(MEVENT const *ep) { diff --git a/ncurses/lib_tstp.c b/ncurses/lib_tstp.c index ee7c2afb..0fb8b848 100644 --- a/ncurses/lib_tstp.c +++ b/ncurses/lib_tstp.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -30,22 +42,13 @@ #include #include - -#if HAVE_SIGACTION -#if !HAVE_TYPE_SIGACTION -typedef struct sigaction sigaction_t; -#endif -#else /* !HAVE_SIGACTION */ -#if HAVE_SIGVEC #include -#endif -#endif -#ifdef SVR4_ACTION +#if defined(SVR4_ACTION) && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE #endif -MODULE_ID("$Id: lib_tstp.c,v 1.8 1996/11/17 00:11:41 tom Exp $") +MODULE_ID("$Id: lib_tstp.c,v 1.15 1998/02/11 12:13:57 tom Exp $") /* * Note: This code is fragile! Its problem is that different OSs @@ -110,7 +113,7 @@ static void tstp(int dummy GCC_UNUSED) */ (void)sigemptyset(&mask); (void)sigaddset(&mask, SIGALRM); -#ifdef SIGWINCH +#if USE_SIGWINCH (void)sigaddset(&mask, SIGWINCH); #endif (void)sigprocmask(SIG_BLOCK, &mask, &omask); @@ -173,18 +176,36 @@ static void cleanup(int sig) sigemptyset(&act.sa_mask); act.sa_flags = 0; act.sa_handler = SIG_IGN; - if (sigaction(sig, &act, (sigaction_t *)0) == 0) { - endwin(); - } + if (sigaction(sig, &act, (sigaction_t *)0) == 0) #else - if (signal(sig, SIG_IGN) != SIG_ERR) { + if (signal(sig, SIG_IGN) != SIG_ERR) +#endif + { + SCREEN *scan = _nc_screen_chain; + while(scan) + { + set_term(scan); endwin(); + SP->_endwin = FALSE; /* in case we have an atexit! */ + scan = scan->_next_screen; + } } -#endif } exit(EXIT_FAILURE); } +#if USE_SIGWINCH +static void sigwinch(int sig GCC_UNUSED) +{ + SCREEN *scan = _nc_screen_chain; + while(scan) + { + scan->_sig_winch = TRUE; + scan = scan->_next_screen; + } +} +#endif /* USE_SIGWINCH */ + /* * If the given signal is still in its default state, set it to the given * handler. @@ -194,11 +215,12 @@ static int CatchIfDefault(int sig, sigaction_t *act) { sigaction_t old_act; -#ifdef SA_RESTART - act->sa_flags |= SA_RESTART; -#endif /* SA_RESTART */ if (sigaction(sig, (sigaction_t *)0, &old_act) == 0 - && old_act.sa_handler == SIG_DFL) { + && (old_act.sa_handler == SIG_DFL +#if USE_SIGWINCH + || (sig == SIGWINCH && old_act.sa_handler == SIG_IGN) +#endif + )) { (void)sigaction(sig, act, (sigaction_t *)0); return TRUE; } @@ -210,7 +232,11 @@ static int CatchIfDefault(int sig, RETSIGTYPE (*handler)()) void (*ohandler)(); ohandler = signal(sig, SIG_IGN); - if (ohandler == SIG_DFL) { + if (ohandler == SIG_DFL +#if USE_SIGWINCH + || (sig == SIGWINCH && ohandler == SIG_IGN) +#endif + ) { signal(sig, handler); return TRUE; } else { @@ -252,10 +278,14 @@ static int ignore; { sigemptyset(&act.sa_mask); act.sa_flags = 0; +#if USE_SIGWINCH + act.sa_handler = sigwinch; + CatchIfDefault(SIGWINCH, &act); +#endif + #ifdef SA_RESTART act.sa_flags |= SA_RESTART; #endif /* SA_RESTART */ - act.sa_handler = cleanup; CatchIfDefault(SIGINT, &act); CatchIfDefault(SIGTERM, &act); @@ -265,18 +295,31 @@ static int ignore; ignore = TRUE; } } -#else +#else /* !SIGTSTP */ if (enable) { #if HAVE_SIGACTION || HAVE_SIGVEC static sigaction_t act; + sigemptyset(&act.sa_mask); +#if USE_SIGWINCH + act.sa_handler = sigwinch; + CatchIfDefault(SIGWINCH, &act); +#endif +#ifdef SA_RESTART + act.sa_flags |= SA_RESTART; +#endif /* SA_RESTART */ act.sa_handler = cleanup; CatchIfDefault(SIGINT, &act); CatchIfDefault(SIGTERM, &act); -#else + +#else /* !(HAVE_SIGACTION || HAVE_SIGVEC) */ + CatchIfDefault(SIGINT, cleanup); CatchIfDefault(SIGTERM, cleanup); +#if USE_SIGWINCH + CatchIfDefault(SIGWINCH, sigwinch); #endif +#endif /* !(HAVE_SIGACTION || HAVE_SIGVEC) */ } -#endif +#endif /* !SIGTSTP */ } diff --git a/ncurses/lib_twait.c b/ncurses/lib_twait.c index 15ab948a..93f24d72 100644 --- a/ncurses/lib_twait.c +++ b/ncurses/lib_twait.c @@ -1,50 +1,69 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* ** lib_twait.c ** ** The routine _nc_timed_wait(). ** +** (This file was originally written by Eric Raymond; however except for +** comments, none of the original code remains - T.Dickey). */ #include #if USE_FUNC_POLL -#include -#include -#if HAVE_SYS_TIME_H -#include -#endif +# include +# include +# if HAVE_SYS_TIME_H +# include +# endif #elif HAVE_SELECT -/* on SCO, conflicts with */ -#if HAVE_SYS_TIME_H && ! SYSTEM_LOOKS_LIKE_SCO -#include -#endif -#if HAVE_SYS_SELECT_H -#include +# if HAVE_SYS_TIME_H && HAVE_SYS_TIME_SELECT +# include +# endif +# if HAVE_SYS_SELECT_H +# include +# endif #endif + +#ifdef __BEOS__ +/* BeOS select() only works on sockets. Use the tty hack instead */ +#include +#define select check_select #endif -MODULE_ID("$Id: lib_twait.c,v 1.18 1997/02/15 18:27:51 tom Exp $") +MODULE_ID("$Id: lib_twait.c,v 1.30 1998/02/11 12:14:01 tom Exp $") /* * We want to define GOOD_SELECT if the last argument of select(2) is @@ -65,46 +84,20 @@ MODULE_ID("$Id: lib_twait.c,v 1.18 1997/02/15 18:27:51 tom Exp $") static void _nc_gettime(struct timeval *tp) { gettimeofday(tp, (struct timezone *)0); - T(("time: %ld.%06ld", tp->tv_sec, tp->tv_usec)); + T(("time: %ld.%06ld", (long) tp->tv_sec, (long) tp->tv_usec)); } #endif #endif -#if !HAVE_USLEEP -int _nc_usleep(unsigned int usec) -{ -int code; -struct timeval tval; - -#if defined(TRACE) && HAVE_GETTIMEOFDAY - _nc_gettime(&tval); -#endif -#if USE_FUNC_POLL - { - struct pollfd fds[1]; - code = poll(fds, 0, usec / 1000); - } -#elif HAVE_SELECT - tval.tv_sec = usec / 1000000; - tval.tv_usec = usec % 1000000; - code = select(0, NULL, NULL, NULL, &tval); -#endif - -#if defined(TRACE) && HAVE_GETTIMEOFDAY - _nc_gettime(&tval); -#endif - return code; -} -#endif /* !HAVE_USLEEP */ - /* - * Wait a specified number of milliseconds, returning true if the timer + * Wait a specified number of milliseconds, returning nonzero if the timer * didn't expire before there is activity on the specified file descriptors. * The file-descriptors are specified by the mode: * 0 - none (absolute time) * 1 - ncurses' normal input-descriptor * 2 - mouse descriptor, if any * 3 - either input or mouse. + * We return a mask that corresponds to the mode (e.g., 2 for mouse activity). * * If the milliseconds given are -1, the wait blocks until activity on the * descriptors. @@ -140,13 +133,18 @@ long delta; ntimeout.tv_usec = 0; } - T(("start twait: %lu.%06lu secs", (long) ntimeout.tv_sec, (long) ntimeout.tv_usec)); + T(("start twait: %lu.%06lu secs, mode: %d", (long) ntimeout.tv_sec, (long) ntimeout.tv_usec, mode)); +#ifdef HIDE_EINTR /* * The do loop tries to make it look like we have restarting signals, * even if we don't. */ do { +#endif /* HIDE_EINTR */ +#if !GOOD_SELECT && HAVE_GETTIMEOFDAY + retry: +#endif count = 0; #if USE_FUNC_POLL @@ -156,12 +154,11 @@ long delta; count++; } if ((mode & 2) - && (fd = _nc_mouse_fd()) >= 0) { + && (fd = SP->_mouse_fd) >= 0) { fds[count].fd = fd; fds[count].events = POLLIN; count++; } - result = poll(fds, count, milliseconds); #elif HAVE_SELECT /* @@ -175,7 +172,7 @@ long delta; count = SP->_ifd + 1; } if ((mode & 2) - && (fd = _nc_mouse_fd()) >= 0) { + && (fd = SP->_mouse_fd) >= 0) { FD_SET(fd, &set); count = max(fd, count) + 1; } @@ -219,17 +216,20 @@ long delta; if (result == 0 && (ntimeout.tv_sec != 0 || ntimeout.tv_usec > 100000)) { napms(100); - continue; + goto retry; } #endif +#ifdef HIDE_EINTR } while (result == -1 && errno == EINTR); +#endif /* return approximate time left on the ntimeout, in milliseconds */ if (timeleft) *timeleft = (ntimeout.tv_sec * 1000) + (ntimeout.tv_usec / 1000); - T(("end twait: returned %d, remaining time %lu.%06lu secs (%d msec)", - result, (long) ntimeout.tv_sec, (long) ntimeout.tv_usec, + T(("end twait: returned %d (%d), remaining time %lu.%06lu secs (%d msec)", + result, errno, + (long) ntimeout.tv_sec, (long) (ntimeout.tv_usec / 1000), timeleft ? *timeleft : -1)); /* @@ -251,7 +251,7 @@ long delta; } #elif HAVE_SELECT if ((mode & 2) - && (fd = _nc_mouse_fd()) >= 0 + && (fd = SP->_mouse_fd) >= 0 && FD_ISSET(fd, &set)) result |= 2; if ((mode & 1) diff --git a/ncurses/lib_ungetch.c b/ncurses/lib_ungetch.c new file mode 100644 index 00000000..5fdfb47d --- /dev/null +++ b/ncurses/lib_ungetch.c @@ -0,0 +1,74 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_ungetch.c +** +** The routine ungetch(). +** +*/ + +#include + +MODULE_ID("$Id: lib_ungetch.c,v 1.2 1998/02/11 12:13:56 tom Exp $") + +#include + +#ifdef TRACE +void _nc_fifo_dump(void) +{ +int i; + T(("head = %d, tail = %d, peek = %d", head, tail, peek)); + for (i = 0; i < 10; i++) + T(("char %d = %s", i, _trace_key(SP->_fifo[i]))); +} +#endif /* TRACE */ + +int ungetch(int ch) +{ + if (tail == -1) + return ERR; + if (head == -1) { + head = 0; + t_inc() + peek = tail; /* no raw keys */ + } else + h_dec(); + + SP->_fifo[head] = ch; + T(("ungetch %#x ok", ch)); +#ifdef TRACE + if (_nc_tracing & TRACE_IEVENT) _nc_fifo_dump(); +#endif + return OK; +} diff --git a/ncurses/lib_vidattr.c b/ncurses/lib_vidattr.c index afdf57f7..cbd4634a 100644 --- a/ncurses/lib_vidattr.c +++ b/ncurses/lib_vidattr.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* * vidputs(newmode, outc) @@ -52,7 +64,7 @@ #include #include -MODULE_ID("$Id: lib_vidattr.c,v 1.14 1997/05/06 16:02:43 tom Exp $") +MODULE_ID("$Id: lib_vidattr.c,v 1.20 1998/02/11 12:13:56 tom Exp $") #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc) @@ -67,6 +79,8 @@ int vidputs(attr_t newmode, int (*outc)(int)) static attr_t previous_attr = A_NORMAL; attr_t turn_on, turn_off; int pair, current_pair; +bool reverse = FALSE; +bool used_ncv = FALSE; T((T_CALLED("vidputs(%s)"), _traceattr(newmode))); @@ -76,20 +90,65 @@ int pair, current_pair; T(("previous attribute was %s", _traceattr(previous_attr))); +#if !USE_XMC_SUPPORT + if (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 ((newmode & A_COLOR) + && (no_color_video > 0)) { + static const struct { + attr_t video; + unsigned bit; + } table[] = { + { A_STANDOUT, 1 }, + { A_UNDERLINE, 2 }, + { A_REVERSE, 4 }, + { A_BLINK, 8 }, + { A_DIM, 16 }, + { A_BOLD, 32 }, + { A_INVIS, 64 }, + { A_PROTECT, 128 }, + { A_ALTCHARSET, 256 }, + }; + size_t n; + for (n = 0; n < SIZEOF(table); n++) { + if ((table[n].bit & no_color_video) + && (table[n].video & newmode)) { + used_ncv = TRUE; + if (table[n].video == A_REVERSE) + reverse = TRUE; + else + newmode &= ~table[n].video; + } + } + } + if (newmode == previous_attr) returnCode(OK); - turn_off = (~newmode & previous_attr) & ALL_BUT_COLOR; - turn_on = (newmode & ~previous_attr) & ALL_BUT_COLOR; - pair = PAIR_NUMBER(newmode); current_pair = PAIR_NUMBER(previous_attr); + if (reverse) { + newmode &= ~A_REVERSE; + pair = -pair; + } + if (previous_attr & A_REVERSE) + current_pair = -current_pair; + + turn_off = (~newmode & previous_attr) & ALL_BUT_COLOR; + turn_on = (newmode & ~previous_attr) & ALL_BUT_COLOR; + /* if there is no current screen, assume we *can* do color */ if ((!SP || SP->_coloron) && pair == 0) { T(("old pair = %d -- new pair = %d", current_pair, pair)); if (pair != current_pair) { - _nc_do_color(pair, outc); + _nc_do_color(pair, reverse, outc); previous_attr &= ~A_COLOR; } } @@ -104,7 +163,7 @@ int pair, current_pair; previous_attr &= ~A_COLOR; } - } else if (set_attributes) { + } else if (set_attributes && !used_ncv) { if (turn_on || turn_off) { TPUTS_TRACE("set_attributes"); tputs(tparm(set_attributes, @@ -157,10 +216,13 @@ int pair, current_pair; current_pair = PAIR_NUMBER(previous_attr); T(("old pair = %d -- new pair = %d", current_pair, pair)); if (pair != current_pair) { - _nc_do_color(pair, outc); + _nc_do_color(pair, reverse, outc); } } + if (reverse) + newmode |= A_REVERSE; + if (SP) SP->_current_attr = newmode; else @@ -176,9 +238,9 @@ int vidattr(attr_t newmode) returnCode(vidputs(newmode, _nc_outch)); } -attr_t termattrs(void) +chtype termattrs(void) { - int attrs = A_NORMAL; + chtype attrs = A_NORMAL; if (enter_alt_charset_mode) attrs |= A_ALTCHARSET; diff --git a/ncurses/lib_vline.c b/ncurses/lib_vline.c new file mode 100644 index 00000000..93936c09 --- /dev/null +++ b/ncurses/lib_vline.c @@ -0,0 +1,81 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + + + +/* +** lib_vline.c +** +** The routine wvline(). +** +*/ + +#include + +MODULE_ID("$Id: lib_vline.c,v 1.2 1998/02/11 12:13:55 tom Exp $") + +int wvline(WINDOW *win, chtype ch, int n) +{ +int code = ERR; +short row, col; +short end; + + T((T_CALLED("wvline(%p,%s,%d)"), win, _tracechtype(ch), n)); + + if (win) { + row = win->_cury; + col = win->_curx; + end = row + n - 1; + if (end > win->_maxy) + end = win->_maxy; + + if (ch == 0) + ch = ACS_VLINE; + ch = _nc_render(win, ch); + + while(end >= row) { + win->_line[end].text[col] = ch; + if (win->_line[end].firstchar == _NOCHANGE + || win->_line[end].firstchar > col) + win->_line[end].firstchar = col; + if (win->_line[end].lastchar == _NOCHANGE + || win->_line[end].lastchar < col) + win->_line[end].lastchar = col; + end--; + } + + _nc_synchook(win); + code = OK; + } + returnCode(code); +} diff --git a/ncurses/lib_wattroff.c b/ncurses/lib_wattroff.c new file mode 100644 index 00000000..6f14be63 --- /dev/null +++ b/ncurses/lib_wattroff.c @@ -0,0 +1,55 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_wattroff.c +** +** The routine wattr_off(). +** +*/ + +#include +#include + +MODULE_ID("$Id: lib_wattroff.c,v 1.2 1998/02/11 12:13:56 tom Exp $") + +int wattr_off(WINDOW *win, const attr_t at) +{ + T((T_CALLED("wattr_off(%p,%s)"), win, _traceattr(at))); + if (win) { + T(("... current %s", _traceattr(win->_attrs))); + toggle_attr_off(win->_attrs,at); + returnCode(OK); + } else + returnCode(ERR); +} diff --git a/ncurses/lib_wattron.c b/ncurses/lib_wattron.c new file mode 100644 index 00000000..fed0fe4d --- /dev/null +++ b/ncurses/lib_wattron.c @@ -0,0 +1,55 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_wattron.c +** +** The routines wattr_on(). +** +*/ + +#include +#include + +MODULE_ID("$Id: lib_wattron.c,v 1.2 1998/02/11 12:13:56 tom Exp $") + +int wattr_on(WINDOW *win, const attr_t at) +{ + T((T_CALLED("wattr_on(%p,%s)"), win, _traceattr(at))); + if (win) { + T(("... current %s", _traceattr(win->_attrs))); + toggle_attr_on(win->_attrs,at); + returnCode(OK); + } else + returnCode(ERR); +} diff --git a/ncurses/lib_window.c b/ncurses/lib_window.c index 6dab3b80..741ff3f9 100644 --- a/ncurses/lib_window.c +++ b/ncurses/lib_window.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* ** lib_window.c @@ -27,7 +39,7 @@ #include -MODULE_ID("$Id: lib_window.c,v 1.8 1997/02/02 01:14:43 tom Exp $") +MODULE_ID("$Id: lib_window.c,v 1.11 1998/02/11 12:13:53 tom Exp $") void _nc_synchook(WINDOW *win) /* hook to be called after each window change */ @@ -39,12 +51,12 @@ void _nc_synchook(WINDOW *win) int mvderwin(WINDOW *win, int y, int x) /* move a derived window */ { - WINDOW *orig = win->_parent; + WINDOW *orig; int i; T((T_CALLED("mvderwin(%p,%d,%d)"), win, y, x)); - if (orig) + if (win && (orig = win->_parent)) { if (win->_parx==x && win->_pary==y) returnCode(OK); @@ -182,9 +194,10 @@ int i; T((T_CALLED("dupwin(%p)"), win)); - if ((nwin = newwin(win->_maxy + 1, win->_maxx + 1, win->_begy, win->_begx)) == NULL) - returnWin(0); - + if ((win==NULL) || + ((nwin = newwin(win->_maxy + 1, win->_maxx + 1, win->_begy, win->_begx)) == NULL)) + returnWin(0); + nwin->_curx = win->_curx; nwin->_cury = win->_cury; nwin->_maxy = win->_maxy; @@ -193,7 +206,11 @@ int i; nwin->_begx = win->_begx; nwin->_yoffset = win->_yoffset; - nwin->_flags = win->_flags; + nwin->_flags = win->_flags & ~_SUBWIN; + /* Due to the use of newwin(), the clone is not a subwindow. + * The text is really copied into the clone. + */ + nwin->_attrs = win->_attrs; nwin->_bkgd = win->_bkgd; @@ -204,9 +221,11 @@ int i; nwin->_delay = win->_delay; nwin->_immed = win->_immed; nwin->_sync = win->_sync; - nwin->_parx = win->_parx; - nwin->_pary = win->_pary; - nwin->_parent = win->_parent; + + nwin->_parx = 0; + nwin->_pary = 0; + nwin->_parent = (WINDOW*)0; + /* See above: the clone isn't a subwindow! */ nwin->_regtop = win->_regtop; nwin->_regbottom = win->_regbottom; diff --git a/ncurses/llib-lncurses b/ncurses/llib-lncurses index 0ca29b5e..9a58ee0e 100644 --- a/ncurses/llib-lncurses +++ b/ncurses/llib-lncurses @@ -1,50 +1,64 @@ -/****************************************************************************** - * Copyright 1996,1997 by Thomas E. Dickey * - * All Rights Reserved. * - * * - * Permission to use, copy, modify, and distribute this software and its * - * documentation for any purpose and without fee is hereby granted, provided * - * that the above copyright notice appear in all copies and that both that * - * copyright notice and this permission notice appear in supporting * - * documentation, and that the name of the above listed copyright holder(s) * - * not be used in advertising or publicity pertaining to distribution of the * - * software without specific, written prior permission. THE ABOVE LISTED * - * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * - * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - ******************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1996,1997,1998 * + ****************************************************************************/ /* LINTLIBRARY */ -/* ./fallback.c */ +/* ./hardscroll.c */ #include -#include -#undef _nc_fallback -const TERMTYPE *_nc_fallback( - const char *name) - { return(*(const TERMTYPE **)0); } +#undef _nc_scroll_optimize +void _nc_scroll_optimize(void) + { /* void */ } /* ./hashmap.c */ +typedef struct +{ + unsigned long hashval; + int oldcount, newcount; + int oldindex, newindex; +} + sym; + #undef _nc_hash_map void _nc_hash_map(void) { /* void */ } -/* ./hardscroll.c */ - -#undef _nc_scroll_optimize -void _nc_scroll_optimize(void) - { /* void */ } - /* ./lib_acs.c */ +#include + #undef acs_map -chtype acs_map[128]; +chtype acs_map[128 ]; #undef init_acs void init_acs(void) @@ -54,18 +68,6 @@ void init_acs(void) #include -#undef wattr_on -int wattr_on( - WINDOW *win, - const attr_t at) - { return(*(int *)0); } - -#undef wattr_off -int wattr_off( - WINDOW *win, - const attr_t at) - { return(*(int *)0); } - #undef wchgat int wchgat( WINDOW *win, @@ -120,35 +122,37 @@ int waddchnstr( int n) { return(*(int *)0); } +/* ./lib_baudrate.c */ + +struct speed { + speed_t s; + int sp; +}; + +#undef baudrate +int baudrate(void) + { return(*(int *)0); } + /* ./lib_beep.c */ #undef beep int beep(void) { return(*(int *)0); } -#undef flash -int flash(void) - { return(*(int *)0); } - /* ./lib_bkgd.c */ +#undef wbkgdset +void wbkgdset( + WINDOW *win, + chtype ch) + { /* void */ } + #undef wbkgd int wbkgd( WINDOW *win, const chtype ch) { return(*(int *)0); } -/* ./lib_baudrate.c */ - -struct speed { - speed_t s; - int sp; -}; - -#undef baudrate -int baudrate(void) - { return(*(int *)0); } - /* ./lib_box.c */ #undef wborder @@ -164,20 +168,6 @@ int wborder( chtype br) { return(*(int *)0); } -#undef whline -int whline( - WINDOW *win, - chtype ch, - int n) - { return(*(int *)0); } - -#undef wvline -int wvline( - WINDOW *win, - chtype ch, - int n) - { return(*(int *)0); } - /* ./lib_clear.c */ #undef wclear @@ -263,12 +253,8 @@ WINDOW *stdscr; WINDOW *curscr; #undef newscr WINDOW *newscr; -#undef _nc_windows -struct _win_list *_nc_windows; -#undef _nc_idcok -bool _nc_idcok; -#undef _nc_idlok -bool _nc_idlok; +#undef _nc_screen_chain +SCREEN *_nc_screen_chain; #undef SP SCREEN *SP; @@ -299,6 +285,31 @@ void _nc_outstr( const char *str) { /* void */ } +#undef _nc_scrolln +int _nc_scrolln( + int n, + int top, + int bot, + int maxy) + { return(*(int *)0); } + +#undef _nc_screen_resume +void _nc_screen_resume(void) + { /* void */ } + +#undef _nc_screen_init +void _nc_screen_init(void) + { /* void */ } + +#undef _nc_screen_wrap +void _nc_screen_wrap(void) + { /* void */ } + +#undef _nc_do_xmc_glitch +void _nc_do_xmc_glitch( + attr_t previous) + { /* void */ } + /* ./lib_endwin.c */ #undef endwin @@ -312,9 +323,13 @@ int werase( WINDOW *win) { return(*(int *)0); } -/* ./lib_gen.c */ +/* ./lib_flash.c */ -#include +#undef flash +int flash(void) + { return(*(int *)0); } + +/* ./lib_gen.c */ #undef addch int addch( @@ -345,17 +360,17 @@ int addstr( #undef attroff int attroff( - int z) + NCURSES_ATTR_T z) { return(*(int *)0); } #undef attron int attron( - int z) + NCURSES_ATTR_T z) { return(*(int *)0); } #undef attrset int attrset( - int z) + NCURSES_ATTR_T z) { return(*(int *)0); } #undef attr_get @@ -364,17 +379,17 @@ int attr_get(void) #undef attr_off int attr_off( - int z) + NCURSES_ATTR_T z) { return(*(int *)0); } #undef attr_on int attr_on( - int z) + NCURSES_ATTR_T z) { return(*(int *)0); } #undef attr_set int attr_set( - int z) + NCURSES_ATTR_T z) { return(*(int *)0); } #undef bkgd @@ -952,12 +967,6 @@ int wattr_set( attr_t z) { return(*(int *)0); } -#undef wbkgdset -void wbkgdset( - WINDOW *a1, - chtype z) - { /* void */ } - #undef wdeleteln int wdeleteln( WINDOW *z) @@ -1009,19 +1018,11 @@ int wstandend( /* ./lib_getch.c */ +#include + #undef ESCDELAY int ESCDELAY; -#undef ungetch -int ungetch( - int ch) - { return(*(int *)0); } - -#undef _nc_backspace -void _nc_backspace( - WINDOW *win) - { /* void */ } - #undef wgetch int wgetch( WINDOW *win) @@ -1036,6 +1037,15 @@ int wgetnstr( int maxlen) { return(*(int *)0); } +/* ./lib_hline.c */ + +#undef whline +int whline( + WINDOW *win, + chtype ch, + int n) + { return(*(int *)0); } + /* ./lib_inchstr.c */ #undef winchnstr @@ -1047,10 +1057,6 @@ int winchnstr( /* ./lib_initscr.c */ -#undef _nc_initscr -int _nc_initscr(void) - { return(*(int *)0); } - #undef initscr WINDOW *initscr(void) { return(*(WINDOW **)0); } @@ -1099,59 +1105,6 @@ int winnstr( int isendwin(void) { return(*(int *)0); } -/* ./lib_kernel.c */ - -#undef napms -int napms( - int ms) - { return(*(int *)0); } - -#undef reset_prog_mode -int reset_prog_mode(void) - { return(*(int *)0); } - -#undef reset_shell_mode -int reset_shell_mode(void) - { return(*(int *)0); } - -#undef erasechar -char erasechar(void) - { return(*(char *)0); } - -#undef killchar -char killchar(void) - { return(*(char *)0); } - -#undef flushinp -int flushinp(void) - { return(*(int *)0); } - -#undef savetty -int savetty(void) - { return(*(int *)0); } - -#undef resetty -int resetty(void) - { return(*(int *)0); } - -/* ./lib_keyname.c */ - -#include -#include - -struct kn { - const char *name; - int code; -}; - -#undef key_names -const struct kn key_names[] = {0}; - -#undef keyname -const char *keyname( - int c) - { return(*(const char **)0); } - /* ./lib_longname.c */ #undef longname @@ -1160,43 +1113,6 @@ char *longname(void) /* ./lib_mouse.c */ -#undef _nc_max_click_interval -int _nc_max_click_interval; - -#undef _nc_mouse_init -void _nc_mouse_init( - SCREEN *sp) - { /* void */ } - -#undef _nc_mouse_fd -int _nc_mouse_fd(void) - { return(*(int *)0); } - -#undef _nc_mouse_event -bool _nc_mouse_event( - SCREEN *sp) - { return(*(bool *)0); } - -#undef _nc_mouse_inline -bool _nc_mouse_inline( - SCREEN *sp) - { return(*(bool *)0); } - -#undef _nc_mouse_parse -bool _nc_mouse_parse( - int runcount) - { return(*(bool *)0); } - -#undef _nc_mouse_wrap -void _nc_mouse_wrap( - SCREEN *sp) - { /* void */ } - -#undef _nc_mouse_resume -void _nc_mouse_resume( - SCREEN *sp) - { /* void */ } - #undef getmouse int getmouse( MEVENT *aevent) @@ -1215,7 +1131,7 @@ mmask_t mousemask( #undef wenclose bool wenclose( - WINDOW *win, + const WINDOW *win, int y, int x) { return(*(bool *)0); } @@ -1225,6 +1141,10 @@ int mouseinterval( int maxclick) { return(*(int *)0); } +#undef _nc_has_mouse +int _nc_has_mouse(void) + { return(*(int *)0); } + /* ./lib_move.c */ #undef wmove @@ -1236,6 +1156,12 @@ int wmove( /* ./lib_mvcur.c */ +#undef _nc_msec_cost +int _nc_msec_cost( + const char *const cap, + int affcnt) + { return(*(int *)0); } + #undef _nc_mvcur_resume void _nc_mvcur_resume(void) { /* void */ } @@ -1256,14 +1182,6 @@ int mvcur( int xnew) { return(*(int *)0); } -#undef _nc_mvcur_scrolln -int _nc_mvcur_scrolln( - int n, - int top, - int bot, - int maxy) - { return(*(int *)0); } - /* ./lib_mvwin.c */ #undef mvwin @@ -1328,141 +1246,34 @@ WINDOW *_nc_makenew( int flags) { return(*(WINDOW **)0); } -/* ./lib_options.c */ +/* ./lib_overlay.c */ -#undef has_ic -int has_ic(void) +#undef overlay +int overlay( + const WINDOW *win1, + WINDOW *win2) { return(*(int *)0); } -#undef has_il -int has_il(void) +#undef overwrite +int overwrite( + const WINDOW *win1, + WINDOW *win2) { return(*(int *)0); } -#undef idlok -int idlok( - WINDOW *win, - bool flag) +#undef copywin +int copywin( + const WINDOW *src, + WINDOW *dst, + int sminrow, + int smincol, + int dminrow, + int dmincol, + int dmaxrow, + int dmaxcol, + int over) { return(*(int *)0); } -#undef idcok -void idcok( - WINDOW *win, - bool flag) - { /* void */ } - -#undef clearok -int clearok( - WINDOW *win, - bool flag) - { return(*(int *)0); } - -#undef immedok -void immedok( - WINDOW *win, - bool flag) - { /* void */ } - -#undef leaveok -int leaveok( - WINDOW *win, - bool flag) - { return(*(int *)0); } - -#undef scrollok -int scrollok( - WINDOW *win, - bool flag) - { return(*(int *)0); } - -#undef halfdelay -int halfdelay( - int t) - { return(*(int *)0); } - -#undef nodelay -int nodelay( - WINDOW *win, - bool flag) - { return(*(int *)0); } - -#undef notimeout -int notimeout( - WINDOW *win, - bool f) - { return(*(int *)0); } - -#undef wtimeout -int wtimeout( - WINDOW *win, - int delay) - { return(*(int *)0); } - -#undef _nc_keypad -int _nc_keypad( - bool flag) - { return(*(int *)0); } - -#undef keypad -int keypad( - WINDOW *win, - bool flag) - { return(*(int *)0); } - -#undef meta -int meta( - WINDOW *win, - bool flag) - { return(*(int *)0); } - -#undef curs_set -int curs_set( - int vis) - { return(*(int *)0); } - -#if 0 - -#include - -#endif - -#undef typeahead -int typeahead( - int fd) - { return(*(int *)0); } - -#undef has_key -int has_key( - int keycode) - { return(*(int *)0); } - -/* ./lib_overlay.c */ - -#undef overlay -int overlay( - const WINDOW *win1, - WINDOW *win2) - { return(*(int *)0); } - -#undef overwrite -int overwrite( - 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, - int over) - { return(*(int *)0); } - -/* ./lib_pad.c */ +/* ./lib_pad.c */ #undef newpad WINDOW *newpad( @@ -1504,7 +1315,7 @@ int pnoutrefresh( #undef pechochar int pechochar( WINDOW *pad, - chtype ch) + const chtype ch) { return(*(int *)0); } /* ./lib_print.c */ @@ -1554,55 +1365,7 @@ int vwprintw( va_list argp) { return(*(int *)0); } -/* ./lib_raw.c */ - -#undef raw -int raw(void) - { return(*(int *)0); } - -#undef cbreak -int cbreak(void) - { return(*(int *)0); } - -#undef echo -int echo(void) - { return(*(int *)0); } - -#undef nl -int nl(void) - { return(*(int *)0); } - -#undef qiflush -int qiflush(void) - { return(*(int *)0); } - -#undef noraw -int noraw(void) - { return(*(int *)0); } - -#undef nocbreak -int nocbreak(void) - { return(*(int *)0); } - -#undef noecho -int noecho(void) - { return(*(int *)0); } - -#undef nonl -int nonl(void) - { return(*(int *)0); } - -#undef noqiflush -int noqiflush(void) - { return(*(int *)0); } - -#undef intrflush -int intrflush( - WINDOW *win, - bool flag) - { return(*(int *)0); } - -/* ./lib_refresh.c */ +/* ./lib_redrawln.c */ #undef wredrawln int wredrawln( @@ -1611,6 +1374,8 @@ int wredrawln( int num) { return(*(int *)0); } +/* ./lib_refresh.c */ + #undef wrefresh int wrefresh( WINDOW *win) @@ -1638,16 +1403,6 @@ int restartterm( int *errret) { return(*(int *)0); } -#undef set_curterm -TERMINAL *set_curterm( - TERMINAL *term) - { return(*(TERMINAL **)0); } - -#undef del_curterm -int del_curterm( - TERMINAL *term) - { return(*(int *)0); } - /* ./lib_scanw.c */ #undef vwscanw @@ -1730,7 +1485,8 @@ void _nc_scroll_window( WINDOW *win, int const n, short const top, - short const bottom) + short const bottom, + chtype blank) { /* void */ } #undef wscrl @@ -1766,11 +1522,6 @@ void delscreen( SCREEN *sp) { /* void */ } -#undef rippedoff -ripoff_t rippedoff[5]; -#undef rsp -ripoff_t *rsp; - #undef _nc_setupscreen int _nc_setupscreen( short slines, @@ -1794,46 +1545,70 @@ int ripoffline( int p2)) { return(*(int *)0); } -/* ./lib_setup.c */ +/* ./lib_slk.c */ -#include +#undef _nc_slk_format +int _nc_slk_format; -#undef use_env -void use_env( - bool f) - { /* void */ } +#undef _nc_slk_initialize +int _nc_slk_initialize( + WINDOW *stwin, + int cols) + { return(*(int *)0); } -#undef LINES -int LINES; -#undef COLS -int COLS; -#undef TABSIZE -int TABSIZE; +#undef slk_restore +int slk_restore(void) + { return(*(int *)0); } -#undef _nc_get_screensize -void _nc_get_screensize(void) - { /* void */ } +/* ./lib_slkatrof.c */ -#undef ttytype -char ttytype[256 ]; +#undef slk_attroff +int slk_attroff( + const attr_t attr) + { return(*(int *)0); } -#undef setupterm -int setupterm( - const char *tname, - int Filedes, - int *errret) +/* ./lib_slkatron.c */ + +#undef slk_attron +int slk_attron( + const attr_t attr) { return(*(int *)0); } -/* ./lib_slk.c */ +/* ./lib_slkatrset.c */ -#undef _nc_slk_format -int _nc_slk_format; +#undef slk_attrset +int slk_attrset( + const attr_t attr) + { return(*(int *)0); } + +/* ./lib_slkattr.c */ + +#undef slk_attr +attr_t slk_attr(void) + { return(*(attr_t *)0); } + +/* ./lib_slkclear.c */ + +#undef slk_clear +int slk_clear(void) + { return(*(int *)0); } + +/* ./lib_slkinit.c */ + +#undef slk_init +int slk_init( + int format) + { return(*(int *)0); } + +/* ./lib_slklab.c */ #undef slk_label char *slk_label( int n) { return(*(char **)0); } +/* ./lib_slkrefr.c */ + #undef slk_noutrefresh int slk_noutrefresh(void) { return(*(int *)0); } @@ -1842,9 +1617,7 @@ int slk_noutrefresh(void) int slk_refresh(void) { return(*(int *)0); } -#undef slk_restore -int slk_restore(void) - { return(*(int *)0); } +/* ./lib_slkset.c */ #undef slk_set int slk_set( @@ -1853,121 +1626,23 @@ int slk_set( int format) { return(*(int *)0); } +/* ./lib_slktouch.c */ + #undef slk_touch int slk_touch(void) { return(*(int *)0); } -#undef slk_clear -int slk_clear(void) - { return(*(int *)0); } +/* ./lib_touch.c */ -#undef _nc_slk_initialize -int _nc_slk_initialize( - WINDOW *stwin, - int cols) +#undef is_linetouched +int is_linetouched( + WINDOW *win, + int line) { return(*(int *)0); } -#undef slk_init -int slk_init( - int format) - { return(*(int *)0); } - -#undef slk_attrset -int slk_attrset( - const attr_t attr) - { return(*(int *)0); } - -#undef slk_attron -int slk_attron( - const attr_t attr) - { return(*(int *)0); } - -#undef slk_attroff -int slk_attroff( - const attr_t attr) - { return(*(int *)0); } - -#undef slk_attr -attr_t slk_attr(void) - { return(*(attr_t *)0); } - -/* ./lib_termcap.c */ - -#include -#include - -#undef PC -char PC; -#undef UP -char *UP; -#undef BC -char *BC; -#undef ospeed -short ospeed; - -#undef tgetent -int tgetent( - char *bufp, - const char *name) - { return(*(int *)0); } - -#if 0 - -#include - -#endif - -#undef tgetflag -int tgetflag( - const char *id) - { return(*(int *)0); } - -#undef tgetnum -int tgetnum( - const char *id) - { return(*(int *)0); } - -#undef tgetstr -char *tgetstr( - const char *id, - char **area) - { return(*(char **)0); } - -#undef tgoto -char *tgoto( - const char *string, - int x, - int y) - { return(*(char **)0); } - -/* ./lib_ti.c */ - -#undef tigetflag -int tigetflag( - const char *str) - { return(*(int *)0); } - -#undef tigetnum -int tigetnum( - const char *str) - { return(*(int *)0); } - -#undef tigetstr -char *tigetstr( - const char *str) - { return(*(char **)0); } - -/* ./lib_touch.c */ - -#undef is_linetouched -int is_linetouched( - WINDOW *win, - int line) - { return(*(int *)0); } - -#undef is_wintouched -int is_wintouched( - WINDOW *win) +#undef is_wintouched +int is_wintouched( + WINDOW *win) { return(*(int *)0); } #undef wtouchln @@ -1978,90 +1653,33 @@ int wtouchln( int changed) { return(*(int *)0); } -/* ./lib_tparm.c */ - -typedef union { - unsigned int num; - char *str; -} stack_frame; +/* ./lib_traceatr.c */ -#undef tparm -char *tparm( - const char *string, - ...) +#undef _traceattr2 +char *_traceattr2( + int bufnum, + attr_t newmode) { return(*(char **)0); } -/* ./lib_tputs.c */ - -#undef delay_output -int delay_output( - int ms) - { return(*(int *)0); } - -#undef _nc_outch -int _nc_outch( - int ch) - { return(*(int *)0); } - -#undef putp -int putp( - const char *string) - { return(*(int *)0); } - -#undef tputs -int tputs( - const char *string, - int affcnt, - int (*outc)( - int p1)) - { return(*(int *)0); } - -/* ./lib_trace.c */ - -#include - -#undef _nc_tracing -unsigned _nc_tracing; -#undef _nc_tputs_trace -const char *_nc_tputs_trace = {0}; -#undef _nc_outchars -long _nc_outchars; -#undef _nc_optimize_enable -int _nc_optimize_enable; - -#undef trace -void trace( - const unsigned int tracelevel) - { /* void */ } - -#undef _nc_visbuf -const char *_nc_visbuf( - const char *buf) - { return(*(const char **)0); } - -#undef _tracef -void _tracef( - const char *fmt, - ...) - { /* void */ } - -/* ./lib_traceatr.c */ - #undef _traceattr char *_traceattr( attr_t newmode) { return(*(char **)0); } -#undef _tracechtype -char *_tracechtype( +#undef _nc_retrace_attr_t +attr_t _nc_retrace_attr_t( + attr_t code) + { return(*(attr_t *)0); } + +#undef _tracechtype2 +char *_tracechtype2( + int bufnum, chtype ch) { return(*(char **)0); } -/* ./lib_tracechr.c */ - -#undef _tracechar -char *_tracechar( - const unsigned char ch) +#undef _tracechtype +char *_tracechtype( + chtype ch) { return(*(char **)0); } /* ./lib_tracedmp.c */ @@ -2082,30 +1700,20 @@ char *_tracemouse( /* ./lib_tstp.c */ #include - -typedef struct sigaction sigaction_t; +#include #undef _nc_signal_handler void _nc_signal_handler( bool enable) { /* void */ } -/* ./lib_twait.c */ +/* ./lib_ungetch.c */ -#undef _nc_timed_wait -int _nc_timed_wait( - int mode, - int milliseconds, - int *timeleft) +#undef ungetch +int ungetch( + int ch) { return(*(int *)0); } -/* ./lib_unctrl.c */ - -#undef unctrl -char *unctrl( - chtype uch) - { return(*(char **)0); } - /* ./lib_vidattr.c */ #undef vidputs @@ -2121,8 +1729,33 @@ int vidattr( { return(*(int *)0); } #undef termattrs -attr_t termattrs(void) - { return(*(attr_t *)0); } +chtype termattrs(void) + { return(*(chtype *)0); } + +/* ./lib_vline.c */ + +#undef wvline +int wvline( + WINDOW *win, + chtype ch, + int n) + { return(*(int *)0); } + +/* ./lib_wattroff.c */ + +#undef wattr_off +int wattr_off( + WINDOW *win, + const attr_t at) + { return(*(int *)0); } + +/* ./lib_wattron.c */ + +#undef wattr_on +int wattr_on( + WINDOW *win, + const attr_t at) + { return(*(int *)0); } /* ./lib_window.c */ @@ -2164,75 +1797,25 @@ WINDOW *dupwin( WINDOW *win) { return(*(WINDOW **)0); } -/* ./names.c */ - -#undef boolnames -char *const boolnames[] = {0}; -#undef boolfnames -char *const boolfnames[] = {0}; -#undef numnames -char *const numnames[] = {0}; -#undef numfnames -char *const numfnames[] = {0}; -#undef strnames -char *const strnames[] = {0}; -#undef strfnames -char *const strfnames[] = {0}; +/* ./nc_panel.c */ -/* ./codes.c */ -#undef boolcodes -char *const boolcodes[] = {0}; -#undef numcodes -char *const numcodes[] = {0}; -#undef strcodes -char *const strcodes[] = {0}; +#undef _nc_panelhook +struct panelhook *_nc_panelhook(void) + { return(*(struct panelhook **)0); } -/* ./read_entry.c */ -#undef cur_term -TERMINAL *cur_term; +/* ./safe_sprintf.c */ -#undef _nc_tic_dir -char *_nc_tic_dir( - char *path) +#undef _nc_printf_string +char *_nc_printf_string( + const char *fmt, + va_list ap) { return(*(char **)0); } -#undef _nc_read_file_entry -int _nc_read_file_entry( - const char *const filename, - TERMTYPE *ptr) - { return(*(int *)0); } - -#undef _nc_read_entry -int _nc_read_entry( - const char *const tn, - char *const filename, - TERMTYPE *const tp) - { return(*(int *)0); } - -#undef _nc_first_name -char *_nc_first_name( - const char *const sp) - { return(*(char **)0); } - -#undef _nc_name_match -int _nc_name_match( - const char *const namelst, - const char *const name, - const char *const delim) - { return(*(int *)0); } - -/* ./read_termcap.c */ +/* ./write_entry.c */ +#include #include -#undef _nc_read_termcap_entry -int _nc_read_termcap_entry( - const char *const tn, - TERMTYPE *const tp) - { return(*(int *)0); } - -/* ./write_entry.c */ - #undef _nc_set_writedir void _nc_set_writedir( char *dir) @@ -2259,6 +1842,169 @@ void _nc_sigaction(void) void _nc_vsscanf(void) { /* void */ } +/* ./define_key.c */ + +#undef define_key +int define_key( + char *str, + int keycode) + { return(*(int *)0); } + +/* ./expanded.c */ + +#undef _nc_toggle_attr_on +void _nc_toggle_attr_on( + attr_t *S, + attr_t at) + { /* void */ } + +#undef _nc_toggle_attr_off +void _nc_toggle_attr_off( + attr_t *S, + attr_t at) + { /* void */ } + +#undef _nc_can_clear_with +int _nc_can_clear_with( + chtype ch) + { return(*(int *)0); } + +#undef _nc_DelCharCost +int _nc_DelCharCost( + int count) + { return(*(int *)0); } + +#undef _nc_InsCharCost +int _nc_InsCharCost( + int count) + { return(*(int *)0); } + +#undef _nc_UpdateAttrs +void _nc_UpdateAttrs( + chtype c) + { /* void */ } + +/* ./keyok.c */ + +#undef keyok +int keyok( + int c, + bool flag) + { return(*(int *)0); } + +/* ./lib_adabind.c */ + +#undef _nc_ada_getmaxyx +int _nc_ada_getmaxyx( + const WINDOW *win, + int *y, + int *x) + { return(*(int *)0); } + +#undef _nc_ada_getbegyx +int _nc_ada_getbegyx( + const WINDOW *win, + int *y, + int *x) + { return(*(int *)0); } + +#undef _nc_ada_getyx +int _nc_ada_getyx( + const WINDOW *win, + int *y, + int *x) + { return(*(int *)0); } + +#undef _nc_ada_getparyx +int _nc_ada_getparyx( + const WINDOW *win, + int *y, + int *x) + { return(*(int *)0); } + +#undef _nc_ada_isscroll +int _nc_ada_isscroll( + const WINDOW *win) + { return(*(int *)0); } + +#undef _nc_ada_coord_transform +int _nc_ada_coord_transform( + const WINDOW *win, + int *Y, + int *X, + int dir) + { return(*(int *)0); } + +#undef _nc_ada_mouse_event +void _nc_ada_mouse_event( + mmask_t m, + int *b, + int *s) + { /* void */ } + +#undef _nc_ada_mouse_mask +int _nc_ada_mouse_mask( + int button, + int state, + mmask_t *mask) + { return(*(int *)0); } + +#undef _nc_ada_vcheck +int _nc_ada_vcheck( + int major, + int minor) + { return(*(int *)0); } + +/* ./lib_dft_fgbg.c */ + +#undef use_default_colors +int use_default_colors(void) + { return(*(int *)0); } + +/* ./lib_freeall.c */ + +#undef _nc_free_termtype +void _nc_free_termtype( + struct termtype *p, + int base) + { /* void */ } + +#undef _nc_freeall +void _nc_freeall(void) + { /* void */ } + +#undef _nc_free_and_exit +void _nc_free_and_exit( + int code) + { /* void */ } + +/* ./resizeterm.c */ + +#undef resizeterm +int resizeterm( + int ToLines, + int ToCols) + { return(*(int *)0); } + +/* ./softscroll.c */ + +#undef _nc_setup_scroll +void _nc_setup_scroll(void) + { /* void */ } + +#undef _nc_perform_scroll +void _nc_perform_scroll(void) + { /* void */ } + +/* ./wresize.c */ + +#undef wresize +int wresize( + WINDOW *win, + int ToLines, + int ToCols) + { return(*(int *)0); } + /* ./alloc_entry.c */ #undef _nc_init_entry @@ -2286,21 +2032,30 @@ void _nc_merge_entry( #undef _nc_captoinfo char *_nc_captoinfo( - char *const cap, - char *s, + const char *cap, + const char *s, int const parametrized) { return(*(char **)0); } #undef _nc_infotocap char *_nc_infotocap( - char *const cap, - char *str, + const char *cap, + const char *str, int const parametrized) { return(*(char **)0); } +/* ./codes.c */ + +#undef boolcodes +char *const boolcodes[] = {0}; +#undef numcodes +char *const numcodes[] = {0}; +#undef strcodes +char *const strcodes[] = {0}; + /* ./comp_captab.c */ -#include +#include #undef _nc_info_hash_table const struct name_table_entry *const _nc_info_hash_table[991] = {0}; @@ -2320,6 +2075,10 @@ const struct name_table_entry *_nc_get_table( #undef _nc_suppress_warnings bool _nc_suppress_warnings; +#undef _nc_curr_line +int _nc_curr_line; +#undef _nc_curr_col +int _nc_curr_col; #undef _nc_set_source void _nc_set_source( @@ -2354,8 +2113,18 @@ void _nc_syserr_abort( ...) { /* void */ } +/* ./comp_expand.c */ + +#undef _nc_tic_expand +char *_nc_tic_expand( + const char *srcp, + bool tic_format) + { return(*(char **)0); } + /* ./comp_hash.c */ +#include + #undef _nc_find_entry struct name_table_entry const *_nc_find_entry( const char *string, @@ -2405,10 +2174,6 @@ int _nc_resolve_uses(void) #undef _nc_syntax int _nc_syntax; -#undef _nc_curr_line -int _nc_curr_line; -#undef _nc_curr_col -int _nc_curr_col; #undef _nc_curr_file_pos long _nc_curr_file_pos; #undef _nc_comment_start @@ -2422,9 +2187,14 @@ long _nc_start_line; int _nc_get_token(void) { return(*(int *)0); } +#undef _nc_trans_string +char _nc_trans_string( + char *ptr) + { return(*(char *)0); } + #undef _nc_push_token void _nc_push_token( - int class) + int tokclass) { /* void */ } #undef _nc_panic_mode @@ -2438,123 +2208,558 @@ void _nc_reset_input( char *buf) { /* void */ } -/* ./parse_entry.c */ +/* ./fallback.c */ -#undef _nc_curr_token -struct token _nc_curr_token; +#undef _nc_fallback +const TERMTYPE *_nc_fallback( + const char *name) + { return(*(const TERMTYPE **)0); } -#undef _nc_parse_entry -int _nc_parse_entry( - struct entry *entryp, - int literal, - bool silent) - { return(*(int *)0); } +/* ./lib_cur_term.c */ -#undef _nc_capcmp -int _nc_capcmp( - const char *s, - const char *t) +#undef cur_term +TERMINAL *cur_term; + +#undef _nc_get_curterm +int _nc_get_curterm( + struct termios *buf) { return(*(int *)0); } -typedef struct {const char *from; const char *to;} assoc; +#undef _nc_set_curterm +int _nc_set_curterm( + struct termios *buf) + { return(*(int *)0); } -/* ./lib_dft_fgbg.c */ +#undef set_curterm +TERMINAL *set_curterm( + TERMINAL *term) + { return(*(TERMINAL **)0); } -#undef use_default_colors -int use_default_colors(void) +#undef del_curterm +int del_curterm( + TERMINAL *term) { return(*(int *)0); } -/* ./lib_freeall.c */ +/* ./lib_kernel.c */ -#undef _nc_free_termtype -void _nc_free_termtype( - struct termtype *p, - int base) - { /* void */ } +#undef napms +int napms( + int ms) + { return(*(int *)0); } -#undef _nc_freeall -void _nc_freeall(void) - { /* void */ } +#undef reset_prog_mode +int reset_prog_mode(void) + { return(*(int *)0); } -#undef _nc_free_and_exit -void _nc_free_and_exit( - int code) - { /* void */ } +#undef reset_shell_mode +int reset_shell_mode(void) + { return(*(int *)0); } -/* ./resizeterm.c */ +#undef erasechar +char erasechar(void) + { return(*(char *)0); } -#undef resizeterm -int resizeterm( - int ToLines, - int ToCols) +#undef killchar +char killchar(void) + { return(*(char *)0); } + +#undef flushinp +int flushinp(void) { return(*(int *)0); } -/* ./wresize.c */ +#undef savetty +int savetty(void) + { return(*(int *)0); } -#undef wresize -int wresize( - WINDOW *win, - int ToLines, - int ToCols) +#undef resetty +int resetty(void) { return(*(int *)0); } -/* ./lib_adabind.c */ +/* ./lib_keyname.c */ -#undef _nc_ada_getmaxyx -int _nc_ada_getmaxyx( +#include +#include +#include + +struct kn { + const char *name; + int code; +}; + +#undef key_names +const struct kn key_names[] = {0}; + +#undef keyname +const char *keyname( + int c) + { return(*(const char **)0); } + +/* ./lib_options.c */ + +#undef has_ic +int has_ic(void) + { return(*(int *)0); } + +#undef has_il +int has_il(void) + { return(*(int *)0); } + +#undef idlok +int idlok( WINDOW *win, - int *y, - int *x) + bool flag) { return(*(int *)0); } -#undef _nc_ada_getbegyx -int _nc_ada_getbegyx( +#undef idcok +void idcok( WINDOW *win, - int *y, - int *x) + bool flag) + { /* void */ } + +#undef clearok +int clearok( + WINDOW *win, + bool flag) { return(*(int *)0); } -#undef _nc_ada_getyx -int _nc_ada_getyx( +#undef immedok +void immedok( WINDOW *win, - int *y, - int *x) + bool flag) + { /* void */ } + +#undef leaveok +int leaveok( + WINDOW *win, + bool flag) { return(*(int *)0); } -#undef _nc_ada_getparyx -int _nc_ada_getparyx( +#undef scrollok +int scrollok( WINDOW *win, - int *y, - int *x) + bool flag) { return(*(int *)0); } -#undef _nc_ada_isscroll -int _nc_ada_isscroll( - WINDOW *win) +#undef halfdelay +int halfdelay( + int t) { return(*(int *)0); } -#undef _nc_ada_coord_transform -int _nc_ada_coord_transform( +#undef nodelay +int nodelay( WINDOW *win, - int *Y, - int *X, - int dir) + bool flag) { return(*(int *)0); } -#undef _nc_ada_mouse_event -void _nc_ada_mouse_event( - mmask_t m, - int *b, - int *s) +#undef notimeout +int notimeout( + WINDOW *win, + bool f) + { return(*(int *)0); } + +#undef wtimeout +int wtimeout( + WINDOW *win, + int delay) + { return(*(int *)0); } + +#undef keypad +int keypad( + WINDOW *win, + bool flag) + { return(*(int *)0); } + +#undef meta +int meta( + WINDOW *win, + bool flag) + { return(*(int *)0); } + +#undef curs_set +int curs_set( + int vis) + { return(*(int *)0); } + +#undef typeahead +int typeahead( + int fd) + { return(*(int *)0); } + +#undef has_key +int has_key( + int keycode) + { return(*(int *)0); } + +#if 0 + +#include + +#endif + +#undef _nc_keypad +int _nc_keypad( + bool flag) + { return(*(int *)0); } + +/* ./lib_raw.c */ + +#undef raw +int raw(void) + { return(*(int *)0); } + +#undef cbreak +int cbreak(void) + { return(*(int *)0); } + +#undef echo +int echo(void) + { return(*(int *)0); } + +#undef nl +int nl(void) + { return(*(int *)0); } + +#undef qiflush +int qiflush(void) + { return(*(int *)0); } + +#undef noraw +int noraw(void) + { return(*(int *)0); } + +#undef nocbreak +int nocbreak(void) + { return(*(int *)0); } + +#undef noecho +int noecho(void) + { return(*(int *)0); } + +#undef nonl +int nonl(void) + { return(*(int *)0); } + +#undef noqiflush +int noqiflush(void) + { return(*(int *)0); } + +#undef intrflush +int intrflush( + WINDOW *win, + bool flag) + { return(*(int *)0); } + +/* ./lib_termcap.c */ + +#include + +#undef PC +char PC; +#undef UP +char *UP; +#undef BC +char *BC; +#undef ospeed +short ospeed; + +#undef tgetent +int tgetent( + char *bufp, + const char *name) + { return(*(int *)0); } + +#if 0 + +#include + +#endif + +#undef tgetflag +int tgetflag( + const char *id) + { return(*(int *)0); } + +#undef tgetnum +int tgetnum( + const char *id) + { return(*(int *)0); } + +#undef tgetstr +char *tgetstr( + const char *id, + char **area) + { return(*(char **)0); } + +#undef tgoto +char *tgoto( + const char *string, + int x, + int y) + { return(*(char **)0); } + +/* ./lib_ti.c */ + +#undef tigetflag +int tigetflag( + const char *str) + { return(*(int *)0); } + +#undef tigetnum +int tigetnum( + const char *str) + { return(*(int *)0); } + +#undef tigetstr +char *tigetstr( + const char *str) + { return(*(char **)0); } + +/* ./lib_tparm.c */ + +typedef union { + unsigned int num; + char *str; +} stack_frame; + +#undef tparm +char *tparm( + const char *string, + ...) + { return(*(char **)0); } + +/* ./lib_tputs.c */ + +#undef _nc_nulls_sent +int _nc_nulls_sent; + +#undef delay_output +int delay_output( + int ms) + { return(*(int *)0); } + +#undef _nc_outch +int _nc_outch( + int ch) + { return(*(int *)0); } + +#undef putp +int putp( + const char *string) + { return(*(int *)0); } + +#undef tputs +int tputs( + const char *string, + int affcnt, + int (*outc)( + int p1)) + { return(*(int *)0); } + +/* ./lib_trace.c */ + +#include + +#undef _nc_tracing +unsigned _nc_tracing; +#undef _nc_tputs_trace +const char *_nc_tputs_trace = {0}; +#undef _nc_outchars +long _nc_outchars; +#undef _nc_optimize_enable +int _nc_optimize_enable; + +#undef trace +void trace( + const unsigned int tracelevel) { /* void */ } -#undef _nc_ada_mouse_mask -int _nc_ada_mouse_mask( - int button, - int state, - mmask_t *mask) +#undef _nc_visbuf2 +const char *_nc_visbuf2( + int bufnum, + const char *buf) + { return(*(const char **)0); } + +#undef _nc_visbuf +const char *_nc_visbuf( + const char *buf) + { return(*(const char **)0); } + +#undef _tracef +void _tracef( + const char *fmt, + ...) + { /* void */ } + +#undef _nc_retrace_int +int _nc_retrace_int( + int code) + { return(*(int *)0); } + +#undef _nc_retrace_ptr +char *_nc_retrace_ptr( + char *code) + { return(*(char **)0); } + +#undef _nc_retrace_win +WINDOW *_nc_retrace_win( + WINDOW *code) + { return(*(WINDOW **)0); } + +/* ./lib_tracechr.c */ + +#undef _tracechar +char *_tracechar( + const unsigned char ch) + { return(*(char **)0); } + +/* ./lib_twait.c */ + +#undef _nc_timed_wait +int _nc_timed_wait( + int mode, + int milliseconds, + int *timeleft) { return(*(int *)0); } -#undef _nc_ada_unregister_mouse -void _nc_ada_unregister_mouse(void) +/* ./name_match.c */ + +#undef _nc_first_name +char *_nc_first_name( + const char *const sp) + { return(*(char **)0); } + +#undef _nc_name_match +int _nc_name_match( + const char *const namelst, + const char *const name, + const char *const delim) + { return(*(int *)0); } + +/* ./names.c */ + +#undef boolnames +char *const boolnames[] = {0}; +#undef boolfnames +char *const boolfnames[] = {0}; +#undef numnames +char *const numnames[] = {0}; +#undef numfnames +char *const numfnames[] = {0}; +#undef strnames +char *const strnames[] = {0}; +#undef strfnames +char *const strfnames[] = {0}; + +/* ./parse_entry.c */ +#undef _nc_curr_token +struct token _nc_curr_token; + +#undef _nc_parse_entry +int _nc_parse_entry( + struct entry *entryp, + int literal, + bool silent) + { return(*(int *)0); } + +#undef _nc_capcmp +int _nc_capcmp( + const char *s, + const char *t) + { return(*(int *)0); } + +typedef struct {const char *from; const char *to;} assoc; + +/* ./read_entry.c */ + +#undef _nc_tic_dir +const char *_nc_tic_dir( + const char *path) + { return(*(const char **)0); } + +#undef _nc_read_file_entry +int _nc_read_file_entry( + const char *const filename, + TERMTYPE *ptr) + { return(*(int *)0); } + +#undef _nc_read_entry +int _nc_read_entry( + const char *const tn, + char *const filename, + TERMTYPE *const tp) + { return(*(int *)0); } + +/* ./read_termcap.c */ + +#undef _nc_read_termcap_entry +int _nc_read_termcap_entry( + const char *const tn, + TERMTYPE *const tp) + { return(*(int *)0); } + +/* ./lib_setup.c */ + +#include + +#undef use_env +void use_env( + bool f) { /* void */ } + +#undef LINES +int LINES; +#undef COLS +int COLS; +#undef TABSIZE +int TABSIZE; + +#undef _nc_update_screensize +void _nc_update_screensize(void) + { /* void */ } + +#undef ttytype +char ttytype[256 ]; + +#undef setupterm +int setupterm( + const char *tname, + int Filedes, + int *errret) + { return(*(int *)0); } + +/* ./trace_buf.c */ + +#undef _nc_trace_buf +char *_nc_trace_buf( + int bufnum, + size_t want) + { return(*(char **)0); } + +/* ./tries.c */ + +#undef _nc_add_to_try +void _nc_add_to_try( + struct tries **tree, + char *str, + unsigned short code) + { /* void */ } + +#undef _nc_expand_try +char *_nc_expand_try( + struct tries *tree, + unsigned short code, + size_t len) + { return(*(char **)0); } + +#undef _nc_remove_key +int _nc_remove_key( + struct tries **tree, + unsigned short code) + { return(*(int *)0); } + +/* ./unctrl.c */ + +#undef unctrl +char *unctrl( + chtype ch) + { return(*(char **)0); } diff --git a/ncurses/make_keys.c b/ncurses/make_keys.c new file mode 100644 index 00000000..c244b0c9 --- /dev/null +++ b/ncurses/make_keys.c @@ -0,0 +1,134 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1997 * + ****************************************************************************/ + +/* + * This replaces an awk script which translated keys.list into keys.tries by + * 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. + */ +#include + +MODULE_ID("$Id: make_keys.c,v 1.4 1998/02/11 12:13:57 tom Exp $") + +#include + +#define UNKNOWN (SIZEOF(strnames) + SIZEOF(strfnames)) + +static size_t lookup(const char *name) +{ + size_t n; + bool found = FALSE; + for (n = 0; strnames[n] != 0; n++) { + if (!strcmp(name, strnames[n])) { + found = TRUE; + break; + } + } + if (!found) { + for (n = 0; strfnames[n] != 0; n++) { + if (!strcmp(name, strfnames[n])) { + found = TRUE; + break; + } + } + } + return found ? n : UNKNOWN; +} + +static void make_keys(FILE *ifp, FILE *ofp) +{ + char buffer[BUFSIZ]; + char from[BUFSIZ]; + char to[BUFSIZ]; + int maxlen = 16; + + while (fgets(buffer, sizeof(buffer), ifp) != 0) { + if (*buffer == '#') + continue; + if (sscanf(buffer, "%s %s", to, from) == 2) { + int code = lookup(from); + if (code == UNKNOWN) + continue; + if ((int)strlen(from) > maxlen) + maxlen = strlen(from); + fprintf(ofp, "\t{ %4d, %-*.*s },\t/* %s */\n", + code, + maxlen, maxlen, + to, + from); + } + } +} + +static void write_list(FILE *ofp, const char **list) +{ + while (*list != 0) + fprintf(ofp, "%s\n", *list++); +} + +int main(int argc, char *argv[]) +{ + static const char *prefix[] = { + "#ifndef NCU_KEYS_H", + "#define NCU_KEYS_H 1", + "", + "/* This file was generated by MAKE_KEYS */", + "", + "static const struct {", + "\tunsigned offset;", + "\tchtype code;", + "} table[] = {", + 0 + }; + static const char *suffix[] = { + "};", + "", + "#endif /* NCU_KEYS_H */", + 0 + }; + + write_list(stdout, prefix); + if (argc > 1) { + int n; + for (n = 1; n < argc; n++) { + FILE *fp = fopen(argv[n], "r"); + if (fp != 0) { + make_keys(fp, stdout); + fclose(fp); + } + } + } else { + make_keys(stdin, stdout); + } + write_list(stdout, suffix); + return EXIT_SUCCESS; +} diff --git a/ncurses/modules b/ncurses/modules index 91fa3135..321170cb 100644 --- a/ncurses/modules +++ b/ncurses/modules @@ -1,35 +1,49 @@ -# $Id: modules,v 1.25 1997/04/26 21:59:59 tom Exp $ -################################################################################ -# Copyright 1996,1997 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: modules,v 1.42 1998/02/11 12:13:57 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# + +@ base # Library objects -fallback lib . ../include/term.h $(INCDIR)/tic.h -hashmap lib $(srcdir) hardscroll lib $(srcdir) +hashmap lib $(srcdir) lib_acs lib $(srcdir) ../include/term.h lib_addch lib $(srcdir) lib_addstr lib $(srcdir) +lib_baudrate lib $(srcdir) ../include/term.h lib_beep lib $(srcdir) ../include/term.h lib_bkgd lib $(srcdir) -lib_baudrate lib $(srcdir) ../include/term.h lib_box lib $(srcdir) +lib_chgat lib $(srcdir) lib_clear lib $(srcdir) +lib_clearok lib $(srcdir) lib_clrbot lib $(srcdir) lib_clreol lib $(srcdir) lib_color lib $(srcdir) ../include/term.h @@ -37,11 +51,15 @@ lib_data lib $(srcdir) lib_delch lib $(srcdir) lib_delwin lib $(srcdir) lib_doupdate lib $(srcdir) ../include/term.h +lib_echo lib $(srcdir) lib_endwin lib $(srcdir) lib_erase lib $(srcdir) +lib_flash lib $(srcdir) ../include/term.h lib_gen lib . ../include/curses.h lib_getch lib $(srcdir) lib_getstr lib $(srcdir) ../include/term.h +lib_hline lib $(srcdir) +lib_immedok lib $(srcdir) lib_inchstr lib $(srcdir) lib_initscr lib $(srcdir) lib_insch lib $(srcdir) @@ -49,69 +67,101 @@ lib_insdel lib $(srcdir) lib_insstr lib $(srcdir) lib_instr lib $(srcdir) lib_isendwin lib $(srcdir) -lib_kernel lib $(srcdir) ../include/term.h -lib_keyname lib . ../include/term.h +lib_leaveok lib $(srcdir) lib_longname lib $(srcdir) lib_mouse lib $(srcdir) ../include/term.h lib_move lib $(srcdir) lib_mvcur lib $(srcdir) ../include/term.h lib_mvwin lib $(srcdir) +lib_napms lib $(srcdir) lib_newterm lib $(srcdir) ../include/term.h lib_newwin lib $(srcdir) -lib_options lib $(srcdir) ../include/term.h keys.tries +lib_nl lib $(srcdir) lib_overlay lib $(srcdir) lib_pad lib $(srcdir) lib_print lib $(srcdir) ../include/term.h lib_printw lib $(srcdir) -lib_raw lib $(srcdir) ../include/term.h +lib_redrawln lib $(srcdir) lib_refresh lib $(srcdir) lib_restart lib $(srcdir) lib_scanw lib $(srcdir) lib_screen lib $(srcdir) ../include/term.h lib_scroll lib $(srcdir) +lib_scrollok lib $(srcdir) lib_scrreg lib $(srcdir) lib_set_term lib $(srcdir) ../include/term.h -lib_setup lib $(srcdir) ../include/term.h lib_slk lib $(srcdir) ../include/term.h -lib_termcap lib $(srcdir) ../include/term.h -lib_ti lib $(srcdir) ../include/term.h +lib_slkatrof lib $(srcdir) +lib_slkatron lib $(srcdir) +lib_slkatrset lib $(srcdir) +lib_slkattr lib $(srcdir) +lib_slkclear lib $(srcdir) +lib_slkinit lib $(srcdir) +lib_slklab lib $(srcdir) +lib_slkrefr lib $(srcdir) ../include/term.h +lib_slkset lib $(srcdir) +lib_slktouch lib $(srcdir) lib_touch lib $(srcdir) -lib_tparm lib $(srcdir) ../include/term.h -lib_tputs lib $(srcdir) ../include/term.h -lib_trace lib $(srcdir) lib_traceatr lib $(srcdir) -lib_tracechr lib $(srcdir) lib_tracedmp lib $(srcdir) lib_tracemse lib $(srcdir) lib_tstp lib $(srcdir) -lib_twait lib $(srcdir) +lib_ungetch lib $(srcdir) lib_vidattr lib $(srcdir) ../include/term.h +lib_vline lib $(srcdir) +lib_wattroff lib $(srcdir) +lib_wattron lib $(srcdir) lib_window lib $(srcdir) -names lib . -codes lib . -unctrl lib . -read_entry lib $(srcdir) ../include/term.h $(INCDIR)/tic.h -read_termcap lib $(srcdir) ../include/term.h +nc_panel lib $(srcdir) +safe_sprintf lib $(srcdir) write_entry lib $(srcdir) ../include/term.h $(INCDIR)/tic.h # Modules for porting sigaction lib $(srcdir) vsscanf lib $(srcdir) -# Support for termcap (and tic, etc.) +# Extensions to the base library +@ ext_funcs +define_key lib $(srcdir) +expanded lib . +keyok lib $(srcdir) +lib_adabind lib $(srcdir) +lib_dft_fgbg lib $(srcdir) +lib_freeall lib $(srcdir) +resizeterm lib $(srcdir) ../include/term.h +softscroll lib $(srcdir) +wresize lib $(srcdir) ../include/term.h + +# Support for termcap (and tic, etc.), which can be a separate library +@ termlib alloc_entry lib $(srcdir) ../include/term.h captoinfo lib $(srcdir) +codes lib . comp_captab lib . ../include/term.h ../include/hashsize.h comp_error lib $(srcdir) +comp_expand lib $(srcdir) $(INCDIR)/tic.h comp_hash lib $(srcdir) ../include/term.h ../include/hashsize.h comp_parse lib $(srcdir) ../include/term.h $(INCDIR)/tic.h comp_scan lib $(srcdir) +fallback lib . ../include/term.h $(INCDIR)/tic.h +lib_cur_term lib $(srcdir) +lib_kernel lib $(srcdir) ../include/term.h +lib_keyname lib . ../include/term.h +lib_options lib $(srcdir) ../include/term.h keys.tries +lib_raw lib $(srcdir) ../include/term.h +lib_termcap lib $(srcdir) ../include/term.h +lib_ti lib $(srcdir) ../include/term.h +lib_tparm lib $(srcdir) ../include/term.h +lib_tputs lib $(srcdir) ../include/term.h +lib_trace lib $(srcdir) +lib_tracechr lib $(srcdir) +lib_twait lib $(srcdir) +name_match lib $(srcdir) ../include/term.h $(INCDIR)/tic.h +names lib . parse_entry lib $(srcdir) ../include/term.h ../include/parametrized.h - -# Extensions -lib_dft_fgbg lib $(srcdir) -lib_freeall lib $(srcdir) -resizeterm lib $(srcdir) ../include/term.h -wresize lib $(srcdir) ../include/term.h -lib_adabind lib $(srcdir) -expanded lib . +read_entry lib $(srcdir) ../include/term.h $(INCDIR)/tic.h +read_termcap lib $(srcdir) ../include/term.h +lib_setup lib $(srcdir) ../include/term.h +trace_buf lib $(srcdir) +tries lib $(srcdir) +unctrl lib . diff --git a/ncurses/name_match.c b/ncurses/name_match.c new file mode 100644 index 00000000..457f6376 --- /dev/null +++ b/ncurses/name_match.c @@ -0,0 +1,85 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +#include +#include +#include + +MODULE_ID("$Id: name_match.c,v 1.4 1998/02/11 12:13:55 tom Exp $") + +/* + * _nc_first_name(char *names) + * + * Extract the primary name from a compiled entry. + */ + +char *_nc_first_name(const char *const sp) +/* get the first name from the given name list */ +{ + static char buf[MAX_NAME_SIZE]; + register char *cp; + + (void) strcpy(buf, sp); + + cp = strchr(buf, '|'); + if (cp) + *cp = '\0'; + + return(buf); +} + +/* + * int _nc_name_match(namelist, name, delim) + * + * Is the given name matched in namelist? + */ + +int _nc_name_match(const char *const namelst, const char *const name, const char *const delim) +/* microtune this, it occurs in several critical loops */ +{ +char namecopy[MAX_ENTRY_SIZE]; /* this may get called on a TERMCAP value */ +register char *cp; + + if (namelst == 0) + return(FALSE); + (void) strcpy(namecopy, namelst); + if ((cp = strtok(namecopy, delim)) != 0) { + do { + /* avoid strcmp() function-call cost if possible */ + if (cp[0] == name[0] && strcmp(cp, name) == 0) + return(TRUE); + } while + ((cp = strtok((char *)0, delim)) != 0); + } + return(FALSE); +} diff --git a/ncurses/nc_panel.c b/ncurses/nc_panel.c new file mode 100644 index 00000000..536aab38 --- /dev/null +++ b/ncurses/nc_panel.c @@ -0,0 +1,41 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1997 * + ****************************************************************************/ + +#include + +MODULE_ID("$Id: nc_panel.c,v 1.2 1998/02/11 12:13:56 tom Exp $") + +struct panelhook* +_nc_panelhook(void) +{ + return (SP ? &(SP->_panelHook) : NULL); +} diff --git a/ncurses/parse_entry.c b/ncurses/parse_entry.c index f3f74f79..fd41019b 100644 --- a/ncurses/parse_entry.c +++ b/ncurses/parse_entry.c @@ -1,22 +1,35 @@ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -36,7 +49,7 @@ #include #include -MODULE_ID("$Id: parse_entry.c,v 1.18 1997/02/02 01:50:15 tom Exp $") +MODULE_ID("$Id: parse_entry.c,v 1.22 1998/02/11 12:13:59 tom Exp $") #ifdef LINT static short const parametrized[] = { 0 }; @@ -549,7 +562,7 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base) } else tab = _nc_save_str(C_HT); } - if (init_tabs == -1 && has_hardware_tabs == TRUE) + if (init_tabs == ABSENT_NUMERIC && has_hardware_tabs == TRUE) init_tabs = 8; /* @@ -563,7 +576,7 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base) * Translate the old termcap :pt: capability to it#8 + ht=\t */ if (has_hardware_tabs == TRUE) - if (init_tabs != 8) + if (init_tabs != 8 && init_tabs != ABSENT_NUMERIC) _nc_warning("hardware tabs with a width other than 8: %d", init_tabs); else { @@ -700,6 +713,12 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base) { char buf2[MAX_TERMCAP_LENGTH], *bp = buf2; + if (acs_chars) + { + (void)strcpy(bp, acs_chars); + bp += strlen(bp); + } + if (acs_ulcorner && acs_ulcorner[1] == '\0') { *bp++ = 'l'; @@ -781,6 +800,12 @@ void postprocess_terminfo(TERMTYPE *tp) { char buf2[MAX_TERMCAP_LENGTH], *bp = buf2; + if (acs_chars) + { + (void)strcpy(bp, acs_chars); + bp += strlen(bp); + } + if (box_chars_1[0]) /* ACS_ULCORNER */ { *bp++ = 'l'; @@ -865,7 +890,7 @@ struct name_table_entry const * lookup_fullname(const char *find) for (;;) { int count = 0; - char *const *names; + NCURSES_CONST char *const *names; switch (++state) { case BOOLEAN: diff --git a/ncurses/read_entry.c b/ncurses/read_entry.c index 868073dc..c783d0af 100644 --- a/ncurses/read_entry.c +++ b/ncurses/read_entry.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ @@ -36,9 +48,11 @@ #include #include -MODULE_ID("$Id: read_entry.c,v 1.31 1997/05/10 17:31:08 tom Exp $") +MODULE_ID("$Id: read_entry.c,v 1.35 1998/02/11 12:13:59 tom Exp $") -TERMINAL *cur_term; +#ifndef O_BINARY +#define O_BINARY 0 +#endif /* * int @@ -84,7 +98,7 @@ int _nc_read_file_entry(const char *const filename, TERMTYPE *ptr) int i, fd, numread; char buf[MAX_ENTRY_SIZE]; - if ((fd = open(filename, O_RDONLY)) < 0) + if ((fd = open(filename, O_RDONLY|O_BINARY)) < 0) return(0); T(("read terminfo %s", filename)); @@ -157,6 +171,11 @@ int _nc_read_file_entry(const char *const filename, TERMTYPE *ptr) if (str_count) { + if (str_count*2 >= MAX_ENTRY_SIZE) + { + close(fd); + return(0); + } /* grab the string offsets */ numread = read(fd, buf, (unsigned)(str_count*2)); if (numread < str_count*2) @@ -166,6 +185,8 @@ int _nc_read_file_entry(const char *const filename, TERMTYPE *ptr) } for (i = 0; i < numread/2; i++) { + if (i >= STRCOUNT) + break; if (IS_NEG1(buf + 2*i)) ptr->Strings[i] = ABSENT_STRING; else if (IS_NEG2(buf + 2*i)) @@ -279,49 +300,3 @@ char ttn[MAX_ALIAS + 3]; return(_nc_read_tic_entry(filename, TERMINFO, ttn, tp)); } -/* - * _nc_first_name(char *names) - * - * Extract the primary name from a compiled entry. - */ - -char *_nc_first_name(const char *const sp) -/* get the first name from the given name list */ -{ - static char buf[MAX_NAME_SIZE]; - register char *cp; - - (void) strcpy(buf, sp); - - cp = strchr(buf, '|'); - if (cp) - *cp = '\0'; - - return(buf); -} - -/* - * bool _nc_name_match(namelist, name, delim) - * - * Is the given name matched in namelist? - */ - -int _nc_name_match(const char *const namelst, const char *const name, const char *const delim) -/* microtune this, it occurs in several critical loops */ -{ -char namecopy[MAX_ENTRY_SIZE]; /* this may get called on a TERMCAP value */ -register char *cp; - - if (namelst == 0) - return(FALSE); - (void) strcpy(namecopy, namelst); - if ((cp = strtok(namecopy, delim)) != 0) { - do { - /* avoid strcmp() function-call cost if possible */ - if (cp[0] == name[0] && strcmp(cp, name) == 0) - return(TRUE); - } while - ((cp = strtok((char *)0, delim)) != 0); - } - return(FALSE); -} diff --git a/ncurses/read_termcap.c b/ncurses/read_termcap.c index 3243694d..d67a3bc9 100644 --- a/ncurses/read_termcap.c +++ b/ncurses/read_termcap.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -40,6 +52,7 @@ #include +#include #include #include #include @@ -48,7 +61,14 @@ #include #endif -MODULE_ID("$Id: read_termcap.c,v 1.21 1996/12/21 14:24:06 tom Exp $") +MODULE_ID("$Id: read_termcap.c,v 1.27 1998/02/11 12:13:58 tom Exp $") + +#ifdef __EMX__ +#define is_pathname(s) ((((s) != 0) && ((s)[0] == '/')) \ + || (((s)[0] != 0) && ((s)[1] == ':'))) +#else +#define is_pathname(s) ((s) != 0 && (s)[0] == '/') +#endif #define TC_SUCCESS 0 #define TC_UNRESOLVED -1 @@ -56,158 +76,17 @@ MODULE_ID("$Id: read_termcap.c,v 1.21 1996/12/21 14:24:06 tom Exp $") #define TC_SYS_ERR -3 #define TC_REF_LOOP -4 -#ifdef USE_GETCAP -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgment: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* static char sccsid[] = "@(#)termcap.c 8.1 (Berkeley) 6/4/93" */ - -#define PBUFSIZ 512 /* max length of filename path */ -#define PVECSIZ 32 /* max number of names in path */ +#if USE_GETCAP -static char *_nc_cgetcap(char *, const char *, int); -static int _nc_cgetent(char **, int *, char **, const char *); +#if HAVE_BSD_CGETENT +#define _nc_cgetcap cgetcap +#define _nc_cgetent(buf, oline, db_array, name) cgetent(buf, db_array, name) +#define _nc_cgetmatch cgetmatch +#define _nc_cgetset cgetset +#else static int _nc_cgetmatch(char *, const char *); -static int _nc_cgetset(const char *); static int _nc_getent(char **, unsigned int *, int *, int, char **, int, const char *, int, char *); static int _nc_nfcmp(const char *, char *); -static int _nc_tgetent(char *, char **, int *, const char *); - -/* - * termcap - routines for dealing with the terminal capability data base - * - * BUG: Should use a "last" pointer in tbuf, so that searching - * for capabilities alphabetically would not be a n**2/2 - * process when large numbers of capabilities are given. - * Note: If we add a last pointer now we will screw up the - * tc capability. We really should compile termcap. - * - * Essentially all the work here is scanning and decoding escapes in string - * capabilities. We don't use stdio because the editor doesn't, and because - * living w/o it is not hard. - */ - -static char *tbuf; /* termcap buffer */ - -/* - * Get an entry for terminal name in buffer bp from the termcap file. - */ -static int -_nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) -{ - static char *the_source; - - register char *p; - register char *cp; - char *dummy; - char **fname; - char *home; - int i; - 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; - - fname = pathvec; - pvec = pathvec; - tbuf = bp; - p = pathbuf; - cp = getenv("TERMCAP"); - - /* - * TERMCAP can have one of two things in it. It can be the name of a - * file to use instead of /etc/termcap. In this case it better start - * with a "/". Or it can be an entry to use so we don't have to read - * the file. In this case it has to already have the newlines crunched - * out. If TERMCAP does not hold a file name then a path of names is - * searched instead. The path is found in the TERMPATH variable, or - * becomes "$HOME/.termcap /etc/termcap" if no TERMPATH exists. - */ - if (!cp || *cp != '/') { /* no TERMCAP or it holds an entry */ - if ((termpath = getenv("TERMPATH")) != 0) { - strncpy(pathbuf, termpath, sizeof(pathbuf)-1); - } else { - if ((home = getenv("HOME")) != 0) { /* setup path */ - p += strlen(home); /* path, looking in */ - strcpy(pathbuf, home); /* $HOME first */ - *p++ = '/'; - } /* if no $HOME look in current directory */ -#define MY_PATH_DEF ".termcap /etc/termcap /usr/share/misc/termcap" - strncpy(p, MY_PATH_DEF, PBUFSIZ - (p - pathbuf)); - } - } - else /* user-defined name in TERMCAP */ - strncpy(pathbuf, cp, PBUFSIZ); /* still can be tokenized */ - - *fname++ = pathbuf; /* tokenize path into vector of names */ - while (*++p) { - if (*p == ' ' || *p == ':') { - *p = '\0'; - while (*++p) - if (*p != ' ' && *p != ':') - break; - if (*p == '\0') - break; - *fname++ = p; - if (fname >= pathvec + PVECSIZ) { - fname--; - break; - } - } - } - *fname = 0; /* mark end of vector */ - if (cp && *cp && *cp != '/') { - if (_nc_cgetset(cp) < 0) - return(TC_SYS_ERR); - } - - i = _nc_cgetent(&dummy, lineno, pathvec, name); - - if (i >= 0) - strcpy(bp, dummy); - - FreeIfNeeded(dummy); - FreeIfNeeded(the_source); - the_source = 0; - - if (i >= 0) { - the_source = malloc(strlen(pathvec[i]) + 1); - if (the_source != 0) - *sourcename = strcpy(the_source, pathvec[i]); - } - - return(i); -} /*- * Copyright (c) 1992, 1993 @@ -672,8 +551,8 @@ _nc_getent( * Insert tc'ed record into our record. */ s = tcstart + newilen; - memmove(s, tcend, rp - tcend); - memmove(tcstart, newicap, newilen); + memmove(s, tcend, (size_t)(rp - tcend)); + memmove(tcstart, newicap, (size_t)newilen); rp += diff; free(icap); @@ -767,14 +646,274 @@ _nc_nfcmp(const char *nf, char *rec) return (ret); } +#endif /* HAVE_BSD_CGETENT */ + +/* + * Since ncurses provides its own 'tgetent()', we cannot use the native one. + * So we reproduce the logic to get down to cgetent() -- or our cut-down + * version of that -- to circumvent the problem of configuring against the + * termcap library. + */ +#define USE_BSD_TGETENT 1 + +#if USE_BSD_TGETENT +/* + * Copyright (c) 1980, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* static char sccsid[] = "@(#)termcap.c 8.1 (Berkeley) 6/4/93" */ + +#define PBUFSIZ 512 /* max length of filename path */ +#define PVECSIZ 32 /* max number of names in path */ +#define TBUFSIZ (2048*2) + +static char *tbuf; + +/* + * On entry, srcp points to a non ':' character which is the beginning of the + * token, if any. We'll try to return a string that doesn't end with a ':'. + */ +static char * +get_tc_token(char **srcp, int *endp) +{ + int ch; + bool found = FALSE; + char *s, *base; + char *tok = 0; + + *endp = TRUE; + for (s = base = *srcp; *s != '\0'; ) { + ch = *s++; + if (ch == '\\') { + if (*s == '\0') { + break; + } else if (*s++ == '\n') { + while (isspace(*s)) + s++; + } else { + found = TRUE; + } + } else if (ch == ':') { + if (found) { + tok = base; + s[-1] = '\0'; + *srcp = s; + *endp = FALSE; + break; + } + base = s; + } else if (isgraph(ch)) { + found = TRUE; + } + } + + /* malformed entry may end without a ':' */ + if (tok == 0 && found) { + tok = base; + } + + return tok; +} + +static char * +copy_tc_token(char *dst, const char *src, size_t len) +{ + int ch; + + while ((ch = *src++) != '\0') { + if (ch == '\\' && *src == '\n') { + while (isspace(*src)) + src++; + continue; + } + if (--len == 0) { + dst = 0; + break; + } + *dst++ = ch; + } + return dst; +} + +/* + * Get an entry for terminal name in buffer bp from the termcap file. + */ +static int +_nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) +{ + static char *the_source; + + register char *p; + register char *cp; + char *dummy; + char **fname; + char *home; + int i; + 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; + + fname = pathvec; + pvec = pathvec; + tbuf = bp; + p = pathbuf; + cp = getenv("TERMCAP"); + + /* + * TERMCAP can have one of two things in it. It can be the name of a + * file to use instead of /etc/termcap. In this case it better start + * with a "/". Or it can be an entry to use so we don't have to read + * the file. In this case it has to already have the newlines crunched + * out. If TERMCAP does not hold a file name then a path of names is + * searched instead. The path is found in the TERMPATH variable, or + * becomes "$HOME/.termcap /etc/termcap" if no TERMPATH exists. + */ + if (!is_pathname(cp)) { /* no TERMCAP or it holds an entry */ + if ((termpath = getenv("TERMPATH")) != 0) { + strncpy(pathbuf, termpath, sizeof(pathbuf)-1); + } else { + if ((home = getenv("HOME")) != 0) { /* setup path */ + p += strlen(home); /* path, looking in */ + strcpy(pathbuf, home); /* $HOME first */ + *p++ = '/'; + } /* if no $HOME look in current directory */ +#define MY_PATH_DEF ".termcap /etc/termcap /usr/share/misc/termcap" + strncpy(p, MY_PATH_DEF, (size_t)(PBUFSIZ - (p - pathbuf))); + } + } + else /* user-defined name in TERMCAP */ + strncpy(pathbuf, cp, PBUFSIZ); /* still can be tokenized */ + + *fname++ = pathbuf; /* tokenize path into vector of names */ + while (*++p) { + if (*p == ' ' || *p == ':') { + *p = '\0'; + while (*++p) + if (*p != ' ' && *p != ':') + break; + if (*p == '\0') + break; + *fname++ = p; + if (fname >= pathvec + PVECSIZ) { + fname--; + break; + } + } + } + *fname = 0; /* mark end of vector */ + if (is_pathname(cp)) { + if (_nc_cgetset(cp) < 0) { + return(TC_SYS_ERR); + } + } + + i = _nc_cgetent(&dummy, lineno, pathvec, name); + + /* ncurses' termcap-parsing routines cannot handle multiple adjacent + * empty fields, and mistakenly use the last valid cap entry instead of + * the first (breaks tc= includes) + */ + if (i >= 0) { + char *pd, *ps, *tok; + int endflag = FALSE; + char *list[1023]; + size_t n, count = 0; + + pd = bp; + ps = dummy; + while (!endflag && (tok = get_tc_token(&ps, &endflag)) != 0) { + bool ignore = FALSE; + + for (n = 1; n < count; n++) { + char *s = list[n]; + if (s[0] == tok[0] + && s[1] == tok[1]) { + ignore = TRUE; + break; + } + } + if (ignore != TRUE) { + list[count++] = tok; + pd = copy_tc_token(pd, tok, TBUFSIZ - (2+pd-bp)); + if (pd == 0) { + i = -1; + break; + } + *pd++ = ':'; + *pd = '\0'; + } + } + } + + FreeIfNeeded(dummy); + FreeIfNeeded(the_source); + the_source = 0; + + /* This is not related to the BSD cgetent(), but to fake up a suitable + * filename for ncurses' error reporting. (If we are not using BSD + * cgetent, then it is the actual filename). + */ + if (i >= 0) { + the_source = malloc(strlen(pathvec[i]) + 1); + if (the_source != 0) + *sourcename = strcpy(the_source, pathvec[i]); + } + + return(i); +} +#endif /* USE_BSD_TGETENT */ #endif /* USE_GETCAP */ int _nc_read_termcap_entry(const char *const tn, TERMTYPE *const tp) { int found = FALSE; ENTRY *ep; +#if USE_GETCAP_CACHE char cwd_buf[PATH_MAX]; -#ifndef USE_GETCAP +#endif +#if USE_GETCAP + char tc[TBUFSIZ]; + static char *source; + static int lineno; + + /* we're using getcap(3) */ + if (_nc_tgetent(tc, &source, &lineno, tn) < 0) + return (ERR); + + _nc_curr_line = lineno; + _nc_set_source(source); + _nc_read_entry_source((FILE *)0, tc, FALSE, FALSE, NULLHOOK); +#else /* * Here is what the 4.4BSD termcap(3) page prescribes: * @@ -811,7 +950,7 @@ int _nc_read_termcap_entry(const char *const tn, TERMTYPE *const tp) if ((tc = getenv("TERMCAP")) != 0) { - if (tc[0] == '/') /* interpret as a filename */ + if (is_pathname(tc)) /* interpret as a filename */ { termpaths[0] = tc; termpaths[filecount = 1] = 0; @@ -899,19 +1038,7 @@ int _nc_read_termcap_entry(const char *const tn, TERMTYPE *const tp) } } } -#else - char tc[2048 * 2]; - static char *source; - static int lineno; - - /* we're using getcap(3) */ - if (_nc_tgetent(tc, &source, &lineno, tn) <= 0) - return (ERR); - - _nc_curr_line = lineno; - _nc_set_source(source); - _nc_read_entry_source((FILE *)0, tc, FALSE, FALSE, NULLHOOK); -#endif +#endif /* USE_GETCAP */ if (_nc_head == 0) return(ERR); @@ -920,9 +1047,11 @@ int _nc_read_termcap_entry(const char *const tn, TERMTYPE *const tp) _nc_resolve_uses(); /* find a terminal matching tn, if we can */ +#if USE_GETCAP_CACHE if (getcwd(cwd_buf, sizeof(cwd_buf)) != 0) { _nc_set_writedir((char *)0); /* note: this does a chdir */ +#endif for_entry_list(ep) { if (_nc_name_match(ep->tterm.term_names, tn, "|:")) { @@ -958,8 +1087,10 @@ int _nc_read_termcap_entry(const char *const tn, TERMTYPE *const tp) break; } } +#if USE_GETCAP_CACHE chdir(cwd_buf); } +#endif _nc_free_entries(_nc_head); return(found); diff --git a/ncurses/resizeterm.c b/ncurses/resizeterm.c index 59a971f5..aaf823fb 100644 --- a/ncurses/resizeterm.c +++ b/ncurses/resizeterm.c @@ -1,22 +1,34 @@ -/****************************************************************************** - * Copyright 1996,1997 by Thomas E. Dickey * - * All Rights Reserved. * - * * - * Permission to use, copy, modify, and distribute this software and its * - * documentation for any purpose and without fee is hereby granted, provided * - * that the above copyright notice appear in all copies and that both that * - * copyright notice and this permission notice appear in supporting * - * documentation, and that the name of the above listed copyright holder(s) * - * not be used in advertising or publicity pertaining to distribution of the * - * software without specific, written prior permission. THE ABOVE LISTED * - * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * - * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - ******************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1996,1997 * + ****************************************************************************/ /* * This is an extension to the curses library. It provides callers with a hook @@ -29,7 +41,7 @@ #include #include -MODULE_ID("$Id: resizeterm.c,v 1.3 1997/02/02 01:03:06 tom Exp $") +MODULE_ID("$Id: resizeterm.c,v 1.6 1998/02/11 12:13:55 tom Exp $") /* * This function reallocates NCURSES window structures. It is invoked in @@ -49,10 +61,17 @@ resizeterm(int ToLines, int ToCols) ToLines, ToCols, screen_lines, screen_columns)); + SP->_sig_winch = FALSE; + if (ToLines != screen_lines || ToCols != screen_columns) { WINDOWLIST *wp; +#if USE_SIGWINCH + ungetch(KEY_RESIZE); /* so application can know this */ + clearok(curscr, TRUE); /* screen contents is unknown */ +#endif + for (wp = _nc_windows; wp != 0; wp = wp->next) { WINDOW *win = wp->win; int myLines = win->_maxy + 1; diff --git a/ncurses/safe_sprintf.c b/ncurses/safe_sprintf.c new file mode 100644 index 00000000..6dbc8d98 --- /dev/null +++ b/ncurses/safe_sprintf.c @@ -0,0 +1,241 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1997 * + ****************************************************************************/ + +#include +#include + +MODULE_ID("$Id: safe_sprintf.c,v 1.5 1998/02/11 12:13:57 tom Exp $") + +#if USE_SAFE_SPRINTF + +typedef enum { Flags, Width, Prec, Type, Format } PRINTF; + +#define VA_INTGR(type) ival = va_arg(ap, type) +#define VA_FLOAT(type) fval = va_arg(ap, type) +#define VA_POINT(type) pval = (void *)va_arg(ap, type) + +/* + * Scan a variable-argument list for printf to determine the number of + * characters that would be emitted. + */ +static int +_nc_printf_length(const char *fmt, va_list ap) +{ + size_t length = BUFSIZ; + char *buffer; + char *format; + int len = 0; + + if (fmt == 0 || *fmt == '\0') + return -1; + if ((format = malloc(strlen(fmt)+1)) == 0) + return -1; + if ((buffer = malloc(length)) == 0) { + free(format); + return -1; + } + + while (*fmt != '\0') { + if (*fmt == '%') { + PRINTF state = Flags; + char *pval = ""; + double fval = 0.0; + int done = FALSE; + int ival = 0; + int prec = -1; + int type = 0; + int used = 0; + int width = -1; + size_t f = 0; + + format[f++] = *fmt; + while (*++fmt != '\0' && len >= 0 && !done) { + format[f++] = *fmt; + + if (isdigit(*fmt)) { + int num = *fmt - '0'; + if (state == Flags && num != 0) + state = Width; + if (state == Width) { + if (width < 0) + width = 0; + width = (width * 10) + num; + } else if (state == Prec) { + if (prec < 0) + prec = 0; + prec = (prec * 10) + num; + } + } else if (*fmt == '*') { + VA_INTGR(int); + if (state == Flags) + state = Width; + if (state == Width) { + width = ival; + } else if (state == Prec) { + prec = ival; + } + sprintf(&format[--f], "%d", ival); + f = strlen(format); + } else if (isalpha(*fmt)) { + done = TRUE; + switch (*fmt) { + case 'Z': /* FALLTHRU */ + case 'h': /* FALLTHRU */ + case 'l': /* FALLTHRU */ + case 'L': /* FALLTHRU */ + done = FALSE; + type = *fmt; + break; + case 'i': /* FALLTHRU */ + case 'd': /* FALLTHRU */ + case 'u': /* FALLTHRU */ + case 'x': /* FALLTHRU */ + case 'X': /* FALLTHRU */ + if (type == 'l') + VA_INTGR(long); + else if (type == 'Z') + VA_INTGR(size_t); + else + VA_INTGR(int); + used = 'i'; + break; + case 'f': /* FALLTHRU */ + case 'e': /* FALLTHRU */ + case 'E': /* FALLTHRU */ + case 'g': /* FALLTHRU */ + case 'G': /* FALLTHRU */ + if (type == 'L') + VA_FLOAT(long double); + else + VA_FLOAT(double); + used = 'f'; + break; + case 'c': + VA_INTGR(int); + used = 'i'; + break; + case 's': + VA_POINT(char *); + if (prec < 0) + prec = strlen(pval); + if (prec > (int)length) { + length = length + prec; + buffer = realloc(buffer, length); + if (buffer == 0) { + free(format); + return -1; + } + } + used = 'p'; + break; + case 'p': + VA_POINT(void *); + used = 'p'; + break; + case 'n': + VA_POINT(int *); + used = 0; + break; + default: + break; + } + } else if (*fmt == '.') { + state = Prec; + } else if (*fmt == '%') { + done = TRUE; + used = 'p'; + } + } + format[f] = '\0'; + switch (used) { + case 'i': + sprintf(buffer, format, ival); + break; + case 'f': + sprintf(buffer, format, fval); + break; + default: + sprintf(buffer, format, pval); + break; + } + len += (int)strlen(buffer); + } else { + fmt++; + len++; + } + } + + free(buffer); + free(format); + return len; +} +#endif + +/* + * Wrapper for vsprintf that allocates a buffer big enough to hold the result. + */ +char * +_nc_printf_string(const char *fmt, va_list ap) +{ +#if USE_SAFE_SPRINTF + char *buf = 0; + int len = _nc_printf_length(fmt, ap); + + if (len > 0) { + buf = malloc(len+1); + vsprintf(buf, fmt, ap); + } +#else + static int rows, cols; + static char *buf; + static size_t len; + + if (screen_lines > rows || screen_columns > cols) { + if (screen_lines > rows) rows = screen_lines; + if (screen_columns > cols) cols = screen_columns; + len = (rows * (cols + 1)) + 1; + if (buf == 0) + buf = malloc(len); + else + buf = realloc(buf, len); + } + + if (buf != 0) { +# if HAVE_VSNPRINTF + vsnprintf(buf, len, fmt, ap); /* GNU extension */ +# else + vsprintf(buf, fmt, ap); /* ANSI */ +# endif +#endif + } + return buf; +} diff --git a/ncurses/sigaction.c b/ncurses/sigaction.c index f3a5704c..405f5913 100644 --- a/ncurses/sigaction.c +++ b/ncurses/sigaction.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ #include @@ -28,7 +40,7 @@ #include #include -MODULE_ID("$Id: sigaction.c,v 1.6 1996/07/31 00:15:36 tom Exp $") +MODULE_ID("$Id: sigaction.c,v 1.7 1998/02/11 12:13:53 tom Exp $") int sigaction (int sig, sigaction_t * sigact, sigaction_t * osigact) diff --git a/ncurses/softscroll.c b/ncurses/softscroll.c new file mode 100644 index 00000000..160d77c5 --- /dev/null +++ b/ncurses/softscroll.c @@ -0,0 +1,257 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1997 * + ****************************************************************************/ +#include +#include + +MODULE_ID("$Id: softscroll.c,v 1.6 1998/02/11 12:13:56 tom Exp $") + +/* + * Compute indices for the given WINDOW, preparing it for scrolling. + * + * TODO (this implementation is only for proof-of-concept) + * (a) ensure that curscr's oldindex values are cached properly so we + * don't have to recompute them on each pass. + * (b) investigate if there are gains to be made by iterating newscr's + * row indices outward from the current position, rather than by + * all rows. + */ +static void compute_curscr(void) +{ + int y, x, z; + for (y = 0; y < screen_lines; y++) { + struct ldat *nline = &curscr->_line[y]; + int found = y; + for (z = 0; z < y; z++) { + int same = TRUE; + struct ldat *oline = &curscr->_line[z]; + for (x = 0; x < screen_columns; x++) { + if (nline->text[x] != oline->text[x]) { + same = FALSE; + break; + } + } + if (same) { + found = z; + break; + } + } + nline->oldindex = found; + } +} + +static void compute_newscr(void) +{ + int y, x, z; + for (y = 0; y < screen_lines; y++) { + struct ldat *nline = &newscr->_line[y]; + int found = _NEWINDEX; + for (z = 0; z < screen_lines; z++) { + int same = TRUE; + struct ldat *oline = &curscr->_line[z]; + for (x = 0; x < screen_columns; x++) { + if (nline->text[x] != oline->text[x]) { + same = FALSE; + break; + } + } + if (same) { + found = z; + break; + } + } + nline->oldindex = found; + } +} + +void +_nc_setup_scroll(void) +{ +#ifdef TRACE + if (_nc_tracing & TRACE_UPDATE) { + _tracef("_nc_setup_scroll"); + _nc_linedump(); + } +#endif /* TRACE */ + compute_curscr(); + compute_newscr(); +#ifdef TRACE + if (_nc_tracing & TRACE_UPDATE) { + _tracef("..._nc_setup_scroll"); + _nc_linedump(); + } +#endif +} + +#define MINDISP 2 +#define NEWNUM(n) newscr->_line[n].oldindex +#define OLDNUM(n) curscr->_line[n].oldindex + +/* + * This performs essentially the same function as _nc_scroll_optimize(), but + * uses different assumptions about the .oldindex values. More than one line + * may have the same .oldindex value. We don't assume the values are ordered. + * + * (Neither algorithm takes into account the cost of constructing the lines + * which are scrolled) + */ +void +_nc_perform_scroll(void) +{ + int disp; + int row; + int top, bottom, maxdisp; + int partial; + + /* + * Find the top/bottom lines that are different between curscr and + * newscr, limited by the terminal's ability to scroll portions of the + * screen. + * + * FIXME: this doesn't account for special cases of insert/delete line. + */ + if (change_scroll_region + && (scroll_forward || parm_index) + && (scroll_reverse || parm_rindex)) { + partial = TRUE; + for (row = 0, top = -1; row < screen_lines; row++) { + if (OLDNUM(row) != NEWNUM(row)) { + break; + } + top = row; + } + top++; + + for (row = screen_lines-1, bottom = screen_lines; row >= 0; row--) { + if (OLDNUM(row) != NEWNUM(row)) { + break; + } + bottom = row; + } + bottom--; + } else { + partial = FALSE; + top = 0; + bottom = screen_lines - 1; + } + + maxdisp = (bottom - top + 1) / 2; + if (maxdisp < MINDISP) + return; + + T(("_nc_perform_scroll %d..%d (maxdisp=%d)", top, bottom, maxdisp)); + + for (disp = 1; disp < maxdisp; disp++) { + int n; + int fn, fwd = 0; + int bn, bak = 0; + int first, last; + int moved; + + do { + /* check for forward-movement */ + for (fn = top + disp; fn < screen_lines - disp; fn++) { + int eql = 0; + for (n = fn, fwd = 0; n < screen_lines; n++) { + if (NEWNUM(n) == _NEWINDEX + || NEWNUM(n) != OLDNUM(n-disp)) + break; + fwd++; + if (OLDNUM(n) == NEWNUM(n)) + eql++; + } + if (eql == fwd) + fwd = 0; + if (fwd >= disp) + break; + fwd = 0; + } + + /* check for backward-movement */ + for (bn = top + disp; bn < screen_lines - disp; bn++) { + int eql = 0; + for (n = bn, bak = 0; n < screen_lines; n++) { + if (OLDNUM(n) == _NEWINDEX + || OLDNUM(n) != NEWNUM(n-disp)) + break; + bak++; + if (OLDNUM(n-disp) == NEWNUM(n-disp)) + eql++; + } + if (eql == bak) + bak = 0; + if (bak >= disp) + break; + bak = 0; + } + + /* choose only one, in case they overlap */ + if (fwd > bak) { + first = fn - disp; + last = fn + fwd - 1; + moved = -disp; + } else if (bak) { + first = bn - disp; + last = bn + bak - 1; + moved = disp; + } else { + break; + } + + TR(TRACE_UPDATE | TRACE_MOVE, ("scroll [%d, %d] by %d", first, last, moved)); + if (_nc_scrolln(moved, first, last, screen_lines - 1) == ERR) + { + TR(TRACE_UPDATE | TRACE_MOVE, ("unable to scroll")); + break; + } + + /* If the scrolled text was at one end of the range + * of changed lines, adjust the loop limits. + */ + if (first == top) + top = last + 1; + if (last == bottom) + bottom = first - 1; + + maxdisp = (bottom - top + 1) / 2; + if (maxdisp < MINDISP) + return; + + /* In any case, mark the lines so we don't try to + * use them in a subsequent scroll. + */ + for (fn = first; fn <= last; fn++) { + OLDNUM(fn) = + NEWNUM(fn) = _NEWINDEX; + } + } while (partial); + } +} diff --git a/ncurses/trace_buf.c b/ncurses/trace_buf.c new file mode 100644 index 00000000..688ee3ee --- /dev/null +++ b/ncurses/trace_buf.c @@ -0,0 +1,79 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1997 * + ****************************************************************************/ +/* + * trace_buf.c - Tracing/Debugging buffers (attributes) + */ + +#include + +MODULE_ID("$Id: trace_buf.c,v 1.3 1998/02/11 12:13:55 tom Exp $") + +char * _nc_trace_buf(int bufnum, size_t want) +{ + static struct { + char *text; + size_t size; + } *list; + static size_t have; + +#if NO_LEAKS + if (bufnum < 0) { + if (have) { + while (have--) { + free(list[have].text); + } + free(list); + } + return 0; + } +#endif + + if ((size_t)(bufnum+1) > have) { + size_t need = (bufnum + 1) * 2; + size_t used = sizeof(*list) * need; + list = (list == 0) ? malloc(used) : realloc(list, used); + while (need > have) + list[have++].text = 0; + } + + if (list[bufnum].text == 0) + { + list[bufnum].text = malloc(want); + list[bufnum].size = want; + } + else if (want > list[bufnum].size) { + list[bufnum].text = realloc(list[bufnum].text, want); + list[bufnum].size = want; + } + *(list[bufnum].text) = '\0'; + return list[bufnum].text; +} diff --git a/ncurses/tries.c b/ncurses/tries.c new file mode 100644 index 00000000..52738866 --- /dev/null +++ b/ncurses/tries.c @@ -0,0 +1,185 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1997 * + ****************************************************************************/ + +/* +** tries.c +** +** Functions to manage the tree of partial-completions for keycodes. +** +*/ + +#include + +MODULE_ID("$Id: tries.c,v 1.7 1998/02/11 12:13:57 tom Exp $") + +#define SET_TRY(dst,src) if ((dst->ch = *src++) == 128) dst->ch = '\0' +#define CMP_TRY(a,b) ((a)? (a == b) : (b == 128)) + +void _nc_add_to_try(struct tries **tree, char *str, unsigned short code) +{ + static bool out_of_memory = FALSE; + struct tries *ptr, *savedptr; + unsigned char *txt = (unsigned char *)str; + + if (txt == 0 || *txt == '\0' || out_of_memory || code == 0) + return; + + if ((*tree) != 0) { + ptr = savedptr = (*tree); + + for (;;) { + unsigned char cmp = *txt; + + while (!CMP_TRY(ptr->ch, cmp) + && ptr->sibling != 0) + ptr = ptr->sibling; + + if (CMP_TRY(ptr->ch, cmp)) { + if (*(++txt) == '\0') { + ptr->value = code; + return; + } + if (ptr->child != 0) + ptr = ptr->child; + else + break; + } else { + if ((ptr->sibling = typeCalloc(struct tries,1)) == 0) { + out_of_memory = TRUE; + return; + } + + savedptr = ptr = ptr->sibling; + SET_TRY(ptr,txt); + ptr->value = 0; + + break; + } + } /* end for (;;) */ + } else { /* (*tree) == 0 :: First sequence to be added */ + savedptr = ptr = (*tree) = typeCalloc(struct tries,1); + + if (ptr == 0) { + out_of_memory = TRUE; + return; + } + + SET_TRY(ptr,txt); + ptr->value = 0; + } + + /* at this point, we are adding to the try. ptr->child == 0 */ + + while (*txt) { + ptr->child = typeCalloc(struct tries,1); + + ptr = ptr->child; + + if (ptr == 0) { + out_of_memory = TRUE; + + while ((ptr = savedptr) != 0) { + savedptr = ptr->child; + free(ptr); + } + + return; + } + + SET_TRY(ptr,txt); + ptr->value = 0; + } + + ptr->value = code; + return; +} + +/* + * Expand a keycode into the string that it corresponds to, returning null if + * no match was found, otherwise allocating a string of the result. + */ +char *_nc_expand_try(struct tries *tree, unsigned short code, size_t len) +{ + struct tries *ptr = tree; + char *result = 0; + + if (code != 0) { + while (ptr != 0) { + if ((result = _nc_expand_try(ptr->child, code, len + 1)) != 0) { + break; + } + if (ptr->value == code) { + result = typeCalloc(char, len+2); + break; + } + ptr = ptr->sibling; + } + } + if (result != 0) { + if ((result[len] = ptr->ch) == 0) + *((unsigned char *)(result+len)) = 128; +#ifdef TRACE + if (len == 0) + _tracef("expand_key %s %s", _trace_key(code), _nc_visbuf(result)); +#endif + } + return result; +} + +/* + * Remove a code from the specified tree, freeing the unused nodes. Returns + * true if the code was found/removed. + */ +int _nc_remove_key(struct tries **tree, unsigned short code) +{ + if (code == 0) + return FALSE; + + while (*tree != 0) { + if (_nc_remove_key(&(*tree)->child, code)) { + return TRUE; + } + if ((*tree)->value == code) { + if((*tree)->child) { + /* don't cut the whole sub-tree */ + (*tree)->value = 0; + } else { + struct tries *to_free = *tree; + *tree = (*tree)->sibling; + free(to_free); + } + return TRUE; + } + tree = &(*tree)->sibling; + } + return FALSE; +} diff --git a/ncurses/wresize.c b/ncurses/wresize.c index bd96c3f3..c5b2dd9a 100644 --- a/ncurses/wresize.c +++ b/ncurses/wresize.c @@ -1,27 +1,39 @@ -/****************************************************************************** - * Copyright 1996,1997 by Thomas E. Dickey * - * All Rights Reserved. * - * * - * Permission to use, copy, modify, and distribute this software and its * - * documentation for any purpose and without fee is hereby granted, provided * - * that the above copyright notice appear in all copies and that both that * - * copyright notice and this permission notice appear in supporting * - * documentation, and that the name of the above listed copyright holder(s) * - * not be used in advertising or publicity pertaining to distribution of the * - * software without specific, written prior permission. THE ABOVE LISTED * - * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * - * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - ******************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1996,1997 * + ****************************************************************************/ #include #include -MODULE_ID("$Id: wresize.c,v 1.5 1997/02/01 23:22:54 tom Exp $") +MODULE_ID("$Id: wresize.c,v 1.9 1998/02/11 12:13:54 tom Exp $") /* * Reallocate a curses WINDOW struct to either shrink or grow to the specified @@ -45,21 +57,24 @@ static void *doalloc(void *p, size_t n) int wresize(WINDOW *win, int ToLines, int ToCols) { - register int row; - int size_x, size_y; - struct ldat *pline = (win->_flags & _SUBWIN) ? win->_parent->_line : 0; + register int row; + int size_x, size_y; + struct ldat *pline; + chtype blank; #ifdef TRACE T((T_CALLED("wresize(%p,%d,%d)"), win, ToLines, ToCols)); - TR(TRACE_UPDATE, ("...beg (%d, %d), max(%d,%d), reg(%d,%d)", - win->_begy, win->_begx, - win->_maxy, win->_maxx, - win->_regtop, win->_regbottom)); - if (_nc_tracing & TRACE_UPDATE) - _tracedump("...before", win); + if (win) { + TR(TRACE_UPDATE, ("...beg (%d, %d), max(%d,%d), reg(%d,%d)", + win->_begy, win->_begx, + win->_maxy, win->_maxx, + win->_regtop, win->_regbottom)); + if (_nc_tracing & TRACE_UPDATE) + _tracedump("...before", win); + } #endif - if (--ToLines < 0 || --ToCols < 0) + if (!win || --ToLines < 0 || --ToCols < 0) returnCode(ERR); size_x = win->_maxx; @@ -69,6 +84,8 @@ wresize(WINDOW *win, int ToLines, int ToCols) && ToCols == size_x) returnCode(OK); + pline = (win->_flags & _SUBWIN) ? win->_parent->_line : 0; + /* * If the number of lines has changed, adjust the size of the overall * vector: @@ -97,13 +114,13 @@ wresize(WINDOW *win, int ToLines, int ToCols) /* * Adjust the width of the columns: */ + blank = _nc_background(win); for (row = 0; row <= ToLines; row++) { chtype *s = win->_line[row].text; int begin = (s == 0) ? 0 : size_x + 1; int end = ToCols; - chtype blank = _nc_background(win); - win->_line[row].oldindex = row; + if_USE_SCROLL_HINTS(win->_line[row].oldindex = row); if (ToCols != size_x || s == 0) { if (! (win->_flags & _SUBWIN)) { diff --git a/ncurses/write_entry.c b/ncurses/write_entry.c index 95117128..c0b24547 100644 --- a/ncurses/write_entry.c +++ b/ncurses/write_entry.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ @@ -37,12 +49,27 @@ #define S_ISDIR(mode) ((mode & S_IFMT) == S_IFDIR) #endif -MODULE_ID("$Id: write_entry.c,v 1.16 1997/05/10 17:33:12 tom Exp $") +MODULE_ID("$Id: write_entry.c,v 1.22 1998/02/11 12:13:59 tom Exp $") static int total_written; static int write_object(FILE *, TERMTYPE *); +static void write_file(char *filename, TERMTYPE *tp) +{ + FILE *fp = fopen(filename, "wb"); + if (fp == 0) { + perror(filename); + _nc_syserr_abort("can't open %s/%s", _nc_tic_dir(0), filename); + } + DEBUG(1, ("Created %s", filename)); + + if (write_object(fp, tp) == ERR) { + _nc_syserr_abort("error writing %s/%s", _nc_tic_dir(0), filename); + } + fclose(fp); +} + /* * make_directory(char *path) * @@ -64,9 +91,9 @@ const char *destination = _nc_tic_dir(0); rc = mkdir(path, 0777); } else { if (access(path, R_OK|W_OK|X_OK) < 0) { - _nc_err_abort("%s: permission denied", fullpath); + rc = -1; /* permission denied */ } else if (!(S_ISDIR(statbuf.st_mode))) { - _nc_err_abort("%s: not a directory", fullpath); + rc = -1; /* not a directory */ } } return rc; @@ -115,6 +142,8 @@ void _nc_set_writedir(char *dir) * * Check for access rights to destination directories * Create any directories which don't exist. + * Note: there's no reason to return the result of make_directory(), since + * this function is called only in instances where that has to succeed. * */ @@ -134,7 +163,9 @@ char *s; dir[0] = code; dir[1] = '\0'; - (void) make_directory(dir); + if (make_directory(dir) < 0) { + _nc_err_abort("%s/%s: permission denied", _nc_tic_dir(0), dir); + } verified[s-dirnames] = TRUE; } @@ -164,7 +195,6 @@ char *s; void _nc_write_entry(TERMTYPE *const tp) { struct stat statbuf; -FILE *fp; char name_list[MAX_TERMINFO_LENGTH]; char *first_name, *other_names; char *ptr; @@ -228,17 +258,7 @@ static time_t start_time; /* time at start of writes */ } check_writeable(first_name[0]); - fp = fopen(filename, "w"); - if (fp == NULL) { - perror(filename); - _nc_syserr_abort("can't open %s/%s", _nc_tic_dir(0), filename); - } - DEBUG(1, ("Created %s", filename)); - - if (write_object(fp, tp) == ERR) { - _nc_syserr_abort("error writing %s/%s", _nc_tic_dir(0), filename); - } - fclose(fp); + write_file(filename, tp); if (start_time == 0) { if (stat(filename, &statbuf) < 0 @@ -272,12 +292,17 @@ static time_t start_time; /* time at start of writes */ _nc_warning("alias %s multiply defined.", ptr); } else +#if HAVE_LINK { #if USE_SYMLINKS strcpy(symlinkname, "../"); strcat(symlinkname, filename); #endif /* USE_SYMLINKS */ +#if HAVE_REMOVE + remove(linkname); +#else unlink(linkname); +#endif #if USE_SYMLINKS if (symlink(symlinkname, linkname) < 0) #else @@ -286,6 +311,9 @@ static time_t start_time; /* time at start of writes */ _nc_syserr_abort("can't link %s to %s", filename, linkname); DEBUG(1, ("Linked %s", linkname)); } +#else /* just make copies */ + write_file(linkname, tp); +#endif /* HAVE_LINK */ } } diff --git a/panel/Makefile.in b/panel/Makefile.in index e1877932..645e2108 100644 --- a/panel/Makefile.in +++ b/panel/Makefile.in @@ -1,23 +1,34 @@ -# $Id: Makefile.in,v 1.15 1997/02/15 17:10:04 tom Exp $ -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: Makefile.in,v 1.26 1998/02/11 12:14:02 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# # Makefile for panels source code. # # This makes the following: @@ -35,7 +46,7 @@ SHELL = /bin/sh THIS = Makefile MODEL = @DFT_LWR_MODEL@ -INSTALL_PREFIX = @INSTALL_PREFIX +INSTALL_PREFIX = @INSTALL_PREFIX@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -46,6 +57,7 @@ datadir = @datadir@ ticdir = $(datadir)/terminfo INSTALL = @INSTALL@ +INSTALL_LIB = @INSTALL@ @INSTALL_LIB@ INSTALL_DATA = @INSTALL_DATA@ AR = @AR@ @@ -72,9 +84,10 @@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) LINK = $(CC) LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ +SHLIB_LIST = -lncurses @SHLIB_LIST@ MK_SHARED_LIB = @MK_SHARED_LIB@ -REL_VERSION = @nc_cv_rel_version@ -ABI_VERSION = @nc_cv_abi_version@ +REL_VERSION = @cf_cv_rel_version@ +ABI_VERSION = @cf_cv_abi_version@ RANLIB = @RANLIB@ @@ -84,8 +97,13 @@ LINT = @LINT@ LINT_OPTS = @LINT_OPTS@ LINT_LIBS = -lpanel -lncurses @LIBS@ +AUTO_SRC = \ + ../include/panel.h + ################################################################################ -all :: ../include/panel.h $(LIBRARIES) +all install :: $(AUTO_SRC) $(LIBRARIES) + +sources: $(AUTO_SRC) $(INSTALL_PREFIX)$(libdir) : $(srcdir)/../mkinstalldirs $@ @@ -106,14 +124,15 @@ tags: TAGS: etags *.[ch] +mostlyclean :: + -rm -f core tags TAGS *~ *.ln *.atac trace + clean :: - -rm -f tags TAGS *~ ../include/panel.h + -rm -f $(AUTO_SRC) distclean :: clean -rm -f Makefile -mostlyclean :: clean - realclean :: distclean ############################################################################### diff --git a/panel/headers b/panel/headers index f70e2085..fa0164cd 100644 --- a/panel/headers +++ b/panel/headers @@ -1,20 +1,31 @@ -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +############################################################################## +# Copyright (c) 1998 Free 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 1996 +# $(srcdir)/panel.h diff --git a/panel/llib-lpanel b/panel/llib-lpanel index 2f0e99fa..ab75ffee 100644 --- a/panel/llib-lpanel +++ b/panel/llib-lpanel @@ -1,87 +1,108 @@ -/****************************************************************************** - * Copyright 1996 by Thomas E. Dickey * - * All Rights Reserved. * - * * - * Permission to use, copy, modify, and distribute this software and its * - * documentation for any purpose and without fee is hereby granted, provided * - * that the above copyright notice appear in all copies and that both that * - * copyright notice and this permission notice appear in supporting * - * documentation, and that the name of the above listed copyright holder(s) * - * not be used in advertising or publicity pertaining to distribution of the * - * software without specific, written prior permission. THE ABOVE LISTED * - * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * - * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - ******************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1997 * + ****************************************************************************/ /* LINTLIBRARY */ /* ./panel.c */ #include "panel.priv.h" -#undef panel_window -WINDOW *panel_window( - const PANEL *pan) - { return(*(WINDOW **)0); } - -#undef update_panels -void update_panels(void) +#undef _nc_free_obscure +void _nc_free_obscure( + PANEL *pan) { /* void */ } -#undef hide_panel -int hide_panel( - PANEL *pan) - { return(*(int *)0); } - -#undef show_panel -int show_panel( - PANEL *pan) - { return(*(int *)0); } +#undef _nc_override +void _nc_override( + const PANEL *pan, + int show) + { /* void */ } -#undef top_panel -int top_panel( - PANEL *pan) - { return(*(int *)0); } +#undef _nc_calculate_obscure +void _nc_calculate_obscure(void) + { /* void */ } -#undef del_panel -int del_panel( - PANEL *pan) - { return(*(int *)0); } +#undef _nc_panel_is_linked +bool _nc_panel_is_linked( + const PANEL *pan) + { return(*(bool *)0); } -#undef bottom_panel -int bottom_panel( - PANEL *pan) - { return(*(int *)0); } +#undef _nc_panel_link_bottom +void _nc_panel_link_bottom( + PANEL *pan) + { /* void */ } -#undef new_panel -PANEL *new_panel( - WINDOW *win) - { return(*(PANEL **)0); } +/* ./p_above.c */ #undef panel_above PANEL *panel_above( const PANEL *pan) { return(*(PANEL **)0); } +/* ./p_below.c */ + #undef panel_below PANEL *panel_below( const PANEL *pan) { return(*(PANEL **)0); } -#undef set_panel_userptr -int set_panel_userptr( - PANEL *pan, - const void *uptr) +/* ./p_bottom.c */ + +#undef bottom_panel +int bottom_panel( + PANEL *pan) { return(*(int *)0); } -#undef panel_userptr -const void *panel_userptr( +/* ./p_delete.c */ + +#undef del_panel +int del_panel( + PANEL *pan) + { return(*(int *)0); } + +/* ./p_hide.c */ + +#undef hide_panel +int hide_panel( + PANEL *pan) + { return(*(int *)0); } + +/* ./p_hidden.c */ + +#undef panel_hidden +int panel_hidden( const PANEL *pan) - { return(*(const void **)0); } + { return(*(int *)0); } + +/* ./p_move.c */ #undef move_panel int move_panel( @@ -90,13 +111,57 @@ int move_panel( int startx) { return(*(int *)0); } +/* ./p_new.c */ + +#undef new_panel +PANEL *new_panel( + WINDOW *win) + { return(*(PANEL **)0); } + +/* ./p_replace.c */ + #undef replace_panel int replace_panel( PANEL *pan, WINDOW *win) { return(*(int *)0); } -#undef panel_hidden -int panel_hidden( - const PANEL *pan) +/* ./p_show.c */ + +#undef show_panel +int show_panel( + PANEL *pan) { return(*(int *)0); } + +/* ./p_top.c */ + +#undef top_panel +int top_panel( + PANEL *pan) + { return(*(int *)0); } + +/* ./p_update.c */ + +#undef update_panels +void update_panels(void) + { /* void */ } + +/* ./p_user.c */ + +#undef set_panel_userptr +int set_panel_userptr( + PANEL *pan, + void *uptr) + { return(*(int *)0); } + +#undef panel_userptr +void *panel_userptr( + const PANEL *pan) + { return(*(void **)0); } + +/* ./p_win.c */ + +#undef panel_window +WINDOW *panel_window( + const PANEL *pan) + { return(*(WINDOW **)0); } diff --git a/panel/modules b/panel/modules index 9e979f74..ed51d2c1 100644 --- a/panel/modules +++ b/panel/modules @@ -1,21 +1,49 @@ -################################################################################ -# Copyright 1995 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +############################################################################## +# Copyright (c) 1998 Free 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 1995,1997 +# + +@ base # Library objects panel lib $(srcdir) $(PANEL_PRIV_H) +p_above lib $(srcdir) $(PANEL_PRIV_H) +p_below lib $(srcdir) $(PANEL_PRIV_H) +p_bottom lib $(srcdir) $(PANEL_PRIV_H) +p_delete lib $(srcdir) $(PANEL_PRIV_H) +p_hide lib $(srcdir) $(PANEL_PRIV_H) +p_hidden lib $(srcdir) $(PANEL_PRIV_H) +p_move lib $(srcdir) $(PANEL_PRIV_H) +p_new lib $(srcdir) $(PANEL_PRIV_H) +p_replace lib $(srcdir) $(PANEL_PRIV_H) +p_show lib $(srcdir) $(PANEL_PRIV_H) +p_top lib $(srcdir) $(PANEL_PRIV_H) +p_update lib $(srcdir) $(PANEL_PRIV_H) +p_user lib $(srcdir) $(PANEL_PRIV_H) +p_win lib $(srcdir) $(PANEL_PRIV_H) + diff --git a/panel/p_above.c b/panel/p_above.c new file mode 100644 index 00000000..0c3d10fc --- /dev/null +++ b/panel/p_above.c @@ -0,0 +1,51 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* p_above.c + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_above.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +PANEL* +panel_above(const PANEL *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(_nc_bottom_panel==_nc_top_panel ? (PANEL*)0 : _nc_bottom_panel->above); + } + else + return(pan->above); +} diff --git a/panel/p_below.c b/panel/p_below.c new file mode 100644 index 00000000..7e0f2b24 --- /dev/null +++ b/panel/p_below.c @@ -0,0 +1,53 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* p_below.c + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_below.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +PANEL* +panel_below(const PANEL *pan) +{ + if(!pan) + { + /* if top and bottom are equal, we have no or only the pseudo panel */ + return(_nc_top_panel==_nc_bottom_panel ? (PANEL*)0 : _nc_top_panel); + } + else + { + /* we must not return the pseudo panel */ + return(pan->below==_nc_bottom_panel ? (PANEL*) 0 : pan->below); + } +} diff --git a/panel/p_bottom.c b/panel/p_bottom.c new file mode 100644 index 00000000..47abc694 --- /dev/null +++ b/panel/p_bottom.c @@ -0,0 +1,53 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* p_bottom.c + * Place a panel on bottom of the stack; may already be in the stack + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_bottom.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +int +bottom_panel(PANEL *pan) +{ + if(!pan) + return(ERR); + if(pan == _nc_bottom_panel) + return(OK); + dBug(("--> bottom_panel %s", USER_PTR(pan->user))); + if(_nc_panel_is_linked(pan)) + (void)hide_panel(pan); + _nc_panel_link_bottom(pan); + return(OK); +} diff --git a/panel/p_delete.c b/panel/p_delete.c new file mode 100644 index 00000000..aabccdc4 --- /dev/null +++ b/panel/p_delete.c @@ -0,0 +1,53 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* p_delete.c + * Remove a panel from stack, if in it, and free struct + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_delete.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +int +del_panel(PANEL *pan) +{ + if(pan) + { + dBug(("--> del_panel %s", USER_PTR(pan->user))); + if(_nc_panel_is_linked(pan)) + (void)hide_panel(pan); + free((void *)pan); + return(OK); + } + return(ERR); +} diff --git a/panel/p_hidden.c b/panel/p_hidden.c new file mode 100644 index 00000000..4b90a619 --- /dev/null +++ b/panel/p_hidden.c @@ -0,0 +1,47 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* p_hidden.c + * Test whether or not panel is hidden + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_hidden.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +int +panel_hidden(const PANEL *pan) +{ + if(!pan) + return(ERR); + return(_nc_panel_is_linked(pan) ? TRUE : FALSE); +} diff --git a/panel/p_hide.c b/panel/p_hide.c new file mode 100644 index 00000000..bc7c1921 --- /dev/null +++ b/panel/p_hide.c @@ -0,0 +1,99 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* p_hide.c + * Remove a panel from the stack + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_hide.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +/*+------------------------------------------------------------------------- + __panel_unlink(pan) - unlink panel from stack +--------------------------------------------------------------------------*/ +static void +__panel_unlink(PANEL *pan) +{ + PANEL *prev; + PANEL *next; + +#ifdef TRACE + dStack("",1,pan); + if(!_nc_panel_is_linked(pan)) + return; +#endif + + _nc_override(pan,P_TOUCH); + _nc_free_obscure(pan); + + prev = pan->below; + next = pan->above; + + if(prev) + { /* if non-zero, we will not update the list head */ + prev->above = next; + if(next) + next->below = prev; + } + else if(next) + next->below = prev; + if(pan == _nc_bottom_panel) + _nc_bottom_panel = next; + if(pan == _nc_top_panel) + _nc_top_panel = prev; + + _nc_calculate_obscure(); + + pan->above = (PANEL *)0; + pan->below = (PANEL *)0; + dStack("",9,pan); +} + +int +hide_panel(register PANEL *pan) +{ + if(!pan) + return(ERR); + + dBug(("--> hide_panel %s", USER_PTR(pan->user))); + + if(!_nc_panel_is_linked(pan)) + { + pan->above = (PANEL *)0; + pan->below = (PANEL *)0; + return(ERR); + } + + __panel_unlink(pan); + return(OK); +} diff --git a/panel/p_move.c b/panel/p_move.c new file mode 100644 index 00000000..6bec36b9 --- /dev/null +++ b/panel/p_move.c @@ -0,0 +1,59 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* p_move.c + * Move a panel to a new location + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_move.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +int +move_panel(PANEL *pan, int starty, int startx) +{ + WINDOW *win; + + if(!pan) + return(ERR); + if(_nc_panel_is_linked(pan)) + _nc_override(pan,P_TOUCH); + win = pan->win; + if(mvwin(win,starty,startx)) + return(ERR); + getbegyx(win, pan->wstarty, pan->wstartx); + pan->wendy = pan->wstarty + getmaxy(win); + pan->wendx = pan->wstartx + getmaxx(win); + if(_nc_panel_is_linked(pan)) + _nc_calculate_obscure(); + return(OK); +} diff --git a/panel/p_new.c b/panel/p_new.c new file mode 100644 index 00000000..b4acc279 --- /dev/null +++ b/panel/p_new.c @@ -0,0 +1,99 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* p_new.c + * Creation of a new panel + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_new.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +/*+------------------------------------------------------------------------- + Get root (i.e. stdscr's) panel. + Establish the pseudo panel for stdscr if necessary. +--------------------------------------------------------------------------*/ +static PANEL* +root_panel(void) +{ + 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; + getbegyx(win, pan->wstarty, pan->wstartx); + pan->wendy = pan->wstarty + getmaxy(win); + pan->wendx = pan->wstartx + getmaxx(win); + pan->below = (PANEL*)0; + pan->above = (PANEL*)0; + pan->obscure = (PANELCONS*)0; +#ifdef TRACE + pan->user = "stdscr"; +#else + pan->user = (void*)0; +#endif + _nc_panel_link_bottom(pan); + } + } + return _nc_stdscr_pseudo_panel; +} + +PANEL * +new_panel(WINDOW *win) +{ + PANEL *pan = (PANEL*)0; + + (void)root_panel(); + assert(_nc_stdscr_pseudo_panel); + + if (!(win->_flags & _ISPAD) && (pan = (PANEL*)malloc(sizeof(PANEL)))) + { + pan->win = win; + pan->above = (PANEL *)0; + pan->below = (PANEL *)0; + getbegyx(win, pan->wstarty, pan->wstartx); + pan->wendy = pan->wstarty + getmaxy(win); + pan->wendx = pan->wstartx + getmaxx(win); +#ifdef TRACE + pan->user = "new"; +#else + pan->user = (char *)0; +#endif + pan->obscure = (PANELCONS *)0; + (void)show_panel(pan); + } + return(pan); +} diff --git a/panel/p_replace.c b/panel/p_replace.c new file mode 100644 index 00000000..c34d51d3 --- /dev/null +++ b/panel/p_replace.c @@ -0,0 +1,52 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* p_replace.c + * Replace a panels window. + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_replace.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +int +replace_panel(PANEL *pan, WINDOW *win) +{ + if(!pan) + return(ERR); + if(_nc_panel_is_linked(pan)) + _nc_override(pan,P_TOUCH); + pan->win = win; + if(_nc_panel_is_linked(pan)) + _nc_calculate_obscure(); + return(OK); +} diff --git a/panel/p_show.c b/panel/p_show.c new file mode 100644 index 00000000..10781efb --- /dev/null +++ b/panel/p_show.c @@ -0,0 +1,76 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* p_show.c + * Place a panel on top of the stack; may already be in the stack + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_show.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +static void +panel_link_top(PANEL *pan) +{ +#ifdef TRACE + dStack("",1,pan); + if(_nc_panel_is_linked(pan)) + return; +#endif + + pan->above = (PANEL *)0; + pan->below = (PANEL *)0; + if(_nc_top_panel) + { + _nc_top_panel->above = pan; + pan->below = _nc_top_panel; + } + _nc_top_panel = pan; + if(!_nc_bottom_panel) + _nc_bottom_panel = pan; + _nc_calculate_obscure(); + dStack("",9,pan); +} + +int +show_panel(PANEL *pan) +{ + if(!pan) + return(ERR); + if(pan == _nc_top_panel) + return(OK); + dBug(("--> show_panel %s", USER_PTR(pan->user))); + if(_nc_panel_is_linked(pan)) + (void)hide_panel(pan); + panel_link_top(pan); + return(OK); +} diff --git a/panel/p_top.c b/panel/p_top.c new file mode 100644 index 00000000..2ce5bb3e --- /dev/null +++ b/panel/p_top.c @@ -0,0 +1,45 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* p_top.c + * Place a panel on top of the stack. + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_top.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +int +top_panel(PANEL *pan) +{ + return(show_panel(pan)); +} diff --git a/panel/p_update.c b/panel/p_update.c new file mode 100644 index 00000000..e7e31ef6 --- /dev/null +++ b/panel/p_update.c @@ -0,0 +1,61 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* p_update.c + * wnoutrefresh windows in an orderly fashion + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_update.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +void +update_panels(void) +{ + PANEL *pan; + + dBug(("--> update_panels")); + pan = _nc_bottom_panel; + while(pan) + { + _nc_override(pan,P_UPDATE); + pan = pan->above; + } + + pan = _nc_bottom_panel; + while (pan) + { + if (is_wintouched(pan->win)) + Wnoutrefresh(pan); + pan = pan->above; + } +} diff --git a/panel/p_user.c b/panel/p_user.c new file mode 100644 index 00000000..28b6526b --- /dev/null +++ b/panel/p_user.c @@ -0,0 +1,55 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* p_user.c + * Set/Get panels user pointer + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_user.c,v 1.3 1998/02/11 12:14:01 tom Exp $") + +int +set_panel_userptr(PANEL *pan, NCURSES_CONST void *uptr) +{ + if(!pan) + return(ERR); + pan->user = uptr; + return(OK); +} + +NCURSES_CONST void* +panel_userptr(const PANEL *pan) +{ + return(pan ? pan->user : (NCURSES_CONST void *)0); +} + diff --git a/panel/p_win.c b/panel/p_win.c new file mode 100644 index 00000000..9c5a313d --- /dev/null +++ b/panel/p_win.c @@ -0,0 +1,49 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* p_win.c + * Return a panels window. + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_win.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +WINDOW* +panel_window(const PANEL *pan) +{ + return(pan ? pan->win : (WINDOW *)0); +} + + + + diff --git a/panel/panel.c b/panel/panel.c index fdc6e564..c90ad4f5 100644 --- a/panel/panel.c +++ b/panel/panel.c @@ -1,37 +1,44 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* panels is copyright (C) 1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* All praise to the original author, Warren Tucker. * -* * -* Permission is hereby granted to reproduce and distribute panels * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of panels in any * -* applications linked with it is highly appreciated. * -* * -* panels comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ - -/* panel.c -- implementation of panels library */ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* panel.c -- implementation of panels library, some core routines */ #include "panel.priv.h" -MODULE_ID("$Id: panel.c,v 1.10 1997/05/05 09:42:11 tom Exp $") +MODULE_ID("$Id: panel.c,v 1.15 1998/02/11 12:14:01 tom Exp $") #ifdef TRACE -extern char *_nc_visbuf(const char *); -#ifdef TRACE_TXT -#define USER_PTR(ptr) _nc_visbuf((const char *)ptr) -#else -static char *my_nc_visbuf(const void *ptr) +#ifndef TRACE_TXT +const char *_nc_my_visbuf(const void *ptr) { char temp[20]; if (ptr != 0) @@ -40,107 +47,85 @@ static char *my_nc_visbuf(const void *ptr) strcpy(temp, ""); return _nc_visbuf(temp); } -#define USER_PTR(ptr) my_nc_visbuf((const char *)ptr) #endif #endif -static PANEL *__bottom_panel = (PANEL *)0; -static PANEL *__top_panel = (PANEL *)0; - -static PANEL __stdscr_pseudo_panel = { (WINDOW *)0, - 0,0,0,0, - (PANEL *)0, (PANEL *)0, - (void *)0, - (PANELCONS *)0 }; - -/* Prototypes */ -static void __panel_link_bottom(PANEL *pan); /*+------------------------------------------------------------------------- dPanel(text,pan) --------------------------------------------------------------------------*/ #ifdef TRACE -static void -dPanel(const char *text, const PANEL *pan) +void +_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) : "--", pan->wstarty, pan->wstartx); -} /* end of dPanel */ -#else -# define dPanel(text,pan) +} #endif /*+------------------------------------------------------------------------- dStack(fmt,num,pan) --------------------------------------------------------------------------*/ #ifdef TRACE -static void -dStack(const char *fmt, int num, const PANEL *pan) +void +_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, - (__bottom_panel) ? USER_PTR(__bottom_panel->user) : "--", - (__top_panel) ? USER_PTR(__top_panel->user) : "--"); + (_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 = __bottom_panel; + pan = _nc_bottom_panel; while(pan) { dPanel("stk",pan); pan = pan->above; } -} /* end of dStack */ -#else -# define dStack(fmt,num,pan) +} #endif /*+------------------------------------------------------------------------- Wnoutrefresh(pan) - debugging hook for wnoutrefresh --------------------------------------------------------------------------*/ #ifdef TRACE -static void -Wnoutrefresh(const PANEL *pan) +void +_nc_Wnoutrefresh(const PANEL *pan) { dPanel("wnoutrefresh",pan); wnoutrefresh(pan->win); -} /* end of Wnoutrefresh */ -#else -# define Wnoutrefresh(pan) wnoutrefresh((pan)->win) +} #endif /*+------------------------------------------------------------------------- Touchpan(pan) --------------------------------------------------------------------------*/ #ifdef TRACE -static void -Touchpan(const PANEL *pan) +void +_nc_Touchpan(const PANEL *pan) { dPanel("Touchpan",pan); touchwin(pan->win); -} /* end of Touchpan */ -#else -# define Touchpan(pan) touchwin((pan)->win) +} #endif /*+------------------------------------------------------------------------- Touchline(pan,start,count) --------------------------------------------------------------------------*/ #ifdef TRACE -static void -Touchline(const PANEL *pan, int start, int count) +void +_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); -} /* end of Touchline */ -#else -# define Touchline(pan,start,count) touchline((pan)->win,start,count) +} #endif /*+------------------------------------------------------------------------- @@ -151,24 +136,25 @@ __panels_overlapped(register const PANEL *pan1, register const PANEL *pan2) { if(!pan1 || !pan2) return(FALSE); + dBug(("__panels_overlapped %s %s", USER_PTR(pan1->user), USER_PTR(pan2->user))); /* pan1 intersects with pan2 ? */ - if((pan1->wstarty >= pan2->wstarty) && (pan1->wstarty < pan2->wendy) && - (pan1->wstartx >= pan2->wstartx) && (pan1->wstartx < pan2->wendx)) - return(TRUE); - /* or vice versa test */ - if((pan2->wstarty >= pan1->wstarty) && (pan2->wstarty < pan1->wendy) && - (pan2->wstartx >= pan1->wstartx) && (pan2->wstartx < pan1->wendx)) - return(TRUE); - dBug((" no")); - return(FALSE); -} /* end of __panels_overlapped */ + if( (((pan1->wstarty >= pan2->wstarty) && (pan1->wstarty < pan2->wendy)) || + ((pan2->wstarty >= pan1->wstarty) && (pan2->wstarty < pan1->wendy))) && + (((pan1->wstartx >= pan2->wstartx) && (pan1->wstartx < pan2->wendx)) || + ((pan2->wstartx >= pan1->wstartx) && (pan2->wstartx < pan1->wendx))) + ) return(TRUE); + else { + dBug((" no")); + return(FALSE); + } +} /*+------------------------------------------------------------------------- - __free_obscure(pan) + _nc_free_obscure(pan) --------------------------------------------------------------------------*/ -static INLINE void -__free_obscure(PANEL *pan) +void +_nc_free_obscure(PANEL *pan) { PANELCONS *tobs = pan->obscure; /* "this" one */ PANELCONS *nobs; /* "next" one */ @@ -180,40 +166,19 @@ __free_obscure(PANEL *pan) tobs = nobs; } pan->obscure = (PANELCONS *)0; -} /* end of __free_obscure */ - -/*+------------------------------------------------------------------------- - Get root (i.e. stdscr's) panel. - Establish the pseudo panel for stdscr if necessary. ---------------------------------------------------------------------------*/ -static PANEL* -__root_panel(void) -{ - if(!__stdscr_pseudo_panel.win) - { /* initialize those fields not already statically initialized */ - assert(stdscr && !__bottom_panel && !__top_panel); - __stdscr_pseudo_panel.win = stdscr; - __stdscr_pseudo_panel.wendy = LINES; - __stdscr_pseudo_panel.wendx = COLS; -#ifdef TRACE - __stdscr_pseudo_panel.user = "stdscr"; -#endif - __panel_link_bottom(&__stdscr_pseudo_panel); - } - return &__stdscr_pseudo_panel; } /*+------------------------------------------------------------------------- __override(pan,show) --------------------------------------------------------------------------*/ -static void -__override(const PANEL *pan, int show) +void +_nc_override(const PANEL *pan, int show) { int y; PANEL *pan2; PANELCONS *tobs = pan->obscure; /* "this" one */ - dBug(("__override %s,%d", USER_PTR(pan->user),show)); + dBug(("_nc_override %s,%d", USER_PTR(pan->user),show)); switch (show) { @@ -250,27 +215,27 @@ __override(const PANEL *pan, int show) } tobs = tobs->above; } -} /* end of __override */ +} /*+------------------------------------------------------------------------- __calculate_obscure() --------------------------------------------------------------------------*/ -static void -__calculate_obscure(void) +void +_nc_calculate_obscure(void) { PANEL *pan; PANEL *pan2; PANELCONS *tobs; /* "this" one */ PANELCONS *lobs = (PANELCONS *)0; /* last one */ - pan = __bottom_panel; + pan = _nc_bottom_panel; while(pan) { if(pan->obscure) - __free_obscure(pan); + _nc_free_obscure(pan); dBug(("--> __calculate_obscure %s", USER_PTR(pan->user))); lobs = (PANELCONS *)0; /* last one */ - pan2 = __bottom_panel; + pan2 = _nc_bottom_panel; /* This loop builds a list of panels obsured by pan or obscuring pan; pan itself is in the list; all panels before pan are obscured by pan, all panels after pan are obscuring pan. */ @@ -291,374 +256,53 @@ __calculate_obscure(void) } pan2 = pan2->above; } - __override(pan,P_TOUCH); + _nc_override(pan,P_TOUCH); pan = pan->above; } -} /* end of __calculate_obscure */ +} /*+------------------------------------------------------------------------- - __panel_is_linked(pan) - check to see if panel is in the stack + _nc_panel_is_linked(pan) - check to see if panel is in the stack --------------------------------------------------------------------------*/ -static INLINE bool -__panel_is_linked(const PANEL *pan) +bool +_nc_panel_is_linked(const PANEL *pan) { /* This works! The only case where it would fail is, when the list has only one element. But this could only be the pseudo panel at the bottom */ return ( ((pan->above!=(PANEL *)0) || (pan->below!=(PANEL *)0) || - (pan==__bottom_panel)) ? TRUE : FALSE ); -} /* end of __panel_is_linked */ - -/*+------------------------------------------------------------------------- - __panel_link_top(pan) - link panel into stack at top ---------------------------------------------------------------------------*/ -static void -__panel_link_top(PANEL *pan) -{ -#ifdef TRACE - dStack("",1,pan); - if(__panel_is_linked(pan)) - return; -#endif - - pan->above = (PANEL *)0; - pan->below = (PANEL *)0; - if(__top_panel) - { - __top_panel->above = pan; - pan->below = __top_panel; - } - __top_panel = pan; - if(!__bottom_panel) - __bottom_panel = pan; - __calculate_obscure(); - dStack("",9,pan); + (pan==_nc_bottom_panel)) ? TRUE : FALSE ); +} -} /* end of __panel_link_top */ /*+------------------------------------------------------------------------- __panel_link_bottom(pan) - link panel into stack at bottom --------------------------------------------------------------------------*/ -static void -__panel_link_bottom(PANEL *pan) +void +_nc_panel_link_bottom(PANEL *pan) { #ifdef TRACE dStack("",1,pan); - if(__panel_is_linked(pan)) + if(_nc_panel_is_linked(pan)) return; #endif pan->above = (PANEL *)0; pan->below = (PANEL *)0; - if(__bottom_panel) + if(_nc_bottom_panel) { /* the stdscr pseudo panel always stays real bottom; so we insert after bottom panel*/ - pan->below = __bottom_panel; - pan->above = __bottom_panel->above; + pan->below = _nc_bottom_panel; + pan->above = _nc_bottom_panel->above; if (pan->above) pan->above->below = pan; - __bottom_panel->above = pan; + _nc_bottom_panel->above = pan; } else - __bottom_panel = pan; - if(!__top_panel) - __top_panel = pan; - assert(__bottom_panel == &__stdscr_pseudo_panel); - __calculate_obscure(); + _nc_bottom_panel = pan; + if(!_nc_top_panel) + _nc_top_panel = pan; + assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel); + _nc_calculate_obscure(); dStack("",9,pan); -} /* end of __panel_link_bottom */ - -/*+------------------------------------------------------------------------- - __panel_unlink(pan) - unlink panel from stack ---------------------------------------------------------------------------*/ -static void -__panel_unlink(PANEL *pan) -{ - PANEL *prev; - PANEL *next; - -#ifdef TRACE - dStack("",1,pan); - if(!__panel_is_linked(pan)) - return; -#endif - - __override(pan,P_TOUCH); - __free_obscure(pan); - - prev = pan->below; - next = pan->above; - - if(prev) - { /* if non-zero, we will not update the list head */ - prev->above = next; - if(next) - next->below = prev; - } - else if(next) - next->below = prev; - if(pan == __bottom_panel) - __bottom_panel = next; - if(pan == __top_panel) - __top_panel = prev; - - __calculate_obscure(); - - pan->above = (PANEL *)0; - pan->below = (PANEL *)0; - dStack("",9,pan); -} /* end of __panel_unlink */ - -/*+------------------------------------------------------------------------- - panel_window(pan) - get window associated with panel ---------------------------------------------------------------------------*/ -WINDOW * -panel_window(const PANEL *pan) -{ - return(pan ? pan->win : (WINDOW *)0); -} /* end of panel_window */ - -/*+------------------------------------------------------------------------- - update_panels() - wnoutrefresh windows in an orderly fashion ---------------------------------------------------------------------------*/ -void -update_panels(void) -{ - PANEL *pan; - - dBug(("--> update_panels")); - pan = __bottom_panel; - while(pan) - { - __override(pan,P_UPDATE); - pan = pan->above; - } - - pan = __bottom_panel; - while (pan) - { - if(is_wintouched(pan->win)) - Wnoutrefresh(pan); - pan = pan->above; - } -} /* end of update_panels */ - -/*+------------------------------------------------------------------------- - hide_panel(pan) - remove a panel from stack ---------------------------------------------------------------------------*/ -int -hide_panel(register PANEL *pan) -{ - if(!pan) - return(ERR); - - dBug(("--> hide_panel %s", USER_PTR(pan->user))); - - if(!__panel_is_linked(pan)) - { - pan->above = (PANEL *)0; - pan->below = (PANEL *)0; - return(ERR); - } - - __panel_unlink(pan); - return(OK); -} /* end of hide_panel */ - -/*+------------------------------------------------------------------------- - show_panel(pan) - place a panel on top of stack -may already be in stack ---------------------------------------------------------------------------*/ -int -show_panel(register PANEL *pan) -{ - if(!pan) - return(ERR); - if(pan == __top_panel) - return(OK); - dBug(("--> show_panel %s", USER_PTR(pan->user))); - if(__panel_is_linked(pan)) - (void)hide_panel(pan); - __panel_link_top(pan); - return(OK); -} /* end of show_panel */ - -/*+------------------------------------------------------------------------- - top_panel(pan) - place a panel on top of stack ---------------------------------------------------------------------------*/ -int -top_panel(register PANEL *pan) -{ - return(show_panel(pan)); -} /* end of top_panel */ - -/*+------------------------------------------------------------------------- - del_panel(pan) - remove a panel from stack, if in it, and free struct ---------------------------------------------------------------------------*/ -int -del_panel(register PANEL *pan) -{ - if(pan) - { - dBug(("--> del_panel %s", USER_PTR(pan->user))); - if(__panel_is_linked(pan)) - (void)hide_panel(pan); - free((void *)pan); - return(OK); - } - return(ERR); -} /* end of del_panel */ - -/*+------------------------------------------------------------------------- - bottom_panel(pan) - place a panel on bottom of stack -may already be in stack ---------------------------------------------------------------------------*/ -int -bottom_panel(register PANEL *pan) -{ - if(!pan) - return(ERR); - if(pan == __bottom_panel) - return(OK); - dBug(("--> bottom_panel %s", USER_PTR(pan->user))); - if(__panel_is_linked(pan)) - (void)hide_panel(pan); - __panel_link_bottom(pan); - return(OK); -} /* end of bottom_panel */ - -/*+------------------------------------------------------------------------- - new_panel(win) - create a panel and place on top of stack ---------------------------------------------------------------------------*/ -PANEL * -new_panel(WINDOW *win) -{ - PANEL *pan = (PANEL *)malloc(sizeof(PANEL)); - - (void)__root_panel(); - - if(pan) - { - pan->win = win; - pan->above = (PANEL *)0; - pan->below = (PANEL *)0; - getbegyx(win, pan->wstarty, pan->wstartx); - pan->wendy = pan->wstarty + getmaxy(win); - pan->wendx = pan->wstartx + getmaxx(win); -#ifdef TRACE - pan->user = "new"; -#else - pan->user = (char *)0; -#endif - pan->obscure = (PANELCONS *)0; - (void)show_panel(pan); - } - return(pan); -} /* end of new_panel */ - -/*+------------------------------------------------------------------------- - panel_above(pan) ---------------------------------------------------------------------------*/ -PANEL * -panel_above(const PANEL *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(__bottom_panel==__top_panel ? (PANEL*)0 : __bottom_panel->above); - } - else - return(pan->above); -} /* end of panel_above */ - -/*+------------------------------------------------------------------------- - panel_below(pan) ---------------------------------------------------------------------------*/ -PANEL * -panel_below(const PANEL *pan) -{ - if(!pan) - { - /* if top and bottom are equal, we have no or only the pseudo panel */ - return(__top_panel==__bottom_panel ? (PANEL*)0 : __top_panel); - } - else - { - /* we must not return the pseudo panel */ - return(pan->below==__bottom_panel ? (PANEL*) 0 : pan->below); - } -} /* end of panel_below */ - -/*+------------------------------------------------------------------------- - set_panel_userptr(pan,uptr) ---------------------------------------------------------------------------*/ -int -set_panel_userptr(PANEL *pan, const void *uptr) -{ - if(!pan) - return(ERR); - pan->user = uptr; - return(OK); -} /* end of set_panel_userptr */ - -/*+------------------------------------------------------------------------- - panel_userptr(pan) ---------------------------------------------------------------------------*/ -const void* -panel_userptr(const PANEL *pan) -{ - return(pan ? pan->user : (void *)0); -} /* end of panel_userptr */ - -/*+------------------------------------------------------------------------- - move_panel(pan,starty,startx) ---------------------------------------------------------------------------*/ -int -move_panel(PANEL *pan, int starty, int startx) -{ - WINDOW *win; - - if(!pan) - return(ERR); - if(__panel_is_linked(pan)) - __override(pan,P_TOUCH); - win = pan->win; - if(mvwin(win,starty,startx)) - return(ERR); - getbegyx(win, pan->wstarty, pan->wstartx); - pan->wendy = pan->wstarty + getmaxy(win); - pan->wendx = pan->wstartx + getmaxx(win); - if(__panel_is_linked(pan)) - __calculate_obscure(); - return(OK); -} /* end of move_panel */ - -/*+------------------------------------------------------------------------- - replace_panel(pan,win) ---------------------------------------------------------------------------*/ -int -replace_panel(PANEL *pan, WINDOW *win) -{ - if(!pan) - return(ERR); - if(__panel_is_linked(pan)) - __override(pan,P_TOUCH); - pan->win = win; - if(__panel_is_linked(pan)) - __calculate_obscure(); - return(OK); -} /* end of replace_panel */ - -/*+------------------------------------------------------------------------- - panel_hidden(pan) ---------------------------------------------------------------------------*/ -int -panel_hidden(const PANEL *pan) -{ - if(!pan) - return(ERR); - return(__panel_is_linked(pan) ? TRUE : FALSE); -} /* end of panel_hidden */ - -/* end of panel.c */ +} diff --git a/panel/panel.h b/panel/panel.h index 2f917827..2ebc3292 100644 --- a/panel/panel.h +++ b/panel/panel.h @@ -1,25 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* panels is copyright (C) 1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* All praise to the original author, Warren Tucker. * -* * -* Permission is hereby granted to reproduce and distribute panels * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of panels in any * -* applications linked with it is highly appreciated. * -* * -* panels comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* panel.h -- interface file for panels library */ @@ -37,7 +47,7 @@ typedef struct panel int wendx; struct panel *below; struct panel *above; - const void *user; + NCURSES_CONST void *user; struct panelcons *obscure; } PANEL; @@ -56,8 +66,8 @@ extern int bottom_panel(PANEL *); extern PANEL *new_panel(WINDOW *); extern PANEL *panel_above(const PANEL *); extern PANEL *panel_below(const PANEL *); -extern int set_panel_userptr(PANEL *,const void *); -extern const void* panel_userptr(const PANEL *); +extern int set_panel_userptr(PANEL *, NCURSES_CONST void *); +extern NCURSES_CONST void* panel_userptr(const PANEL *); extern int move_panel(PANEL *, int, int); extern int replace_panel(PANEL *,WINDOW *); extern int panel_hidden(const PANEL *); diff --git a/panel/panel.priv.h b/panel/panel.priv.h index 0e6fa591..80b1d8f9 100644 --- a/panel/panel.priv.h +++ b/panel/panel.priv.h @@ -1,4 +1,4 @@ -/* $Id: panel.priv.h,v 1.4 1997/04/05 23:38:02 tom Exp $ */ +/* $Id: panel.priv.h,v 1.8 1997/10/21 10:19:37 juergen Exp $ */ #ifndef _PANEL_PRIV_H #define _PANEL_PRIV_H @@ -8,45 +8,78 @@ #endif #include +#include #include #if HAVE_LIBDMALLOC -#include /* Gray Watson's library */ +# include /* Gray Watson's library */ #endif #if HAVE_LIBDBMALLOC -#include /* Conor Cahill's library */ +# include /* Conor Cahill's library */ #endif +#include #include "panel.h" - #if ( CC_HAS_INLINE_FUNCS && !defined(TRACE) ) # define INLINE inline #else # define INLINE #endif - typedef struct panelcons { struct panelcons *above; struct panel *pan; } PANELCONS; -#ifdef TRACE -# define dBug(x) _tracef x -#else -# define dBug(x) -#endif - #ifdef USE_RCS_IDS -#define MODULE_ID(id) static const char Ident[] = id; +# define MODULE_ID(id) static const char Ident[] = id; #else -#define MODULE_ID(id) /*nothing*/ +# define MODULE_ID(id) /*nothing*/ #endif #define P_TOUCH (0) #define P_UPDATE (1) +#ifdef TRACE + extern const char *_nc_my_visbuf(const void *); +# ifdef TRACE_TXT +# define USER_PTR(ptr) _nc_visbuf((const char *)ptr) +# else +# define USER_PTR(ptr) _nc_my_visbuf((const char *)ptr) +# endif + + extern void _nc_dPanel(const char*, const PANEL*); + extern void _nc_dStack(const char*, int, const PANEL*); + extern void _nc_Wnoutrefresh(const PANEL*); + extern void _nc_Touchpan(const PANEL*); + extern void _nc_Touchline(const PANEL*, int, int); + +# define dBug(x) _tracef x +# define dPanel(text,pan) _nc_dPanel(text,pan) +# define dStack(fmt,num,pan) _nc_dStack(fmt,num,pan) +# define Wnoutrefresh(pan) _nc_Wnoutrefresh(pan) +# define Touchpan(pan) _nc_Touchpan(pan) +# define Touchline(pan,start,count) _nc_Touchline(pan,start,count) +#else /* !TRACE */ +# define dBug(x) +# define dPanel(text,pan) +# define dStack(fmt,num,pan) +# define Wnoutrefresh(pan) wnoutrefresh((pan)->win) +# define Touchpan(pan) touchwin((pan)->win) +# define Touchline(pan,start,count) touchline((pan)->win,start,count) #endif + +#define _nc_stdscr_pseudo_panel _nc_panelhook()->stdscr_pseudo_panel +#define _nc_top_panel _nc_panelhook()->top_panel +#define _nc_bottom_panel _nc_panelhook()->bottom_panel + +extern void _nc_panel_link_bottom(PANEL*); +extern bool _nc_panel_is_linked(const PANEL*); +extern void _nc_calculate_obscure(void); +extern void _nc_free_obscure(PANEL*); +extern void _nc_override(const PANEL*,int); + +#endif /* _PANEL_PRIV_H */ diff --git a/progs/Makefile.in b/progs/Makefile.in index a8bce990..598c218e 100644 --- a/progs/Makefile.in +++ b/progs/Makefile.in @@ -1,23 +1,34 @@ -# $Id: Makefile.in,v 1.21 1997/02/15 20:03:34 tom Exp $ -################################################################################ -# Copyright 1996,1997 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: Makefile.in,v 1.35 1998/02/11 12:14:03 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997 +# # Makefile for ncurses source code. # # This makes the ncurses utility programs. @@ -34,8 +45,9 @@ SHELL = /bin/sh THIS = Makefile -NC_MFLAGS = @nc_cv_makeflags@ +CF_MFLAGS = @cf_cv_makeflags@ @SET_MAKE@ +x = @PROG_EXT@ MODEL = ../@DFT_OBJ_SUBDIR@ INSTALL_PREFIX = @INSTALL_PREFIX@ @@ -43,6 +55,7 @@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ +libdir = @libdir@ includedir = @includedir@ datadir = @datadir@ @@ -66,18 +79,19 @@ CCFLAGS = $(CPPFLAGS) $(CFLAGS) CFLAGS_NORMAL = $(CCFLAGS) CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE CFLAGS_PROFILE = $(CCFLAGS) -pg -CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ +CFLAGS_SHARED = $(CCFLAGS) # @CC_SHARED_OPTS@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) LD = @LD@ LINK = $(CC) -LDFLAGS = -L../lib -lncurses@DFT_ARG_SUFFIX@ @LDFLAGS@ @LD_MODEL@ @LIBS@ @EXTRA_LIBS@ +LDFLAGS = @EXTRA_LDFLAGS@ \ + @PROG_ARGS@ @LDFLAGS@ @LD_MODEL@ @LIBS@ @EXTRA_LIBS@ LDFLAGS_NORMAL = $(LDFLAGS) LDFLAGS_DEBUG = $(LDFLAGS) @CC_G_OPT@ LDFLAGS_PROFILE = $(LDFLAGS) -pg -LDFLAGS_SHARED = $(LDFLAGS) @CC_SHARED_OPTS@ +LDFLAGS_SHARED = $(LDFLAGS) @CC_SHARED_OPTS@ # @LD_SHARED_OPTS@ LDFLAGS_DEFAULT = $(LDFLAGS_@DFT_UPR_MODEL@) @@ -88,34 +102,52 @@ LINT_LIBS = -lncurses @LIBS@ AUTO_SRC = \ termsort.c -PROGS = tic toe infocmp clear tput tset +PROGS = tic$x toe$x infocmp$x clear$x tput$x tset$x -TESTPROGS = mvcur tctest hardscroll hashmap +TESTPROGS = mvcur$x tctest$x hardscroll$x hashmap$x # Default library, for linking applications -DEPS_CURSES = ../lib/libncurses@DFT_DEP_SUFFIX@ +DEPS_CURSES = @LIB_PREFIX@ncurses@DFT_DEP_SUFFIX@ ################################################################################ -all: $(AUTO_SRC) $(PROGS) +all: $(AUTO_SRC) $(PROGS) + +sources: $(AUTO_SRC) install: install.progs +uninstall: uninstall.progs # this line simplifies the configure-script install.libs: +uninstall.libs: install.progs: $(PROGS) $(INSTALL_PREFIX)$(bindir) - $(INSTALL_PROGRAM) tic $(INSTALL_PREFIX)$(bindir)/tic - $(INSTALL_PROGRAM) toe $(INSTALL_PREFIX)$(bindir)/toe - $(INSTALL_PROGRAM) infocmp $(INSTALL_PREFIX)$(bindir)/infocmp - $(INSTALL_PROGRAM) clear $(INSTALL_PREFIX)$(bindir)/clear - $(INSTALL_PROGRAM) tput $(INSTALL_PREFIX)$(bindir)/tput - $(INSTALL_PROGRAM) tset $(INSTALL_PREFIX)$(bindir)/tset + $(INSTALL_PROGRAM) tic$x $(INSTALL_PREFIX)$(bindir)/tic$x + $(INSTALL_PROGRAM) toe$x $(INSTALL_PREFIX)$(bindir)/toe$x + $(INSTALL_PROGRAM) infocmp$x $(INSTALL_PREFIX)$(bindir)/infocmp$x + $(INSTALL_PROGRAM) clear$x $(INSTALL_PREFIX)$(bindir)/clear$x + $(INSTALL_PROGRAM) tput$x $(INSTALL_PREFIX)$(bindir)/tput$x + $(INSTALL_PROGRAM) tset$x $(INSTALL_PREFIX)$(bindir)/tset$x @echo "linking captoinfo to tic" - -@rm -f $(INSTALL_PREFIX)$(bindir)/captoinfo - (cd $(INSTALL_PREFIX)$(bindir) && $(LN_S) tic captoinfo) + -@rm -f $(INSTALL_PREFIX)$(bindir)/captoinfo$x + (cd $(INSTALL_PREFIX)$(bindir) && $(LN_S) tic$x captoinfo$x) + @echo "linking infotocap to tic" + -@rm -f $(INSTALL_PREFIX)$(bindir)/infotocap$x + (cd $(INSTALL_PREFIX)$(bindir) && $(LN_S) tic$x infotocap$x) @echo "linking reset to tset" - -@rm -f $(INSTALL_PREFIX)$(bindir)/reset - (cd $(INSTALL_PREFIX)$(bindir) && $(LN_S) tset reset) + -@rm -f $(INSTALL_PREFIX)$(bindir)/reset$x + (cd $(INSTALL_PREFIX)$(bindir) && $(LN_S) tset$x reset$x) + +uninstall.progs: + -@rm -f $(INSTALL_PREFIX)$(bindir)/tic$x + -@rm -f $(INSTALL_PREFIX)$(bindir)/toe$x + -@rm -f $(INSTALL_PREFIX)$(bindir)/infocmp$x + -@rm -f $(INSTALL_PREFIX)$(bindir)/clear$x + -@rm -f $(INSTALL_PREFIX)$(bindir)/tput$x + -@rm -f $(INSTALL_PREFIX)$(bindir)/tset$x + -@rm -f $(INSTALL_PREFIX)$(bindir)/captoinfo$x + -@rm -f $(INSTALL_PREFIX)$(bindir)/infotocap$x + -@rm -f $(INSTALL_PREFIX)$(bindir)/reset$x $(INSTALL_PREFIX)$(bindir) : $(srcdir)/../mkinstalldirs $@ @@ -128,81 +160,45 @@ DEPS_TIC = \ $(MODEL)/tic.o \ $(MODEL)/dump_entry.o -tic: $(DEPS_TIC) $(DEPS_CURSES) +tic$x: $(DEPS_TIC) $(DEPS_CURSES) @ECHO_LINK@ $(LINK) $(DEPS_TIC) $(LDFLAGS_DEFAULT) -o $@ DEPS_TOE = \ $(MODEL)/toe.o \ $(MODEL)/dump_entry.o -toe: $(DEPS_TOE) $(DEPS_CURSES) +toe$x: $(DEPS_TOE) $(DEPS_CURSES) @ECHO_LINK@ $(LINK) $(DEPS_TOE) $(LDFLAGS_DEFAULT) -o $@ DEPS_CLEAR = \ $(MODEL)/clear.o -clear: $(DEPS_CLEAR) $(DEPS_CURSES) +clear$x: $(DEPS_CLEAR) $(DEPS_CURSES) @ECHO_LINK@ $(LINK) $(DEPS_CLEAR) $(LDFLAGS_DEFAULT) -o $@ DEPS_TPUT = \ $(MODEL)/tput.o -tput: $(DEPS_TPUT) $(DEPS_CURSES) +tput$x: $(DEPS_TPUT) $(DEPS_CURSES) @ECHO_LINK@ $(LINK) $(DEPS_TPUT) $(LDFLAGS_DEFAULT) -o $@ DEPS_INFOCMP = \ $(MODEL)/infocmp.o \ $(MODEL)/dump_entry.o -infocmp: $(DEPS_INFOCMP) $(DEPS_CURSES) +infocmp$x: $(DEPS_INFOCMP) $(DEPS_CURSES) @ECHO_LINK@ $(LINK) $(DEPS_INFOCMP) $(LDFLAGS_DEFAULT) -o $@ DEPS_TSET = \ $(MODEL)/tset.o \ $(MODEL)/dump_entry.o -tset: $(DEPS_TSET) $(DEPS_CURSES) +tset$x: $(DEPS_TSET) $(DEPS_CURSES) @ECHO_LINK@ $(LINK) $(DEPS_TSET) $(LDFLAGS_DEFAULT) -o $@ termsort.c: $(srcdir)/MKtermsort.sh sh -c "$(srcdir)/MKtermsort.sh $(AWK) $(srcdir)/../include/Caps" >$@ -# -# Test programs (not normally built by make all) start here. -# - -# Cursor movement optimization tester. Use -g for debugging but -O if you're -# profiling with intent to determine COMPUTE_OVERHEAD -MVFLAGS = -O -DEPS_MVCUR = \ - $(srcdir)/../ncurses/lib_mvcur.c \ - $(MODEL)/dump_entry.o - -mvcur: $(DEPS_MVCUR) $(DEPS_CURSES) - @ECHO_LINK@ $(LINK) $(CCFLAGS) -DTRACE -DMAIN $(MVFLAGS) $(DEPS_MVCUR) $(LDFLAGS_DEFAULT) -o $@ - -# Termcap-conversion tester -DEPS_TCTEST = \ - $(srcdir)/../ncurses/captoinfo.c - -tctest: $(DEPS_TCTEST) $(DEPS_CURSES) - @ECHO_LINK@ $(LINK) $(CCFLAGS) -DTRACE -DMAIN $(DEPS_TCTEST) $(LDFLAGS_DEFAULT) -o $@ - -# Demonstrator/tester for hardware-scrolling algorithm. -DEPS_HARDSCROLL = \ - $(srcdir)/../ncurses/hardscroll.c \ - $(MODEL)/lib_trace.o -hardscroll: - @ECHO_LINK@ $(LINK) $(CCFLAGS) -I$(srcdir)/../ncurses -DTRACE -DSCROLLDEBUG $(DEPS_HARDSCROLL) $(LDFLAGS_DEFAULT) -o $@ - -# Demonstrator-tester for enhanced hardware-scrolling code with hash mapping -DEPS_HASHMAP = \ - $(srcdir)/../ncurses/hashmap.c \ - $(srcdir)/../ncurses/hardscroll.c \ - $(MODEL)/lib_trace.o -hashmap: $(DEPS_HASHMAP) - @ECHO_LINK@ $(LINK) $(CCFLAGS) -I$(srcdir)/../ncurses -DTRACE -DHASHDEBUG $(DEPS_HASHMAP) -o $@ - # # Utility productions start here # @@ -213,25 +209,26 @@ tags: TAGS: etags *.[ch] -clean :: - -rm -f tags TAGS do.tic *~ - -rm -f $(AUTO_SRC) $(TESTPROGS) +mostlyclean :: + -rm -f core tags TAGS *~ *.ln *.atac trace + -rm -f $(TESTPROGS) + +clean :: mostlyclean + -rm -f $(AUTO_SRC) -rm -f $(PROGS) distclean :: clean -rm -f Makefile -mostlyclean :: clean - realclean :: distclean # These rules are used to allow "make -n" to work on a clean directory-tree ../include/hashsize.h \ ../include/parametrized.h \ ../include/term.h : - cd ../include; $(MAKE) $(NC_MFLAGS) + cd ../include; $(MAKE) $(CF_MFLAGS) $(DEPS_CURSES) : - cd ../ncurses; $(MAKE) $(NC_MFLAGS) + cd ../ncurses; $(MAKE) $(CF_MFLAGS) lint: $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/clear.c $(LINT_LIBS) diff --git a/progs/capconvert b/progs/capconvert index 0a3ea5d5..2125a0d6 100755 --- a/progs/capconvert +++ b/progs/capconvert @@ -1,4 +1,5 @@ -#! /bin/sh +#!/bin/sh +# $Id: capconvert,v 1.3 1997/08/02 21:52:06 tom Exp $ # # capconvert -- automated conversion from termcap to terminfo # @@ -13,57 +14,93 @@ echo "" # case they're on a workstation and probably don't. # Check to make sure TERMINFO is not already defined -if [ "$TERMINFO" ] +if test -n "$TERMINFO" then echo "TERMINFO is already defined in your environment. This means" echo "you already have a local terminfo tree, so you do not need any" echo "conversion." + if test ! -d $TERMINFO ; then + echo "Caution: TERMINFO does not point to a directory!" + fi exit; fi -# Check to see if terminfo is present. -if [ -d /usr/lib/terminfo -o -d /usr/local/lib/terminfo ] +# Check to see if terminfo is present in one of the standard locations. +terminfo=no +for p in $TERMINFO \ + /usr/lib/terminfo \ + /usr/share/lib/terminfo \ + /usr/share/terminfo \ + /usr/local/lib/terminfo \ + /usr/local/share/terminfo +do + if test -d $p ; then + terminfo=yes + break + fi +done + +if test $terminfo = yes then echo "Your system already has a system-wide terminfo tree." - terminfo=yes echo "" - if [ "$TERMCAP" = "" ] + if test -z "$TERMCAP" then - echo "You have no TERMCAP variable set, so we're done." + echo "You have no TERMCAP variable set, so we are done." # Assumes the terminfo master covers all canned terminal types exit; fi - if [ "$TERM" = "xterm" ] + if test "$TERM" = "xterm" then - echo "You're running xterm, which rudely sets TERMCAP itself." + echo "You are running xterm, which usually sets TERMCAP itself." echo "We can ignore this, because terminfo knows about xterm." - echo "So you'll just use the system-wide terminfo tree." + echo "So you will just use the system-wide terminfo tree." exit; else - echo "We'll have to make a local one for you anyway, in order" - echo "to capture the effect of your TERMCAP variable." + echo "We will have to make a local one for you anyway, to capture the effect" + echo "of your TERMCAP variable." fi else - echo "No system-wide terminfo tree. We'll make you a local one." - terminfo=no + echo "No system-wide terminfo tree. We will make you a local one." fi echo ""; +# Check if test -x works (it's not portable, but useful) +OPT="-x" +TMP=test$$; touch $TMP && chmod 755 $TMP +if test $OPT $TMP ; then + chmod 644 $TMP + test $OPT $TMP && OPT="-f" +else + OPT="-f" +fi +rm -f $TMP # First step -- go find tic -set -- `echo $PATH | tr ':' '\n' | sort | uniq` -for x in $* +TIC= +IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" +for x in $PATH . do - if [ -x $x/tic ] + if test $OPT $x/tic then - tic=$x/tic - fi; + TIC=$x/tic + break + fi done -if [ "$tic" ] +IFS="$ac_save_ifs" + +if test -n "$TIC" then - echo "I see tic at $tic." + echo "I see tic at $TIC." + case $TIC in # (vi + ./tic) + if test $OPT ../misc/shlib ; then + TIC="../misc/shlib $TIC" + fi + ;; + esac else - echo "You don't have tic installed anywhere I can see, please fix that." + echo "You do not have tic installed anywhere I can see, please fix that." exit; fi echo ""; @@ -73,16 +110,16 @@ echo ""; # # Make the user a terminfo directory -if [ -d $HOME/.terminfo ] +if test -d $HOME/.terminfo then echo "It appears you already have a private terminfo directory" echo "at $HOME/.terminfo; this seems odd, because TERMINFO" - echo "is not defined. I'm not going to second-guess this -- if you" + echo "is not defined. I am not going to second-guess this -- if you" echo "really want me to try auto-configuring for you, remove or" echo "rename $HOME/terminfo and run me again." exit; else - echo "I'm creating your private terminfo directory at $HOME/.terminfo" + echo "I am creating your private terminfo directory at $HOME/.terminfo" mkdir $HOME/.terminfo # Ensure that that's where tic's compilation results. # This isn't strictly necessary with a 1.9.7 or later tic. @@ -91,9 +128,9 @@ fi echo ""; # Find a terminfo source to work from -if [ -f ../misc/terminfo.src ] +if test -f ../misc/terminfo.src then - echo "I see the terminfo master source is handy; I'll use that." + echo "I see the terminfo master source is handy; I will use that." master=../misc/terminfo.src else # Ooops...looks like we're running from somewhere other than the @@ -102,15 +139,15 @@ else mcount=`echo $master | wc -l` case $mcount in 0) - echo "I can't find a terminfo source file anywhere under your home directory." + echo "I can not find a terminfo source file anywhere under your home directory." echo "There should be a file called terminfo.src somewhere in your" echo "ncurses distribution; please put it in your home directotry" - echo "and run me again (it doesn't have to live there permanently)." + echo "and run me again (it does not have to live there permanently)." exit; ;; 1) echo "I see a file called $master." - echo "I'm going to assume this is the terminfo source included with" + echo "I am going to assume this is the terminfo source included with" echo "the ncurses distribution. If this assumption is wrong, please" echo "interrupt me now! OK to continue?" read ans; @@ -122,11 +159,11 @@ else do echo "Please tell me which one to use:" read master; - if [ -f $master ] + if test -f $master then break else - echo "That file doesn't exist. Try again?"; + echo "That file does not exist. Try again?"; fi done ;; @@ -135,25 +172,27 @@ fi echo ""; # Now that we have a master, compile it into the local tree -echo "OK, now I'll make your private terminfo tree. This may take a bit..." +echo "OK, now I will make your private terminfo tree. This may take a bit..." # # Kluge alert: we compile terminfo.src in two pieces because a lot of machines # with < 16MB RAM choke on tic's core-hog habits. +trap "rm -f tsplit$$.*" 0 1 2 5 15 sed -n $master \ - -e '1,/SPLIT HERE/w tsplit$$.01' \ - -e '/SPLIT HERE/,$w tsplit$$.02' \ + -e '1,/SPLIT HERE/w 'tsplit$$.01 \ + -e '/SPLIT HERE/,$w 'tsplit$$.02 \ 2>/dev/null -for x in tsplit$$.*; do $tic -v $x; done +for x in tsplit$$.*; do eval $TIC $x; done rm tsplit$$.* +trap 0 1 2 5 15 # echo "You now have a private tree under $HOME/.terminfo;" echo "the ncurses library will automatically read from it," echo "and ncurses tic will automatically compile entries to it." # We're done unless user has a .termcap file or equivalent named by TERMCAP -if [ "$TERMCAP" = "" ] +if test -z "$TERMCAP" then - echo "You have no TERMCAP set, so we're done." + echo "You have no TERMCAP set, so we are done." fi # OK, here comes the nasty case...user has a TERMCAP. Instead of @@ -162,27 +201,27 @@ fi # we don't actually know what TERM will be nor even if it always has # the same value for this user) we do the following three steps... -if [ -f $HOME/.termcap ] +if test -f $HOME/.termcap then - echo 'I see you have a $HOME/.termcap file. I'll compile that.' - $tic $HOME/.termcap + echo 'I see you have a $HOME/.termcap file. I will compile that.' + eval $TIC $HOME/.termcap echo "Done." echo "Note that editing $HOME/.termcap will no longer change the data curses sees." -else if `expr $TERMCAP : "/"` = '1' +elif test -f "$TERMCAP" then - echo "Your TERMCAP names the file $TERMCAP. I'll compile that." - $tic $TERMCAP + echo "Your TERMCAP names the file $TERMCAP. I will compile that." + eval $TIC $TERMCAP echo "Done." echo "Note that editing $TERMCAP will no longer change the data curses sees." else echo "Your TERMCAP value appears to be an entry in termcap format." - echo "I'll compile it." + echo "I will compile it." echo $TERMCAP >myterm$$ - $tic myterm$$ + eval $TIC myterm$$ rm myterm$$ echo "Done." echo "Note that editing TERMCAP will no longer change the data curses sees." -fi fi +fi echo "To do that, decompile the terminal decription you want with infocmp(1)," echo "edit to taste, and recompile using tic(1)." diff --git a/progs/clear.c b/progs/clear.c index 417c2446..b813f0e4 100644 --- a/progs/clear.c +++ b/progs/clear.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -28,7 +40,7 @@ #include -MODULE_ID("$Id: clear.c,v 1.6 1996/12/21 17:35:11 tom Exp $") +MODULE_ID("$Id: clear.c,v 1.7 1998/02/11 12:14:02 tom Exp $") static int putch(int c) { diff --git a/progs/dump_entry.c b/progs/dump_entry.c index 8610f797..605b14c7 100644 --- a/progs/dump_entry.c +++ b/progs/dump_entry.c @@ -1,33 +1,44 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ #define __INTERNAL_CAPS_VISIBLE #include -#include #include "dump_entry.h" #include "termsort.c" /* this C file is generated */ #include "parametrized.h" /* so is this */ -MODULE_ID("$Id: dump_entry.c,v 1.17 1997/05/10 17:35:30 tom Exp $") +MODULE_ID("$Id: dump_entry.c,v 1.25 1998/02/11 12:14:02 tom Exp $") #define INDENT 8 @@ -45,7 +56,9 @@ static size_t out_size; /* ...and its allocated length */ /* indirection pointers for implementing sort and display modes */ static const int *bool_indirect, *num_indirect, *str_indirect; -static char * const *bool_names, * const *num_names, * const *str_names; +static NCURSES_CONST char * const *bool_names; +static NCURSES_CONST char * const *num_names; +static NCURSES_CONST char * const *str_names; static const char *separator, *trailer; @@ -68,7 +81,7 @@ void _nc_leaks_dump_entry(void) } #endif -char *nametrans(const char *name) +NCURSES_CONST char *nametrans(const char *name) /* translate a capability name from termcap to terminfo */ { const struct name_table_entry *np; @@ -189,92 +202,6 @@ void dump_init(const char *version, int mode, int sort, int twidth, int traceval _nc_progname, width, tversion, outform); } -static int trailing_spaces(const char *src) -{ - while (*src == ' ') - src++; - return *src == 0; -} - -/* this deals with differences over whether 0x7f and 0x80..0x9f are controls */ -#define CHAR_OF(s) (*(unsigned const char *)(s)) -#define REALCTL(s) (CHAR_OF(s) < 127 && iscntrl(CHAR_OF(s))) -#define REALPRINT(s) (CHAR_OF(s) < 127 && isprint(CHAR_OF(s))) - -char *expand(char *srcp) -{ -static char buffer[1024]; -int bufp; -const char *ptr, *str = (srcp == ABSENT_STRING - || srcp == CANCELLED_STRING) ? "" : srcp; -bool islong = (strlen(str) > 3); - - bufp = 0; - ptr = str; - while (*str) { - if (*str == '%' && REALPRINT(str+1)) { - buffer[bufp++] = *str++; - buffer[bufp++] = *str; - } - else if (*str == '\033') { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'E'; - } - else if (*str == '\\' && (outform==F_TERMINFO) && (str == srcp || str[-1] != '^')) { - buffer[bufp++] = '\\'; - buffer[bufp++] = '\\'; - } - else if (*str == ' ' && (outform==F_TERMINFO) && (str == srcp || trailing_spaces(str))) { - buffer[bufp++] = '\\'; - buffer[bufp++] = 's'; - } - else if ((*str == ',' || *str == ':' || *str == '^') && (outform==F_TERMINFO)) { - buffer[bufp++] = '\\'; - buffer[bufp++] = *str; - } - else if (REALPRINT(str) && (*str != ',' && *str != ':' && !(*str == '!' && outform!=F_TERMINFO) && *str != '^')) - buffer[bufp++] = *str; -#if 0 /* FIXME: this would be more readable */ - else if (*str == '\b') { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'b'; - } - else if (*str == '\f') { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'f'; - } - else if (*str == '\t' && islong) { - buffer[bufp++] = '\\'; - buffer[bufp++] = 't'; - } -#endif - else if (*str == '\r' && (islong || (strlen(srcp) > 2 && str[1] == '\0'))) { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'r'; - } - else if (*str == '\n' && islong) { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'n'; - } -#define UnCtl(c) ((0xff & (c)) + '@') - else if (REALCTL(str) && *str != '\\' && (!islong || isdigit(str[1]))) - { - (void) sprintf(&buffer[bufp], "^%c", UnCtl(*str)); - bufp += 2; - } - else - { - (void) sprintf(&buffer[bufp], "\\%03o", 0xff & *str); - bufp += 4; - } - - str++; - } - - buffer[bufp] = '\0'; - return(buffer); -} - static TERMTYPE *cur_type; static int dump_predicate(int type, int idx) @@ -298,6 +225,7 @@ static int dump_predicate(int type, int idx) } static void set_obsolete_termcaps(TERMTYPE *tp); +static void repair_acsc(TERMTYPE *tp); /* is this the index of a function key string? */ #define FNKEY(i) (((i)<= 65 && (i)>= 75) || ((i)<= 216 && (i)>= 268)) @@ -314,11 +242,14 @@ static bool version_filter(int type, int idx) switch (type) { case BOOLEAN: - return (idx <= 20); /* below and including xon_xoff */ + /* below and including xon_xoff */ + return ((idx <= 20) ? TRUE : FALSE); case NUMBER: - return (idx <= 7); /* below and including width_status_line */ + /* below and including width_status_line */ + return ((idx <= 7) ? TRUE : FALSE); case STRING: - return (idx <= 144); /* below and including prtr_non */ + /* below and including prtr_non */ + return ((idx <= 144) ? TRUE : FALSE); } break; @@ -326,9 +257,11 @@ static bool version_filter(int type, int idx) switch (type) { case BOOLEAN: - return (idx <= 20); /* below and including xon_xoff */ + /* below and including xon_xoff */ + return ((idx <= 20) ? TRUE : FALSE); case NUMBER: - return (idx <= 10); /* below and including label_width */ + /* below and including label_width */ + return ((idx <= 10) ? TRUE : FALSE); case STRING: if (idx <= 144) /* below and including prtr_non */ return(TRUE); @@ -345,9 +278,11 @@ static bool version_filter(int type, int idx) switch (type) { case BOOLEAN: - return (idx <= 20); /* below and including xon_xoff */ + /* below and including xon_xoff */ + return ((idx <= 20) ? TRUE : FALSE); case NUMBER: - return (idx <= 7); /* below and including width_status_line */ + /* below and including width_status_line */ + return ((idx <= 7) ? TRUE : FALSE); case STRING: if (idx <= 144) /* below and including prtr_non */ return(TRUE); @@ -541,6 +476,7 @@ bool outcount = 0; if (len & 1) len++; + repair_acsc(tterm); for (j=0; j < STRCOUNT; j++) { if (sortmode == S_NOSORT) i = j; @@ -584,13 +520,12 @@ bool outcount = 0; if (tterm->Strings[i] != ABSENT_STRING && i + 1 > num_strings) num_strings = i + 1; - if (tterm->Strings[i] == ABSENT_STRING - || tterm->Strings[i] == CANCELLED_STRING) + if (!VALID_STRING(tterm->Strings[i])) sprintf(buffer, "%s@", str_names[i]); else if (outform == F_TERMCAP || outform == F_TCONVERR) { - char *srccap = expand(tterm->Strings[i]); - char *cv = _nc_infotocap(str_names[i], srccap,parametrized[i]); + char *srccap = _nc_tic_expand(tterm->Strings[i], FALSE); + char *cv = _nc_infotocap(str_names[i], srccap, parametrized[i]); if (cv == (char *)NULL) { @@ -607,7 +542,7 @@ bool outcount = 0; } else { - sprintf(buffer,"%s=%s",str_names[i],expand(tterm->Strings[i])); + sprintf(buffer, "%s=%s", str_names[i], _nc_tic_expand(tterm->Strings[i], outform==F_TERMINFO)); len += strlen(tterm->Strings[i]) + 1; } @@ -637,7 +572,7 @@ bool outcount = 0; } else if (tversion == V_AIX) { - if (acs_chars) + if (VALID_STRING(acs_chars)) { bool box_ok = TRUE; const char *acstrans = "lqkxjmwuvtn"; @@ -661,7 +596,7 @@ bool outcount = 0; if (box_ok) { (void) strcpy(buffer, "box1="); - (void) strcat(buffer, expand(boxchars)); + (void) strcat(buffer, _nc_tic_expand(boxchars, outform==F_TERMINFO)); WRAP_CONCAT; } } @@ -846,3 +781,51 @@ static void set_obsolete_termcaps(TERMTYPE *tp) { #include "capdefaults.c" } + +/* + * Convert an alternate-character-set string to canonical form: sorted and + * unique. + */ +static void repair_acsc(TERMTYPE *tp) +{ + if (VALID_STRING(acs_chars)) { + size_t n, m; + char mapped[256]; + char extra = 0; + unsigned source; + unsigned target; + bool fix_needed = FALSE; + + for (n = 0, source = 0; acs_chars[n] != 0; n++) { + target = acs_chars[n]; + if (source >= target) { + fix_needed = TRUE; + break; + } + source = target; + if (acs_chars[n+1]) + n++; + } + if (fix_needed) { + memset(mapped, 0, sizeof(mapped)); + for (n = 0; acs_chars[n] != 0; n++) { + source = acs_chars[n]; + if ((target = (unsigned char)acs_chars[n+1]) != 0) { + mapped[source] = target; + n++; + } else { + extra = source; + } + } + for (n = m = 0; n < sizeof(mapped); n++) { + if (mapped[n]) { + acs_chars[m++] = n; + acs_chars[m++] = mapped[n]; + } + } + if (extra) + acs_chars[m++] = extra; /* garbage in, garbage out */ + acs_chars[m] = 0; + } + } +} diff --git a/progs/dump_entry.h b/progs/dump_entry.h index 7ea6fcf2..2a24ea9d 100644 --- a/progs/dump_entry.h +++ b/progs/dump_entry.h @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -38,12 +50,11 @@ #define S_VARIABLE 3 /* sort by C variable names */ #define S_TERMCAP 4 /* sort by termcap names */ -extern char *nametrans(const char *); +extern NCURSES_CONST char *nametrans(const char *); extern void dump_init(const char *, int, int, int, int); extern int fmt_entry(TERMTYPE *, int (*)(int, int), bool, bool); extern int dump_entry(TERMTYPE *, bool, int (*)(int, int)); extern int dump_uses(const char *, bool); extern void compare_entry(void (*)(int, int, const char *)); -extern char *expand(char *); #define FAIL -1 diff --git a/progs/infocmp.c b/progs/infocmp.c index 71e0a7c0..d603353b 100644 --- a/progs/infocmp.c +++ b/progs/infocmp.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -27,18 +39,14 @@ #include -#include - #include #include -MODULE_ID("$Id: infocmp.c,v 1.27 1997/02/15 18:54:44 tom Exp $") +MODULE_ID("$Id: infocmp.c,v 1.34 1998/02/11 12:14:03 tom Exp $") #define L_CURL "{" #define R_CURL "}" -#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING) - #define MAXTERMS 32 /* max # terminal arguments we can handle */ const char *_nc_progname = "infocmp"; @@ -182,7 +190,7 @@ static int use_predicate(int type, int idx) if (usestr == ABSENT_STRING && termstr == ABSENT_STRING) return(FAIL); - else if (!usestr || !termstr || capcmp(usestr,termstr)) + else if (!usestr || !termstr || capcmp(usestr, termstr)) return(TRUE); else return(FAIL); @@ -281,7 +289,7 @@ static void compare_predicate(int type, int idx, const char *name) else { (void) strcpy(buf1, "'"); - (void) strcat(buf1, expand(s1)); + (void) strcat(buf1, _nc_tic_expand(s1, outform==F_TERMINFO)); (void) strcat(buf1, "'"); } @@ -290,7 +298,7 @@ static void compare_predicate(int type, int idx, const char *name) else { (void) strcpy(buf2, "'"); - (void) strcat(buf2, expand(s2)); + (void) strcat(buf2, _nc_tic_expand(s2, outform==F_TERMINFO)); (void) strcat(buf2, "'"); } @@ -301,7 +309,7 @@ static void compare_predicate(int type, int idx, const char *name) case C_COMMON: if (s1 && s2 && !capcmp(s1, s2)) - (void) printf("\t%s= '%s'.\n",name,expand(s1)); + (void) printf("\t%s= '%s'.\n", name, _nc_tic_expand(s1, outform==F_TERMINFO)); break; case C_NAND: @@ -572,7 +580,7 @@ static void analyze_string(const char *name, const char *cap, TERMTYPE *tp) /* couldn't match anything */ buf2[0] = *sp; buf2[1] = '\0'; - (void) strcat(buf, expand(buf2)); + (void) strcat(buf, _nc_tic_expand(buf2, outform==F_TERMINFO)); } } (void) printf("%s\n", buf); @@ -608,7 +616,7 @@ static void file_comparison(int argc, char *argv[]) _nc_read_entry_source(stdin, NULL, TRUE, FALSE, NULLHOOK); if (itrace) - (void) fprintf(stderr, "Resolving file %d...\n",n-0); + (void) fprintf(stderr, "Resolving file %d...\n", n-0); /* do use resolution */ if (!_nc_resolve_uses()) @@ -643,7 +651,7 @@ static void file_comparison(int argc, char *argv[]) for (qp = heads[0]; qp; qp = qp->next) { for (rp = heads[1]; rp; rp = rp->next) - if (_nc_entry_match(qp->tterm.term_names,rp->tterm.term_names)) + if (_nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) { /* * This is why the uses structure parent element is @@ -742,7 +750,7 @@ static void file_comparison(int argc, char *argv[]) { case C_DIFFERENCE: if (itrace) - (void)fprintf(stderr,"infocmp: dumping differences\n"); + (void)fprintf(stderr, "infocmp: dumping differences\n"); (void) printf("comparing %s to %s.\n", name1, name2); compare_entry(compare_predicate); break; @@ -784,7 +792,9 @@ static void usage(void) int main(int argc, char *argv[]) { char *terminal, *firstdir, *restdir; - path tfile[MAXTERMS]; + /* Avoid "local data >32k" error with mwcc */ + /* Also avoid overflowing smaller stacks on systems like AmigaOS */ + path *tfile = malloc(sizeof(path)*MAXTERMS); int c, i, len; bool filecompare = FALSE; bool initdump = FALSE; @@ -827,6 +837,13 @@ int main(int argc, char *argv[]) filecompare = TRUE; break; + case 'I': + outform = F_TERMINFO; + if (sortmode == S_DEFAULT) + sortmode = S_VARIABLE; + tversion = 0; + break; + case 'i': init_analyze = TRUE; break; @@ -850,7 +867,7 @@ int main(int argc, char *argv[]) break; case 'r': - tversion = (char *)NULL; + tversion = 0; break; case 'R': @@ -1062,13 +1079,15 @@ int main(int argc, char *argv[]) tp = buf; *tp++ = '"'; for (sp = term->Strings[n]; *sp; sp++) + { if (isascii(*sp) && isprint(*sp) && *sp !='\\' && *sp != '"') *tp++ = *sp; else { - (void) sprintf(tp, "\\%03o", *sp); + (void) sprintf(tp, "\\%03o", *sp & 0xff); tp += 4; } + } *tp++ = '"'; *tp = '\0'; size += (strlen(term->Strings[n]) + 1); @@ -1115,12 +1134,12 @@ int main(int argc, char *argv[]) len = dump_entry(&term[0], limited, NULL); putchar('\n'); if (itrace) - (void)fprintf(stderr,"infocmp: length %d\n", len); + (void)fprintf(stderr, "infocmp: length %d\n", len); break; case C_DIFFERENCE: if (itrace) - (void)fprintf(stderr,"infocmp: dumping differences\n"); + (void)fprintf(stderr, "infocmp: dumping differences\n"); (void) printf("comparing %s to %s.\n", tname[0], tname[1]); compare_entry(compare_predicate); break; @@ -1149,7 +1168,7 @@ int main(int argc, char *argv[]) len += dump_uses(tname[i], !(outform==F_TERMCAP || outform==F_TCONVERR)); putchar('\n'); if (itrace) - (void)fprintf(stderr,"infocmp: length %d\n", len); + (void)fprintf(stderr, "infocmp: length %d\n", len); break; } } diff --git a/progs/modules b/progs/modules index 3c6157b1..54cd2020 100644 --- a/progs/modules +++ b/progs/modules @@ -1,23 +1,36 @@ # Program modules (some are in ncurses lib!) -################################################################################ -# Copyright 1995 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +############################################################################## +# Copyright (c) 1998 Free 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 1995,1997 +# + +@ 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 diff --git a/progs/progs.priv.h b/progs/progs.priv.h index 854ff30b..fb5a8476 100644 --- a/progs/progs.priv.h +++ b/progs/progs.priv.h @@ -1,31 +1,40 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ - +/**************************************************************************** + * Copyright (c) 1998 Free 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 1997,1998 * + ****************************************************************************/ /* - * $Id: progs.priv.h,v 1.9 1997/04/05 23:38:08 tom Exp $ + * $Id: progs.priv.h,v 1.17 1998/02/11 12:14:03 tom Exp $ * * progs.priv.h * * Header file for curses utility programs - * */ #include @@ -37,6 +46,7 @@ #endif #include +#include #include #include @@ -87,7 +97,7 @@ #include -#if !HAVE_EXTERN_ERRNO +#if DECL_ERRNO extern int errno; #endif @@ -101,6 +111,7 @@ extern char *optarg; extern int optind; #endif /* HAVE_GETOPT_H */ +#include #include #include #include @@ -134,3 +145,15 @@ extern int optind; #ifndef STDERR_FILENO #define STDERR_FILENO 2 #endif + +/* We use isascii only to guard against use of 7-bit ctype tables in the + * isprint test in infocmp. + */ +#ifndef HAVE_ISASCII +# undef isascii +# if ('z'-'a' == 25) && ('z' < 127) && ('Z'-'A' == 25) && ('Z' < 127) && ('9' < 127) +# define isascii(c) (((c) & 0xff) <= 127) +# else +# define isascii(c) 1 /* not really ascii anyway */ +# endif +#endif diff --git a/progs/tic.c b/progs/tic.c index 5921b340..6163e329 100644 --- a/progs/tic.c +++ b/progs/tic.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* * tic.c --- Main program for terminfo compiler @@ -27,12 +39,10 @@ #include -#include - #include #include -MODULE_ID("$Id: tic.c,v 1.21 1996/12/30 02:24:15 tom Exp $") +MODULE_ID("$Id: tic.c,v 1.28 1998/02/11 12:14:02 tom Exp $") const char *_nc_progname = "tic"; @@ -152,7 +162,8 @@ static void put_translate(int c) *sp++ = c; else /* ah! candidate name! */ { - char *up, *tp; + char *up; + NCURSES_CONST char *tp; *sp++ = '\0'; in_name = FALSE; @@ -166,7 +177,7 @@ static void put_translate(int c) *up = '\0'; } - if ((tp = nametrans(namebuf)) != (char *)NULL) + if ((tp = nametrans(namebuf)) != 0) { (void) putchar(':'); (void) fputs(tp, stdout); @@ -262,7 +273,7 @@ static const char **make_namelist(char *src) static bool matches(const char **needle, const char *haystack) /* does entry in needle list match |-separated field in haystack? */ { - int code = FALSE; + bool code = FALSE; size_t n; if (needle != 0) @@ -319,7 +330,7 @@ bool check_only = FALSE; * design decision to allow the numeric values for -w, -v options to * be optional. */ - while ((this_opt = getopt(argc, argv, "0123456789CILNR:TVce:orsvw")) != EOF) { + while ((this_opt = getopt(argc, argv, "0123456789CILNR:TVce:o:rsvw")) != EOF) { if (isdigit(this_opt)) { switch (last_opt) { case 'v': @@ -509,9 +520,6 @@ bool check_only = FALSE; } else { - bool trailing_comment = FALSE; - int c, oldc = '\0'; - /* this is in case infotocap() generates warnings */ _nc_curr_col = _nc_curr_line = -1; @@ -540,12 +548,23 @@ bool check_only = FALSE; } if (!namelst) { + int c, oldc = '\0'; + bool in_comment = FALSE; + bool trailing_comment = FALSE; + (void) fseek(stdin, _nc_tail->cend, SEEK_SET); while ((c = getchar()) != EOF) { - if (oldc == '\n' && c == '#') - trailing_comment = TRUE; - if (trailing_comment) + if (oldc == '\n') { + if (c == '#') { + trailing_comment = TRUE; + in_comment = TRUE; + } else { + in_comment = FALSE; + } + } + if (trailing_comment + && (in_comment || (oldc == '\n' && c == '\n'))) putchar(c); oldc = c; } diff --git a/progs/toe.c b/progs/toe.c index 438d59de..85f135e3 100644 --- a/progs/toe.c +++ b/progs/toe.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* * toe.c --- table of entries report generator @@ -29,7 +41,7 @@ #include #include -MODULE_ID("$Id: toe.c,v 0.15 1997/02/15 18:54:47 tom Exp $") +MODULE_ID("$Id: toe.c,v 0.18 1998/02/11 12:14:02 tom Exp $") const char *_nc_progname; @@ -90,6 +102,7 @@ int main (int argc, char *argv[]) { if (freopen(argv[optind], "r", stdin) == NULL) { + (void) fflush(stdout); fprintf(stderr, "%s: can't open %s\n", _nc_progname, argv[optind]); ExitProgram(EXIT_FAILURE); } @@ -157,12 +170,12 @@ int main (int argc, char *argv[]) if (optind < argc) { code = typelist(argc-optind, argv+optind, header, deschook); } else { - char *explicit, *home, *eargv[3]; + char *by_env, *home, *eargv[3]; int j; j = 0; - if ((explicit = getenv("TERMINFO")) != (char *)NULL) - eargv[j++] = explicit; + if ((by_env = getenv("TERMINFO")) != (char *)NULL) + eargv[j++] = by_env; else { if ((home = getenv("HOME")) != (char *)NULL) @@ -210,6 +223,7 @@ static int typelist(int eargc, char *eargv[], if ((termdir = opendir(eargv[i])) == (DIR *)NULL) { + (void) fflush(stdout); (void) fprintf(stderr, "%s: can't open terminfo directory %s\n", _nc_progname, eargv[i]); @@ -253,6 +267,7 @@ static int typelist(int eargc, char *eargv[], status = _nc_read_file_entry(name_2, <erm); if (status <= 0) { + (void) fflush(stdout); (void) fprintf(stderr, "toe: couldn't open terminfo file %s.\n", name_2); diff --git a/progs/tput.c b/progs/tput.c index 5d0cabc6..e14140eb 100644 --- a/progs/tput.c +++ b/progs/tput.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -29,10 +41,9 @@ #include -#include #include -MODULE_ID("$Id: tput.c,v 1.8 1996/12/21 17:34:36 tom Exp $") +MODULE_ID("$Id: tput.c,v 1.11 1998/02/11 12:14:02 tom Exp $") #define PUTS(s) fputs(s, stdout) #define PUTCHAR(c) putchar(c) @@ -209,6 +220,8 @@ int main(int argc, char **argv) char *s, *term; int errret, cmdline = 1; int c; +char buf[BUFSIZ]; +int errors = 0; prg_name = argv[0]; s = strrchr(prg_name, '/'); @@ -239,19 +252,14 @@ int c; /* NOTREACHED */ } - if (term == NULL || *term == '\0') { + if (term == NULL || *term == '\0') quit(2, "No value for $TERM and no -T specified"); - } - setupterm(term, STDOUT_FILENO, &errret); - if (errret == ERR) - quit(3, "unknown terminal \"%s\"", term); + if (setupterm(term, STDOUT_FILENO, &errret) != OK) + quit(3, "unknown terminal \"%s\"", term); if (cmdline) - return(tput(argc, argv)); - else { - char buf[BUFSIZ]; - int errors = 0; + return tput(argc, argv); while (fgets(buf, sizeof(buf), stdin) != (char *)NULL) { char *argvec[16]; /* command, 9 parms, null, & slop */ @@ -260,18 +268,17 @@ int c; /* crack the argument list into a dope vector */ for (cp = buf; *cp; cp++) { - if (isspace(*cp)) - *cp = '\0'; - else if (cp == buf || cp[-1] == 0) - argvec[argnum++] = cp; + if (isspace(*cp)) + *cp = '\0'; + else if (cp == buf || cp[-1] == 0) + argvec[argnum++] = cp; } argvec[argnum] = (char *)NULL; if (tput(argnum, argvec) != 0) - errors++; + errors++; } - return(errors > 0); - } + return errors > 0; } diff --git a/progs/tset.c b/progs/tset.c index e6a075d9..1df3fd64 100644 --- a/progs/tset.c +++ b/progs/tset.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free 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: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* @@ -66,7 +78,6 @@ #include #include -#include #include #include @@ -82,7 +93,7 @@ char *ttyname(int fd); # include #endif -#if SYSTEM_LOOKS_LIKE_SCO +#if NEED_PTEM_H /* they neglected to define struct winsize in termios.h -- it's only in termio.h */ #include @@ -92,7 +103,7 @@ char *ttyname(int fd); #include /* for bool typedef */ #include -MODULE_ID("$Id: tset.c,v 0.23 1997/05/10 17:44:47 tom Exp $") +MODULE_ID("$Id: tset.c,v 0.31 1998/02/11 12:14:02 tom Exp $") extern char **environ; @@ -103,10 +114,10 @@ const char *_nc_progname = "tset"; static TTY mode, oldmode; -static int terasechar; /* new erase character */ -static int intrchar; /* new interrupt character */ +static int terasechar = -1; /* new erase character */ +static int intrchar = -1; /* new interrupt character */ static int isreset; /* invoked as reset */ -static int tkillchar; /* new kill character */ +static int tkillchar = -1; /* new kill character */ static int tlines, tcolumns; /* window size */ #define LOWERCASE(c) ((isalpha(c) && isupper(c)) ? tolower(c) : (c)) @@ -161,7 +172,7 @@ static void cat(char *file) { register int fd, nr, nw; - char buf[1024]; + char buf[BUFSIZ]; if ((fd = open(file, O_RDONLY, 0)) < 0) failed(file); @@ -265,6 +276,32 @@ static const SPEEDS speeds[] = { { "38400", B38400 }, { "19200", B19200 }, { "38400", B38400 }, +#ifdef B19200 + { "19200", B19200 }, +#else +#ifdef EXTA + { "19200", EXTA }, +#endif +#endif +#ifdef B38400 + { "38400", B38400 }, +#else +#ifdef EXTB + { "38400", EXTB }, +#endif +#endif +#ifdef B57600 + { "57600", B57600 }, +#endif +#ifdef B115200 + { "115200", B115200 }, +#endif +#ifdef B230400 + { "230400", B230400 }, +#endif +#ifdef B460800 + { "460800", B460800 }, +#endif { (char *)0, 0 } }; @@ -464,8 +501,10 @@ get_termcap_entry(char *userarg) const char *ttype; #if HAVE_GETTTYNAM struct ttyent *t; - char *ttypath; +#else + FILE *fp; #endif + char *ttypath; if (userarg) { ttype = userarg; @@ -476,23 +515,46 @@ get_termcap_entry(char *userarg) if ((ttype = getenv("TERM")) != 0) goto map; -#if HAVE_GETTTYNAM - /* - * We have the 4.3BSD library call getttynam(3); that means - * there's an /etc/ttys to look up device-to-type mappings in. - * Try ttyname(3); check for dialup or other mapping. - */ if ((ttypath = ttyname(STDERR_FILENO)) != 0) { if ((p = strrchr(ttypath, '/')) != 0) ++p; else p = ttypath; +#if HAVE_GETTTYNAM + /* + * We have the 4.3BSD library call getttynam(3); that means + * there's an /etc/ttys to look up device-to-type mappings in. + * Try ttyname(3); check for dialup or other mapping. + */ if ((t = getttynam(p))) { ttype = t->ty_type; goto map; } +#else + if ((fp = fopen("/etc/ttytype", "r")) != 0 + || (fp = fopen("/etc/ttys", "r")) != 0) { + char buffer[BUFSIZ]; + char *s, *t, *d; + + while (fgets(buffer, sizeof(buffer)-1, fp) != 0) { + for (s = buffer, t = d = 0; *s; s++) { + if (isspace(*s)) + *s = '\0'; + else if (t == 0) + t = s; + else if (d == 0 && s != buffer && s[-1] == '\0') + d = s; + } + if (t != 0 && d != 0 && !strcmp(d,p)) { + ttype = strdup(t); + fclose(fp); + goto map; + } + } + fclose(fp); + } +#endif /* HAVE_GETTTYNAM */ } -#endif /* BSD */ /* If still undefined, use "unknown". */ ttype = "unknown"; @@ -562,6 +624,8 @@ found: if ((p = getenv("TERMCAP")) != 0 && *p != '/') { #undef CERASE #undef CINTR #undef CKILL +#undef CLNEXT +#undef CRPRNT #undef CQUIT #undef CSTART #undef CSTOP @@ -572,14 +636,8 @@ found: if ((p = getenv("TERMCAP")) != 0 && *p != '/') { #define CERASE CTRL('H') #define CINTR 127 /* ^? */ #define CKILL CTRL('U') -#if defined(CLNEXT) -#undef CLNEXT #define CLNEXT CTRL('v') -#endif -#if defined(CRPRNT) -#undef CRPRNT #define CRPRNT CTRL('r') -#endif #define CQUIT CTRL('\\') #define CSTART CTRL('Q') #define CSTOP CTRL('S') @@ -710,59 +768,43 @@ reset_mode(void) } /* - * Determine the erase, interrupt, and kill characters from the termcap - * entry and command line and update their values in 'mode'. + * Returns a "good" value for the erase character. This is loosely based on + * the BSD4.4 logic. */ -static void -set_control_chars(void) +static int +default_erase(void) { -#ifdef __OBSOLETE__ - /* - * 4.4BSD logic for setting erasechar, left here in case there is some - * necessary subtlety missed in the production code below that really - * needs to be added someday (in particular, I don't understand what - * the second if-statement involving the os flag is doing, and it makes - * my head hurt when I try and follow out all the combinations). - */ - char *bp, *p, bs_char, buf[1024]; - - bp = buf; - p = tgetstr("kb", &bp); - if (p == 0 || p[1] != '\0') - p = tgetstr("bc", &bp); - if (p != 0 && p[1] == '\0') - bs_char = p[0]; - else if (tgetflag("bs")) - bs_char = CTRL('h'); - else - bs_char = 0; + int result; - if (terasechar==0 && !tgetflag("os") && mode.c_cc[VERASE] != CERASE) { - if (tgetflag("bs") || bs_char != 0) - terasechar = -1; - } - if (terasechar < 0) - terasechar = (bs_char != 0) ? bs_char : CTRL('h'); -#else - /* the real erasechar logic used now */ - char bs_char = 0; - - if (key_backspace != (char *)0) - bs_char = key_backspace[0]; + if (over_strike + && key_backspace != 0 + && strlen(key_backspace) == 1) + result = key_backspace[0]; + else + result = CERASE; - if (terasechar <= 0) - terasechar = (bs_char != 0) ? bs_char : CTRL('h'); -#endif /* __OBSOLETE__ */ + return result; +} +/* + * Update the values of the erase, interrupt, and kill characters in 'mode'. + * + * SVr4 tset (e.g., Solaris 2.5) only modifies the intr, quit or erase + * characters if they're unset, or if we specify them as options. This differs + * from BSD 4.4 tset, which always sets erase. + */ +static void +set_control_chars(void) +{ #ifdef TERMIOS - if (mode.c_cc[VERASE] == 0 || terasechar != 0) - mode.c_cc[VERASE] = terasechar ? terasechar : CERASE; + if (mode.c_cc[VERASE] == 0 || terasechar >= 0) + mode.c_cc[VERASE] = terasechar >= 0 ? terasechar : default_erase(); - if (mode.c_cc[VINTR] == 0 || intrchar != 0) - mode.c_cc[VINTR] = intrchar ? intrchar : CINTR; + if (mode.c_cc[VINTR] == 0 || intrchar >= 0) + mode.c_cc[VINTR] = intrchar >= 0 ? intrchar : CINTR; - if (mode.c_cc[VKILL] == 0 || tkillchar != 0) - mode.c_cc[VKILL] = tkillchar ? tkillchar : CKILL; + if (mode.c_cc[VKILL] == 0 || tkillchar >= 0) + mode.c_cc[VKILL] = tkillchar >= 0 ? tkillchar : CKILL; #endif } @@ -876,7 +918,7 @@ set_init(void) if (settle) { (void)putc('\r', stderr); (void)fflush(stderr); - (void)sleep(1); /* Settle the terminal. */ + (void)napms(1000); /* Settle the terminal. */ } } @@ -926,28 +968,32 @@ static void report(const char *name, int which, u_int def) { #ifdef TERMIOS - u_int old, new; + u_int older, newer; char *p; - new = mode.c_cc[which]; - old = oldmode.c_cc[which]; + newer = mode.c_cc[which]; + older = oldmode.c_cc[which]; - if (old == new && old == def) + if (older == newer && older == def) return; - (void)fprintf(stderr, "%s %s ", name, old == new ? "is" : "set to"); + (void)fprintf(stderr, "%s %s ", name, older == newer ? "is" : "set to"); - if ((p = key_backspace) != 0 - && new == (u_int)p[0] + /* + * Check 'delete' before 'backspace', since the key_backspace value + * is ambiguous. + */ + if (newer == 0177) + (void)fprintf(stderr, "delete.\n"); + else if ((p = key_backspace) != 0 + && newer == (u_int)p[0] && p[1] == '\0') (void)fprintf(stderr, "backspace.\n"); - else if (new == 0177) - (void)fprintf(stderr, "delete.\n"); - else if (new < 040) { - new ^= 0100; - (void)fprintf(stderr, "control-%c (^%c).\n", new, new); + else if (newer < 040) { + newer ^= 0100; + (void)fprintf(stderr, "control-%c (^%c).\n", newer, newer); } else - (void)fprintf(stderr, "%c.\n", new); + (void)fprintf(stderr, "%c.\n", newer); #endif } @@ -994,10 +1040,17 @@ usage(const char* pname) exit(EXIT_FAILURE); } +static char arg_to_char(void) +{ + return (optarg[0] == '^' && optarg[1] != '\0') + ? ((optarg[1] == '?') ? '\177' : CTRL(optarg[1])) + : optarg[0]; +} + int main(int argc, char **argv) { -#ifdef TIOCGWINSZ +#if defined(TIOCGWINSZ) && defined(TIOCSWINSZ) struct winsize win; #endif int ch, noinit, noset, quiet, Sflag, sflag, showterm; @@ -1041,22 +1094,16 @@ main(int argc, char **argv) add_mapping("dialup", optarg); break; case 'e': /* erase character */ - terasechar = optarg[0] == '^' && optarg[1] != '\0' ? - optarg[1] == '?' ? '\177' : CTRL(optarg[1]) : - optarg[0]; + terasechar = arg_to_char(); break; case 'I': /* no initialization strings */ noinit = 1; break; case 'i': /* interrupt character */ - intrchar = optarg[0] == '^' && optarg[1] != '\0' ? - optarg[1] == '?' ? '\177' : CTRL(optarg[1]) : - optarg[0]; + intrchar = arg_to_char(); break; case 'k': /* kill character */ - tkillchar = optarg[0] == '^' && optarg[1] != '\0' ? - optarg[1] == '?' ? '\177' : CTRL(optarg[1]) : - optarg[0]; + tkillchar = arg_to_char(); break; case 'm': /* map identifier to type */ add_mapping(0, optarg); @@ -1095,7 +1142,7 @@ main(int argc, char **argv) tcolumns = columns; tlines = lines; -#ifdef TIOCGWINSZ +#if defined(TIOCGWINSZ) && defined(TIOCSWINSZ) /* Set window size */ (void)ioctl(STDERR_FILENO, TIOCGWINSZ, &win); if (win.ws_row == 0 && win.ws_col == 0 && diff --git a/shlib-versions b/shlib-versions new file mode 100644 index 00000000..313d2c2c --- /dev/null +++ b/shlib-versions @@ -0,0 +1,4 @@ +.*-.*-linux.* libform=4 +.*-.*-linux.* libmenu=4 +.*-.*-linux.* libncurses=4 +.*-.*-linux.* libpanel=4 diff --git a/sysdeps/unix/sysv/linux/alpha/configure b/sysdeps/unix/sysv/linux/alpha/configure new file mode 100755 index 00000000..6fa25190 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/configure @@ -0,0 +1,2 @@ +# Alpha uses long as bool. +nc_cv_type_of_bool=long diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure old mode 100644 new mode 100755 index 87f91bf5..6f4b789a --- a/sysdeps/unix/sysv/linux/configure +++ b/sysdeps/unix/sysv/linux/configure @@ -1,55 +1,59 @@ # Local configure fragment for ncurses/sysdeps/unix/sysv/linux. -glibc_nc_srcdir=${srcdir}/ncurses - -NCURSES_MAJOR="`egrep '^NCURSES_MAJOR[ ]*=' $glibc_nc_srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" -NCURSES_MINOR="`egrep '^NCURSES_MINOR[ ]*=' $glibc_nc_srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" -NCURSES_PATCH="`egrep '^NCURSES_PATCH[ ]*=' $glibc_nc_srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" -nc_cv_abi_version=${NCURSES_MAJOR} -nc_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR} +nc_given_srcdir=${srcdir}/ncurses + +NCURSES_MAJOR="`egrep '^NCURSES_MAJOR[ ]*=' $nc_given_srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" +NCURSES_MINOR="`egrep '^NCURSES_MINOR[ ]*=' $nc_given_srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" +NCURSES_PATCH="`egrep '^NCURSES_PATCH[ ]*=' $nc_given_srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" +cf_cv_abi_version=${NCURSES_MAJOR} +cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR} + +# Default to char +if [ x${cf_cv_type_of_bool} = x ] +then + cf_cv_type_of_bool=char +fi -rm -f ncurses/codes.c \ +rm -f ncurses/MKterm.h.awk \ + ncurses/codes.c \ ncurses/comp_captab.c \ + ncurses/confdefs.h \ + ncurses/config.log \ ncurses/curses.h \ - ncurses/edit_man.sed \ - ncurses/edit_man.sh \ - ncurses/eti.h \ ncurses/expanded.c \ ncurses/fallback.c \ - ncurses/form.h \ ncurses/hashsize.h \ ncurses/keys.tries \ ncurses/lib_gen.c \ ncurses/lib_keyname.c \ - ncurses/menu.h \ - ncurses/mf_common.h \ ncurses/names.c \ ncurses/ncurses_cfg.h \ ncurses/nomacros.h \ - ncurses/panel.h \ ncurses/parametrized.h \ - ncurses/run_tic.sh \ ncurses/term.h \ ncurses/termcap.h \ ncurses/terminfo.5 \ ncurses/termsort.c \ ncurses/unctrl.c \ - ncurses/unctrl.h \ - ncurses/config_h + ncurses/unctrl.h # Protect against being on the right side of a sed subst in config.status. sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g; s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs < $nc_file fi; done rm -f conftest.s* +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# nc_d sets the value in "#define NAME VALUE" lines. +nc_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +nc_dB='\([ ][ ]*\)[^ ]*%\1#\2' +nc_dC='\3' +nc_dD='%g' +# nc_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +nc_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +nc_uB='\([ ]\)%\1#\2define\3' +nc_uC=' ' +nc_uD='\4%g' +# nc_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +nc_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +nc_eB='$%\1#\2define\3' +nc_eC=' ' +nc_eD='%g' + +NC_CONFIG_HEADERS="ncurses/ncurses_cfg.h:include/ncurses_cfg.hin" +for nc_file in .. $NC_CONFIG_HEADERS; do if test "x$nc_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$nc_file" in + *:*) nc_file_in=`echo "$nc_file"|sed 's%[^:]*:%%'` + nc_file=`echo "$nc_file"|sed 's%:.*%%'` ;; + *) nc_file_in="${nc_file}.in" ;; + esac + + echo creating $nc_file + + rm -f conftest.frag conftest.in conftest.out + nc_file_inputs=`echo $nc_file_in|sed -e "s%^%$nc_given_srcdir/%" -e "s%:% $nc_given_srcdir/%g"` + cat $nc_file_inputs > conftest.in + + rm -f conftest.frag + cat >> conftest.frag <> conftest.frag <> conftest.frag <> conftest.frag <> conftest.frag <> conftest.frag <> conftest.edit < conftest.out +rm -f conftest.in +mv conftest.out conftest.in +rm -f conftest.edit conftest.frag + + rm -f conftest.frag conftest.h + echo "/* $nc_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $nc_file conftest.h 2>/dev/null; then + echo "$nc_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + nc_dir=`echo $nc_file|sed 's%/[^/][^/]*$%%'` + if test "$nc_dir" != "$nc_file" && test "$nc_dir" != .; then + # The file is in a subdirectory. + test ! -d "$nc_dir" && mkdir "$nc_dir" + fi + rm -f $nc_file + mv conftest.h $nc_file + fi +fi; done + SYS_NAME=`uname -a` if test -z "$SYS_NAME"; then SYS_NAME=unknown;fi -AWK=awk -CC="gcc -I${glibc_nc_srcdir}/ncurses -Incurses -I${glibc_nc_srcdir}/include" -CPP="${CC} -E" -NC_LIST_MODELS="normal" -WITH_ECHO="yes" -WITH_OVERWRITE="yes" +NC_AWK=awk +BUILD_CC=${BUILD_CC-gcc} +NC_CC="${BUILD_CC} -I${nc_given_srcdir}/ncurses -Incurses -I${nc_given_srcdir}/include" +NC_CPP="${NC_CC} -E" +CF_LIST_MODELS="normal" +#WITH_ECHO="yes" +#WITH_OVERWRITE="yes" nc_cxx_library="yes" -nc_cv_systype="Linux" -nc_cv_rel_version="4.1" -nc_cv_abi_version="4" -nc_cv_do_symlinks="yes" -nc_cv_rm_so_locs="no" - - - - - - +cf_cv_systype="Linux" +cf_cv_rel_version="4.2" +cf_cv_abi_version="4" +cf_cv_do_symlinks="yes" +cf_cv_rm_so_locs="no" rm -f headers.sed headers.sh @@ -190,84 +347,52 @@ NC_EOF chmod 0755 headers.sh -### Special editing. We generate ncurses_cfg.h directly to allow all filenames -### to be MSDOS-compatible, as well as to make the list of definitions be -### dynamically determined by the configuration script -- a consideration when -### doing type-clean development testing. - -echo creating ncurses/ncurses_cfg.h -rm -f ncurses/ncurses_cfg.h -echo "/* generated by configure-script - * On host: $SYS_NAME - */ -#ifndef NC_CONFIG_H -#define NC_CONFIG_H" >ncurses/ncurses_cfg.h -sed -e '/^ -D/!d' \ - -e 's/ -D/\ -#define /g' \ - -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1 /g' \ - -e 's/\\//g' \ - ncurses/config_h | sort >>ncurses/ncurses_cfg.h -echo " - /* The C compiler may not treat these properly, but C++ has to */ -#ifdef __cplusplus -#undef const -#undef inline -#else -#if defined(lint) || defined(TRACE) -#undef inline -#define inline /* nothing */ -#endif -#endif - -#endif /* NC_CONFIG_H */" >> ncurses/ncurses_cfg.h -echo removing ncurses/config_h -rm ncurses/config_h - echo creating ncurses/term.h -${AWK} -f ncurses/MKterm.h.awk ${glibc_nc_srcdir}/include/Caps > ncurses/term.h -sh ${glibc_nc_srcdir}/include/edit_cfg.sh ncurses/ncurses_cfg.h ncurses/term.h +${NC_AWK} -f ncurses/MKterm.h.awk ${nc_given_srcdir}/include/Caps > ncurses/term.h +sh ${nc_given_srcdir}/include/edit_cfg.sh ncurses/ncurses_cfg.h ncurses/term.h echo creating ncurses/hashsize.h -sh ${glibc_nc_srcdir}/include/MKhashsize.sh ${glibc_nc_srcdir}/include/Caps > ncurses/hashsize.h +sh ${nc_given_srcdir}/include/MKhashsize.sh ${nc_given_srcdir}/include/Caps > ncurses/hashsize.h echo creating ncurses/parametrized.h -sh ${glibc_nc_srcdir}/include/MKparametrized.sh ${glibc_nc_srcdir}/include/Caps > ncurses/parametrized.h +sh ${nc_given_srcdir}/include/MKparametrized.sh ${nc_given_srcdir}/include/Caps > ncurses/parametrized.h echo creating ncurses/termsort.c -sh ${glibc_nc_srcdir}/progs/MKtermsort.sh "${AWK}" ${glibc_nc_srcdir}/include/Caps > ncurses/termsort.c +sh ${nc_given_srcdir}/progs/MKtermsort.sh "${NC_AWK}" ${nc_given_srcdir}/include/Caps > ncurses/termsort.c echo creating ncurses/fallback.c -sh ${glibc_nc_srcdir}/ncurses/MKfallback.sh > ncurses/fallback.c +sh ${nc_given_srcdir}/ncurses/MKfallback.sh > ncurses/fallback.c echo creating ncurses/lib_gen.c -sh ${glibc_nc_srcdir}/ncurses/MKlib_gen.sh "${CPP}" "${AWK}" < ncurses/curses.h > ncurses/lib_gen.c +sh ${nc_given_srcdir}/ncurses/MKlib_gen.sh "${NC_CPP}" "${NC_AWK}" < ncurses/curses.h > ncurses/lib_gen.c echo creating ncurses/nomacros.h -sh ${glibc_nc_srcdir}/ncurses/MKlib_gen.sh "${CPP}" "${AWK}" < ncurses/curses.h | fgrep undef > ncurses/nomacros.h - -echo creating ncurses/keys.tries -${AWK} -f ${glibc_nc_srcdir}/ncurses/MKkeys.awk ${glibc_nc_srcdir}/ncurses/keys.list > ncurses/keys.tries +sh ${nc_given_srcdir}/ncurses/MKlib_gen.sh "${NC_CPP}" "${NC_AWK}" < ncurses/curses.h | fgrep undef > ncurses/nomacros.h echo creating ncurses/expanded.c -sh ${glibc_nc_srcdir}/ncurses/MKexpanded.sh "${CPP}" +sh ${nc_given_srcdir}/ncurses/MKexpanded.sh "${NC_CPP}" mv expanded.c ncurses/expanded.c echo creating ncurses/comp_captab.c -${CC} -o make_hash -DMAIN_PROGRAM ${glibc_nc_srcdir}/ncurses/comp_hash.c -sh ${glibc_nc_srcdir}/ncurses/MKcaptab.awk "${AWK}" ${glibc_nc_srcdir}/include/Caps > ncurses/comp_captab.c +${NC_CC} -o make_hash -DMAIN_PROGRAM ${nc_given_srcdir}/ncurses/comp_hash.c +sh ${nc_given_srcdir}/ncurses/MKcaptab.awk "${NC_AWK}" ${nc_given_srcdir}/include/Caps > ncurses/comp_captab.c rm -f make_hash echo creating ncurses/lib_keyname.c -${AWK} -f ${glibc_nc_srcdir}/ncurses/MKkeyname.awk ${glibc_nc_srcdir}/ncurses/keys.list > ncurses/lib_keyname.c +${NC_AWK} -f ${nc_given_srcdir}/ncurses/MKkeyname.awk ${nc_given_srcdir}/ncurses/keys.list > ncurses/lib_keyname.c echo creating ncurses/names.c and ncurses/codes.c -${AWK} -f ${glibc_nc_srcdir}/ncurses/MKnames.awk ${glibc_nc_srcdir}/include/Caps +${NC_AWK} -f ${nc_given_srcdir}/ncurses/MKnames.awk ${nc_given_srcdir}/include/Caps cat namehdr boolnames boolfnames numnames numfnames strnames strfnames nameftr >ncurses/names.c cat namehdr boolcodes numcodes strcodes codeftr > ncurses/codes.c rm -f namehdr nameftr codeftr boolnames boolfnames boolcodes numnames numfnames numcodes strnames strfnames strcodes +echo creating ncurses/keys.tries +${NC_CC} -o make_key ${nc_given_srcdir}/ncurses/make_keys.c +./make_key ${nc_given_srcdir}/ncurses/keys.list > ncurses/keys.tries +rm -f make_key + echo creating ncurses/unctrl.c -echo | ${AWK} -f ${glibc_nc_srcdir}/ncurses/MKunctrl.awk > ncurses/unctrl.c +echo | ${NC_AWK} -f ${nc_given_srcdir}/ncurses/MKunctrl.awk > ncurses/unctrl.c echo creating ncurses/terminfo.5 -sh ${glibc_nc_srcdir}/man/MKterminfo.sh ${glibc_nc_srcdir}/man/terminfo.head ${glibc_nc_srcdir}/include/Caps ${glibc_nc_srcdir}/man/terminfo.tail > ncurses/terminfo.5 +sh ${nc_given_srcdir}/man/MKterminfo.sh ${nc_given_srcdir}/man/terminfo.head ${nc_given_srcdir}/include/Caps ${nc_given_srcdir}/man/terminfo.tail > ncurses/terminfo.5 diff --git a/sysdeps/unix/sysv/linux/edit_man.sh b/sysdeps/unix/sysv/linux/edit_man.sh old mode 100644 new mode 100755 diff --git a/sysdeps/unix/sysv/linux/run_tic.sh b/sysdeps/unix/sysv/linux/run_tic.sh index 12b16feb..2dccd56b 100755 --- a/sysdeps/unix/sysv/linux/run_tic.sh +++ b/sysdeps/unix/sysv/linux/run_tic.sh @@ -1,24 +1,35 @@ #!/bin/sh -################################################################################ -# Copyright 1996 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ -# $Id: run_tic.sh,v 1.8 1997/05/09 10:43:29 hjl Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996 +# +# $Id: run_tic.sh,v 1.9 1998/02/11 12:14:03 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. # diff --git a/tack/Makefile.in b/tack/Makefile.in new file mode 100644 index 00000000..1e5a011a --- /dev/null +++ b/tack/Makefile.in @@ -0,0 +1,167 @@ +# $Id: Makefile.in,v 1.6 1998/02/11 12:14:03 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1997 +# +# Makefile for terminfo/termcap test program +# +# The following pre-processor variables may be set. +# +# SELECT Use this define if your operating system has the select +# system call. +# +# WAIT_MODE Use this define if your operating system cannot tell if +# a chracter is ready in the input queue. Funtion keys +# must be padded with blanks. +# +# If generated without pre-processor variables, a terminfo test +# program will be generated for System V Release 3. + +# turn off _all_ suffix rules; we'll generate our own +.SUFFIXES: + +SHELL = /bin/sh +THIS = Makefile + +MODEL = ../@DFT_OBJ_SUBDIR@ +INSTALL_PREFIX = @INSTALL_PREFIX@ +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ + +CC = @CC@ +CFLAGS = @CFLAGS@ + +INCDIR = $(srcdir)/../include +CPPFLAGS = -I../tack -I$(srcdir) @CPPFLAGS@ \ + -DHAVE_CONFIG_H -DSELECT + +CCFLAGS = $(CPPFLAGS) $(CFLAGS) + +CFLAGS_NORMAL = $(CCFLAGS) +CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE +CFLAGS_PROFILE = $(CCFLAGS) -pg +CFLAGS_SHARED = $(CCFLAGS) # @CC_SHARED_OPTS@ + +CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) + +LD = @LD@ +LINK = $(CC) +LDFLAGS = @EXTRA_LDFLAGS@ \ + -L../lib \ + -L$(libdir) \ + -lncurses@DFT_ARG_SUFFIX@ @LDFLAGS@ @LD_MODEL@ @LIBS@ @EXTRA_LIBS@ + +LDFLAGS_NORMAL = $(LDFLAGS) +LDFLAGS_DEBUG = $(LDFLAGS) @CC_G_OPT@ +LDFLAGS_PROFILE = $(LDFLAGS) -pg +LDFLAGS_SHARED = $(LDFLAGS) @CC_SHARED_OPTS@ @LD_SHARED_OPTS@ + +LDFLAGS_DEFAULT = $(LDFLAGS_@DFT_UPR_MODEL@) + +LINT = @LINT@ +LINT_OPTS = @LINT_OPTS@ +LINT_LIBS = -lncurses @LIBS@ + +# This would be $(SHARED_OBJS), but make cannot handle this much forward ref. +TACK_DEPS = \ + $(MODEL)/ansi.o \ + $(MODEL)/charset.o \ + $(MODEL)/color.o \ + $(MODEL)/control.o \ + $(MODEL)/crum.o \ + $(MODEL)/edit.o \ + $(MODEL)/fun.o \ + $(MODEL)/init.o \ + $(MODEL)/menu.o \ + $(MODEL)/modes.o \ + $(MODEL)/output.o \ + $(MODEL)/pad.o \ + $(MODEL)/scan.o \ + $(MODEL)/sync.o \ + $(MODEL)/sysdep.o \ + $(MODEL)/tack.o + +TARGET = tack + +all: $(TACK_DEPS) $(TARGET) + +sources: + +$(TARGET): $(TACK_DEPS) + @ echo linking $@ ... ; $(LINK) $(TACK_DEPS) $(LDFLAGS_DEFAULT) -o $@ + +$(TACK_DEPS): $(srcdir)/tack.h + +lint: + lint $(C_SRC) + +mostlyclean : + -rm -f core tags TAGS *~ *.ln *.atac trace + +clean :: mostlyclean + rm -f $(TACK_DEPS) $(TARGET) tack.tar tack.tar.gz + +distclean :: clean + -rm -f Makefile + +realclean : distclean + +# vi tags +tags: $(C_SRC) $(DIR)/tack.h + ctags $(>) + +# emacs tags +TAGS: $(C_SRC) + etags $(C_SRC) + +install: $(TARGET) + $(INSTALL_PROGRAM) $(TARGET) $(INSTALL_PREFIX)$(bindir)/$(TARGET) + +list: $(srcdir)/tack.h $(C_SRC) + for name in $(>) ; \ + do \ + ucb cat -n $$name | ucb pr -h "$$name" | ucb lpr ; \ + done + +# archive a backup copy +arch: $(srcdir)/Makefile $(srcdir)/tack.h $(C_SRC) + rm -f tack.a + ar q tack.a $(>) + +tack.tar.gz: tack.tar + gzip tack.tar + +tack.tar: makefile *.[ch] tack.1 HISTORY + tar -cvf tack.tar makefile *.[ch] tack.1 HISTORY diff --git a/tack/modules b/tack/modules new file mode 100644 index 00000000..334d512c --- /dev/null +++ b/tack/modules @@ -0,0 +1,47 @@ +# $Id: modules,v 1.3 1998/02/11 12:14:03 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1997 +# +ansi tack $(srcdir) +charset tack $(srcdir) +color tack $(srcdir) +control tack $(srcdir) +crum tack $(srcdir) +edit tack $(srcdir) +fun tack $(srcdir) +init tack $(srcdir) +menu tack $(srcdir) +modes tack $(srcdir) +output tack $(srcdir) +pad tack $(srcdir) +scan tack $(srcdir) +sync tack $(srcdir) +sysdep tack $(srcdir) +tack tack $(srcdir) diff --git a/tar-copy.sh b/tar-copy.sh new file mode 100755 index 00000000..4e45bc34 --- /dev/null +++ b/tar-copy.sh @@ -0,0 +1,70 @@ +#!/bin/sh +# $Id: tar-copy.sh,v 1.3 1998/02/11 12:14:03 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1997,1998 +# +# Copy a collection of files using 'tar', so that their dates and links are +# preserved +# +# Parameters: +# $1 = files to copy +# $2 = source directory +# $3 = destination directory +# +#DOIT=echo +DOIT=eval + +if test $# != 3 ; then + echo "Usage: $0 files source target" + exit 1 +elif test ! -d "$2" ; then + echo "Source directory not found: $2" + exit 1 +elif test ! -d "$3" ; then + echo "Target directory not found: $3" + exit 1 +fi + +WD=`pwd` + +TMP=$WD/copy$$ +trap "rm -f $TMP" 0 1 2 5 15 + +cd $2 +if ( tar cf $TMP $1 ) +then + cd $3 + LIST=`tar tf $TMP 2>&1` + $DOIT rm -rf $LIST 2>/dev/null + $DOIT tar xvf $TMP +else + echo "Cannot create tar of $1 files" + exit 1 +fi diff --git a/test/Makefile.in b/test/Makefile.in index 87ead9c4..d189ada7 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1,27 +1,43 @@ -# $Id: Makefile.in,v 1.29 1997/05/10 16:23:07 tom Exp $ -################################################################################ -# Copyright 1996,1997 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: Makefile.in,v 1.45 1998/02/11 12:14:05 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1996,1997,1998 +# # Makefile for ncurses tests. +# turn off _all_ suffix rules; we'll generate our own +.SUFFIXES: + SHELL = /bin/sh +x = @PROG_EXT@ + MODEL = ../@DFT_OBJ_SUBDIR@ srcdir = @srcdir@ prefix = @prefix@ @@ -39,12 +55,14 @@ CCFLAGS = $(CPPFLAGS) $(CFLAGS) CFLAGS_NORMAL = $(CCFLAGS) CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE CFLAGS_PROFILE = $(CCFLAGS) -pg -CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ +CFLAGS_SHARED = $(CCFLAGS) # @CC_SHARED_OPTS@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) -ABI_VERSION = @nc_cv_abi_version@ +REL_VERSION = @cf_cv_rel_version@ +ABI_VERSION = @cf_cv_abi_version@ LOCAL_LIBS = @TEST_DEPS@ +MATH_LIB = @MATH_LIB@ LD = @LD@ LINK = $(CC) @@ -54,7 +72,7 @@ LDFLAGS = @LD_MODEL@ @TEST_ARGS@ @LIBS@ @EXTRA_LIBS@ @LOCAL_LDFLAGS@ @LDFLAGS@ LDFLAGS_NORMAL = $(LDFLAGS) LDFLAGS_DEBUG = $(LDFLAGS) @CC_G_OPT@ LDFLAGS_PROFILE = $(LDFLAGS) -pg -LDFLAGS_SHARED = $(LDFLAGS) @CC_SHARED_OPTS@ +LDFLAGS_SHARED = $(LDFLAGS) @CC_SHARED_OPTS@ # @LD_SHARED_OPTS@ LDFLAGS_DEFAULT = $(LDFLAGS_@DFT_UPR_MODEL@) @@ -63,71 +81,111 @@ LINT_OPTS = @LINT_OPTS@ LINT_LIBS = -lform -lmenu -lpanel -lncurses @LIBS@ TESTS = \ - blue \ - bs \ - firework \ - gdc \ - hanoi \ - hashtest \ - knight \ - lrtest \ - ncurses \ - newdemo \ - rain \ - tclock \ - testcurs \ - view \ - worm \ - xmas + blue$x \ + bs$x \ + firework$x \ + firstlast$x \ + gdc$x \ + hanoi$x \ + hashtest$x \ + knight$x \ + lrtest$x \ + ncurses$x \ + newdemo$x \ + rain$x \ + tclock$x \ + testaddch$x \ + testcurs$x \ + testscanw$x \ + view$x \ + worm$x \ + xmas$x all: $(TESTS) -blue: $(MODEL)/blue.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -bs: $(MODEL)/bs.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -firework: $(MODEL)/firework.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -gdc: $(MODEL)/gdc.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -hanoi: $(MODEL)/hanoi.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -hashtest: $(MODEL)/hashtest.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -knight: $(MODEL)/knight.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -lrtest: $(MODEL)/lrtest.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -ncurses: $(MODEL)/ncurses.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -newdemo: $(MODEL)/newdemo.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -rain: $(MODEL)/rain.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -tclock: $(MODEL)/tclock.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -lm -testcurs: $(MODEL)/testcurs.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -view: $(MODEL)/view.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -worm: $(MODEL)/worm.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -xmas: $(MODEL)/xmas.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) +sources: + +blue$x: $(MODEL)/blue.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/blue.o $(LDFLAGS_DEFAULT) + +bs$x: $(MODEL)/bs.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/bs.o $(LDFLAGS_DEFAULT) + +firework$x: $(MODEL)/firework.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/firework.o $(LDFLAGS_DEFAULT) + +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) + +hanoi$x: $(MODEL)/hanoi.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/hanoi.o $(LDFLAGS_DEFAULT) + +hashtest$x: $(MODEL)/hashtest.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/hashtest.o $(LDFLAGS_DEFAULT) + +knight$x: $(MODEL)/knight.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/knight.o $(LDFLAGS_DEFAULT) + +lrtest$x: $(MODEL)/lrtest.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/lrtest.o $(LDFLAGS_DEFAULT) + +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) + +rain$x: $(MODEL)/rain.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/rain.o $(LDFLAGS_DEFAULT) + +tclock$x: $(MODEL)/tclock.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/tclock.o $(LDFLAGS_DEFAULT) $(MATH_LIB) + +testaddch$x: $(MODEL)/testaddch.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/testaddch.o $(LDFLAGS_DEFAULT) + +testcurs$x: $(MODEL)/testcurs.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/testcurs.o $(LDFLAGS_DEFAULT) + +testscanw$x: $(MODEL)/testscanw.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/testscanw.o $(LDFLAGS_DEFAULT) + +view$x: $(MODEL)/view.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/view.o $(LDFLAGS_DEFAULT) + +worm$x: $(MODEL)/worm.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/worm.o $(LDFLAGS_DEFAULT) + +xmas$x: $(MODEL)/xmas.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/xmas.o $(LDFLAGS_DEFAULT) install: install.libs: install.test: -clean :: - -rm -rf *.o trace screendump *.atac *.lis core $(TESTS) +uninstall: +uninstall.libs: +uninstall.test: + +mostlyclean :: + -rm -f core tags TAGS *~ *.ln *.atac trace + +clean :: mostlyclean + -rm -rf *.o screendump *.lis $(TESTS) distclean :: clean -rm -f Makefile ncurses_cfg.h config.* -mostlyclean :: clean - realclean :: distclean lint: sh -c 'for N in $(TESTS); do echo LINT:$$N; $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/$$N.c $(LINT_LIBS); done' + +# Use this to get a list of test-programs for the standalone configure script. +echo_tests : + @echo "$(TESTS)" +echo_suffix : + @echo "$x" diff --git a/test/bs.c b/test/bs.c index 98d6d060..eaa6f1ae 100644 --- a/test/bs.c +++ b/test/bs.c @@ -7,7 +7,7 @@ * v2.0 featuring strict ANSI/POSIX conformance, November 1993. * v2.1 with ncurses mouse support, September 1995 * - * $Id: bs.c,v 1.17 1997/04/06 01:42:57 tom Exp $ + * $Id: bs.c,v 1.22 1997/12/20 15:11:53 tom Exp $ */ #include @@ -57,7 +57,7 @@ static int getcoord(int); /* display symbols */ #define SHOWHIT '*' #define SHOWSPLASH ' ' -#define IS_SHIP(c) isupper(c) +#define IS_SHIP(c) (isupper(c) ? TRUE : FALSE) /* how to position us on player board */ #define PYBASE 3 @@ -118,9 +118,9 @@ static int cury = (BDEPTH / 2); typedef struct { char *name; /* name of the ship type */ - unsigned hits; /* how many times has this ship been hit? */ + int hits; /* how many times has this ship been hit? */ char symbol; /* symbol for game purposes */ - unsigned char length; /* length of ship */ + int length; /* length of ship */ char x, y; /* coordinates of ship start point */ unsigned char dir; /* direction of `bow' */ bool placed; /* has it been placed on the board? */ @@ -148,7 +148,8 @@ static ship_t cpuship[SHIPTYPES] = }; /* "Hits" board, and main board. */ -static char hits[2][BWIDTH][BDEPTH], board[2][BWIDTH][BDEPTH]; +static char hits[2][BWIDTH][BDEPTH]; +static char board[2][BWIDTH][BDEPTH]; static int turn; /* 0=player, 1=computer */ static int plywon=0, cpuwon=0; /* How many games has each won? */ @@ -159,7 +160,7 @@ static int salvo, blitz, closepack; static RETSIGTYPE uninitgame(int sig) GCC_NORETURN; -static void uninitgame(int sig GCC_UNUSED) +static RETSIGTYPE uninitgame(int sig GCC_UNUSED) /* end the game, either normally or due to signal */ { clear(); @@ -334,9 +335,20 @@ static void initgame(void) for (i = 0; i < SHIPTYPES; i++) { ss = cpuship + i; - ss->x = ss->y = ss->dir = ss->hits = ss->placed = 0; + + ss->x = + ss->y = + ss->dir = + ss->hits = 0; + ss->placed = FALSE; + ss = plyship + i; - ss->x = ss->y = ss->dir = ss->hits = ss->placed = 0; + + ss->x = + ss->y = + ss->dir = + ss->hits = 0; + ss->placed = FALSE; } /* draw empty boards */ @@ -626,13 +638,13 @@ static int getcoord(int atcpu) } } -static int collidecheck(int b, int y, int x) +static bool collidecheck(int b, int y, int x) /* is this location on the selected zboard adjacent to a ship? */ { - int collide; + bool collide; /* anything on the square */ - if ((collide = IS_SHIP(board[b][x][y])) != 0) + if ((collide = IS_SHIP(board[b][x][y])) != FALSE) return(collide); /* anything on the neighbors */ @@ -646,8 +658,11 @@ static int collidecheck(int b, int y, int x) yend = y + yincr[i]; xend = x + xincr[i]; - if (ONBOARD(xend, yend)) - collide += IS_SHIP(board[b][xend][yend]); + if (ONBOARD(xend, yend) + && IS_SHIP(board[b][xend][yend])) { + collide = TRUE; + break; + } } } return(collide); @@ -675,7 +690,7 @@ static bool checkplace(int b, ship_t *ss, int vis) error("Figure I won't find it if you put it there?"); break; } - return(0); + return(FALSE); } for(l = 0; l < ss->length; ++l) @@ -809,7 +824,7 @@ static int plyturn(void) break; } hit = IS_SHIP(board[COMPUTER][curx][cury]); - hits[PLAYER][curx][cury] = hit ? MARK_HIT : MARK_MISS; + hits[PLAYER][curx][cury] = (hit ? MARK_HIT : MARK_MISS); cgoto(cury, curx); #ifdef A_COLOR if (has_colors()) @@ -848,7 +863,7 @@ static int plyturn(void) (void)beep(); return(awinna() == -1); } - return(hit); + return (hit); } static int sgetc(const char *s) @@ -935,7 +950,7 @@ static void randomfire(int *px, int *py) #define S_HIT 1 #define S_SUNK -1 -static bool cpufire(int x, int y) +static int cpufire(int x, int y) /* fire away at given location */ { bool hit, sunk; @@ -961,7 +976,7 @@ static bool cpufire(int x, int y) attrset(0); #endif /* A_COLOR */ - return(hit ? (sunk ? S_SUNK : S_HIT) : S_MISS); + return ((hit ? (sunk ? S_SUNK : S_HIT) : S_MISS) ? TRUE : FALSE); } /* @@ -981,7 +996,8 @@ static bool cputurn(void) static int next = RANDOM_FIRE; static bool used[4]; static ship_t ts; - int navail, x, y, d, n, hit = S_MISS; + int navail, x, y, d, n; + int hit = S_MISS; switch(next) { @@ -1090,7 +1106,7 @@ static bool cputurn(void) "New state %d, x=%d, y=%d, d=%d", next, x, y, d); #endif /* DEBUG */ - return(hit); + return ((hit) ? TRUE : FALSE); } static diff --git a/test/configure.in b/test/configure.in index f28ce772..a3eed744 100644 --- a/test/configure.in +++ b/test/configure.in @@ -1,23 +1,34 @@ -dnl***************************************************************************** -dnl Copyright 1996,1997 by Thomas E. Dickey * -dnl All Rights Reserved. * -dnl * -dnl Permission to use, copy, modify, and distribute this software and its * -dnl documentation for any purpose and without fee is hereby granted, provided * -dnl that the above copyright notice appear in all copies and that both that * -dnl copyright notice and this permission notice appear in supporting * -dnl documentation, and that the name of the above listed copyright holder(s) * -dnl not be used in advertising or publicity pertaining to distribution of the * -dnl software without specific, written prior permission. THE ABOVE LISTED * -dnl COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * -dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * -dnl EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * -dnl SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * -dnl RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * -dnl CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * -dnl CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * -dnl***************************************************************************** -dnl $Id: configure.in,v 1.15 1997/05/06 00:36:02 tom Exp $ +dnl*************************************************************************** +dnl Copyright (c) 1998 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 * +dnl "Software"), to deal in the Software without restriction, including * +dnl without limitation the rights to use, copy, modify, merge, publish, * +dnl distribute, distribute with modifications, sublicense, and/or sell * +dnl copies of the Software, and to permit persons to whom the Software is * +dnl furnished to do so, subject to the following conditions: * +dnl * +dnl The above copyright notice and this permission notice shall be included * +dnl in all copies or substantial portions of the Software. * +dnl * +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * +dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * +dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * +dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * +dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * +dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * +dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. * +dnl * +dnl Except as contained in this notice, the name(s) of the above copyright * +dnl holders shall not be used in advertising or otherwise to promote the * +dnl sale, use or other dealings in this Software without prior written * +dnl authorization. * +dnl*************************************************************************** +dnl +dnl Author: Thomas E. Dickey 1996,1997,1998 +dnl +dnl $Id: configure.in,v 1.23 1998/02/11 12:14:05 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) @@ -28,19 +39,33 @@ dnl dnl dickey@clark.net (Thomas Dickey) AC_PREREQ(2.12) AC_INIT(ncurses.c) +AC_CONFIG_HEADER(ncurses_cfg.h:ncurses_tst.hin) AC_PROG_CC +dnl Things that we don't need (or must override) if we're not building ncurses CC_G_OPT="-g" AC_SUBST(CC_G_OPT) CC_SHARED_OPTS=unknown AC_SUBST(CC_SHARED_OPTS) CPPFLAGS="$CPPFLAGS" AC_SUBST(CPPFLAGS) +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) +LD_MODEL="" AC_SUBST(LD_MODEL) +LDFLAGS_SHARED="" AC_SUBST(LDFLAGS_SHARED) LIB_NAME=curses AC_SUBST(LIB_NAME) +LIB_PREFIX="-l" AC_SUBST(LIB_PREFIX) LINT=lint AC_SUBST(LINT) LINT_OPTS="" AC_SUBST(LINT_OPTS) +LOCAL_LDFLAGS="" AC_SUBST(LOCAL_LDFLAGS) +MATH_LIB="-lm" AC_SUBST(MATH_LIB) +PROG_EXT="" AC_SUBST(PROG_EXT) TEST_ARGS="" AC_SUBST(TEST_ARGS) +TEST_DEPS="" AC_SUBST(TEST_DEPS) +cf_cv_abi_version="" AC_SUBST(cf_cv_abi_version) +cf_cv_rel_version="" AC_SUBST(cf_cv_rel_version) dnl SunOS 4.x AC_ARG_WITH(5lib, @@ -51,7 +76,8 @@ AC_ARG_WITH(5lib, dnl Ncurses, installed in conventional location AC_ARG_WITH(ncurses, [ --with-ncurses use ncurses-libraries (installed)], - [AC_CHECK_LIB(gpm,Gpm_Open) + [AC_CHECK_FUNC(initscr,,[ + AC_CHECK_LIB(gpm,Gpm_Open) LIB_NAME=ncurses for p in $HOME /usr/local /usr do @@ -70,17 +96,18 @@ AC_ARG_WITH(ncurses, fi fi done - ],[test -d /usr/ccs/lib && LIBS="-L/usr/ccs/lib $LIBS"]) + ],[test -d /usr/ccs/lib && LIBS="-L/usr/ccs/lib $LIBS"])]) dnl If we've not specified a library, assume we're using sysvr4 libraries dnl installed conventionally (e.g., SunOS 5.x - solaris). dnl Autoconf builds up the $LIBS in reverse order -AC_CHECK_LIB($LIB_NAME,initscr) -AC_CHECK_LIB(form,form_driver,,,-lcurses) -AC_CHECK_LIB(menu,menu_driver,,,-lcurses) -AC_CHECK_LIB(panel,new_panel,,,-lcurses) +AC_CHECK_FUNC(initscr,,[ +AC_CHECK_LIB($LIB_NAME,initscr)]) +AC_CHECK_LIB(form,form_driver) +AC_CHECK_LIB(menu,menu_driver) +AC_CHECK_LIB(panel,new_panel) AC_TYPE_SIGNAL @@ -107,76 +134,42 @@ strdup \ vsscanf \ ) -AC_CHECKING([for SCO by checking on /usr/bin/scosh]) -AC_PROGRAM_CHECK(COULD_BE_SCO, [scosh], maybe, maybenot) -if test "$COULD_BE_SCO" = "maybe" -then - AC_DEFINE(SYSTEM_LOOKS_LIKE_SCO) -fi - -dnl Things that we don't need (or must override) if we're not building ncurses -ECHO_LINK='@ echo linking $@ ... ;' -AC_SUBST(ECHO_LINK) - -LD_MODEL="" -AC_SUBST(LD_MODEL) - -LOCAL_LDFLAGS="" -AC_SUBST(LOCAL_LDFLAGS) - -nc_cv_abi_version="" -AC_SUBST(nc_cv_abi_version) - -TEST_DEPS="" -AC_SUBST(TEST_DEPS) - -LIB_PREFIX="-l" -AC_SUBST(LIB_PREFIX) - -DFT_DEP_SUFFIX="" -AC_SUBST(DFT_DEP_SUFFIX) - -rm -f config_h.in -echo '@DEFS@' >config_h.in - -changequote({,})dnl -AC_OUTPUT(config_h Makefile,{ - -### Special editing. We generate ncurses_cfg.h directly to allow all filenames -### to be MSDOS-compatible, as well as to make the list of definitions be -### dynamically determined by the configuration script -- a consideration when -### doing type-clean development testing. - -echo creating ncurses_cfg.h -rm -f ncurses_cfg.h -echo "/* generated by configure-script - * On host: $SYS_NAME - */ -#ifndef NC_CONFIG_H -#define NC_CONFIG_H" >ncurses_cfg.h -sed -e '/^ -D/!d' \ - -e 's/ -D/\ -#define /g' \ - -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1 /g' \ - -e 's@\\@@g' \ - config_h | sort >>ncurses_cfg.h -echo " - /* The C compiler may not treat these properly, but C++ has to */ -#ifdef __cplusplus -#undef const -#undef inline +dnl --------------------------------------------------------------------------- +dnl [CF_SYS_TIME_SELECT] +AC_MSG_CHECKING(if sys/time.h conflicts with sys/select.h) +AC_CACHE_VAL(cf_cv_sys_time_select,[ +AC_TRY_COMPILE([ +#if HAVE_SYS_TIME_H +#include #endif - -#endif /* NC_CONFIG_H */" >> ncurses_cfg.h -echo removing config_h -rm config_h -},{ -### Special initialization commands, used to pass information from the -### configuration-run into config.status - -SYS_NAME="`(uname -a || hostname) 2>/dev/null | sed 1q`" -if test -z "\$SYS_NAME"; then SYS_NAME=unknown;fi -}) -changequote([,])dnl - -rm -f config_h.in +#if HAVE_SYS_SELECT_H +#include +#endif +],[],[cf_cv_sys_time_select=yes], + [cf_cv_sys_time_select=no]) + ]) +AC_MSG_RESULT($cf_cv_sys_time_select) +test $cf_cv_sys_time_select = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT) +dnl --------------------------------------------------------------------------- + +AC_OUTPUT(Makefile,[ + cat >>Makefile <>Makefile < @@ -12,7 +12,7 @@ static int get_colour(chtype *); static void explode(int row, int col); static void showit(void); -static void onsig(int sig); +static RETSIGTYPE onsig(int sig); static int my_bg = COLOR_BLACK; diff --git a/test/firstlast.c b/test/firstlast.c new file mode 100644 index 00000000..f9515dcb --- /dev/null +++ b/test/firstlast.c @@ -0,0 +1,89 @@ +/* + * This test was written by Alexander V. Lukyanov to demonstrate difference + * between ncurses 4.1 and SVR4 curses + * + * $Id: firstlast.c,v 1.2 1997/10/18 21:34:53 tom Exp $ + */ + +#include + +static void fill(WINDOW *w,const char *str) +{ + const char *s; + for(;;) { + for(s=str; *s; s++) { + if(waddch(w,*s)==ERR) + { + wmove(w,0,0); + return; + } + } + } +} + +int main( + int argc GCC_UNUSED, + char *argv[] GCC_UNUSED) +{ + WINDOW *large,*small; + initscr(); + noecho(); + + large = newwin(20,60,2,10); + small = newwin(10,30,7,25); + + /* test 1 - addch */ + fill(large,"LargeWindow"); + + refresh(); + wrefresh(large); + wrefresh(small); + + mvwaddstr(small,5,5," Test String "); + wrefresh(small); + getch(); + + touchwin(large); + wrefresh(large); + + mvwaddstr(small,5,5," Test <***************> String "); + wrefresh(small); + + /* DIFFERENCE! */ + getch(); + + /* test 2: erase */ + erase(); + refresh(); + getch(); + + /* test 3: clrtoeol */ + werase(small); + wrefresh(small); + touchwin(large); + wrefresh(large); + wmove(small,5,0); + waddstr(small," clrtoeol>"); + wclrtoeol(small); + wrefresh(small); + + /* DIFFERENCE! */; + getch(); + + /* test 4: clrtobot */ + werase(small); + wrefresh(small); + touchwin(large); + wrefresh(large); + wmove(small,5,3); + waddstr(small," clrtobot>"); + wclrtobot(small); + wrefresh(small); + + /* DIFFERENCE! */ + getch(); + + endwin(); + + return EXIT_SUCCESS; +} diff --git a/test/gdc.c b/test/gdc.c index 6bf38301..ecef2bb1 100644 --- a/test/gdc.c +++ b/test/gdc.c @@ -6,7 +6,7 @@ * modified 10-18-89 for curses (jrl) * 10-18-89 added signal handling * - * $Id: gdc.c,v 1.8 1997/01/19 00:59:28 tom Exp $ + * $Id: gdc.c,v 1.10 1997/10/18 20:06:06 tom Exp $ */ #include @@ -28,7 +28,7 @@ static short disp[11] = { 075557, 011111, 071747, 071717, 055711, 074717, 074757, 071111, 075757, 075717, 002020 }; -static long old[6], next[6], new[6], mask; +static long older[6], next[6], newer[6], mask; static char scrol; static int sigtermed = 0; @@ -46,6 +46,36 @@ RETSIGTYPE sighndl(int signo) sigtermed=signo; } +static void +drawbox(void) +{ + chtype bottom[XLENGTH+1]; + int n; + + if(hascolor) + attrset(COLOR_PAIR(3)); + + mvaddch(YBASE - 1, XBASE - 1, ACS_ULCORNER); + hline(ACS_HLINE, XLENGTH); + mvaddch(YBASE - 1, XBASE + XLENGTH, ACS_URCORNER); + + mvaddch(YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER); + mvinchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH); + for (n = 0; n < XLENGTH; n++) + bottom[n] = ACS_HLINE | (bottom[n] & (A_ATTRIBUTES | A_COLOR)); + mvaddchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH); + mvaddch(YBASE + YDEPTH, XBASE + XLENGTH, ACS_LRCORNER); + + move(YBASE, XBASE - 1); + vline(ACS_VLINE, YDEPTH); + + move(YBASE, XBASE + XLENGTH); + vline(ACS_VLINE, YDEPTH); + + if(hascolor) + attrset(COLOR_PAIR(2)); +} + int main(int argc, char *argv[]) { @@ -61,6 +91,7 @@ int n = 0; cbreak(); noecho(); nodelay(stdscr, 1); + curs_set(0); hascolor = has_colors(); @@ -86,25 +117,7 @@ int n = 0; n = atoi(*argv); } - if(hascolor) { - attrset(COLOR_PAIR(3)); - - mvaddch(YBASE - 1, XBASE - 1, ACS_ULCORNER); - hline(ACS_HLINE, XLENGTH); - mvaddch(YBASE - 1, XBASE + XLENGTH, ACS_URCORNER); - - mvaddch(YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER); - hline(ACS_HLINE, XLENGTH); - mvaddch(YBASE + YDEPTH, XBASE + XLENGTH, ACS_LRCORNER); - - move(YBASE, XBASE - 1); - vline(ACS_VLINE, YDEPTH); - - move(YBASE, XBASE + XLENGTH); - vline(ACS_VLINE, YDEPTH); - - attrset(COLOR_PAIR(2)); - } + drawbox(); do { char buf[30]; @@ -122,15 +135,15 @@ int n = 0; for(k=0; k<6; k++) { if(scrol) { for(i=0; i<5; i++) - new[i] = (new[i]&~mask) | (new[i+1]&mask); - new[5] = (new[5]&~mask) | (next[k]&mask); + newer[i] = (newer[i]&~mask) | (newer[i+1]&mask); + newer[5] = (newer[5]&~mask) | (next[k]&mask); } else - new[k] = (new[k]&~mask) | (next[k]&mask); + newer[k] = (newer[k]&~mask) | (next[k]&mask); next[k] = 0; for(s=1; s>=0; s--) { standt(s); for(i=0; i<6; i++) { - if((a = (new[i]^old[i])&(s ? new : old)[i]) != 0) { + if((a = (newer[i]^older[i])&(s ? newer : older)[i]) != 0) { for(j=0,t=1<<26; t; t>>=1,j++) { if(a&t) { if(!(a&(t<<1))) { @@ -141,11 +154,15 @@ int n = 0; } } if(!s) { - old[i] = new[i]; + older[i] = newer[i]; } } if(!s) { + if (scrol) + drawbox(); refresh(); + if (scrol) + napms(150); } } } @@ -156,6 +173,7 @@ int n = 0; mvaddstr(16, 30, buf); movto(6, 0); + drawbox(); refresh(); sleep(1); while(wgetch(stdscr) != ERR) @@ -164,6 +182,7 @@ int n = 0; standend(); clear(); refresh(); + curs_set(1); endwin(); fprintf(stderr, "gdc terminated by signal %d\n", sigtermed); return EXIT_FAILURE; @@ -172,6 +191,7 @@ int n = 0; standend(); clear(); refresh(); + curs_set(1); endwin(); return EXIT_SUCCESS; } @@ -184,7 +204,7 @@ int i, m; m = 7<>(4-i)*3)&07)< @@ -191,7 +191,7 @@ InitTiles(int NTiles) static void DisplayTiles(void) { - int Line, Peg, SlotNo; + int Line, peg, SlotNo; char TileBuf[BUFSIZ]; erase(); @@ -212,16 +212,16 @@ DisplayTiles(void) attrset(A_NORMAL); /* Draw tiles */ - for(Peg=0; Peg + +int main(int argc, char *argv[]) +{ + int n; + for (n = -1; n < 512; n++) { + printf("%d(%5o):%s\n", n, n, keyname(n)); + } + return EXIT_SUCCESS; +} diff --git a/test/knight.c b/test/knight.c index b9461068..fe310119 100644 --- a/test/knight.c +++ b/test/knight.c @@ -6,7 +6,7 @@ * Eric S. Raymond July 22 1995. Mouse support * added September 20th 1995. * - * $Id: knight.c,v 1.13 1997/01/19 00:55:17 tom Exp $ + * $Id: knight.c,v 1.14 1997/08/20 16:22:38 hjl Exp $ */ #include @@ -559,7 +559,7 @@ static bool chksqr (int r1, int c1) return(FALSE); if ((c1 < 0) || (c1 > BWIDTH - 1)) return(FALSE); - return (!board[r1][c1]); + return ((!board[r1][c1]) ? TRUE : FALSE); } /* knight.c ends here */ diff --git a/test/lrtest.c b/test/lrtest.c index 17168990..893e1cde 100644 --- a/test/lrtest.c +++ b/test/lrtest.c @@ -6,7 +6,7 @@ * This can't be part of the ncurses test-program, because ncurses rips off the * bottom line to do labels. * - * $Id: lrtest.c,v 0.6 1997/04/26 23:47:42 tom Exp $ + * $Id: lrtest.c,v 0.7 1998/02/12 23:49:11 tom Exp $ */ #include @@ -33,7 +33,7 @@ main( move(LINES/2+1, 4); addstr("Please report this (with a copy of your terminfo entry).\n"); move(LINES/2+2, 4); - addstr("to the ncurses maintainers, at ncurses@bsdi.com.\n"); + addstr("to the ncurses maintainers, at bug-ncurses@gnu.org.\n"); } box(stdscr, 0, 0); diff --git a/test/modules b/test/modules index 82053789..a265cfb0 100644 --- a/test/modules +++ b/test/modules @@ -1,27 +1,41 @@ # Test-Program modules -# $Id: modules,v 1.1 1997/02/08 22:18:23 tom Exp $ -################################################################################ -# Copyright 1997 by Thomas E. Dickey # -# All Rights Reserved. # -# # -# Permission to use, copy, modify, and distribute this software and its # -# documentation for any purpose and without fee is hereby granted, provided # -# that the above copyright notice appear in all copies and that both that # -# copyright notice and this permission notice appear in supporting # -# documentation, and that the name of the above listed copyright holder(s) not # -# be used in advertising or publicity pertaining to distribution of the # -# software without specific, written prior permission. THE ABOVE LISTED # -# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # -# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # -# PERFORMANCE OF THIS SOFTWARE. # -################################################################################ +# $Id: modules,v 1.6 1998/02/11 12:14:04 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free 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 1997 +# + +@ base blue progs $(srcdir) ../include/term.h bs progs $(srcdir) firework progs $(srcdir) ../include/term.h +firstlast progs $(srcdir) gdc progs $(srcdir) hanoi progs $(srcdir) hashtest progs $(srcdir) @@ -31,7 +45,9 @@ ncurses progs $(srcdir) ../include/panel.h ../include/menu.h ../include/form.h newdemo progs $(srcdir) 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) diff --git a/test/ncurses.c b/test/ncurses.c index faef03dc..c1d94086 100644 --- a/test/ncurses.c +++ b/test/ncurses.c @@ -1,3 +1,30 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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. * + ****************************************************************************/ /**************************************************************************** NAME @@ -10,11 +37,9 @@ DESCRIPTION An interactive test module for the ncurses library. AUTHOR - This software is Copyright (C) 1993 by Eric S. Raymond, all rights reserved. -It is issued with ncurses under the same terms and conditions as the ncurses -library source. + Author: Eric S. Raymond 1993 -$Id: ncurses.c,v 1.91 1997/05/10 18:19:48 tom Exp $ +$Id: ncurses.c,v 1.108 1998/02/28 01:11:47 tom Exp $ ***************************************************************************/ @@ -26,8 +51,12 @@ $Id: ncurses.c,v 1.91 1997/05/10 18:19:48 tom Exp $ #include #include +#if HAVE_LOCALE_H +#include +#endif + #if HAVE_GETTIMEOFDAY -#if HAVE_SYS_TIME_H && ! SYSTEM_LOOKS_LIKE_SCO +#if HAVE_SYS_TIME_H && HAVE_SYS_TIME_SELECT #include #endif #if HAVE_SYS_SELECT_H @@ -86,7 +115,6 @@ extern int _nc_tracing; #define CTRL(x) ((x) & 0x1f) #endif -#define SIZEOF(table) (sizeof(table)/sizeof(table[0])) #define QUIT CTRL('Q') #define ESCAPE CTRL('[') #define BLANK ' ' /* this is the background character */ @@ -274,10 +302,11 @@ int y, x; endwin(); } -static int show_attr(int row, chtype attr, const char *name, bool once, const char *capname) +static int show_attr(int row, int skip, chtype attr, const char *name, bool once) { mvprintw(row, 8, "%s mode:", name); mvprintw(row, 24, "|"); + if (skip) printw("%*s", skip, " "); if (once) attron(attr); else @@ -285,38 +314,98 @@ static int show_attr(int row, chtype attr, const char *name, bool once, const ch addstr("abcde fghij klmno pqrst uvwxy z"); if (once) attroff(attr); + if (skip) printw("%*s", skip, " "); printw("|"); - if (capname != 0 && tigetstr(capname) == 0) + if (attr != A_NORMAL && !(termattrs() & attr)) printw(" (N/A)"); return row + 2; } +static bool attr_getc(int *skip, int *fg, int *bg) +{ + int ch = Getchar(); + + if (isdigit(ch)) { + *skip = (ch - '0'); + return TRUE; + } else if (ch == CTRL('L')) { + touchwin(stdscr); + touchwin(curscr); + return TRUE; + } else 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; + } + if (*fg >= COLORS) *fg = 0; + if (*fg < 0) *fg = COLORS - 1; + if (*bg >= COLORS) *bg = 0; + if (*bg < 0) *bg = COLORS - 1; + return TRUE; + } + return FALSE; +} + static void attr_test(void) /* test text attributes */ { - int row = 2; - refresh(); + int n; + int skip = tigetnum("xmc"); + int fg = COLOR_WHITE; + int bg = COLOR_BLACK; + bool *pairs = (bool *)calloc(COLOR_PAIRS, sizeof(bool)); + pairs[0] = TRUE; + + if (skip < 0) + skip = 0; + + n = skip; /* make it easy */ - mvaddstr(0, 20, "Character attribute test display"); + do { + int row = 2; + int normal = A_NORMAL | BLANK; + + if (has_colors()) { + int pair = (fg * COLORS) + bg; + if (!pairs[pair]) { + init_pair(pair, fg, bg); + pairs[pair] = TRUE; + } + normal |= COLOR_PAIR(pair); + } + bkgdset(normal); + erase(); - row = show_attr(row, A_STANDOUT, "STANDOUT", TRUE, "smso"); - row = show_attr(row, A_REVERSE, "REVERSE", TRUE, "rev"); - row = show_attr(row, A_BOLD, "BOLD", TRUE, "bold"); - row = show_attr(row, A_UNDERLINE, "UNDERLINE", TRUE, "smul"); - row = show_attr(row, A_DIM, "DIM", TRUE, "dim"); - row = show_attr(row, A_BLINK, "BLINK", TRUE, "blink"); - row = show_attr(row, A_PROTECT, "PROTECT", TRUE, "prot"); - row = show_attr(row, A_INVIS, "INVISIBLE", TRUE, "invis"); - row = show_attr(row, A_NORMAL, "NORMAL", FALSE,0); + mvaddstr(0, 20, "Character attribute test display"); - mvprintw(row, 8, + row = show_attr(row, n, A_STANDOUT, "STANDOUT", TRUE); + row = show_attr(row, n, A_REVERSE, "REVERSE", TRUE); + row = show_attr(row, n, A_BOLD, "BOLD", TRUE); + row = show_attr(row, n, A_UNDERLINE, "UNDERLINE", TRUE); + row = show_attr(row, n, A_DIM, "DIM", TRUE); + row = show_attr(row, n, A_BLINK, "BLINK", TRUE); + row = show_attr(row, n, A_PROTECT, "PROTECT", TRUE); + row = show_attr(row, n, A_INVIS, "INVISIBLE", TRUE); + row = show_attr(row, n, A_NORMAL, "NORMAL", FALSE); + + 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 = repaint"); + if (has_colors()) + printw(". f/F/b/F toggle colors (now %d/%d)", fg, bg); - refresh(); - - Pause(); + refresh(); + } while (attr_getc(&n, &fg, &bg)); + bkgdset(A_NORMAL | BLANK); erase(); endwin(); } @@ -327,7 +416,7 @@ static void attr_test(void) * ****************************************************************************/ -static NCURSES_CONST char *colors[] = +static NCURSES_CONST char *color_names[] = { "black", "red", @@ -339,46 +428,52 @@ static NCURSES_CONST char *colors[] = "white" }; +static void show_color_name(int y, int x, int color) +{ + if (COLORS > 8) + mvprintw(y, x, "%02d ", color); + else + mvaddstr(y, x, color_names[color]); +} + static void color_test(void) /* generate a color test pattern */ { int i; + int base, top, width; + NCURSES_CONST char *hello; refresh(); (void) printw("There are %d color pairs\n", COLOR_PAIRS); - (void) mvprintw(1, 0, - "%dx%d matrix of foreground/background colors, bright *off*\n", - COLORS, COLORS); - for (i = 0; i < COLORS; i++) - mvaddstr(2, (i+1) * 8, colors[i]); - for (i = 0; i < COLORS; i++) - mvaddstr(3 + i, 0, colors[i]); - for (i = 1; i < COLOR_PAIRS; i++) - { - init_pair(i, i % COLORS, i / COLORS); - attron((attr_t)COLOR_PAIR(i)); - mvaddstr(3 + (i / COLORS), (i % COLORS + 1) * 8, "Hello"); - attrset(A_NORMAL); - } + width = (COLORS > 8) ? 4 : 8; + hello = (COLORS > 8) ? "Test" : "Hello"; - (void) mvprintw(COLORS + 4, 0, - "%dx%d matrix of foreground/background colors, bright *on*\n", - COLORS, COLORS); - for (i = 0; i < COLORS; i++) - mvaddstr(5 + COLORS, (i+1) * 8, colors[i]); - for (i = 0; i < COLORS; i++) - mvaddstr(6 + COLORS + i, 0, colors[i]); - for (i = 1; i < COLOR_PAIRS; i++) + for (base = 0; base < 2; base++) { - init_pair(i, i % COLORS, i / COLORS); - attron((attr_t)(COLOR_PAIR(i) | A_BOLD)); - mvaddstr(6 + COLORS + (i / COLORS), (i % COLORS + 1) * 8, "Hello"); - attrset(A_NORMAL); + top = (COLORS > 8) ? 0 : base * (COLORS+3); + clrtobot(); + (void) mvprintw(top + 1, 0, + "%dx%d matrix of foreground/background colors, bright *%s*\n", + COLORS, COLORS, + base ? "on" : "off"); + for (i = 0; i < COLORS; i++) + show_color_name(top + 2, (i+1) * width, i); + for (i = 0; i < COLORS; i++) + show_color_name(top + 3 + i, 0, i); + for (i = 1; i < COLOR_PAIRS; i++) + { + init_pair(i, i % COLORS, i / COLORS); + attron((attr_t)COLOR_PAIR(i)); + if (base) + attron((attr_t)A_BOLD); + mvaddstr(top + 3 + (i / COLORS), (i % COLORS + 1) * width, hello); + attrset(A_NORMAL); + } + if ((COLORS > 8) || base) + Pause(); } - Pause(); - erase(); endwin(); } @@ -432,8 +527,8 @@ static void color_edit(void) { mvprintw(2 + i, 0, "%c %-8s:", (i == current ? '>' : ' '), - (i < (int) SIZEOF(colors) - ? colors[i] : "")); + (i < (int) SIZEOF(color_names) + ? color_names[i] : "")); attrset(COLOR_PAIR(i)); addstr(" "); attrset(A_NORMAL); @@ -519,7 +614,7 @@ static void color_edit(void) P("currently selected will be reverse-video highlighted."); P(""); P("To change a field, enter the digits of the new value; they are echoed"); - P("echoed. Finish by typing `='; the change will take effect instantly."); + P("as entered. Finish by typing `='. The change will take effect instantly."); P("To increment or decrement a value, use the same procedure, but finish"); P("with a `+' or `-'."); P(""); @@ -1136,6 +1231,11 @@ static void acs_and_scroll(void) neww->next->last = neww; } current = neww; + /* SVr4 curses sets the keypad on all newly-created windows to + * false. Someone reported that PDCurses makes new windows inherit + * this flag. Remove the following 'keypad()' call to test this + */ + keypad(current->wind, TRUE); current->do_keypad = HaveKeypad(current); current->do_scroll = HaveScroll(current); break; @@ -1212,6 +1312,7 @@ static void acs_and_scroll(void) if (current) { pair *tmp, ul, lr; + int mx, my; move(0, 0); clrtoeol(); addstr("Use arrows to move cursor, anything else to mark new corner"); @@ -1233,15 +1334,16 @@ static void acs_and_scroll(void) wnoutrefresh(stdscr); /* strictly cosmetic hack for the test */ - if (current->wind->_maxy > tmp->y - ul.y) + getmaxyx(current->wind, my, mx); + if (my > tmp->y - ul.y) { getyx(current->wind, lr.y, lr.x); wmove(current->wind, tmp->y - ul.y + 1, 0); wclrtobot(current->wind); wmove(current->wind, lr.y, lr.x); } - if (current->wind->_maxx > tmp->x - ul.x) - for (i = 0; i < current->wind->_maxy; i++) + if (mx > tmp->x - ul.x) + for (i = 0; i < my; i++) { wmove(current->wind, i, tmp->x - ul.x + 1); wclrtoeol(current->wind); @@ -1314,7 +1416,7 @@ static void acs_and_scroll(void) usescr = (current ? current->wind : stdscr); wrefresh(usescr); } while - ((c = wGetchar(usescr)) + ((c = wGetchar(usescr)) != QUIT && !((c == ESCAPE) && (usescr->_use_keypad)) && (c != ERR)); @@ -1869,8 +1971,8 @@ static void panner(WINDOW *pad, int length = (portx - top_x - 1); float ratio = ((float) length) / ((float) pxmax); - lowend = top_x + (basex * ratio); - highend = top_x + ((basex + length) * ratio); + lowend = (int)(top_x + (basex * ratio)); + highend = (int)(top_x + ((basex + length) * ratio)); do_h_line(porty - 1, top_x, ACS_HLINE, lowend); if (highend < portx) { @@ -1886,8 +1988,8 @@ static void panner(WINDOW *pad, int length = (porty - top_y - 1); float ratio = ((float) length) / ((float) pymax); - lowend = top_y + (basey * ratio); - highend = top_y + ((basey + length) * ratio); + lowend = (int)(top_y + (basey * ratio)); + highend = (int)(top_y + ((basey + length) * ratio)); do_v_line(top_y, portx - 1, ACS_VLINE, lowend); if (highend < porty) { @@ -1938,7 +2040,6 @@ int padgetch(WINDOW *win) { int c; - while(1) switch(c = wGetchar(win)) { case '!': ShellOut(FALSE); return KEY_REFRESH; @@ -2024,10 +2125,8 @@ static void flushinp_test(WINDOW *win) WINDOW *subWin; wclear (win); - w = win->_maxx; - h = win->_maxy; - bx = win->_begx; - by = win->_begy; + getmaxyx(win, h, w); + getbegyx(win, by, bx); sw = w / 3; sh = h / 3; if((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2)) == 0) @@ -2048,7 +2147,14 @@ static void flushinp_test(WINDOW *win) mvwaddstr(subWin, 2, 1, "This is a subwindow"); wrefresh(win); - nocbreak(); + /* + * This used to set 'nocbreak()'. However, Alexander Lukyanov says that + * it only happened to "work" on SVr4 because that implementation does not + * emulate nocbreak+noecho mode, whereas ncurses does. To get the desired + * test behavior, we're using 'cbreak()', which will allow a single + * character to return without needing a newline. - T.Dickey 1997/10/11. + */ + cbreak(); mvwaddstr(win, 0, 1, "This is a test of the flushinp() call."); mvwaddstr(win, 2, 1, "Type random keys for 5 seconds."); @@ -2209,7 +2315,7 @@ static char *tracetrace(int tlevel) size_t need = 12; for (n = 0; t_tbl[n].name != 0; n++) need += strlen(t_tbl[n].name) + 2; - buf = malloc(need); + buf = (char *)malloc(need); } sprintf(buf, "0x%02x = {", tlevel); if (tlevel == 0) { @@ -2576,11 +2682,13 @@ static void demo_forms(void) static void fillwin(WINDOW *win, char ch) { int y, x; + int y1, x1; - for (y = 0; y <= win->_maxy; y++) + getmaxyx(win, y1, x1); + for (y = 0; y < y1; y++) { wmove(win, y, 0); - for (x = 0; x <= win->_maxx; x++) + for (x = 0; x < x1; x++) waddch(win, ch); } } @@ -2588,12 +2696,14 @@ static void fillwin(WINDOW *win, char ch) static void crosswin(WINDOW *win, char ch) { int y, x; + int y1, x1; - for (y = 0; y <= win->_maxy; y++) + getmaxyx(win, y1, x1); + for (y = 0; y < y1; y++) { - for (x = 0; x <= win->_maxx; x++) - if (((x > win->_maxx / 3) && (x <= 2 * win->_maxx / 3)) - || (((y > win->_maxy / 3) && (y <= 2 * win->_maxy / 3)))) + for (x = 0; x < x1; x++) + 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); @@ -2609,6 +2719,7 @@ static void overlap_test(void) WINDOW *win1 = newwin(9, 20, 3, 3); WINDOW *win2 = newwin(9, 20, 9, 16); + raw(); refresh(); move(0, 0); printw("This test shows the behavior of wnoutrefresh() with respect to\n"); @@ -2771,10 +2882,6 @@ do_single_test(const char c) #endif case '?': - (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."); break; default: @@ -2853,6 +2960,10 @@ main(int argc, char *argv[]) int command, c; int my_e_param = 1; +#if HAVE_LOCALE_H + setlocale(LC_CTYPE, ""); +#endif + while ((c = getopt(argc, argv, "e:fhs:t:")) != EOF) { switch (c) { case 'e': @@ -2871,9 +2982,11 @@ main(int argc, char *argv[]) case 'h': ripoffline(1, rip_header); break; +#if USE_LIBPANEL case 's': nap_msec = atol(optarg); break; +#endif #ifdef TRACE case 't': save_trace = atoi(optarg); @@ -2989,6 +3102,12 @@ main(int argc, char *argv[]) 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 diff --git a/test/ncurses_tst.hin b/test/ncurses_tst.hin new file mode 100644 index 00000000..1d77cbd3 --- /dev/null +++ b/test/ncurses_tst.hin @@ -0,0 +1,56 @@ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1998 * + ****************************************************************************/ +/* + * $Id: ncurses_tst.hin,v 1.2 1998/02/11 12:14:05 tom Exp $ + * + * This is a template-file used to generate the "ncurses_cfg.h" file. + * + * Rather than list every definition, the configuration script substitutes + * the definitions that it finds using 'sed'. You need a patch (971222) + * to autoconf 2.12 to do this. + */ +#ifndef NC_CONFIG_H +#define NC_CONFIG_H +@DEFS@ + + /* The C compiler may not treat these properly but C++ has to */ +#ifdef __cplusplus +#undef const +#undef inline +#else +#if defined(lint) || defined(TRACE) +#undef inline +#define inline /* nothing */ +#endif +#endif + +#endif /* NC_CONFIG_H */ diff --git a/test/newdemo.c b/test/newdemo.c index 534d3791..d47d275e 100644 --- a/test/newdemo.c +++ b/test/newdemo.c @@ -2,7 +2,7 @@ * newdemo.c - A demo program using PDCurses. The program illustrate * the use of colours for text output. * - * $Id: newdemo.c,v 1.14 1997/04/06 01:43:32 tom Exp $ + * $Id: newdemo.c,v 1.17 1997/09/20 15:11:26 tom Exp $ */ #include @@ -62,8 +62,8 @@ main( char *argv[] GCC_UNUSED) { WINDOW *win; -int w, x, y, i, j, k, len; -char buffer[80]; +int w, x, y, i, j, k; +char buffer[200]; const char *message; int width, height; chtype save[80]; @@ -137,37 +137,31 @@ chtype c; /* Draw running messages */ init_pair(6,COLOR_YELLOW,COLOR_WHITE); wattrset(win, COLOR_PAIR(6)); - message = messages[0]; - len = strlen(message); - j = 0; - i = 2; + message = messages[j = 0]; + i = 1; w = width-2; - while(j < NMESSAGES) - { strncpy(buffer, message, (size_t)(w - i)); - buffer[w-i] = 0; - mvwaddstr(win, height/2, i, buffer); - if(w - i < len) - { memset(buffer, ' ', (size_t)i); - strcpy(buffer, message + (w - i)); - buffer[strlen(buffer)] = ' '; - buffer[i-2] = '\0'; - mvwaddstr(win, height/2, 2, buffer); + strcpy(buffer, message); + while(j < NMESSAGES) { + while ((int)strlen(buffer) < w) { + strcat(buffer, " ... "); + strcat(buffer, messages[++j % NMESSAGES]); } + + if (i < w) + mvwaddnstr(win, height/2, w - i, buffer, i); + else + mvwaddnstr(win, height/2, 1, buffer, w); + wrefresh(win); nodelay(win,TRUE); if (wgetch(win) != ERR) { flushinp(); break; } - mvwaddch(win, height/2, i, ' '); - i = ++i % w; - if(i < 2) - { message = messages[++j%NMESSAGES]; - memset(buffer, ' ', (size_t)(w-2)); - buffer[w-2] = 0; - mvwaddstr(win, height/2, 2, buffer); - i = 2; - } + if (i++ >= w) { + for (k = 0; (buffer[k] = buffer[k+1]) != '\0'; k++) + ; + } delay_output(100); } @@ -222,10 +216,8 @@ SubWinTest(WINDOW *win) int w, h, sw, sh, bx, by; WINDOW *swin1, *swin2, *swin3; - w = win->_maxx; - h = win->_maxy; - bx = win->_begx; - by = win->_begy; + getmaxyx(win, h, w); + getbegyx(win, by, bx); sw = w / 3; sh = h / 3; if((swin1 = subwin(win, sh, sw, by+3, bx+5)) == NULL) @@ -271,8 +263,7 @@ int x1, y1, xd1, yd1; int x2, y2, xd2, yd2; int x3, y3, xd3, yd3; - w = win->_maxx; - h = win->_maxy; + getmaxyx(win, h, w); x1 = 2 + rand() % (w - 4); y1 = 2 + rand() % (h - 4); x2 = 2 + rand() % (w - 4); diff --git a/test/rain.c b/test/rain.c index c0b39041..4132a438 100644 --- a/test/rain.c +++ b/test/rain.c @@ -1,5 +1,5 @@ /* - * $Id: rain.c,v 1.8 1997/05/03 18:38:27 tom Exp $ + * $Id: rain.c,v 1.11 1997/09/18 18:36:46 tom Exp $ */ #include @@ -9,11 +9,22 @@ /* rain 11/3/1980 EPS/CITHEP */ -#define cursor(col,row) move(row,col) - static float ranf(void); static void onsig(int sig); +static int next_j(int j) +{ + if (j==0) j=4; else --j; + if (has_colors()) { + int z = (int)(3*ranf()); + chtype color = COLOR_PAIR(z); + if (z) + color |= A_BOLD; + attrset(color); + } + return j; +} + int main( int argc GCC_UNUSED, @@ -28,61 +39,75 @@ float c; if (signal(j,SIG_IGN)!=SIG_IGN) signal(j,onsig); initscr(); + if (has_colors()) { + int bg = COLOR_BLACK; + start_color(); +#ifdef NCURSES_VERSION + if (use_default_colors() == OK) + bg = -1; +#endif + init_pair(1, COLOR_BLUE, bg); + init_pair(2, COLOR_CYAN, bg); + } nl(); noecho(); curs_set(0); + timeout(0); r = (float)(LINES - 4); c = (float)(COLS - 4); for (j=5;--j>=0;) { - xpos[j]=(int)(c* ranf())+2; - ypos[j]=(int)(r* ranf())+2; + xpos[j]=(int)(c* ranf())+2; + ypos[j]=(int)(r* ranf())+2; } + for (j=0;;) { - x=(int)(c*ranf())+2; - y=(int)(r*ranf())+2; - - cursor(x,y); addch('.'); - - cursor(xpos[j],ypos[j]); addch('o'); - - if (j==0) j=4; else --j; - cursor(xpos[j],ypos[j]); addch('O'); - - if (j==0) j=4; else --j; - cursor(xpos[j],ypos[j]-1); - addch('-'); - cursor(xpos[j]-1,ypos[j]); - addstr("|.|"); - cursor(xpos[j],ypos[j]+1); - addch('-'); - - if (j==0) j=4; else --j; - cursor(xpos[j],ypos[j]-2); - addch('-'); - cursor(xpos[j]-1,ypos[j]-1); - addstr("/ \\"); - cursor(xpos[j]-2,ypos[j]); - addstr("| O |"); - cursor(xpos[j]-1,ypos[j]+1); - addstr("\\ /"); - cursor(xpos[j],ypos[j]+2); - addch('-'); - - if (j==0) j=4; else --j; - cursor(xpos[j],ypos[j]-2); - addch(' '); - cursor(xpos[j]-1,ypos[j]-1); - addstr(" "); - cursor(xpos[j]-2,ypos[j]); - addstr(" "); - cursor(xpos[j]-1,ypos[j]+1); - addstr(" "); - cursor(xpos[j],ypos[j]+2); - addch(' '); - xpos[j]=x; ypos[j]=y; - refresh(); - napms(50); + x=(int)(c*ranf())+2; + y=(int)(r*ranf())+2; + + mvaddch(y,x, '.'); + + mvaddch(ypos[j], xpos[j], 'o'); + + j = next_j(j); + mvaddch(ypos[j], xpos[j], 'O'); + + j = next_j(j); + mvaddch( ypos[j]-1, xpos[j], '-'); + mvaddstr(ypos[j], xpos[j]-1, "|.|"); + mvaddch( ypos[j]+1, xpos[j], '-'); + + j = next_j(j); + mvaddch( ypos[j]-2, xpos[j], '-'); + mvaddstr(ypos[j]-1, xpos[j]-1, "/ \\"); + mvaddstr(ypos[j], xpos[j]-2, "| O |"); + mvaddstr(ypos[j]+1, xpos[j]-1, "\\ /"); + mvaddch( ypos[j]+2, xpos[j], '-'); + + j = next_j(j); + mvaddch( ypos[j]-2, xpos[j], ' '); + mvaddstr(ypos[j]-1, xpos[j]-1, " "); + mvaddstr(ypos[j], xpos[j]-2, " "); + mvaddstr(ypos[j]+1, xpos[j]-1, " "); + mvaddch( ypos[j]+2, xpos[j], ' '); + + xpos[j] = x; ypos[j] = y; + + switch(getch()) + { + case('q'): + case('Q'): + curs_set(1); + endwin(); + return(EXIT_SUCCESS); +#ifdef KEY_RESIZE + case(KEY_RESIZE): + r = (float)(LINES - 4); + c = (float)(COLS - 4); + break; +#endif + } + napms(50); } } diff --git a/test/tclock.c b/test/tclock.c index b46c5998..bccce31d 100644 --- a/test/tclock.c +++ b/test/tclock.c @@ -32,6 +32,12 @@ #define sign(_x) (_x<0?-1:1) +#define ASPECT 2.2 +#define ROUND(value) ((int)((value) + 0.5)) + +#define A2X(angle,radius) ROUND(ASPECT * radius * sin(angle)) +#define A2Y(angle,radius) ROUND(radius * cos(angle)) + /* Plot a point */ static void plot(int x,int y,char col) @@ -128,8 +134,8 @@ main( { sangle=(i+1)*(2.0*PI)/12.0; sradius=10; - sdx=2.0*sradius*sin(sangle); - sdy=sradius*cos(sangle); + sdx = A2X(sangle, sradius); + sdy = A2Y(sangle, sradius); sprintf(szChar,"%d",i+1); mvaddstr((int)(cy-sdy),(int)(cx+sdx),szChar); @@ -138,35 +144,36 @@ main( mvaddstr(0,0,"ASCII Clock by Howard Jones (ha.jones@ic.ac.uk),1994"); sradius=8; - while(1) + for(;;) { - sleep(1); + napms(1000); - tim=time(0); - t=localtime(&tim); + tim = time(0); + t = localtime(&tim); - hours=(t->tm_hour + (t->tm_min/60.0)); - if(hours>12.0) hours-=12.0; + hours = (t->tm_hour + (t->tm_min/60.0)); + if(hours>12.0) hours -= 12.0; - mangle=(t->tm_min)*(2*PI)/60.0; - mdx=2.0*mradius*sin(mangle); - mdy=mradius*cos(mangle); + mangle = ((t->tm_min) * (2 * PI)/60.0); + mdx = A2X(mangle, mradius); + mdy = A2Y(mangle, mradius); - hangle=(hours)*(2.0*PI)/12.0; - hdx=2.0*hradius*sin(hangle); - hdy=hradius*cos(hangle); + hangle = ((hours) * (2.0 * PI)/12.0); + hdx = A2X(hangle, hradius); + hdy = A2Y(hangle, hradius); - sangle=(t->tm_sec%60)*(2.0*PI)/60.0; - sdx=2.0*sradius*sin(sangle); - sdy=sradius*cos(sangle); + sangle = ((t->tm_sec) * (2.0 * PI)/60.0); + sdx = A2X(sangle, sradius); + sdy = A2Y(sangle, sradius); plot(cx+sdx,cy-sdy,'O'); dline(cx,cy,cx+hdx,cy-hdy,'.'); dline(cx,cy,cx+mdx,cy-mdy,'#'); mvaddstr(23,0,ctime(&tim)); - refresh(); + if ((t->tm_sec % 5) == 0) beep(); + plot(cx+sdx,cy-sdy,' '); dline(cx,cy,cx+hdx,cy-hdy,' '); dline(cx,cy,cx+mdx,cy-mdy,' '); diff --git a/test/test.priv.h b/test/test.priv.h index 4228ff6f..0ae43319 100644 --- a/test/test.priv.h +++ b/test/test.priv.h @@ -1,23 +1,35 @@ -/****************************************************************************** - * Copyright 1996 by Thomas E. Dickey * - * All Rights Reserved. * - * * - * Permission to use, copy, modify, and distribute this software and its * - * documentation for any purpose and without fee is hereby granted, provided * - * that the above copyright notice appear in all copies and that both that * - * copyright notice and this permission notice appear in supporting * - * documentation, and that the name of the above listed copyright holder(s) * - * not be used in advertising or publicity pertaining to distribution of the * - * software without specific, written prior permission. THE ABOVE LISTED * - * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * - * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - ******************************************************************************/ -/* $Id: test.priv.h,v 1.13 1997/04/06 01:44:04 tom Exp $ */ +/**************************************************************************** + * Copyright (c) 1998 Free 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 1996 * + ****************************************************************************/ +/* $Id: test.priv.h,v 1.15 1998/02/11 12:14:04 tom Exp $ */ #if HAVE_CONFIG_H #include #endif @@ -52,6 +64,8 @@ extern int optind; #define GCC_UNUSED /* nothing */ #endif +#define SIZEOF(table) (sizeof(table)/sizeof(table[0])) + #if defined(NCURSES_VERSION) && HAVE_NC_ALLOC_H #include #endif diff --git a/test/testaddch.c b/test/testaddch.c new file mode 100644 index 00000000..444da0a1 --- /dev/null +++ b/test/testaddch.c @@ -0,0 +1,60 @@ +/* + * This is an example written by Alexander V. Lukyanov , + * to demonstrate an inconsistency between ncurses and SVr4 curses. + * + * $Id: testaddch.c,v 1.3 1997/10/18 21:35:15 tom Exp $ + */ +#include + +static void attr_addstr(const char *s, chtype a) +{ + while(*s) + addch(((unsigned char)(*s++))|a); +} + +int +main( + int argc GCC_UNUSED, + char *argv[] GCC_UNUSED) +{ + unsigned i; + chtype back,set,attr; + + initscr(); + start_color(); + init_pair(1,COLOR_WHITE,COLOR_BLUE); + init_pair(2,COLOR_WHITE,COLOR_RED); + init_pair(3,COLOR_BLACK,COLOR_MAGENTA); + init_pair(4,COLOR_BLACK,COLOR_GREEN); + init_pair(5,COLOR_BLACK,COLOR_CYAN); + init_pair(6,COLOR_BLACK,COLOR_YELLOW); + init_pair(7,COLOR_BLACK,COLOR_WHITE); + + for(i=0; i<8; i++) + { + back = (i&1) ? A_BOLD|'B' : ' '; + set = (i&2) ? A_REVERSE : 0; + attr = (i&4) ? COLOR_PAIR(4) : 0; + + bkgdset(back); + attrset(set); + + attr_addstr("Test string with spaces -> <-\n",attr); + } + addch('\n'); + for(i=0; i<8; i++) + { + back = (i&1) ? A_BOLD|'B'|COLOR_PAIR(1) : ' '; + set = (i&2) ? A_REVERSE|COLOR_PAIR(2) : 0; + attr = (i&4) ? COLOR_PAIR(4) : 0; + + bkgdset(back); + attrset(set); + + attr_addstr("Test string with spaces -> <-\n",attr); + } + + getch(); + endwin(); + return EXIT_SUCCESS; +} diff --git a/test/testcurs.c b/test/testcurs.c index 3e6b49f7..7f40fffa 100644 --- a/test/testcurs.c +++ b/test/testcurs.c @@ -2,24 +2,31 @@ * * This is a test program for the PDCurses screen package for IBM PC type * machines. + * * This program was written by John Burnell (johnb@kea.am.dsir.govt.nz) - * esr changed the usleep calls to napms calls, 7 Nov 1995 + * wrs(5/28/93) -- modified to be consistent (perform identically) with either + * PDCurses or under Unix System V, R4 * - * $Id: testcurs.c,v 1.14 1997/04/06 01:44:16 tom Exp $ + * $Id: testcurs.c,v 1.17 1997/09/20 17:45:04 tom Exp $ */ #include +#include + +#if defined(XCURSES) +char *XCursesProgramName = "testcurs"; +#endif -static void display_menu (int,int); static int initTest (WINDOW **); +static void display_menu (int,int); static void inputTest (WINDOW *); static void introTest (WINDOW *); static void outputTest (WINDOW *); static void padTest (WINDOW *); -#ifdef __PDCURSES__ +static void scrollTest (WINDOW *); +# if defined(PDCURSES) && !defined(XCURSES) static void resizeTest (WINDOW *); #endif -static void scrollTest (WINDOW *); struct commands { @@ -32,7 +39,7 @@ const COMMAND command[] = { {"Intro Test", introTest}, {"Pad Test", padTest}, -#ifdef __PDCURSES__ +# if defined(PDCURSES) && !defined(XCURSES) {"Resize Test", resizeTest}, #endif {"Scroll Test", scrollTest}, @@ -45,15 +52,15 @@ int width, height; int main( - int argc GCC_UNUSED, - char *argv[] GCC_UNUSED) + int argc GCC_UNUSED, + char *argv[] GCC_UNUSED) { WINDOW *win; int key,old_option=(-1),new_option=0; bool quit=FALSE; #ifdef PDCDEBUG - PDC_debug("testcurs started\n"); + PDC_debug("testcurs started\n"); #endif if (!initTest (&win)) return EXIT_FAILURE; @@ -61,12 +68,12 @@ bool quit=FALSE; if (has_colors()) { init_pair(1,COLOR_WHITE,COLOR_BLUE); - wattrset(win, COLOR_PAIR(1)); + wbkgd(win, COLOR_PAIR(1)); } else - wattrset(win, A_REVERSE); + wbkgd(win, A_REVERSE); #else - wattrset(win, A_REVERSE); + wbkgd(win, A_REVERSE); #endif erase(); @@ -109,6 +116,9 @@ bool quit=FALSE; delwin (win); endwin(); +#ifdef XCURSES + XCursesExit(); +#endif return EXIT_SUCCESS; } @@ -116,25 +126,25 @@ static void Continue (WINDOW *win) { wmove(win, 10, 1); -/* wclrtoeol(win); -*/ mvwaddstr(win, 10, 1, " Press any key to continue"); + wclrtoeol(win); + mvwaddstr(win, 10, 1, " Press any key to continue"); wrefresh(win); raw(); wgetch(win); } -static -int initTest (WINDOW **win) +static int +initTest (WINDOW **win) { #ifdef PDCDEBUG - PDC_debug("initTest called\n"); + PDC_debug("initTest called\n"); #endif #ifdef NCURSES_VERSION - trace(TRACE_MAXIMUM); + trace(TRACE_MAXIMUM); #endif initscr(); #ifdef PDCDEBUG - PDC_debug("after initscr()\n"); + PDC_debug("after initscr()\n"); #endif #ifdef A_COLOR if (has_colors()) @@ -144,7 +154,8 @@ int initTest (WINDOW **win) height = 13; /* Create a drawing window */ *win = newwin(height, width, (LINES-height)/2, (COLS-width)/2); if(*win == NULL) - { endwin(); + { + endwin(); return 0; } return 1; @@ -153,6 +164,12 @@ int initTest (WINDOW **win) static void introTest (WINDOW *win) { + wmove( win, height/2-5, width/2 ); + wvline( win, ACS_VLINE, 10 ); + wmove( win, height/2, width/2-10 ); + whline( win, ACS_HLINE, 20 ); + Continue(win); + beep (); werase(win); @@ -180,7 +197,7 @@ scrollTest (WINDOW *win) napms(250); scroll(win); wrefresh (win); - }; + } getmaxyx (win, OldY, OldX); mvwprintw (win, 6, 1, "The top of the window will scroll"); @@ -192,8 +209,19 @@ scrollTest (WINDOW *win) napms(500); scroll(win); wrefresh (win); - }; - wsetscrreg (win, 0, --OldY); + } + + mvwprintw (win, 3, 1, "The bottom of the window will scroll"); + wmove (win, 8, 1); + wsetscrreg (win, 5, --OldY); + box(win, ACS_VLINE, ACS_HLINE); + wrefresh (win); + for (i = 5; i <= OldY; i++) { + napms (300); + wscrl(win,-1); + wrefresh (win); + } + wsetscrreg (win, 0, OldY); } @@ -205,10 +233,8 @@ inputTest (WINDOW *win) WINDOW *subWin; wclear (win); - w = win->_maxx; - h = win->_maxy; - bx = win->_begx; - by = win->_begy; + getmaxyx(win, h, w); + getbegyx(win, by, bx); sw = w / 3; sh = h / 3; if((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2)) == NULL) @@ -217,13 +243,13 @@ inputTest (WINDOW *win) #ifdef A_COLOR if (has_colors()) { - init_pair(2,COLOR_CYAN,COLOR_BLUE); - wattrset(subWin, COLOR_PAIR(2) | A_BOLD); + init_pair(2,COLOR_WHITE,COLOR_RED); + wbkgd(subWin, COLOR_PAIR(2) | A_BOLD); } else - wattrset(subWin, A_BOLD); + wbkgd(subWin, A_BOLD); #else - wattrset(subWin, A_BOLD); + wbkgd(subWin, A_BOLD); #endif box(subWin, ACS_VLINE, ACS_HLINE); wrefresh(win); @@ -233,9 +259,9 @@ inputTest (WINDOW *win) mvwaddstr(win, 1, 1, "Pressing ^C should do nothing"); wrefresh(win); + werase (subWin); + box(subWin, ACS_VLINE, ACS_HLINE); for (i = 0; i < 5; i++) { - werase (subWin); - box(subWin, ACS_VLINE, ACS_HLINE); mvwprintw (subWin, 1, 1, "Time = %d", i); wrefresh(subWin); napms(1000); @@ -262,22 +288,75 @@ inputTest (WINDOW *win) Continue(win); wclear (win); - mvwaddstr(win, 2, 1, "Press a function key or an arrow key"); + mvwaddstr(win, 1, 1, "Press keys (or mouse buttons) to show their names"); + mvwaddstr(win, 2, 1, "Press spacebar to finish"); wrefresh(win); keypad(win, TRUE); raw(); - c = wgetch(win); - + noecho(); + typeahead(-1); +#if defined(PDCURSES) + mouse_set(ALL_MOUSE_EVENTS); +#endif + while(1) { + wmove(win,3,5); + c = wgetch(win); + wclrtobot(win); + if (c >= KEY_MIN) + wprintw(win,"Key Pressed: %s", keyname(c)); + else + if (isprint(c)) + wprintw(win,"Key Pressed: %c", c); + else + wprintw(win,"Key Pressed: %s", unctrl(c)); +#if defined(PDCURSES) + if (c == KEY_MOUSE) { + int button=0; + request_mouse_pos(); + if (BUTTON_CHANGED(1)) + button = 1; + else + if (BUTTON_CHANGED(2)) + button = 2; + else + if (BUTTON_CHANGED(3)) + button = 3; + else + button = 0; + wmove(win,4,18); + wprintw(win,"Button %d: ",button); + if (MOUSE_MOVED) + wprintw(win,"moved: "); + else + if ((BUTTON_STATUS(button) & BUTTON_ACTION_MASK) == BUTTON_PRESSED) + wprintw(win,"pressed: "); + else + if ((BUTTON_STATUS(button) & BUTTON_ACTION_MASK) == BUTTON_DOUBLE_CLICKED) + wprintw(win,"double: "); + else + wprintw(win,"released: "); + wprintw(win," Position: Y: %d X: %d",MOUSE_Y_POS,MOUSE_X_POS); + } +#endif + wrefresh(win); + if (c == ' ') + break; + } +#if 0 nodelay(win, TRUE); wgetch(win); nodelay(win, FALSE); - +#endif +#if defined(PDCURSES) + mouse_set(0L); +#endif refresh(); wclear (win); mvwaddstr(win, 3, 2, "The window should have moved"); mvwaddstr(win, 4, 2, "This text should have appeared without you pressing a key"); - mvwprintw(win, 2, 2, "Keycode = %d", c); - mvwaddstr(win, 6, 2, "Enter a number then a string seperated by space"); + mvwaddstr(win, 6, 2, "Enter a number then a string separated by space"); + mvwin(win, 2, 1); + wrefresh(win); echo(); noraw(); mvwscanw(win, 7, 6, "%d %s", &num,buffer); @@ -291,53 +370,74 @@ outputTest (WINDOW *win) WINDOW *win1; char Buffer [80]; chtype ch; + int by, bx; nl (); wclear (win); mvwaddstr(win, 1, 1, "You should now have a screen in the upper left corner, and this text should have wrapped"); mvwin(win, 2, 1); + waddstr(win,"\nThis text should be down\n"); + waddstr(win, "and broken into two here ^"); Continue(win); wclear(win); + wattron(win, A_BOLD); mvwaddstr(win, 1, 1, "A new window will appear with this text in it"); mvwaddstr(win, 8, 1, "Press any key to continue"); wrefresh(win); wgetch(win); - win1 = newwin(10, 50, 15, 25); - if(win1 == NULL) - { endwin(); - return; - } -#ifdef A_COLOR - if (has_colors()) + getbegyx(win, by, bx); + + if (LINES < 24 || COLS < 75) { + mvwaddstr(win, 5, 1, "Some tests have been skipped as they require a"); + mvwaddstr(win, 6, 1, "display of at least 24 LINES by 75 COLUMNS"); + Continue(win); + } else { + win1 = newwin(10, 50, 14, 25); + if(win1 == NULL) { - init_pair(3,COLOR_BLUE,COLOR_WHITE); - wattrset(win1, COLOR_PAIR(3)); + endwin(); + return; } - else - wattrset(win1, A_NORMAL); +#ifdef A_COLOR + if (has_colors()) + { + init_pair(3,COLOR_BLUE,COLOR_WHITE); + wbkgd(win1, COLOR_PAIR(3)); + } + else + wbkgd(win1, A_NORMAL); #else - wattrset(win1, A_NORMAL); + wbkgd(win1, A_NORMAL); #endif - wclear (win1); - mvwaddstr(win1, 5, 1, "This text should appear; using overlay option"); - copywin(win, win1,0,0,0,0,10,50,TRUE); + wclear (win1); + mvwaddstr(win1, 5, 1, "This text should appear; using overlay option"); + copywin(win, win1,0,0,0,0,9,49,TRUE); - box(win1,ACS_VLINE,ACS_HLINE); - - wmove(win1, 8, 26); - wrefresh(win1); - wgetch(win1); - - wclear(win1); - wattron(win1, A_BLINK); - mvwaddstr(win1, 4, 1, "This blinking text should appear in only the second window"); - wattroff(win1, A_BLINK); - wrefresh(win1); - wgetch(win1); - delwin(win1); +#if defined(PDCURSES) && !defined(XCURSES) + box(win1,0xb3,0xc4); +#else + box(win1,ACS_VLINE,ACS_HLINE); +#endif + wmove(win1, 8, 26); + wrefresh(win1); + wgetch(win1); + + wclear(win1); + wattron(win1, A_BLINK); + mvwaddstr(win1, 4, 1, "This blinking text should appear in only the second window"); + wattroff(win1, A_BLINK); + mvwin(win1, by, bx); + overlay(win, win1); + mvwin(win1,14,25); + wmove(win1, 8, 26); + wrefresh(win1); + wgetch(win1); + delwin(win1); + } + clear(); wclear(win); wrefresh(win); mvwaddstr(win, 6, 2, "This line shouldn't appear"); @@ -361,6 +461,9 @@ outputTest (WINDOW *win) winsch (win, ch); Continue(win); + mvwinsstr( win, 6, 2, "A1B2C3D4E5" ); + Continue(win); + wmove(win, 5, 1); winsertln (win); mvwaddstr(win, 5, 2, "The lines below should have moved down"); @@ -375,35 +478,60 @@ outputTest (WINDOW *win) echo(); wscanw (win, "%s", Buffer); - wclear(win); - mvwaddstr(win, 10, 1, "Enter a string"); - wrefresh(win); - clear(); - move(0,0); printw("This is a formatted string in stdscr: %d %s\n", 42, "is it"); mvaddstr(10, 1, "Enter a string: "); - refresh(); - noraw(); - echo(); scanw ("%s", Buffer); - wclear(win); - curs_set(2); - mvwaddstr(win, 1, 1, "The cursor should appear as a block (visible)"); - Continue(win); + if (tigetstr("cvvis") != 0) { + wclear(win); + curs_set(2); + mvwaddstr(win, 1, 1, "The cursor should appear as a block (visible)"); + Continue(win); + } - wclear(win); - curs_set(0); - mvwaddstr(win, 1, 1, "The cursor should have disappeared (invisible)"); - Continue(win); + if (tigetstr("civis") != 0) { + wclear(win); + curs_set(0); + mvwaddstr(win, 1, 1, "The cursor should have disappeared (invisible)"); + Continue(win); + } - wclear(win); - curs_set(1); - mvwaddstr(win, 1, 1, "The cursor should be an underline (normal)"); + if (tigetstr("cnorm") != 0) { + wclear(win); + curs_set(1); + mvwaddstr(win, 1, 1, "The cursor should be an underline (normal)"); + Continue(win); + } + +#ifdef A_COLOR + if ( has_colors() ) { + wclear(win); + mvwaddstr(win, 1, 1, "Colors should change after you press a key"); + Continue(win); + init_pair(1, COLOR_RED, COLOR_WHITE); + wrefresh(win); + } +#endif + + werase(win); + mvwaddstr(win, 1, 1, "Information About Your Terminal"); + mvwaddstr(win, 3, 1, termname()); + mvwaddstr(win, 4, 1, longname()); + if ( termattrs() & A_BLINK ) + mvwaddstr(win,5, 1, "This terminal supports blinking."); + else + mvwaddstr(win,5, 1, "This terminal does NOT support blinking."); + + mvwaddnstr( win, 7,5, "Have a nice day!ok", 16 ); + wrefresh(win); + + mvwinnstr( win, 7,5, Buffer, 18 ); + mvaddstr( LINES-2, 10, Buffer ); + refresh(); Continue(win); } -#ifdef __PDCURSES__ +#if defined(PDCURSES) && !defined(XCURSES) static void resizeTest(WINDOW *dummy GCC_UNUSED) { @@ -413,10 +541,13 @@ resizeTest(WINDOW *dummy GCC_UNUSED) clear(); refresh(); - resize(50); +# if defined(OS2) + resize_term(50,120); +# else + resize_term(50,80); +# endif - - win1 = newwin(11, 50, 14, 25); + win1 = newwin(10, 50, 14, 25); if(win1 == NULL) { endwin(); return; @@ -433,9 +564,9 @@ resizeTest(WINDOW *dummy GCC_UNUSED) mvwaddstr(win1, 1, 1, "The screen may now have 50 lines"); Continue(win1); + wclear (win1); resetty (); - wclear (win1); mvwaddstr(win1, 1, 1, "The screen should now be reset"); Continue(win1); @@ -450,12 +581,14 @@ resizeTest(WINDOW *dummy GCC_UNUSED) static void padTest(WINDOW *dummy GCC_UNUSED) { -WINDOW *pad; +WINDOW *pad, *spad; pad = newpad(50,100); + wattron(pad, A_REVERSE); mvwaddstr(pad, 5, 2, "This is a new pad"); - mvwaddstr(pad, 8, 0, "The end of this line should be truncated here:abcd"); - mvwaddstr(pad,11, 1, "This line should not appear."); + wattrset(pad,A_NORMAL); + mvwaddstr(pad, 8, 0, "The end of this line should be truncated here:except now"); + mvwaddstr(pad,11, 1, "This line should not appear.It will now"); wmove(pad, 10, 1); wclrtoeol(pad); mvwaddstr(pad, 10, 1, " Press any key to continue"); @@ -464,6 +597,14 @@ WINDOW *pad; raw(); wgetch(pad); + spad = subpad(pad,12,25,6,52); + mvwaddstr(spad, 2, 2, "This is a new subpad"); + box(spad,0,0); + prefresh(pad,0,0,0,0,15,75); + keypad(pad, TRUE); + raw(); + wgetch(pad); + mvwaddstr(pad, 35, 2, "This is displayed at line 35 in the pad"); mvwaddstr(pad, 40, 1, " Press any key to continue"); prefresh(pad,30,0,0,0,10,45); diff --git a/test/testscanw.c b/test/testscanw.c new file mode 100644 index 00000000..8420ea0f --- /dev/null +++ b/test/testscanw.c @@ -0,0 +1,38 @@ +/* gleaned from a web-search, shows a bug combining scanw and implicit scroll. + * Date: 1997/03/17 + * From: bayern@morpheus.cis.yale.edu + * + * $Id: testscanw.c,v 1.5 1997/09/20 14:16:20 tom Exp $ + */ +#include +#include + +int main(int argc, char *argv[]) +{ + long badanswer = 1; + long *response = &badanswer; + + initscr(); + scrollok(stdscr, TRUE); + idlok(stdscr, TRUE); + echo(); + +#if 0 + trace(TRACE_UPDATE|TRACE_CALLS); +#endif + while (argc > 1) { + if (isdigit(*argv[1])) + move(atoi(argv[1]), 0); + else if (!strcmp(argv[1], "-k")) + keypad(stdscr, TRUE); + argc--, argv++; + } + + while (badanswer) { + printw("Enter a number (0 to quit):\n"); + printw("--> "); + scanw("%20ld", response); /* yes, it's a pointer */ + } + endwin(); + return EXIT_SUCCESS; +} diff --git a/test/view.c b/test/view.c index bbcecf6b..ad6bb2e1 100644 --- a/test/view.c +++ b/test/view.c @@ -7,7 +7,7 @@ * modified by Thomas Dickey July 1995 to demonstrate * the use of 'resizeterm()'. * - * Takes a filename argument. It's a simple file-viewer with various + * Takes a filename argument. It's a simple file-viewer with various * scroll-up and scroll-down commands. * * n -- scroll one line forward @@ -22,7 +22,7 @@ * scroll operation worked, and the refresh() code only had to do a * partial repaint. * - * $Id: view.c,v 1.20 1997/04/26 18:16:38 tom Exp $ + * $Id: view.c,v 1.26 1997/11/15 22:36:41 tom Exp $ */ #include @@ -44,16 +44,14 @@ #endif /* This is needed to compile 'struct winsize' */ -#if SYSTEM_LOOKS_LIKE_SCO +#if NEED_PTEM_H #include #include #endif - -#define MAXLINES 256 /* most lines we can handle */ -static void finish(int sig) GCC_NORETURN; +static RETSIGTYPE finish(int sig) GCC_NORETURN; static void show_all(void); - + #if defined(SIGWINCH) && defined(TIOCGWINSZ) && defined(NCURSES_VERSION) #define CAN_RESIZE 1 #else @@ -69,10 +67,11 @@ static int waiting; static int shift; static char *fname; -static char *lines[MAXLINES]; +static char **lines; static char **lptr; #if !HAVE_STRDUP +#define strdup my_strdup static char *strdup (char *s) { char *p; @@ -84,51 +83,88 @@ static char *strdup (char *s) } #endif /* not HAVE_STRDUP */ +static void usage(void) +{ + static const char *msg[] = { + "Usage: view [options] file" + ,"" + ,"Options:" + ," -n NUM specify maximum number of lines (default 1000)" +#if defined(KEY_RESIZE) + ," -r use experimental KEY_RESIZE rather than our own handler" +#endif +#ifdef TRACE + ," -t trace screen updates" + ," -T NUM specify trace mask" +#endif + }; + size_t n; + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + exit (EXIT_FAILURE); +} + int main(int argc, char *argv[]) { +int MAXLINES = 1000; FILE *fp; char buf[BUFSIZ]; int i; char **olptr; int done = FALSE; +int length = 0; +#if CAN_RESIZE +bool use_resize = TRUE; +#endif + while ((i = getopt(argc, argv, "n:rtT:")) != EOF) { + switch (i) { + case 'n': + if ((MAXLINES = atoi(optarg)) < 1) + usage(); + break; +#if CAN_RESIZE + case 'r': + use_resize = FALSE; + break; +#endif #ifdef TRACE - trace(TRACE_UPDATE); + case 'T': + trace(atoi(optarg)); + break; + case 't': + trace(TRACE_CALLS); + break; #endif - - if (argc != 2) { - fprintf(stderr, "usage: view file\n"); - return EXIT_FAILURE; - } else { - fname = argv[1]; - if ((fp = fopen(fname, "r")) == (FILE *)NULL) { - perror(fname); - return EXIT_FAILURE; + default: + usage(); } } + if (optind + 1 != argc) + usage(); + + if ((lines = (char **)calloc(MAXLINES+2, sizeof(*lines))) == 0) + usage(); + + fname = argv[optind]; + if ((fp = fopen(fname, "r")) == 0) { + perror(fname); + return EXIT_FAILURE; + } (void) signal(SIGINT, finish); /* arrange interrupts to terminate */ #if CAN_RESIZE - (void) signal(SIGWINCH, adjust); /* arrange interrupts to resize */ + if (use_resize) + (void) signal(SIGWINCH, adjust); /* arrange interrupts to resize */ #endif - (void) initscr(); /* initialize the curses library */ - keypad(stdscr, TRUE); /* enable keyboard mapping */ - (void) nonl(); /* tell curses not to do NL->CR/NL on output */ - (void) cbreak(); /* take input chars one at a time, no wait for \n */ - (void) noecho(); /* don't echo input */ - idlok(stdscr, TRUE); /* allow use of insert/delete line */ - /* slurp the file */ - for (lptr = &lines[0]; fgets(buf, BUFSIZ, fp) != (char *)NULL; lptr++) { + for (lptr = &lines[0]; (lptr - lines) < MAXLINES; lptr++) { char temp[BUFSIZ], *s, *d; int col; - if (lptr - lines >= MAXLINES) { - endwin(); - (void) fprintf(stderr, "%s: %s is too large\n", argv[0], argv[1]); - return EXIT_FAILURE; - } + if (fgets(buf, sizeof(buf), fp) == 0) + break; /* convert tabs so that shift will work properly */ for (s = buf, d = temp, col = 0; (*d = *s) != '\0'; s++) { @@ -143,23 +179,31 @@ int done = FALSE; col++; d++; } else { - sprintf(d, "\\%03o", *s); + sprintf(d, "\\%03o", *s & 0xff); d += strlen(d); col = (d - temp); } } - *lptr = strdup(temp); + *lptr = strdup(temp); } (void) fclose(fp); + length = lptr - lines; + + (void) initscr(); /* initialize the curses library */ + keypad(stdscr, TRUE); /* enable keyboard mapping */ + (void) nonl(); /* tell curses not to do NL->CR/NL on output */ + (void) cbreak(); /* take input chars one at a time, no wait for \n */ + (void) noecho(); /* don't echo input */ + idlok(stdscr, TRUE); /* allow use of insert/delete line */ lptr = lines; while (!done) { - int n, c; - bool explicit; + int n, c; + bool got_number; show_all(); - explicit = FALSE; + got_number = FALSE; n = 0; for (;;) { #if CAN_RESIZE @@ -169,43 +213,57 @@ int done = FALSE; waiting = TRUE; c = getch(); waiting = FALSE; - if (c < 127 && isdigit(c)) { + if ((c < 127) && isdigit(c)) { + if (!got_number) { + mvprintw(0,0, "Count: "); + clrtoeol(); + } + addch(c); n = 10 * n + (c - '0'); - explicit = TRUE; - } else + got_number = TRUE; + } + else break; } - if (!explicit && n == 0) + if (!got_number && n == 0) n = 1; - switch(c) { - case KEY_DOWN: + switch(c) { + case KEY_DOWN: case 'n': olptr = lptr; - for (i = 0; i < n; i++) - if (lptr + LINES < lines + MAXLINES && lptr[LINES + 1]) + for (i = 0; i < n; i++) + if ((lptr - lines) < (length - LINES + 1)) lptr++; - else + else break; wscrl(stdscr, lptr - olptr); - break; + break; - case KEY_UP: + case KEY_UP: case 'p': olptr = lptr; - for (i = 0; i < n; i++) + for (i = 0; i < n; i++) if (lptr > lines) lptr--; - else + else break; wscrl(stdscr, lptr - olptr); - break; + break; case 'h': case KEY_HOME: lptr = lines; break; + case 'e': + case KEY_END: + if (length > LINES) + lptr = lines + length - LINES + 1; + else + lptr = lines; + break; + case 'r': case KEY_RIGHT: shift++; @@ -214,7 +272,7 @@ int done = FALSE; case 'l': case KEY_LEFT: if (shift) - shift--; + shift--; else beep(); break; @@ -223,12 +281,20 @@ int done = FALSE; done = TRUE; break; +#ifdef KEY_RESIZE + case KEY_RESIZE: /* ignore this; ncurses will repaint */ + break; +#endif +#if CAN_RESIZE + case ERR: + break; +#endif default: beep(); } } - finish(0); /* we're done */ + finish(0); /* we're done */ } static RETSIGTYPE finish(int sig) @@ -250,7 +316,6 @@ static RETSIGTYPE adjust(int sig) if (ioctl(fileno(stdout), TIOCGWINSZ, &size) == 0) { resizeterm(size.ws_row, size.ws_col); - beep(); wrefresh(curscr); /* Linux needs this */ show_all(); } @@ -280,14 +345,14 @@ static void show_all(void) clrtoeol(); scrollok(stdscr, FALSE); /* prevent screen from moving */ - for (i = 1; i < LINES; i++) { - move(i, 0); - if ((s = lptr[i-1]) != 0 && (int)strlen(s) > shift) - printw("%3d:%.*s", lptr+i-lines, COLS-4, s + shift); + for (i = 1; i < LINES; i++) { + move(i, 0); + if ((s = lptr[i-1]) != 0 && (int)strlen(s) > shift) + printw("%3d:%.*s", lptr+i-lines, COLS-4, s + shift); else - printw("%3d:", lptr+i-lines); + printw("%3d:", lptr+i-lines); clrtoeol(); - } + } setscrreg(1, LINES-1); scrollok(stdscr, TRUE); refresh(); diff --git a/test/worm.c b/test/worm.c index ba54ba82..ceb4f980 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.20 1997/05/03 18:38:57 tom Exp $ + $Id: worm.c,v 1.21 1998/01/30 10:17:59 tom Exp $ */ #include @@ -233,13 +233,13 @@ int last, bottom; bg = -1; #endif - init_pair(COLOR_GREEN, COLOR_GREEN, -1); - init_pair(COLOR_RED, COLOR_RED, -1); - init_pair(COLOR_CYAN, COLOR_CYAN, -1); - init_pair(COLOR_WHITE, COLOR_WHITE, -1); - init_pair(COLOR_MAGENTA, COLOR_MAGENTA, -1); - init_pair(COLOR_BLUE, COLOR_BLUE, -1); - init_pair(COLOR_YELLOW, COLOR_YELLOW, -1); + init_pair(COLOR_GREEN, COLOR_GREEN, bg); + init_pair(COLOR_RED, COLOR_RED, bg); + init_pair(COLOR_CYAN, COLOR_CYAN, bg); + init_pair(COLOR_WHITE, COLOR_WHITE, bg); + init_pair(COLOR_MAGENTA, COLOR_MAGENTA, bg); + init_pair(COLOR_BLUE, COLOR_BLUE, bg); + init_pair(COLOR_YELLOW, COLOR_YELLOW, bg); flavor[0] |= COLOR_PAIR(COLOR_GREEN) | A_BOLD; flavor[1] |= COLOR_PAIR(COLOR_RED) | A_BOLD; diff --git a/test/xmas.c b/test/xmas.c index 4204fe70..3923c771 100644 --- a/test/xmas.c +++ b/test/xmas.c @@ -91,12 +91,16 @@ /* */ /******************************************************************************/ +/* + * $Id: xmas.c,v 1.12 1998/01/18 01:13:47 tom Exp $ + */ #include #include #define FROMWHO "Mark Hessling - (M.Hessling@gu.edu.au)" +static int my_bg = COLOR_BLACK; static int y_pos, x_pos; static WINDOW @@ -127,6 +131,40 @@ static int reindeer(void); static int blinkit(void); static RETSIGTYPE done(int sig) GCC_NORETURN ; +static void +set_color(WINDOW *win, chtype color) +{ + if (has_colors()) { + static bool *pairs; + int n = (color + 1); + if (pairs == 0) + pairs = (bool *)calloc(COLORS+1, sizeof(bool)); + if (!pairs[n]) { + init_pair(n, color, my_bg); + pairs[n] = TRUE; + } + wattroff(win, A_COLOR); + wattron(win, COLOR_PAIR(n)); + } +} + +static void +unset_color(WINDOW *win) +{ + if (has_colors()) + wattrset(win, COLOR_PAIR(0)); +} + +static void +look_out(int msecs) +{ + napms(msecs); + if (getch() != ERR) { + beep(); + done(0); + } +} + int main( int argc GCC_UNUSED, char **argv GCC_UNUSED) @@ -143,6 +181,14 @@ int loopy; signal(SIGHUP,done); signal(SIGQUIT,done); #endif + if (has_colors()) { + start_color(); +#ifdef NCURSES_VERSION + if (use_default_colors() == OK) + my_bg = -1; +#endif + } + curs_set(0); treescrn = newwin(16,27,3,53); treescrn2 = newwin(16,27,3,53); @@ -389,7 +435,7 @@ int loopy; /***********************************************/ cbreak(); nodelay(stdscr,TRUE); - do { + for (;;) { clear(); werase(treescrn); touchwin(w_del_msg); @@ -399,25 +445,25 @@ int loopy; werase(treescrn8); touchwin(treescrn8); refresh(); - napms(150); + look_out(150); boxit(); refresh(); - napms(150); + look_out(150); seas(); refresh(); - napms(150); + look_out(150); greet(); refresh(); - napms(150); + look_out(150); fromwho(); refresh(); - napms(150); + look_out(150); tree(); - napms(150); + look_out(150); balls(); - napms(150); + look_out(150); star(); - napms(150); + look_out(150); strng1(); strng2(); strng3(); @@ -596,14 +642,14 @@ int loopy; mvwaddch(treescrn7, 12, 14, ' '); - napms(150); + look_out(150); reindeer(); touchwin(w_holiday); wrefresh(w_holiday); wrefresh(w_del_msg); - napms(500); + look_out(500); for(loopy = 0;loopy < 100;loopy++) { blinkit(); } @@ -611,11 +657,7 @@ int loopy; #ifdef NOLOOP done(0); #endif - } - while(getch() == (ERR)); -/* while(!typeahead(stdin));*/ - done(0); /*NOTREACHED*/ } @@ -684,6 +726,7 @@ static int fromwho(void) static int tree(void) { + set_color(treescrn, COLOR_GREEN); mvwaddch(treescrn, 1, 11, (chtype)'/'); mvwaddch(treescrn, 2, 11, (chtype)'/'); mvwaddch(treescrn, 3, 10, (chtype)'/'); @@ -720,6 +763,7 @@ static int tree(void) mvwaddstr(treescrn, 14, 11, "| |"); mvwaddstr(treescrn, 15, 11, "|_|"); + unset_color(treescrn); wrefresh(treescrn); wrefresh(w_del_msg); @@ -729,9 +773,9 @@ static int tree(void) static int balls(void) { - overlay(treescrn, treescrn2); + set_color(treescrn2, COLOR_BLUE); mvwaddch(treescrn2, 3, 9, (chtype)'@'); mvwaddch(treescrn2, 3, 15, (chtype)'@'); mvwaddch(treescrn2, 4, 8, (chtype)'@'); @@ -749,6 +793,7 @@ static int balls(void) mvwaddch(treescrn2, 12, 1, (chtype)'@'); mvwaddch(treescrn2, 12, 23, (chtype)'@'); + unset_color(treescrn2); wrefresh(treescrn2); wrefresh(w_del_msg); return( 0 ); @@ -757,10 +802,13 @@ static int balls(void) static int star(void) { - wstandout(treescrn2); + wattrset(treescrn2, A_BOLD | A_BLINK); + set_color(treescrn2, COLOR_YELLOW); + mvwaddch(treescrn2, 0, 12, (chtype)'*'); wstandend(treescrn2); + unset_color(treescrn2); wrefresh(treescrn2); wrefresh(w_del_msg); return( 0 ); @@ -769,10 +817,16 @@ static int star(void) static int strng1(void) { + wattrset(treescrn2, A_BOLD | A_BLINK); + set_color(treescrn2, COLOR_WHITE); + mvwaddch(treescrn2, 3, 13, (chtype)'\''); mvwaddch(treescrn2, 3, 12, (chtype)':'); mvwaddch(treescrn2, 3, 11, (chtype)'.'); + wattroff(treescrn2, A_BOLD | A_BLINK); + unset_color(treescrn2); + wrefresh(treescrn2); wrefresh(w_del_msg); return( 0 ); @@ -781,6 +835,9 @@ static int strng1(void) static int strng2(void) { + wattrset(treescrn2, A_BOLD | A_BLINK); + set_color(treescrn2, COLOR_WHITE); + mvwaddch(treescrn2, 5, 14, (chtype)'\''); mvwaddch(treescrn2, 5, 13, (chtype)':'); mvwaddch(treescrn2, 5, 12, (chtype)'.'); @@ -788,6 +845,9 @@ static int strng2(void) mvwaddch(treescrn2, 6, 10, (chtype)'\''); mvwaddch(treescrn2, 6, 9, (chtype)':'); + wattroff(treescrn2, A_BOLD | A_BLINK); + unset_color(treescrn2); + wrefresh(treescrn2); wrefresh(w_del_msg); return( 0 ); @@ -796,6 +856,9 @@ static int strng2(void) static int strng3(void) { + wattrset(treescrn2, A_BOLD | A_BLINK); + set_color(treescrn2, COLOR_WHITE); + mvwaddch(treescrn2, 7, 16, (chtype)'\''); mvwaddch(treescrn2, 7, 15, (chtype)':'); mvwaddch(treescrn2, 7, 14, (chtype)'.'); @@ -805,6 +868,9 @@ static int strng3(void) mvwaddch(treescrn2, 8, 10, (chtype)'.'); mvwaddch(treescrn2, 8, 9, (chtype)','); + wattroff(treescrn2, A_BOLD | A_BLINK); + unset_color(treescrn2); + wrefresh(treescrn2); wrefresh(w_del_msg); return( 0 ); @@ -813,6 +879,9 @@ static int strng3(void) static int strng4(void) { + wattrset(treescrn2, A_BOLD | A_BLINK); + set_color(treescrn2, COLOR_WHITE); + mvwaddch(treescrn2, 9, 17, (chtype)'\''); mvwaddch(treescrn2, 9, 16, (chtype)':'); mvwaddch(treescrn2, 9, 15, (chtype)'.'); @@ -827,6 +896,9 @@ static int strng4(void) mvwaddch(treescrn2, 11, 6, (chtype)','); mvwaddch(treescrn2, 12, 5, (chtype)'\''); + wattroff(treescrn2, A_BOLD | A_BLINK); + unset_color(treescrn2); + wrefresh(treescrn2); wrefresh(w_del_msg); return( 0 ); @@ -835,6 +907,9 @@ static int strng4(void) static int strng5(void) { + wattrset(treescrn2, A_BOLD | A_BLINK); + set_color(treescrn2, COLOR_WHITE); + mvwaddch(treescrn2, 11, 19, (chtype)'\''); mvwaddch(treescrn2, 11, 18, (chtype)':'); mvwaddch(treescrn2, 11, 17, (chtype)'.'); @@ -844,6 +919,9 @@ static int strng5(void) mvwaddch(treescrn2, 12, 13, (chtype)'.'); mvwaddch(treescrn2, 12, 12, (chtype)','); + wattroff(treescrn2, A_BOLD | A_BLINK); + unset_color(treescrn2); + /* save a fully lit tree */ overlay(treescrn2, treescrn); @@ -910,7 +988,7 @@ deer_step(WINDOW *win, int y, int x) mvwin(win, y, x); wrefresh(win); wrefresh(w_del_msg); - napms(5); + look_out(5); } static int reindeer(void) @@ -930,7 +1008,7 @@ static int reindeer(void) werase(dotdeer0); wrefresh(dotdeer0); wrefresh(w_del_msg); - napms(50); + look_out(50); } } @@ -1006,7 +1084,7 @@ static int reindeer(void) } } - napms(300); + look_out(300); y_pos = 1; @@ -1062,8 +1140,9 @@ static RETSIGTYPE done(int sig GCC_UNUSED) signal(SIGHUP,done); signal(SIGQUIT,done); #endif - clear(); + move(LINES-1,0); refresh(); endwin(); + curs_set(1); exit(EXIT_SUCCESS); } -- 2.44.0
    C nameAda nameman page
    baudrate()Baudratecurs_termattrs.3x
    baudrate()Baudratecurs_termattrs.3x
    beep()Beepcurs_beep.3x
    bottom_panel()Bottompanel.3x
    box()Boxcurs_border.3x
    can_change_color()Can_Change_Colorcurs_color.3x
    can_change_color()Can_Change_Colorcurs_color.3x
    cbreak()Set_Cbreak_Modecurs_inopts.3x
    clearok()Clear_On_Next_Updatecurs_outopts.3x
    color_content()Color_Contentcurs_color.3x
    color_content()Color_Contentcurs_color.3x
    copywin()Copycurs_overlay.3x
    current_field()Currentform_page.3x
    current_item()Currentmitem_current.3x
    curs_set()Set_Cursor_Visibilitycurs_kernel.3x
    curs_set()Set_Cursor_Visibilitycurs_kernel.3x
    data_ahead()Data_Aheadform_data.3x
    data_behind()Data_Behindform_data.3x
    def_prog_mode()Save_Curses_Modecurs_kernel.3x
    def_prog_mode()Save_Curses_Modecurs_kernel.3x
    define_key()Define_Keydefine_key.3x
    del_panel()Deletepanel.3x
    delay_output()Delay_Outputcurs_util.3x
    delay_output()Delay_Outputcurs_util.3x
    delwin()Deletecurs_window.3x
    derwin()Derived_Windowcurs_window.3x
    doupdate()Update_Screencurs_refresh.3x
    dynamic_field_info()Dynamic_Infoform_field_info.3x
    echo()Set_Echo_Modecurs_inopts.3x
    endwin()End_Windowscurs_initscr.3x
    erasechar()Erase_Charactercurs_termattrs.3x
    erasechar()Erase_Charactercurs_termattrs.3x
    field_back()Backgroundform_field_attributes.3x
    field_back()Backgroundform_field_attributes.3x
    field_buffer()Get_Bufferform_field_buffer.3x
    field_pad()Pad_Characterform_field_attributes.3x
    field_status()Changedform_field_buffer.3x
    field_term()Get_Field_Term_Hookform_hook.3x
    field_type()Get_Typeform_field_validation.3x
    field_type()Get_Typeform_field_validation.3x
    field_userptrGet_User_Dataform_field_userptr.3x
    flash()Flash_Screencurs_beep.3x
    flushinp()Flush_Inputcurs_util.3x
    flushinp()Flush_Inputcurs_util.3x
    form_driver()Driverform_driver.3x
    form_fields()Fieldsform_field.3x
    form_init()Get_Form_Init_Hookform_hook.3x
    getparyx()Get_Origin_Relative_To_Parentcurs_getyx.3x
    getyx()Get_Cursor_Positioncurs_getyx.3x
    halfdelay()Half_Delaycurs_inopts.3x
    has_colors()Has_Colorscurs_color.3x
    has_ic()Has_Insert_Charactercurs_termattrs.3x
    has_il()Has_Insert_Linecurs_termattrs.3x
    has_colors()Has_Colorscurs_color.3x
    has_ic()Has_Insert_Charactercurs_termattrs.3x
    has_il()Has_Insert_Linecurs_termattrs.3x
    has_key()Has_Keycurs_getch.3x
    hide_panel()Hidepanel.3x
    idcok()Use_Insert_Delete_Charactercurs_outopts.3x
    idlok()Use_Insert_Delete_Linecurs_outopts.3x
    immedok()Immediate_Update_Modecurs_outopts.3x
    init_color()Init_Colorcurs_color.3x
    init_pair()Init_Paircurs_color.3x
    init_color()Init_Colorcurs_color.3x
    init_pair()Init_Paircurs_color.3x
    initscr()Init_Screencurs_initscr.3x
    initscr()Init_Windowscurs_initscr.3x
    intrflush()Set_Flush_On_Interrupt_Modecurs_inopts.3x
    item_userptrGet_User_Datamitem_userptr.3x
    item_value()Valuemitem_value.3x
    item_visible()Visiblemitem_visible.3x
    keyname()Key_Namecurs_util.3x
    keyname()Key_Namecurs_util.3x
    keyok()Enable_Keykeyok.3x
    keypad()Set_KeyPad_Modecurs_inopts.3x
    killchar()Kill_Charactercurs_termattrs.3x
    killchar()Kill_Charactercurs_termattrs.3x
    leaveok()Leave_Cursor_After_Updatecurs_outopts.3x
    link_field()Linkform_field_new.3x
    longname()Long_Namecurs_termattrs.3x
    longname()Long_Namecurs_termattrs.3x
    menu_back()Backgroundmenu_attribs.3x
    menu_back()Backgroundmenu_attribs.3x
    menu_driver()Drivermenu_new.3x
    mvwinnstr()Peekcurs_instr.3x
    mvwinsch()Insertcurs_winch.3x
    mvwinsnstr()Insertcurs_winch.3x
    napms()Nap_Milli_Secondscurs_kernel.3x
    napms()Nap_Milli_Secondscurs_kernel.3x
    new_field()Createform_field_new.3x
    new_field()New_Fieldform_field_new.3x
    new_form()Createform_new.3x
    notimeout()Set_Escape_Time_Modecurs_inopts.3x
    overlay()Overlaycurs_overlay.3x
    overwrite()Overwritecurs_overlay.3x
    pair_content()Pair_Contentcurs_color.3x
    pair_content()Pair_Contentcurs_color.3x
    panel_above()Abovepanel.3x
    panel_below()Belowpanel.3x
    panel_hidden()Is_Hiddenpanel.3x
    raw()Set_Raw_Modecurs_inopts.3x
    redrawwin()Redrawcurs_refresh.3x
    replace_panel()Replacepanel.3x
    reset_prog_mode()Reset_Curses_Modecurs_kernel.3x
    resetty();Reset_Terminal_Statecurs_kernel.3x
    ripoffline()Rip_Off_Linescurs_kernel.3x
    savetty()Save_Terminal_Statecurs_kernel.3x
    reset_prog_mode()Reset_Curses_Modecurs_kernel.3x
    resetty();Reset_Terminal_Statecurs_kernel.3x
    ripoffline()Rip_Off_Linescurs_kernel.3x
    savetty()Save_Terminal_Statecurs_kernel.3x
    scale_form()Scaleform_win.3x
    scale_menu()Scalemenu_win.3x
    scrollok()Allow_Scrollingcurs_outopts.3x
    set_field_pad()Set_Pad_Characterform_field_attributes.3x
    set_field_status()Set_Statusform_field_buffer.3x
    set_field_term()Set_Field_Term_Hookform_hook.3x
    set_field_type()Set_Typeform_fieldtype.3x
    set_field_type()Set_Typeform_fieldtype.3x
    set_field_userptrSet_User_Dataform_field_userptr.3x
    set_form_fields()Redefineform_field.3x
    set_form_fields()Set_Fieldsform_field.3x
    slk_restore()Restore_Soft_Label_Keyscurs_slk.3x
    slk_set()Set_Soft_Label_Keycurs_slk.3x
    slk_touch()Touch_Soft_Label_Keyscurs_slk.3x
    start_clolor()Start_Colorcurs_color.3x
    start_clolor()Start_Colorcurs_color.3x
    stdscrStandard_Windowcurs_initscr.3x
    subpad()Sub_Padcurs_pad.3x
    subwin()Sub_Windowcurs_window.3x
    syncok()Set_Synch_Modecurs_window.3x
    termattrs()Supported_Attributescurs_termattrs.3x
    termname()Terminal_Namecurs_termattrs.3x
    termattrs()Supported_Attributescurs_termattrs.3x
    termname()Terminal_Namecurs_termattrs.3x
    top_panel()Toppanel.3x
    top_row()Top_Rowmitem_current.3x
    touchline()Touchcurs_touch.3x
    touchwin()Touchcurs_touch.3x
    unctrl()Un_Controlcurs_util.3x
    unctrl()Un_Controlcurs_util.3x
    ungetch()Undo_Keystrokecurs_getch.3x
    ungetmouse()Unget_Mousecurs_mouse.3x
    untouchwin()Untouchcurs_touch.3x