From f5813cd463176e23f3594134737acfdd21e497d7 Mon Sep 17 00:00:00 2001 From: agalliat <42209272+agalliat@users.noreply.github.com> Date: Sat, 22 Feb 2025 20:24:28 +0100 Subject: [PATCH] PDCurses --- vendor/build_pdcurses.txt | 11 + vendor/pdcurses/CNAME | 1 + vendor/pdcurses/README.md | 82 + vendor/pdcurses/common/README.md | 5 + vendor/pdcurses/common/acs437.h | 35 + vendor/pdcurses/common/acsgr.h | 35 + vendor/pdcurses/common/acsuni.h | 35 + vendor/pdcurses/common/borland.lrf | 9 + vendor/pdcurses/common/font437.h | 386 ++ vendor/pdcurses/common/icon32.xpm | 42 + vendor/pdcurses/common/icon64.xpm | 74 + vendor/pdcurses/common/iconbmp.h | 24 + vendor/pdcurses/common/libobjs.mif | 24 + vendor/pdcurses/common/pdcurses.rc | 35 + vendor/pdcurses/common/watcom.mif | 72 + vendor/pdcurses/curses.h | 1441 ++++++ vendor/pdcurses/curspriv.h | 133 + vendor/pdcurses/demos/README.md | 28 + vendor/pdcurses/demos/UTF-8-demo.txt | 212 + vendor/pdcurses/demos/firework.c | 145 + vendor/pdcurses/demos/nctests.mif | 34 + vendor/pdcurses/demos/ncurses_cfg.h | 65 + vendor/pdcurses/demos/ozdemo.c | 435 ++ vendor/pdcurses/demos/pdcurses.lib | Bin 0 -> 115712 bytes vendor/pdcurses/demos/ptest.c | 311 ++ vendor/pdcurses/demos/rain.c | 157 + vendor/pdcurses/demos/testcurs.c | 1382 ++++++ vendor/pdcurses/demos/tui.c | 824 ++++ vendor/pdcurses/demos/tui.h | 65 + vendor/pdcurses/demos/tuidemo.c | 228 + vendor/pdcurses/demos/worm.c | 432 ++ vendor/pdcurses/demos/xmas.c | 954 ++++ vendor/pdcurses/docs/HISTORY.md | 2477 +++++++++++ vendor/pdcurses/docs/IMPLEMNT.md | 323 ++ vendor/pdcurses/docs/MANUAL.md | 3099 +++++++++++++ vendor/pdcurses/docs/README.md | 37 + vendor/pdcurses/docs/USERS.md | 380 ++ vendor/pdcurses/docs/manext.awk | 15 + vendor/pdcurses/docs/mkman.sh | 7 + vendor/pdcurses/dos/Makefile | 82 + vendor/pdcurses/dos/Makefile.bcc | 76 + vendor/pdcurses/dos/Makefile.wcc | 35 + vendor/pdcurses/dos/README.md | 41 + vendor/pdcurses/dos/pdcclip.c | 133 + vendor/pdcurses/dos/pdcdisp.c | 155 + vendor/pdcurses/dos/pdcdos.h | 168 + vendor/pdcurses/dos/pdcgetsc.c | 81 + vendor/pdcurses/dos/pdckbd.c | 472 ++ vendor/pdcurses/dos/pdcscrn.c | 684 +++ vendor/pdcurses/dos/pdcsetsc.c | 122 + vendor/pdcurses/dos/pdcurses.lib | Bin 0 -> 115712 bytes vendor/pdcurses/dos/pdcutil.c | 103 + vendor/pdcurses/os2/Makefile | 95 + vendor/pdcurses/os2/Makefile.bcc | 76 + vendor/pdcurses/os2/Makefile.wcc | 24 + vendor/pdcurses/os2/README.md | 28 + vendor/pdcurses/os2/pdcclip.c | 173 + vendor/pdcurses/os2/pdcdisp.c | 126 + vendor/pdcurses/os2/pdcgetsc.c | 52 + vendor/pdcurses/os2/pdckbd.c | 437 ++ vendor/pdcurses/os2/pdcos2.h | 23 + vendor/pdcurses/os2/pdcscrn.c | 224 + vendor/pdcurses/os2/pdcsetsc.c | 116 + vendor/pdcurses/os2/pdcutil.c | 38 + vendor/pdcurses/panel.h | 54 + vendor/pdcurses/pdcurses/README.md | 19 + vendor/pdcurses/pdcurses/addch.c | 410 ++ vendor/pdcurses/pdcurses/addchstr.c | 246 + vendor/pdcurses/pdcurses/addstr.c | 241 + vendor/pdcurses/pdcurses/attr.c | 411 ++ vendor/pdcurses/pdcurses/beep.c | 76 + vendor/pdcurses/pdcurses/bkgd.c | 228 + vendor/pdcurses/pdcurses/border.c | 418 ++ vendor/pdcurses/pdcurses/clear.c | 161 + vendor/pdcurses/pdcurses/color.c | 364 ++ vendor/pdcurses/pdcurses/debug.c | 108 + vendor/pdcurses/pdcurses/delch.c | 98 + vendor/pdcurses/pdcurses/deleteln.c | 213 + vendor/pdcurses/pdcurses/getch.c | 591 +++ vendor/pdcurses/pdcurses/getstr.c | 480 ++ vendor/pdcurses/pdcurses/getyx.c | 144 + vendor/pdcurses/pdcurses/inch.c | 128 + vendor/pdcurses/pdcurses/inchstr.c | 215 + vendor/pdcurses/pdcurses/initscr.c | 433 ++ vendor/pdcurses/pdcurses/inopts.c | 410 ++ vendor/pdcurses/pdcurses/insch.c | 272 ++ vendor/pdcurses/pdcurses/insstr.c | 265 ++ vendor/pdcurses/pdcurses/instr.c | 247 + vendor/pdcurses/pdcurses/kernel.c | 299 ++ vendor/pdcurses/pdcurses/keyname.c | 131 + vendor/pdcurses/pdcurses/mouse.c | 423 ++ vendor/pdcurses/pdcurses/move.c | 79 + vendor/pdcurses/pdcurses/outopts.c | 262 ++ vendor/pdcurses/pdcurses/overlay.c | 216 + vendor/pdcurses/pdcurses/pad.c | 276 ++ vendor/pdcurses/pdcurses/panel.c | 646 +++ vendor/pdcurses/pdcurses/printw.c | 131 + vendor/pdcurses/pdcurses/refresh.c | 289 ++ vendor/pdcurses/pdcurses/scanw.c | 583 +++ vendor/pdcurses/pdcurses/scr_dump.c | 219 + vendor/pdcurses/pdcurses/scroll.c | 103 + vendor/pdcurses/pdcurses/slk.c | 673 +++ vendor/pdcurses/pdcurses/termattr.c | 174 + vendor/pdcurses/pdcurses/touch.c | 210 + vendor/pdcurses/pdcurses/util.c | 310 ++ vendor/pdcurses/pdcurses/window.c | 639 +++ vendor/pdcurses/sdl1/Makefile | 105 + vendor/pdcurses/sdl1/README.md | 179 + vendor/pdcurses/sdl1/pdcclip.c | 132 + vendor/pdcurses/sdl1/pdcdisp.c | 529 +++ vendor/pdcurses/sdl1/pdcgetsc.c | 30 + vendor/pdcurses/sdl1/pdckbd.c | 373 ++ vendor/pdcurses/sdl1/pdcscrn.c | 368 ++ vendor/pdcurses/sdl1/pdcsdl.h | 34 + vendor/pdcurses/sdl1/pdcsetsc.c | 108 + vendor/pdcurses/sdl1/pdcutil.c | 28 + vendor/pdcurses/sdl1/sdltest.c | 79 + vendor/pdcurses/sdl2/Makefile | 156 + vendor/pdcurses/sdl2/Makefile.vc | 129 + vendor/pdcurses/sdl2/README.md | 194 + vendor/pdcurses/sdl2/pdcclip.c | 93 + vendor/pdcurses/sdl2/pdcdisp.c | 581 +++ vendor/pdcurses/sdl2/pdcgetsc.c | 30 + vendor/pdcurses/sdl2/pdckbd.c | 478 ++ vendor/pdcurses/sdl2/pdcscrn.c | 426 ++ vendor/pdcurses/sdl2/pdcsdl.h | 36 + vendor/pdcurses/sdl2/pdcsetsc.c | 108 + vendor/pdcurses/sdl2/pdcutil.c | 27 + vendor/pdcurses/sdl2/sdltest.c | 84 + vendor/pdcurses/sdl2/versions.mif | 2 + vendor/pdcurses/wincon/Makefile | 115 + vendor/pdcurses/wincon/Makefile.bcc | 87 + vendor/pdcurses/wincon/Makefile.vc | 120 + vendor/pdcurses/wincon/Makefile.wcc | 37 + vendor/pdcurses/wincon/README.md | 70 + vendor/pdcurses/wincon/pdcclip.c | 150 + vendor/pdcurses/wincon/pdcdisp.c | 329 ++ vendor/pdcurses/wincon/pdcgetsc.c | 42 + vendor/pdcurses/wincon/pdckbd.c | 693 +++ vendor/pdcurses/wincon/pdcscrn.c | 686 +++ vendor/pdcurses/wincon/pdcsetsc.c | 133 + vendor/pdcurses/wincon/pdcutil.c | 26 + vendor/pdcurses/wincon/pdcwin.h | 27 + vendor/pdcurses/x11/Makefile.in | 562 +++ vendor/pdcurses/x11/README.md | 227 + vendor/pdcurses/x11/aclocal.m4 | 553 +++ vendor/pdcurses/x11/config.guess | 1774 ++++++++ vendor/pdcurses/x11/config.h.in | 34 + vendor/pdcurses/x11/config.sub | 1907 ++++++++ vendor/pdcurses/x11/configure | 5940 +++++++++++++++++++++++++ vendor/pdcurses/x11/configure.ac | 171 + vendor/pdcurses/x11/install-sh | 253 ++ vendor/pdcurses/x11/pdcclip.c | 247 + vendor/pdcurses/x11/pdcdisp.c | 437 ++ vendor/pdcurses/x11/pdcgetsc.c | 28 + vendor/pdcurses/x11/pdckbd.c | 583 +++ vendor/pdcurses/x11/pdcscrn.c | 746 ++++ vendor/pdcurses/x11/pdcsetsc.c | 102 + vendor/pdcurses/x11/pdcutil.c | 39 + vendor/pdcurses/x11/pdcx11.h | 82 + vendor/pdcurses/x11/sb.c | 328 ++ vendor/pdcurses/x11/scrlbox.c | 337 ++ vendor/pdcurses/x11/scrlbox.h | 47 + vendor/pdcurses/x11/xcurses-config.in | 81 + 164 files changed, 50815 insertions(+) create mode 100644 vendor/build_pdcurses.txt create mode 100644 vendor/pdcurses/CNAME create mode 100644 vendor/pdcurses/README.md create mode 100644 vendor/pdcurses/common/README.md create mode 100644 vendor/pdcurses/common/acs437.h create mode 100644 vendor/pdcurses/common/acsgr.h create mode 100644 vendor/pdcurses/common/acsuni.h create mode 100644 vendor/pdcurses/common/borland.lrf create mode 100644 vendor/pdcurses/common/font437.h create mode 100644 vendor/pdcurses/common/icon32.xpm create mode 100644 vendor/pdcurses/common/icon64.xpm create mode 100644 vendor/pdcurses/common/iconbmp.h create mode 100644 vendor/pdcurses/common/libobjs.mif create mode 100644 vendor/pdcurses/common/pdcurses.rc create mode 100644 vendor/pdcurses/common/watcom.mif create mode 100644 vendor/pdcurses/curses.h create mode 100644 vendor/pdcurses/curspriv.h create mode 100644 vendor/pdcurses/demos/README.md create mode 100644 vendor/pdcurses/demos/UTF-8-demo.txt create mode 100644 vendor/pdcurses/demos/firework.c create mode 100644 vendor/pdcurses/demos/nctests.mif create mode 100644 vendor/pdcurses/demos/ncurses_cfg.h create mode 100644 vendor/pdcurses/demos/ozdemo.c create mode 100644 vendor/pdcurses/demos/pdcurses.lib create mode 100644 vendor/pdcurses/demos/ptest.c create mode 100644 vendor/pdcurses/demos/rain.c create mode 100644 vendor/pdcurses/demos/testcurs.c create mode 100644 vendor/pdcurses/demos/tui.c create mode 100644 vendor/pdcurses/demos/tui.h create mode 100644 vendor/pdcurses/demos/tuidemo.c create mode 100644 vendor/pdcurses/demos/worm.c create mode 100644 vendor/pdcurses/demos/xmas.c create mode 100644 vendor/pdcurses/docs/HISTORY.md create mode 100644 vendor/pdcurses/docs/IMPLEMNT.md create mode 100644 vendor/pdcurses/docs/MANUAL.md create mode 100644 vendor/pdcurses/docs/README.md create mode 100644 vendor/pdcurses/docs/USERS.md create mode 100755 vendor/pdcurses/docs/manext.awk create mode 100755 vendor/pdcurses/docs/mkman.sh create mode 100644 vendor/pdcurses/dos/Makefile create mode 100644 vendor/pdcurses/dos/Makefile.bcc create mode 100644 vendor/pdcurses/dos/Makefile.wcc create mode 100644 vendor/pdcurses/dos/README.md create mode 100644 vendor/pdcurses/dos/pdcclip.c create mode 100644 vendor/pdcurses/dos/pdcdisp.c create mode 100644 vendor/pdcurses/dos/pdcdos.h create mode 100644 vendor/pdcurses/dos/pdcgetsc.c create mode 100644 vendor/pdcurses/dos/pdckbd.c create mode 100644 vendor/pdcurses/dos/pdcscrn.c create mode 100644 vendor/pdcurses/dos/pdcsetsc.c create mode 100644 vendor/pdcurses/dos/pdcurses.lib create mode 100644 vendor/pdcurses/dos/pdcutil.c create mode 100644 vendor/pdcurses/os2/Makefile create mode 100644 vendor/pdcurses/os2/Makefile.bcc create mode 100644 vendor/pdcurses/os2/Makefile.wcc create mode 100644 vendor/pdcurses/os2/README.md create mode 100644 vendor/pdcurses/os2/pdcclip.c create mode 100644 vendor/pdcurses/os2/pdcdisp.c create mode 100644 vendor/pdcurses/os2/pdcgetsc.c create mode 100644 vendor/pdcurses/os2/pdckbd.c create mode 100644 vendor/pdcurses/os2/pdcos2.h create mode 100644 vendor/pdcurses/os2/pdcscrn.c create mode 100644 vendor/pdcurses/os2/pdcsetsc.c create mode 100644 vendor/pdcurses/os2/pdcutil.c create mode 100644 vendor/pdcurses/panel.h create mode 100644 vendor/pdcurses/pdcurses/README.md create mode 100644 vendor/pdcurses/pdcurses/addch.c create mode 100644 vendor/pdcurses/pdcurses/addchstr.c create mode 100644 vendor/pdcurses/pdcurses/addstr.c create mode 100644 vendor/pdcurses/pdcurses/attr.c create mode 100644 vendor/pdcurses/pdcurses/beep.c create mode 100644 vendor/pdcurses/pdcurses/bkgd.c create mode 100644 vendor/pdcurses/pdcurses/border.c create mode 100644 vendor/pdcurses/pdcurses/clear.c create mode 100644 vendor/pdcurses/pdcurses/color.c create mode 100644 vendor/pdcurses/pdcurses/debug.c create mode 100644 vendor/pdcurses/pdcurses/delch.c create mode 100644 vendor/pdcurses/pdcurses/deleteln.c create mode 100644 vendor/pdcurses/pdcurses/getch.c create mode 100644 vendor/pdcurses/pdcurses/getstr.c create mode 100644 vendor/pdcurses/pdcurses/getyx.c create mode 100644 vendor/pdcurses/pdcurses/inch.c create mode 100644 vendor/pdcurses/pdcurses/inchstr.c create mode 100644 vendor/pdcurses/pdcurses/initscr.c create mode 100644 vendor/pdcurses/pdcurses/inopts.c create mode 100644 vendor/pdcurses/pdcurses/insch.c create mode 100644 vendor/pdcurses/pdcurses/insstr.c create mode 100644 vendor/pdcurses/pdcurses/instr.c create mode 100644 vendor/pdcurses/pdcurses/kernel.c create mode 100644 vendor/pdcurses/pdcurses/keyname.c create mode 100644 vendor/pdcurses/pdcurses/mouse.c create mode 100644 vendor/pdcurses/pdcurses/move.c create mode 100644 vendor/pdcurses/pdcurses/outopts.c create mode 100644 vendor/pdcurses/pdcurses/overlay.c create mode 100644 vendor/pdcurses/pdcurses/pad.c create mode 100644 vendor/pdcurses/pdcurses/panel.c create mode 100644 vendor/pdcurses/pdcurses/printw.c create mode 100644 vendor/pdcurses/pdcurses/refresh.c create mode 100644 vendor/pdcurses/pdcurses/scanw.c create mode 100644 vendor/pdcurses/pdcurses/scr_dump.c create mode 100644 vendor/pdcurses/pdcurses/scroll.c create mode 100644 vendor/pdcurses/pdcurses/slk.c create mode 100644 vendor/pdcurses/pdcurses/termattr.c create mode 100644 vendor/pdcurses/pdcurses/touch.c create mode 100644 vendor/pdcurses/pdcurses/util.c create mode 100644 vendor/pdcurses/pdcurses/window.c create mode 100644 vendor/pdcurses/sdl1/Makefile create mode 100644 vendor/pdcurses/sdl1/README.md create mode 100644 vendor/pdcurses/sdl1/pdcclip.c create mode 100644 vendor/pdcurses/sdl1/pdcdisp.c create mode 100644 vendor/pdcurses/sdl1/pdcgetsc.c create mode 100644 vendor/pdcurses/sdl1/pdckbd.c create mode 100644 vendor/pdcurses/sdl1/pdcscrn.c create mode 100644 vendor/pdcurses/sdl1/pdcsdl.h create mode 100644 vendor/pdcurses/sdl1/pdcsetsc.c create mode 100644 vendor/pdcurses/sdl1/pdcutil.c create mode 100644 vendor/pdcurses/sdl1/sdltest.c create mode 100644 vendor/pdcurses/sdl2/Makefile create mode 100644 vendor/pdcurses/sdl2/Makefile.vc create mode 100644 vendor/pdcurses/sdl2/README.md create mode 100644 vendor/pdcurses/sdl2/pdcclip.c create mode 100644 vendor/pdcurses/sdl2/pdcdisp.c create mode 100644 vendor/pdcurses/sdl2/pdcgetsc.c create mode 100644 vendor/pdcurses/sdl2/pdckbd.c create mode 100644 vendor/pdcurses/sdl2/pdcscrn.c create mode 100644 vendor/pdcurses/sdl2/pdcsdl.h create mode 100644 vendor/pdcurses/sdl2/pdcsetsc.c create mode 100644 vendor/pdcurses/sdl2/pdcutil.c create mode 100644 vendor/pdcurses/sdl2/sdltest.c create mode 100644 vendor/pdcurses/sdl2/versions.mif create mode 100644 vendor/pdcurses/wincon/Makefile create mode 100644 vendor/pdcurses/wincon/Makefile.bcc create mode 100644 vendor/pdcurses/wincon/Makefile.vc create mode 100644 vendor/pdcurses/wincon/Makefile.wcc create mode 100644 vendor/pdcurses/wincon/README.md create mode 100644 vendor/pdcurses/wincon/pdcclip.c create mode 100644 vendor/pdcurses/wincon/pdcdisp.c create mode 100644 vendor/pdcurses/wincon/pdcgetsc.c create mode 100644 vendor/pdcurses/wincon/pdckbd.c create mode 100644 vendor/pdcurses/wincon/pdcscrn.c create mode 100644 vendor/pdcurses/wincon/pdcsetsc.c create mode 100644 vendor/pdcurses/wincon/pdcutil.c create mode 100644 vendor/pdcurses/wincon/pdcwin.h create mode 100644 vendor/pdcurses/x11/Makefile.in create mode 100644 vendor/pdcurses/x11/README.md create mode 100644 vendor/pdcurses/x11/aclocal.m4 create mode 100755 vendor/pdcurses/x11/config.guess create mode 100644 vendor/pdcurses/x11/config.h.in create mode 100755 vendor/pdcurses/x11/config.sub create mode 100755 vendor/pdcurses/x11/configure create mode 100644 vendor/pdcurses/x11/configure.ac create mode 100755 vendor/pdcurses/x11/install-sh create mode 100644 vendor/pdcurses/x11/pdcclip.c create mode 100644 vendor/pdcurses/x11/pdcdisp.c create mode 100644 vendor/pdcurses/x11/pdcgetsc.c create mode 100644 vendor/pdcurses/x11/pdckbd.c create mode 100644 vendor/pdcurses/x11/pdcscrn.c create mode 100644 vendor/pdcurses/x11/pdcsetsc.c create mode 100644 vendor/pdcurses/x11/pdcutil.c create mode 100644 vendor/pdcurses/x11/pdcx11.h create mode 100644 vendor/pdcurses/x11/sb.c create mode 100644 vendor/pdcurses/x11/scrlbox.c create mode 100644 vendor/pdcurses/x11/scrlbox.h create mode 100644 vendor/pdcurses/x11/xcurses-config.in diff --git a/vendor/build_pdcurses.txt b/vendor/build_pdcurses.txt new file mode 100644 index 0000000..71da7b4 --- /dev/null +++ b/vendor/build_pdcurses.txt @@ -0,0 +1,11 @@ +- im Verzeichnis "pdcurses/dos/": + +wmake -f Makefile.wcc MODEL=f + +- Demo's bauen: + +wmake demos -f Makefile.wcc MODEL=f + +- Dateien entfernen: + +wmake clean -f Makefile.wcc diff --git a/vendor/pdcurses/CNAME b/vendor/pdcurses/CNAME new file mode 100644 index 0000000..1f4a84b --- /dev/null +++ b/vendor/pdcurses/CNAME @@ -0,0 +1 @@ +pdcurses.org \ No newline at end of file diff --git a/vendor/pdcurses/README.md b/vendor/pdcurses/README.md new file mode 100644 index 0000000..587b11d --- /dev/null +++ b/vendor/pdcurses/README.md @@ -0,0 +1,82 @@ +PDCurses +======== + +Stable: [v3.9] +Current: [See git repository][git] + +PDCurses is a public domain curses library for [DOS], [OS/2], [Windows] +console, [X11] and [SDL], implementing most of the functions available in +[X/Open] and System V R4 curses, and supporting a variety of compilers for +these platforms. The X11 and SDL ports let you recompile existing +text-mode curses programs to produce GUI applications. + +PDCurses is distributed mainly as source code, but some pre-compiled +libraries may be available. + +The latest version can be found at: + + + +For changes, see the [History] file. The main documentation is now in the +[docs] directory. + + +Mailing lists +------------- + +There's a low-traffic mailing list for announcements and discussion. To +subscribe, email the [list server], with the first line of the body of +the message containing: + +`subscribe pdcurses-l` + +or you can read the mailing list [archive]. + + +Other links +----------- + +* [Docs][docs] +* [GitHub Page][git] +* [SourceForge Page] +* [X/Open] curses + + +Legal Stuff +----------- + +The core package and most ports are in the public domain, but a few files +in the [demos] and [X11][xstatus] directories are subject to copyright +under licenses described there. + +This software is provided AS IS with NO WARRANTY whatsoever. + + +Maintainer +---------- + +[William McBrine] + + +[v3.9]: https://github.com/wmcbrine/PDCurses/releases/tag/3.9 +[git]: https://github.com/wmcbrine/PDCurses + +[History]: docs/HISTORY.md +[docs]: docs/README.md + +[list server]: mailto:majordomo@lightlink.com +[archive]: https://www.mail-archive.com/pdcurses-l@lightlink.com/ + +[SourceForge Page]: https://sourceforge.net/projects/pdcurses +[X/Open]: https://pubs.opengroup.org/onlinepubs/007908799/cursesix.html + +[DOS]: dos/README.md +[OS/2]: os2/README.md +[SDL]: sdl2/README.md +[Windows]: wincon/README.md +[X11]: x11/README.md + +[demos]: demos/README.md#distribution-status +[xstatus]: x11/README.md#distribution-status + +[William McBrine]: https://wmcbrine.com/ diff --git a/vendor/pdcurses/common/README.md b/vendor/pdcurses/common/README.md new file mode 100644 index 0000000..70e3db6 --- /dev/null +++ b/vendor/pdcurses/common/README.md @@ -0,0 +1,5 @@ +PDCurses common files +===================== + +This directory is for files which are platform-specific, yet shared by +more than one platform, in contrast to the "common core" in ../pdcurses. diff --git a/vendor/pdcurses/common/acs437.h b/vendor/pdcurses/common/acs437.h new file mode 100644 index 0000000..24cbd78 --- /dev/null +++ b/vendor/pdcurses/common/acs437.h @@ -0,0 +1,35 @@ +/* ACS definitions originally by jshumate@wrdis01.robins.af.mil -- these + match code page 437 and compatible pages (CP850, CP852, etc.) */ + +chtype acs_map[128] = +{ + PDC_ACS(0), PDC_ACS(1), PDC_ACS(2), PDC_ACS(3), PDC_ACS(4), + PDC_ACS(5), PDC_ACS(6), PDC_ACS(7), PDC_ACS(8), PDC_ACS(9), + PDC_ACS(10), PDC_ACS(11), PDC_ACS(12), PDC_ACS(13), PDC_ACS(14), + PDC_ACS(15), PDC_ACS(16), PDC_ACS(17), PDC_ACS(18), PDC_ACS(19), + PDC_ACS(20), PDC_ACS(21), PDC_ACS(22), PDC_ACS(23), PDC_ACS(24), + PDC_ACS(25), PDC_ACS(26), PDC_ACS(27), PDC_ACS(28), PDC_ACS(29), + PDC_ACS(30), PDC_ACS(31), ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', + + PDC_ACS(0x1a), PDC_ACS(0x1b), PDC_ACS(0x18), PDC_ACS(0x19), + + '/', + + 0xdb, + + '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', + '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', + 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + + PDC_ACS(0x04), 0xb1, + + 'b', 'c', 'd', 'e', + + 0xf8, 0xf1, 0xb0, PDC_ACS(0x0f), 0xd9, 0xbf, 0xda, 0xc0, 0xc5, 0x2d, + 0x2d, 0xc4, 0x2d, 0x5f, 0xc3, 0xb4, 0xc1, 0xc2, 0xb3, 0xf3, 0xf2, + 0xe3, 0xd8, 0x9c, 0xf9, + + PDC_ACS(127) +}; diff --git a/vendor/pdcurses/common/acsgr.h b/vendor/pdcurses/common/acsgr.h new file mode 100644 index 0000000..674ddc5 --- /dev/null +++ b/vendor/pdcurses/common/acsgr.h @@ -0,0 +1,35 @@ +/* ACS Unicode mapping with punchouts for box characters et al. */ + +chtype acs_map[128] = +{ + PDC_ACS(0), PDC_ACS(1), PDC_ACS(2), PDC_ACS(3), PDC_ACS(4), + PDC_ACS(5), PDC_ACS(6), PDC_ACS(7), PDC_ACS(8), PDC_ACS(9), + PDC_ACS(10), PDC_ACS(11), PDC_ACS(12), PDC_ACS(13), PDC_ACS(14), + PDC_ACS(15), PDC_ACS(16), PDC_ACS(17), PDC_ACS(18), PDC_ACS(19), + PDC_ACS(20), PDC_ACS(21), PDC_ACS(22), PDC_ACS(23), PDC_ACS(24), + PDC_ACS(25), PDC_ACS(26), PDC_ACS(27), PDC_ACS(28), PDC_ACS(29), + PDC_ACS(30), PDC_ACS(31), ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', + + 0x2192, 0x2190, 0x2191, 0x2193, + + '/', + + ACS_BLOCK, + + '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', + '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', + 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + + 0x2666, 0x2592, + + 'b', 'c', 'd', 'e', + + 0x00b0, 0x00b1, 0x2591, 0x00a4, ACS_LRCORNER, ACS_URCORNER, + ACS_ULCORNER, ACS_LLCORNER, ACS_PLUS, ACS_S1, ACS_S3, ACS_HLINE, + ACS_S7, ACS_S9, ACS_LTEE, ACS_RTEE, ACS_BTEE, ACS_TTEE, ACS_VLINE, + 0x2264, 0x2265, 0x03c0, 0x2260, 0x00a3, 0x00b7, + + PDC_ACS(127) +}; diff --git a/vendor/pdcurses/common/acsuni.h b/vendor/pdcurses/common/acsuni.h new file mode 100644 index 0000000..2fdad8a --- /dev/null +++ b/vendor/pdcurses/common/acsuni.h @@ -0,0 +1,35 @@ +/* ACS Unicode mapping */ + +chtype acs_map[128] = +{ + PDC_ACS(0), PDC_ACS(1), PDC_ACS(2), PDC_ACS(3), PDC_ACS(4), + PDC_ACS(5), PDC_ACS(6), PDC_ACS(7), PDC_ACS(8), PDC_ACS(9), + PDC_ACS(10), PDC_ACS(11), PDC_ACS(12), PDC_ACS(13), PDC_ACS(14), + PDC_ACS(15), PDC_ACS(16), PDC_ACS(17), PDC_ACS(18), PDC_ACS(19), + PDC_ACS(20), PDC_ACS(21), PDC_ACS(22), PDC_ACS(23), PDC_ACS(24), + PDC_ACS(25), PDC_ACS(26), PDC_ACS(27), PDC_ACS(28), PDC_ACS(29), + PDC_ACS(30), PDC_ACS(31), ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', + + 0x2192, 0x2190, 0x2191, 0x2193, + + '/', + + 0x2588, + + '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', + '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', + 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + + 0x2666, 0x2592, + + 'b', 'c', 'd', 'e', + + 0x00b0, 0x00b1, 0x2591, 0x00a4, 0x2518, 0x2510, 0x250c, 0x2514, + 0x253c, 0x23ba, 0x23bb, 0x2500, 0x23bc, 0x23bd, 0x251c, 0x2524, + 0x2534, 0x252c, 0x2502, 0x2264, 0x2265, 0x03c0, 0x2260, 0x00a3, + 0x00b7, + + PDC_ACS(127) +}; diff --git a/vendor/pdcurses/common/borland.lrf b/vendor/pdcurses/common/borland.lrf new file mode 100644 index 0000000..4d1793d --- /dev/null +++ b/vendor/pdcurses/common/borland.lrf @@ -0,0 +1,9 @@ ++addch.obj +addchstr.obj +addstr.obj +attr.obj +beep.obj +bkgd.obj & ++border.obj +clear.obj +color.obj +delch.obj +deleteln.obj & ++getch.obj +getstr.obj +getyx.obj +inch.obj +inchstr.obj +initscr.obj & ++inopts.obj +insch.obj +insstr.obj +instr.obj +kernel.obj +keyname.obj & ++mouse.obj +move.obj +outopts.obj +overlay.obj +pad.obj +panel.obj & ++printw.obj +refresh.obj +scanw.obj +scr_dump.obj +scroll.obj +slk.obj & ++termattr.obj +touch.obj +util.obj +window.obj +debug.obj & ++pdcclip.obj +pdcdisp.obj +pdcgetsc.obj +pdckbd.obj +pdcscrn.obj & ++pdcsetsc.obj +pdcutil.obj ,lib.map diff --git a/vendor/pdcurses/common/font437.h b/vendor/pdcurses/common/font437.h new file mode 100644 index 0000000..1157953 --- /dev/null +++ b/vendor/pdcurses/common/font437.h @@ -0,0 +1,386 @@ +/* Default font for SDL (narrow build) -- this is simply a 256x128x1 + BMP, in #include'able form. The font is 8x16, code page 437, and is + based on the pc8x16s.bdf font from the vgafonts.tar.gz package, by + "Myrlin". */ + +unsigned char font437[] = +{ + 0x42, 0x4d, 0x3e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, + 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x12, 0x0b, + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, + 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x76, 0xf8, 0xc0, 0x6c, 0xfe, 0x70, 0x7c, 0x18, + 0x7e, 0x38, 0xee, 0x3c, 0x00, 0xc0, 0x1c, 0xc6, 0x00, 0x7e, 0x7e, + 0x7e, 0x18, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, + 0x00, 0x00, 0xdc, 0xcc, 0xc0, 0x6c, 0xc6, 0xd8, 0x66, 0x18, 0x18, + 0x6c, 0x6c, 0x66, 0x00, 0x60, 0x30, 0xc6, 0xfe, 0x00, 0x00, 0x00, + 0x18, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x7e, + 0x00, 0xd8, 0xcc, 0xc0, 0x6c, 0x60, 0xd8, 0x66, 0x18, 0x3c, 0xc6, + 0x6c, 0x66, 0x7e, 0x7e, 0x60, 0xc6, 0x00, 0x00, 0x30, 0x0c, 0x18, + 0xd8, 0x18, 0xdc, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x7e, 0x00, + 0xd8, 0xcc, 0xc0, 0x6c, 0x30, 0xd8, 0x66, 0x18, 0x66, 0xc6, 0x6c, + 0x66, 0xdb, 0xf3, 0x60, 0xc6, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x00, 0x76, 0x00, 0x18, 0x00, 0x6c, 0x00, 0x00, 0x7e, 0x00, 0xd8, + 0xc8, 0xc0, 0x6c, 0x18, 0xd8, 0x66, 0x18, 0x66, 0xc6, 0x6c, 0x66, + 0xdb, 0xdb, 0x60, 0xc6, 0xfe, 0x18, 0x0c, 0x30, 0x18, 0x18, 0x7e, + 0x00, 0x00, 0x18, 0x18, 0xec, 0x00, 0x00, 0x7e, 0x00, 0xdc, 0xdc, + 0xc0, 0x6c, 0x18, 0xd8, 0x66, 0x18, 0x66, 0xfe, 0xc6, 0x3e, 0xdb, + 0xdb, 0x7c, 0xc6, 0x00, 0x7e, 0x06, 0x60, 0x18, 0x18, 0x00, 0xdc, + 0x00, 0x00, 0x00, 0x0c, 0x36, 0x7e, 0x7e, 0x00, 0x76, 0xce, 0xc0, + 0xfe, 0x30, 0x7e, 0x66, 0xdc, 0x66, 0xc6, 0xc6, 0x0c, 0x7e, 0x7e, + 0x60, 0xc6, 0x00, 0x18, 0x0c, 0x30, 0x18, 0x18, 0x18, 0x76, 0x00, + 0x00, 0x00, 0x0c, 0x36, 0x32, 0x7e, 0x00, 0x00, 0xc6, 0xc6, 0x00, + 0x60, 0x00, 0x00, 0x76, 0x3c, 0xc6, 0xc6, 0x18, 0x00, 0x06, 0x60, + 0xc6, 0xfe, 0x18, 0x18, 0x18, 0x1b, 0x18, 0x00, 0x00, 0x38, 0x00, + 0x00, 0x0c, 0x36, 0x18, 0x7e, 0x00, 0x00, 0xce, 0xc6, 0x00, 0xc6, + 0x00, 0x00, 0x00, 0x18, 0x6c, 0x6c, 0x30, 0x00, 0x03, 0x30, 0x7c, + 0x00, 0x00, 0x30, 0x0c, 0x1b, 0x18, 0x00, 0x00, 0x6c, 0x00, 0x00, + 0x0c, 0x36, 0x0c, 0x00, 0x00, 0x00, 0x7c, 0xfe, 0x00, 0xfe, 0x00, + 0x00, 0x00, 0x7e, 0x38, 0x38, 0x1e, 0x00, 0x00, 0x1c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0e, 0x18, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x0c, + 0x36, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0f, 0x6c, + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, + 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, + 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, + 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, + 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, + 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, + 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, + 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, + 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, + 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, + 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, + 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, + 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, + 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, + 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, + 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, + 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, + 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18, + 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, + 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, + 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, + 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, + 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, + 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x1f, 0xff, 0xff, 0x1f, 0xff, 0xff, + 0x1f, 0x37, 0x3f, 0x37, 0xff, 0xf7, 0x37, 0xff, 0xf7, 0xff, 0xff, + 0xff, 0xff, 0x3f, 0x1f, 0x1f, 0x3f, 0xff, 0xff, 0xf8, 0x1f, 0xff, + 0xff, 0xf0, 0x0f, 0x00, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, + 0x36, 0x30, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x36, 0x00, + 0x00, 0x36, 0x18, 0x18, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, + 0xf0, 0x0f, 0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x1f, 0x36, + 0x37, 0x3f, 0xf7, 0xff, 0x37, 0xff, 0xf7, 0xff, 0x36, 0xff, 0x00, + 0x36, 0x1f, 0x1f, 0x00, 0x36, 0xff, 0x18, 0x00, 0xff, 0x00, 0xf0, + 0x0f, 0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, + 0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, + 0x18, 0x00, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, + 0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00, + 0x36, 0x00, 0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18, + 0x00, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, + 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00, 0x36, + 0x00, 0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18, 0x00, + 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x18, + 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00, 0x36, 0x00, + 0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18, 0x00, 0x00, + 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x18, 0x18, + 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00, 0x36, 0x00, 0x36, + 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18, 0x00, 0x00, 0x36, + 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, + 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, + 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x06, 0x00, 0x00, 0x00, + 0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, + 0x36, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x06, 0x00, 0x00, 0x00, 0x11, + 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, + 0x00, 0x00, 0x00, 0x18, 0x76, 0x18, 0x7c, 0x78, 0x66, 0xc6, 0x00, + 0x00, 0x7c, 0x00, 0x00, 0x0c, 0x3f, 0x18, 0x00, 0x00, 0x44, 0xaa, + 0x77, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, + 0x00, 0x00, 0x18, 0xcc, 0x18, 0xc6, 0xcc, 0x66, 0xc6, 0x00, 0x00, + 0xc6, 0xc0, 0x06, 0x86, 0x9a, 0x3c, 0x00, 0x00, 0x11, 0x55, 0xdd, + 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, + 0x00, 0x18, 0xcc, 0x18, 0xc6, 0xcc, 0x66, 0xc6, 0x00, 0x00, 0xc6, + 0xc0, 0x06, 0xdc, 0xce, 0x3c, 0x36, 0xd8, 0x44, 0xaa, 0x77, 0x18, + 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, + 0x18, 0xcc, 0x18, 0xc6, 0xcc, 0x66, 0xce, 0x00, 0x00, 0xc0, 0xc0, + 0x06, 0x60, 0x66, 0x3c, 0x6c, 0x6c, 0x11, 0x55, 0xdd, 0x18, 0x18, + 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, + 0x7c, 0x18, 0xc6, 0xcc, 0x66, 0xde, 0x7e, 0x7c, 0x60, 0xc0, 0x06, + 0x30, 0x30, 0x18, 0xd8, 0x36, 0x44, 0xaa, 0x77, 0x18, 0xf8, 0xf8, + 0xf6, 0xfe, 0xf8, 0xf6, 0x36, 0xf6, 0xfe, 0xfe, 0xf8, 0xf8, 0x0c, + 0x18, 0xc6, 0xcc, 0x66, 0xfe, 0x00, 0x00, 0x30, 0xfe, 0xfe, 0x18, + 0x18, 0x18, 0x6c, 0x6c, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, + 0x00, 0x18, 0x06, 0x36, 0x06, 0x06, 0x36, 0x18, 0x00, 0x78, 0x38, + 0x7c, 0xcc, 0x5c, 0xf6, 0x3e, 0x38, 0x30, 0x00, 0x00, 0x6c, 0x6c, + 0x18, 0x36, 0xd8, 0x44, 0xaa, 0x77, 0x18, 0x18, 0xf8, 0x36, 0x00, + 0xf8, 0xf6, 0x36, 0xfe, 0xf6, 0x36, 0xf8, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xe6, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, + 0x00, 0x00, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, + 0x36, 0x36, 0x00, 0x36, 0x36, 0x18, 0x00, 0x60, 0x30, 0x60, 0x60, + 0xdc, 0xc6, 0x6c, 0x6c, 0x30, 0x00, 0x00, 0x62, 0x62, 0x18, 0x00, + 0x00, 0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36, + 0x36, 0x00, 0x36, 0x36, 0x18, 0x00, 0x30, 0x18, 0x30, 0x30, 0x76, + 0x00, 0x3c, 0x38, 0x30, 0x00, 0x00, 0xe0, 0xe0, 0x18, 0x00, 0x00, + 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36, 0x36, + 0x00, 0x36, 0x36, 0x18, 0x00, 0x18, 0x0c, 0x18, 0x18, 0x00, 0xdc, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x44, + 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36, 0x36, 0x00, + 0x36, 0x36, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x55, + 0xdd, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36, 0x36, 0x00, 0x36, + 0x36, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, + 0x78, 0x7c, 0x76, 0x76, 0x76, 0x76, 0x7c, 0x7c, 0x7c, 0x7c, 0x18, + 0x18, 0x18, 0xc6, 0xc6, 0xfc, 0x6e, 0xce, 0x7c, 0x7c, 0x7c, 0x78, + 0x78, 0x76, 0x7c, 0x7c, 0x18, 0xfe, 0x18, 0xc6, 0x70, 0x3c, 0xcc, + 0xc2, 0xcc, 0xcc, 0xcc, 0xcc, 0xc6, 0xc2, 0xc2, 0xc2, 0x18, 0x18, + 0x18, 0xc6, 0xc6, 0xc0, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, + 0xce, 0xc6, 0xc6, 0x18, 0x60, 0x7e, 0xcc, 0xd8, 0x66, 0xcc, 0xc0, + 0xcc, 0xcc, 0xcc, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0x18, 0x18, 0x18, + 0xc6, 0xc6, 0xc0, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, 0xc6, + 0xc6, 0xc6, 0x7c, 0x60, 0x18, 0xcc, 0x18, 0xc6, 0xcc, 0xc0, 0xcc, + 0xcc, 0xcc, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0x18, 0x18, 0x18, 0xfe, + 0xc6, 0xc0, 0x7e, 0xcc, 0xc6, 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 0xc6, + 0x30, 0x66, 0x3c, 0x30, 0x00, 0x38, 0x00, 0x00, 0x3e, 0x38, 0xc6, + 0x30, 0x78, 0x30, 0xc6, 0x00, 0x00, 0x18, 0x3c, 0x66, 0xcc, 0x1b, + 0x00, 0x00, 0x0c, 0x10, 0x00, 0x60, 0x38, 0x00, 0x10, 0x00, 0x60, + 0x00, 0x18, 0x60, 0xc6, 0x6c, 0x30, 0x00, 0x00, 0x10, 0x00, 0x60, + 0x30, 0x60, 0x00, 0xc6, 0xc6, 0x18, 0x00, 0x00, 0xf8, 0x0e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x38, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xc0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x00, 0x00, 0xcc, 0x00, 0x00, 0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xcc, 0xc4, 0xcc, 0xc6, 0x78, 0xcc, 0xec, 0x18, 0x0c, + 0xd8, 0x18, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xec, 0xc2, 0x30, 0xcc, + 0xc6, 0xc6, 0x6c, 0xc6, 0x0c, 0x70, 0x18, 0x0e, 0x00, 0x6c, 0x00, + 0x78, 0xf8, 0x78, 0x7c, 0x7c, 0x30, 0x7c, 0xd8, 0x38, 0x0c, 0xcc, + 0x18, 0xec, 0xb8, 0x78, 0xf8, 0x7c, 0xb8, 0x7c, 0xfc, 0xcc, 0xc6, + 0xc6, 0xc6, 0xc6, 0xfe, 0x18, 0x18, 0x18, 0x00, 0x38, 0x00, 0x00, + 0xc0, 0x00, 0x0c, 0x00, 0x32, 0x00, 0xc0, 0x00, 0x00, 0xc0, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x00, 0x10, 0x0c, 0x00, 0xc0, + 0x00, 0x0c, 0x00, 0x36, 0x00, 0xc0, 0x18, 0x0c, 0xc0, 0x18, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x00, 0xc0, 0x00, + 0x0c, 0x00, 0x1c, 0x00, 0xc0, 0x18, 0x0c, 0xc0, 0x38, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0e, 0x18, 0x70, 0xdc, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7c, 0xc6, 0xfc, 0x3c, 0xf8, 0xfc, 0xc0, 0x3e, 0xc6, 0x18, 0x78, + 0xc2, 0xfc, 0xc6, 0xc6, 0x7c, 0xc0, 0x7c, 0xc6, 0x7c, 0x18, 0x7c, + 0x10, 0x6c, 0xc6, 0x18, 0xfe, 0x3c, 0x02, 0x3c, 0x00, 0x00, 0xc0, + 0xc6, 0xc6, 0x66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 0xc6, 0xc6, 0xc6, 0x7c, 0x66, 0x0c, 0x30, + 0xe0, 0x0c, 0x00, 0x00, 0xc6, 0x6c, 0xc6, 0xc2, 0xce, 0xc0, 0xc0, + 0xc0, 0xc6, 0x18, 0x0c, 0xcc, 0xc0, 0xfe, 0xf6, 0xc6, 0xc6, 0xc6, + 0xc6, 0xc0, 0x18, 0xc6, 0xc6, 0xc6, 0x6c, 0x66, 0x06, 0x30, 0xc0, + 0x0c, 0x00, 0x00, 0x7c, 0x38, 0xc6, 0x66, 0xdc, 0xc0, 0xc0, 0x62, + 0xc6, 0x18, 0x0c, 0xc6, 0xc0, 0xee, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, + 0xc2, 0x7e, 0xc6, 0xc6, 0xc6, 0xc6, 0x66, 0x06, 0x30, 0x80, 0x0c, + 0xc6, 0x00, 0x00, 0x10, 0xfc, 0x3c, 0xf8, 0xfc, 0xfc, 0x3c, 0xc6, + 0x18, 0x1e, 0xc2, 0xc0, 0xc6, 0xc6, 0x7c, 0xfc, 0x7c, 0xfc, 0x7c, + 0x7e, 0xc6, 0xc6, 0xc6, 0xc6, 0x66, 0xfe, 0x3c, 0x00, 0x3c, 0x6c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6c, 0x7c, + 0x86, 0x76, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x18, 0x00, 0x18, 0x80, + 0x38, 0x18, 0xfe, 0x7c, 0x0c, 0x7c, 0x7c, 0x30, 0x7c, 0x78, 0x00, + 0x30, 0x06, 0x00, 0x60, 0x18, 0x00, 0x18, 0x00, 0x6c, 0xc6, 0xc6, + 0xcc, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x00, 0x18, 0xc0, 0x6c, + 0x18, 0xc0, 0x86, 0x0c, 0x86, 0xc6, 0x30, 0xc6, 0x8c, 0x18, 0x18, + 0x0c, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0xfe, 0x86, 0x60, 0xcc, + 0x00, 0x30, 0x0c, 0x66, 0x18, 0x18, 0x00, 0x00, 0x60, 0xc6, 0x18, + 0xc0, 0x06, 0x0c, 0x06, 0xc6, 0x30, 0xc6, 0x06, 0x18, 0x18, 0x18, + 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x6c, 0x06, 0x30, 0xcc, 0x00, + 0x30, 0x0c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x30, 0xe6, 0x18, 0x60, + 0x06, 0x0c, 0x06, 0xc6, 0x30, 0xc6, 0x06, 0x00, 0x00, 0x30, 0x7e, + 0x0c, 0x18, 0x00, 0x18, 0x00, 0x6c, 0x06, 0x18, 0xdc, 0x00, 0x30, + 0x0c, 0xff, 0x7e, 0x00, 0xfe, 0x00, 0x18, 0xf6, 0x18, 0x30, 0x06, + 0xfe, 0x06, 0xe6, 0x18, 0xc6, 0x06, 0x00, 0x00, 0x60, 0x00, 0x06, + 0x18, 0x00, 0x18, 0x00, 0x6c, 0x7c, 0x0c, 0x76, 0x00, 0x30, 0x0c, + 0x3c, 0x18, 0x00, 0x00, 0x00, 0x0c, 0xde, 0x18, 0x18, 0x3c, 0xcc, + 0xfc, 0xdc, 0x0c, 0x7c, 0x7e, 0x00, 0x00, 0x30, 0x00, 0x0c, 0x18, + 0x00, 0x3c, 0x00, 0xfe, 0xc0, 0xc6, 0x38, 0x00, 0x30, 0x0c, 0x66, + 0x18, 0x00, 0x00, 0x00, 0x06, 0xce, 0x18, 0x0c, 0x06, 0x6c, 0xc0, + 0xc0, 0x06, 0xc6, 0xc6, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x0c, 0x00, + 0x3c, 0x24, 0x6c, 0xc2, 0xc2, 0x6c, 0x60, 0x30, 0x0c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x02, 0xc6, 0x78, 0x06, 0x06, 0x3c, 0xc0, 0xc0, + 0x06, 0xc6, 0xc6, 0x18, 0x18, 0x0c, 0x00, 0x30, 0xc6, 0x00, 0x3c, + 0x66, 0x6c, 0xc6, 0x00, 0x6c, 0x30, 0x18, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x6c, 0x38, 0xc6, 0x86, 0x1c, 0xc0, 0x60, 0x06, + 0xc6, 0xc6, 0x00, 0x00, 0x06, 0x00, 0x60, 0xc6, 0x00, 0x18, 0x66, + 0x00, 0x7c, 0x00, 0x38, 0x30, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x38, 0x18, 0x7c, 0x7c, 0x0c, 0xfe, 0x3c, 0xfe, 0x7c, + 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x66, 0x00, + 0x18, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, + 0x00, 0xff, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7e, 0x7e, 0x10, 0x00, 0x3c, 0x3c, 0x00, 0xff, 0x00, + 0xff, 0x78, 0x18, 0xe0, 0xe6, 0x18, 0x80, 0x02, 0x00, 0x66, 0x1b, + 0xc6, 0xfe, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x81, 0xff, 0x38, 0x10, 0x18, 0x18, 0x00, 0xff, 0x3c, 0xc3, + 0xcc, 0x18, 0xf0, 0xe7, 0x18, 0xc0, 0x06, 0x18, 0x66, 0x1b, 0x0c, + 0xfe, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x10, 0x00, + 0x81, 0xff, 0x7c, 0x38, 0x18, 0x18, 0x18, 0xe7, 0x66, 0x99, 0xcc, + 0x7e, 0x70, 0x67, 0xdb, 0xe0, 0x0e, 0x3c, 0x00, 0x1b, 0x38, 0xfe, + 0x3c, 0x18, 0x7e, 0x18, 0x30, 0xfe, 0x28, 0xfe, 0x38, 0x00, 0x99, + 0xe7, 0xfe, 0x7c, 0xe7, 0x7e, 0x3c, 0xc3, 0x42, 0xbd, 0xcc, 0x18, + 0x30, 0x63, 0x3c, 0xf0, 0x1e, 0x7e, 0x66, 0x1b, 0x6c, 0xfe, 0x7e, + 0x18, 0x18, 0x0c, 0x60, 0xc0, 0x6c, 0x7c, 0x38, 0x00, 0xbd, 0xc3, + 0xfe, 0xfe, 0xe7, 0xff, 0x3c, 0xc3, 0x42, 0xbd, 0xcc, 0x3c, 0x30, + 0x63, 0xe7, 0xf8, 0x3e, 0x18, 0x66, 0x1b, 0xc6, 0x00, 0x18, 0x18, + 0x18, 0xfe, 0xfe, 0xc0, 0xfe, 0x7c, 0x7c, 0x00, 0x81, 0xff, 0xfe, + 0x7c, 0xe7, 0xff, 0x18, 0xe7, 0x66, 0x99, 0x78, 0x66, 0x30, 0x63, + 0x3c, 0xfe, 0xfe, 0x18, 0x66, 0x7b, 0xc6, 0x00, 0x18, 0x18, 0x18, + 0x0c, 0x60, 0xc0, 0x6c, 0x38, 0x7c, 0x00, 0x81, 0xff, 0xfe, 0x38, + 0x3c, 0x7e, 0x00, 0xff, 0x3c, 0xc3, 0x32, 0x66, 0x30, 0x63, 0xdb, + 0xf8, 0x3e, 0x18, 0x66, 0xdb, 0x6c, 0x00, 0x18, 0x18, 0x18, 0x18, + 0x30, 0x00, 0x28, 0x38, 0xfe, 0x00, 0xa5, 0xdb, 0x6c, 0x10, 0x3c, + 0x3c, 0x00, 0xff, 0x00, 0xff, 0x1a, 0x66, 0x3f, 0x7f, 0x18, 0xf0, + 0x1e, 0x7e, 0x66, 0xdb, 0x38, 0x00, 0x7e, 0x7e, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x10, 0xfe, 0x00, 0x81, 0xff, 0x00, 0x00, 0x18, 0x18, + 0x00, 0xff, 0x00, 0xff, 0x0e, 0x66, 0x33, 0x63, 0x18, 0xe0, 0x0e, + 0x3c, 0x66, 0xdb, 0x60, 0x00, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0x00, 0xff, 0x1e, 0x3c, 0x3f, 0x7f, 0x00, 0xc0, 0x06, 0x18, + 0x66, 0x7f, 0xc6, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, + 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, + 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; diff --git a/vendor/pdcurses/common/icon32.xpm b/vendor/pdcurses/common/icon32.xpm new file mode 100644 index 0000000..24f64e4 --- /dev/null +++ b/vendor/pdcurses/common/icon32.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static char *icon32[] = { +/* width height ncolors chars_per_pixel */ +"32 32 3 1", +/* colors */ +" c #000", +". c #FFF", +"X c None", +/* pixels */ +"................................", +"................................", +"................................", +".......... .... ..........", +".......... ... ..........", +".......... ... .. ..........", +".......... .... .. ..........", +".......... .... .. ..........", +".......... ... .. ..........", +".......... .. .. ..........", +".......... . .. ..........", +".......... .. ..........", +".......... .. . ..........", +".......... .. .. ..........", +".......... .. ... ..........", +".......... .. .... ..........", +".......... .. .... ..........", +".......... .. ... ..........", +".......... ... ..........", +".......... .... ..........", +"................................", +"................................", +".. .. .. . . ... ... ... ...", +". .. . .. . . . .. . .. . .. ..", +". .... .. . .... .... .. . .....", +". .... .. . ..... .. ... ...", +". .... .. . ....... . ....... ..", +". .. . .. . .... .. . .. . .. ..", +".. ... .. ..... ... ... ...", +"................................", +"................................", +"................................" +}; diff --git a/vendor/pdcurses/common/icon64.xpm b/vendor/pdcurses/common/icon64.xpm new file mode 100644 index 0000000..55e8b59 --- /dev/null +++ b/vendor/pdcurses/common/icon64.xpm @@ -0,0 +1,74 @@ +/* XPM */ +static char *icon64[] = { +/* width height ncolors chars_per_pixel */ +"64 64 3 1", +/* colors */ +" c #000", +". c #FFF", +"X c None", +/* pixels */ +"................................................................", +"................................................................", +"................................................................", +"................................................................", +"................................................................", +"................................................................", +"................................................................", +".................... ...... ......................", +".................... ..... ......................", +".................... .... ......................", +".................... .... ......................", +".................... ...... ... ......................", +".................... ....... ... ......................", +".................... ....... ... ......................", +".................... ....... ... ......................", +".................... ....... ... ......................", +".................... ...... ... ......................", +".................... ..... .... ......................", +".................... .... ... ......................", +".................... ... ... ......................", +".................... .. ... ......................", +".................... . ... ......................", +".................... ... ......................", +".................... ... ......................", +".................... ... . ......................", +".................... ... .. ......................", +".................... ... ... ......................", +".................... ... .... ......................", +".................... .... ..... ......................", +".................... ... ...... ......................", +".................... ... ....... ......................", +".................... ... ....... ......................", +".................... ... ....... ......................", +".................... ... ....... ......................", +".................... ... ...... ......................", +".................... .... ......................", +".................... .... ......................", +".................... ..... ......................", +".................... ...... ......................", +"................................................................", +"................................................................", +"................................................................", +"................................................................", +"...... ... ...... . .. ..... ..... ..... ......", +"..... .. .. ...... . . .. ... ... ... .. ... ... .....", +".... .... . ...... . .... . ..... . .... . ..... ....", +".... ...... . ...... . ...... . ....... . ...... . ....... ....", +".... ........ ...... . ......... ....... . ...... . ....... ....", +".... ........ ...... . ......... ........ ...... . ...........", +".... ........ ...... . .......... ....... ...... .. ..........", +".... ........ ...... . ........... ... ... ......", +".... ........ ...... . ............... .. .............. .....", +".... ........ ...... . ................ . ............... ....", +".... ........ ...... . ......... ....... . ...... . ....... ....", +".... ...... . ...... . ......... ....... . ...... . ....... ....", +".... .... . .... . ......... ..... . .... . ..... ....", +"..... .. ... .. .. .......... ... ... .. ... ... .....", +"...... ..... ... ........... ..... ..... ......", +"................................................................", +"................................................................", +"................................................................", +"................................................................", +"................................................................", +"................................................................" +}; diff --git a/vendor/pdcurses/common/iconbmp.h b/vendor/pdcurses/common/iconbmp.h new file mode 100644 index 0000000..51f6cb1 --- /dev/null +++ b/vendor/pdcurses/common/iconbmp.h @@ -0,0 +1,24 @@ +/* The PDCurses logo as #include'able BMP (from icon32.xpm), + for use by SDL. */ + +unsigned char iconbmp[] = +{ + 0x42, 0x4d, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, + 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x13, 0x0b, + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xce, 0x6f, 0x9c, + 0xe7, 0xb5, 0xaf, 0x6b, 0x5b, 0xbd, 0xaf, 0xeb, 0xfb, 0xbd, 0xaf, + 0x98, 0xe7, 0xbd, 0xaf, 0x7b, 0x5f, 0xb5, 0xa5, 0x6b, 0x5b, 0xcd, + 0xab, 0x9c, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xcf, 0x03, 0xff, 0xff, 0xce, 0x03, 0xff, 0xff, 0xcc, 0x73, + 0xff, 0xff, 0xcc, 0xf3, 0xff, 0xff, 0xcc, 0xf3, 0xff, 0xff, 0xcc, + 0x73, 0xff, 0xff, 0xc6, 0x33, 0xff, 0xff, 0xc3, 0x13, 0xff, 0xff, + 0xc1, 0x83, 0xff, 0xff, 0xc8, 0xc3, 0xff, 0xff, 0xcc, 0x63, 0xff, + 0xff, 0xce, 0x33, 0xff, 0xff, 0xcf, 0x33, 0xff, 0xff, 0xcf, 0x33, + 0xff, 0xff, 0xce, 0x33, 0xff, 0xff, 0xc0, 0x73, 0xff, 0xff, 0xc0, + 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff +}; diff --git a/vendor/pdcurses/common/libobjs.mif b/vendor/pdcurses/common/libobjs.mif new file mode 100644 index 0000000..a8f9dc6 --- /dev/null +++ b/vendor/pdcurses/common/libobjs.mif @@ -0,0 +1,24 @@ +# Common elements for most of the DOS, OS/2 and Windows +# makefiles (not Watcom) + +PDCURSES_CURSES_H = $(PDCURSES_SRCDIR)/curses.h +PDCURSES_CURSPRIV_H = $(PDCURSES_SRCDIR)/curspriv.h +PDCURSES_HEADERS = $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H) +PANEL_HEADER = $(PDCURSES_SRCDIR)/panel.h + +srcdir = $(PDCURSES_SRCDIR)/pdcurses +demodir = $(PDCURSES_SRCDIR)/demos + +LIBOBJS = addch.$(O) addchstr.$(O) addstr.$(O) attr.$(O) beep.$(O) \ +bkgd.$(O) border.$(O) clear.$(O) color.$(O) delch.$(O) deleteln.$(O) \ +getch.$(O) getstr.$(O) getyx.$(O) inch.$(O) inchstr.$(O) \ +initscr.$(O) inopts.$(O) insch.$(O) insstr.$(O) instr.$(O) kernel.$(O) \ +keyname.$(O) mouse.$(O) move.$(O) outopts.$(O) overlay.$(O) pad.$(O) \ +panel.$(O) printw.$(O) refresh.$(O) scanw.$(O) scr_dump.$(O) scroll.$(O) \ +slk.$(O) termattr.$(O) touch.$(O) util.$(O) window.$(O) debug.$(O) + +PDCOBJS = pdcclip.$(O) pdcdisp.$(O) pdcgetsc.$(O) pdckbd.$(O) pdcscrn.$(O) \ +pdcsetsc.$(O) pdcutil.$(O) + +DEMOS = testcurs$(E) ozdemo$(E) xmas$(E) tuidemo$(E) firework$(E) \ +ptest$(E) rain$(E) worm$(E) diff --git a/vendor/pdcurses/common/pdcurses.rc b/vendor/pdcurses/common/pdcurses.rc new file mode 100644 index 0000000..53d4754 --- /dev/null +++ b/vendor/pdcurses/common/pdcurses.rc @@ -0,0 +1,35 @@ +#include +#include "../curses.h" + +VS_VERSION_INFO VERSIONINFO +FILEVERSION PDC_VER_MAJOR,PDC_VER_MINOR,0,0 +PRODUCTVERSION PDC_VER_MAJOR,PDC_VER_MINOR,0,0 +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG | VS_FF_PRERELEASE +#else + FILEFLAGS 0 +#endif +FILEOS VOS_NT_WINDOWS32 +FILETYPE VFT_DLL +FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "04090000" + BEGIN + VALUE "CompanyName", "PDCurses.org" + VALUE "FileDescription", "PDCurses Library" + VALUE "FileVersion", PDC_VERDOT ".0.0" + VALUE "InternalName", "PDCurses" + VALUE "LegalCopyright", "Public Domain" + VALUE "OriginalFilename", "pdcurses.dll" + VALUE "ProductName", "PDCurses" + VALUE "ProductVersion", PDC_VERDOT ".0.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 0 + END +END diff --git a/vendor/pdcurses/common/watcom.mif b/vendor/pdcurses/common/watcom.mif new file mode 100644 index 0000000..72b6b52 --- /dev/null +++ b/vendor/pdcurses/common/watcom.mif @@ -0,0 +1,72 @@ +# Common elements for the Watcom makefiles + +CFLAGS += -wx -zq -i=$(PDCURSES_SRCDIR) + +!ifeq DEBUG Y +CFLAGS += -d2 -DPDCDEBUG +LDFLAGS = D W A op q sys $(TARGET) +!else +CFLAGS += -oneatx -wcd=303 +LDFLAGS = op q sys $(TARGET) +!endif + +RM = rm +LIBEXE = wlib -q -n -b -c -t + +srcdir = $(PDCURSES_SRCDIR)/pdcurses +demodir = $(PDCURSES_SRCDIR)/demos + +LIBOBJS = addch.o addchstr.o addstr.o attr.o beep.o bkgd.o & +border.o clear.o color.o delch.o deleteln.o & +getch.o getstr.o getyx.o inch.o inchstr.o initscr.o inopts.o & +insch.o insstr.o instr.o kernel.o keyname.o mouse.o move.o & +outopts.o overlay.o pad.o panel.o printw.o refresh.o & +scanw.o scr_dump.o scroll.o slk.o termattr.o & +touch.o util.o window.o debug.o + +PDCOBJS = pdcclip.o pdcdisp.o pdcgetsc.o pdckbd.o pdcscrn.o & +pdcsetsc.o pdcutil.o + +DEMOS = testcurs.exe ozdemo.exe xmas.exe tuidemo.exe firework.exe & +ptest.exe rain.exe worm.exe + +LIBCURSES = pdcurses.lib + +LINK = wlink + +!ifdef __LOADDLL__ +! loaddll wcc wccd +! loaddll wcc386 wccd386 +! loaddll wlink wlinkd +! loaddll wlib wlibd +!endif + +all: $(LIBCURSES) + +clean + -$(RM) *.o + -$(RM) *.lib + -$(RM) *.exe + -$(RM) *.err + +demos: $(DEMOS) + +.c: $(srcdir);$(osdir);$(demodir) +.c.o: .autodepend + $(CC) $(CFLAGS) $< + +.o.exe: + $(LINK) $(LDFLAGS) n $@ f $*.o l $(LIBCURSES) + +testcurs.exe: testcurs.o $(LIBCURSES) +ozdemo.exe: ozdemo.o $(LIBCURSES) +xmas.exe: xmas.o $(LIBCURSES) +firework.exe: firework.o $(LIBCURSES) +rain.exe: rain.o $(LIBCURSES) +worm.exe: worm.o $(LIBCURSES) +ptest.exe: ptest.o $(LIBCURSES) + +tuidemo.exe: tuidemo.o tui.o $(LIBCURSES) + $(LINK) $(LDFLAGS) n $@ f tuidemo.o f tui.o l $(LIBCURSES) + +dist: .symbolic diff --git a/vendor/pdcurses/curses.h b/vendor/pdcurses/curses.h new file mode 100644 index 0000000..f58fe66 --- /dev/null +++ b/vendor/pdcurses/curses.h @@ -0,0 +1,1441 @@ +/*----------------------------------------------------------------------* + * PDCurses * + *----------------------------------------------------------------------*/ + +#ifndef __PDCURSES__ +#define __PDCURSES__ 1 + +/*man-start************************************************************** + +Define before inclusion (only those needed): + + Macro | Meaning / value + :-------------|------------------------------------------------- + XCURSES | if building / built for X11 + PDC_RGB | RGB color (Red = 1, Green = 2, Blue = 4) vs. BGR + PDC_WIDE | if building / built with wide-character support + PDC_DLL_BUILD | if building / built as a Windows DLL + PDC_NCMOUSE | use ncurses mouse API vs. traditional PDCurses + +Defined by this header: + + Macro | Meaning / value + :-------------|------------------------------------------------- + PDCURSES | PDCurses-only features are available + PDC_BUILD | API build version + PDC_VER_MAJOR | major version number + PDC_VER_MINOR | minor version number + PDC_VERDOT | version string + +**man-end****************************************************************/ + +#define PDCURSES 1 +#define PDC_BUILD 3908 +#define PDC_VER_MAJOR 3 +#define PDC_VER_MINOR 9 +#define PDC_VERDOT "3.9" + +#define CHTYPE_LONG 1 /* chtype >= 32 bits */ + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +# define PDC_99 1 +#endif + +#if defined(__cplusplus) && __cplusplus >= 199711L +# define PDC_PP98 1 +#endif + +/*----------------------------------------------------------------------*/ + +#include +#include +#include + +#ifdef PDC_WIDE +# include +#endif + +#if defined(PDC_99) && !defined(__bool_true_false_are_defined) +# include +#endif + +#ifdef __cplusplus +extern "C" +{ +# ifndef PDC_PP98 +# define bool _bool +# endif +#endif + +/*---------------------------------------------------------------------- + * + * Constants and Types + * + */ + +#undef FALSE +#define FALSE 0 + +#undef TRUE +#define TRUE 1 + +#undef ERR +#define ERR (-1) + +#undef OK +#define OK 0 + +#if !defined(PDC_PP98) && !defined(__bool_true_false_are_defined) +typedef unsigned char bool; +#endif + +#if _LP64 +typedef unsigned int chtype; +#else +typedef unsigned long chtype; /* 16-bit attr + 16-bit char */ +#endif + +#ifdef PDC_WIDE +typedef chtype cchar_t; +#endif + +typedef chtype attr_t; + +/*---------------------------------------------------------------------- + * + * Version Info + * + */ + +/* Use this structure with PDC_get_version() for run-time info about the + way the library was built, in case it doesn't match the header. */ + +typedef struct +{ + short flags; /* flags OR'd together (see below) */ + short build; /* PDC_BUILD at compile time */ + unsigned char major; /* PDC_VER_MAJOR */ + unsigned char minor; /* PDC_VER_MINOR */ + unsigned char csize; /* sizeof chtype */ + unsigned char bsize; /* sizeof bool */ +} PDC_VERSION; + +enum +{ + PDC_VFLAG_DEBUG = 1, /* set if built with -DPDCDEBUG */ + PDC_VFLAG_WIDE = 2, /* -DPDC_WIDE */ + PDC_VFLAG_UTF8 = 4, /* -DPDC_FORCE_UTF8 */ + PDC_VFLAG_DLL = 8, /* -DPDC_DLL_BUILD */ + PDC_VFLAG_RGB = 16 /* -DPDC_RGB */ +}; + +/*---------------------------------------------------------------------- + * + * Mouse Interface + * + */ + +#if _LP64 +typedef unsigned int mmask_t; +#else +typedef unsigned long mmask_t; +#endif + +typedef struct +{ + int x; /* absolute column, 0 based, measured in characters */ + int y; /* absolute row, 0 based, measured in characters */ + short button[3]; /* state of each button */ + int changes; /* flags indicating what has changed with the mouse */ +} MOUSE_STATUS; + +#define BUTTON_RELEASED 0x0000 +#define BUTTON_PRESSED 0x0001 +#define BUTTON_CLICKED 0x0002 +#define BUTTON_DOUBLE_CLICKED 0x0003 +#define BUTTON_TRIPLE_CLICKED 0x0004 +#define BUTTON_MOVED 0x0005 /* PDCurses */ +#define WHEEL_SCROLLED 0x0006 /* PDCurses */ +#define BUTTON_ACTION_MASK 0x0007 /* PDCurses */ + +#define PDC_BUTTON_SHIFT 0x0008 /* PDCurses */ +#define PDC_BUTTON_CONTROL 0x0010 /* PDCurses */ +#define PDC_BUTTON_ALT 0x0020 /* PDCurses */ +#define BUTTON_MODIFIER_MASK 0x0038 /* PDCurses */ + +#define MOUSE_X_POS (Mouse_status.x) +#define MOUSE_Y_POS (Mouse_status.y) + +/* + * Bits associated with the .changes field: + * 3 2 1 0 + * 210987654321098765432109876543210 + * 1 <- button 1 has changed + * 10 <- button 2 has changed + * 100 <- button 3 has changed + * 1000 <- mouse has moved + * 10000 <- mouse position report + * 100000 <- mouse wheel up + * 1000000 <- mouse wheel down + * 10000000 <- mouse wheel left + * 100000000 <- mouse wheel right + */ + +#define PDC_MOUSE_MOVED 0x0008 +#define PDC_MOUSE_POSITION 0x0010 +#define PDC_MOUSE_WHEEL_UP 0x0020 +#define PDC_MOUSE_WHEEL_DOWN 0x0040 +#define PDC_MOUSE_WHEEL_LEFT 0x0080 +#define PDC_MOUSE_WHEEL_RIGHT 0x0100 + +#define A_BUTTON_CHANGED (Mouse_status.changes & 7) +#define MOUSE_MOVED (Mouse_status.changes & PDC_MOUSE_MOVED) +#define MOUSE_POS_REPORT (Mouse_status.changes & PDC_MOUSE_POSITION) +#define BUTTON_CHANGED(x) (Mouse_status.changes & (1 << ((x) - 1))) +#define BUTTON_STATUS(x) (Mouse_status.button[(x) - 1]) +#define MOUSE_WHEEL_UP (Mouse_status.changes & PDC_MOUSE_WHEEL_UP) +#define MOUSE_WHEEL_DOWN (Mouse_status.changes & PDC_MOUSE_WHEEL_DOWN) +#define MOUSE_WHEEL_LEFT (Mouse_status.changes & PDC_MOUSE_WHEEL_LEFT) +#define MOUSE_WHEEL_RIGHT (Mouse_status.changes & PDC_MOUSE_WHEEL_RIGHT) + +/* mouse bit-masks */ + +#define BUTTON1_RELEASED 0x00000001L +#define BUTTON1_PRESSED 0x00000002L +#define BUTTON1_CLICKED 0x00000004L +#define BUTTON1_DOUBLE_CLICKED 0x00000008L +#define BUTTON1_TRIPLE_CLICKED 0x00000010L +#define BUTTON1_MOVED 0x00000010L /* PDCurses */ + +#define BUTTON2_RELEASED 0x00000020L +#define BUTTON2_PRESSED 0x00000040L +#define BUTTON2_CLICKED 0x00000080L +#define BUTTON2_DOUBLE_CLICKED 0x00000100L +#define BUTTON2_TRIPLE_CLICKED 0x00000200L +#define BUTTON2_MOVED 0x00000200L /* PDCurses */ + +#define BUTTON3_RELEASED 0x00000400L +#define BUTTON3_PRESSED 0x00000800L +#define BUTTON3_CLICKED 0x00001000L +#define BUTTON3_DOUBLE_CLICKED 0x00002000L +#define BUTTON3_TRIPLE_CLICKED 0x00004000L +#define BUTTON3_MOVED 0x00004000L /* PDCurses */ + +/* For the ncurses-compatible functions only, BUTTON4_PRESSED and + BUTTON5_PRESSED are returned for mouse scroll wheel up and down; + otherwise PDCurses doesn't support buttons 4 and 5 */ + +#define BUTTON4_RELEASED 0x00008000L +#define BUTTON4_PRESSED 0x00010000L +#define BUTTON4_CLICKED 0x00020000L +#define BUTTON4_DOUBLE_CLICKED 0x00040000L +#define BUTTON4_TRIPLE_CLICKED 0x00080000L + +#define BUTTON5_RELEASED 0x00100000L +#define BUTTON5_PRESSED 0x00200000L +#define BUTTON5_CLICKED 0x00400000L +#define BUTTON5_DOUBLE_CLICKED 0x00800000L +#define BUTTON5_TRIPLE_CLICKED 0x01000000L + +#define MOUSE_WHEEL_SCROLL 0x02000000L /* PDCurses */ +#define BUTTON_MODIFIER_SHIFT 0x04000000L /* PDCurses */ +#define BUTTON_MODIFIER_CONTROL 0x08000000L /* PDCurses */ +#define BUTTON_MODIFIER_ALT 0x10000000L /* PDCurses */ + +#define ALL_MOUSE_EVENTS 0x1fffffffL +#define REPORT_MOUSE_POSITION 0x20000000L + +/* ncurses mouse interface */ + +typedef struct +{ + short id; /* unused, always 0 */ + int x, y, z; /* x, y same as MOUSE_STATUS; z unused */ + mmask_t bstate; /* equivalent to changes + button[], but + in the same format as used for mousemask() */ +} MEVENT; + +#if defined(PDC_NCMOUSE) && !defined(NCURSES_MOUSE_VERSION) +# define NCURSES_MOUSE_VERSION 2 +#endif + +#ifdef NCURSES_MOUSE_VERSION +# define BUTTON_SHIFT BUTTON_MODIFIER_SHIFT +# define BUTTON_CONTROL BUTTON_MODIFIER_CONTROL +# define BUTTON_CTRL BUTTON_MODIFIER_CONTROL +# define BUTTON_ALT BUTTON_MODIFIER_ALT +#else +# define BUTTON_SHIFT PDC_BUTTON_SHIFT +# define BUTTON_CONTROL PDC_BUTTON_CONTROL +# define BUTTON_ALT PDC_BUTTON_ALT +#endif + +/*---------------------------------------------------------------------- + * + * Window and Screen Structures + * + */ + +typedef struct _win /* definition of a window */ +{ + int _cury; /* current pseudo-cursor */ + int _curx; + int _maxy; /* max window coordinates */ + int _maxx; + int _begy; /* origin on screen */ + int _begx; + int _flags; /* window properties */ + chtype _attrs; /* standard attributes and colors */ + chtype _bkgd; /* background, normally blank */ + bool _clear; /* causes clear at next refresh */ + bool _leaveit; /* leaves cursor where it is */ + bool _scroll; /* allows window scrolling */ + bool _nodelay; /* input character wait flag */ + bool _immed; /* immediate update flag */ + bool _sync; /* synchronise window ancestors */ + bool _use_keypad; /* flags keypad key mode active */ + chtype **_y; /* pointer to line pointer array */ + int *_firstch; /* first changed character in line */ + int *_lastch; /* last changed character in line */ + int _tmarg; /* top of scrolling region */ + int _bmarg; /* bottom of scrolling region */ + int _delayms; /* milliseconds of delay for getch() */ + int _parx, _pary; /* coords relative to parent (0,0) */ + struct _win *_parent; /* subwin's pointer to parent win */ + + /* these are used only if this is a pad */ + struct pdat + { + int _pad_y; + int _pad_x; + int _pad_top; + int _pad_left; + int _pad_bottom; + int _pad_right; + } _pad; /* Pad-properties structure */ +} WINDOW; + +/* Color pair structure */ + +typedef struct +{ + short f; /* foreground color */ + short b; /* background color */ + int count; /* allocation order */ + bool set; /* pair has been set */ +} PDC_PAIR; + +/* Avoid using the SCREEN struct directly -- use the corresponding + functions if possible. This struct may eventually be made private. */ + +typedef struct +{ + bool alive; /* if initscr() called, and not endwin() */ + bool autocr; /* if cr -> lf */ + bool cbreak; /* if terminal unbuffered */ + bool echo; /* if terminal echo */ + bool raw_inp; /* raw input mode (v. cooked input) */ + bool raw_out; /* raw output mode (7 v. 8 bits) */ + bool audible; /* FALSE if the bell is visual */ + bool mono; /* TRUE if current screen is mono */ + bool resized; /* TRUE if TERM has been resized */ + bool orig_attr; /* TRUE if we have the original colors */ + short orig_fore; /* original screen foreground color */ + short orig_back; /* original screen foreground color */ + int cursrow; /* position of physical cursor */ + int curscol; /* position of physical cursor */ + int visibility; /* visibility of cursor */ + int orig_cursor; /* original cursor size */ + int lines; /* new value for LINES */ + int cols; /* new value for COLS */ + mmask_t _trap_mbe; /* trap these mouse button events */ + int mouse_wait; /* time to wait (in ms) for a + button release after a press, in + order to count it as a click */ + int slklines; /* lines in use by slk_init() */ + WINDOW *slk_winptr; /* window for slk */ + int linesrippedoff; /* lines ripped off via ripoffline() */ + int linesrippedoffontop; /* lines ripped off on + top via ripoffline() */ + int delaytenths; /* 1/10ths second to wait block + getch() for */ + bool _preserve; /* TRUE if screen background + to be preserved */ + int _restore; /* specifies if screen background + to be restored, and how */ + unsigned long key_modifiers; /* key modifiers (SHIFT, CONTROL, etc.) + on last key press */ + bool return_key_modifiers; /* TRUE if modifier keys are + returned as "real" keys */ + bool key_code; /* TRUE if last key is a special key; + used internally by get_wch() */ + MOUSE_STATUS mouse_status; /* last returned mouse status */ + short line_color; /* color of line attributes - default -1 */ + attr_t termattrs; /* attribute capabilities */ + WINDOW *lastscr; /* the last screen image */ + FILE *dbfp; /* debug trace file pointer */ + bool color_started; /* TRUE after start_color() */ + bool dirty; /* redraw on napms() after init_color() */ + int sel_start; /* start of selection (y * COLS + x) */ + int sel_end; /* end of selection */ + int *c_buffer; /* character buffer */ + int c_pindex; /* putter index */ + int c_gindex; /* getter index */ + int *c_ungch; /* array of ungotten chars */ + int c_ungind; /* ungetch() push index */ + int c_ungmax; /* allocated size of ungetch() buffer */ + PDC_PAIR *atrtab; /* table of color pairs */ +} SCREEN; + +/*---------------------------------------------------------------------- + * + * External Variables + * + */ + +#ifdef PDC_DLL_BUILD +# ifdef CURSES_LIBRARY +# define PDCEX __declspec(dllexport) extern +# else +# define PDCEX __declspec(dllimport) +# endif +#else +# define PDCEX extern +#endif + +PDCEX int LINES; /* terminal height */ +PDCEX int COLS; /* terminal width */ +PDCEX WINDOW *stdscr; /* the default screen window */ +PDCEX WINDOW *curscr; /* the current screen image */ +PDCEX SCREEN *SP; /* curses variables */ +PDCEX MOUSE_STATUS Mouse_status; +PDCEX int COLORS; +PDCEX int COLOR_PAIRS; +PDCEX int TABSIZE; +PDCEX chtype acs_map[]; /* alternate character set map */ +PDCEX char ttytype[]; /* terminal name/description */ + +/*man-start************************************************************** + +Text Attributes +=============== + +PDCurses uses a 32-bit integer for its chtype: + + color pair | modifiers | character eg 'a' + -----------------------|-----------------------|-------------------- + 31 30 29 28 27 26 25 24|23 22 21 20 19 18 17 16|15 14 13 .. 2 1 0 + +There are 256 color pairs (8 bits), 8 bits for modifiers, and 16 bits +for character data. The modifiers are bold, underline, right-line, +left-line, italic, reverse and blink, plus the alternate character set +indicator. + +**man-end****************************************************************/ + +/*** Video attribute macros ***/ + +#define A_NORMAL (chtype)0 + +#define A_ALTCHARSET (chtype)0x00010000 +#define A_RIGHT (chtype)0x00020000 +#define A_LEFT (chtype)0x00040000 +#define A_ITALIC (chtype)0x00080000 +#define A_UNDERLINE (chtype)0x00100000 +#define A_REVERSE (chtype)0x00200000 +#define A_BLINK (chtype)0x00400000 +#define A_BOLD (chtype)0x00800000 + +#define A_ATTRIBUTES (chtype)0xffff0000 +#define A_CHARTEXT (chtype)0x0000ffff +#define A_COLOR (chtype)0xff000000 + +#define PDC_COLOR_SHIFT 24 + +#define A_LEFTLINE A_LEFT +#define A_RIGHTLINE A_RIGHT +#define A_STANDOUT (A_REVERSE | A_BOLD) /* X/Open */ + +#define A_DIM A_NORMAL +#define A_INVIS A_NORMAL +#define A_PROTECT A_NORMAL + +#define A_HORIZONTAL A_NORMAL +#define A_LOW A_NORMAL +#define A_TOP A_NORMAL +#define A_VERTICAL A_NORMAL + +#define CHR_MSK A_CHARTEXT /* Obsolete */ +#define ATR_MSK A_ATTRIBUTES /* Obsolete */ +#define ATR_NRM A_NORMAL /* Obsolete */ + +/* For use with attr_t -- X/Open says, "these shall be distinct", so + this is a non-conforming implementation. */ + +#define WA_NORMAL A_NORMAL + +#define WA_ALTCHARSET A_ALTCHARSET +#define WA_BLINK A_BLINK +#define WA_BOLD A_BOLD +#define WA_DIM A_DIM +#define WA_INVIS A_INVIS +#define WA_ITALIC A_ITALIC +#define WA_LEFT A_LEFT +#define WA_PROTECT A_PROTECT +#define WA_REVERSE A_REVERSE +#define WA_RIGHT A_RIGHT +#define WA_STANDOUT A_STANDOUT +#define WA_UNDERLINE A_UNDERLINE + +#define WA_HORIZONTAL A_HORIZONTAL +#define WA_LOW A_LOW +#define WA_TOP A_TOP +#define WA_VERTICAL A_VERTICAL + +#define WA_ATTRIBUTES A_ATTRIBUTES + +/*** Alternate character set macros ***/ + +#define PDC_ACS(w) ((chtype)w | A_ALTCHARSET) + +/* VT100-compatible symbols -- box chars */ + +#define ACS_ULCORNER PDC_ACS('l') +#define ACS_LLCORNER PDC_ACS('m') +#define ACS_URCORNER PDC_ACS('k') +#define ACS_LRCORNER PDC_ACS('j') +#define ACS_RTEE PDC_ACS('u') +#define ACS_LTEE PDC_ACS('t') +#define ACS_BTEE PDC_ACS('v') +#define ACS_TTEE PDC_ACS('w') +#define ACS_HLINE PDC_ACS('q') +#define ACS_VLINE PDC_ACS('x') +#define ACS_PLUS PDC_ACS('n') + +/* VT100-compatible symbols -- other */ + +#define ACS_S1 PDC_ACS('o') +#define ACS_S9 PDC_ACS('s') +#define ACS_DIAMOND PDC_ACS('`') +#define ACS_CKBOARD PDC_ACS('a') +#define ACS_DEGREE PDC_ACS('f') +#define ACS_PLMINUS PDC_ACS('g') +#define ACS_BULLET PDC_ACS('~') + +/* Teletype 5410v1 symbols -- these are defined in SysV curses, but + are not well-supported by most terminals. Stick to VT100 characters + for optimum portability. */ + +#define ACS_LARROW PDC_ACS(',') +#define ACS_RARROW PDC_ACS('+') +#define ACS_DARROW PDC_ACS('.') +#define ACS_UARROW PDC_ACS('-') +#define ACS_BOARD PDC_ACS('h') +#define ACS_LANTERN PDC_ACS('i') +#define ACS_BLOCK PDC_ACS('0') + +/* That goes double for these -- undocumented SysV symbols. Don't use + them. */ + +#define ACS_S3 PDC_ACS('p') +#define ACS_S7 PDC_ACS('r') +#define ACS_LEQUAL PDC_ACS('y') +#define ACS_GEQUAL PDC_ACS('z') +#define ACS_PI PDC_ACS('{') +#define ACS_NEQUAL PDC_ACS('|') +#define ACS_STERLING PDC_ACS('}') + +/* Box char aliases */ + +#define ACS_BSSB ACS_ULCORNER +#define ACS_SSBB ACS_LLCORNER +#define ACS_BBSS ACS_URCORNER +#define ACS_SBBS ACS_LRCORNER +#define ACS_SBSS ACS_RTEE +#define ACS_SSSB ACS_LTEE +#define ACS_SSBS ACS_BTEE +#define ACS_BSSS ACS_TTEE +#define ACS_BSBS ACS_HLINE +#define ACS_SBSB ACS_VLINE +#define ACS_SSSS ACS_PLUS + +/* cchar_t aliases */ + +#ifdef PDC_WIDE +# define WACS_ULCORNER (&(acs_map['l'])) +# define WACS_LLCORNER (&(acs_map['m'])) +# define WACS_URCORNER (&(acs_map['k'])) +# define WACS_LRCORNER (&(acs_map['j'])) +# define WACS_RTEE (&(acs_map['u'])) +# define WACS_LTEE (&(acs_map['t'])) +# define WACS_BTEE (&(acs_map['v'])) +# define WACS_TTEE (&(acs_map['w'])) +# define WACS_HLINE (&(acs_map['q'])) +# define WACS_VLINE (&(acs_map['x'])) +# define WACS_PLUS (&(acs_map['n'])) + +# define WACS_S1 (&(acs_map['o'])) +# define WACS_S9 (&(acs_map['s'])) +# define WACS_DIAMOND (&(acs_map['`'])) +# define WACS_CKBOARD (&(acs_map['a'])) +# define WACS_DEGREE (&(acs_map['f'])) +# define WACS_PLMINUS (&(acs_map['g'])) +# define WACS_BULLET (&(acs_map['~'])) + +# define WACS_LARROW (&(acs_map[','])) +# define WACS_RARROW (&(acs_map['+'])) +# define WACS_DARROW (&(acs_map['.'])) +# define WACS_UARROW (&(acs_map['-'])) +# define WACS_BOARD (&(acs_map['h'])) +# define WACS_LANTERN (&(acs_map['i'])) +# define WACS_BLOCK (&(acs_map['0'])) + +# define WACS_S3 (&(acs_map['p'])) +# define WACS_S7 (&(acs_map['r'])) +# define WACS_LEQUAL (&(acs_map['y'])) +# define WACS_GEQUAL (&(acs_map['z'])) +# define WACS_PI (&(acs_map['{'])) +# define WACS_NEQUAL (&(acs_map['|'])) +# define WACS_STERLING (&(acs_map['}'])) + +# define WACS_BSSB WACS_ULCORNER +# define WACS_SSBB WACS_LLCORNER +# define WACS_BBSS WACS_URCORNER +# define WACS_SBBS WACS_LRCORNER +# define WACS_SBSS WACS_RTEE +# define WACS_SSSB WACS_LTEE +# define WACS_SSBS WACS_BTEE +# define WACS_BSSS WACS_TTEE +# define WACS_BSBS WACS_HLINE +# define WACS_SBSB WACS_VLINE +# define WACS_SSSS WACS_PLUS +#endif + +/*** Color macros ***/ + +#define COLOR_BLACK 0 + +#ifdef PDC_RGB /* RGB */ +# define COLOR_RED 1 +# define COLOR_GREEN 2 +# define COLOR_BLUE 4 +#else /* BGR */ +# define COLOR_BLUE 1 +# define COLOR_GREEN 2 +# define COLOR_RED 4 +#endif + +#define COLOR_CYAN (COLOR_BLUE | COLOR_GREEN) +#define COLOR_MAGENTA (COLOR_RED | COLOR_BLUE) +#define COLOR_YELLOW (COLOR_RED | COLOR_GREEN) + +#define COLOR_WHITE 7 + +/*---------------------------------------------------------------------- + * + * Function and Keypad Key Definitions + * Many are just for compatibility + * + */ + +#define KEY_CODE_YES 0x100 /* If get_wch() gives a key code */ + +#define KEY_BREAK 0x101 /* Not on PC KBD */ +#define KEY_DOWN 0x102 /* Down arrow key */ +#define KEY_UP 0x103 /* Up arrow key */ +#define KEY_LEFT 0x104 /* Left arrow key */ +#define KEY_RIGHT 0x105 /* Right arrow key */ +#define KEY_HOME 0x106 /* home key */ +#define KEY_BACKSPACE 0x107 /* not on pc */ +#define KEY_F0 0x108 /* function keys; 64 reserved */ + +#define KEY_DL 0x148 /* delete line */ +#define KEY_IL 0x149 /* insert line */ +#define KEY_DC 0x14a /* delete character */ +#define KEY_IC 0x14b /* insert char or enter ins mode */ +#define KEY_EIC 0x14c /* exit insert char mode */ +#define KEY_CLEAR 0x14d /* clear screen */ +#define KEY_EOS 0x14e /* clear to end of screen */ +#define KEY_EOL 0x14f /* clear to end of line */ +#define KEY_SF 0x150 /* scroll 1 line forward */ +#define KEY_SR 0x151 /* scroll 1 line back (reverse) */ +#define KEY_NPAGE 0x152 /* next page */ +#define KEY_PPAGE 0x153 /* previous page */ +#define KEY_STAB 0x154 /* set tab */ +#define KEY_CTAB 0x155 /* clear tab */ +#define KEY_CATAB 0x156 /* clear all tabs */ +#define KEY_ENTER 0x157 /* enter or send (unreliable) */ +#define KEY_SRESET 0x158 /* soft/reset (partial/unreliable) */ +#define KEY_RESET 0x159 /* reset/hard reset (unreliable) */ +#define KEY_PRINT 0x15a /* print/copy */ +#define KEY_LL 0x15b /* home down/bottom (lower left) */ +#define KEY_ABORT 0x15c /* abort/terminate key (any) */ +#define KEY_SHELP 0x15d /* short help */ +#define KEY_LHELP 0x15e /* long help */ +#define KEY_BTAB 0x15f /* Back tab key */ +#define KEY_BEG 0x160 /* beg(inning) key */ +#define KEY_CANCEL 0x161 /* cancel key */ +#define KEY_CLOSE 0x162 /* close key */ +#define KEY_COMMAND 0x163 /* cmd (command) key */ +#define KEY_COPY 0x164 /* copy key */ +#define KEY_CREATE 0x165 /* create key */ +#define KEY_END 0x166 /* end key */ +#define KEY_EXIT 0x167 /* exit key */ +#define KEY_FIND 0x168 /* find key */ +#define KEY_HELP 0x169 /* help key */ +#define KEY_MARK 0x16a /* mark key */ +#define KEY_MESSAGE 0x16b /* message key */ +#define KEY_MOVE 0x16c /* move key */ +#define KEY_NEXT 0x16d /* next object key */ +#define KEY_OPEN 0x16e /* open key */ +#define KEY_OPTIONS 0x16f /* options key */ +#define KEY_PREVIOUS 0x170 /* previous object key */ +#define KEY_REDO 0x171 /* redo key */ +#define KEY_REFERENCE 0x172 /* ref(erence) key */ +#define KEY_REFRESH 0x173 /* refresh key */ +#define KEY_REPLACE 0x174 /* replace key */ +#define KEY_RESTART 0x175 /* restart key */ +#define KEY_RESUME 0x176 /* resume key */ +#define KEY_SAVE 0x177 /* save key */ +#define KEY_SBEG 0x178 /* shifted beginning key */ +#define KEY_SCANCEL 0x179 /* shifted cancel key */ +#define KEY_SCOMMAND 0x17a /* shifted command key */ +#define KEY_SCOPY 0x17b /* shifted copy key */ +#define KEY_SCREATE 0x17c /* shifted create key */ +#define KEY_SDC 0x17d /* shifted delete char key */ +#define KEY_SDL 0x17e /* shifted delete line key */ +#define KEY_SELECT 0x17f /* select key */ +#define KEY_SEND 0x180 /* shifted end key */ +#define KEY_SEOL 0x181 /* shifted clear line key */ +#define KEY_SEXIT 0x182 /* shifted exit key */ +#define KEY_SFIND 0x183 /* shifted find key */ +#define KEY_SHOME 0x184 /* shifted home key */ +#define KEY_SIC 0x185 /* shifted input key */ + +#define KEY_SLEFT 0x187 /* shifted left arrow key */ +#define KEY_SMESSAGE 0x188 /* shifted message key */ +#define KEY_SMOVE 0x189 /* shifted move key */ +#define KEY_SNEXT 0x18a /* shifted next key */ +#define KEY_SOPTIONS 0x18b /* shifted options key */ +#define KEY_SPREVIOUS 0x18c /* shifted prev key */ +#define KEY_SPRINT 0x18d /* shifted print key */ +#define KEY_SREDO 0x18e /* shifted redo key */ +#define KEY_SREPLACE 0x18f /* shifted replace key */ +#define KEY_SRIGHT 0x190 /* shifted right arrow */ +#define KEY_SRSUME 0x191 /* shifted resume key */ +#define KEY_SSAVE 0x192 /* shifted save key */ +#define KEY_SSUSPEND 0x193 /* shifted suspend key */ +#define KEY_SUNDO 0x194 /* shifted undo key */ +#define KEY_SUSPEND 0x195 /* suspend key */ +#define KEY_UNDO 0x196 /* undo key */ + +/* PDCurses-specific key definitions -- PC only */ + +#define ALT_0 0x197 +#define ALT_1 0x198 +#define ALT_2 0x199 +#define ALT_3 0x19a +#define ALT_4 0x19b +#define ALT_5 0x19c +#define ALT_6 0x19d +#define ALT_7 0x19e +#define ALT_8 0x19f +#define ALT_9 0x1a0 +#define ALT_A 0x1a1 +#define ALT_B 0x1a2 +#define ALT_C 0x1a3 +#define ALT_D 0x1a4 +#define ALT_E 0x1a5 +#define ALT_F 0x1a6 +#define ALT_G 0x1a7 +#define ALT_H 0x1a8 +#define ALT_I 0x1a9 +#define ALT_J 0x1aa +#define ALT_K 0x1ab +#define ALT_L 0x1ac +#define ALT_M 0x1ad +#define ALT_N 0x1ae +#define ALT_O 0x1af +#define ALT_P 0x1b0 +#define ALT_Q 0x1b1 +#define ALT_R 0x1b2 +#define ALT_S 0x1b3 +#define ALT_T 0x1b4 +#define ALT_U 0x1b5 +#define ALT_V 0x1b6 +#define ALT_W 0x1b7 +#define ALT_X 0x1b8 +#define ALT_Y 0x1b9 +#define ALT_Z 0x1ba + +#define CTL_LEFT 0x1bb /* Control-Left-Arrow */ +#define CTL_RIGHT 0x1bc +#define CTL_PGUP 0x1bd +#define CTL_PGDN 0x1be +#define CTL_HOME 0x1bf +#define CTL_END 0x1c0 + +#define KEY_A1 0x1c1 /* upper left on Virtual keypad */ +#define KEY_A2 0x1c2 /* upper middle on Virt. keypad */ +#define KEY_A3 0x1c3 /* upper right on Vir. keypad */ +#define KEY_B1 0x1c4 /* middle left on Virt. keypad */ +#define KEY_B2 0x1c5 /* center on Virt. keypad */ +#define KEY_B3 0x1c6 /* middle right on Vir. keypad */ +#define KEY_C1 0x1c7 /* lower left on Virt. keypad */ +#define KEY_C2 0x1c8 /* lower middle on Virt. keypad */ +#define KEY_C3 0x1c9 /* lower right on Vir. keypad */ + +#define PADSLASH 0x1ca /* slash on keypad */ +#define PADENTER 0x1cb /* enter on keypad */ +#define CTL_PADENTER 0x1cc /* ctl-enter on keypad */ +#define ALT_PADENTER 0x1cd /* alt-enter on keypad */ +#define PADSTOP 0x1ce /* stop on keypad */ +#define PADSTAR 0x1cf /* star on keypad */ +#define PADMINUS 0x1d0 /* minus on keypad */ +#define PADPLUS 0x1d1 /* plus on keypad */ +#define CTL_PADSTOP 0x1d2 /* ctl-stop on keypad */ +#define CTL_PADCENTER 0x1d3 /* ctl-enter on keypad */ +#define CTL_PADPLUS 0x1d4 /* ctl-plus on keypad */ +#define CTL_PADMINUS 0x1d5 /* ctl-minus on keypad */ +#define CTL_PADSLASH 0x1d6 /* ctl-slash on keypad */ +#define CTL_PADSTAR 0x1d7 /* ctl-star on keypad */ +#define ALT_PADPLUS 0x1d8 /* alt-plus on keypad */ +#define ALT_PADMINUS 0x1d9 /* alt-minus on keypad */ +#define ALT_PADSLASH 0x1da /* alt-slash on keypad */ +#define ALT_PADSTAR 0x1db /* alt-star on keypad */ +#define ALT_PADSTOP 0x1dc /* alt-stop on keypad */ +#define CTL_INS 0x1dd /* ctl-insert */ +#define ALT_DEL 0x1de /* alt-delete */ +#define ALT_INS 0x1df /* alt-insert */ +#define CTL_UP 0x1e0 /* ctl-up arrow */ +#define CTL_DOWN 0x1e1 /* ctl-down arrow */ +#define CTL_TAB 0x1e2 /* ctl-tab */ +#define ALT_TAB 0x1e3 +#define ALT_MINUS 0x1e4 +#define ALT_EQUAL 0x1e5 +#define ALT_HOME 0x1e6 +#define ALT_PGUP 0x1e7 +#define ALT_PGDN 0x1e8 +#define ALT_END 0x1e9 +#define ALT_UP 0x1ea /* alt-up arrow */ +#define ALT_DOWN 0x1eb /* alt-down arrow */ +#define ALT_RIGHT 0x1ec /* alt-right arrow */ +#define ALT_LEFT 0x1ed /* alt-left arrow */ +#define ALT_ENTER 0x1ee /* alt-enter */ +#define ALT_ESC 0x1ef /* alt-escape */ +#define ALT_BQUOTE 0x1f0 /* alt-back quote */ +#define ALT_LBRACKET 0x1f1 /* alt-left bracket */ +#define ALT_RBRACKET 0x1f2 /* alt-right bracket */ +#define ALT_SEMICOLON 0x1f3 /* alt-semi-colon */ +#define ALT_FQUOTE 0x1f4 /* alt-forward quote */ +#define ALT_COMMA 0x1f5 /* alt-comma */ +#define ALT_STOP 0x1f6 /* alt-stop */ +#define ALT_FSLASH 0x1f7 /* alt-forward slash */ +#define ALT_BKSP 0x1f8 /* alt-backspace */ +#define CTL_BKSP 0x1f9 /* ctl-backspace */ +#define PAD0 0x1fa /* keypad 0 */ + +#define CTL_PAD0 0x1fb /* ctl-keypad 0 */ +#define CTL_PAD1 0x1fc +#define CTL_PAD2 0x1fd +#define CTL_PAD3 0x1fe +#define CTL_PAD4 0x1ff +#define CTL_PAD5 0x200 +#define CTL_PAD6 0x201 +#define CTL_PAD7 0x202 +#define CTL_PAD8 0x203 +#define CTL_PAD9 0x204 + +#define ALT_PAD0 0x205 /* alt-keypad 0 */ +#define ALT_PAD1 0x206 +#define ALT_PAD2 0x207 +#define ALT_PAD3 0x208 +#define ALT_PAD4 0x209 +#define ALT_PAD5 0x20a +#define ALT_PAD6 0x20b +#define ALT_PAD7 0x20c +#define ALT_PAD8 0x20d +#define ALT_PAD9 0x20e + +#define CTL_DEL 0x20f /* clt-delete */ +#define ALT_BSLASH 0x210 /* alt-back slash */ +#define CTL_ENTER 0x211 /* ctl-enter */ + +#define SHF_PADENTER 0x212 /* shift-enter on keypad */ +#define SHF_PADSLASH 0x213 /* shift-slash on keypad */ +#define SHF_PADSTAR 0x214 /* shift-star on keypad */ +#define SHF_PADPLUS 0x215 /* shift-plus on keypad */ +#define SHF_PADMINUS 0x216 /* shift-minus on keypad */ +#define SHF_UP 0x217 /* shift-up on keypad */ +#define SHF_DOWN 0x218 /* shift-down on keypad */ +#define SHF_IC 0x219 /* shift-insert on keypad */ +#define SHF_DC 0x21a /* shift-delete on keypad */ + +#define KEY_MOUSE 0x21b /* "mouse" key */ +#define KEY_SHIFT_L 0x21c /* Left-shift */ +#define KEY_SHIFT_R 0x21d /* Right-shift */ +#define KEY_CONTROL_L 0x21e /* Left-control */ +#define KEY_CONTROL_R 0x21f /* Right-control */ +#define KEY_ALT_L 0x220 /* Left-alt */ +#define KEY_ALT_R 0x221 /* Right-alt */ +#define KEY_RESIZE 0x222 /* Window resize */ +#define KEY_SUP 0x223 /* Shifted up arrow */ +#define KEY_SDOWN 0x224 /* Shifted down arrow */ + +#define KEY_MIN KEY_BREAK /* Minimum curses key value */ +#define KEY_MAX KEY_SDOWN /* Maximum curses key */ + +#define KEY_F(n) (KEY_F0 + (n)) + +/*---------------------------------------------------------------------- + * + * Functions + * + */ + +/* Standard */ + +PDCEX int addch(const chtype); +PDCEX int addchnstr(const chtype *, int); +PDCEX int addchstr(const chtype *); +PDCEX int addnstr(const char *, int); +PDCEX int addstr(const char *); +PDCEX int attroff(chtype); +PDCEX int attron(chtype); +PDCEX int attrset(chtype); +PDCEX int attr_get(attr_t *, short *, void *); +PDCEX int attr_off(attr_t, void *); +PDCEX int attr_on(attr_t, void *); +PDCEX int attr_set(attr_t, short, void *); +PDCEX int baudrate(void); +PDCEX int beep(void); +PDCEX int bkgd(chtype); +PDCEX void bkgdset(chtype); +PDCEX int border(chtype, chtype, chtype, chtype, + chtype, chtype, chtype, chtype); +PDCEX int box(WINDOW *, chtype, chtype); +PDCEX bool can_change_color(void); +PDCEX int cbreak(void); +PDCEX int chgat(int, attr_t, short, const void *); +PDCEX int clearok(WINDOW *, bool); +PDCEX int clear(void); +PDCEX int clrtobot(void); +PDCEX int clrtoeol(void); +PDCEX int color_content(short, short *, short *, short *); +PDCEX int color_set(short, void *); +PDCEX int copywin(const WINDOW *, WINDOW *, int, int, int, + int, int, int, int); +PDCEX int curs_set(int); +PDCEX int def_prog_mode(void); +PDCEX int def_shell_mode(void); +PDCEX int delay_output(int); +PDCEX int delch(void); +PDCEX int deleteln(void); +PDCEX void delscreen(SCREEN *); +PDCEX int delwin(WINDOW *); +PDCEX WINDOW *derwin(WINDOW *, int, int, int, int); +PDCEX int doupdate(void); +PDCEX WINDOW *dupwin(WINDOW *); +PDCEX int echochar(const chtype); +PDCEX int echo(void); +PDCEX int endwin(void); +PDCEX char erasechar(void); +PDCEX int erase(void); +PDCEX void filter(void); +PDCEX int flash(void); +PDCEX int flushinp(void); +PDCEX chtype getbkgd(WINDOW *); +PDCEX int getnstr(char *, int); +PDCEX int getstr(char *); +PDCEX WINDOW *getwin(FILE *); +PDCEX int halfdelay(int); +PDCEX bool has_colors(void); +PDCEX bool has_ic(void); +PDCEX bool has_il(void); +PDCEX int hline(chtype, int); +PDCEX void idcok(WINDOW *, bool); +PDCEX int idlok(WINDOW *, bool); +PDCEX void immedok(WINDOW *, bool); +PDCEX int inchnstr(chtype *, int); +PDCEX int inchstr(chtype *); +PDCEX chtype inch(void); +PDCEX int init_color(short, short, short, short); +PDCEX int init_pair(short, short, short); +PDCEX WINDOW *initscr(void); +PDCEX int innstr(char *, int); +PDCEX int insch(chtype); +PDCEX int insdelln(int); +PDCEX int insertln(void); +PDCEX int insnstr(const char *, int); +PDCEX int insstr(const char *); +PDCEX int instr(char *); +PDCEX int intrflush(WINDOW *, bool); +PDCEX bool isendwin(void); +PDCEX bool is_linetouched(WINDOW *, int); +PDCEX bool is_wintouched(WINDOW *); +PDCEX char *keyname(int); +PDCEX int keypad(WINDOW *, bool); +PDCEX char killchar(void); +PDCEX int leaveok(WINDOW *, bool); +PDCEX char *longname(void); +PDCEX int meta(WINDOW *, bool); +PDCEX int move(int, int); +PDCEX int mvaddch(int, int, const chtype); +PDCEX int mvaddchnstr(int, int, const chtype *, int); +PDCEX int mvaddchstr(int, int, const chtype *); +PDCEX int mvaddnstr(int, int, const char *, int); +PDCEX int mvaddstr(int, int, const char *); +PDCEX int mvchgat(int, int, int, attr_t, short, const void *); +PDCEX int mvcur(int, int, int, int); +PDCEX int mvdelch(int, int); +PDCEX int mvderwin(WINDOW *, int, int); +PDCEX int mvgetch(int, int); +PDCEX int mvgetnstr(int, int, char *, int); +PDCEX int mvgetstr(int, int, char *); +PDCEX int mvhline(int, int, chtype, int); +PDCEX chtype mvinch(int, int); +PDCEX int mvinchnstr(int, int, chtype *, int); +PDCEX int mvinchstr(int, int, chtype *); +PDCEX int mvinnstr(int, int, char *, int); +PDCEX int mvinsch(int, int, chtype); +PDCEX int mvinsnstr(int, int, const char *, int); +PDCEX int mvinsstr(int, int, const char *); +PDCEX int mvinstr(int, int, char *); +PDCEX int mvprintw(int, int, const char *, ...); +PDCEX int mvscanw(int, int, const char *, ...); +PDCEX int mvvline(int, int, chtype, int); +PDCEX int mvwaddchnstr(WINDOW *, int, int, const chtype *, int); +PDCEX int mvwaddchstr(WINDOW *, int, int, const chtype *); +PDCEX int mvwaddch(WINDOW *, int, int, const chtype); +PDCEX int mvwaddnstr(WINDOW *, int, int, const char *, int); +PDCEX int mvwaddstr(WINDOW *, int, int, const char *); +PDCEX int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *); +PDCEX int mvwdelch(WINDOW *, int, int); +PDCEX int mvwgetch(WINDOW *, int, int); +PDCEX int mvwgetnstr(WINDOW *, int, int, char *, int); +PDCEX int mvwgetstr(WINDOW *, int, int, char *); +PDCEX int mvwhline(WINDOW *, int, int, chtype, int); +PDCEX int mvwinchnstr(WINDOW *, int, int, chtype *, int); +PDCEX int mvwinchstr(WINDOW *, int, int, chtype *); +PDCEX chtype mvwinch(WINDOW *, int, int); +PDCEX int mvwinnstr(WINDOW *, int, int, char *, int); +PDCEX int mvwinsch(WINDOW *, int, int, chtype); +PDCEX int mvwinsnstr(WINDOW *, int, int, const char *, int); +PDCEX int mvwinsstr(WINDOW *, int, int, const char *); +PDCEX int mvwinstr(WINDOW *, int, int, char *); +PDCEX int mvwin(WINDOW *, int, int); +PDCEX int mvwprintw(WINDOW *, int, int, const char *, ...); +PDCEX int mvwscanw(WINDOW *, int, int, const char *, ...); +PDCEX int mvwvline(WINDOW *, int, int, chtype, int); +PDCEX int napms(int); +PDCEX WINDOW *newpad(int, int); +PDCEX SCREEN *newterm(const char *, FILE *, FILE *); +PDCEX WINDOW *newwin(int, int, int, int); +PDCEX int nl(void); +PDCEX int nocbreak(void); +PDCEX int nodelay(WINDOW *, bool); +PDCEX int noecho(void); +PDCEX int nonl(void); +PDCEX void noqiflush(void); +PDCEX int noraw(void); +PDCEX int notimeout(WINDOW *, bool); +PDCEX int overlay(const WINDOW *, WINDOW *); +PDCEX int overwrite(const WINDOW *, WINDOW *); +PDCEX int pair_content(short, short *, short *); +PDCEX int pechochar(WINDOW *, chtype); +PDCEX int pnoutrefresh(WINDOW *, int, int, int, int, int, int); +PDCEX int prefresh(WINDOW *, int, int, int, int, int, int); +PDCEX int printw(const char *, ...); +PDCEX int putwin(WINDOW *, FILE *); +PDCEX void qiflush(void); +PDCEX int raw(void); +PDCEX int redrawwin(WINDOW *); +PDCEX int refresh(void); +PDCEX int reset_prog_mode(void); +PDCEX int reset_shell_mode(void); +PDCEX int resetty(void); +PDCEX int ripoffline(int, int (*)(WINDOW *, int)); +PDCEX int savetty(void); +PDCEX int scanw(const char *, ...); +PDCEX int scr_dump(const char *); +PDCEX int scr_init(const char *); +PDCEX int scr_restore(const char *); +PDCEX int scr_set(const char *); +PDCEX int scrl(int); +PDCEX int scroll(WINDOW *); +PDCEX int scrollok(WINDOW *, bool); +PDCEX SCREEN *set_term(SCREEN *); +PDCEX int setscrreg(int, int); +PDCEX int slk_attroff(const chtype); +PDCEX int slk_attr_off(const attr_t, void *); +PDCEX int slk_attron(const chtype); +PDCEX int slk_attr_on(const attr_t, void *); +PDCEX int slk_attrset(const chtype); +PDCEX int slk_attr_set(const attr_t, short, void *); +PDCEX int slk_clear(void); +PDCEX int slk_color(short); +PDCEX int slk_init(int); +PDCEX char *slk_label(int); +PDCEX int slk_noutrefresh(void); +PDCEX int slk_refresh(void); +PDCEX int slk_restore(void); +PDCEX int slk_set(int, const char *, int); +PDCEX int slk_touch(void); +PDCEX int standend(void); +PDCEX int standout(void); +PDCEX int start_color(void); +PDCEX WINDOW *subpad(WINDOW *, int, int, int, int); +PDCEX WINDOW *subwin(WINDOW *, int, int, int, int); +PDCEX int syncok(WINDOW *, bool); +PDCEX chtype termattrs(void); +PDCEX attr_t term_attrs(void); +PDCEX char *termname(void); +PDCEX void timeout(int); +PDCEX int touchline(WINDOW *, int, int); +PDCEX int touchwin(WINDOW *); +PDCEX int typeahead(int); +PDCEX int untouchwin(WINDOW *); +PDCEX void use_env(bool); +PDCEX int vidattr(chtype); +PDCEX int vid_attr(attr_t, short, void *); +PDCEX int vidputs(chtype, int (*)(int)); +PDCEX int vid_puts(attr_t, short, void *, int (*)(int)); +PDCEX int vline(chtype, int); +PDCEX int vw_printw(WINDOW *, const char *, va_list); +PDCEX int vwprintw(WINDOW *, const char *, va_list); +PDCEX int vw_scanw(WINDOW *, const char *, va_list); +PDCEX int vwscanw(WINDOW *, const char *, va_list); +PDCEX int waddchnstr(WINDOW *, const chtype *, int); +PDCEX int waddchstr(WINDOW *, const chtype *); +PDCEX int waddch(WINDOW *, const chtype); +PDCEX int waddnstr(WINDOW *, const char *, int); +PDCEX int waddstr(WINDOW *, const char *); +PDCEX int wattroff(WINDOW *, chtype); +PDCEX int wattron(WINDOW *, chtype); +PDCEX int wattrset(WINDOW *, chtype); +PDCEX int wattr_get(WINDOW *, attr_t *, short *, void *); +PDCEX int wattr_off(WINDOW *, attr_t, void *); +PDCEX int wattr_on(WINDOW *, attr_t, void *); +PDCEX int wattr_set(WINDOW *, attr_t, short, void *); +PDCEX void wbkgdset(WINDOW *, chtype); +PDCEX int wbkgd(WINDOW *, chtype); +PDCEX int wborder(WINDOW *, chtype, chtype, chtype, chtype, + chtype, chtype, chtype, chtype); +PDCEX int wchgat(WINDOW *, int, attr_t, short, const void *); +PDCEX int wclear(WINDOW *); +PDCEX int wclrtobot(WINDOW *); +PDCEX int wclrtoeol(WINDOW *); +PDCEX int wcolor_set(WINDOW *, short, void *); +PDCEX void wcursyncup(WINDOW *); +PDCEX int wdelch(WINDOW *); +PDCEX int wdeleteln(WINDOW *); +PDCEX int wechochar(WINDOW *, const chtype); +PDCEX int werase(WINDOW *); +PDCEX int wgetch(WINDOW *); +PDCEX int wgetnstr(WINDOW *, char *, int); +PDCEX int wgetstr(WINDOW *, char *); +PDCEX int whline(WINDOW *, chtype, int); +PDCEX int winchnstr(WINDOW *, chtype *, int); +PDCEX int winchstr(WINDOW *, chtype *); +PDCEX chtype winch(WINDOW *); +PDCEX int winnstr(WINDOW *, char *, int); +PDCEX int winsch(WINDOW *, chtype); +PDCEX int winsdelln(WINDOW *, int); +PDCEX int winsertln(WINDOW *); +PDCEX int winsnstr(WINDOW *, const char *, int); +PDCEX int winsstr(WINDOW *, const char *); +PDCEX int winstr(WINDOW *, char *); +PDCEX int wmove(WINDOW *, int, int); +PDCEX int wnoutrefresh(WINDOW *); +PDCEX int wprintw(WINDOW *, const char *, ...); +PDCEX int wredrawln(WINDOW *, int, int); +PDCEX int wrefresh(WINDOW *); +PDCEX int wscanw(WINDOW *, const char *, ...); +PDCEX int wscrl(WINDOW *, int); +PDCEX int wsetscrreg(WINDOW *, int, int); +PDCEX int wstandend(WINDOW *); +PDCEX int wstandout(WINDOW *); +PDCEX void wsyncdown(WINDOW *); +PDCEX void wsyncup(WINDOW *); +PDCEX void wtimeout(WINDOW *, int); +PDCEX int wtouchln(WINDOW *, int, int, int); +PDCEX int wvline(WINDOW *, chtype, int); + +/* Wide-character functions */ + +#ifdef PDC_WIDE +PDCEX int addnwstr(const wchar_t *, int); +PDCEX int addwstr(const wchar_t *); +PDCEX int add_wch(const cchar_t *); +PDCEX int add_wchnstr(const cchar_t *, int); +PDCEX int add_wchstr(const cchar_t *); +PDCEX int bkgrnd(const cchar_t *); +PDCEX void bkgrndset(const cchar_t *); +PDCEX int border_set(const cchar_t *, const cchar_t *, const cchar_t *, + const cchar_t *, const cchar_t *, const cchar_t *, + const cchar_t *, const cchar_t *); +PDCEX int box_set(WINDOW *, const cchar_t *, const cchar_t *); +PDCEX int echo_wchar(const cchar_t *); +PDCEX int erasewchar(wchar_t *); +PDCEX int getbkgrnd(cchar_t *); +PDCEX int getcchar(const cchar_t *, wchar_t *, attr_t *, short *, void *); +PDCEX int getn_wstr(wint_t *, int); +PDCEX int get_wch(wint_t *); +PDCEX int get_wstr(wint_t *); +PDCEX int hline_set(const cchar_t *, int); +PDCEX int innwstr(wchar_t *, int); +PDCEX int ins_nwstr(const wchar_t *, int); +PDCEX int ins_wch(const cchar_t *); +PDCEX int ins_wstr(const wchar_t *); +PDCEX int inwstr(wchar_t *); +PDCEX int in_wch(cchar_t *); +PDCEX int in_wchnstr(cchar_t *, int); +PDCEX int in_wchstr(cchar_t *); +PDCEX char *key_name(wchar_t); +PDCEX int killwchar(wchar_t *); +PDCEX int mvaddnwstr(int, int, const wchar_t *, int); +PDCEX int mvaddwstr(int, int, const wchar_t *); +PDCEX int mvadd_wch(int, int, const cchar_t *); +PDCEX int mvadd_wchnstr(int, int, const cchar_t *, int); +PDCEX int mvadd_wchstr(int, int, const cchar_t *); +PDCEX int mvgetn_wstr(int, int, wint_t *, int); +PDCEX int mvget_wch(int, int, wint_t *); +PDCEX int mvget_wstr(int, int, wint_t *); +PDCEX int mvhline_set(int, int, const cchar_t *, int); +PDCEX int mvinnwstr(int, int, wchar_t *, int); +PDCEX int mvins_nwstr(int, int, const wchar_t *, int); +PDCEX int mvins_wch(int, int, const cchar_t *); +PDCEX int mvins_wstr(int, int, const wchar_t *); +PDCEX int mvinwstr(int, int, wchar_t *); +PDCEX int mvin_wch(int, int, cchar_t *); +PDCEX int mvin_wchnstr(int, int, cchar_t *, int); +PDCEX int mvin_wchstr(int, int, cchar_t *); +PDCEX int mvvline_set(int, int, const cchar_t *, int); +PDCEX int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int); +PDCEX int mvwaddwstr(WINDOW *, int, int, const wchar_t *); +PDCEX int mvwadd_wch(WINDOW *, int, int, const cchar_t *); +PDCEX int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int); +PDCEX int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *); +PDCEX int mvwgetn_wstr(WINDOW *, int, int, wint_t *, int); +PDCEX int mvwget_wch(WINDOW *, int, int, wint_t *); +PDCEX int mvwget_wstr(WINDOW *, int, int, wint_t *); +PDCEX int mvwhline_set(WINDOW *, int, int, const cchar_t *, int); +PDCEX int mvwinnwstr(WINDOW *, int, int, wchar_t *, int); +PDCEX int mvwins_nwstr(WINDOW *, int, int, const wchar_t *, int); +PDCEX int mvwins_wch(WINDOW *, int, int, const cchar_t *); +PDCEX int mvwins_wstr(WINDOW *, int, int, const wchar_t *); +PDCEX int mvwin_wch(WINDOW *, int, int, cchar_t *); +PDCEX int mvwin_wchnstr(WINDOW *, int, int, cchar_t *, int); +PDCEX int mvwin_wchstr(WINDOW *, int, int, cchar_t *); +PDCEX int mvwinwstr(WINDOW *, int, int, wchar_t *); +PDCEX int mvwvline_set(WINDOW *, int, int, const cchar_t *, int); +PDCEX int pecho_wchar(WINDOW *, const cchar_t*); +PDCEX int setcchar(cchar_t*, const wchar_t*, const attr_t, + short, const void*); +PDCEX int slk_wset(int, const wchar_t *, int); +PDCEX int unget_wch(const wchar_t); +PDCEX int vline_set(const cchar_t *, int); +PDCEX int waddnwstr(WINDOW *, const wchar_t *, int); +PDCEX int waddwstr(WINDOW *, const wchar_t *); +PDCEX int wadd_wch(WINDOW *, const cchar_t *); +PDCEX int wadd_wchnstr(WINDOW *, const cchar_t *, int); +PDCEX int wadd_wchstr(WINDOW *, const cchar_t *); +PDCEX int wbkgrnd(WINDOW *, const cchar_t *); +PDCEX void wbkgrndset(WINDOW *, const cchar_t *); +PDCEX int wborder_set(WINDOW *, const cchar_t *, const cchar_t *, + const cchar_t *, const cchar_t *, const cchar_t *, + const cchar_t *, const cchar_t *, const cchar_t *); +PDCEX int wecho_wchar(WINDOW *, const cchar_t *); +PDCEX int wgetbkgrnd(WINDOW *, cchar_t *); +PDCEX int wgetn_wstr(WINDOW *, wint_t *, int); +PDCEX int wget_wch(WINDOW *, wint_t *); +PDCEX int wget_wstr(WINDOW *, wint_t *); +PDCEX int whline_set(WINDOW *, const cchar_t *, int); +PDCEX int winnwstr(WINDOW *, wchar_t *, int); +PDCEX int wins_nwstr(WINDOW *, const wchar_t *, int); +PDCEX int wins_wch(WINDOW *, const cchar_t *); +PDCEX int wins_wstr(WINDOW *, const wchar_t *); +PDCEX int winwstr(WINDOW *, wchar_t *); +PDCEX int win_wch(WINDOW *, cchar_t *); +PDCEX int win_wchnstr(WINDOW *, cchar_t *, int); +PDCEX int win_wchstr(WINDOW *, cchar_t *); +PDCEX wchar_t *wunctrl(cchar_t *); +PDCEX int wvline_set(WINDOW *, const cchar_t *, int); +#endif + +/* Quasi-standard */ + +PDCEX chtype getattrs(WINDOW *); +PDCEX int getbegx(WINDOW *); +PDCEX int getbegy(WINDOW *); +PDCEX int getmaxx(WINDOW *); +PDCEX int getmaxy(WINDOW *); +PDCEX int getparx(WINDOW *); +PDCEX int getpary(WINDOW *); +PDCEX int getcurx(WINDOW *); +PDCEX int getcury(WINDOW *); +PDCEX void traceoff(void); +PDCEX void traceon(void); +PDCEX char *unctrl(chtype); + +PDCEX int crmode(void); +PDCEX int nocrmode(void); +PDCEX int draino(int); +PDCEX int resetterm(void); +PDCEX int fixterm(void); +PDCEX int saveterm(void); +PDCEX void setsyx(int, int); + +PDCEX int mouse_set(mmask_t); +PDCEX int mouse_on(mmask_t); +PDCEX int mouse_off(mmask_t); +PDCEX int request_mouse_pos(void); +PDCEX void wmouse_position(WINDOW *, int *, int *); +PDCEX mmask_t getmouse(void); + +/* ncurses */ + +PDCEX int alloc_pair(int, int); +PDCEX int assume_default_colors(int, int); +PDCEX const char *curses_version(void); +PDCEX int find_pair(int, int); +PDCEX int free_pair(int); +PDCEX bool has_key(int); +PDCEX bool is_cleared(const WINDOW *); +PDCEX bool is_idcok(const WINDOW *); +PDCEX bool is_idlok(const WINDOW *); +PDCEX bool is_immedok(const WINDOW *); +PDCEX bool is_keypad(const WINDOW *); +PDCEX bool is_leaveok(const WINDOW *); +PDCEX bool is_nodelay(const WINDOW *); +PDCEX bool is_notimeout(const WINDOW *); +PDCEX bool is_pad(const WINDOW *); +PDCEX bool is_scrollok(const WINDOW *); +PDCEX bool is_subwin(const WINDOW *); +PDCEX bool is_syncok(const WINDOW *); +PDCEX int set_tabsize(int); +PDCEX int use_default_colors(void); +PDCEX int wgetdelay(const WINDOW *); +PDCEX WINDOW *wgetparent(const WINDOW *); +PDCEX int wgetscrreg(const WINDOW *, int *, int *); +PDCEX int wresize(WINDOW *, int, int); + +PDCEX bool has_mouse(void); +PDCEX int mouseinterval(int); +PDCEX mmask_t mousemask(mmask_t, mmask_t *); +PDCEX bool mouse_trafo(int *, int *, bool); +PDCEX int nc_getmouse(MEVENT *); +PDCEX int ungetmouse(MEVENT *); +PDCEX bool wenclose(const WINDOW *, int, int); +PDCEX bool wmouse_trafo(const WINDOW *, int *, int *, bool); + +/* PDCurses */ + +PDCEX int addrawch(chtype); +PDCEX int insrawch(chtype); +PDCEX bool is_termresized(void); +PDCEX int mvaddrawch(int, int, chtype); +PDCEX int mvdeleteln(int, int); +PDCEX int mvinsertln(int, int); +PDCEX int mvinsrawch(int, int, chtype); +PDCEX int mvwaddrawch(WINDOW *, int, int, chtype); +PDCEX int mvwdeleteln(WINDOW *, int, int); +PDCEX int mvwinsertln(WINDOW *, int, int); +PDCEX int mvwinsrawch(WINDOW *, int, int, chtype); +PDCEX int raw_output(bool); +PDCEX int resize_term(int, int); +PDCEX WINDOW *resize_window(WINDOW *, int, int); +PDCEX int waddrawch(WINDOW *, chtype); +PDCEX int winsrawch(WINDOW *, chtype); +PDCEX char wordchar(void); + +#ifdef PDC_WIDE +PDCEX wchar_t *slk_wlabel(int); +#endif + +PDCEX void PDC_debug(const char *, ...); +PDCEX void PDC_get_version(PDC_VERSION *); +PDCEX int PDC_ungetch(int); +PDCEX int PDC_set_blink(bool); +PDCEX int PDC_set_bold(bool); +PDCEX int PDC_set_line_color(short); +PDCEX void PDC_set_title(const char *); + +PDCEX int PDC_clearclipboard(void); +PDCEX int PDC_freeclipboard(char *); +PDCEX int PDC_getclipboard(char **, long *); +PDCEX int PDC_setclipboard(const char *, long); + +PDCEX unsigned long PDC_get_key_modifiers(void); +PDCEX int PDC_return_key_modifiers(bool); + +#ifdef XCURSES +PDCEX WINDOW *Xinitscr(int, char **); +PDCEX void XCursesExit(void); +PDCEX int sb_init(void); +PDCEX int sb_set_horz(int, int, int); +PDCEX int sb_set_vert(int, int, int); +PDCEX int sb_get_horz(int *, int *, int *); +PDCEX int sb_get_vert(int *, int *, int *); +PDCEX int sb_refresh(void); +#endif + +/* NetBSD */ + +PDCEX int touchoverlap(const WINDOW *, WINDOW *); +PDCEX int underend(void); +PDCEX int underscore(void); +PDCEX int wunderend(WINDOW *); +PDCEX int wunderscore(WINDOW *); + +/*** Functions defined as macros ***/ + +/* getch() and ungetch() conflict with some DOS libraries */ + +#define getch() wgetch(stdscr) +#define ungetch(ch) PDC_ungetch(ch) + +#define COLOR_PAIR(n) (((chtype)(n) << PDC_COLOR_SHIFT) & A_COLOR) +#define PAIR_NUMBER(n) (((n) & A_COLOR) >> PDC_COLOR_SHIFT) + +/* These will _only_ work as macros */ + +#define getbegyx(w, y, x) (y = getbegy(w), x = getbegx(w)) +#define getmaxyx(w, y, x) (y = getmaxy(w), x = getmaxx(w)) +#define getparyx(w, y, x) (y = getpary(w), x = getparx(w)) +#define getyx(w, y, x) (y = getcury(w), x = getcurx(w)) + +#define getsyx(y, x) { if (curscr->_leaveit) (y)=(x)=-1; \ + else getyx(curscr,(y),(x)); } + +#ifdef NCURSES_MOUSE_VERSION +# define getmouse(x) nc_getmouse(x) +#endif + +/* Deprecated */ + +#define PDC_save_key_modifiers(x) (OK) +#define PDC_get_input_fd() 0 + +/* return codes from PDC_getclipboard() and PDC_setclipboard() calls */ + +#define PDC_CLIP_SUCCESS 0 +#define PDC_CLIP_ACCESS_ERROR 1 +#define PDC_CLIP_EMPTY 2 +#define PDC_CLIP_MEMORY_ERROR 3 + +/* PDCurses key modifier masks */ + +#define PDC_KEY_MODIFIER_SHIFT 1 +#define PDC_KEY_MODIFIER_CONTROL 2 +#define PDC_KEY_MODIFIER_ALT 4 +#define PDC_KEY_MODIFIER_NUMLOCK 8 + +#ifdef __cplusplus +# ifndef PDC_PP98 +# undef bool +# endif +} +#endif + +#endif /* __PDCURSES__ */ diff --git a/vendor/pdcurses/curspriv.h b/vendor/pdcurses/curspriv.h new file mode 100644 index 0000000..952feda --- /dev/null +++ b/vendor/pdcurses/curspriv.h @@ -0,0 +1,133 @@ +/* Private definitions and declarations for use within PDCurses. + These should generally not be referenced by applications. */ + +#ifndef __CURSES_INTERNALS__ +#define __CURSES_INTERNALS__ 1 + +#define CURSES_LIBRARY +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__TURBOC__) || defined(__EMX__) || defined(__DJGPP__) || \ + defined(PDC_99) || defined(__WATCOMC__) +# ifndef HAVE_VSSCANF +# define HAVE_VSSCANF 1 /* have vsscanf() */ +# endif +#endif + +#if defined(PDC_99) || defined(__WATCOMC__) +# ifndef HAVE_SNPRINTF +# define HAVE_SNPRINTF 1 /* have snprintf() */ +# endif +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF 1 /* have vsnprintf() */ +# endif +#endif + +/*----------------------------------------------------------------------*/ + +typedef struct /* structure for ripped off lines */ +{ + int line; + int (*init)(WINDOW *, int); +} RIPPEDOFFLINE; + +/* Window properties */ + +#define _SUBWIN 0x01 /* window is a subwindow */ +#define _PAD 0x10 /* X/Open Pad. */ +#define _SUBPAD 0x20 /* X/Open subpad. */ + +/* Miscellaneous */ + +#define _NO_CHANGE -1 /* flags line edge unchanged */ + +#define _ECHAR 0x08 /* Erase char (^H) */ +#define _DWCHAR 0x17 /* Delete Word char (^W) */ +#define _DLCHAR 0x15 /* Delete Line char (^U) */ + +/*----------------------------------------------------------------------*/ + +/* Platform implementation functions */ + +void PDC_beep(void); +bool PDC_can_change_color(void); +int PDC_color_content(short, short *, short *, short *); +bool PDC_check_key(void); +int PDC_curs_set(int); +void PDC_doupdate(void); +void PDC_flushinp(void); +int PDC_get_columns(void); +int PDC_get_cursor_mode(void); +int PDC_get_key(void); +int PDC_get_rows(void); +void PDC_gotoyx(int, int); +bool PDC_has_mouse(void); +int PDC_init_color(short, short, short, short); +int PDC_modifiers_set(void); +int PDC_mouse_set(void); +void PDC_napms(int); +void PDC_reset_prog_mode(void); +void PDC_reset_shell_mode(void); +int PDC_resize_screen(int, int); +void PDC_restore_screen_mode(int); +void PDC_save_screen_mode(int); +#ifdef XCURSES +void PDC_set_args(int, char **); +#endif +void PDC_scr_close(void); +void PDC_scr_free(void); +int PDC_scr_open(void); +void PDC_set_keyboard_binary(bool); +void PDC_transform_line(int, int, int, const chtype *); +const char *PDC_sysname(void); + +/* Internal cross-module functions */ + +void PDC_init_atrtab(void); +WINDOW *PDC_makelines(WINDOW *); +WINDOW *PDC_makenew(int, int, int, int); +int PDC_mouse_in_slk(int, int); +void PDC_slk_free(void); +void PDC_slk_initialize(void); +void PDC_sync(WINDOW *); + +#ifdef PDC_WIDE +int PDC_mbtowc(wchar_t *, const char *, size_t); +size_t PDC_mbstowcs(wchar_t *, const char *, size_t); +size_t PDC_wcstombs(char *, const wchar_t *, size_t); +#endif + +#ifdef PDCDEBUG +# define PDC_LOG(x) if (SP && SP->dbfp) PDC_debug x +#else +# define PDC_LOG(x) +#endif + +/* Internal macros for attributes */ + +#ifndef max +# define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif +#ifndef min +# define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif + +#define DIVROUND(num, divisor) ((num) + ((divisor) >> 1)) / (divisor) + +#define PDC_CLICK_PERIOD 150 /* time to wait for a click, if + not set by mouseinterval() */ +#define PDC_COLOR_PAIRS 256 +#define PDC_MAXCOL 768 /* maximum possible COLORS; may be less */ + +#define _INBUFSIZ 512 /* size of terminal input buffer */ +#define NUNGETCH 256 /* max # chars to ungetch() */ + +#ifdef __cplusplus +} +#endif + +#endif /* __CURSES_INTERNALS__ */ diff --git a/vendor/pdcurses/demos/README.md b/vendor/pdcurses/demos/README.md new file mode 100644 index 0000000..107873b --- /dev/null +++ b/vendor/pdcurses/demos/README.md @@ -0,0 +1,28 @@ +PDCurses Demos +============== + +This directory contains demonstration programs to show and test the +capabilities of curses libraries. Some of them predate PDCurses, +PCcurses or even pcurses/ncurses. Although some PDCurses-specific code +has been added, all programs remain portable to other implementations +(at a minimum, to ncurses). + + +Building +-------- + +The demos are built by the platform-specific makefiles, in the platform +directories. Alternatively, you can build them manually, individually, +and link with any curses library; e.g., "cc -orain rain.c -lcurses". +There are no dependencies besides curses and the standard C library, and +no configuration is needed. + + +Distribution Status +------------------- + +Public domain, except for rain.c and worm.c, which are under the ncurses +license (MIT-like), and UTF-8-demo.txt, which is under Creative Commons +Attribution ([CC BY]). + +[CC BY]: https://creativecommons.org/licenses/by/4.0/ diff --git a/vendor/pdcurses/demos/UTF-8-demo.txt b/vendor/pdcurses/demos/UTF-8-demo.txt new file mode 100644 index 0000000..ff915b2 --- /dev/null +++ b/vendor/pdcurses/demos/UTF-8-demo.txt @@ -0,0 +1,212 @@ + +UTF-8 encoded sample plain-text file +‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +Markus Kuhn [ˈmaʳkʊs kuːn] — 2002-07-25 CC BY + + +The ASCII compatible UTF-8 encoding used in this plain-text file +is defined in Unicode, ISO 10646-1, and RFC 2279. + + +Using Unicode/UTF-8, you can write in emails and source code things such as + +Mathematics and sciences: + + ∮ E⋅da = Q, n → ∞, ∑ f(i) = ∏ g(i), ⎧⎡⎛┌─────┐⎞⎤⎫ + ⎪⎢⎜│a²+b³ ⎟⎥⎪ + ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β), ⎪⎢⎜│───── ⎟⎥⎪ + ⎪⎢⎜⎷ c₈ ⎟⎥⎪ + ℕ ⊆ ℕ₀ ⊂ ℤ ⊂ ℚ ⊂ ℝ ⊂ ℂ, ⎨⎢⎜ ⎟⎥⎬ + ⎪⎢⎜ ∞ ⎟⎥⎪ + ⊥ < a ≠ b ≡ c ≤ d ≪ ⊤ ⇒ (⟦A⟧ ⇔ ⟪B⟫), ⎪⎢⎜ ⎲ ⎟⎥⎪ + ⎪⎢⎜ ⎳aⁱ-bⁱ⎟⎥⎪ + 2H₂ + O₂ ⇌ 2H₂O, R = 4.7 kΩ, ⌀ 200 mm ⎩⎣⎝i=1 ⎠⎦⎭ + +Linguistics and dictionaries: + + ði ıntəˈnæʃənəl fəˈnɛtık əsoʊsiˈeıʃn + Y [ˈʏpsilɔn], Yen [jɛn], Yoga [ˈjoːgɑ] + +APL: + + ((V⍳V)=⍳⍴V)/V←,V ⌷←⍳→⍴∆∇⊃‾⍎⍕⌈ + +Nicer typography in plain text files: + + ╔══════════════════════════════════════════╗ + ║ ║ + ║ • ‘single’ and “double” quotes ║ + ║ ║ + ║ • Curly apostrophes: “We’ve been here” ║ + ║ ║ + ║ • Latin-1 apostrophe and accents: '´` ║ + ║ ║ + ║ • ‚deutsche‘ „Anführungszeichen“ ║ + ║ ║ + ║ • †, ‡, ‰, •, 3–4, —, −5/+5, ™, … ║ + ║ ║ + ║ • ASCII safety test: 1lI|, 0OD, 8B ║ + ║ ╭─────────╮ ║ + ║ • the euro symbol: │ 14.95 € │ ║ + ║ ╰─────────╯ ║ + ╚══════════════════════════════════════════╝ + +Combining characters: + + STARGΛ̊TE SG-1, a = v̇ = r̈, a⃑ ⊥ b⃑ + +Greek (in Polytonic): + + The Greek anthem: + + Σὲ γνωρίζω ἀπὸ τὴν κόψη + τοῦ σπαθιοῦ τὴν τρομερή, + σὲ γνωρίζω ἀπὸ τὴν ὄψη + ποὺ μὲ βία μετράει τὴ γῆ. + + ᾿Απ᾿ τὰ κόκκαλα βγαλμένη + τῶν ῾Ελλήνων τὰ ἱερά + καὶ σὰν πρῶτα ἀνδρειωμένη + χαῖρε, ὦ χαῖρε, ᾿Ελευθεριά! + + From a speech of Demosthenes in the 4th century BC: + + Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν, ὦ ἄνδρες ᾿Αθηναῖοι, + ὅταν τ᾿ εἰς τὰ πράγματα ἀποβλέψω καὶ ὅταν πρὸς τοὺς + λόγους οὓς ἀκούω· τοὺς μὲν γὰρ λόγους περὶ τοῦ + τιμωρήσασθαι Φίλιππον ὁρῶ γιγνομένους, τὰ δὲ πράγματ᾿ + εἰς τοῦτο προήκοντα, ὥσθ᾿ ὅπως μὴ πεισόμεθ᾿ αὐτοὶ + πρότερον κακῶς σκέψασθαι δέον. οὐδέν οὖν ἄλλο μοι δοκοῦσιν + οἱ τὰ τοιαῦτα λέγοντες ἢ τὴν ὑπόθεσιν, περὶ ἧς βουλεύεσθαι, + οὐχὶ τὴν οὖσαν παριστάντες ὑμῖν ἁμαρτάνειν. ἐγὼ δέ, ὅτι μέν + ποτ᾿ ἐξῆν τῇ πόλει καὶ τὰ αὑτῆς ἔχειν ἀσφαλῶς καὶ Φίλιππον + τιμωρήσασθαι, καὶ μάλ᾿ ἀκριβῶς οἶδα· ἐπ᾿ ἐμοῦ γάρ, οὐ πάλαι + γέγονεν ταῦτ᾿ ἀμφότερα· νῦν μέντοι πέπεισμαι τοῦθ᾿ ἱκανὸν + προλαβεῖν ἡμῖν εἶναι τὴν πρώτην, ὅπως τοὺς συμμάχους + σώσομεν. ἐὰν γὰρ τοῦτο βεβαίως ὑπάρξῃ, τότε καὶ περὶ τοῦ + τίνα τιμωρήσεταί τις καὶ ὃν τρόπον ἐξέσται σκοπεῖν· πρὶν δὲ + τὴν ἀρχὴν ὀρθῶς ὑποθέσθαι, μάταιον ἡγοῦμαι περὶ τῆς + τελευτῆς ὁντινοῦν ποιεῖσθαι λόγον. + + Δημοσθένους, Γ´ ᾿Ολυνθιακὸς + +Georgian: + + From a Unicode conference invitation: + + გთხოვთ ახლავე გაიაროთ რეგისტრაცია Unicode-ის მეათე საერთაშორისო + კონფერენციაზე დასასწრებად, რომელიც გაიმართება 10-12 მარტს, + ქ. მაინცში, გერმანიაში. კონფერენცია შეჰკრებს ერთად მსოფლიოს + ექსპერტებს ისეთ დარგებში როგორიცაა ინტერნეტი და Unicode-ი, + ინტერნაციონალიზაცია და ლოკალიზაცია, Unicode-ის გამოყენება + ოპერაციულ სისტემებსა, და გამოყენებით პროგრამებში, შრიფტებში, + ტექსტების დამუშავებასა და მრავალენოვან კომპიუტერულ სისტემებში. + +Russian: + + From a Unicode conference invitation: + + Зарегистрируйтесь сейчас на Десятую Международную Конференцию по + Unicode, которая состоится 10-12 марта 1997 года в Майнце в Германии. + Конференция соберет широкий круг экспертов по вопросам глобального + Интернета и Unicode, локализации и интернационализации, воплощению и + применению Unicode в различных операционных системах и программных + приложениях, шрифтах, верстке и многоязычных компьютерных системах. + +Thai (UCS Level 2): + + Excerpt from a poetry on The Romance of The Three Kingdoms (a Chinese + classic 'San Gua'): + + [----------------------------|------------------------] + ๏ แผ่นดินฮั่นเสื่อมโทรมแสนสังเวช พระปกเกศกองบู๊กู้ขึ้นใหม่ + สิบสองกษัตริย์ก่อนหน้าแลถัดไป สององค์ไซร้โง่เขลาเบาปัญญา + ทรงนับถือขันทีเป็นที่พึ่ง บ้านเมืองจึงวิปริตเป็นนักหนา + โฮจิ๋นเรียกทัพทั่วหัวเมืองมา หมายจะฆ่ามดชั่วตัวสำคัญ + เหมือนขับไสไล่เสือจากเคหา รับหมาป่าเข้ามาเลยอาสัญ + ฝ่ายอ้องอุ้นยุแยกให้แตกกัน ใช้สาวนั้นเป็นชนวนชื่นชวนใจ + พลันลิฉุยกุยกีกลับก่อเหตุ ช่างอาเพศจริงหนาฟ้าร้องไห้ + ต้องรบราฆ่าฟันจนบรรลัย ฤๅหาใครค้ำชูกู้บรรลังก์ ฯ + + (The above is a two-column text. If combining characters are handled + correctly, the lines of the second column should be aligned with the + | character above.) + +Ethiopian: + + Proverbs in the Amharic language: + + ሰማይ አይታረስ ንጉሥ አይከሰስ። + ብላ ካለኝ እንደአባቴ በቆመጠኝ። + ጌጥ ያለቤቱ ቁምጥና ነው። + ደሀ በሕልሙ ቅቤ ባይጠጣ ንጣት በገደለው። + የአፍ ወለምታ በቅቤ አይታሽም። + አይጥ በበላ ዳዋ ተመታ። + ሲተረጉሙ ይደረግሙ። + ቀስ በቀስ፥ ዕንቁላል በእግሩ ይሄዳል። + ድር ቢያብር አንበሳ ያስር። + ሰው እንደቤቱ እንጅ እንደ ጉረቤቱ አይተዳደርም። + እግዜር የከፈተውን ጉሮሮ ሳይዘጋው አይድርም። + የጎረቤት ሌባ፥ ቢያዩት ይስቅ ባያዩት ያጠልቅ። + ሥራ ከመፍታት ልጄን ላፋታት። + ዓባይ ማደሪያ የለው፥ ግንድ ይዞ ይዞራል። + የእስላም አገሩ መካ የአሞራ አገሩ ዋርካ። + ተንጋሎ ቢተፉ ተመልሶ ባፉ። + ወዳጅህ ማር ቢሆን ጨርስህ አትላሰው። + እግርህን በፍራሽህ ልክ ዘርጋ። + +Runes: + + ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ + + (Old English, which transcribed into Latin reads 'He cwaeth that he + bude thaem lande northweardum with tha Westsae.' and means 'He said + that he lived in the northern land near the Western Sea.') + +Braille: + + ⡌⠁⠧⠑ ⠼⠁⠒ ⡍⠜⠇⠑⠹⠰⠎ ⡣⠕⠌ + + ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠙⠑⠁⠙⠒ ⠞⠕ ⠃⠑⠛⠔ ⠺⠊⠹⠲ ⡹⠻⠑ ⠊⠎ ⠝⠕ ⠙⠳⠃⠞ + ⠱⠁⠞⠑⠧⠻ ⠁⠃⠳⠞ ⠹⠁⠞⠲ ⡹⠑ ⠗⠑⠛⠊⠌⠻ ⠕⠋ ⠙⠊⠎ ⠃⠥⠗⠊⠁⠇ ⠺⠁⠎ + ⠎⠊⠛⠝⠫ ⠃⠹ ⠹⠑ ⠊⠇⠻⠛⠹⠍⠁⠝⠂ ⠹⠑ ⠊⠇⠻⠅⠂ ⠹⠑ ⠥⠝⠙⠻⠞⠁⠅⠻⠂ + ⠁⠝⠙ ⠹⠑ ⠡⠊⠑⠋ ⠍⠳⠗⠝⠻⠲ ⡎⠊⠗⠕⠕⠛⠑ ⠎⠊⠛⠝⠫ ⠊⠞⠲ ⡁⠝⠙ + ⡎⠊⠗⠕⠕⠛⠑⠰⠎ ⠝⠁⠍⠑ ⠺⠁⠎ ⠛⠕⠕⠙ ⠥⠏⠕⠝ ⠰⡡⠁⠝⠛⠑⠂ ⠋⠕⠗ ⠁⠝⠹⠹⠔⠛ ⠙⠑ + ⠡⠕⠎⠑ ⠞⠕ ⠏⠥⠞ ⠙⠊⠎ ⠙⠁⠝⠙ ⠞⠕⠲ + + ⡕⠇⠙ ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲ + + ⡍⠔⠙⠖ ⡊ ⠙⠕⠝⠰⠞ ⠍⠑⠁⠝ ⠞⠕ ⠎⠁⠹ ⠹⠁⠞ ⡊ ⠅⠝⠪⠂ ⠕⠋ ⠍⠹ + ⠪⠝ ⠅⠝⠪⠇⠫⠛⠑⠂ ⠱⠁⠞ ⠹⠻⠑ ⠊⠎ ⠏⠜⠞⠊⠊⠥⠇⠜⠇⠹ ⠙⠑⠁⠙ ⠁⠃⠳⠞ + ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲ ⡊ ⠍⠊⠣⠞ ⠙⠁⠧⠑ ⠃⠑⠲ ⠔⠊⠇⠔⠫⠂ ⠍⠹⠎⠑⠇⠋⠂ ⠞⠕ + ⠗⠑⠛⠜⠙ ⠁ ⠊⠕⠋⠋⠔⠤⠝⠁⠊⠇ ⠁⠎ ⠹⠑ ⠙⠑⠁⠙⠑⠌ ⠏⠊⠑⠊⠑ ⠕⠋ ⠊⠗⠕⠝⠍⠕⠝⠛⠻⠹ + ⠔ ⠹⠑ ⠞⠗⠁⠙⠑⠲ ⡃⠥⠞ ⠹⠑ ⠺⠊⠎⠙⠕⠍ ⠕⠋ ⠳⠗ ⠁⠝⠊⠑⠌⠕⠗⠎ + ⠊⠎ ⠔ ⠹⠑ ⠎⠊⠍⠊⠇⠑⠆ ⠁⠝⠙ ⠍⠹ ⠥⠝⠙⠁⠇⠇⠪⠫ ⠙⠁⠝⠙⠎ + ⠩⠁⠇⠇ ⠝⠕⠞ ⠙⠊⠌⠥⠗⠃ ⠊⠞⠂ ⠕⠗ ⠹⠑ ⡊⠳⠝⠞⠗⠹⠰⠎ ⠙⠕⠝⠑ ⠋⠕⠗⠲ ⡹⠳ + ⠺⠊⠇⠇ ⠹⠻⠑⠋⠕⠗⠑ ⠏⠻⠍⠊⠞ ⠍⠑ ⠞⠕ ⠗⠑⠏⠑⠁⠞⠂ ⠑⠍⠏⠙⠁⠞⠊⠊⠁⠇⠇⠹⠂ ⠹⠁⠞ + ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲ + + (The first couple of paragraphs of "A Christmas Carol" by Dickens) + +Compact font selection example text: + + ABCDEFGHIJKLMNOPQRSTUVWXYZ /0123456789 + abcdefghijklmnopqrstuvwxyz £©µÀÆÖÞßéöÿ + –—‘“”„†•…‰™œŠŸž€ ΑΒΓΔΩαβγδω АБВГДабвгд + ∀∂∈ℝ∧∪≡∞ ↑↗↨↻⇣ ┐┼╔╘░►☺♀ fi�⑀₂ἠḂӥẄɐː⍎אԱა + +Greetings in various languages: + + Hello world, Καλημέρα κόσμε, コンニチハ + +Box drawing alignment tests: █ + ▉ + ╔══╦══╗ ┌──┬──┐ ╭──┬──╮ ╭──┬──╮ ┏━━┳━━┓ ┎┒┏┑ ╷ ╻ ┏┯┓ ┌┰┐ ▊ ╱╲╱╲╳╳╳ + ║┌─╨─┐║ │╔═╧═╗│ │╒═╪═╕│ │╓─╁─╖│ ┃┌─╂─┐┃ ┗╃╄┙ ╶┼╴╺╋╸┠┼┨ ┝╋┥ ▋ ╲╱╲╱╳╳╳ + ║│╲ ╱│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╿ │┃ ┍╅╆┓ ╵ ╹ ┗┷┛ └┸┘ ▌ ╱╲╱╲╳╳╳ + ╠╡ ╳ ╞╣ ├╢ ╟┤ ├┼─┼─┼┤ ├╫─╂─╫┤ ┣┿╾┼╼┿┫ ┕┛┖┚ ┌┄┄┐ ╎ ┏┅┅┓ ┋ ▍ ╲╱╲╱╳╳╳ + ║│╱ ╲│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╽ │┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▎ + ║└─╥─┘║ │╚═╤═╝│ │╘═╪═╛│ │╙─╀─╜│ ┃└─╂─┘┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▏ + ╚══╩══╝ └──┴──┘ ╰──┴──╯ ╰──┴──╯ ┗━━┻━━┛ ▗▄▖▛▀▜ └╌╌┘ ╎ ┗╍╍┛ ┋ ▁▂▃▄▅▆▇█ + ▝▀▘▙▄▟ diff --git a/vendor/pdcurses/demos/firework.c b/vendor/pdcurses/demos/firework.c new file mode 100644 index 0000000..d9f40f4 --- /dev/null +++ b/vendor/pdcurses/demos/firework.c @@ -0,0 +1,145 @@ +#include +#include +#include + +#define DELAYSIZE 200 + +void myrefresh(void); +void get_color(void); +void explode(int, int); + +short color_table[] = +{ + COLOR_RED, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN, + COLOR_RED, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE +}; + +int main(int argc, char **argv) +{ + time_t seed; + int start, end, row, diff, flag, direction; + short i; + +#ifdef XCURSES + Xinitscr(argc, argv); +#else + initscr(); +#endif + keypad(stdscr, TRUE); + nodelay(stdscr, TRUE); + noecho(); + + if (has_colors()) + start_color(); + + for (i = 0; i < 8; i++) + init_pair(i, color_table[i], COLOR_BLACK); + + seed = time((time_t *)0); + srand(seed); + flag = 0; + + while (getch() == ERR) /* loop until a key is hit */ + { + do { + start = rand() % (COLS - 3); + end = rand() % (COLS - 3); + start = (start < 2) ? 2 : start; + end = (end < 2) ? 2 : end; + direction = (start > end) ? -1 : 1; + diff = abs(start - end); + + } while (diff < 2 || diff >= LINES - 2); + + attrset(A_NORMAL); + + for (row = 0; row < diff; row++) + { + mvaddstr(LINES - row, row * direction + start, + (direction < 0) ? "\\" : "/"); + + if (flag++) + { + myrefresh(); + erase(); + flag = 0; + } + } + + if (flag++) + { + myrefresh(); + flag = 0; + } + + explode(LINES - row, diff * direction + start); + erase(); + myrefresh(); + } + + endwin(); + + return 0; +} + +void explode(int row, int col) +{ + erase(); + mvaddstr(row, col, "-"); + myrefresh(); + + --col; + + get_color(); + mvaddstr(row - 1, col, " - "); + mvaddstr(row, col, "-+-"); + mvaddstr(row + 1, col, " - "); + myrefresh(); + + --col; + + get_color(); + mvaddstr(row - 2, col, " --- "); + mvaddstr(row - 1, col, "-+++-"); + mvaddstr(row, col, "-+#+-"); + mvaddstr(row + 1, col, "-+++-"); + mvaddstr(row + 2, col, " --- "); + myrefresh(); + + get_color(); + mvaddstr(row - 2, col, " +++ "); + mvaddstr(row - 1, col, "++#++"); + mvaddstr(row, col, "+# #+"); + mvaddstr(row + 1, col, "++#++"); + mvaddstr(row + 2, col, " +++ "); + myrefresh(); + + get_color(); + mvaddstr(row - 2, col, " # "); + mvaddstr(row - 1, col, "## ##"); + mvaddstr(row, col, "# #"); + mvaddstr(row + 1, col, "## ##"); + mvaddstr(row + 2, col, " # "); + myrefresh(); + + get_color(); + mvaddstr(row - 2, col, " # # "); + mvaddstr(row - 1, col, "# #"); + mvaddstr(row, col, " "); + mvaddstr(row + 1, col, "# #"); + mvaddstr(row + 2, col, " # # "); + myrefresh(); +} + +void myrefresh(void) +{ + napms(DELAYSIZE); + move(LINES - 1, COLS - 1); + refresh(); +} + +void get_color(void) +{ + chtype bold = (rand() % 2) ? A_BOLD : A_NORMAL; + attrset(COLOR_PAIR(rand() % 8) | bold); +} diff --git a/vendor/pdcurses/demos/nctests.mif b/vendor/pdcurses/demos/nctests.mif new file mode 100644 index 0000000..f967dfd --- /dev/null +++ b/vendor/pdcurses/demos/nctests.mif @@ -0,0 +1,34 @@ +# This provides for compiling and linking the ncurses test programs. + +ncurses_testdir = $(HOME)/ncurses-6.4/test + +NCURSES_TESTS = bs$(E) gdc$(E) hanoi$(E) knight$(E) tclock$(E) \ +lrtest$(E) ncurses$(E) + +ncurses_tests: $(NCURSES_TESTS) + +ncurses_clean: + -rm -f *.$(O) trace $(NCURSES_TESTS) + +NCFLAGS = $(DEMOFLAGS) -I$(demodir) -I$(ncurses_testdir) + +bs$(E): $(ncurses_testdir)/bs.c + $(BUILD) $(NCFLAGS) -o $@ $< $(LDFLAGS) + +gdc$(E): $(ncurses_testdir)/gdc.c + $(BUILD) $(NCFLAGS) -o $@ $< $(LDFLAGS) + +hanoi$(E): $(ncurses_testdir)/hanoi.c + $(BUILD) $(NCFLAGS) -o $@ $< $(LDFLAGS) -lm + +knight$(E): $(ncurses_testdir)/knight.c + $(BUILD) $(NCFLAGS) -o $@ $< $(LDFLAGS) + +tclock$(E): $(ncurses_testdir)/tclock.c + $(BUILD) $(NCFLAGS) -o $@ $< $(LDFLAGS) -lm + +lrtest$(E): $(ncurses_testdir)/lrtest.c + $(BUILD) $(NCFLAGS) -o $@ $< $(LDFLAGS) + +ncurses$(E): $(ncurses_testdir)/ncurses.c + $(BUILD) $(NCFLAGS) -o $@ $< $(LDFLAGS) diff --git a/vendor/pdcurses/demos/ncurses_cfg.h b/vendor/pdcurses/demos/ncurses_cfg.h new file mode 100644 index 0000000..2b650e7 --- /dev/null +++ b/vendor/pdcurses/demos/ncurses_cfg.h @@ -0,0 +1,65 @@ +/* This file is only used with the ncurses test programs. + * + * Have ncurses-6.4 unpacked in your $(HOME) (you don't need to build + * it), or edit ncurses_testdir appropriately in the Makefile or + * nctests.mif. Configure and build PDCurses, and: + * + * "make ncurses_tests" to start. + * "make ncurses_clean" when you're done. + * + * Builds: bs gdc hanoi knight tclock ncurses + */ + +#define PDC_NCMOUSE +#define DATA_DIR "." +#define NCURSES_CONST +#define NCURSES_EXPORT(foo) foo +#define popup_msg(bar, baz) + +#define RETSIGTYPE void +#define TIME_WITH_SYS_TIME 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_SYS_TIME_SELECT 1 +#define HAVE_UNISTD_H 1 +#define HAVE_TERMATTRS 1 + +#include + +#define ExitProgram exit + +#define HAVE_ASSUME_DEFAULT_COLORS 1 +#define HAVE_CURSES_VERSION 1 +#define HAVE_GETBEGX 1 +#define HAVE_GETCURX 1 +#define HAVE_GETMAXX 1 +#define HAVE_GETNSTR 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_GETWIN 1 +#define HAVE_HALFDELAY 1 +#define HAVE_LIBPANEL 1 +#define HAVE_LOCALE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_NAPMS 1 +#define HAVE_NEWPAD 1 +#define HAVE_PANEL_H 1 +#define HAVE_PUTWIN 1 +#define HAVE_SLK_COLOR 1 +#define HAVE_SLK_INIT 1 +#define HAVE_STRSTR 1 +#define HAVE_USE_DEFAULT_COLORS 1 +#define HAVE_WRESIZE 1 +#define USE_STRING_HACKS 1 + +#ifdef PDC_WIDE +# define USE_WIDEC_SUPPORT 1 +# define HAVE_WCSRTOMBS 1 +# define HAVE_MBSRTOWCS 1 +# define HAVE_MBRTOWC 1 +# define HAVE_MBRLEN 1 +#endif + +/* Fool ncurses.c so it gives us all the tests, and doesn't redefine + ACS_ chars +*/ + +#define NCURSES_VERSION PDCURSES diff --git a/vendor/pdcurses/demos/ozdemo.c b/vendor/pdcurses/demos/ozdemo.c new file mode 100644 index 0000000..217fe4f --- /dev/null +++ b/vendor/pdcurses/demos/ozdemo.c @@ -0,0 +1,435 @@ +/* + * ozdemo.c - A demo program using PDCurses. The program + * (formerly newdemo) illustrates the use of colors for text output. + */ + +#include +#include +#include +#include +#include + +int WaitForUser(void); +int SubWinTest(WINDOW *); +int BouncingBalls(WINDOW *); +void trap(int); + +/* An ASCII map of Australia */ + +char *AusMap[17] = +{ + " A ", + " AA AA ", + " N.T. AAAAA AAAA ", + " AAAAAAAAAAA AAAAAAAA ", + " AAAAAAAAAAAAAAAAAAAAAAAAA Qld.", + " AAAAAAAAAAAAAAAAAAAAAAAAAAAA ", + " AAAAAAAAAAAAAAAAAAAAAAAAAAAAA ", + " AAAAAAAAAAAAAAAAAAAAAAAAAAAA ", + " AAAAAAAAAAAAAAAAAAAAAAAAA N.S.W.", + "W.A. AAAAAAAAA AAAAAA Vic.", + " AAA S.A. AA", + " A Tas.", + "" +}; + +/* Funny messages for the scroller */ + +char *messages[] = +{ + "Hello from the Land Down Under", + "The Land of crocs, and a big Red Rock", + "Where the sunflower runs along the highways", + "The dusty red roads lead one to loneliness", + "Blue sky in the morning and", + "Freezing nights and twinkling stars", + NULL +}; + +int WaitForUser(void) +{ + chtype ch; + + nodelay(stdscr, TRUE); + halfdelay(50); + + ch = getch(); + + nodelay(stdscr, FALSE); + nocbreak(); /* Reset the halfdelay() value */ + cbreak(); + + return (ch == '\033') ? ch : 0; +} + +int SubWinTest(WINDOW *win) +{ + WINDOW *swin1, *swin2, *swin3; + int w, h, sw, sh, bx, by; + + wattrset(win, 0); + getmaxyx(win, h, w); + getbegyx(win, by, bx); + + sw = w / 3; + sh = h / 3; + + if ((swin1 = derwin(win, sh, sw, 3, 5)) == NULL) + return 1; + if ((swin2 = subwin(win, sh, sw, by + 4, bx + 8)) == NULL) + return 1; + if ((swin3 = subwin(win, sh, sw, by + 5, bx + 11)) == NULL) + return 1; + + init_pair(8, COLOR_RED, COLOR_BLUE); + wbkgd(swin1, COLOR_PAIR(8)); + werase(swin1); + mvwaddstr(swin1, 0, 3, "Sub-window 1"); + wrefresh(swin1); + + init_pair(9, COLOR_CYAN, COLOR_MAGENTA); + wbkgd(swin2, COLOR_PAIR(9)); + werase(swin2); + mvwaddstr(swin2, 0, 3, "Sub-window 2"); + wrefresh(swin2); + + init_pair(10, COLOR_YELLOW, COLOR_GREEN); + wbkgd(swin3, COLOR_PAIR(10)); + werase(swin3); + mvwaddstr(swin3, 0, 3, "Sub-window 3"); + wrefresh(swin3); + + delwin(swin1); + delwin(swin2); + delwin(swin3); + WaitForUser(); + + return 0; +} + +int BouncingBalls(WINDOW *win) +{ + chtype c1, c2, c3, ball1, ball2, ball3; + int w, h, x1, y1, xd1, yd1, x2, y2, xd2, yd2, x3, y3, xd3, yd3, c; + + curs_set(0); + + wbkgd(win, COLOR_PAIR(1)); + wrefresh(win); + wattrset(win, 0); + + init_pair(11, COLOR_RED, COLOR_GREEN); + init_pair(12, COLOR_BLUE, COLOR_RED); + init_pair(13, COLOR_YELLOW, COLOR_WHITE); + + ball1 = 'O' | COLOR_PAIR(11); + ball2 = '*' | COLOR_PAIR(12); + ball3 = '@' | COLOR_PAIR(13); + + getmaxyx(win, h, w); + + x1 = 2 + rand() % (w - 4); + y1 = 2 + rand() % (h - 4); + x2 = 2 + rand() % (w - 4); + y2 = 2 + rand() % (h - 4); + x3 = 2 + rand() % (w - 4); + y3 = 2 + rand() % (h - 4); + + xd1 = 1; + yd1 = 1; + xd2 = 1; + yd2 = -1; + xd3 = -1; + yd3 = 1; + + nodelay(stdscr, TRUE); + + while ((c = getch()) == ERR) + { + x1 += xd1; + if (x1 <= 1 || x1 >= w - 2) + xd1 *= -1; + + y1 += yd1; + if (y1 <= 1 || y1 >= h - 2) + yd1 *= -1; + + x2 += xd2; + if (x2 <= 1 || x2 >= w - 2) + xd2 *= -1; + + y2 += yd2; + if (y2 <= 1 || y2 >= h - 2) + yd2 *= -1; + + x3 += xd3; + if (x3 <= 1 || x3 >= w - 2) + xd3 *= -1; + + y3 += yd3; + if (y3 <= 1 || y3 >= h - 2) + yd3 *= -1; + + c1 = mvwinch(win, y1, x1); + c2 = mvwinch(win, y2, x2); + c3 = mvwinch(win, y3, x3); + + mvwaddch(win, y1, x1, ball1); + mvwaddch(win, y2, x2, ball2); + mvwaddch(win, y3, x3, ball3); + + wmove(win, 0, 0); + wrefresh(win); + + mvwaddch(win, y1, x1, c1); + mvwaddch(win, y2, x2, c2); + mvwaddch(win, y3, x3, c3); + + napms(150); + } + + nodelay(stdscr, FALSE); + ungetch(c); + return 0; +} + +/* Trap interrupt */ + +void trap(int sig) +{ + if (sig == SIGINT) + { + endwin(); + + exit(0); + } +} + +int main(int argc, char **argv) +{ + WINDOW *win; + chtype save[80], ch; + time_t seed; + int width, height, w, x, y, i, j; + +#ifdef XCURSES + Xinitscr(argc, argv); +#else + initscr(); +#endif + seed = time((time_t *)0); + srand(seed); + + start_color(); +# if defined(NCURSES_VERSION) || (defined(PDC_BUILD) && PDC_BUILD > 3000) + use_default_colors(); +# endif + cbreak(); + noecho(); + + curs_set(0); + +#if !defined(__TURBOC__) && !defined(OS2) + signal(SIGINT, trap); +#endif + noecho(); + + /* refresh stdscr so that reading from it will not cause it to + overwrite the other windows that are being created */ + + refresh(); + + /* Create a drawing window */ + + width = 48; + height = 15; + + win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2); + + if (win == NULL) + { + endwin(); + + return 1; + } + + for (;;) + { + init_pair(1, COLOR_WHITE, COLOR_BLUE); + wbkgd(win, COLOR_PAIR(1)); + werase(win); + + init_pair(2, COLOR_RED, COLOR_RED); + wattrset(win, COLOR_PAIR(2)); + box(win, ' ', ' '); + wrefresh(win); + + wattrset(win, 0); + + /* Do random output of a character */ + + ch = 'a'; + + nodelay(stdscr, TRUE); + + for (i = 0; i < 5000; ++i) + { + x = rand() % (width - 2) + 1; + y = rand() % (height - 2) + 1; + + mvwaddch(win, y, x, ch); + wrefresh(win); + + if (getch() != ERR) + break; + + if (i == 2000) + { + ch = 'b'; + init_pair(3, COLOR_CYAN, COLOR_YELLOW); + wattrset(win, COLOR_PAIR(3)); + } + } + + nodelay(stdscr, FALSE); + + SubWinTest(win); + + /* Erase and draw green window */ + + init_pair(4, COLOR_YELLOW, COLOR_GREEN); + wbkgd(win, COLOR_PAIR(4)); + wattrset(win, A_BOLD); + werase(win); + wrefresh(win); + + /* Draw RED bounding box */ + + wattrset(win, COLOR_PAIR(2)); + box(win, ' ', ' '); + wrefresh(win); + + /* Display Australia map */ + + wattrset(win, A_BOLD); + i = 0; + + while (*AusMap[i]) + { + mvwaddstr(win, i + 1, 8, AusMap[i]); + wrefresh(win); + napms(100); + ++i; + } + + init_pair(5, COLOR_BLUE, COLOR_WHITE); + wattrset(win, COLOR_PAIR(5) | A_BLINK); + mvwaddstr(win, height - 2, +#ifdef PDC_VERDOT + 2, " PDCurses " PDC_VERDOT +#else + 3, " PDCurses" +#endif + " - DOS, OS/2, Windows, X11, SDL"); + wrefresh(win); + + /* Draw running messages */ + + init_pair(6, COLOR_BLACK, COLOR_WHITE); + wattrset(win, COLOR_PAIR(6)); + w = width - 2; + nodelay(win, TRUE); + + mvwhline(win, height / 2, 1, ' ', w); + + for (j = 0; messages[j] != NULL; j++) + { + char *message = messages[j]; + int msg_len = strlen(message); + int stop = 0; + int xpos, start, count; + + for (i = 0; i <= w + msg_len; i++) + { + if (i < w) + { + xpos = w - i; + start = 0; + count = (i > msg_len) ? msg_len : i; + } + else + { + xpos = 0; + start = i - w; + count = (w > msg_len - start) ? msg_len - start : w; + } + + mvwaddnstr(win, height / 2, xpos + 1, message + start, count); + if (xpos + count < w) + waddstr(win, " "); + + wrefresh(win); + + if (wgetch(win) != ERR) + { + flushinp(); + stop = 1; + break; + } + + napms(100); + } + + if (stop) + break; + } + + j = 0; + + /* Draw running 'A's across in RED */ + + init_pair(7, COLOR_RED, COLOR_GREEN); + wattron(win, COLOR_PAIR(7)); + + for (i = 2; i < width - 4; ++i) + { + ch = mvwinch(win, 5, i); + save[j++] = ch; + ch = ch & 0x7f; + mvwaddch(win, 5, i, ch); + } + + wrefresh(win); + + /* Put a message up; wait for a key */ + + i = height - 2; + wattrset(win, COLOR_PAIR(5)); + mvwaddstr(win, i, 2, + " Type a key to continue or ESC to quit "); + wrefresh(win); + + if (WaitForUser() == '\033') + break; + + /* Restore the old line */ + + wattrset(win, 0); + + for (i = 2, j = 0; i < width - 4; ++i) + mvwaddch(win, 5, i, save[j++]); + + wrefresh(win); + + BouncingBalls(win); + + /* BouncingBalls() leaves a keystroke in the queue */ + + if (WaitForUser() == '\033') + break; + } + + endwin(); + + return 0; +} diff --git a/vendor/pdcurses/demos/pdcurses.lib b/vendor/pdcurses/demos/pd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-HWdn*A5aByBfP@P78gP+h>nNgxs>Lo+Q&j-8Wf786s0f|RWHHlRvWF}) z29A(Y{#Xn}z}pho;r?3McM>`H|0QE7=A>7QouGbOwU2I0fTe~A+lzu6xBWn8^%~Di z+tSVZ)em@%w6sHRUa&0?5I_I$<)W__=ux3OP)Z*=9i0T#%R%%%GGi`ZxaOD#2hI4| zs-{MCFYY{pzQ(l+uC}8v&pg;SuJ|UbD;6zl+pnQVdTKSut|#r%#5@ku75QNnYCSSX z_-;s;paUkTE8&E|W~GNz0IWNM0l#&Zq{EJ(3rS5+RDf7t4?LfYuY`HD#0S;}kRw>S2mj(z)jT31SfQmq z(M(`hO%RIdsRKPpP$>8+)D<^ZppIJ>tnK0kbOR~;I$!{HO*T+O&*di&)8*SrsT(;% z7*l1in^EEm4h+lbumgNOe}2J?`kddI3tkyGf$|@vhBc4PlL@nMap}Xkme;$?c%7Mw zc9@;1<7c)t?`y5hHTKOY*OYw!N+mPYbfK>n#v;eeA zEC{7DL|dq~;dI80<3M@q?65g5XmeElhzt|}L4Wq#eU-c!W%QgCr~ zca7xa=Dw&` +#include +#include + +PANEL *p1, *p2, *p3, *p4, *p5; +WINDOW *w4, *w5; + +long nap_msec = 1; + +char *mod[] = +{ + "test ", "TEST ", "(**) ", "*()* ", "<--> ", "LAST " +}; + +void pflush(void) +{ + update_panels(); + doupdate(); +} + +void sizecheck(void) +{ + if (COLS < 70 || LINES < 23) + { + printw("A window at least 70x23 is required for this demo"); + refresh(); + napms(5000); + endwin(); + exit(-1); + } +} + +void backfill(void) +{ + int y, x; + + erase(); + + for (y = 0; y < LINES - 1; y++) + for (x = 0; x < COLS; x++) + printw("%d", (y + x) % 10); +} + +void wait_a_while(long msec) +{ + int c; + + if (msec != 1) + timeout(msec); + + c = getch(); + +#ifdef KEY_RESIZE + while (c == KEY_RESIZE || (msec == 1 && c == ERR)) + { +# ifdef PDCURSES + resize_term(0, 0); +# endif + sizecheck(); + backfill(); + pflush(); + c = getch(); + } +#endif + + if (c == 'q') + { + endwin(); + exit(1); + } +} + +void saywhat(const char *text) +{ + mvprintw(LINES - 1, 0, "%-20.20s", text); +} + +/* mkpanel - alloc a win and panel and associate them */ + +PANEL *mkpanel(int rows, int cols, int tly, int tlx) +{ + WINDOW *win = newwin(rows, cols, tly, tlx); + PANEL *pan = (PANEL *)0; + + if (win) + { + pan = new_panel(win); + + if (!pan) + delwin(win); + } + + return pan; +} + +void rmpanel(PANEL *pan) +{ + WINDOW *win = pan->win; + + del_panel(pan); + delwin(win); +} + +void fill_panel(PANEL *pan) +{ + WINDOW *win = pan->win; + char num = *((char *)pan->user + 1); + int y, x, maxy, maxx; + + box(win, 0, 0); + mvwprintw(win, 1, 1, "-pan%c-", num); + getmaxyx(win, maxy, maxx); + + for (y = 2; y < maxy - 1; y++) + for (x = 1; x < maxx - 1; x++) + mvwaddch(win, y, x, num); +} + +int main(int argc, char **argv) +{ + int itmp, y; + + if (argc > 1 && atol(argv[1])) + nap_msec = atol(argv[1]); + +#ifdef XCURSES + Xinitscr(argc, argv); +#else + initscr(); +#endif + + keypad(stdscr, TRUE); + sizecheck(); + backfill(); + + for (y = 0; y < 5; y++) + { + p1 = mkpanel(10, 10, 0, 0); + set_panel_userptr(p1, "p1"); + + p2 = mkpanel(14, 14, 5, 5); + set_panel_userptr(p2, "p2"); + + p3 = mkpanel(6, 8, 12, 12); + set_panel_userptr(p3, "p3"); + + p4 = mkpanel(10, 10, 10, 30); + w4 = panel_window(p4); + set_panel_userptr(p4, "p4"); + + p5 = mkpanel(10, 10, 13, 37); + w5 = panel_window(p5); + set_panel_userptr(p5, "p5"); + + fill_panel(p1); + fill_panel(p2); + fill_panel(p3); + fill_panel(p4); + fill_panel(p5); + hide_panel(p4); + hide_panel(p5); + pflush(); + wait_a_while(nap_msec); + + saywhat("h3 s1 s2 s4 s5;"); + move_panel(p1, 0, 0); + hide_panel(p3); + show_panel(p1); + show_panel(p2); + show_panel(p4); + show_panel(p5); + pflush(); + wait_a_while(nap_msec); + + saywhat("s1;"); + show_panel(p1); + pflush(); + wait_a_while(nap_msec); + + saywhat("s2;"); + show_panel(p2); + pflush(); + wait_a_while(nap_msec); + + saywhat("m2;"); + move_panel(p2, 10, 10); + pflush(); + wait_a_while(nap_msec); + + saywhat("s3;"); + show_panel(p3); + pflush(); + wait_a_while(nap_msec); + + saywhat("m3;"); + move_panel(p3, 5, 5); + pflush(); + wait_a_while(nap_msec); + + saywhat("b3;"); + bottom_panel(p3); + pflush(); + wait_a_while(nap_msec); + + saywhat("s4;"); + show_panel(p4); + pflush(); + wait_a_while(nap_msec); + + saywhat("s5;"); + show_panel(p5); + pflush(); + wait_a_while(nap_msec); + + saywhat("t3;"); + top_panel(p3); + pflush(); + wait_a_while(nap_msec); + + saywhat("t1;"); + top_panel(p1); + pflush(); + wait_a_while(nap_msec); + + saywhat("t2;"); + top_panel(p2); + pflush(); + wait_a_while(nap_msec); + + saywhat("t3;"); + top_panel(p3); + pflush(); + wait_a_while(nap_msec); + + saywhat("t4;"); + top_panel(p4); + pflush(); + wait_a_while(nap_msec); + + for (itmp = 0; itmp < 6; itmp++) + { + saywhat("m4;"); + mvwaddstr(w4, 3, 1, mod[itmp]); + move_panel(p4, 4, itmp * 10); + mvwaddstr(w5, 4, 1, mod[itmp]); + pflush(); + wait_a_while(nap_msec); + + saywhat("m5;"); + mvwaddstr(w4, 4, 1, mod[itmp]); + move_panel(p5, 7, itmp * 10 + 6); + mvwaddstr(w5, 3, 1, mod[itmp]); + pflush(); + wait_a_while(nap_msec); + } + + saywhat("m4;"); + move_panel(p4, 4, itmp * 10); + pflush(); + wait_a_while(nap_msec); + + saywhat("t5;"); + top_panel(p5); + pflush(); + wait_a_while(nap_msec); + + saywhat("t2;"); + top_panel(p2); + pflush(); + wait_a_while(nap_msec); + + saywhat("t1;"); + top_panel(p1); + pflush(); + wait_a_while(nap_msec); + + saywhat("d2;"); + rmpanel(p2); + pflush(); + wait_a_while(nap_msec); + + saywhat("h3;"); + hide_panel(p3); + pflush(); + wait_a_while(nap_msec); + + saywhat("d1;"); + rmpanel(p1); + pflush(); + wait_a_while(nap_msec); + + saywhat("d4; "); + rmpanel(p4); + pflush(); + wait_a_while(nap_msec); + + saywhat("d5; "); + rmpanel(p5); + pflush(); + wait_a_while(nap_msec); + + if (nap_msec == 1) + break; + + nap_msec = 100L; + } + + endwin(); + + return 0; +} /* end of main */ diff --git a/vendor/pdcurses/demos/rain.c b/vendor/pdcurses/demos/rain.c new file mode 100644 index 0000000..98bfa70 --- /dev/null +++ b/vendor/pdcurses/demos/rain.c @@ -0,0 +1,157 @@ +/**************************************************************************** + * Copyright (c) 2002 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * 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 +#include +#include + +/* rain 1980-11-03 EPS/CITHEP */ + +static int next_j(int j) +{ + if (j == 0) + j = 4; + else + --j; + + if (has_colors()) + { + int z = rand() % 3; + chtype color = COLOR_PAIR(z); + + if (z) + color |= A_BOLD; + + attrset(color); + } + + return j; +} + +int main(int argc, char *argv[]) +{ + time_t seed; + int x, y, j, r, c; + static int xpos[5], ypos[5]; + +#ifdef XCURSES + Xinitscr(argc, argv); +#else + initscr(); +#endif + seed = time((time_t *)0); + srand(seed); + + if (has_colors()) + { + short bg = COLOR_BLACK; + + start_color(); + +#if defined(NCURSES_VERSION) || (defined(PDC_BUILD) && PDC_BUILD > 3000) + 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); + keypad(stdscr, TRUE); + + r = LINES - 4; + c = COLS - 4; + + for (j = 5; --j >= 0;) + { + xpos[j] = rand() % c + 2; + ypos[j] = rand() % r + 2; + } + + for (j = 0;;) + { + x = rand() % c + 2; + y = rand() % r + 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; + case 's': + nodelay(stdscr, FALSE); + break; + case ' ': + nodelay(stdscr, TRUE); +#ifdef KEY_RESIZE + break; + case KEY_RESIZE: +# ifdef PDCURSES + resize_term(0, 0); +# endif + r = LINES - 4; + c = COLS - 4; +#endif + } + napms(50); + } +} diff --git a/vendor/pdcurses/demos/testcurs.c b/vendor/pdcurses/demos/testcurs.c new file mode 100644 index 0000000..d41feb0 --- /dev/null +++ b/vendor/pdcurses/demos/testcurs.c @@ -0,0 +1,1382 @@ +/* + * This is a test program for PDCurses. Originally by + * John Burnell + * + * wrs (1993-05-28) -- modified to be consistent (perform identically) + * with either PDCurses or under Unix System V, R4 + */ + +#ifndef _XOPEN_SOURCE_EXTENDED +# define _XOPEN_SOURCE_EXTENDED 1 +#endif + +#include +#include +#include +#include + +#ifdef WACS_S1 +# define HAVE_WIDE 1 +#else +# define HAVE_WIDE 0 +#endif + +#include + +#if HAVE_WIDE +# include +#endif + +#if defined(PDCURSES) && !defined(XCURSES) +# define HAVE_RESIZE 1 +#else +# define HAVE_RESIZE 0 +#endif + +#ifdef A_COLOR +# define HAVE_COLOR 1 +#else +# define HAVE_COLOR 0 +#endif + +#ifdef PDCURSES +# define HAVE_CLIPBOARD 1 +#else +# define HAVE_CLIPBOARD 0 +#endif + +void inputTest(WINDOW *); +void scrollTest(WINDOW *); +void introTest(WINDOW *); +int initTest(WINDOW **, int, char **); +void outputTest(WINDOW *); +void padTest(WINDOW *); +void acsTest(WINDOW *); +void attrTest(WINDOW *); + +#if HAVE_COLOR +void colorTest(WINDOW *); +#endif + +#if HAVE_RESIZE +void resizeTest(WINDOW *); +#endif + +#if HAVE_CLIPBOARD +void clipboardTest(WINDOW *); +#endif + +#if HAVE_WIDE +void wideTest(WINDOW *); +#endif + +void display_menu(int, int); + +struct commands +{ + const char *text; + void (*function)(WINDOW *); +}; + +typedef struct commands COMMAND; + +#define MAX_OPTIONS (7 + HAVE_COLOR + HAVE_RESIZE + HAVE_CLIPBOARD + HAVE_WIDE) + +COMMAND command[MAX_OPTIONS] = +{ + {"Intro Test", introTest}, + {"Pad Test", padTest}, +#if HAVE_RESIZE + {"Resize Test", resizeTest}, +#endif + {"Scroll Test", scrollTest}, + {"Input Test", inputTest}, + {"Output Test", outputTest}, + {"ACS Test", acsTest}, + {"Attrib Test", attrTest}, +#if HAVE_COLOR + {"Color Test", colorTest}, +#endif +#if HAVE_CLIPBOARD + {"Clipboard Test", clipboardTest}, +#endif +#if HAVE_WIDE + {"Wide Input", wideTest} +#endif +}; + +int width, height; + +int main(int argc, char *argv[]) +{ + WINDOW *win; + int key, old_option = -1, new_option = 0; + bool quit = FALSE; + + setlocale(LC_ALL, ""); + + if (initTest(&win, argc, argv)) + return 1; + +#ifdef A_COLOR + if (has_colors()) + { + init_pair(1, COLOR_WHITE, COLOR_BLUE); + wbkgd(win, COLOR_PAIR(1)); + } + else +#endif + wbkgd(win, A_REVERSE); + + erase(); + display_menu(old_option, new_option); + + while (1) + { + noecho(); + keypad(stdscr, TRUE); + raw(); + + key = getch(); + + switch(key) + { + case 10: + case 13: + case KEY_ENTER: + old_option = -1; + erase(); + refresh(); + (*command[new_option].function)(win); + erase(); + display_menu(old_option, new_option); + break; + + case KEY_PPAGE: + case KEY_HOME: + old_option = new_option; + new_option = 0; + display_menu(old_option, new_option); + break; + + case KEY_NPAGE: + case KEY_END: + old_option = new_option; + new_option = MAX_OPTIONS - 1; + display_menu(old_option, new_option); + break; + + case KEY_UP: + old_option = new_option; + new_option = (new_option == 0) ? + new_option : new_option - 1; + display_menu(old_option, new_option); + break; + + case KEY_DOWN: + old_option = new_option; + new_option = (new_option == MAX_OPTIONS - 1) ? + new_option : new_option + 1; + display_menu(old_option, new_option); + break; +#ifdef KEY_RESIZE + case KEY_RESIZE: +# ifdef PDCURSES + resize_term(0, 0); +# endif + old_option = -1; + erase(); + display_menu(old_option, new_option); + break; +#endif + case 'Q': + case 'q': + quit = TRUE; + } + + if (quit == TRUE) + break; + } + + delwin(win); + endwin(); + + return 0; +} + +void Continue(WINDOW *win) +{ + mvwaddstr(win, 10, 1, " Press any key to continue"); + wrefresh(win); + raw(); + wgetch(win); +} + +void Continue2(void) +{ + move(LINES - 1, 1); + clrtoeol(); + mvaddstr(LINES - 2, 1, " Press any key to continue"); + refresh(); + raw(); + getch(); +} + +int initTest(WINDOW **win, int argc, char *argv[]) +{ +#ifdef XCURSES + Xinitscr(argc, argv); +#else + initscr(); +#endif +#ifdef A_COLOR + if (has_colors()) + start_color(); +#endif + /* Create a drawing window */ + + width = 60; + height = 13; + + *win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2); + + if (*win == NULL) + { + endwin(); + return 1; + } + + return 0; +} + +void introTest(WINDOW *win) +{ + werase(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); + + box(win, ACS_VLINE, ACS_HLINE); + wrefresh(win); + + cbreak(); + mvwaddstr(win, 1, 1, + "You should have a rectangle in the middle of the screen"); + mvwaddstr(win, 2, 1, "You should have heard a beep"); + Continue(win); + + flash(); + mvwaddstr(win, 3, 1, "You should have seen a flash"); + Continue(win); +} + +void scrollTest(WINDOW *win) +{ + int i, OldY; +#ifndef PDCURSES + int OldX; +#endif + werase(win); + mvwaddstr(win, height - 2, 1, "The window will now scroll slowly"); + box(win, ACS_VLINE, ACS_HLINE); + wrefresh(win); + scrollok(win, TRUE); + napms(500); + + for (i = 1; i <= height; i++) + { + napms(150); + scroll(win); + wrefresh(win); + }; + +#ifdef PDCURSES + OldY = getmaxy(win); +#else + getmaxyx(win, OldY, OldX); +#endif + mvwaddstr(win, 6, 1, "The top of the window will scroll"); + wmove(win, 1, 1); + wsetscrreg(win, 0, 4); + box(win, ACS_VLINE, ACS_HLINE); + wrefresh(win); + + for (i = 1; i <= 5; i++) + { + napms(500); + scroll(win); + wrefresh(win); + } + + mvwaddstr(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); +} + +void inputTest(WINDOW *win) +{ + int w, h, bx, by, sw, sh, i, c, num = 0; + char buffer[80]; + WINDOW *subWin; + static const char spinner[5] = "/-\\|"; + int spinner_count = 0; + + wclear(win); + + 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) + return; + +#ifdef A_COLOR + if (has_colors()) + { + init_pair(2, COLOR_WHITE, COLOR_RED); + wbkgd(subWin, COLOR_PAIR(2) | A_BOLD); + } + else +#endif + wbkgd(subWin, A_BOLD); + + box(subWin, ACS_VLINE, ACS_HLINE); + wrefresh(win); + + nocbreak(); + + wclear (win); + 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(); + noecho(); + + wtimeout(win, 200); + +#ifdef PDCURSES + mouse_set(ALL_MOUSE_EVENTS); + PDC_return_key_modifiers(TRUE); +#endif + curs_set(0); /* turn cursor off */ + + while (1) + { + while (1) + { + c = wgetch(win); + + if (c == ERR) + { + spinner_count++; + if (spinner_count == 4) + spinner_count = 0; + mvwaddch(win, 3, 3, spinner[spinner_count]); + wrefresh(win); + } + else + break; + } +#ifdef PDCURSES + wmove(win, 4, 18); + wclrtoeol(win); +#endif + mvwaddstr(win, 3, 5, "Key Pressed: "); + wclrtoeol(win); + + if (c >= KEY_MIN) + wprintw(win, "%s", keyname(c)); + else if (isprint(c)) + wprintw(win, "%c", c); + else + wprintw(win, "%s", unctrl(c)); +#ifdef 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; + + if (button && (BUTTON_STATUS(button) & + BUTTON_MODIFIER_MASK)) + { + waddstr(win, " Modifier(s):"); + + if (BUTTON_STATUS(button) & BUTTON_SHIFT) + waddstr(win, " SHIFT"); + + if (BUTTON_STATUS(button) & BUTTON_CONTROL) + waddstr(win, " CONTROL"); + + if (BUTTON_STATUS(button) & BUTTON_ALT) + waddstr(win, " ALT"); + } + + wmove(win, 4, 18); + wclrtoeol(win); + wprintw(win, "Button %d: ", button); + + if (MOUSE_MOVED) + waddstr(win, "moved: "); + else if (MOUSE_WHEEL_UP) + waddstr(win, "wheel up: "); + else if (MOUSE_WHEEL_DOWN) + waddstr(win, "wheel dn: "); + else if (MOUSE_WHEEL_LEFT) + waddstr(win, "wheel lt: "); + else if (MOUSE_WHEEL_RIGHT) + waddstr(win, "wheel rt: "); + else if ((BUTTON_STATUS(button) & + BUTTON_ACTION_MASK) == BUTTON_PRESSED) + waddstr(win, "pressed: "); + else if ((BUTTON_STATUS(button) & + BUTTON_ACTION_MASK) == BUTTON_CLICKED) + waddstr(win, "clicked: "); + else if ((BUTTON_STATUS(button) & + BUTTON_ACTION_MASK) == BUTTON_DOUBLE_CLICKED) + waddstr(win, "double: "); + else + waddstr(win, "released: "); + + wprintw(win, "Position: Y: %d X: %d", MOUSE_Y_POS, MOUSE_X_POS); + } + else if (PDC_get_key_modifiers()) + { + waddstr(win, " Modifier(s):"); + if (PDC_get_key_modifiers() & PDC_KEY_MODIFIER_SHIFT) + waddstr(win, " SHIFT"); + + if (PDC_get_key_modifiers() & PDC_KEY_MODIFIER_CONTROL) + waddstr(win, " CONTROL"); + + if (PDC_get_key_modifiers() & PDC_KEY_MODIFIER_ALT) + waddstr(win, " ALT"); + + if (PDC_get_key_modifiers() & PDC_KEY_MODIFIER_NUMLOCK) + waddstr(win, " NUMLOCK"); + } +#endif + wrefresh(win); + + if (c == ' ') + break; + } + + wtimeout(win, -1); /* turn off timeout() */ + curs_set(1); /* turn cursor back on */ + +#ifdef PDCURSES + mouse_set(0L); + PDC_return_key_modifiers(FALSE); +#endif + wclear(win); + mvwaddstr(win, 2, 1, "Press some keys for 5 seconds"); + 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++) + { + mvwprintw(subWin, 1, 1, "Time = %d", i); + wrefresh(subWin); + napms(1000); + flushinp(); + } + + delwin(subWin); + werase(win); + flash(); + wrefresh(win); + napms(500); + flushinp(); + + mvwaddstr(win, 2, 1, "Press a key, followed by ENTER"); + wmove(win, 9, 10); + wrefresh(win); + echo(); + + keypad(win, TRUE); + raw(); + wgetnstr(win, buffer, 3); + flushinp(); + + wmove(win, 9, 10); + wdelch(win); + mvwaddstr(win, 4, 1, "The character should now have been deleted"); + Continue(win); + + refresh(); + wclear(win); + echo(); + buffer[0] = '\0'; + mvwaddstr(win, 3, 2, "The window should have moved"); + mvwaddstr(win, 4, 2, + "This text should have appeared without you pressing a key"); + mvwaddstr(win, 6, 2, "Enter a number then a string seperated by space"); + mvwin(win, 2, 1); + wrefresh(win); + mvwscanw(win, 7, 6, "%d %s", &num, buffer); + mvwprintw(win, 8, 6, "String: %s Number: %d", buffer, num); + Continue(win); + + refresh(); + wclear(win); + echo(); + mvwaddstr(win, 3, 2, "Enter a 5 character string: "); + wgetnstr(win, buffer, 5); + mvwprintw(win, 4, 2, "String: %s", buffer); + Continue(win); +} + +void outputTest(WINDOW *win) +{ + WINDOW *win1; + char Buffer[80]; + chtype ch; + int by, bx; + +#ifdef PDCURSES + PDC_set_blink(TRUE); +#endif + nl(); + wclear(win); + mvwaddstr(win, 1, 1, "You should now have a screen in the upper " + "left corner, and this text should have wrapped"); + 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); + + 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) + { + endwin(); + return; + } + +#ifdef A_COLOR + if (has_colors()) + { + init_pair(3, COLOR_BLUE, COLOR_WHITE); + wbkgd(win1, COLOR_PAIR(3)); + } + else +#endif + wbkgd(win1, A_NORMAL); + + 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); + + 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"); + mvwaddstr(win, 4, 2, "Only half of the next line is visible"); + mvwaddstr(win, 5, 2, "Only half of the next line is visible"); + wmove(win, 6, 1); + wclrtobot(win); + wmove(win, 5, 20); + wclrtoeol(win); + mvwaddstr(win, 8, 2, "This line also shouldn't appear"); + wmove(win, 8, 1); + winsdelln(win, -1); + Continue(win); + + wmove(win, 5, 9); + ch = winch(win); + + wclear(win); + wmove(win, 6, 2); + waddstr(win, "The next char should be l: "); + winsch(win, ch); + Continue(win); + + mvwinsstr(win, 6, 2, "A1B2C3D4E5"); + Continue(win); + + wmove(win, 5, 1); + winsdelln(win, 1); + mvwaddstr(win, 5, 2, "The lines below should have moved down"); + Continue(win); + + wclear(win); + wmove(win, 2, 2); + wprintw(win, "This is a formatted string in a window: %d %s\n", + 42, "is it"); + mvwaddstr(win, 10, 1, "Enter a string: "); + wrefresh(win); + echo(); + wscanw(win, "%s", Buffer); + + printw("This is a formatted string in stdscr: %d %s\n", 42, "is it"); + mvaddstr(10, 1, "Enter a string: "); + scanw("%s", Buffer); + + wclear(win); + curs_set(2); + mvwaddstr(win, 1, 1, "The cursor should be in high-visibility mode"); + Continue(win); + + wclear(win); + curs_set(0); + mvwaddstr(win, 1, 1, "The cursor should have disappeared"); + Continue(win); + + wclear(win); + curs_set(1); + mvwaddstr(win, 1, 1, "The cursor should be 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 claims to support 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 + PDC_set_blink(FALSE); +#endif +} + +#if HAVE_RESIZE +void resizeTest(WINDOW *dummy) +{ + WINDOW *win1; + int nwidth = 135, nheight = 52; + int owidth = COLS, oheight = LINES; + + savetty(); + + resize_term(nheight, nwidth); + + clear(); + refresh(); + + win1 = newwin(10, 50, 14, 25); + + if (win1 == NULL) + { + endwin(); + return; + } + +#ifdef A_COLOR + if (has_colors()) + { + init_pair(3, COLOR_BLUE, COLOR_WHITE); + wattrset(win1, COLOR_PAIR(3)); + } + + wclear(win1); +#endif + mvwaddstr(win1, 0, 0, "The screen may now be resized"); + mvwprintw(win1, 1, 4, "Given size: %d by %d", nwidth, nheight); + mvwprintw(win1, 2, 4, "Actual size: %d by %d", COLS, LINES); + Continue(win1); + + wclear(win1); + resetty(); + + mvwaddstr(win1, 0, 0, "The screen should now be reset"); + mvwprintw(win1, 1, 6, "Old size: %d by %d", owidth, oheight); + mvwprintw(win1, 2, 6, "Size now: %d by %d", COLS, LINES); + Continue(win1); + + delwin(win1); + + clear(); + refresh(); +} +#endif /* HAVE_RESIZE */ + +void padTest(WINDOW *dummy) +{ + WINDOW *pad, *spad; + + pad = newpad(50, 100); + wattron(pad, A_REVERSE); + mvwaddstr(pad, 5, 2, "This is a new pad"); + wattrset(pad, 0); + 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"); + prefresh(pad, 0, 0, 0, 0, 10, 45); + keypad(pad, TRUE); + raw(); + wgetch(pad); + + spad = subpad(pad, 12, 25, 7, 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); + keypad(pad, TRUE); + raw(); + wgetch(pad); + + delwin(pad); +} + +#if HAVE_CLIPBOARD +void clipboardTest(WINDOW *win) +{ + static const char *text = + "This string placed in clipboard by PDCurses test program, testcurs."; + char *ptr = NULL; + long i, length = 0; + + mvaddstr(1, 1, + "This test will display the contents of the system clipboard"); + + Continue2(); + + scrollok(stdscr, TRUE); + i = PDC_getclipboard(&ptr, &length); + + switch(i) + { + case PDC_CLIP_ACCESS_ERROR: + mvaddstr(3, 1, "There was an error accessing the clipboard"); + refresh(); + break; + + case PDC_CLIP_MEMORY_ERROR: + mvaddstr(3, 1, + "Unable to allocate memory for clipboard contents"); + break; + + case PDC_CLIP_EMPTY: + mvaddstr(3, 1, "There was no text in the clipboard"); + break; + + default: + wsetscrreg(stdscr, 0, LINES - 1); + clear(); + mvaddstr(1, 1, "Clipboard contents..."); + mvprintw(2, 1, "%s\n", ptr); + } + + Continue2(); + + clear(); + mvaddstr(1, 1, + "This test will place the following string in the system clipboard:"); + mvaddstr(2, 1, text); + + i = PDC_setclipboard(text, strlen(text)); + + switch(i) + { + case PDC_CLIP_ACCESS_ERROR: + mvaddstr(3, 1, "There was an error accessing the clipboard"); + break; + + case PDC_CLIP_MEMORY_ERROR: + mvaddstr(3, 1, "Unable to allocate memory for clipboard contents"); + break; + + default: + mvaddstr(3, 1, "The string was placed in the clipboard successfully"); + } + + Continue2(); +} +#endif /* HAVE_CLIPBOARD */ + +void curTest(void) +{ + do { + int c = getch(); +#ifdef PDCURSES + if (c == KEY_UP) + move(getcury(stdscr) - 1, getcurx(stdscr)); + else if (c == KEY_DOWN) + move(getcury(stdscr) + 1, getcurx(stdscr)); + else if (c == KEY_LEFT) + move(getcury(stdscr), getcurx(stdscr) - 1); + else if (c == KEY_RIGHT) + move(getcury(stdscr), getcurx(stdscr) + 1); + else if (c == 'i') + curs_set(SP->visibility == 1 ? 2 : 1); + else +#endif + break; + } while (TRUE); +} + +void acsTest(WINDOW *win) +{ +#ifdef ACS_S3 +# define ACSNUM 32 +#else +# define ACSNUM 25 +#endif + static const char *acs_names[] = + { + "ACS_ULCORNER", "ACS_URCORNER", "ACS_LLCORNER", "ACS_LRCORNER", + "ACS_LTEE", "ACS_RTEE", "ACS_TTEE", "ACS_BTEE", "ACS_HLINE", + "ACS_VLINE", "ACS_PLUS", + + "ACS_S1", "ACS_S9", "ACS_DIAMOND", "ACS_CKBOARD", "ACS_DEGREE", + "ACS_PLMINUS", "ACS_BULLET", + + "ACS_LARROW", "ACS_RARROW", "ACS_UARROW", "ACS_DARROW", + "ACS_BOARD", "ACS_LANTERN", "ACS_BLOCK" +#ifdef ACS_S3 + , "ACS_S3", "ACS_S7", "ACS_LEQUAL", "ACS_GEQUAL", + "ACS_PI", "ACS_NEQUAL", "ACS_STERLING" +#endif + }; + + chtype acs_values[ACSNUM]; + +#if HAVE_WIDE + cchar_t *wacs_values[] = + { + WACS_ULCORNER, WACS_URCORNER, WACS_LLCORNER, WACS_LRCORNER, + WACS_LTEE, WACS_RTEE, WACS_TTEE, WACS_BTEE, WACS_HLINE, + WACS_VLINE, WACS_PLUS, + + WACS_S1, WACS_S9, WACS_DIAMOND, WACS_CKBOARD, WACS_DEGREE, + WACS_PLMINUS, WACS_BULLET, + + WACS_LARROW, WACS_RARROW, WACS_UARROW, WACS_DARROW, WACS_BOARD, + WACS_LANTERN, WACS_BLOCK +# ifdef WACS_S3 + , WACS_S3, WACS_S7, WACS_LEQUAL, WACS_GEQUAL, WACS_PI, + WACS_NEQUAL, WACS_STERLING +# endif + }; + + static const wchar_t russian[] = {0x0420, 0x0443, 0x0441, 0x0441, + 0x043a, 0x0438, 0x0439, L' ', 0x044f, 0x0437, 0x044b, 0x043a, 0}; + + static const wchar_t greek[] = {0x0395, 0x03bb, 0x03bb, 0x03b7, + 0x03bd, 0x03b9, 0x03ba, 0x03ac, 0}; + + static const wchar_t georgian[] = {0x10e5, 0x10d0, 0x10e0, 0x10d7, + 0x10e3, 0x10da, 0x10d8, L' ', 0x10d4, 0x10dc, 0x10d0, 0}; +#endif + + int i, tmarg = (LINES - 22) / 2; + + attrset(A_BOLD); + mvaddstr(tmarg, (COLS - 23) / 2, "Alternate Character Set"); + attrset(A_NORMAL); + + tmarg += 3; + +#define A(b,c) acs_values[b] = ACS_##c + + A(0,ULCORNER); A(1,URCORNER); A(2,LLCORNER); A(3,LRCORNER); + A(4,LTEE); A(5,RTEE); A(6,TTEE); A(7,BTEE); + A(8,HLINE); A(9,VLINE); A(10,PLUS); A(11,S1); + A(12,S9); A(13,DIAMOND); A(14,CKBOARD); A(15,DEGREE); + + A(16,PLMINUS); A(17,BULLET); A(18,LARROW); A(19,RARROW); + A(20,UARROW); A(21,DARROW); A(22,BOARD); A(23,LANTERN); + A(24,BLOCK); +#ifdef ACS_S3 + A(25,S3); A(26,S7); A(27,LEQUAL); A(28,GEQUAL); + A(29,PI); A(30,NEQUAL); A(31,STERLING); +#endif + +#undef A + + for (i = 0; i < ACSNUM; i++) + { + move((i % 8) * 2 + tmarg, (i / 8) * (COLS / 4) + (COLS / 8 - 7)); + addch(acs_values[i]); + printw(" %s", acs_names[i]); + } + + mvaddstr(tmarg + 18, 3, "Press any key to continue"); + curTest(); + +#if HAVE_WIDE + clear(); + + attrset(A_BOLD); + mvaddstr(tmarg - 3, (COLS - 28) / 2, "Wide Alternate Character Set"); + attrset(A_NORMAL); + + for (i = 0; i < ACSNUM; i++) + { + move((i % 8) * 2 + tmarg, (i / 8) * (COLS / 4) + (COLS / 8 - 7)); + add_wch(wacs_values[i]); + printw(" W%s", acs_names[i]); + } + + /* Spanish, Russian, Greek, Georgian */ + + mvaddwstr(tmarg + 16, COLS / 8 - 5, L"Espa\xf1ol"); + mvaddwstr(tmarg + 16, 3 * (COLS / 8) - 5, russian); + mvaddwstr(tmarg + 16, 5 * (COLS / 8) - 5, greek); + mvaddwstr(tmarg + 16, 7 * (COLS / 8) - 5, georgian); + + mvaddstr(tmarg + 18, 3, "Press any key to continue"); + curTest(); +#endif +} + +void attrTest(WINDOW *win) +{ + int tmarg = (LINES - 16) / 2; + int col1 = (COLS - 36) / 2, col2 = col1 + 20; + + attrset(A_BOLD); + mvaddstr(tmarg, (COLS - 20) / 2, "Character Attributes"); + attrset(A_NORMAL); + + refresh(); + +#ifdef PDCURSES + PDC_set_blink(TRUE); + PDC_set_bold(TRUE); +#endif + +#ifdef A_ITALIC + attrset(A_ITALIC); + mvaddstr(tmarg + 3, col1, "A_ITALIC"); + attrset(A_NORMAL); +#endif + + attrset(A_BOLD); + mvaddstr(tmarg + 5, col1, "A_BOLD"); + attrset(A_NORMAL); + + attrset(A_BLINK); + mvaddstr(tmarg + 7, col1, "A_BLINK"); + attrset(A_NORMAL); + + attrset(A_REVERSE); + mvaddstr(tmarg + 9, col1, "A_REVERSE"); + attrset(A_NORMAL); + + attrset(A_STANDOUT); + mvaddstr(tmarg + 11, col1, "A_STANDOUT"); + attrset(A_NORMAL); + + attrset(A_UNDERLINE); + mvaddstr(tmarg + 13, col1, "A_UNDERLINE"); + attrset(A_NORMAL); + +#ifdef A_ITALIC + attrset(A_ITALIC|A_UNDERLINE); + mvaddstr(tmarg + 3, col2, "Underlined Italic"); + attrset(A_NORMAL); +#endif + + attrset(A_BOLD|A_UNDERLINE); + mvaddstr(tmarg + 5, col2, "Underlined Bold"); + attrset(A_NORMAL); + + attrset(A_BLINK|A_UNDERLINE); + mvaddstr(tmarg + 7, col2, "Underlined Blink"); + attrset(A_NORMAL); + +#ifdef A_LEFT + attrset(A_LEFT); + mvaddstr(tmarg + 9, col2, "A_LEFT"); + attrset(A_NORMAL); +#endif + +#ifdef A_RIGHT + attrset(A_RIGHT); + mvaddstr(tmarg + 11, col2, "A_RIGHT"); + attrset(A_NORMAL); +#endif + + attrset(A_BLINK|A_REVERSE); + mvaddstr(tmarg + 13, col2, "Reverse Blink"); + attrset(A_NORMAL); + + mvaddstr(tmarg + 16, 3, "Press any key to continue"); + curTest(); + +#ifdef PDCURSES + PDC_set_bold(FALSE); + PDC_set_blink(FALSE); +#endif +} + +#if HAVE_COLOR +void remap(int tmarg, const short *colors) +{ + struct + { + short red, green, blue; + } orgcolors[16]; + int i, maxcol = (COLORS >= 16) ? 16 : 8; + + for (i = 0; i < maxcol; i++) + color_content(i, &(orgcolors[i].red), + &(orgcolors[i].green), + &(orgcolors[i].blue)); + + attrset(A_BOLD); + mvaddstr(tmarg, (COLS - 22) / 2, " init_color() Example "); + attrset(A_NORMAL); + + refresh(); + + for (i = 0; i < 8; i++) + { + init_color(colors[i], i * 125, 0, i * 125); + + if (COLORS >= 16) + init_color(colors[i] + 8, 0, i * 125, 0); + } + + mvaddstr(tmarg + 19, 3, "Press any key to continue"); + curTest(); + + for (i = 0; i < maxcol; i++) + init_color(i, orgcolors[i].red, + orgcolors[i].green, + orgcolors[i].blue); +} + +void extended(int tmarg) +{ + int i, x, y, z, lmarg = (COLS - 77) / 2; + + erase(); + + curs_set(0); + + attrset(A_BOLD); + mvaddstr(tmarg, (COLS - 15) / 2, "Extended Colors"); + attrset(A_NORMAL); + + mvaddstr(tmarg + 3, lmarg, "6x6x6 Color Cube (16-231):"); + + for (i = 16; i < 256; i++) + init_pair(i, COLOR_BLACK, i); + + for (i = 16, x = 0; x < 6; x++) + for (z = 0; z < 6; z++) + for (y = 0; y < 6; y++) + { + chtype ch = ' ' | COLOR_PAIR(i++); + + mvaddch(tmarg + 5 + y, z * 13 + x * 2 + lmarg, ch); + addch(ch); + } + + mvaddstr(tmarg + 13, lmarg, "Greyscale (232-255):"); + + for (x = 0; x < 24; x++) + { + chtype ch = ' ' | COLOR_PAIR(232 + x); + + mvaddch(tmarg + 15, x * 2 + lmarg, ch); + addch(ch); + } + + refresh(); + curs_set(1); + + mvaddstr(tmarg + 19, 3, "Press any key to continue"); + curTest(); +} + +void gradient(int tmarg) +{ + int i; + short cnum = 256, pnum = 16; + + erase(); + refresh(); + + curs_set(0); + + attrset(A_BOLD); + mvaddstr(tmarg, (COLS - 17) / 2, "Colors Beyond 256"); + attrset(A_NORMAL); + + for (i = 0; i < 3; i++) + { + int j; + const char *output_text[3] = { + "Red on green to white on black | " + " (gradients work just as well with", + "Blue on yellow to black on red | " + "palettes, if you have enough colors)", + "White on red to green on blue, underlined (if available)" }; + const int len = (int)strlen(output_text[i]); + + move(tmarg + 3 + i, (COLS - 69) / 2); + for (j = 0; j < len; j++) + { + const int oval = j * 1000 / len; + const int reverse = 1000 - oval; + + if (!i) + { + init_color(cnum, 1000, oval, oval); + init_color(cnum + 1, 0, reverse, 0); + } + else if (i == 1) + { + init_color(cnum, 0, 0, reverse); + init_color(cnum + 1, 1000, reverse, 0); + } + else + { + init_color(cnum, reverse, 1000, reverse); + init_color(cnum + 1, reverse, 0, oval); + } + init_pair(pnum, cnum, cnum + 1); + attrset(COLOR_PAIR(pnum)); + if (i == 2) + attron(A_UNDERLINE); + addch(output_text[i][j]); + + cnum += 2; + pnum++; + } + } + + refresh(); + curs_set(1); + + attrset(A_NORMAL); + mvaddstr(tmarg + 19, 3, "Press any key to continue"); + curTest(); +} + +void colorTest(WINDOW *win) +{ + static const short colors[] = + { + COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_BLUE, + COLOR_CYAN, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE + }; + + static const char *colornames[] = + { + "COLOR_BLACK", "COLOR_RED", "COLOR_GREEN", "COLOR_BLUE", + "COLOR_CYAN", "COLOR_MAGENTA", "COLOR_YELLOW", "COLOR_WHITE" + }; + + chtype fill = ACS_BLOCK; + bool widecol = (COLORS >= 16); + + int i, j, tmarg, col1, col2, col3; + + if (!has_colors()) + return; + + tmarg = (LINES - 19) / 2; + col1 = (COLS - 60) / 2; + col2 = col1 + 20; + col3 = col2 + 20; + + attrset(A_BOLD); + mvaddstr(tmarg, (COLS - 22) / 2, "Color Attribute Macros"); + attrset(A_NORMAL); + + if (widecol) + { + mvaddstr(tmarg + 3, col2 + 3, "Colors 0-7"); + mvaddstr(tmarg + 3, col3 + 2, "Colors 8-15"); + } + else + { + mvaddstr(tmarg + 3, col2 + 4, "A_NORMAL"); + mvaddstr(tmarg + 3, col3 + 5, "A_BOLD"); + } + + for (i = 0; i < 8; i++) + { + init_pair(i + 4, colors[i], COLOR_BLACK); + if (widecol) + init_pair(i + 12, colors[i] + 8, COLOR_BLACK); + + mvaddstr(tmarg + i + 5, col1, colornames[i]); + + for (j = 0; j < 16; j++) + { + mvaddch(tmarg + i + 5, col2 + j, fill | COLOR_PAIR(i + 4)); + mvaddch(tmarg + i + 5, col3 + j, fill | (widecol ? + COLOR_PAIR(i + 12) : (COLOR_PAIR(i + 4) | A_BOLD) )); + } + } + + mvprintw(tmarg + 15, col1, "COLORS = %d", COLORS); + mvprintw(tmarg + 16, col1, "COLOR_PAIRS = %d", COLOR_PAIRS); + + mvaddstr(tmarg + 19, 3, "Press any key to continue"); + curTest(); + + if (can_change_color()) + remap(tmarg, colors); + + if (COLORS >= 256) + extended(tmarg); + + if (can_change_color() && COLORS >= 768) + gradient(tmarg); +} +#endif + +#if HAVE_WIDE +void wideTest(WINDOW *win) +{ + wchar_t tmp[513]; + size_t i; + + attrset(A_BOLD); + mvaddstr(1, (COLS - 25) / 2, "Wide Character Input Test"); + attrset(A_NORMAL); + + mvaddstr(4, 1, "Enter a string: "); + + echo(); + + get_wstr((wint_t *)tmp); + addstr("\n\n String:\n\n "); + addwstr(tmp); + addstr("\n\n\n Hex:\n\n "); + + for (i = 0; i < wcslen(tmp); i++) + { + printw("%04x ", tmp[i]); + addnwstr(tmp + i, 1); + addstr(" "); + } + + noecho(); + + Continue2(); +} +#endif + +void display_menu(int old_option, int new_option) +{ + int lmarg = (COLS - 14) / 2, + tmarg = (LINES - (MAX_OPTIONS + 2)) / 2; + + if (old_option == -1) + { + int i; + + attrset(A_BOLD); + mvaddstr(tmarg - 3, lmarg - 5, "PDCurses Test Program"); + attrset(A_NORMAL); + + for (i = 0; i < MAX_OPTIONS; i++) + mvaddstr(tmarg + i, lmarg, command[i].text); + } + else + mvaddstr(tmarg + old_option, lmarg, command[old_option].text); + + attrset(A_REVERSE); + mvaddstr(tmarg + new_option, lmarg, command[new_option].text); + attrset(A_NORMAL); + + mvaddstr(tmarg + MAX_OPTIONS + 2, lmarg - 23, + "Use Up and Down Arrows to select - Enter to run - Q to quit"); + refresh(); +} diff --git a/vendor/pdcurses/demos/tui.c b/vendor/pdcurses/demos/tui.c new file mode 100644 index 0000000..f49a3b8 --- /dev/null +++ b/vendor/pdcurses/demos/tui.c @@ -0,0 +1,824 @@ +/********************************* tui.c ************************************/ +/* + * 'textual user interface' + * + * Author : P.J. Kunst + * Date : 1993-02-25 + */ + +#include +#include +#include +#include +#include +#include +#include "tui.h" + +void statusmsg(char *); +int waitforkey(void); +void rmerror(void); + +#if defined(__unix) && !defined(__DJGPP__) +#include +#endif + +#ifdef A_COLOR +# define TITLECOLOR 1 /* color pair indices */ +# define MAINMENUCOLOR (2 | A_BOLD) +# define MAINMENUREVCOLOR (3 | A_BOLD | A_REVERSE) +# define SUBMENUCOLOR (4 | A_BOLD) +# define SUBMENUREVCOLOR (5 | A_BOLD | A_REVERSE) +# define BODYCOLOR 6 +# define STATUSCOLOR (7 | A_BOLD) +# define INPUTBOXCOLOR 8 +# define EDITBOXCOLOR (9 | A_BOLD | A_REVERSE) +#else +# define TITLECOLOR 0 /* color pair indices */ +# define MAINMENUCOLOR (A_BOLD) +# define MAINMENUREVCOLOR (A_BOLD | A_REVERSE) +# define SUBMENUCOLOR (A_BOLD) +# define SUBMENUREVCOLOR (A_BOLD | A_REVERSE) +# define BODYCOLOR 0 +# define STATUSCOLOR (A_BOLD) +# define INPUTBOXCOLOR 0 +# define EDITBOXCOLOR (A_BOLD | A_REVERSE) +#endif + + +#define th 1 /* title window height */ +#define mh 1 /* main menu height */ +#define sh 2 /* status window height */ +#define bh (LINES - th - mh - sh) /* body window height */ +#define bw COLS /* body window width */ + + +/******************************* STATIC ************************************/ + +static WINDOW *wtitl, *wmain, *wbody, *wstat; /* title, menu, body, status win*/ +static int nexty, nextx; +static int key = ERR, ch = ERR; +static bool quit = FALSE; +static bool incurses = FALSE; + +#ifndef PDCURSES +static char wordchar(void) +{ + return 0x17; /* ^W */ +} +#endif + +static char *padstr(char *s, int length) +{ + static char buf[MAXSTRLEN]; + char fmt[10]; + + sprintf(fmt, (int)strlen(s) > length ? "%%.%ds" : "%%-%ds", length); + sprintf(buf, fmt, s); + + return buf; +} + +static char *prepad(char *s, int length) +{ + int i; + char *p = s; + + if (length > 0) + { + memmove((void *)(s + length), (const void *)s, strlen(s) + 1); + + for (i = 0; i < length; i++) + *p++ = ' '; + } + + return s; +} + +static void rmline(WINDOW *win, int nr) /* keeps box lines intact */ +{ + mvwaddstr(win, nr, 1, padstr(" ", bw - 2)); + wrefresh(win); +} + +static void initcolor(void) +{ +#ifdef A_COLOR + if (has_colors()) + start_color(); + + /* foreground, background */ + + init_pair(TITLECOLOR & ~A_ATTR, COLOR_BLACK, COLOR_CYAN); + init_pair(MAINMENUCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN); + init_pair(MAINMENUREVCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLACK); + init_pair(SUBMENUCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN); + init_pair(SUBMENUREVCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLACK); + init_pair(BODYCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLUE); + init_pair(STATUSCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN); + init_pair(INPUTBOXCOLOR & ~A_ATTR, COLOR_BLACK, COLOR_CYAN); + init_pair(EDITBOXCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLACK); +#endif +} + +static void setcolor(WINDOW *win, chtype color) +{ + chtype attr = color & A_ATTR; /* extract Bold, Reverse, Blink bits */ + +#ifdef A_COLOR + attr &= ~A_REVERSE; /* ignore reverse, use colors instead! */ + wattrset(win, COLOR_PAIR(color & A_CHARTEXT) | attr); +#else + attr &= ~A_BOLD; /* ignore bold, gives messy display on HP-UX */ + wattrset(win, attr); +#endif +} + +static void colorbox(WINDOW *win, chtype color, int hasbox) +{ + int maxy; +#ifndef PDCURSES + int maxx; +#endif + chtype attr = color & A_ATTR; /* extract Bold, Reverse, Blink bits */ + + setcolor(win, color); + +#ifdef A_COLOR + if (has_colors()) + wbkgd(win, COLOR_PAIR(color & A_CHARTEXT) | (attr & ~A_REVERSE)); + else +#endif + wbkgd(win, attr); + + werase(win); + +#ifdef PDCURSES + maxy = getmaxy(win); +#else + getmaxyx(win, maxy, maxx); +#endif + if (hasbox && (maxy > 2)) + box(win, 0, 0); + + touchwin(win); + wrefresh(win); +} + +static void idle(void) +{ + char buf[MAXSTRLEN]; + time_t t; + struct tm *tp; + + if (time (&t) == -1) + return; /* time not available */ + + tp = localtime(&t); + sprintf(buf, " %.4d-%.2d-%.2d %.2d:%.2d:%.2d", + tp->tm_year + 1900, tp->tm_mon + 1, tp->tm_mday, + tp->tm_hour, tp->tm_min, tp->tm_sec); + + mvwaddstr(wtitl, 0, bw - strlen(buf) - 2, buf); + wrefresh(wtitl); +} + +static void menudim(menu *mp, int *lines, int *columns) +{ + int n, l, mmax = 0; + + for (n = 0; mp->func; n++, mp++) + if ((l = strlen(mp->name)) > mmax) mmax = l; + + *lines = n; + *columns = mmax + 2; +} + +static void setmenupos(int y, int x) +{ + nexty = y; + nextx = x; +} + +static void getmenupos(int *y, int *x) +{ + *y = nexty; + *x = nextx; +} + +static int hotkey(const char *s) +{ + int c0 = *s; /* if no upper case found, return first char */ + + for (; *s; s++) + if (isupper((unsigned char)*s)) + break; + + return *s ? *s : c0; +} + +static void repaintmenu(WINDOW *wmenu, menu *mp) +{ + int i; + menu *p = mp; + + for (i = 0; p->func; i++, p++) + mvwaddstr(wmenu, i + 1, 2, p->name); + + touchwin(wmenu); + wrefresh(wmenu); +} + +static void repaintmainmenu(int width, menu *mp) +{ + int i; + menu *p = mp; + + for (i = 0; p->func; i++, p++) + mvwaddstr(wmain, 0, i * width, prepad(padstr(p->name, width - 1), 1)); + + touchwin(wmain); + wrefresh(wmain); +} + +static void mainhelp(void) +{ +#ifdef ALT_X + statusmsg("Use arrow keys and Enter to select (Alt-X to quit)"); +#else + statusmsg("Use arrow keys and Enter to select"); +#endif +} + +static void mainmenu(menu *mp) +{ + int nitems, barlen, old = -1, cur = 0, c, cur0; + + menudim(mp, &nitems, &barlen); + repaintmainmenu(barlen, mp); + + while (!quit) + { + if (cur != old) + { + if (old != -1) + { + mvwaddstr(wmain, 0, old * barlen, + prepad(padstr(mp[old].name, barlen - 1), 1)); + + statusmsg(mp[cur].desc); + } + else + mainhelp(); + + setcolor(wmain, MAINMENUREVCOLOR); + + mvwaddstr(wmain, 0, cur * barlen, + prepad(padstr(mp[cur].name, barlen - 1), 1)); + + setcolor(wmain, MAINMENUCOLOR); + old = cur; + wrefresh(wmain); + } + + switch (c = (key != ERR ? key : waitforkey())) + { + case KEY_DOWN: + case '\n': /* menu item selected */ + touchwin(wbody); + wrefresh(wbody); + rmerror(); + setmenupos(th + mh, cur * barlen); + curs_set(1); + (mp[cur].func)(); /* perform function */ + curs_set(0); + + switch (key) + { + case KEY_LEFT: + cur = (cur + nitems - 1) % nitems; + key = '\n'; + break; + + case KEY_RIGHT: + cur = (cur + 1) % nitems; + key = '\n'; + break; + + default: + key = ERR; + } + + repaintmainmenu(barlen, mp); + old = -1; + break; + + case KEY_LEFT: + cur = (cur + nitems - 1) % nitems; + break; + + case KEY_RIGHT: + cur = (cur + 1) % nitems; + break; + + case KEY_ESC: + mainhelp(); + break; + + default: + cur0 = cur; + + do + { + cur = (cur + 1) % nitems; + + } while ((cur != cur0) && (hotkey(mp[cur].name) != toupper(c))); + + if (hotkey(mp[cur].name) == toupper(c)) + key = '\n'; + } + + } + + rmerror(); + touchwin(wbody); + wrefresh(wbody); +} + +static void cleanup(void) /* cleanup curses settings */ +{ + if (incurses) + { + delwin(wtitl); + delwin(wmain); + delwin(wbody); + delwin(wstat); + curs_set(1); + endwin(); + incurses = FALSE; + } +} + + +/******************************* EXTERNAL **********************************/ + +void clsbody(void) +{ + werase(wbody); + wmove(wbody, 0, 0); +} + +int bodylen(void) +{ +#ifdef PDCURSES + return getmaxy(wbody); +#else + int maxy, maxx; + + getmaxyx(wbody, maxy, maxx); + return maxy; +#endif +} + +WINDOW *bodywin(void) +{ + return wbody; +} + +void rmerror(void) +{ + rmline(wstat, 0); +} + +void rmstatus(void) +{ + rmline(wstat, 1); +} + +void titlemsg(char *msg) +{ + mvwaddstr(wtitl, 0, 2, padstr(msg, bw - 3)); + wrefresh(wtitl); +} + +void bodymsg(char *msg) +{ + waddstr(wbody, msg); + wrefresh(wbody); +} + +void errormsg(char *msg) +{ + beep(); + mvwaddstr(wstat, 0, 2, padstr(msg, bw - 3)); + wrefresh(wstat); +} + +void statusmsg(char *msg) +{ + mvwaddstr(wstat, 1, 2, padstr(msg, bw - 3)); + wrefresh(wstat); +} + +bool keypressed(void) +{ + ch = wgetch(wbody); + + return ch != ERR; +} + +int getkey(void) +{ + int c = ch; + + ch = ERR; +#ifdef ALT_X + quit = (c == ALT_X); /* PC only ! */ +#endif + return c; +} + +int waitforkey(void) +{ + do idle(); while (!keypressed()); + return getkey(); +} + +void DoExit(void) /* terminate program */ +{ + quit = TRUE; +} + +void domenu(menu *mp) +{ + int y, x, nitems, barlen, mheight, mw, old = -1, cur = 0, cur0; + bool stop = FALSE; + WINDOW *wmenu; + + curs_set(0); + getmenupos(&y, &x); + menudim(mp, &nitems, &barlen); + mheight = nitems + 2; + mw = barlen + 2; + wmenu = newwin(mheight, mw, y, x); + colorbox(wmenu, SUBMENUCOLOR, 1); + repaintmenu(wmenu, mp); + + key = ERR; + + while (!stop && !quit) + { + if (cur != old) + { + if (old != -1) + mvwaddstr(wmenu, old + 1, 1, + prepad(padstr(mp[old].name, barlen - 1), 1)); + + setcolor(wmenu, SUBMENUREVCOLOR); + mvwaddstr(wmenu, cur + 1, 1, + prepad(padstr(mp[cur].name, barlen - 1), 1)); + + setcolor(wmenu, SUBMENUCOLOR); + statusmsg(mp[cur].desc); + + old = cur; + wrefresh(wmenu); + } + + switch (key = ((key != ERR) ? key : waitforkey())) + { + case '\n': /* menu item selected */ + touchwin(wbody); + wrefresh(wbody); + setmenupos(y + 1, x + 1); + rmerror(); + + key = ERR; + curs_set(1); + (mp[cur].func)(); /* perform function */ + curs_set(0); + + repaintmenu(wmenu, mp); + + old = -1; + break; + + case KEY_UP: + cur = (cur + nitems - 1) % nitems; + key = ERR; + break; + + case KEY_DOWN: + cur = (cur + 1) % nitems; + key = ERR; + break; + + case KEY_ESC: + case KEY_LEFT: + case KEY_RIGHT: + if (key == KEY_ESC) + key = ERR; /* return to prev submenu */ + + stop = TRUE; + break; + + default: + cur0 = cur; + + do + { + cur = (cur + 1) % nitems; + + } while ((cur != cur0) && + (hotkey(mp[cur].name) != toupper((int)key))); + + key = (hotkey(mp[cur].name) == toupper((int)key)) ? '\n' : ERR; + } + + } + + rmerror(); + delwin(wmenu); + touchwin(wbody); + wrefresh(wbody); +} + +void startmenu(menu *mp, char *mtitle) +{ + initscr(); + incurses = TRUE; + initcolor(); + + wtitl = subwin(stdscr, th, bw, 0, 0); + wmain = subwin(stdscr, mh, bw, th, 0); + wbody = subwin(stdscr, bh, bw, th + mh, 0); + wstat = subwin(stdscr, sh, bw, th + mh + bh, 0); + + colorbox(wtitl, TITLECOLOR, 0); + colorbox(wmain, MAINMENUCOLOR, 0); + colorbox(wbody, BODYCOLOR, 0); + colorbox(wstat, STATUSCOLOR, 0); + + if (mtitle) + titlemsg(mtitle); + + cbreak(); /* direct input (no newline required)... */ + noecho(); /* ... without echoing */ + curs_set(0); /* hide cursor (if possible) */ + nodelay(wbody, TRUE); /* don't wait for input... */ + halfdelay(10); /* ...well, no more than a second, anyway */ + keypad(wbody, TRUE); /* enable cursor keys */ + scrollok(wbody, TRUE); /* enable scrolling in main window */ + + leaveok(stdscr, TRUE); + leaveok(wtitl, TRUE); + leaveok(wmain, TRUE); + leaveok(wstat, TRUE); + + mainmenu(mp); + + cleanup(); +} + +static void repainteditbox(WINDOW *win, int x, char *buf) +{ +#ifndef PDCURSES + int maxy; +#endif + int maxx; + +#ifdef PDCURSES + maxx = getmaxx(win); +#else + getmaxyx(win, maxy, maxx); +#endif + werase(win); + mvwprintw(win, 0, 0, "%s", padstr(buf, maxx)); + wmove(win, 0, x); + wrefresh(win); +} + +/* + + weditstr() - edit string + + Description: + The initial value of 'str' with a maximum length of 'field' - 1, + which is supplied by the calling routine, is editted. The user's + erase (^H), kill (^U) and delete word (^W) chars are interpreted. + The PC insert or Tab keys toggle between insert and edit mode. + Escape aborts the edit session, leaving 'str' unchanged. + Enter, Up or Down Arrow are used to accept the changes to 'str'. + NOTE: editstr(), mveditstr(), and mvweditstr() are macros. + + Return Value: + Returns the input terminating character on success (Escape, + Enter, Up or Down Arrow) and ERR on error. + + Errors: + It is an error to call this function with a NULL window pointer. + The length of the initial 'str' must not exceed 'field' - 1. + +*/ + +int weditstr(WINDOW *win, char *buf, int field) +{ + char org[MAXSTRLEN], *tp, *bp = buf; + bool defdisp = TRUE, stop = FALSE, insert = FALSE; + int cury, curx, begy, begx; + chtype oldattr; + WINDOW *wedit; + int c = 0; + + if ((field >= MAXSTRLEN) || (buf == NULL) || + ((int)strlen(buf) > field - 1)) + return ERR; + + strcpy(org, buf); /* save original */ + + wrefresh(win); + getyx(win, cury, curx); + getbegyx(win, begy, begx); + + wedit = subwin(win, 1, field, begy + cury, begx + curx); + oldattr = getattrs(wedit); + colorbox(wedit, EDITBOXCOLOR, 0); + + keypad(wedit, TRUE); + curs_set(1); + + while (!stop) + { + idle(); + repainteditbox(wedit, bp - buf, buf); + + switch (c = wgetch(wedit)) + { + case ERR: + break; + + case KEY_ESC: + strcpy(buf, org); /* restore original */ + stop = TRUE; + break; + + case '\n': + case KEY_UP: + case KEY_DOWN: + stop = TRUE; + break; + + case KEY_LEFT: + if (bp > buf) + bp--; + break; + + case KEY_RIGHT: + defdisp = FALSE; + if (bp - buf < (int)strlen(buf)) + bp++; + break; + + case '\t': /* TAB -- because insert + is broken on HPUX */ + case KEY_IC: /* enter insert mode */ + case KEY_EIC: /* exit insert mode */ + defdisp = FALSE; + insert = !insert; + + curs_set(insert ? 2 : 1); + break; + + default: + /* check KEY_BACKSPACE manually, because erasechar() can only + * return char, and KEY_BACKSPACE is an int, so on systems + * that truly return KEY_BACKSPACE from wgetch(), we'll never + * catch it with erasechar() */ + if (c == erasechar() || c == KEY_BACKSPACE) + { + if (bp > buf) + { + memmove((void *)(bp - 1), (const void *)bp, strlen(bp) + 1); + bp--; + } + } + else if (c == killchar()) /* ^U */ + { + bp = buf; + *bp = '\0'; + } + else if (c == wordchar()) /* ^W */ + { + tp = bp; + + while ((bp > buf) && (*(bp - 1) == ' ')) + bp--; + while ((bp > buf) && (*(bp - 1) != ' ')) + bp--; + + memmove((void *)bp, (const void *)tp, strlen(tp) + 1); + } + else if (isprint(c)) + { + if (defdisp) + { + bp = buf; + *bp = '\0'; + defdisp = FALSE; + } + + if (insert) + { + if ((int)strlen(buf) < field - 1) + { + memmove((void *)(bp + 1), (const void *)bp, + strlen(bp) + 1); + + *bp++ = c; + } + } + else if (bp - buf < field - 1) + { + /* append new string terminator */ + + if (!*bp) + bp[1] = '\0'; + + *bp++ = c; + } + } + } + } + + curs_set(0); + + wattrset(wedit, oldattr); + repainteditbox(wedit, bp - buf, buf); + delwin(wedit); + + return c; +} + +WINDOW *winputbox(WINDOW *win, int nlines, int ncols) +{ + WINDOW *winp; + int cury, curx, begy, begx; + + getyx(win, cury, curx); + getbegyx(win, begy, begx); + + winp = newwin(nlines, ncols, begy + cury, begx + curx); + colorbox(winp, INPUTBOXCOLOR, 1); + + return winp; +} + +int getstrings(char *desc[], char *buf[], int field) +{ + WINDOW *winput; + int oldy, oldx, maxy, maxx, nlines, ncols, i, n, l, mmax = 0; + int c = 0; + bool stop = FALSE; + + for (n = 0; desc[n]; n++) + if ((l = strlen(desc[n])) > mmax) + mmax = l; + + nlines = n + 2; ncols = mmax + field + 4; + getyx(wbody, oldy, oldx); + getmaxyx(wbody, maxy, maxx); + + winput = mvwinputbox(wbody, (maxy - nlines) / 2, (maxx - ncols) / 2, + nlines, ncols); + + for (i = 0; i < n; i++) + mvwprintw(winput, i + 1, 2, "%s", desc[i]); + + i = 0; + + while (!stop) + { + switch (c = mvweditstr(winput, i+1, mmax+3, buf[i], field)) + { + case KEY_ESC: + stop = TRUE; + break; + + case KEY_UP: + i = (i + n - 1) % n; + break; + + case '\n': + case '\t': + case KEY_DOWN: + if (++i == n) + stop = TRUE; /* all passed? */ + } + } + + delwin(winput); + touchwin(wbody); + wmove(wbody, oldy, oldx); + wrefresh(wbody); + + return c; +} diff --git a/vendor/pdcurses/demos/tui.h b/vendor/pdcurses/demos/tui.h new file mode 100644 index 0000000..0bb4c68 --- /dev/null +++ b/vendor/pdcurses/demos/tui.h @@ -0,0 +1,65 @@ +/* + * 'textual user interface' + * + * Author : P.J. Kunst + * Date : 1993-02-25 + */ + +#ifndef _TUI_H_ +#define _TUI_H_ + +#include + +#ifdef A_COLOR +#define A_ATTR (A_ATTRIBUTES ^ A_COLOR) /* A_BLINK, A_REVERSE, A_BOLD */ +#else +#define A_ATTR (A_ATTRIBUTES) /* standard UNIX attributes */ +#endif + +#define MAXSTRLEN 256 +#define KEY_ESC 0x1b /* Escape */ + +typedef void (*FUNC)(void); + +typedef struct +{ + char *name; /* item label */ + FUNC func; /* (pointer to) function */ + char *desc; /* function description */ +} menu; + +/* ANSI C function prototypes: */ + +void clsbody(void); +int bodylen(void); +WINDOW *bodywin(void); + +void rmerror(void); +void rmstatus(void); + +void titlemsg(char *msg); +void bodymsg(char *msg); +void errormsg(char *msg); +void statusmsg(char *msg); + +bool keypressed(void); +int getkey(void); +int waitforkey(void); + +void DoExit(void); +void startmenu(menu *mp, char *title); +void domenu(menu *mp); + +int weditstr(WINDOW *win, char *buf, int field); +WINDOW *winputbox(WINDOW *win, int nlines, int ncols); +int getstrings(char *desc[], char *buf[], int field); + +#define editstr(s,f) (weditstr(stdscr,s,f)) +#define mveditstr(y,x,s,f) (move(y,x)==ERR?ERR:editstr(s,f)) +#define mvweditstr(w,y,x,s,f) (wmove(w,y,x)==ERR?ERR:weditstr(w,s,f)) + +#define inputbox(l,c) (winputbox(stdscr,l,c)) +#define mvinputbox(y,x,l,c) (move(y,x)==ERR?w:inputbox(l,c)) +#define mvwinputbox(w,y,x,l,c) (wmove(w,y,x)==ERR?w:winputbox(w,l,c)) + +#endif diff --git a/vendor/pdcurses/demos/tuidemo.c b/vendor/pdcurses/demos/tuidemo.c new file mode 100644 index 0000000..0d4fd4f --- /dev/null +++ b/vendor/pdcurses/demos/tuidemo.c @@ -0,0 +1,228 @@ +/* + * Author : P.J. Kunst + * Date : 1993-02-25 + * + * Purpose: This program demonstrates the use of the 'curses' library + * for the creation of (simple) menu-operated programs. + * In the PDCurses version, use is made of colors for the + * highlighting of subwindows (title bar, status bar etc). + * + * Acknowledgement: some ideas were borrowed from Mark Hessling's + * version of the 'testcurs' program. + */ + +#include +#include +#include +#include +#include "tui.h" + +/* change this if source at other location */ + +#ifdef PDC_FORCE_UTF8 +# define FNAME "../demos/UTF-8-demo.txt" +#else +# define FNAME "../demos/tui.c" +#endif + +/**************************** strings entry box ***************************/ + +void address(void) +{ + char *fieldname[6] = + { + "Name", "Street", "City", "State", "Country", (char *)0 + }; + + char *fieldbuf[5]; + WINDOW *wbody = bodywin(); + int i, field = 50; + + for (i = 0; i < 5; i++) + fieldbuf[i] = calloc(1, field + 1); + + if (getstrings(fieldname, fieldbuf, field) != KEY_ESC) + { + for (i = 0; fieldname[i]; i++) + wprintw(wbody, "%10s : %s\n", + fieldname[i], fieldbuf[i]); + + wrefresh(wbody); + } + + for (i = 0; i < 5; i++) + free(fieldbuf[i]); +} + +/**************************** string entry box ****************************/ + +char *getfname(char *desc, char *fname, int field) +{ + char *fieldname[2]; + char *fieldbuf[1]; + + fieldname[0] = desc; + fieldname[1] = 0; + fieldbuf[0] = fname; + + return (getstrings(fieldname, fieldbuf, field) == KEY_ESC) ? NULL : fname; +} + +/**************************** a very simple file browser ******************/ + +void showfile(char *fname) +{ + int i, bh = bodylen(); + FILE *fp; + char buf[MAXSTRLEN]; + bool ateof = FALSE; + + statusmsg("FileBrowser: Hit key to continue, Q to quit"); + + if ((fp = fopen(fname, "r")) != NULL) /* file available? */ + { + while (!ateof) + { + clsbody(); + + for (i = 0; i < bh - 1 && !ateof; i++) + { + if (fgets(buf, MAXSTRLEN, fp)) + bodymsg(buf); + else + ateof = TRUE; + } + + switch (waitforkey()) + { + case 'Q': + case 'q': + case 0x1b: + ateof = TRUE; + } + } + + fclose(fp); + } + else + { + sprintf(buf, "ERROR: file '%s' not found", fname); + errormsg(buf); + } +} + +/***************************** forward declarations ***********************/ + +void sub0(void), sub1(void), sub2(void), sub3(void); +void func1(void), func2(void); +void subfunc1(void), subfunc2(void); +void subsub(void); + +/***************************** menus initialization ***********************/ + +menu MainMenu[] = +{ + { "Asub", sub0, "Go inside first submenu" }, + { "Bsub", sub1, "Go inside second submenu" }, + { "Csub", sub2, "Go inside third submenu" }, + { "Dsub", sub3, "Go inside fourth submenu" }, + { "", (FUNC)0, "" } /* always add this as the last item! */ +}; + +menu SubMenu0[] = +{ + { "Exit", DoExit, "Terminate program" }, + { "", (FUNC)0, "" } +}; + +menu SubMenu1[] = +{ + { "OneBeep", func1, "Sound one beep" }, + { "TwoBeeps", func2, "Sound two beeps" }, + { "", (FUNC)0, "" } +}; + +menu SubMenu2[] = +{ + { "Browse", subfunc1, "Source file lister" }, + { "Input", subfunc2, "Interactive file lister" }, + { "Address", address, "Get address data" }, + { "", (FUNC)0, "" } +}; + +menu SubMenu3[] = +{ + { "SubSub", subsub, "Go inside sub-submenu" }, + { "", (FUNC)0, "" } +}; + +/***************************** main menu functions ************************/ + +void sub0(void) +{ + domenu(SubMenu0); +} + +void sub1(void) +{ + domenu(SubMenu1); +} + +void sub2(void) +{ + domenu(SubMenu2); +} + +void sub3(void) +{ + domenu(SubMenu3); +} + +/***************************** submenu1 functions *************************/ + +void func1(void) +{ + beep(); + bodymsg("One beep! "); +} + +void func2(void) +{ + beep(); + bodymsg("Two beeps! "); + beep(); +} + +/***************************** submenu2 functions *************************/ + +void subfunc1(void) +{ + showfile(FNAME); +} + +void subfunc2(void) +{ + char fname[MAXSTRLEN]; + + strcpy(fname, FNAME); + if (getfname ("File to browse:", fname, 50)) + showfile(fname); +} + +/***************************** submenu3 functions *************************/ + +void subsub(void) +{ + domenu(SubMenu2); +} + +/***************************** start main menu ***************************/ + +int main(int argc, char **argv) +{ + setlocale(LC_ALL, ""); + + startmenu(MainMenu, "TUI - 'textual user interface' demonstration program"); + + return 0; +} diff --git a/vendor/pdcurses/demos/worm.c b/vendor/pdcurses/demos/worm.c new file mode 100644 index 0000000..b19d75c --- /dev/null +++ b/vendor/pdcurses/demos/worm.c @@ -0,0 +1,432 @@ +/**************************************************************************** + * Copyright (c) 2005 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/* + + @@@ @@@ @@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@ + @@@ @@@ @@@@@@@@@@@@ @@@@@@@@@@@@ @@@@@@@@@@@@@ + @@@ @@@ @@@@ @@@@ @@@@ @@@@ @@@ @@@@ + @@@ @@ @@@ @@@ @@@ @@@ @@@ @@@ @@@ + @@@ @@@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@ + @@@@ @@@@ @@@@ @@@ @@@ @@@ @@@ @@@ @@@ + @@@@@@@@@@@@ @@@@ @@@@ @@@ @@@ @@@ @@@ + @@@@ @@@@ @@@@@@@@@@@@ @@@ @@@ @@@ @@@ + @@ @@ @@@@@@@@@@ @@@ @@@ @@@ @@@ + + Eric P. Scott + Caltech High Energy Physics + October, 1980 + + Color by Eric S. Raymond + July, 1995 + +Options: + -f fill screen with copies of 'WORM' at start. + -l set worm length + -n set number of worms + -t make worms leave droppings +*/ + +#include +#include +#include + +#define FLAVORS 7 + +static chtype flavor[FLAVORS] = +{ + 'O', '*', '#', '$', '%', '0', '@' +}; + +static const short xinc[] = +{ + 1, 1, 1, 0, -1, -1, -1, 0 +}, +yinc[] = +{ + -1, 0, 1, 1, 1, 0, -1, -1 +}; + +static struct worm +{ + int orientation, head; + short *xpos, *ypos; +} worm[40]; + +static const char *field; +static int length = 16, number = 3; +static chtype trail = ' '; + +static const struct options +{ + int nopts; + int opts[3]; +} normal[8] = +{ + { 3, { 7, 0, 1 } }, { 3, { 0, 1, 2 } }, { 3, { 1, 2, 3 } }, + { 3, { 2, 3, 4 } }, { 3, { 3, 4, 5 } }, { 3, { 4, 5, 6 } }, + { 3, { 5, 6, 7 } }, { 3, { 6, 7, 0 } } +}, +upper[8] = +{ + { 1, { 1, 0, 0 } }, { 2, { 1, 2, 0 } }, { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 2, { 4, 5, 0 } }, + { 1, { 5, 0, 0 } }, { 2, { 1, 5, 0 } } +}, +left[8] = +{ + { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, + { 2, { 2, 3, 0 } }, { 1, { 3, 0, 0 } }, { 2, { 3, 7, 0 } }, + { 1, { 7, 0, 0 } }, { 2, { 7, 0, 0 } } +}, +right[8] = +{ + { 1, { 7, 0, 0 } }, { 2, { 3, 7, 0 } }, { 1, { 3, 0, 0 } }, + { 2, { 3, 4, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, { 2, { 6, 7, 0 } } +}, +lower[8] = +{ + { 0, { 0, 0, 0 } }, { 2, { 0, 1, 0 } }, { 1, { 1, 0, 0 } }, + { 2, { 1, 5, 0 } }, { 1, { 5, 0, 0 } }, { 2, { 5, 6, 0 } }, + { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } } +}, +upleft[8] = +{ + { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 1, { 3, 0, 0 } }, + { 2, { 1, 3, 0 } }, { 1, { 1, 0, 0 } } +}, +upright[8] = +{ + { 2, { 3, 5, 0 } }, { 1, { 3, 0, 0 } }, { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, { 1, { 5, 0, 0 } } +}, +lowleft[8] = +{ + { 3, { 7, 0, 1 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, + { 1, { 1, 0, 0 } }, { 2, { 1, 7, 0 } }, { 1, { 7, 0, 0 } }, + { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } } +}, +lowright[8] = +{ + { 0, { 0, 0, 0 } }, { 1, { 7, 0, 0 } }, { 2, { 5, 7, 0 } }, + { 1, { 5, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } } +}; + +static void cleanup(void) +{ + standend(); + refresh(); + curs_set(1); + endwin(); +} + +int main(int argc, char *argv[]) +{ + const struct options *op; + struct worm *w; + short **ref, *ip; + time_t seed; + int x, y, n, h, last, bottom; + + for (x = 1; x < argc; x++) + { + char *p = argv[x]; + + if (*p == '-') + p++; + + switch (*p) + { + case 'f': + field = "WORM"; + break; + case 'l': + if (++x == argc) + goto usage; + + if ((length = atoi(argv[x])) < 2 || length > 1024) + { + fprintf(stderr, "%s: Invalid length\n", *argv); + return EXIT_FAILURE; + } + + break; + case 'n': + if (++x == argc) + goto usage; + + if ((number = atoi(argv[x])) < 1 || number > 40) + { + fprintf(stderr, "%s: Invalid number of worms\n", *argv); + return EXIT_FAILURE; + } + + break; + case 't': + trail = '.'; + break; + default: + usage: + fprintf(stderr, "usage: %s [-field] [-length #] " + "[-number #] [-trail]\n", *argv); + return EXIT_FAILURE; + } + } + +#ifdef XCURSES + Xinitscr(argc, argv); +#else + initscr(); +#endif + seed = time((time_t *)0); + srand(seed); + + noecho(); + cbreak(); + nonl(); + keypad(stdscr, TRUE); + + curs_set(0); + + bottom = LINES - 1; + last = COLS - 1; + +#ifdef A_COLOR + if (has_colors()) + { + short bg = COLOR_BLACK; + start_color(); + +# if defined(NCURSES_VERSION) || (defined(PDC_BUILD) && PDC_BUILD > 3000) + if (use_default_colors() == OK) + bg = -1; +# endif + +# define SET_COLOR(num, fg) \ + init_pair(num + 1, fg, bg); \ + flavor[num] |= COLOR_PAIR(num + 1) | A_BOLD + + SET_COLOR(0, COLOR_GREEN); + SET_COLOR(1, COLOR_RED); + SET_COLOR(2, COLOR_CYAN); + SET_COLOR(3, COLOR_WHITE); + SET_COLOR(4, COLOR_MAGENTA); + SET_COLOR(5, COLOR_BLUE); + SET_COLOR(6, COLOR_YELLOW); + } +#endif + + ref = malloc(sizeof(short *) * LINES); + + for (y = 0; y < LINES; y++) + { + ref[y] = malloc(sizeof(short) * COLS); + + for (x = 0; x < COLS; x++) + ref[y][x] = 0; + } + +#ifdef BADCORNER + /* if addressing the lower right corner doesn't work in your curses */ + + ref[bottom][last] = 1; +#endif + + for (n = number, w = &worm[0]; --n >= 0; w++) + { + w->orientation = w->head = 0; + + if ((ip = malloc(sizeof(short) * (length + 1))) == NULL) + { + fprintf(stderr, "%s: out of memory\n", *argv); + return EXIT_FAILURE; + } + + w->xpos = ip; + + for (x = length; --x >= 0;) + *ip++ = -1; + + if ((ip = malloc(sizeof(short) * (length + 1))) == NULL) + { + fprintf(stderr, "%s: out of memory\n", *argv); + return EXIT_FAILURE; + } + + w->ypos = ip; + + for (y = length; --y >= 0;) + *ip++ = -1; + } + + if (field) + { + const char *p = field; + + for (y = bottom; --y >= 0;) + for (x = COLS; --x >= 0;) + { + addch((chtype) (*p++)); + + if (!*p) + p = field; + } + } + + napms(12); + refresh(); + nodelay(stdscr, TRUE); + + for (;;) + { + int ch; + + if ((ch = getch()) > 0) + { +#ifdef KEY_RESIZE + if (ch == KEY_RESIZE) + { +# ifdef PDCURSES + resize_term(0, 0); +# endif + if (last != COLS - 1) + { + for (y = 0; y <= bottom; y++) + { + ref[y] = realloc(ref[y], sizeof(short) * COLS); + + for (x = last + 1; x < COLS; x++) + ref[y][x] = 0; + } + + last = COLS - 1; + } + + if (bottom != LINES - 1) + { + for (y = LINES; y <= bottom; y++) + free(ref[y]); + + ref = realloc(ref, sizeof(short *) * LINES); + + for (y = bottom + 1; y < LINES; y++) + { + ref[y] = malloc(sizeof(short) * COLS); + + for (x = 0; x < COLS; x++) + ref[y][x] = 0; + } + + bottom = LINES - 1; + } + } + +#endif /* KEY_RESIZE */ + + /* Make it simple to put this into single-step mode, + or resume normal operation - T. Dickey */ + + if (ch == 'q') + { + cleanup(); + return EXIT_SUCCESS; + } + else if (ch == 's') + nodelay(stdscr, FALSE); + else if (ch == ' ') + nodelay(stdscr, TRUE); + } + + for (n = 0, w = &worm[0]; n < number; n++, w++) + { + if ((x = w->xpos[h = w->head]) < 0) + { + move(y = w->ypos[h] = bottom, x = w->xpos[h] = 0); + addch(flavor[n % FLAVORS]); + ref[y][x]++; + } + else + y = w->ypos[h]; + + if (x > last) + x = last; + + if (y > bottom) + y = bottom; + + if (++h == length) + h = 0; + + if (w->xpos[w->head = h] >= 0) + { + int x1 = w->xpos[h]; + int y1 = w->ypos[h]; + + if (y1 < LINES && x1 < COLS && --ref[y1][x1] == 0) + { + move(y1, x1); + addch(trail); + } + } + + op = &(x == 0 ? (y == 0 ? upleft : + (y == bottom ? lowleft : left)) : + (x == last ? (y == 0 ? upright : + (y == bottom ? lowright : right)) : + (y == 0 ? upper : + (y == bottom ? lower : normal)))) + [w->orientation]; + + switch (op->nopts) + { + case 0: + cleanup(); + return EXIT_SUCCESS; + case 1: + w->orientation = op->opts[0]; + break; + default: + w->orientation = op->opts[rand() % op->nopts]; + } + + move(y += yinc[w->orientation], x += xinc[w->orientation]); + + if (y < 0) + y = 0; + + addch(flavor[n % FLAVORS]); + ref[w->ypos[h] = y][w->xpos[h] = x]++; + } + napms(12); + refresh(); + } +} diff --git a/vendor/pdcurses/demos/xmas.c b/vendor/pdcurses/demos/xmas.c new file mode 100644 index 0000000..e1c02c0 --- /dev/null +++ b/vendor/pdcurses/demos/xmas.c @@ -0,0 +1,954 @@ +/******************************************************************************/ +/* asciixmas */ +/* December 1989 Larry Bartz Indianapolis, IN */ +/* */ +/* */ +/* I'm dreaming of an ascii character-based monochrome Christmas, */ +/* Just like the one's I used to know! */ +/* Via a full duplex communications channel, */ +/* At 9600 bits per second, */ +/* Even though it's kinda slow. */ +/* */ +/* I'm dreaming of an ascii character-based monochrome Christmas, */ +/* With ev'ry C program I write! */ +/* May your screen be merry and bright! */ +/* And may all your Christmases be amber or green, */ +/* (for reduced eyestrain and improved visibility)! */ +/* */ +/* */ +/* */ +/* IMPLEMENTATION */ +/* */ +/* Feel free to modify the defined string FROMWHO to reflect you, your */ +/* organization, your site, whatever. */ +/* */ +/* This looks a lot better if you can turn off your cursor before execution. */ +/* The cursor is distracting but it doesn't really ruin the show. */ +/* */ +/* At our site, we invoke this for our users just after login and the */ +/* determination of terminal type. */ +/* */ +/* */ +/* PORTABILITY */ +/* */ +/* I wrote this using only the very simplest curses functions so that it */ +/* might be the most portable. I was personally able to test on five */ +/* different cpu/UNIX combinations. */ +/* */ +/* */ +/* COMPILE */ +/* */ +/* usually this: */ +/* */ +/* cc -O xmas.c -lcurses -o xmas -s */ +/* */ +/******************************************************************************/ + +#include + +void lil(WINDOW *); +void midtop(WINDOW *); +void bigtop(WINDOW *); +void bigface(WINDOW *, chtype); +void legs1(WINDOW *); +void legs2(WINDOW *); +void legs3(WINDOW *); +void legs4(WINDOW *); +void initdeer(void); +void boxit(void); +void seas(void); +void greet(void); +void fromwho(void); +void del_msg(void); +void tree(void); +void balls(void); +void star(void); +void strng1(void); +void strng2(void); +void strng3(void); +void strng4(void); +void strng5(void); +void blinkit(void); +void reindeer(void); + +#define FROMWHO "From Larry Bartz, Mark Hessling and William McBrine" + +int y_pos, x_pos; + +WINDOW *treescrn, *treescrn2, *treescrn3, *treescrn4, *treescrn5, + *treescrn6, *treescrn7, *treescrn8, *dotdeer0, *stardeer0, + *lildeer0, *lildeer1, *lildeer2, *lildeer3, *middeer0, + *middeer1, *middeer2, *middeer3, *bigdeer0, *bigdeer1, + *bigdeer2, *bigdeer3, *bigdeer4, *lookdeer0, *lookdeer1, + *lookdeer2, *lookdeer3, *lookdeer4, *w_holiday, *w_del_msg; + +int main(int argc, char **argv) +{ + int loopy; + +#ifdef XCURSES + Xinitscr(argc, argv); +#else + initscr(); +#endif + nodelay(stdscr, TRUE); + noecho(); + nonl(); + refresh(); + +#ifdef A_COLOR + if (has_colors()) + start_color(); +#endif + curs_set(0); + + treescrn = newwin(16, 27, 3, 53); + treescrn2 = newwin(16, 27, 3, 53); + treescrn3 = newwin(16, 27, 3, 53); + treescrn4 = newwin(16, 27, 3, 53); + treescrn5 = newwin(16, 27, 3, 53); + treescrn6 = newwin(16, 27, 3, 53); + treescrn7 = newwin(16, 27, 3, 53); + treescrn8 = newwin(16, 27, 3, 53); + + w_holiday = newwin(1, 26, 3, 27); + + w_del_msg = newwin(1, 12, 23, 60); + + mvwaddstr(w_holiday, 0, 0, "H A P P Y H O L I D A Y S"); + + initdeer(); + + clear(); + werase(treescrn); + touchwin(treescrn); + werase(treescrn2); + touchwin(treescrn2); + werase(treescrn8); + touchwin(treescrn8); + refresh(); + napms(1000); + + boxit(); + del_msg(); + napms(1000); + + seas(); + del_msg(); + napms(1000); + + greet(); + del_msg(); + napms(1000); + + fromwho(); + del_msg(); + napms(1000); + + tree(); + napms(1000); + + balls(); + napms(1000); + + star(); + napms(1000); + + strng1(); + strng2(); + strng3(); + strng4(); + strng5(); + + /* set up the windows for our blinking trees */ + /* **************************************** */ + /* treescrn3 */ + + overlay(treescrn, treescrn3); + + /* balls */ + mvwaddch(treescrn3, 4, 18, ' '); + mvwaddch(treescrn3, 7, 6, ' '); + mvwaddch(treescrn3, 8, 19, ' '); + mvwaddch(treescrn3, 11, 22, ' '); + + /* star */ + mvwaddch(treescrn3, 0, 12, '*'); + + /* strng1 */ + mvwaddch(treescrn3, 3, 11, ' '); + + /* strng2 */ + mvwaddch(treescrn3, 5, 13, ' '); + mvwaddch(treescrn3, 6, 10, ' '); + + /* strng3 */ + mvwaddch(treescrn3, 7, 16, ' '); + mvwaddch(treescrn3, 7, 14, ' '); + + /* strng4 */ + mvwaddch(treescrn3, 10, 13, ' '); + mvwaddch(treescrn3, 10, 10, ' '); + mvwaddch(treescrn3, 11, 8, ' '); + + /* strng5 */ + mvwaddch(treescrn3, 11, 18, ' '); + mvwaddch(treescrn3, 12, 13, ' '); + + /* treescrn4 */ + + overlay(treescrn, treescrn4); + + /* balls */ + mvwaddch(treescrn4, 3, 9, ' '); + mvwaddch(treescrn4, 4, 16, ' '); + mvwaddch(treescrn4, 7, 6, ' '); + mvwaddch(treescrn4, 8, 19, ' '); + mvwaddch(treescrn4, 11, 2, ' '); + mvwaddch(treescrn4, 12, 23, ' '); + + /* star */ + mvwaddch(treescrn4, 0, 12, '*' | A_STANDOUT); + + /* strng1 */ + mvwaddch(treescrn4, 3, 13, ' '); + + /* strng2 */ + + /* strng3 */ + mvwaddch(treescrn4, 7, 15, ' '); + mvwaddch(treescrn4, 8, 11, ' '); + + /* strng4 */ + mvwaddch(treescrn4, 9, 16, ' '); + mvwaddch(treescrn4, 10, 12, ' '); + mvwaddch(treescrn4, 11, 8, ' '); + + /* strng5 */ + mvwaddch(treescrn4, 11, 18, ' '); + mvwaddch(treescrn4, 12, 14, ' '); + + /* treescrn5 */ + + overlay(treescrn, treescrn5); + + /* balls */ + mvwaddch(treescrn5, 3, 15, ' '); + mvwaddch(treescrn5, 10, 20, ' '); + mvwaddch(treescrn5, 12, 1, ' '); + + /* star */ + mvwaddch(treescrn5, 0, 12, '*'); + + /* strng1 */ + mvwaddch(treescrn5, 3, 11, ' '); + + /* strng2 */ + mvwaddch(treescrn5, 5, 12, ' '); + + /* strng3 */ + mvwaddch(treescrn5, 7, 14, ' '); + mvwaddch(treescrn5, 8, 10, ' '); + + /* strng4 */ + mvwaddch(treescrn5, 9, 15, ' '); + mvwaddch(treescrn5, 10, 11, ' '); + mvwaddch(treescrn5, 11, 7, ' '); + + /* strng5 */ + mvwaddch(treescrn5, 11, 17, ' '); + mvwaddch(treescrn5, 12, 13, ' '); + + /* treescrn6 */ + + overlay(treescrn, treescrn6); + + /* balls */ + mvwaddch(treescrn6, 6, 7, ' '); + mvwaddch(treescrn6, 7, 18, ' '); + mvwaddch(treescrn6, 10, 4, ' '); + mvwaddch(treescrn6, 11, 23, ' '); + + /* star */ + mvwaddch(treescrn6, 0, 12, '*' | A_STANDOUT); + + /* strng1 */ + + /* strng2 */ + mvwaddch(treescrn6, 5, 11, ' '); + + /* strng3 */ + mvwaddch(treescrn6, 7, 13, ' '); + mvwaddch(treescrn6, 8, 9, ' '); + + /* strng4 */ + mvwaddch(treescrn6, 9, 14, ' '); + mvwaddch(treescrn6, 10, 10, ' '); + mvwaddch(treescrn6, 11, 6, ' '); + + /* strng5 */ + mvwaddch(treescrn6, 11, 16, ' '); + mvwaddch(treescrn6, 12, 12, ' '); + + /* treescrn7 */ + + overlay(treescrn, treescrn7); + + /* balls */ + mvwaddch(treescrn7, 3, 15, ' '); + mvwaddch(treescrn7, 6, 7, ' '); + mvwaddch(treescrn7, 7, 18, ' '); + mvwaddch(treescrn7, 10, 4, ' '); + mvwaddch(treescrn7, 11, 22, ' '); + + /* star */ + mvwaddch(treescrn7, 0, 12, '*'); + + /* strng1 */ + mvwaddch(treescrn7, 3, 12, ' '); + + /* strng2 */ + mvwaddch(treescrn7, 5, 13, ' '); + mvwaddch(treescrn7, 6, 9, ' '); + + /* strng3 */ + mvwaddch(treescrn7, 7, 15, ' '); + mvwaddch(treescrn7, 8, 11, ' '); + + /* strng4 */ + mvwaddch(treescrn7, 9, 16, ' '); + mvwaddch(treescrn7, 10, 12, ' '); + mvwaddch(treescrn7, 11, 8, ' '); + + /* strng5 */ + mvwaddch(treescrn7, 11, 18, ' '); + mvwaddch(treescrn7, 12, 14, ' '); + + napms(1000); + reindeer(); + + touchwin(w_holiday); + wrefresh(w_holiday); + wrefresh(w_del_msg); + + napms(1000); + + for (loopy = 0; loopy < 50; loopy++) + blinkit(); + + clear(); + refresh(); + endwin(); + + return 0; +} + +void lil(WINDOW *win) +{ + mvwaddch(win, 0, 0, (chtype) 'V'); + mvwaddch(win, 1, 0, (chtype) '@'); + mvwaddch(win, 1, 3, (chtype) '~'); +} + +void midtop(WINDOW *win) +{ + mvwaddstr(win, 0, 2, "yy"); + mvwaddstr(win, 1, 2, "0(=)~"); +} + +void bigtop(WINDOW *win) +{ + mvwaddstr(win, 0, 17, "\\/"); + mvwaddstr(win, 0, 20, "\\/"); + mvwaddch(win, 1, 18, (chtype) '\\'); + mvwaddch(win, 1, 20, (chtype) '/'); + mvwaddstr(win, 2, 19, "|_"); + mvwaddstr(win, 3, 18, "/^0\\"); + mvwaddstr(win, 4, 17, "//\\"); + mvwaddch(win, 4, 22, (chtype) '\\'); + mvwaddstr(win, 5, 7, "^~~~~~~~~// ~~U"); +} + +void bigface(WINDOW *win, chtype noseattr) +{ + mvwaddstr(win, 0, 16, "\\/ \\/"); + mvwaddstr(win, 1, 17, "\\Y/ \\Y/"); + mvwaddstr(win, 2, 19, "\\=/"); + mvwaddstr(win, 3, 17, "^\\o o/^"); + mvwaddstr(win, 4, 17, "//( )"); + mvwaddstr(win, 5, 7, "^~~~~~~~~// \\"); + waddch(win, 'O' | noseattr); + waddstr(win, "/"); +} + +void legs1(WINDOW *win) +{ + mvwaddstr(win, 6, 7, "( \\_____( /"); + mvwaddstr(win, 7, 8, "( ) /"); + mvwaddstr(win, 8, 9, "\\\\ /"); + mvwaddstr(win, 9, 11, "\\>/>"); +} + +void legs2(WINDOW *win) +{ + mvwaddstr(win, 6, 7, "(( )____( /"); + mvwaddstr(win, 7, 7, "( / |"); + mvwaddstr(win, 8, 8, "\\/ |"); + mvwaddstr(win, 9, 9, "|> |>"); +} + +void legs3(WINDOW *win) +{ + mvwaddstr(win, 6, 6, "( ()_____( /"); + mvwaddstr(win, 7, 6, "/ / /"); + mvwaddstr(win, 8, 5, "|/ \\"); + mvwaddstr(win, 9, 5, "/> \\>"); +} + +void legs4(WINDOW *win) +{ + mvwaddstr(win, 6, 6, "( )______( /"); + mvwaddstr(win, 7, 5, "(/ \\"); + mvwaddstr(win, 8, 0, "v___= ----^"); +} + +void initdeer(void) +{ + chtype noseattr; + +#ifdef A_COLOR + if (has_colors()) + { + init_pair(31, COLOR_RED, COLOR_BLACK); + noseattr = COLOR_PAIR(31); + } + else +#endif + noseattr = A_NORMAL; + + /* set up the windows for our various reindeer */ + + dotdeer0 = newwin(3, 71, 0, 8); + stardeer0 = newwin(4, 56, 0, 8); + lildeer0 = newwin(7, 54, 0, 8); + middeer0 = newwin(15, 42, 0, 8); + bigdeer0 = newwin(10, 23, 0, 0); + lookdeer0 = newwin(10, 25, 0, 0); + + /* lildeer1 */ + lildeer1 = newwin(2, 4, 0, 0); + lil(lildeer1); + mvwaddstr(lildeer1, 1, 1, "<>"); + + /* lildeer2 */ + lildeer2 = newwin(2, 4, 0, 0); + lil(lildeer2); + mvwaddstr(lildeer2, 1, 1, "||"); + + /* lildeer3 */ + lildeer3 = newwin(2, 4, 0, 0); + lil(lildeer3); + mvwaddstr(lildeer3, 1, 1, "><"); + + /* middeer1 */ + middeer1 = newwin(3, 7, 0, 0); + midtop(middeer1); + mvwaddstr(middeer1, 2, 3, "\\/"); + + /* middeer2 */ + middeer2 = newwin(3, 7, 0, 0); + midtop(middeer2); + mvwaddch(middeer2, 2, 3, (chtype) '|'); + mvwaddch(middeer2, 2, 5, (chtype) '|'); + + /* middeer3 */ + middeer3 = newwin(3, 7, 0, 0); + midtop(middeer3); + mvwaddch(middeer3, 2, 2, (chtype) '/'); + mvwaddch(middeer3, 2, 6, (chtype) '\\'); + + /* bigdeer1 */ + bigdeer1 = newwin(10, 23, 0, 0); + bigtop(bigdeer1); + legs1(bigdeer1); + + /* bigdeer2 */ + bigdeer2 = newwin(10, 23, 0, 0); + bigtop(bigdeer2); + legs2(bigdeer2); + + /* bigdeer3 */ + bigdeer3 = newwin(10, 23, 0, 0); + bigtop(bigdeer3); + legs3(bigdeer3); + + /* bigdeer4 */ + bigdeer4 = newwin(10, 23, 0, 0); + bigtop(bigdeer4); + legs4(bigdeer4); + + /* lookdeer1 */ + lookdeer1 = newwin(10, 25, 0, 0); + bigface(lookdeer1, noseattr); + legs1(lookdeer1); + + /* lookdeer2 */ + lookdeer2 = newwin(10, 25, 0, 0); + bigface(lookdeer2, noseattr); + legs2(lookdeer2); + + /* lookdeer3 */ + lookdeer3 = newwin(10, 25, 0, 0); + bigface(lookdeer3, noseattr); + legs3(lookdeer3); + + /* lookdeer4 */ + lookdeer4 = newwin(10, 25, 0, 0); + bigface(lookdeer4, noseattr); + legs4(lookdeer4); +} + +void boxit(void) +{ + int x; + + for (x = 0; x < 20; ++x) + mvaddch(x, 7, '|'); + + for (x = 0; x < 80; ++x) + { + if (x > 7) + mvaddch(19, x, '_'); + + mvaddch(22, x, '_'); + } +} + +void seas(void) +{ + mvaddch(4, 1, 'S'); + mvaddch(6, 1, 'E'); + mvaddch(8, 1, 'A'); + mvaddch(10, 1, 'S'); + mvaddch(12, 1, 'O'); + mvaddch(14, 1, 'N'); + mvaddch(16, 1, '`'); + mvaddch(18, 1, 'S'); +} + +void greet(void) +{ + mvaddch(3, 5, 'G'); + mvaddch(5, 5, 'R'); + mvaddch(7, 5, 'E'); + mvaddch(9, 5, 'E'); + mvaddch(11, 5, 'T'); + mvaddch(13, 5, 'I'); + mvaddch(15, 5, 'N'); + mvaddch(17, 5, 'G'); + mvaddch(19, 5, 'S'); +} + +void fromwho(void) +{ + mvaddstr(21, 13, FROMWHO); +} + +void del_msg(void) +{ + refresh(); +} + +void tree(void) +{ +#ifdef A_COLOR + if (has_colors()) + { + init_pair(30, COLOR_GREEN, COLOR_BLACK); + wattrset(treescrn, COLOR_PAIR(30)); + } +#endif + mvwaddch(treescrn, 1, 11, (chtype) '/'); + mvwaddch(treescrn, 2, 11, (chtype) '/'); + mvwaddch(treescrn, 3, 10, (chtype) '/'); + mvwaddch(treescrn, 4, 9, (chtype) '/'); + mvwaddch(treescrn, 5, 9, (chtype) '/'); + mvwaddch(treescrn, 6, 8, (chtype) '/'); + mvwaddch(treescrn, 7, 7, (chtype) '/'); + mvwaddch(treescrn, 8, 6, (chtype) '/'); + mvwaddch(treescrn, 9, 6, (chtype) '/'); + mvwaddch(treescrn, 10, 5, (chtype) '/'); + mvwaddch(treescrn, 11, 3, (chtype) '/'); + mvwaddch(treescrn, 12, 2, (chtype) '/'); + + mvwaddch(treescrn, 1, 13, (chtype) '\\'); + mvwaddch(treescrn, 2, 13, (chtype) '\\'); + mvwaddch(treescrn, 3, 14, (chtype) '\\'); + mvwaddch(treescrn, 4, 15, (chtype) '\\'); + mvwaddch(treescrn, 5, 15, (chtype) '\\'); + mvwaddch(treescrn, 6, 16, (chtype) '\\'); + mvwaddch(treescrn, 7, 17, (chtype) '\\'); + mvwaddch(treescrn, 8, 18, (chtype) '\\'); + mvwaddch(treescrn, 9, 18, (chtype) '\\'); + mvwaddch(treescrn, 10, 19, (chtype) '\\'); + mvwaddch(treescrn, 11, 21, (chtype) '\\'); + mvwaddch(treescrn, 12, 22, (chtype) '\\'); + + mvwaddch(treescrn, 4, 10, (chtype) '_'); + mvwaddch(treescrn, 4, 14, (chtype) '_'); + mvwaddch(treescrn, 8, 7, (chtype) '_'); + mvwaddch(treescrn, 8, 17, (chtype) '_'); + + mvwaddstr(treescrn, 13, 0, + "//////////// \\\\\\\\\\\\\\\\\\\\\\\\"); + +#ifdef A_COLOR + if (has_colors()) + { + init_pair(20, COLOR_YELLOW, COLOR_BLACK); + wattrset(treescrn, COLOR_PAIR(20)); + } +#endif + mvwaddstr(treescrn, 14, 11, "| |"); + mvwaddstr(treescrn, 15, 11, "|_|"); + + wrefresh(treescrn); + wrefresh(w_del_msg); +} + +void balls(void) +{ + chtype ball1, ball2, ball3, ball4, ball5, ball6; + + overlay(treescrn, treescrn2); + +#ifdef A_COLOR + if (has_colors()) + { + init_pair(1, COLOR_BLUE, COLOR_BLACK); + init_pair(2, COLOR_RED, COLOR_BLACK); + init_pair(3, COLOR_MAGENTA, COLOR_BLACK); + init_pair(4, COLOR_CYAN, COLOR_BLACK); + init_pair(5, COLOR_YELLOW, COLOR_BLACK); + init_pair(6, COLOR_WHITE, COLOR_BLACK); + ball1 = COLOR_PAIR(1) | '@'; + ball2 = COLOR_PAIR(2) | '@'; + ball3 = COLOR_PAIR(3) | '@'; + ball4 = COLOR_PAIR(4) | '@'; + ball5 = COLOR_PAIR(5) | '@'; + ball6 = COLOR_PAIR(6) | '@'; + } + else +#endif + ball1 = ball2 = ball3 = ball4 = ball5 = ball6 = '@'; + + mvwaddch(treescrn2, 3, 9, ball1); + mvwaddch(treescrn2, 3, 15, ball2); + mvwaddch(treescrn2, 4, 8, ball3); + mvwaddch(treescrn2, 4, 16, ball4); + mvwaddch(treescrn2, 5, 7, ball5); + mvwaddch(treescrn2, 5, 17, ball6); + mvwaddch(treescrn2, 7, 6, ball1 | A_BOLD); + mvwaddch(treescrn2, 7, 18, ball2 | A_BOLD); + mvwaddch(treescrn2, 8, 5, ball3 | A_BOLD); + mvwaddch(treescrn2, 8, 19, ball4 | A_BOLD); + mvwaddch(treescrn2, 10, 4, ball5 | A_BOLD); + mvwaddch(treescrn2, 10, 20, ball6 | A_BOLD); + mvwaddch(treescrn2, 11, 2, ball1); + mvwaddch(treescrn2, 11, 22, ball2); + mvwaddch(treescrn2, 12, 1, ball3); + mvwaddch(treescrn2, 12, 23, ball4); + + wrefresh(treescrn2); + wrefresh(w_del_msg); +} + +void star(void) +{ + mvwaddch(treescrn2, 0, 12, (chtype) '*' | A_STANDOUT); + + wrefresh(treescrn2); + wrefresh(w_del_msg); +} + +void strng1(void) +{ +#ifdef A_COLOR + if (has_colors()) + { + init_pair(10, COLOR_YELLOW, COLOR_BLACK); + wattrset(treescrn2, COLOR_PAIR(10) | A_BOLD); + } +#endif + mvwaddstr(treescrn2, 3, 11, ".:'"); + + wrefresh(treescrn2); + wrefresh(w_del_msg); +} + +void strng2(void) +{ +#ifdef A_COLOR + if (has_colors()) + { + init_pair(11, COLOR_RED, COLOR_BLACK); + wattrset(treescrn2, COLOR_PAIR(11) | A_BOLD); + } +#endif + mvwaddstr(treescrn2, 5, 11, ",.:'"); + mvwaddstr(treescrn2, 6, 9, ":'"); + + wrefresh(treescrn2); + wrefresh(w_del_msg); +} + +void strng3(void) +{ +#ifdef A_COLOR + if (has_colors()) + { + init_pair(12, COLOR_GREEN, COLOR_BLACK); + wattrset(treescrn2, COLOR_PAIR(12) | A_BOLD); + } +#endif + mvwaddstr(treescrn2, 7, 13, ",.:'"); + mvwaddstr(treescrn2, 8, 9, ",.:'"); + + wrefresh(treescrn2); + wrefresh(w_del_msg); +} + +void strng4(void) +{ +#ifdef A_COLOR + if (has_colors()) + { + init_pair(13, COLOR_WHITE, COLOR_BLACK); + wattrset(treescrn2, COLOR_PAIR(13) | A_BOLD); + } +#endif + mvwaddstr(treescrn2, 9, 14, ",.:'"); + mvwaddstr(treescrn2, 10, 10, ",.:'"); + mvwaddstr(treescrn2, 11, 6, ",.:'"); + mvwaddch(treescrn2, 12, 5, (chtype) '\''); + + wrefresh(treescrn2); + wrefresh(w_del_msg); +} + +void strng5(void) +{ +#ifdef A_COLOR + if (has_colors()) + { + init_pair(14, COLOR_CYAN, COLOR_BLACK); + wattrset(treescrn2, COLOR_PAIR(14) | A_BOLD); + } +#endif + mvwaddstr(treescrn2, 11, 16, ",.:'"); + mvwaddstr(treescrn2, 12, 12, ",.:'"); + + /* save a fully lit tree */ + overlay(treescrn2, treescrn); + + wrefresh(treescrn2); + wrefresh(w_del_msg); +} + +void blinkit(void) +{ + static int cycle; + + if (cycle > 4) + cycle = 0; + + touchwin(treescrn8); + + switch (cycle) + { + case 0: + overlay(treescrn3, treescrn8); + break; + + case 1: + overlay(treescrn4, treescrn8); + break; + + case 2: + overlay(treescrn5, treescrn8); + break; + + case 3: + overlay(treescrn6, treescrn8); + break; + + case 4: + overlay(treescrn7, treescrn8); + } + + wrefresh(treescrn8); + wrefresh(w_del_msg); + + napms(50); + touchwin(treescrn8); + + /*ALL ON************************************************** */ + + overlay(treescrn, treescrn8); + wrefresh(treescrn8); + wrefresh(w_del_msg); + + ++cycle; +} + +#define TSHOW(win, pause) touchwin(win); wrefresh(win); \ + wrefresh(w_del_msg); napms(pause) + +#define SHOW(win, pause) mvwin(win, y_pos, x_pos); wrefresh(win); \ + wrefresh(w_del_msg); napms(pause) + +void reindeer(void) +{ + int looper; + + y_pos = 0; + + for (x_pos = 70; x_pos > 62; x_pos--) + { + if (x_pos < 62) + y_pos = 1; + + for (looper = 0; looper < 4; looper++) + { + mvwaddch(dotdeer0, y_pos, x_pos, (chtype) '.'); + wrefresh(dotdeer0); + wrefresh(w_del_msg); + werase(dotdeer0); + wrefresh(dotdeer0); + wrefresh(w_del_msg); + } + } + + y_pos = 2; + + for (; x_pos > 50; x_pos--) + { + for (looper = 0; looper < 4; looper++) + { + if (x_pos < 56) + { + y_pos = 3; + + mvwaddch(stardeer0, y_pos, x_pos, (chtype) '*'); + wrefresh(stardeer0); + wrefresh(w_del_msg); + werase(stardeer0); + wrefresh(stardeer0); + } + else + { + mvwaddch(dotdeer0, y_pos, x_pos, (chtype) '*'); + wrefresh(dotdeer0); + wrefresh(w_del_msg); + werase(dotdeer0); + wrefresh(dotdeer0); + } + wrefresh(w_del_msg); + } + } + + x_pos = 58; + + for (y_pos = 2; y_pos < 5; y_pos++) + { + TSHOW(lildeer0, 50); + + for (looper = 0; looper < 4; looper++) + { + SHOW(lildeer3, 50); + SHOW(lildeer2, 50); + SHOW(lildeer1, 50); + SHOW(lildeer2, 50); + SHOW(lildeer3, 50); + + TSHOW(lildeer0, 50); + + x_pos -= 2; + } + } + + x_pos = 35; + + for (y_pos = 5; y_pos < 10; y_pos++) + { + touchwin(middeer0); + wrefresh(middeer0); + wrefresh(w_del_msg); + + for (looper = 0; looper < 2; looper++) + { + SHOW(middeer3, 50); + SHOW(middeer2, 50); + SHOW(middeer1, 50); + SHOW(middeer2, 50); + SHOW(middeer3, 50); + + TSHOW(middeer0, 50); + + x_pos -= 3; + } + } + + napms(2000); + + y_pos = 1; + + for (x_pos = 8; x_pos < 16; x_pos++) + { + SHOW(bigdeer4, 30); + SHOW(bigdeer3, 30); + SHOW(bigdeer2, 30); + SHOW(bigdeer1, 30); + SHOW(bigdeer2, 30); + SHOW(bigdeer3, 30); + SHOW(bigdeer4, 30); + SHOW(bigdeer0, 30); + } + + --x_pos; + + for (looper = 0; looper < 6; looper++) + { + SHOW(lookdeer4, 40); + SHOW(lookdeer3, 40); + SHOW(lookdeer2, 40); + SHOW(lookdeer1, 40); + SHOW(lookdeer2, 40); + SHOW(lookdeer3, 40); + SHOW(lookdeer4, 40); + } + + SHOW(lookdeer0, 40); + + for (; y_pos < 10; y_pos++) + { + for (looper = 0; looper < 2; looper++) + { + SHOW(bigdeer4, 30); + SHOW(bigdeer3, 30); + SHOW(bigdeer2, 30); + SHOW(bigdeer1, 30); + SHOW(bigdeer2, 30); + SHOW(bigdeer3, 30); + SHOW(bigdeer4, 30); + } + + SHOW(bigdeer0, 30); + } + + --y_pos; + + mvwin(lookdeer3, y_pos, x_pos); + wrefresh(lookdeer3); + wrefresh(w_del_msg); +} diff --git a/vendor/pdcurses/docs/HISTORY.md b/vendor/pdcurses/docs/HISTORY.md new file mode 100644 index 0000000..9678cb1 --- /dev/null +++ b/vendor/pdcurses/docs/HISTORY.md @@ -0,0 +1,2477 @@ +PDCurses 3.9 - 2019-09-04 +========================= + +768 colors, single-process X11, copy-and-paste for all, and more. + + +New features +------------ + +- Single-process, single-thread version of the X11 port. Much, much + faster than the two-process version. Needs more testing. This version + omits translations. + +- A common copy-and-paste system for all platforms, based on the + PDC_*clipboard() functions. (This is the first time copy-and-paste is + available for the SDL ports, and it replaces the old X11-specific + C&P.) Press and hold button 1 while selecting; paste with button 2. + Add Shift if mouse events are activated in curses. You can also paste + via Shift-Ctrl-V, and copy with Shift-Ctrl-C (although selecting + already sets the buffer). Note that paste is implemented via + ungetch(), and is currently limited to 256 characters at a time. (You + can get more via PDC_getclipboard().) With some ports (e.g. Wincon), + the existing terminal C&P mechanism may override PDCurses'. DOS and + SDL1 can only C&P within the same app. + +- A new maximum of 768 colors, for Wincon, SDL and X11. COLOR_PAIRS is + still limited to 256. The idea is that each pair can have a unique + foreground and background, without having to redefine any of the first + 256 (predefined) colors. Colors 256-767 have no initial definitions, + and are intended to be set via init_color(). An example has been added + to testcurs (loosely based on part of newtest, by Bill Gray). + +- Wincon now allows redefinition of all 768 colors, and allows it even + under ConEmu. + +- True italics for ConEmu. (It seems it should also support true bold, + but I couldn't make that work.) + +- Added new functions from ncurses and/or NetBSD: has_mouse(), + is_keypad(), is_leaveok(), is_pad(), set_tabsize(), touchoverlap(), + underscore(), underend(), wunderscore(), and wunderend(). See the man + pages for descriptions. Partly due to Karthik Kumar Viswanathan, and + suggestions of Simon Sobisch. + + +Bug fixes and such +------------------ + +- Check for standard C++ (>= 98), where native bool should exist, and use + that; otherwise (pre-/non-standard C++) fall back to the old behavior. + Satisfies clang, hopefully doesn't mess anything else up. + +- Recent versions of clang throw an error over "-install_name". + +- Most curses functions assumed a valid SP (i.e. that initscr() had + already been called). Now, instead, they return ERR or other + appropriate values. Suggestion of S.S. + +- Deprecated PDC_save_key_modifiers() -- there's no benefit to NOT + saving them. + +- Hold back screen updates due to palette changes until paused; always + do this update now (previously only in X11 and SDL, seems necessary in + Windows 10 1903). + +- SDL2 windows were freezing on moving to another screen (reported by + Mark Hessling). Still issues with moving between screens of different + scaling. + +- Find the X libraries in some additional locations. After M.H. + +- Converted default X11 icons to XPM, fixing their non-display in Ubuntu. + +- Made XIM standard, removed "classic" X11 compose system. + +- Made wide-character build the default for X11 (--disable-widec for + narrow). + +- Smoother resizing in X11, when not in scrollbar mode. + +- Dropped X11 options "borderWidth" (broken since at least 2.7) and + "cursorColor" (now set automatically for contrast). + +- Correctly restore Insert mode and QuickEdit mode in Wincon's + PDC_reset_shell_mode(). Patch by "vyv03354". + +- Add a WINDRES variable to wincon/Makefile for the sake of cross- + compilers. Patch by Marc-Andre Lureau. + +- Suppress cursor movement during color tests in testcurs. + +- Added UTF-8-demo.txt for tuidemo to browse (by default, only in forced + UTF-8 mode). File by Markus Kuhn. + +- Moved the doc files from "man" to "docs" -- the docs/man thing was too + confusing. Streamlined the web page into two files. + +- Rewrote the "Portability" sections of the man pages to reflect current + ncurses and NetBSD. The old charts weren't very accurate. + +- Document resolution of timeout() and napms(). Suggested by S.S. + +- Rewrote manext (again) in Awk. + +- Changed most dates to ISO format. + +See the git log for more details. + +------------------------------------------------------------------------ + +PDCurses 3.8 - 2019-02-02 +========================= + +It's that time again. + + +New features +------------ + +- PDC_VERSION structure and PDC_get_version() function, to provide run- + time information on version and compile options, in case they don't + match the header; along with new compile-time defines PDC_VER_MAJOR, + PDC_VER_MINOR and PDC_VERDOT. Suggested by Simon Sobisch, designed + partly after Bill Gray and partly after SDL_VERSION. + +- Extensive documentation revisions, now covering many previously + undocumented functions. + +- Allow building the DLL with MinGW for SDL. (This also changes the + non-DLL library name from libpdcurses.a to pdcurses.a.) + +- Consolidated Watcom makefiles for DOS, after Tee-Kiah Chia; added + MODEL option to Makefile.bcc for consistency. + +- Added another ncurses_test, "lrtest"; updated for ncurses 6.1. + + +Bug fixes and such +------------------ + +- T.H.'s update rect clipper (a resize fix for SDL2) broke sdltest, + because it didn't take the offsets into account for a non-owned + window. + +- The version number is now hardwired only in curses.h and configure.ac. + +- Revised pdcurses.rc to correctly show all fields when checking the + properties on a DLL; use it with MinGW as well as MSVC. + +- Allow building both 32- and 64-bit SDL2 versions in MinGW without + editing the Makefile, by using the proper dev package. + +- Build SDL2 demos in "Windows" mode (i.e. no controlling terminal) with + MSVC, as with MinGW. + +- Build sdltest.exe with MSVC. + +- Changed sample pathname in tuidemo to always use slashes -- the + backslashes failed in, e.g., SDL under Linux or macOS. Patch by B.G. + +- Warning fix for Borland OS/2. + +- Minor file reorganization / renaming. + +- mmask_t is now used in both the classic and ncurses mouse interfaces, + and is defined in such a way as to keep it at 32 bits. + +- Dropped map_button() and getbmap(). + +- Dropped the ability to build BBS-ready archives from the Makefiles. + +- Made manext.py compatible with Python 3.x. + +See the git log for more details. + +------------------------------------------------------------------------ + +PDCurses 3.7 - 2018-12-31 +========================= + +New features +------------ + +- Avoid conflict with ncurses by having apps define PDC_NCMOUSE before + including curses.h to invoke the ncurses-style mouse interface, + instead of NCURSES_MOUSE_VERSION. (The old way will also still work.) + After Simon Sobisch (see PR #33). + +- In SDL (TTF mode), the box-drawing and block ACS characters are now + rendered in a font-independent way, to ensure their correct alignment + across cells. Underlining is now handled in a similar way. + +- TTF fonts in SDL are now rendered in Blended mode instead of Solid. + Partly after Joachim de Groot. + +- New default fonts and font sizes for SDL/TTF. + +- SDL2 now builds under MSVC. Partly due to Alexandru Afrasinei. + +- Documentation re-org -- more Markdown internal links; moved to man/ + dir (the doc/ dir name was too similar to docs/, which is needed for + GitHub Pages hosting); concatenated man page document now made + permanent, under the name MANUAL.md; new man build utils; merged + sdl.md and x11.md into their respective READMEs; changed some + redundant and unclear comments. + +- Directory re-org -- in addition to the above, created common/, to + unclutter the root, and eliminate a few more redundant files from + platform directories. (We already had "pdcurses", but that's for the + portable core; "common" is for files that are more platform-specific, + though shared by more than one platform.) + +- Broke out the redundant ACS tables and moved them to common/. + +- PDcurses' "bool" type is now based on stdbool.h, when available. There + should be no conflicts when including stdbool.h either before or after + curses.h. + +- The demos are no longer built by default, since they add a lot of time + to the build, and often aren't wanted. But you can still build them via + "make demos" (tweak as needed). + +- Makefile tweaks for cross-compiling by Simon Sobisch. + + +Bug fixes and such +------------------ + +- Improved Windows console resizing, when reducing the vertical size. + After Ulf Magnusson. (See GitHub issue #26.) + +- Bring back ifdef'd CONSOLE_SCREEN_BUFFER_INFOEX, for the benefit of + older compile environments. (Not automatic -- must specify INFOEX=N on + the command line.) After Simon Sobisch. + +- Replaced COMMON_LVB_* with numbers to appease some old compilers. + After Simon Sobisch. + +- KEY_RESIZE should be key_code = TRUE. Reported by Ulf Magnusson. + +- SDL2 resize fixes to prevent crashes, by Tim Hentenarr. + +- SDL2 fixes for handling of SDL_TEXTINPUT, keys with modifiers, and + modifier keystrokes, by Tim Hentenarr. + +- Fixed cursor rendering in SDL/TTF. + +- SDL1 support is now dropped for Windows and macOS, and deprecated for + Linux. Use SDL2. The SDL1 port is likely to be dropped in the future. + +- The setsyx() function is now void, after ncurses, and simplified. + +- Warning fixes by Patrick Georgi and Stefan Reinauer. + +- X11 used SP->resized in a non-boolean way, so it's now a short. + +- Under some conditions (see issue #47), the X11 port could "free" colors + that it hadn't allocated. Reported by rin-kinokocan. + +- New scroller for ozdemo -- no memory allocation, less copying -- to + resolve issue #46. + +- Various minor Makefile tweaks. + +- Eliminated term.h and terminfo.c, and moved mvcur() to move.c. These + stub functions, done on request (with others then requesting that I + take them away -- can't win), were a misguided attempt to facilitate + using PDCurses with certain non-C languages -- which, apparently, they + didn't end up actually doing. They're also, regrettably, specified as + part of the X/Open curses standard, even though they in effect + describe an entirely different interface layer (one on which + traditional curses, but not PDCurses, is built). + +- Dropped support for short (16-bit) chtypes. + +- Finally removed deprec.c, as it promised. + +- Dropped the XOPEN, SYSVcurses and BSDcurses defines from curses.h, as + well as NULL (which is defined in stdio.h, included). TRUE, FALSE, ERR + and OK are now defined unconditionally. + +- Moved pdcurses.org hosting to GitHub -- as a result, the site is now + part of the repo, in the docs/ directory. (Also, it has SSL again.) + +See the git log for more details. + +------------------------------------------------------------------------ + +PDCurses 3.6 - 2018-02-14 +========================= + +Tidying up some loose ends from 3.5, and trying to bring all platforms +up to the same level, as much as possible. + + +New features +------------ + +- 256 colors for the Windows console -- under Windows 10 or ConEmu, + only. This version doesn't allow init_color() or color_content() for + colors 16-255, just uses Windows' predefined palette (which matches + xterm-256color, like the default colors in X11 and SDL). + +- Real blinking for the Windows console (all), and for OS/2 -- done in + software, like the Windows version -- replacing the erraticly working + Vio-based version (which didn't work at all in my OS/2 4.5 VM). OS/2 + now always has 16 colors, and bright backgrounds can combine with + blinking. + +- In DOS, OS/2 and Windows, attribute behavior now more closely matches + that of the more "advanced" ports (X11 and SDL) -- see the Attribute + test in testcurs. + +- All of the A_* and WA_* attributes from X/Open are now defined in + curses.h, although some are no-ops, pending the availablity of more + attribute bits. A_INVIS is now a no-op on all platforms, instead of + overloading A_ITALIC, and so is A_PROTECT. A_LEFT and A_RIGHT are now + synonyms for PDCurses' old *LINE attributes. + + +Bug fixes and such +------------------ + +- For the X11 port, "make install" and the dynamic library build were + broken, since the configure move. Fixes partly after Mark Hessling. + +- Renamed "win32" to the more accurate/descriptive "wincon" (i.e. + WINdows CONsole). Makefiles for all platforms renamed to remove the + redundant platform names, and to allow better sorting. + +- In SDL2, apps that didn't explicitly handle resizing locked up. Now, + they can continue running, at their old size. (To Do: xmas is still a + basket case.) + +- Added "/MACHINE:$(PLATFORM)" to wincon/Makefile.vc -- Thomas Dickey + says this is needed to build 64-bit with Visual Studio Express 2012. + With 2017, it suppresses a warning. + +- Suppressed "Possibly incorrect assignment" warnings with BCC, which + also results in more readable code. + +- Cleaned up obsolete comments, dead code, unneeded includes, typos, and + outdated documentation. + +- Dropped support for EMXVIDEO. + +- Dropped color remapping for OS/2 (broken). + +- Dropped X11 DLL support for Cygwin (broken). + +- Rearranged extended color display in testcurs. + +- In ptest, handle resizing, and check for screens too small to run in. + +- Allow KEY_* codes (including KEY_RESIZE) to exit firework, as other + keys do. + +- Slightly faster Windows compilation (most noticeable in Watcom). + +See the git log for more details. + +------------------------------------------------------------------------ + +PDCurses 3.5 - 2018-01-15 +========================= + +So, it's been a while, eh? + +This release is an attempt to bring PDCurses mostly up to date, without +breaking too many things in the process. + + +New features +------------ + +- SDL2 port, and TTF and Unicode support for both SDL1 and SDL2. Credit + for these goes mostly to Laura Michaels and Robin Gustafsson. + +- 256 colors for SDL and X11, by Bill Gray. Colors 16-255 are set up to + match xterm colors, but can be redefined, as with 0-15. + +- Bold and italic font options for SDL and X11. A_BOLD's behavior is + controlled by the new function PDC_set_bold() -- TRUE to select bold + font, FALSE to choose high foregound intensity (as before). Italic + fonts are selected by A_ITALIC (always on). X11 originally from Mark + Hessling. + +- Real blinking in SDL and X11, controlled by PDC_set_blink(). Largely + due to Kevin Lamonte and Bill Gray. + +- Support for A_UNDERLINE, A_LEFTLINE and A_RIGHTLINE in the Windows + console. This requires a recent version of Windows (10, maybe 8?) to + work with the standard console, but underlining also works with + ConEmu, at least as far back as XP. + +- User resizing (i.e. grab window edges or maximize button) for Windows + console -- needs recent Windows or ConEmu. + +- New-style color-changing code for the Windows console (using the new + offical API instead of undocumented functions), supporting + redefinition of colors 0-15 via init_color(). Works at least as far + back as Windows XP SP3. Patch by "Didrole". + +- The Windows console port now creates a separate console buffer by + default, making for a cleaner and more complete restoration of the + original buffer. The old behavior can be used by setting + "PDC_RESTORE_SCREEN=0". Patch by Jason Hood. + +- Left/right scroll wheel support for Windows console, SDL and X11. X11 + by Mark Hessling. + +- testcurs now includes an additional test to show various attributes, + and a display of the extended colors, where applicable. + + +Bug fixes and such +------------------ + +- termattrs() now returns something vaguely resembling the actual + capabilities of the specific "terminal". Specifically, A_BOLD and + A_BLINK reflect the availability of true bold fonts, and real + blinking; when not set in termattrs(), the attributes still work, but + control foreground and background intensity, as before. *LINE are also + meaningful, and even A_COLOR is set (or not). + +- pad size check in pnoutrefresh() was broken since 3.0. Reported by + Peter Hull. + +- In newpad(), begx and begy should be set to zero, otherwise creating a + subpad of the same width or height fails due to the check in subpad(). + Patch by Raphael Assenat. + +- More straightforward math for subpad(), plus another off-by-one error. + Reported by Werner Wenzel, John Hartmann et al. + +- New subwindows/subpads/resized windows should copy _delayms. Patch by + "xaizek". + +- Potentially invalid saved cursor position in resize_window() -- + another off-by-one _maxx/_maxy error. Patch after "Luke-Jr". + +- copywin() needs to disallow corner values equal to _maxx or _maxy, not + just less than. Reported by "Aleksandr". + +- Misaligned soft-label keys in 4-4-4 mode. Reported by Werner Wenzel. + +- Missing prototypes for bkgrnd() and bkgrndset(). + +- Missing WA_NORMAL and WA_ATTRIBUTES from the X/Open spec. + +- keyname() and termname() now return static buffers, as documented. + +- In the X11 port, due to (post-PDCurses-3.4) changes in Xt, + XtAppMainLoop() always hung. Fixed by re-implementing it within + PDCurses, basically. + +- Fix blinking X11 cursor for clients that call move() more frequently + than cursorBlinkRate -- patch by Kevin Lamonte. + +- Improved cursor rendering for X11, by John P. Hartmann. + +- ALT key combos sometimes not reported in X11, per Mark Hessling et al. + +- Support for XK_ISO_Left_Tab in X11, by John P. Hartmann. + +- Support for "Super" keys in X11, by Bill Gray. + +- Make xcurses-config include -DPDC_WIDE when appropriate, per M.H. + +- The configure script and accompanying files, which were always + specific only to the X11 port (causing considerable confusion), have + been moved to the x11 directory. + +- In SDL, SP->key_code wasn't being set for KEY_MOUSE events. Reported + by Bill Gray. + +- SDL events need to keep pumping through non-input delays. (Really + messed up on current macOS before this change.) + +- SDL2 is outperforming SDL1 by about 10x on the platforms I've tried + that support both, so I've removed Makefile.mng from the SDL1 port. + +- Updated for the most current compilers, wherever possible; various + warning suppressions. All included makefiles were tested with their + respective compilers, shortly before release (including the POSIX + stuff on macOS with clang, and on Ubuntu Linux with gcc). The oldest + compiler I tested with was Turbo C++ 3.0, from 1992; the latest, + several compilers from 2017. + +- Dropped support for LCC-Win32 -- the official site is shut down. + +- Dropped support for Digital Mars -- not updated since 2014, limited + makefile, library missing some needed Windows APIs. + +- Dropped MS C for DOS, and Cset/2 for OS/2. + +- Dropped support for building DLLs with EMX. + +- Minor code and makefile reorganization; mingwin32.mak merged into + gccwin32.mak (i.e. you can use it with both compilers). Some + contributions by Bill Gray and Simon Sobisch. + +- Watcom makefile paths and option markers changed to Unix-friendly + style, after Tee-Kiah Chia. + +- The *.def files are no longer needed, replaced by more PDCEX + declarations in the include files. After Bill Gray and Simon Sobisch. + +- When building with DEBUG=Y, no longer strip the executables. After + Simon Sobisch. + +- Hold debug file ("trace") open after traceon(), for greater + performance. Set PDC_TRACE_FLUSH to make it fflush() after each write + (slower but safer in case of a crash). Patch by Ellie Timoney. + +- Since 3.2, the panel library was simply a copy of the main library. + This kludge is now dropped. (panel.h remains separate from curses.h.) + +- Removed PDCurses.spec, and the RPM-building makefile option. I think + this is better left to the various package/distro maintainers. + +- Various formatting corrections (e.g., trailing spaces stripped), and + variables renamed to avoid clashes. Some contributed by Stefan + Reinauer and Bill Gray. + +- Various documentation corrections and updates. All documentation + "converted" to Markdown format (involving few actual changes -- mainly + the file extension), for better rendering on GitHub, SourceForge, etc. + Some contributed by Anatoly Techtonik. + +- The "Win32" label is deprecated by Microsoft, and accordingly I've + replaced references in the documentation, although not yet changed the + filenames. The Windows console code can just as well be built for + 64-bit (and always could be, AFAIK, although there are minor tweaks + to support it in this version). + +- The ncurses_tests can now be built under SDL as well as X11. Also, all + our tests (still/again) build under recent ncurses. + +- Put testcurs' "Output test" into real blink mode, if possible; and if + COLORS >= 16, use colors 0-15 directly in the color test, instead of + or'ing with A_BOLD to get the high-intensity colors. + +- Renamed the (by now rather old) "newdemo" to "ozdemo". + +- Moved from CVS to git; source is now on GitHub as well as SourceForge; + central site is now pdcurses.org. + +See the git log for more details. + +------------------------------------------------------------------------ + +PDCurses 3.4 - 2008-09-08 +========================= + +Nothing much new this time, but I've been sitting on some bug fixes for +almost a year, so it's overdue. Apart from bugs, the main changes are in +the documentation. + +New features: + +- setsyx() is now a function rather than a macro. + +Bug fixes and such: + +- In x11, the xc_atrtab table size was under-calculated by half, + resulting in crashes at (oddly) certain line counts. (It should've + crashed a lot more.) Reported by Mark Hessling. + +- Test for moved cursor was omitting the window origin offset. Reported + by Carey Evans. + +- Is DOS and OS/2, the value for max items in key_table was still wrong. + Reported by C.E. + +- Changed isendwin() so it won't crash after delscreen(). + +- Ensure zero-termination in PDC_mbstowcs() and PDC_wcstombs(). + +- Disable QuickEdit Mode when enabling mouse input for the Win32 + console; reported by "Zalapkrakna". + +- Fix for building under Innotek C (I hope). Report by Elbert Pol, fix + courtesy of Paul Smedley. + +- Unified exports list with no duplicates -- pdcurses.def is now built + from components at compile time. + +- Don't install curspriv.h, and don't include it with binary + distributions. + +- Building DLLs with LCC is no longer supported, due to the primitive + nature of its make.exe. + +- Export the terminfo stub functions from the DLLs, too. + +- Added support for Apple's ".dylib" in configure. Suggested by Marc + Vaillant (who says it's needed with OS 10.5.) + +- In sdl1/Makefile.mng, ensure that CC is set. + +- In the gcc makefiles, "$?" didn't really have the desired effect -- + _all_ the dependencies showed up on the command line, including + curses.h, and pdcurses.a twice. And apparently, this can mess up some + old version (?) of MinGW. So, revert to spelling out "tuidemo.o + tui.o". Reported by "Howard L." + +- Extensive documentation revision and reorganizing. More to do here. + For example, I moved the build instructions from INSTALL (which never + really described installation) to the platform-specific READMEs. + +- New indentation standard: four spaces, no tabs. + +------------------------------------------------------------------------ + +PDCurses 3.3 - 2007-07-11 +========================= + +This release adds an SDL backend, refines the demos, and is faster in +some cases. + +New features: + +- SDL port. See INSTALL, doc/sdl.txt and sdl1/* for details. + +- Double-buffering -- minimize screen writes by checking, in doupdate() + and wnoutrefresh(), whether the changes to curscr are really changes. + In most cases, this makes no difference (writes were already limited + to areas marked as changed), but it can greatly reduce the overhead + from touchwin(). It also helps if you have small, separated updates on + the same line. + +- The PDC_RGB colors can now be used, or not, with any platform (as long + as the same options are used when compiling both the library and + apps). This may help if you have apps that are hardwired to assume + certain definitions. + +- Restored the use_default_colors() stuff from the ncurses versions of + the rain and worm demos, to make them "transparent" (this is useful + now, with the SDL port); added transparency to newdemo. + +- Added setlocale() to tuidemo, to make it easier to browse files with + non-ASCII characters. + +- Sped up firework demo by replacing unneeded clear() and init_pair() + calls. + +- Allow exit from ptest demo by typing 'q'. + +- New functions for implementors: PDC_pair_content() and PDC_init_pair() + (the old pdc_atrtab stuff was arguably the last remnant of code in the + pdcurses directory that was based on platform details). + +Bug fixes and such: + +- Implicit wrefresh() needs to be called from wgetch() when the window's + cursor position is changed, even if there are no other changes. + +- Set SP->audible on a per-platform basis, as was documented in + IMPLEMNT, but not actually being done. + +- Minor tweaks for efficiency and readability, notably with wscrl(). + +- tuidemo didn't work correctly on monochrome screens when A_COLOR was + defined -- the color pair numbers appeared as the corresponding + character; also, the input box was (I now realize) broken with ncurses + since our 2.7, and broke more subtly with PDCurses' new implicit + refresh handling; also, the path to the default file for the Browse + function was a bit off. + +- Assume in the demos that curs_set() is always available -- there's no + good test for this, and the existing tests were bogus. + +- Made the command-line parameter for ptest work. (If given an argument, + it delays that number of milliseconds between changes, instead of + waiting for a key, and automatically loops five times.) + +- Building the Win32 DLL with MinGW or Cygwin wouldn't work from outside + the platform directory. + +- Building the X11 port with Cygwin required manually editing the + Makefile after configuring; no longer. Reported by Warren W. Gay. + +- Minor tightening of configure and makefiles. + +- Bogus references to "ACS_BLCORNER" in the border man page. Reported by + "Walrii". + +- slk_wlabel() was not documented. + +- Spelling cleanup. + +- Changed RCSIDs to not end with a semicolon -- avoids warnings when + compiling with the -pedantic option. + +- Merged latin-1.txt into x11.txt. + +- Updated config.guess and config.sub to more recent versions. + +------------------------------------------------------------------------ + +PDCurses 3.2 - 2007-06-06 +========================= + +This release mainly covers changes to the build process, along with a +few structural changes. + +New features: + +- The panel library has been folded into the main library. What this + means is that you no longer need to specify "-lpanel" or equivalent + when linking programs that use panel functionality with PDCurses; + however, panel.lib/.a is still provided (as a copy of pdcurses.lib/.a) + so that you can, optionally, build your projects with no changes. It + also means that panel functionality is available with the DLL or + shared library. Note that panel.h remains separate from curses.h. + +- Setting the PDCURSES_SRCDIR environment variable is no longer required + before building, unless you want to build in a location other than the + platform directory. (See INSTALL.) + +- MinGW and Cygwin makefiles support building DLLs, via the "DLL=Y" + option. Partly due to Timofei Shatrov. + +- Support for the Digital Mars compiler. + +- Watcom makefiles now use the "loaddll" feature. + +Bug fixes and such: + +- Eliminated the platform defines (DOS, WIN32, OS2, XCURSES) from + curses.h, except for X11-specific SCREEN elements and functions. + Dynamically-linked X11 apps built against an old version will have + their red and blue swapped until rebuilt. (You can define PDC_RGB to + build the library with the old color scheme, but it would also have to + be defined when building any new app.) Any app that depends on + PDCurses to determine the platform it's building on will have to make + other arrangements. + +- Documentation cleanup -- added more details; removed some content that + didn't apply to PDCurses; moved the doc-building tool to the doc + directory; changed *.man to *.txt. + +- The EMX makefile now accepts "DLL=Y", builds pdcurses.dll instead of + curses.dll, builds either the static library or the DLL (not both at + once), and links all the demos with the DLL when building it. + +- In Win32, read the registry only when needed: when init_color() or + color_content() is called, instead of at startup. + +- A few additional consts in declarations. + +- The Win32 compilers that build DLLs now use common .def files. + +- panel.h functions sorted by name, as with other .h files; curses.h is + no longer included by repeated inclusions of panel.h or term.h. + +- Simplified Borland makefiles. + +- Makefile.aix.in depended on a file, xcurses.exp, that was never there. + This problem was fixed as part of the change to common .def files; + however, I still haven't been able to test building on AIX. + +------------------------------------------------------------------------ + +PDCurses 3.1 - 2007-05-03 +========================= + +Primarily clipboard-related fixes, and special UTF-8 support. + +New features: + +- "Force UTF-8" mode, a compile-time option to force the use of UTF-8 + for multibyte strings, instead of the system locale. (Mainly for + Windows, where UTF-8 doesn't work well in the console.) See INSTALL. + +- Multibyte string support in PDC_*clipboard() functions, and in Win32's + PDC_set_title(). + +- Added the global string "ttytype", per other curses implementations, + for compatibility with old BSD curses. + +- Real functions for the "quasi-standard aliases" -- crmode(), + nocrmode(), draino(), resetterm(), fixterm() and saveterm(). + (Corresponding macros removed.) + +Bug fixes and such: + +- In Win32, under NT-family OSes, the scrollback buffer would be + restored by endwin(), but would not be turned off again when resuming + curses after an endwin(). The result was an odd, partly-scrolled-up + display. Now, the buffer is toggled by PDC_reset_prog_mode() and + PDC_reset_shell_mode(), so it's properly turned off when returning + from an endwin(). + +- In 3.0, selection in X11 didn't work. (Well, the selecting worked, but + the pasting elsewhere didn't.) This was due to the attempted fix + "don't return selection start as a press event," so that's been + reverted for now. + +- PDC_setclipboard() was locking up in X11. Reported by Mark Hessling. + +- Missing underscore in the declaration of XC_say() prevented + compilation with PDCDEBUG defined. Reported by M.H. + +- Off-by-one error in copywin() -- the maximum coordinates for the + destination window should be inclusive. Reported by Tiago Dionizio. + +- Start in echo mode, per X/Open. Reported by T.D. + +- Strip leading and trailing spaces from slk labels, per a literal + reading of X/Open. Suggested by Alexey Miheev (about ncurses, but it + also applies here). + +- The #endif for __PDCURSES__ needs to come _after_ the closing of the + extern "C". This has been broken since June 2005. Fortunately (?), it + only shows up if the file is included multiple times, and then only in + C++. Reported on the DOSBox forums. + +- Use CF_OEMTEXT instead of CF_TEXT in the narrow versions of the + clipboard functions in Win32, to match the console. + +- Changed the format of the string returned from longname(). + +- In the clipboard test in the testcurs demo, use a single mvprintw() to + display the return from PDC_getclipboard(), instead of a loop of + addch(), which was incompatible with multibyte strings. + +- Moved has_key() into the keyname module, and documented it. + +- Moved RIPPEDOFFLINE to curspriv.h. + +- Typos in IMPLEMNT. + +------------------------------------------------------------------------ + +PDCurses 3.0 - 2007-04-01 +========================= + +The focuses for this release are X/Open conformance, i18n, better color +support, cleaner code, and more consistency across platforms. + +This is only a brief summary of the changes. For more details, consult +the CVS log. + +New features: + +- An almost complete implementation of X/Open curses, including the + wide-character and attr_t functions (but excluding terminfo). The + wide-character functions work only in Win32 and X11, for now, and + require building the library with the appropriate options (see + INSTALL). Note that this is a simplistic implementation, with exactly + one wchar_t per cchar_t; the only characters it handles properly are + those that are one column wide. + +- Support for X Input Methods in the X11 port (see INSTALL). When built + this way, the internal compose key support is disabled in favor of + XIM's, which is a lot more complete, although you lose the box cursor. + +- Multibyte character support in the non-wide string handling functions, + per X/Open. This only works when the library is built with wide- + character support enabled. + +- Mouse support for DOS and OS/2. The DOS version includes untested + support for scroll wheels, via the "CuteMouse" driver. + +- An ncurses-compatible mouse interface, which can work in parallel with + the traditional PDCurses mouse interface. See the man page (or + mouse.c) for details. + +- DOS and OS/2 can now return modifiers as keys, as in Win32 and X11. + +- COLORS, which had been fixed at 8, is now either 8 or 16, depending on + the terminal -- usually 16. When it's 8, blinking mode is enabled + (controlled as before by the A_BLINK attribute); when it's 16, bright + background colors are used instead. On platforms where it can be + changed, the mode is toggled by the new function PDC_set_blink(). + PDCurses tries to set PDC_set_blink(FALSE) at startup. (In Win32, it's + always set to FALSE; in DOS, with other than an EGA or VGA card, it + can't be.) Also, COLORS is now set to 0 until start_color() is called. + +- Corresponding to the change in COLORS, COLOR_PAIRS is now 256. + +- Working init_color() and color_content(). The OS/2 version of + init_color() works only in a full-screen session; the Win32 version + works only in windowed mode, and only in NT-family OSes; the DOS + version works only with VGA adapters (real or simulated). The Win32 + version is based mostly on James Brown's setconsoleinfo.c + (www.catch22.net). + +- use_default_colors(), assume_default_colors(), and curses_version(), + after ncurses. + +- Added global int TABSIZE, after ncurses and Solaris curses; removed + window-specific _tabsize. + +- Logical extension to the wide-character slk_ funcs: slk_wlabel(), for + retrieving the label as a wide-character string. + +- A non-macro implementation of ncurses' wresize(). + +- Working putwin(), getwin(), scr_dump() and scr_restore(). + +- A working acs_map[]. Characters from the ACS are now stored in window + structures as a regular character plus the A_ALTCHARSET attribute, and + rendered to the ACS only when displayed. (This allows, for example, + the correct display on one platform of windows saved from another.) + +- In X11, allow selection and paste of UTF8_STRING. + +- The testcurs demo now includes a color chart and init_color() test, a + wide character input test, a display of wide ACS characters with + sample Unicode text, a specific test of flash(), more info in the + resize test, and attempts to change the width as well as the height. + +- Command-line option for MSVC to build DLLs (see INSTALL). Also, the + naming distinction for DLLs ("curses" vs. "pdcurses") is abandoned, + and either the static lib or DLL is built, not both at once (except + for X11). + +- For backwards compatibility, a special module just for deprecated + functions -- currently PDC_check_bios_key(), PDC_get_bios_key(), + PDC_get_ctrl_break() and PDC_set_ctrl_break(). These shouldn't be used + in applications, but currently are... in fact, all the "private" + functions (in curspriv.h) are subject to change and should be avoided. + +- A new document, IMPLEMNT, describing PDCurses' internal functions for + those wishing to port it to new platforms. + +- Mark Hessling has released the X11 port to the public domain. + (However, x11/ScrollBox* retain their separate copyright and MIT-like + license.) + +Bug fixes and such: + +- Most of the macros have been removed (along with the NOMACROS ifdef). + The only remaining ones are those which have to be macros to work, and + those that are required by X/Open to be macros. There were numerous + problems with the macros, and no apparent reason to keep them, except + tradition -- although it was PCcurses 1.x that first omitted them. + +- Clean separation of platform-specific code from the rest. Outside of + the platform directories, there remain only a few ifdefs in curses.h + and curspriv.h. + +- General reorganization and simplification. + +- Documentation revisions. + +- When expanding control characters in addch() or insch(), retain the + attributes from the chtype. + +- Preserve the A_ALTCHARSET attribute in addch() and insch(). + +- Per X/Open, beep() should always return OK. + +- On platforms with a controlling terminal (i.e., not X11), curs_set(1) + now sets the cursor to the shape it had at the time of initscr(), + rather than always making it small. (Exception for DOS: If the video + mode has been changed by PDC_resize_screen(), curs_set(1) reverts to + line 6/7.) The shape is taken from SP->orig_cursor (the meaning of + which is platform-specific). + +- Stop updating the cursor position when the cursor is invisible (this + gives a huge performance boost in Win 9x); update the cursor position + from curs_set() if changing from invisible to visible. + +- Some tweaking of the behavior of def_prog_mode(), def_shell_mode(), + savetty(), reset_prog_mode(), reset_shell_mode() and resetty()... + still not quite right. + +- flash() was not implemented for Win32 or X. A portable implementation + is now used for all platforms. Note that it's much slower than the + old (DOS and OS/2) version, but this is only apparent on an extremely + slow machine, such as an XT. + +- In getstr(), backspacing on high-bit characters caused a double + backspace. + +- hline() and vline() used an incorrect (off by one) interpretation of + _maxx and _maxy. If values of n greater than the max were specified, + these functions could access unallocated memory. + +- innstr() is supposed to return the number of characters read, not just + OK or ERR. Reported by Mike Aubury. + +- A proper implementation of insch() -- the PDC_chadd()-based version + wasn't handling the control characters correctly. + +- Return ASCII and control key names from keyname() (problem revealed by + ncurses' movewindow test); also, per X/Open, return "UNKNOWN KEY" when + appropriate, rather than "NO KEY NAME". + +- Turn off the cursor from leaveok(TRUE), even in X11; leaveok(FALSE) + now calls curs_set(1), regardless of the previous state of the cursor. + +- In the slk area, BUTTON_CLICKED events now translate to function keys, + along with the previously recognized BUTTON_PRESSED events. Of course, + it should really be checking the events specified by map_button(), + which still doesn't work. + +- napms(0) now returns immediately. + +- A unified napms() implementation for DOS -- no longer throttles the + CPU when built with any compiler. + +- Allow backspace editing of the nocbreak() buffer. + +- pair_content(0, ...) is valid. + +- There was no check to ensure that the pnoutrefresh() window fit within + the screen. It now returns an ERR if it doesn't. + +- In X11, resize_term() must be called with parameters (0, 0), and only + when SP->resized is set, else it returns ERR. + +- Copy _bkgd in resize_window(). Patch found on Frederic L. W. Meunier's + web site. + +- slk_clear() now removes the buttons completely, as in ncurses. + +- Use the current foreground color for the line attributes (underline, + left, right), unless PDC_set_line_color() is explicitly called. After + setting the line color, you can reset it to this mode via + "PDC_set_line_color(-1)". + +- Removed non-macro implementations of COLOR_PAIR() and PAIR_NUMBER(). + +- Dispensed with PDC_chadd() and PDC_chins() -- waddch() and winsch() + are now (again) the core functions. + +- Dropped or made static many obsolete, unused, and/or broken functions, + including PDC_chg_attrs(), PDC_cursor_on() and _off(), + PDC_fix_cursor(), PDC_get_attribute(), PDC_get_cur_col() and _row(), + PDC_set_80x25(), PDC_set_cursor_mode(), PDC_set_rows(), + PDC_wunderline(), PDC_wleftline(), PDC_wrightline(), + XCursesModifierPress() and XCurses_refresh_scrollbar(). + +- Obsolete/unused defines: _BCHAR, _GOCHAR, _STOPCHAR, _PRINTCHAR + _ENDLINE, _FULLWIN and _SCROLLWIN. + +- Obsolete/unused elements of the WINDOW struct: _pmax*, _lastp*, + _lasts*. + +- Obsolete/unused elements of the SCREEN struct: orgcbr, visible_cursor, + sizeable, shell, blank, cursor, orig_emulation, font, orig_font, + tahead, adapter, scrnmode, kbdinfo, direct_video, video_page, + video_seg, video_ofs, bogus_adapter. (Some of these persist outside + the SCREEN struct, in the platform directories.) Added mouse_wait and + key_code. + +- Removed all the EMALLOC stuff. Straight malloc calls were used + elsewhere; it was undocumented outside of comments in curspriv.h; and + there are better ways to use a substitute malloc(). + +- Single mouse clicks are now reportable on all platforms (not just + double-clicks). And in general, mouse event reporting is more + consistent across platforms. + +- The mouse cursor no longer appears in full-screen mode in Win32 unless + a nonzero mouse event mask is used. + +- ALT-keypad input now works in Win32. + +- In Win32, SetConsoleMode(ENABLE_WINDOW_INPUT) is not useful, and + appears to be the source of a four-year-old bug report (hanging in + THE) by Phil Smith. + +- Removed the PDC_THREAD_BUILD stuff, which has never worked. For the + record: PDCurses is not thread-safe. Neither is ncurses; and the + X/Open curses spec explicitly makes it a non-requirement. + +- With the internal compose key system in the X11 port, modifier keys + were breaking out of the compose state, making it impossible to type + accented capitals, etc. Also, Multi_key is now the default compose + key, instead of leaving it undefined by default; and a few more combos + are supported. + +- In X11, the first reported mouse event after startup always read as a + double-click at position 0, 0. (This bug was introduced in 2.8.) + +- In X11, don't return selection start as a press event. (Shift-click on + button 1 is still returned.) + +- In X11, properly handle pasting of high-bit chars. (It was doing an + unwanted sign extension.) + +- In X11, BUTTON_MOVED was never returned, although PDC_MOUSE_MOVED was + set. + +- The fix in 2.8 for the scroll wheel in X11 wasn't very good -- it did + report the events as scroll wheel events, but it doubled them. Here's + a proper fix. + +- Changed mouse handling in X11: Simpler translation table, with + XCursesPasteSelection() called from XCursesButton() instead of the + translation table; require shift with button 1 or 2 for select or + paste when mouse events are being reported (as with ncurses), allowing + passthrough of simple button 2 events. This fixes the previously + unreliable button 2 behavior. + +- Modifier keys are now returned on key up in X11, as in Win32. And in + general, modifier key reporting is more consistent across platforms. + +- Modifiers are not returned as keys when a mouse click has occurred + since the key press. + +- In BIOS mode (in DOS), count successive identical output bytes, and + make only one BIOS call for all of them. This dramatically improves + performance. + +- The cursor position was not always updated correctly in BIOS mode. + +- In testcurs, the way the ACS test was written, it would really only + work with a) PDCurses (with any compiler), or b) gcc (with any + curses). Here's a more portable implementation. + +- Better reporting of mouse events in testcurs. + +- Blank out buffer and num before the scanw() test in testcurs, in case + the user just hits enter or etc.; clear the screen after resizing. + +- Allow tuidemo to use the last line. + +- Separate left/right modifier keys are now reported properly in Win32. + (Everything was being reported as _R.) + +- Attempts to redirect input in Win32 now cause program exit and an + error message, instead of hanging. + +- Dropped support for the Microway NDP compiler. + +- Some modules renamed, rearranged. + +- Fixes for errors and warnings when building with Visual C++ 2005. + +- In MSVC, the panel library didn't work with the DLL. + +- Complete export lists for DLLs. + +- Simplified makefiles; moved common elements to .mif files; better + optimization; strip demos when possible. + +- Changed makefile targets of "pdcurses.a/lib" and "panel.a/lib" to + $(LIBCURSES) and $(LIBPANEL). Suggestion of Doug Kaufman. + +- Changed "install" target in the makefile to a double-colon rule, to + get around a conflict with INSTALL on non-case-sensitive filesystems, + such as Mac OS X's HFS+. Reported by Douglas Godfrey et al. + +- Make PDCurses.man dependent on manext. Suggestion of Tiziano Mueller. + +- Set up configure.ac so autoheader works; removed some obsolescent + macros. Partly the suggestion of T.M. + +- The X11 port now builds in the x11 directory (including the demos), as + with other ports. + +- The X11 port should now build on more 64-bit systems. Partly due to + M.H. + +- The default window title and icons for the X11 port are now "PDCurses" + instead of "XCurses". + +- Internal functions and variables made static where possible. + +- Adopted a somewhat more consistent naming style: Internal functions + with external linkage, and only those, have the prefix "PDC_"; + external variables that aren't part of the API use "pdc_"; static + functions use "_"; and "XC_" and "xc_" prefixes are used for functions + and variables, respectively, that are shared between both processes in + the X11 port. Also eliminated camel casing, where possible. + +- Changed the encoding for non-ASCII characters in comments and + documentation from Latin-1 to UTF-8. + +------------------------------------------------------------------------ + +PDCurses 2.8 - 2006-04-01 +========================= + +As with the previous version, you should assume that apps linked against +older dynamic versions of the library won't work with this one until +recompiled. + +New features: + +- Simpler, faster. + +- Declarations for all supported, standard functions, per the X/Open + Curses 4.2 spec, with the notable exception of getch() and ungetch(). + You can disable the use of the macro versions by defining NOMACROS + before including curses.h (see xmas.c for an example). NOMACROS yields + smaller but theoretically slower executables. + +- New functions: vwprintw(), vwscanw(), vw_printw() and vw_scanw(). This + completes the list of X/Open 4.2 functions, except for those concerned + with attr_t and wide characters. Some (especially the terminfo/termcap + functions) aren't yet fully fleshed out, though. + +- Non-macro implementations for COLOR_PAIR(), PAIR_NUMBER(), getbkgd(), + mvgetnstr(), mvwgetnstr(), mvhline(), mvvline(), mvwhline(), and + mvwvline(). (The macros are still available, too.) + +- newterm() works now, in a limited way -- the parameters are ignored, + and only the first invocation will work (i.e., only one SCREEN can be + used). + +- start_color() works now -- which is to say, if you _don't_ call it, + you'll only get monochrome output. Also, without calling it, the + terminal's default colors will be used, where supported (currently + only in Win32). This is equivalent to the PDC_ORIGINAL_COLORS behavior + introduced in 2.7, except that _only_ the default colors will be used. + (PDC_ORIGINAL_COLORS is still available, if you want to combine the + use of specific colors and the default colors.) + +- New logic for termname() and longname(): termname() always returns + "pdcurses"; longname() returns "PDCurses for [platform] [adapter] + [COLOR/MONO]-YxX" (adapter is only defined for DOS and OS/2). This is + the first time these functions return _anything_ in Win32. + +- New installation method for XCurses: the header files are placed in a + subdirectory "xcurses" within the include directory, rather than being + renamed. (But the renamed xcurses.h and xpanel.h are also installed, + for backwards compatibility.) curspriv.h and term.h are now available, + and existing curses-based code need no longer be edited to use + XCurses' curses.h. And with no more need for explicit XCursesExit() + calls (see below), your code need not be changed at all to move from + another curses implementation to XCurses. It can be as simple as "gcc + -I/usr/local/include/xcurses -lXCurses -oprogname progname.c". + +- Combined readme.* into this HISTORY file, and incorporated the old 1.x + (PCcurses) history. + +- New functionality for the testcurs demo: ACS character display; menu + support for PgUp, PgDn, Home and End; centered menu; and it can now + be resized in X. + +- Added modified versions of the rain and worm demos from ncurses. + +Bug fixes and such: + +- Big cleanup of dead and redundant code, including unneeded defines, + ifdefs, and structure elements. + +- flushinp() was not implemented for Win32. + +- resetty() was not restoring LINES and COLS. + +- nonl() made '\n' print a line feed without carriage return. This was + incorrect. + +- Removed bogus implementation of intrflush(). + +- The line-breakout optimization system, disabled by default in 2.7, is + removed in 2.8. It simply didn't work, and never has. (The typeahead() + function remains, for compatibility, but does nothing.) + +- The declarations for the printw() and scanw() function families were + erroneously ifdef'd. + +- Safer printw() calls on platforms that support vsnprintf(). + +- Use the native vsscanf() in DJGPP, MinGW and Cygwin. + +- ACS_BLOCK now works in X. + +- Explicit calls to XCursesExit() are no longer needed. + +- XCURSES is now defined automatically if not DOS, OS2 or WIN32. + +- The default icon for XCurses wasn't working (had to remove the focus + hint code to fix this). Also, the default title is now "XCurses" + instead of "main". + +- Incorrect dimensions (undercounting by two in each direction) were + shown while resizing in X. + +- Scroll wheel events were not always correctly reported in X. + +- 32 bits are enough for the "long" chtype, but 64 bits were used on a + 64-bit system, wasting memory. Now conditioned on _LP64. This could be + faster, too. + +- The short, 16-bit chtype now works with XCurses. + +- Corrected return value for is_linetouched(), is_wintouched(), + can_change_color() and isendwin() (bool instead of int). + +- timeout(), wtimeout(), idcok() and immedok() return void. + +- pair_content() takes a short. + +- Replaced incorrect usages of attr_t with chtype. attr_t is still + typedef'd, for backwards compatibility. (It's supposed to be used for + the WA_*-style functions, which PDCurses doesn't yet support.) + +- Added const where required by the spec, and in other appropriate + places. + +- Removed PDC_usleep(). napms() is now the core delay routine. + +- Fixed poll() support in napms(). + +- Various changes to the internal PDC_* functions -- don't depend on + these, and don't use them unless you absolutely have to. + +- Some routines accessed window structures in their variable + declarations, _before_ checking for a NULL window pointer. + +- Dropped support for the undocumented PDC_FULL_DISPLAY, wtitle(), and + PDC_print(). + +- Cleaned up remaining warnings. + +- Reduced unnecessary #include directives -- speeds up compilation. + +- Fix for demos build in Borland/DOS -- the makefile in 2.7 didn't + specify the memory model. Reported by Erwin Waterlander. + +- Simplified the makefiles; e.g., some now build each demo in a single + step, and Watcom no longer uses demos.lnk. Also, the demo exes are now + stripped when possible; maximum compression used for archives built + by the makefiles; xcurses-config removed as part of "make distclean"; + and I tweaked optimization for some platforms. + +- Reverted to /usr/local/ as default installation directory for XCurses. + +- Upgraded to autoconf 2.59... instantly doubling the size of the + configure script. Ah well. Otherwise, simplified the build system. + +- Dropped support for pre-ANSI compilers. (It hasn't worked since at + least version 2.4, anyway.) + +- Revised and, I hope, clarified the boilerplate and other comments. + +- Simplified logging and RCS ids; added RCS ids where missing. + +- Consistent formatting for all code, approximately equivalent to + "indent -kr -i8 -bl -bli0", with adjustments for 80 columns. + +------------------------------------------------------------------------ + +PDCurses 2.7 - 2005-12-30 +========================= + +INTRODUCTION: + +Hello all. As of a few weeks ago, I'm the new maintainer for PDCurses. +Here's a brief summary of changes in this release. (More details are +available in the CVS log and trackers on SourceForge.) + +NEW FEATURES: + +- Functions: delscreen(), getattrs(), has_key(), slk_color(), + wcolor_set(), wtimeout(). + +- Macros: color_set(), mvhline(), mvvline(), mvwgetnstr(), mvwhline(), + mvwvline(), timeout(), wresize(). + +- Stub implementations of terminfo functions (including a term.h). + +- More stubs for compatibility: filter(), getwin(), putwin(), + noqiflush(), qiflush(), scr_dump(), scr_init(), scr_restore(), + scr_set(), use_env(), vidattr(), vidputs(). + +- The terminal's default colors are used as curses' default colors when + the environment variable "PDC_ORIGINAL_COLORS" is set to any value + (Win32 only at the moment). + +- Simplified build system. + +- Replaced PDC_STATIC_BUILD with its opposite, PDC_DLL_BUILD (see .mak + files for more info). + +- Minimal implementation of color_content() -- no longer a stub. + +- Added the remaining ACS defines (ACS_S3, ACS_BBSS, etc.) for + DOS/OS2/Win; "enhanced" versions of existing ACS characters used. + +- Support for scroll wheels. + +- Support for Pacific C. + +BUGS FIXED: + +- Builds correctly (including demos) on all tested platforms (see + below); nearly all compiler warnings have been cleaned up; the ptest + demo is built on all platforms; "clean" targets are improved. + +- The ability to build ncurses_tests has been restored (see demos dir). + +- Line-breakout optimization now defaults to off (equivalent to + "typeahead(-1)"), so output is not interrupted by keystrokes (it's + supposed to resume on the next refresh(), which wasn't working). + +- Implicit wrefresh() in wgetch() was not being invoked in nodelay mode. + +- subpad() was erroneously offsetting from the origin coordinates of the + parent pad (which are always -1,-1). + +- In wborder(), whline(), and wvline(), the current (wattrset) attribute + was being used, but not the current background (wbkgd). + +- Allow Russian 'r' character ASCII 0xe0 to be returned. + +- termattrs() now also returns A_UNDERLINE, A_REVERSE. + +- In Win32, with large scrollback buffers set, there was an unwanted + "scrollup" effect on startup. + +- Revamped keyboard handling for Win32. + +- New screen resize method for Win32. + +- napms(), delay_output(), etc. now work with Cygwin. + +- curs_set(0) wasn't working in Win32 in full-screen (ALT-ENTER) mode -- + the cursor stayed on. + +- The A_REVERSE attribute was broken in XCurses. + +- On 64-bit systems, XCurses was ignoring every other keystroke. + +- Added focus hints for XCurses. + +- Demos (except for tuidemo) once again have their proper titles in + XCurses (using Xinitscr() instead of the obsolete XCursesProgramName). + +- The 16-bit chtype is a working option again (by removing #define + CHTYPE_LONG from curses.h), except in XCurses. It's not recommended; + but if your needs are limited, it still works. + +- Reset screen size in resetty() under DOS, as in Win32 and OS/2. + +- Changes for cursor size under DOS. + +- Automatic setting of BIOS mode for CGA under DOS now works. + +- The cursor is now always updated in PDC_gotoxy(); this fixes the + problem of missing characters in BIOS mode. + +- Macros nocbreak(), cbreak(), nocrmode(), crmode(), nodelay(), + nl() and nonl() now return OK. + +- ERR and OK are now defined as -1 and 0, respectively, for + compatibility with other curses implementations -- note that this + change is not binary compatible; you'll have to rebuild programs that + use shared/dynamic libraries. + +- Added "const" to prototypes where appropriate. + +- Miscellaneous code cleanup. + +ACKNOWLEDGEMENTS: + + - Walter Briscoe + - Jean-Pierre Demailly + - Ruslan Fedyarov + - Warren Gay + - Florian Grosse-Coosmann + - Vladimir Kokovic + - Matt Maloy + - K.H. Man + - Michael Ryazanov + - Ron Thibodeau + - Alexandr Zamaraev + +and of course, MARK HESSLING, for his over 13 years of service as the +maintainer of PDCurses. Plus, thanks to all who've reported bugs or +requested features. Apologies to anyone I've forgotten. + +I've tested this version on Turbo C++ 3.0 and Borland C++ 3.1 for DOS; +DJGPP 2.X; Open Watcom 1.3 for DOS (16 and 32-bit), Windows and OS/2; +EMX 0.9d and the "newgcc" version of EMX; Borland C++ 5.5 for Windows; +recent versions of MinGW, Cygwin, LCC-Win32 and Microsoft Visual C++; +and gcc under several flavors of Linux, Mac OS X, *BSD and Solaris. + +-- William McBrine + +------------------------------------------------------------------------ + +PDCurses 2.6 - 2003-01-08 +========================= + +INTRODUCTION: + + This release of PDCurses includes the following changes: + +BUGS FIXED: + +- Allow accented characters on Win32 platform when run on non-English + keyboards. + +- Allow "special" characters like Ctrl-S, Ctrl-Q under OS/2 to be returned. + +- Some bugs with halfdelay() fixed by William McBrine. + +- pechochar() should now work correctly. + +- redrawwin() macro in curses.h was incorrect - fixed by Alberto Ornaghi + +- Don't include "special" characters like KEY_SHIFT_L to be returned in + getnstr() family. Bug 542913 + +- Entering TAB in wgetnstr() no longer exceeds requested buffer size. + Bug 489233 + +- Fixed bug 550066, scrollok() and pads. + Also beep() called when buffer exceeded. Bug 562041. + +- Reverse video of X11 selection reinstated. Pablo Garcia Abio?? + +- Right Alt modifier now works like left Alt modifier under Win32 + +- Add support for all libXaw replacement libraries with Scrollbar bug. + Note that for this to work, you still have to change the libXaw + replacement libraries to fix the bug :-( + +- Don't trap signals in XCurses if calling application has ignored them. + Change by Frank Heckenbach. + +- Bug reports from Warren W. Gay: + - Fix termattrs() to return A_REVERSE and A_BLINK on all platforms. + - Fix definition of getsyx() and setsyx() to be consistent with + ncurses. Bug 624424. + - Fix definition of echo() and noecho(). Bug 625001. + - Fix definition of keypad() and leaveok(). Bug 632653. + - Missing panel_hidden() prototype. Bug 649320. + +- Fixed bug with calling def_prog_mode(), resize_term(), + reset_prog_mode(); the resize details were being lost. + +NEW FEATURES: + +- Clipboard support now available on DOS platform, but handled + internally to the currently running process. + +- New X11 resource: textCursor, allows the text cursor to be specified + as a vertical bar, or the standard horizontal bar. Thanks to Frank + Heckenbach for the suggestion. + +NEW COMPILER SUPPORT: + +- lcc-win32 now works correctly + +------------------------------------------------------------------------ + +PDCurses 2.5 - 2001-11-26 +========================= + +INTRODUCTION: + + This release of PDCurses includes the following changes: + +- Set BASE address for Win32 DLL + +- Add KEY_SUP and KEY_SDOWN. + +- Add PDC_set_line_color() + +- Add blink support as bold background + +- Add bold colors + +- Add getbkgd() macro + +- Add new PDC functions for adding underline, overline, leftline and + rightline + +- Add support for shifted keypad keys. + +- Allow more keypad keys to work under Win32 + +- Change Win32 and OS/2 DLL name to curses.dll + +- Change example resources to allow overriding from the command line + +- Changes for building cleanly on OS/2 + +- Changes to handle building XCurses under AIX + +- Check if prefresh() and pnoutrefresh() parameters are valid. + +- Ensure build/install works from any directory + +- Handle platforms where X11 headers do not typedef XPointer. + +- Mention that Flexos is likely out-of-date. + +- Pass delaytenths to XCurses_rawgetch() + +- Remove boldFont + +- Updates for cursor blinking and italic. + +BUGS FIXED: + +- Fix bug with getting Win32 clipboard contents. Added new + PDC_freeclipboard() function. + +- Fix bug with halfdelay() + +- Fix bug with mouse interrupting programs that are not trapping mouse + events under Win32. + +- Fix return value from curs_set() + +- Reverse the left and right pointing bars in ALT_CHARSET + +NEW COMPILER SUPPORT: + +- Add QNX-RTP port + +------------------------------------------------------------------------ + +PDCurses 2.4 - 2000-01-17 +========================= + +INTRODUCTION: + + This release of PDCurses includes the following changes: + +- full support of X11 selection handling + +- removed the need for the cursos2.h file + +- enabled the "shifted" key on the numeric keypad + +- added native clipboard support for X11, Win32 and OS/2 + +- added extra functions for obtaining internal PDCurses status + +- added clipboard and key modifier tests in testcurs.c + +- fixes for panel library + +- key modifiers pressed by themselves are now returned as keys: + KEY_SHIFT_L KEY_SHIFT_R KEY_CONTROL_L KEY_CONTROL_R KEY_ALT_L KEY_ALT_R + This works on Win32 and X11 ports only + +- Added X11 shared library support + +- Added extra slk formats supported by ncurses + +- Fixed bug with resizing the terminal when slk were on. + +- Changed behavior of slk_attrset(), slk_attron() slk_attroff() + functions to work more like ncurses. + +BUGS FIXED: + +- some minor bug and portability fixes were included in this release + +NEW FUNCTIONS: + +- PDC_getclipboard() and PDC_setclipboard() for accessing the native + clipboard (X11, Win32 and OS/2) + +- PDC_set_title() for setting the title of the window (X11 and Win32 + only) + +- PDC_get_input_fd() for getting the file handle of the PDCurses input + +- PDC_get_key_modifiers() for getting the keyboard modifier settings at + the time of the last (w)getch() + +- Xinitscr() (only for X11 port) which allows standard X11 switches to + be passed to the application + +NEW COMPILER SUPPORT: + +- MingW32 GNU compiler under Win95/NT + +- Cygnus Win32 GNU compiler under Win95/NT + +- Borland C++ for OS/2 1.0+ + +- lcc-win32 compiler under Win95/NT + +ACKNOWLEDGEMENTS: (for this release) + +- Georg Fuchs for various changes. +- Juan David Palomar for pointing out getnstr() was not implemented. +- William McBrine for fix to allow black/black as valid color pair. +- Peter Preus for pointing out the missing bccos2.mak file. +- Laura Michaels for a couple of bug fixes and changes required to + support Mingw32 compiler. +- Frank Heckenbach for PDC_get_input_fd() and some portability fixes and + the fixes for panel library. +- Matthias Burian for the lcc-win32 compiler support. + +------------------------------------------------------------------------ + +PDCurses 2.3 - 1998-07-09 +========================= + +INTRODUCTION: + +This release of PDCurses includes the following changes: + +- added more System V R4 functions + +- added Win32 port + +- the X11 port is now fully functional + +- the MS Visual C++ Win32 port now includes a DLL + +- both the X11 and Win32 ports support the mouse + +- the slk..() functions are now functional + +- support for scrollbars under X11 are experimental at this stage + +- long chtype extended to non-Unix ports + +The name of the statically built library is pdcurses.lib (or +pdcurses.a). The name of the DLL import library (where applicable) is +curses.lib. + +BUGS FIXED: + +- some minor bugs were corrected in this release + +NEW FUNCTIONS: + +- slk..() functions + +NEW COMPILER SUPPORT: + +- MS Visual C++ under Win95/NT + +- Watcom C++ under OS/2, Win32 and DOS + +- two EMX ports have been provided: + - OS/2 only using OS/2 APIs + - OS/2 and DOS using EMX video support routines + +EXTRA OPTIONS: + +PDCurses recognizes two environment variables which determines the +initialization and finalization behavior. These environment variables +do not apply to the X11 port. + +PDC_PRESERVE_SCREEN - +If this environment variable is set, PDCurses will not clear the screen +to the default white on black on startup. This allows you to overlay +a window over the top of the existing screen background. + +PDC_RESTORE_SCREEN - +If this environment variable is set, PDCurses will take a copy of the +contents of the screen at the time that PDCurses is started; initscr(), +and when endwin() is called, the screen will be restored. + + +ACKNOWLEDGEMENTS: (for this release) + +- Chris Szurgot for original Win32 port. +- Gurusamy Sarathy for some updates to the Win32 port. +- Kim Huron for the slk..() functions. +- Florian Grosse Coosmann for some bug fixes. +- Esa Peuha for reducing compiler warnings. +- Augustin Martin Domingo for patches to X11 port to enable accented + characters. + +------------------------------------------------------------------------ + +PDCurses 2.2 - 1995-02-12 +========================= + +INTRODUCTION: + + This release of PDCurses has includes a number of major changes: + +- The portable library functions are now grouped together into single + files with the same arrangement as System V R4 curses. + +- A panels library has been included. This panels library was written by + Warren Tucker. + +- Quite a few more functions have been supplied by Wade Schauer and + incorporated into release 2.2. Wade also supplied the support for the + Microway NDP C/C++ 32 bit DOS compiler. + +- The curses datatype has been changed from an unsigned int to a long. + This allows more attributes to be stored as well as increasing the + number of color-pairs from 32 to 64. + +- Xwindows port (experimental at the moment). + +BUGS FIXED: + +- mvwin() checked the wrong coordinates + +- removed DESQview shadow memory buffer checking bug in curses.h in + \#define for wstandout() + +- lots of others I can't remember + +NEW FUNCTIONS: + +- Too many to mention. See intro.man for a complete list of the + functions PDCurses now supports. + +COMPILER SUPPORT: + +- DJGPP 1.12 is now supported. The run-time error that caused programs + to crash has been removed. + +- emx 0.9a is supported. A program compiled for OS/2 should also work + under DOS if you use the VID=EMX switch when compiling. See the + makefile for details. + +- The Microway NDP C/C++ DOS compiler is now supported. Thanks to Wade + Schauer for this port. + +- The Watcom C++ 10.0 DOS compiler is now supported. Thanks to Pieter + Kunst for this port. + +- The library now has many functions grouped together to reduce the size + of the library and to improve the speed of compilation. + +- The "names" of a couple of the compilers in the makefile has changed; + CSET2 is now ICC and GO32 is now GCC. + +EXTRA OPTIONS: + + One difference between the behavior of PDCurses and Unix curses is the + attributes that are displayed when a character is cleared. Under Unix + curses, no attributes are displayed, so the result is always black. + Under PDCurses, these functions clear with the current attributes in + effect at the time. With the introduction of the bkgd functions, by + default, PDCurses clears using the value set by (w)bkgd(). To have + PDCurses behave the same way as it did before release 2.2, compile with + -DPDCURSES_WCLR + +ACKNOWLEDGEMENTS: (for this release) + + Pieter Kunst, David Nugent, Warren Tucker, Darin Haugen, Stefan Strack, + Wade Schauer and others who either alerted me to bugs or supplied + fixes. + +------------------------------------------------------------------------ + +PDCurses 2.1 - 1993-06-20 +========================= + +INTRODUCTION: + + The current code contains bug fixes for the DOS and OS/2 releases and + also includes an alpha release for Unix. The Unix release uses another + public domain package (mytinfo) to handle the low-level screen writes. + mytinfo was posted to comp.sources.unix (or misc) in December 1992 or + January 1993. Unless you are a glutton for punishment I would recommend + you avoid the Unix port at this stage. + + The other major addition to PDCurses is the support for DJGPP (the DOS + port of GNU C++). Thanks to David Nugent . + + Other additions are copywin() function, function debugging support and + getting the small and medium memory models to work. The testcurs.c demo + program has also been changed significantly and a new demo program, + tuidemo, has been added. + + Some people have suggested including information on where to get dmake + from. oak.oakland.edu in /pub/msdos/c + +OTHER NOTES: + + Under DOS, by default, screen writes to a CGA monitor are done via the + video BIOS rather than by direct video memory writes. This is due to + the CGA "snow" problem. If you have a CGA monitor and do not suffer + from snow, you can compile private\_queryad.c with CGA_DIRECT defined. + This will then use cause PDCurses to write directly to the CGA video + memory. + + Function debugging: Firstly to get function debugging, you have to + compile the library with OPT=N in the makefile. This also turns on + compiler debugging. You can control when you want PDCurses to write to + the debug file (called trace in the current directory) by using the + functions traceon() and traceoff() in your program. + + Microsoft C 6.00 Users note: + ---------------------------- + + With the addition of several new functions, using dmake to compile + PDCurses now causes the compiler to run "out of heap space in pass 2". + Using the 6.00AX version (DOS-Extended) to compile PDCurses fixes this + problem; hence the -EM switch. + + Functional changes + ------------------ + + Added OS/2 DLL support. + + A few curses functions have been fixed to exhibit their correct + behavior and make them more functionally portable with System V + curses. The functions that have changed are overlay(), overwrite() and + typeahead. + + overlay() and overwrite() + + Both of theses functions in PDCurses 2.0 allowed for one window to be + effectively placed on top of another, and the characters in the first + window were overlaid or overwritten starting at 0,0 in both windows. + This behavior of these functions was not correct. These functions only + operate on windows that physically overlap with respect to the + displayed screen. To achieve the same functionality as before, use the + new function copywin(). See the manual page for further details. + + typeahead() + + This function in PDCurses 2.0 effectively checked to see if there were + any characters remaining in the keyboard buffer. This is not the + behavior exhibited by System V curses. This function is intended + purely to set a flag so that curses can check while updating the + physical screen if any keyboard input is pending. To achieve the same + effect with typeahead() under PDCurses 2.1 the following code should be + used. + + In place of... + + while(!typeahead(stdin)) + { + /* do something until any key is pressed... */ + } + + use... + + /* getch() to return ERR if no key pending */ + nodelay(stdscr,TRUE); + while(getch() == (ERR)) + { + /* do something until any key is pressed... */ + } + + +ACKNOWLEDGEMENTS: (in no particular order) + + Jason Shumate, Pieter Kunst, David Nugent, Andreas Otte, Pasi + Hamalainen, James McLennan, Duane Paulson, Ib Hojme + + Apologies to anyone I may have left out. + +------------------------------------------------------------------------ + +PDCurses 2.0 - 1992-11-23 +========================= + +INTRODUCTION: + + Well, here it finally is; PDCurses v2.0. + + PDCurses v2.0 is an almost total rewrite of PCcurses 1.4 done by John + 'Frotz' Fa'atuai, the previous maintainer. It adds support for OS/2 as + well as DOS. + + This version has been tested with Microsoft C v6.0, QuickC v2.0 and + Borland C++ 2.0 under DOS and Microsoft C v6.0 and TopSpeed c v3.02 + under OS/2 2.0. Also the library has been compiled successfully with + emx 0.8e, C Set/2 and Watcom 9. Most testing was done with the large + memory model, where applicable. The large memory model is probably the + best model to use. + + The amount of testing has not been as extensive as I would have liked, + but demands on releasing a product have outweighed the product's + quality. Nothing new with that !! Hopefully with wider circulation, + more bugs will be fixed more quickly. + + I have included just 1 makefile which is suitable for dmake 3.8 for + both DOS and OS/2. The makefile does not rely on customization of the + dmake.ini file. + + If you discover bugs, and especially if you have fixes, please let me + know ASAP. + + The source to the library is distributed as a zip file made with zip + 1.9. You will need Info-ZIP unzip 5.0 to unzip. Follow the directions + below to compile the library. + +DIRECTIONS: + + 1. Create a new directory in which to unzip pdcurs20.zip. This will + create a curses directory and a number of subdirectories containing + source code for the library and utilities and the documentation. + + 2. Make changes to the makefile where necessary: + Change the MODEL or model macro to the appropriate value (if it + applies to your compiler). Use model for Borland compilers. + + Change any paths in the defined macros to be suitable for your + compiler. + + 3. Invoke DMAKE [-e environment_options] [target] + + where environment_options are: + + OS (host operating system) + COMP (compiler) + OPT (optimized version or debug version) - optional. default Y + TOS (target operating system) - optional. default OS + + see the makefile for valid combinations + + targets: all, demos, lcursesd.lib, manual... + + NB. dmake is case sensitive with targets, so those environments that + use an upper case model value (eg MSC) MUST specify the library + target as for eg. Lcursesd.lib + + The makefile is by default set up for Borland C++. The use of -e + environment_options override these defaults. If you prefer, you can + just change the defaults in the makefile and invoke it without the + -e switch. + +OTHER NOTES: + + The documentation for the library is built into each source file, a + couple of specific doc files and the header files. A program is + supplied (manext) to build the manual. This program gets compiled when + you build the documentation. + + To generate the library response file correctly, I had to write a quick + and dirty program (buildlrf) to achieve this. Originally the makefiles + just had statements like: "echo -+$(OBJ)\$* & >> $(LRF)" which appended + a suitable line to the response file. Unfortunately under some + combinations of makefiles and command processors (eg. nmake and 4DOS) + the & would get treated as stderr and the echo command would fail. + + The original source for PDCurses that I received from the previous + maintainer contained support for the FLEXOS operating system. Not + having access to it, I could not test the changes I made so its support + has fallen by the wayside. If you really need to have PDCurses running + under FLEXOS, contact me and I will see what can be arranged. + + Under DOS, by default, screen writes to a CGA monitor are done via the + video BIOS rather than by direct video memory writes. This is due to + the CGA "snow" problem. If you have a CGA monitor and do not suffer + from snow, you can compile private\_queryad.c with CGA_DIRECT defined. + This will then use cause PDCurses to write directly to the CGA video + memory. + + Added System V color support. + +COMPILER-SPECIFIC NOTES: + + Microsoft C + ----------- + + It is possible with MSC 6.0 to build the OS/2 libraries and demo + programs from within DOS. This is the only case where it is possible to + specify the value of TOS on the command line to be OS2 and the value of + OS be DOS. + + C Set/2 + ------- + + I have only tested the library using the migration libraries. I doubt + that the demo programs will work without them. + + emx + --- + + Testing has been done with 0.8e of emx together with the 16_to_32 + libraries. The emx\lib directory should include the vio32.lib and + kbd32.lib libraries from the 16_to_32 package. + +BUGS and UNFINISHED BUSINESS: + +- PDC_set_ctrl_break() function does not work under OS/2. + +- win_print() and PDC_print() do not work under OS/2. + +- The file todo.man in the doc directory also lists those functions of + System V 3.2 curses not yet implemented. Any volunteers? + +ACKNOWLEDGEMENTS: + +- John 'Frotz' Fa'atuai, the previous maintainer for providing an + excellent base for further development. +- John Burnell , for the OS/2 port. +- John Steele, Jason (finally NOT a John) Shumate.... + for various fixes and suggestions. +- Eberhardt Mattes (author of emx) for allowing code based on his + C library to be included with PDCurses. +- Several others for their support, moral and actual. + +-- Mark Hessling + +------------------------------------------------------------------------ + +PDCurses 2.0Beta - 1991-12-21 +============================= + +Changed back from short to int. (int is the correct size for the default +platform. Short might be too short on some platforms. This is more +portable. I, also, made this mistake.) + +Many functions are now macros. If you want the real thing, #undef the +macro. (X/Open requirement.) + +Merged many sources into current release. + +Added many X/Open routines (not quite all yet). + +Added internal documentation to all routines. + +Added a HISTORY file to the environment. + +Added a CONTRIB file to the environment. + +------------------------------------------------------------------------ + +PDCurses 1.5Beta - 1990-07-14 +============================= + +Added many levels of compiler support. Added mixed prototypes for all +"internal" routines. Removed all assembly language. Added EGA/VGA +support. Converted all #ifdef to #if in all modules except CURSES.H and +CURSPRIV.H. Always include ASSERT.H. Added support for an external +malloc(), calloc() and free(). Added support for FAST_VIDEO +(direct-memory writes). Added various memory model support (for +FAST_VIDEO). Added much of the December 1988 X/Open Curses +specification. + +-- John 'Frotz' Fa'atuai + +------------------------------------------------------------------------ + +PCcurses 1.4 - 1990-01-14 +========================= + + In PCcurses v.1.4, both portability improvements and bugfixes have +been made. The files have been changed to allow lint-free compilation +with Microsoft C v.5.1, and with Turbo C v.2.0. The source should still +compile without problems on older compilers, although this has not been +verified. + + The makefiles have been changed to suit both the public release and +the author, who maintains a special kind of libraries for himself. In +the case of Microsoft C, changes were done in the makefile to lower the +warning level to 2 (was 3). This was to avoid ANSI warnings which are +abundant because PCcurses does not attempt to follow strict ANSI C +standard. + + BUG FIXES FROM V.1.3 TO V.1.4: + + !!!IMPORTANT CHANGE!!! + + The definitions for OK and ERR in curses.h were exchanged. This was +done to be more consistent with UNIX versions. Also, it permits +functions like newwin() and subwin() to return 0 (=NULL) when they fail +due to memory shortage. This incompatibility with UNIX curses was +pointed out by Fred C. Smith. If you have tested success/failure by +comparisons to anything other than ERR and OK, your applications will +need to be be changed on that point. Sorry... but presumably most of you +used the symbolic constants? + + (END OF IMPORTANT CHANGE) + + Fred also pointed out a bug in the file update.c. The bug caused the +first character printed after 'unauthorized' screen changes (like during +a shell escape, for example) to be placed at the wrong screen position. +This happened even if the normal precautions (clear / touch / refresh) +were taken. The problem has now been fixed. + + PCcurses is currently also being used on a 68000 system with +hard-coded ESCape sequences for ANSI terminals. However, ints used by +the 68000 C compiler are 32 bits. Therefore ints have been turned into +shorts wherever possible in the code (otherwise all window structures +occupy twice as much space as required on the 68000). This does not +affect PC versions since normally both ints and shorts are 16 bits for +PC C compilers. + + At some places in the source code there are references made to the +68000 version. There are also a makefile, a curses68.c file, and a +curses68.cmd file. These are for making, low-level I/O, and linking +commands when building the 68000 version. These files are probably +useful to no-one but the author, since it is very specific for its +special hardware environment. Still in an effort to keep all +curses-related sources in one place they are included. Note however that +PCcurses will not officially support a non-PC environment. + + The file cursesio.c, which was included in the package at revision +level 1.2, and which was to be an alternative to the cursesio.asm file, +has been verified to behave incorrectly in the function _curseskeytst(). +The problem was that the value of 'cflag' does not contain the proper +data for the test that is attempted. Furthermore, neither Turbo C or +Microsoft C allows any way to return the data that is needed, and +consequently you should not use cursesio.c. The best solution is to +simply use the ASM version. In v.1.2 and v.1.3, the user could edit the +makefile to select which version he wanted to use. The makefiles in +v.1.4 have removed this possibility forcing the use of the ASM file, and +cursesio.c has been dropped from the distribution. + + A bug in the wgetstr() function caused PCcurses to echo characters +when reading a keyboard string, even if the echo had been turned off. +Thanks to Per Foreby at Lund University, Sweden, for this. Per also +reported bugs concerning the handling of characters with bit 8 set. +Their ASCII code were considered as lower than 32, so they were erased +etc. like control characters, i.e. erasing two character positions. The +control character test was changed to cope with this. + + The overlay() and overwrite() functions were changed so that the +overlaying window is positioned at its 'own' coordinates inside the +underlying window (it used to be at the underlying window's [0,0] +position). There is some controversy about this - the documentation for +different curses versions say different things. I think the choice made +is the most reasonable. + + The border() and wborder() functions were changed to actually draw a +border, since this seems to be the correct behavior of these functions. +They used to just set the border characters to be used by box(). These +functions are not present in standard BSD UNIX curses. + + The subwin() function previously did not allow the subwindow to be as +big as the original window in which it was created. This has now been +fixed. There was also the problem that the default size (set by +specifying numlines or numcols (or both) as 0 made the resulting actual +size 1 line/column too small. + + There were a few spelling errors in function names, both in the +function declarations and in curses.h. This was reported by Carlos +Amaral at INESC in Portugal. Thanks! There was also an unnecessary (but +harmless) parameter in a function call at one place. + +------------------------------------------------------------------------ + +PCcurses 1.3 - 1988-10-05 +========================= + + The file 'border.c' is now included. It allows you to explicitly +specify what characters should be used as box borders when the box() +functions are called. If the new border characters are non-0, they +override the border characters specified in the box() call. In my +understanding, this functionality is required for AT&T UNIX sV.3 +compatibility. Thanks for this goes to Tony L. Hansen +(hansen@pegasus.UUCP) for posting an article about it on Usenet +(newsgroup comp.unix.questions; his posting was not related at all to +PCcurses). + + The only other difference between v.1.2 and v.1.3 is that the latter +has been changed to avoid warning diagnostics if the source files are +compiled with warning switches on (for Microsoft this means '-W3', for +Turbo C it means '-w -w-pro'). Of these, the Turbo C warning check is +clearly to be used rather than Microsoft, even if neither of them comes +even close to a real UNIX 'lint'. Some of the warnings in fact indicated +real bugs, mostly functions that did not return correct return values or +types. + + The makefiles for both MSC and TRC have been modified to produce +warning messages as part of normal compilation. + +------------------------------------------------------------------------ + +PCcurses 1.2 - 1988-10-02 +========================= + + The changes from v.1.1 to v.1.2 are minor. The biggest change is that +there was a bug related to limiting the cursor movement if the +application tried to move it outside the screen (something that should +not be done anyway). Such erroneous application behavior is now handled +appropriately. + + All modules have been changed to have a revision string in them, which +makes it easier to determine what version is linked into a program (or +what library version you have). + + There is now a 'cursesio.c' file. That file does the same as +'cursesio.asm' (i.e. it provides the interface to the lower-level system +I/O routines). It is written in C and thus it is (possibly) more +portable than the assembler version (but still not so portable since it +uses 8086 INT XX calls directly). When one creates new curses libraries, +one chooses whether to use the assembler or the C version of cursesio. +The choice is made by commenting out the appropriate dependencies for +cursesio.obj, near the end of the makefiles. + + There is now a 'setmode.c' file. That file contains functions that +save and restore terminal modes. They do it into other variables than do +savetty() and resetty(), so one should probably use either +savetty()/resetty() or the new functions only - and not mix the both +ways unless one really knows what one does. + + Diff lists vs v.1.0 are no longer included in the distribution. The +make utility still is. PCcurses v.1.2 still compiles with Microsoft C +v.4.0, and with Borland Turbo C v.1.0. There is as far as I know no +reason to believe that it does not compile under Microsoft C v.3.0 and +5.x, or Turbo C v.1.5, but this has not been tested. + + There are two makefiles included, one for Microsoft C, one for Turbo +C. They are both copies of my personal makefiles, and as such they +reflect the directory structure on my own computer. This will have to be +changed before you run make. Check $(INCDIR) and $(LIBDIR) in +particular, and make the choice of ASM or C cursesio version as +mentioned above (the distribution version uses the C version of +cursesio). + + The manual file (curses.man) has been changed at appropriate places. + + I would like to thank the following persons for their help: + + Brandon S. Allbery (alberry@ncoast.UUCP) + for running comp.binaries.ibm.pc (at that time) + and comp.source.misc. + + Steve Balogh (Steve@cit5.cit.oz.AU) + for writing a set of manual pages and posting + them to the net. + + Torbjorn Lindh + for finding bugs and suggesting raw + character output routines. + + Nathan Glasser (nathan@eddie.mit.edu) + for finding and reporting bugs. + + Ingvar Olafsson (...enea!hafro!ingvar) + for finding and reporting bugs. + + Eric Rosco (...enea!ipmoea!ericr) + for finding and reporting bugs. + + Steve Creps (creps@silver.bacs.indiana.edu) + for doing a lot of work - among others + posting bug fixes to the net, and writing + the new cursesio.c module. + + N. Dean Pentcheff (dean@violet.berkeley.edu) + for finding bugs and rewriting cursesio.asm + for Turbo 'C' 1.5. + + Finally, Jeff Dean (parcvax,hplabs}!cdp!jeff) + (jeff@ads.arpa) + has had a shareware version of curses deliverable since + about half a year before I released PCcurses 1.0 on Use- + Net. He is very concerned about confusion between the two + packages, and therefore any references on the network + should make clear whether they reference Dean's PCcurses + or Larsson's PCcurses. + +------------------------------------------------------------------------ + +PCcurses 1.1 - 1988-03-06 +========================= + + The changes from v.1.0 to v.1.1 are minor. There are a few bug fixes, +and new (non-portable) functions for verbatim IBM character font display +have been added (in charadd.c and charins.c). The manual file +(curses.man) has been changed at appropriate places. + + In the file v10tov11.dif there are listings of the differences between +version 1.0 and 1.1. The diff listings are in UNIX diff(1) format. + + Version 1.1 compiles with Turbo C v.1.0, as well as Microsoft C v.3.0 +and v.4.0. On the release disk there is a make.exe utility which is very +similar to UNIX make (If the package was mailed to you, the make utility +will be in uuencoded format - in make.uu - and must be uudecoded first). +It is much more powerful than Microsoft's different MAKEs; the latter +ones will NOT generate libraries properly if used with the PCcurses +makefiles. + + There are three makefiles: + + makefile generic MSC 3.0 makefile + makefile.ms MSC 4.0 makefile + makefile.tc Turbo C 1.0 makefile + + To make a library with for example Turbo C, make directories to hold +.H and .LIB files (these directories are the 'standard places'), edit +makefile.tc for this, and type + + make -f makefile.tc all + +and libraries for all memory models will be created in the .LIB +directory, while the include files will end up in the .H directory. Also +read what is said about installation below! + +------------------------------------------------------------------------ + +PCcurses 1.0 - 1987-08-24 +========================= + + This is the release notes for the PCcurses v.1.0 cursor/window control +package. PCcurses offers the functionality of UNIX curses, plus some +extras. Normally it should be possible to port curses-based programs +from UNIX curses to PCcurses on the IBM PC without changes. PCcurses is +a port/ rewrite of Pavel Curtis' public domain 'ncurses' package. All +the code has been re-written - it is not just an edit of ncurses (or +UNIX curses). I mention this to clarify any copyright violation claims. +The data structures and ideas are very similar to ncurses. As for UNIX +curses, I have not even seen any sources for it. + + For an introduction to the use of 'curses' and its derivatives, you +should read 'Screen Updating and Cursor Movement Optimization: A Library +Package' by Kenneth C. R. C. Arnold, which describes the original +Berkeley UNIX version of curses. It is available as part of the UNIX +manuals. The other source of information is 'The Ncurses Reference +Manual' by Pavel Curtis. The latter is part of Curtis' ncurses package. + + The only other documentation provided is a 'man' page which describes +all the included functions in a very terse way. In the sources, each +function is preceded by a rather thorough description of what the +function does. I didn't have time to write a nice manual/tutorial - +sorry. + + PCcurses is released as a number of source files, a man page, and a +make file. A uuencoded copy of a 'make' utility, and a manpage for the +'make' is also provided to make it easier to put together PCcurses +libraries. Even if you are not interested in PCcurses, it may be +worthwhile to grab the make. + + The makefile assumes the presence of the Microsoft C compiler (3.0 or +4.0), Microsoft MASM and LIB, plus some MS-DOS utilities. The reason for +supplying MAKE.EXE is that the Microsoft 'MAKE:s' are much inferior to a +real UNIX make. The supplied make is a port of a public domain make, +published on Usenet. It is almost completely compatible with UNIX make. +When generating the curses libraries, the makefile will direct make to +do some directory creating and file copying, and then re-invoke itself +with new targets. The workings of the makefile are not absolutely +crystal clear at first sight... just start it and see what it does. + + For portability, the curses libraries depend on one assembler file for +access to the BIOS routines. There is no support for the EGA, but both +CGA, MGA, and the HGA can be used. The libraries are originally for +Microsoft C, but all C modules should be portable right away. In the +assembler file, segment names probably need to be changed, and possibly +the parameter passing scheme. I think Turbo C will work right away - as +far as I understand, all its conventions are compatible with Microsoft +C. + + There are some parts left out between ncurses and PCcurses. One is the +support for multiple terminals - not very interesting on a PC anyway. +Because we KNOW what terminal we have, there is no need for a termcap or +terminfo library. PCcurses also has some things that neither curses nor +ncurses have. Compared to the original UNIX curses, PCcurses has lots of +extras. + + The BIOS routines are used directly, which gives fast screen updates. +PCcurses does not do direct writes to screen RAM - in my opinion it is +a bit ugly to rely that much on hardware compatibility. Anyone could fix +that, of course... + + One of the more serious problems with PCcurses is the way in which +normal, cbreak, and raw input modes are done. All those details are in +the 'charget' module - I do raw I/O via the BIOS, and perform any +buffering myself. If an application program uses PCcurses, it should do +ALL its I/O via PCcurses calls, otherwise the mix of normal and +PCcurses I/O may mess up the display. I think my code is reasonable... +comments are welcome, provided you express them nicely... + + To install, copy all files to a work directory, edit 'makefile' to +define the standard include and library file directory names of your +choice (these directories must exist already, and their path names must +be relative to the root directory, not to the current one). You must +also run uudecode on make.uu, to generate MAKE.EXE. You can do that on +your PC, if you have uudecode there, otherwise you can do it under UNIX +and do a binary transfer to the PC. When you have MAKE.EXE in your work +directory (or in your /bin directory), type make. + + Make will now create 4 sub-directories (one for each memory model), +copy some assembler include files into them, copy two include files to +your include directory, CHDIR to each sub-directory and re-invoke itself +with other make targets to compile and assemble all the source files +into the appropriate directories. Then the library manager is run to +create the library files in your desired library directory. Presto! + + If you only want to generate a library for one memory model, type +'make small', 'make large', etc. The name of the memory model must be in +lower case, like in the makefile. + + I think the package is fairly well debugged - but then again, that's +what I always think. It was completed in May-87, and no problems found +yet. Now it's your turn... Comments, suggestions and bug reports and +fixes (no flames please) to + +-- Bjorn Larsson diff --git a/vendor/pdcurses/docs/IMPLEMNT.md b/vendor/pdcurses/docs/IMPLEMNT.md new file mode 100644 index 0000000..9b3dd8f --- /dev/null +++ b/vendor/pdcurses/docs/IMPLEMNT.md @@ -0,0 +1,323 @@ +PDCurses Implementor's Guide +============================ + +- Version 1.6 - 2019/09/?? - added PDC_doupdate(); removed argc, argv, + lines, cols and SP allocation from + PDC_scr_open(); removed PDC_init_pair(), + PDC_pair_content() +- Version 1.5 - 2019/09/06 - PDC_has_mouse(), removed PDC_get_input_fd() +- Version 1.4 - 2018/12/31 - PDCurses.md -> USERS.md, MANUAL.md; new dir +- Version 1.3 - 2018/01/12 - notes about official ports, new indentation + style; markdown +- Version 1.2 - 2007/07/11 - added PDC_init_pair(), PDC_pair_content(), + version history; removed pdc_atrtab +- Version 1.1 - 2007/06/06 - minor cosmetic change +- Version 1.0 - 2007/04/01 - initial revision + +This document is for those wishing to port PDCurses to a new platform, +or just wanting to better understand how it works. Nothing here should +be needed for application programming; for that, refer to [USERS.md] and +[MANUAL.md], in man/ . This document assumes that you've read the user- +level documentation and are very familiar with application-level curses +programming. + +If you want to submit your port for possible inclusion into the main +PDCurses distribution, please follow these guidelines: + + - Don't modify anything in the pdcurses directory or in other port + directories. Don't modify curses.h or curspriv.h unless absolutely + necessary. (And prefer modifying curspriv.h over curses.h.) + + - Use the same indentation style, naming and scope conventions as the + existing code. + + - Release all your code to the public domain -- no copyright. Code + under GPL, BSD, etc. will not be accepted. + + +Data Structures +=============== + +A port of PDCurses must provide acs_map[], a 128-element array of +chtypes, with values laid out based on the Alternate Character Set of +the VT100 (see curses.h). PDC_transform_line() must use this table; when +it encounters a chtype with the A_ALTCHARSET flag set, and an A_CHARTEXT +value in the range 0-127, it must render it using the A_CHARTEXT portion +of the corresponding value from this table, instead of the original +value. Also, values may be read from this table by apps, and passed +through functions such as waddch(), which does no special processing on +control characters (0-31 and 127) when the A_ALTCHARSET flag is set. +Thus, any control characters used in acs_map[] should also have the +A_ALTCHARSET flag set. Implementations should provide suitable values +for all the ACS_ macros defined in curses.h; other values in the table +should be filled with their own indices (e.g., acs_map['E'] == 'E'). The +table can be either hardwired, or filled by PDC_scr_open(). Existing +ports define it in pdcdisp.c, but this is not required. + + +Functions +========= + +A port of PDCurses must implement the following functions, with extern +scope. These functions are traditionally divided into several modules, +as indicated below; this division is not required (only the functions +are), but may make it easier to follow for someone familiar with the +existing ports. + +Any other functions you create as part of your implementation should +have static scope, if possible. If they can't be static, they should be +named with the "PDC_" prefix. This minimizes the risk of collision with +an application's choices. + +Current PDCurses style also uses a single leading underscore with the +name of any static function; and modified BSD/Allman-style indentation, +approximately equivalent to "indent -kr -nut -bl -bli0", with +adjustments to keep every line under 80 columns. + + +pdcdisp.c: +---------- + +### void PDC_doupdate(void); + +Called at the end of doupdate(), this function finalizes the update of +the physical screen to match the virtual screen, if necessary, i.e. if +updates were deferred in PDC_transform_line(). + +### void PDC_gotoyx(int y, int x); + +Move the physical cursor (as opposed to the logical cursor affected by +wmove()) to the given location. This is called mainly from doupdate(). +In general, this function need not compare the old location with the new +one, and should just move the cursor unconditionally. + +### void PDC_transform_line(int lineno, int x, int len, const chtype *srcp); + +The core output routine. It takes len chtype entities from srcp (a +pointer into curscr) and renders them to the physical screen at line +lineno, column x. It must also translate characters 0-127 via acs_map[], +if they're flagged with A_ALTCHARSET in the attribute portion of the +chtype. Actual screen updates may be deferred until PDC_doupdate() if +desired (currently done with SDL and X11). + + +pdcgetsc.c: +----------- + +### int PDC_get_columns(void); + +Returns the size of the screen in columns. It's used in initscr() and +resize_term() to set the value of COLS. + +### int PDC_get_cursor_mode(void); + +Returns the size/shape of the cursor. The format of the result is +unspecified, except that it must be returned as an int. This function is +called from initscr(), and the result is stored in SP->orig_cursor, +which is used by PDC_curs_set() to determine the size/shape of the +cursor in normal visibility mode (curs_set(1)). + +### int PDC_get_rows(void); + +Returns the size of the screen in rows. It's used in initscr() and +resize_term() to set the value of LINES. + + +pdckbd.c: +--------- + +### bool PDC_check_key(void); + +Keyboard/mouse event check, called from wgetch(). Returns TRUE if +there's an event ready to process. This function must be non-blocking. + +### void PDC_flushinp(void); + +This is the core of flushinp(). It discards any pending key or mouse +events, removing them from any internal queue and from the OS queue, if +applicable. + +### int PDC_get_key(void); + +Get the next available key, or mouse event (indicated by a return of +KEY_MOUSE), and remove it from the OS' input queue, if applicable. This +function is called from wgetch(). This function may be blocking, and +traditionally is; but it need not be. If a valid key or mouse event +cannot be returned, for any reason, this function returns -1. Valid keys +are those that fall within the appropriate character set, or are in the +list of special keys found in curses.h (KEY_MIN through KEY_MAX). When +returning a special key code, this routine must also set SP->key_code to +TRUE; otherwise it must set it to FALSE. If SP->return_key_modifiers is +TRUE, this function may return modifier keys (shift, control, alt), +pressed alone, as special key codes; if SP->return_key_modifiers is +FALSE, it must not. If modifier keys are returned, it should only happen +if no other keys were pressed in the meantime; i.e., the return should +happen on key up. But if this is not possible, it may return the +modifier keys on key down (if and only if SP->return_key_modifiers is +TRUE). + +### bool PDC_has_mouse(void); + +Called from has_mouse(). Reports whether mouse support is available. Can +be a static TRUE or FALSE, or dependent on conditions. Note: Activating +mouse support should depend only on PDC_mouse_set(); don't expect the +user to call has_mouse() first. + +### int PDC_modifiers_set(void); + +Called from PDC_return_key_modifiers(). If your platform needs to do +anything in response to a change in SP->return_key_modifiers, do it +here. Returns OK or ERR, which is passed on by the caller. + +### int PDC_mouse_set(void); + +Called by mouse_set(), mouse_on(), and mouse_off() -- all the functions +that modify SP->_trap_mbe. If your platform needs to do anything in +response to a change in SP->_trap_mbe (for example, turning the mouse +cursor on or off), do it here. Returns OK or ERR, which is passed on by +the caller. + +### void PDC_set_keyboard_binary(bool on); + +Set keyboard input to "binary" mode. If you need to do something to keep +the OS from processing ^C, etc. on your platform, do it here. TRUE turns +the mode on; FALSE reverts it. This function is called from raw() and +noraw(). + + +pdcscrn.c: +---------- + +### bool PDC_can_change_color(void); + +Returns TRUE if init_color() and color_content() give meaningful +results, FALSE otherwise. Called from can_change_color(). + +### int PDC_color_content(short color, short *red, short *green, short *blue); + +The core of color_content(). This does all the work of that function, +except checking for values out of range and null pointers. + +### int PDC_init_color(short color, short red, short green, short blue); + +The core of init_color(). This does all the work of that function, +except checking for values out of range. + +### void PDC_reset_prog_mode(void); + +The non-portable functionality of reset_prog_mode() is handled here -- +whatever's not done in _restore_mode(). In current ports: In OS/2, this +sets the keyboard to binary mode; in Windows console, it enables or +disables the mouse pointer to match the saved mode; in others it does +nothing. + +### void PDC_reset_shell_mode(void); + +The same thing, for reset_shell_mode(). In OS/2 and Windows console, it +restores the default console mode; in others it does nothing. + +### int PDC_resize_screen(int nlines, int ncols); + +This does the main work of resize_term(). It may respond to non-zero +parameters, by setting the screen to the specified size; to zero +parameters, by setting the screen to a size chosen by the user at +runtime, in an unspecified way (e.g., by dragging the edges of the +window); or both. It may also do nothing, if there's no appropriate +action for the platform. + +### void PDC_restore_screen_mode(int i); + +Called from _restore_mode() in kernel.c, this function does the actual +mode changing, if applicable. Currently used only in DOS and OS/2. + +### void PDC_save_screen_mode(int i); + +Called from _save_mode() in kernel.c, this function saves the actual +screen mode, if applicable. Currently used only in DOS and OS/2. + +### void PDC_scr_close(void); + +The platform-specific part of endwin(). It may restore the image of the +original screen saved by PDC_scr_open(), if the PDC_RESTORE_SCREEN +environment variable is set; either way, if using an existing terminal, +this function should restore it to the mode it had at startup, and move +the cursor to the lower left corner. (The X11 port does nothing.) + +### void PDC_scr_free(void); + +Free any memory allocated by PDC_scr_open(). Called by delscreen(). + +### int PDC_scr_open(void); + +The platform-specific part of initscr(). It must initialize acs_map[] +(unless it's preset) and several members of SP, including mouse_wait, +orig_attr (and if orig_attr is TRUE, orig_fore and orig_back), mono, +_restore and _preserve. If using an existing terminal, and the +environment variable PDC_RESTORE_SCREEN is set, this function may also +store the existing screen image for later restoration by +PDC_scr_close(). + + +pdcsetsc.c: +----------- + +### int PDC_curs_set(int visibility); + +Called from curs_set(). Changes the appearance of the cursor -- 0 turns +it off, 1 is normal (the terminal's default, if applicable, as +determined by SP->orig_cursor), and 2 is high visibility. The exact +appearance of these modes is not specified. + + +pdcutil.c: +---------- + +### void PDC_beep(void); + +Emits a short audible beep. If this is not possible on your platform, +you must set SP->audible to FALSE during initialization (i.e., from +PDC_scr_open() -- not here); otherwise, set it to TRUE. This function is +called from beep(). + +### void PDC_napms(int ms); + +This is the core delay routine, called by napms(). It pauses for about +(the X/Open spec says "at least") ms milliseconds, then returns. High +degrees of accuracy and precision are not expected (though desirable, if +you can achieve them). More important is that this function gives back +the process' time slice to the OS, so that PDCurses idles at low CPU +usage. + +### const char *PDC_sysname(void); + +Returns a short string describing the platform, such as "DOS" or "X11". +This is used by longname(). It must be no more than 100 characters; it +should be much, much shorter (existing platforms use no more than 5). + + +More functions +============== + +The following functions are implemented in the platform directories, but +are accessed directly by apps. Refer to the user documentation for their +descriptions: + + +pdcclip.c: +---------- + +### int PDC_clearclipboard(void); +### int PDC_freeclipboard(char *contents); +### int PDC_getclipboard(char **contents, long *length); +### int PDC_setclipboard(const char *contents, long length); + + +pdcsetsc.c: +----------- + +### int PDC_set_blink(bool blinkon); +### int PDC_set_bold(bool boldon); +### void PDC_set_title(const char *title); + +[USERS.md]: USERS.md +[MANUAL.md]: MANUAL.md diff --git a/vendor/pdcurses/docs/MANUAL.md b/vendor/pdcurses/docs/MANUAL.md new file mode 100644 index 0000000..333511a --- /dev/null +++ b/vendor/pdcurses/docs/MANUAL.md @@ -0,0 +1,3099 @@ +Definitions and Variables (curses.h) +==================================== + +Define before inclusion (only those needed): + + Macro | Meaning / value + :-------------|------------------------------------------------- + XCURSES | if building / built for X11 + PDC_RGB | RGB color (Red = 1, Green = 2, Blue = 4) vs. BGR + PDC_WIDE | if building / built with wide-character support + PDC_DLL_BUILD | if building / built as a Windows DLL + PDC_NCMOUSE | use ncurses mouse API vs. traditional PDCurses + +Defined by this header: + + Macro | Meaning / value + :-------------|------------------------------------------------- + PDCURSES | PDCurses-only features are available + PDC_BUILD | API build version + PDC_VER_MAJOR | major version number + PDC_VER_MINOR | minor version number + PDC_VERDOT | version string + + + +-------------------------------------------------------------------------- + + +Text Attributes +=============== + +PDCurses uses a 32-bit integer for its chtype: + + color pair | modifiers | character eg 'a' + -----------------------|-----------------------|-------------------- + 31 30 29 28 27 26 25 24|23 22 21 20 19 18 17 16|15 14 13 .. 2 1 0 + +There are 256 color pairs (8 bits), 8 bits for modifiers, and 16 bits +for character data. The modifiers are bold, underline, right-line, +left-line, italic, reverse and blink, plus the alternate character set +indicator. + + + +-------------------------------------------------------------------------- + +Functions +========= + +addch +----- + +### Synopsis + + int addch(const chtype ch); + int waddch(WINDOW *win, const chtype ch); + int mvaddch(int y, int x, const chtype ch); + int mvwaddch(WINDOW *win, int y, int x, const chtype ch); + int echochar(const chtype ch); + int wechochar(WINDOW *win, const chtype ch); + + int addrawch(chtype ch); + int waddrawch(WINDOW *win, chtype ch); + int mvaddrawch(int y, int x, chtype ch); + int mvwaddrawch(WINDOW *win, int y, int x, chtype ch); + + int add_wch(const cchar_t *wch); + int wadd_wch(WINDOW *win, const cchar_t *wch); + int mvadd_wch(int y, int x, const cchar_t *wch); + int mvwadd_wch(WINDOW *win, int y, int x, const cchar_t *wch); + int echo_wchar(const cchar_t *wch); + int wecho_wchar(WINDOW *win, const cchar_t *wch); + +### Description + + addch() adds the chtype ch to the default window (stdscr) at the + current cursor position, and advances the cursor. Note that chtypes + can convey both text (a single character) and attributes, including a + color pair. add_wch() is the wide-character version of this function, + taking a pointer to a cchar_t instead of a chtype. + + waddch() is like addch(), but also lets you specify the window. (This + is in fact the core output routine.) wadd_wch() is the wide version. + + mvaddch() moves the cursor to the specified (y, x) position, and adds + ch to stdscr. mvadd_wch() is the wide version. + + mvwaddch() moves the cursor to the specified position and adds ch to + the specified window. mvwadd_wch() is the wide version. + + echochar() adds ch to stdscr at the current cursor position and calls + refresh(). echo_wchar() is the wide version. + + wechochar() adds ch to the specified window and calls wrefresh(). + wecho_wchar() is the wide version. + + addrawch(), waddrawch(), mvaddrawch() and mvwaddrawch() are PDCurses- + specific wrappers for addch() etc. that disable the translation of + control characters. + + The following applies to all these functions: + + If the cursor moves on to the right margin, an automatic newline is + performed. If scrollok is enabled, and a character is added to the + bottom right corner of the window, the scrolling region will be + scrolled up one line. If scrolling is not allowed, ERR will be + returned. + + If ch is a tab, newline, or backspace, the cursor will be moved + appropriately within the window. If ch is a newline, the clrtoeol + routine is called before the cursor is moved to the beginning of the + next line. If newline mapping is off, the cursor will be moved to + the next line, but the x coordinate will be unchanged. If ch is a + tab the cursor is moved to the next tab position within the window. + If ch is another control character, it will be drawn in the ^X + notation. Calling the inch() routine after adding a control + character returns the representation of the control character, not + the control character. + + Video attributes can be combined with a character by ORing them into + the parameter. Text, including attributes, can be copied from one + place to another by using inch() and addch(). + + Note that in PDCurses, for now, a cchar_t and a chtype are the same. + The text field is 16 bits wide, and is treated as Unicode (UCS-2) + when PDCurses is built with wide-character support (define PDC_WIDE). + So, in functions that take a chtype, like addch(), both the wide and + narrow versions will handle Unicode. But for portability, you should + use the wide functions. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + addch | Y | Y | Y + waddch | Y | Y | Y + mvaddch | Y | Y | Y + mvwaddch | Y | Y | Y + echochar | Y | Y | Y + wechochar | Y | Y | Y + add_wch | Y | Y | Y + wadd_wch | Y | Y | Y + mvadd_wch | Y | Y | Y + mvwadd_wch | Y | Y | Y + echo_wchar | Y | Y | Y + wecho_wchar | Y | Y | Y + addrawch | - | - | - + waddrawch | - | - | - + mvaddrawch | - | - | - + mvwaddrawch | - | - | - + + + +-------------------------------------------------------------------------- + + +addchstr +-------- + +### Synopsis + + int addchstr(const chtype *ch); + int addchnstr(const chtype *ch, int n); + int waddchstr(WINDOW *win, const chtype *ch); + int waddchnstr(WINDOW *win, const chtype *ch, int n); + int mvaddchstr(int y, int x, const chtype *ch); + int mvaddchnstr(int y, int x, const chtype *ch, int n); + int mvwaddchstr(WINDOW *, int y, int x, const chtype *ch); + int mvwaddchnstr(WINDOW *, int y, int x, const chtype *ch, int n); + + int add_wchstr(const cchar_t *wch); + int add_wchnstr(const cchar_t *wch, int n); + int wadd_wchstr(WINDOW *win, const cchar_t *wch); + int wadd_wchnstr(WINDOW *win, const cchar_t *wch, int n); + int mvadd_wchstr(int y, int x, const cchar_t *wch); + int mvadd_wchnstr(int y, int x, const cchar_t *wch, int n); + int mvwadd_wchstr(WINDOW *win, int y, int x, const cchar_t *wch); + int mvwadd_wchnstr(WINDOW *win, int y, int x, const cchar_t *wch, + int n); + +### Description + + These routines write a chtype or cchar_t string directly into the + window structure, starting at the current or specified position. The + four routines with n as the last argument copy at most n elements, + but no more than will fit on the line. If n == -1 then the whole + string is copied, up to the maximum number that will fit on the line. + + The cursor position is not advanced. These routines do not check for + newline or other special characters, nor does any line wrapping + occur. + +### Return Value + + All functions return OK or ERR. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + addchstr | Y | Y | Y + waddchstr | Y | Y | Y + mvaddchstr | Y | Y | Y + mvwaddchstr | Y | Y | Y + addchnstr | Y | Y | Y + waddchnstr | Y | Y | Y + mvaddchnstr | Y | Y | Y + mvwaddchnstr | Y | Y | Y + add_wchstr | Y | Y | Y + wadd_wchstr | Y | Y | Y + mvadd_wchstr | Y | Y | Y + mvwadd_wchstr | Y | Y | Y + add_wchnstr | Y | Y | Y + wadd_wchnstr | Y | Y | Y + mvadd_wchnstr | Y | Y | Y + mvwadd_wchnstr | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +addstr +------ + +### Synopsis + + int addstr(const char *str); + int addnstr(const char *str, int n); + int waddstr(WINDOW *win, const char *str); + int waddnstr(WINDOW *win, const char *str, int n); + int mvaddstr(int y, int x, const char *str); + int mvaddnstr(int y, int x, const char *str, int n); + int mvwaddstr(WINDOW *win, int y, int x, const char *str); + int mvwaddnstr(WINDOW *win, int y, int x, const char *str, int n); + + int addwstr(const wchar_t *wstr); + int addnwstr(const wchar_t *wstr, int n); + int waddwstr(WINDOW *win, const wchar_t *wstr); + int waddnwstr(WINDOW *win, const wchar_t *wstr, int n); + int mvaddwstr(int y, int x, const wchar_t *wstr); + int mvaddnwstr(int y, int x, const wchar_t *wstr, int n); + int mvwaddwstr(WINDOW *win, int y, int x, const wchar_t *wstr); + int mvwaddnwstr(WINDOW *win, int y, int x, const wchar_t *wstr, int n); + +### Description + + These routines write all the characters of the null-terminated string + str or wide-character string wstr to the given window. The + functionality is similar to calling waddch() once for each character + in the string; except that, when PDCurses is built with wide- + character support enabled, the narrow-character functions treat the + string as a multibyte string in the current locale, and convert it. + The routines with n as the last argument write at most n characters; + if n is negative, then the entire string will be added. + +### Return Value + + All functions return OK or ERR. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + addstr | Y | Y | Y + waddstr | Y | Y | Y + mvaddstr | Y | Y | Y + mvwaddstr | Y | Y | Y + addnstr | Y | Y | Y + waddnstr | Y | Y | Y + mvaddnstr | Y | Y | Y + mvwaddnstr | Y | Y | Y + addwstr | Y | Y | Y + waddwstr | Y | Y | Y + mvaddwstr | Y | Y | Y + mvwaddwstr | Y | Y | Y + addnwstr | Y | Y | Y + waddnwstr | Y | Y | Y + mvaddnwstr | Y | Y | Y + mvwaddnwstr | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +attr +---- + +### Synopsis + + int attroff(chtype attrs); + int wattroff(WINDOW *win, chtype attrs); + int attron(chtype attrs); + int wattron(WINDOW *win, chtype attrs); + int attrset(chtype attrs); + int wattrset(WINDOW *win, chtype attrs); + int standend(void); + int wstandend(WINDOW *win); + int standout(void); + int wstandout(WINDOW *win); + + int color_set(short color_pair, void *opts); + int wcolor_set(WINDOW *win, short color_pair, void *opts); + + int attr_get(attr_t *attrs, short *color_pair, void *opts); + int attr_off(attr_t attrs, void *opts); + int attr_on(attr_t attrs, void *opts); + int attr_set(attr_t attrs, short color_pair, void *opts); + int wattr_get(WINDOW *win, attr_t *attrs, short *color_pair, + void *opts); + int wattr_off(WINDOW *win, attr_t attrs, void *opts); + int wattr_on(WINDOW *win, attr_t attrs, void *opts); + int wattr_set(WINDOW *win, attr_t attrs, short color_pair, + void *opts); + + int chgat(int n, attr_t attr, short color, const void *opts); + int mvchgat(int y, int x, int n, attr_t attr, short color, + const void *opts); + int mvwchgat(WINDOW *win, int y, int x, int n, attr_t attr, + short color, const void *opts); + int wchgat(WINDOW *win, int n, attr_t attr, short color, + const void *opts); + + chtype getattrs(WINDOW *win); + + int underend(void); + int wunderend(WINDOW *win); + int underscore(void); + int wunderscore(WINDOW *win); + +### Description + + These functions manipulate the current attributes and/or colors of + the named window. These attributes can be any combination of + A_STANDOUT, A_REVERSE, A_BOLD, A_DIM, A_BLINK, A_UNDERLINE. These + constants are defined in and can be combined with the + bitwise-OR operator (|). + + The current attributes of a window are applied to all chtypes that + are written into the window with waddch(). Attributes are a property + of the chtype, and move with the character through any scrolling or + insert/delete operations. + + wattrset() sets the current attributes of the given window to attrs. + attrset() is the stdscr version. + + wattroff() turns off the named attributes without affecting any other + attributes; wattron() turns them on. + + wcolor_set() sets the window color to the value of color_pair. opts + is unused. + + standout() is the same as attron(A_STANDOUT). standend() is the same + as attrset(A_NORMAL); that is, it turns off all attributes. + + The attr_* and wattr_* functions are intended for use with the WA_* + attributes. In PDCurses, these are the same as A_*, and there is no + difference in bevahior from the chtype-based functions. In all cases, + opts is unused. + + wattr_get() retrieves the attributes and color pair for the specified + window. + + wchgat() sets the color pair and attributes for the next n cells on + the current line of a given window, without changing the existing + text, or alterting the window's attributes. An n of -1 extends the + change to the edge of the window. The changes take effect + immediately. opts is unused. + + wunderscore() turns on the A_UNDERLINE attribute; wunderend() turns + it off. underscore() and underend() are the stdscr versions. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + attroff | Y | Y | Y + wattroff | Y | Y | Y + attron | Y | Y | Y + wattron | Y | Y | Y + attrset | Y | Y | Y + wattrset | Y | Y | Y + standend | Y | Y | Y + wstandend | Y | Y | Y + standout | Y | Y | Y + wstandout | Y | Y | Y + color_set | Y | Y | Y + wcolor_set | Y | Y | Y + attr_get | Y | Y | Y + wattr_get | Y | Y | Y + attr_on | Y | Y | Y + wattr_on | Y | Y | Y + attr_off | Y | Y | Y + wattr_off | Y | Y | Y + attr_set | Y | Y | Y + wattr_set | Y | Y | Y + chgat | Y | Y | Y + wchgat | Y | Y | Y + mvchgat | Y | Y | Y + mvwchgat | Y | Y | Y + getattrs | - | Y | Y + underend | - | - | Y + wunderend | - | - | Y + underscore | - | - | Y + wunderscore | - | - | Y + + + +-------------------------------------------------------------------------- + + +beep +---- + +### Synopsis + + int beep(void); + int flash(void); + +### Description + + beep() sounds the audible bell on the terminal, if possible; if not, + it calls flash(). + + flash() "flashes" the screen, by inverting the foreground and + background of every cell, pausing, and then restoring the original + attributes. + +### Return Value + + These functions return ERR if called before initscr(), otherwise OK. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + beep | Y | Y | Y + flash | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +bkgd +---- + +### Synopsis + + int bkgd(chtype ch); + void bkgdset(chtype ch); + chtype getbkgd(WINDOW *win); + int wbkgd(WINDOW *win, chtype ch); + void wbkgdset(WINDOW *win, chtype ch); + + int bkgrnd(const cchar_t *wch); + void bkgrndset(const cchar_t *wch); + int getbkgrnd(cchar_t *wch); + int wbkgrnd(WINDOW *win, const cchar_t *wch); + void wbkgrndset(WINDOW *win, const cchar_t *wch); + int wgetbkgrnd(WINDOW *win, cchar_t *wch); + +### Description + + bkgdset() and wbkgdset() manipulate the background of a window. The + background is a chtype consisting of any combination of attributes + and a character; it is combined with each chtype added or inserted to + the window by waddch() or winsch(). Only the attribute part is used + to set the background of non-blank characters, while both character + and attributes are used for blank positions. + + bkgd() and wbkgd() not only change the background, but apply it + immediately to every cell in the window. + + wbkgrnd(), wbkgrndset() and wgetbkgrnd() are the "wide-character" + versions of these functions, taking a pointer to a cchar_t instead of + a chtype. However, in PDCurses, cchar_t and chtype are the same. + + The attributes that are defined with the attrset()/attron() set of + functions take precedence over the background attributes if there is + a conflict (e.g., different color pairs). + +### Return Value + + bkgd() and wbkgd() return OK, unless the window is NULL, in which + case they return ERR. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + bkgd | Y | Y | Y + bkgdset | Y | Y | Y + getbkgd | Y | Y | Y + wbkgd | Y | Y | Y + wbkgdset | Y | Y | Y + bkgrnd | Y | Y | Y + bkgrndset | Y | Y | Y + getbkgrnd | Y | Y | Y + wbkgrnd | Y | Y | Y + wbkgrndset | Y | Y | Y + wgetbkgrnd | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +border +------ + +### Synopsis + + int border(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, + chtype tr, chtype bl, chtype br); + int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, + chtype bs, chtype tl, chtype tr, chtype bl, chtype br); + int box(WINDOW *win, chtype verch, chtype horch); + int hline(chtype ch, int n); + int vline(chtype ch, int n); + int whline(WINDOW *win, chtype ch, int n); + int wvline(WINDOW *win, chtype ch, int n); + int mvhline(int y, int x, chtype ch, int n); + int mvvline(int y, int x, chtype ch, int n); + int mvwhline(WINDOW *win, int y, int x, chtype ch, int n); + int mvwvline(WINDOW *win, int y, int x, chtype ch, int n); + + int border_set(const cchar_t *ls, const cchar_t *rs, + const cchar_t *ts, const cchar_t *bs, + const cchar_t *tl, const cchar_t *tr, + const cchar_t *bl, const cchar_t *br); + int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs, + const cchar_t *ts, const cchar_t *bs, + const cchar_t *tl, const cchar_t *tr, + const cchar_t *bl, const cchar_t *br); + int box_set(WINDOW *win, const cchar_t *verch, const cchar_t *horch); + int hline_set(const cchar_t *wch, int n); + int vline_set(const cchar_t *wch, int n); + int whline_set(WINDOW *win, const cchar_t *wch, int n); + int wvline_set(WINDOW *win, const cchar_t *wch, int n); + int mvhline_set(int y, int x, const cchar_t *wch, int n); + int mvvline_set(int y, int x, const cchar_t *wch, int n); + int mvwhline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n); + int mvwvline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n); + +### Description + + border(), wborder(), and box() draw a border around the edge of the + window. If any argument is zero, an appropriate default is used: + + Name | Element | Default + :----|:------------------------------|:------------ + ls | left side of border | ACS_VLINE + rs | right side of border | ACS_VLINE + ts | top side of border | ACS_HLINE + bs | bottom side of border | ACS_HLINE + tl | top left corner of border | ACS_ULCORNER + tr | top right corner of border | ACS_URCORNER + bl | bottom left corner of border | ACS_LLCORNER + br | bottom right corner of border | ACS_LRCORNER + + hline() and whline() draw a horizontal line, using ch, starting from + the current cursor position. The cursor position does not change. The + line is at most n characters long, or as many as will fit in the + window. + + vline() and wvline() draw a vertical line, using ch, starting from + the current cursor position. The cursor position does not change. The + line is at most n characters long, or as many as will fit in the + window. + + The *_set functions are the "wide-character" versions, taking + pointers to cchar_t instead of chtype. Note that in PDCurses, chtype + and cchar_t are the same. + +### Return Value + + These functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + border | Y | Y | Y + wborder | Y | Y | Y + box | Y | Y | Y + hline | Y | Y | Y + vline | Y | Y | Y + whline | Y | Y | Y + wvline | Y | Y | Y + mvhline | Y | Y | Y + mvvline | Y | Y | Y + mvwhline | Y | Y | Y + mvwvline | Y | Y | Y + border_set | Y | Y | Y + wborder_set | Y | Y | Y + box_set | Y | Y | Y + hline_set | Y | Y | Y + vline_set | Y | Y | Y + whline_set | Y | Y | Y + wvline_set | Y | Y | Y + mvhline_set | Y | Y | Y + mvvline_set | Y | Y | Y + mvwhline_set | Y | Y | Y + mvwvline_set | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +clear +----- + +### Synopsis + + int clear(void); + int wclear(WINDOW *win); + int erase(void); + int werase(WINDOW *win); + int clrtobot(void); + int wclrtobot(WINDOW *win); + int clrtoeol(void); + int wclrtoeol(WINDOW *win); + +### Description + + erase() and werase() copy blanks (i.e. the background chtype) to + every cell of the window. + + clear() and wclear() are similar to erase() and werase(), but they + also call clearok() to ensure that the the window is cleared on the + next wrefresh(). + + clrtobot() and wclrtobot() clear the window from the current cursor + position to the end of the window. + + clrtoeol() and wclrtoeol() clear the window from the current cursor + position to the end of the current line. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + clear | Y | Y | Y + wclear | Y | Y | Y + erase | Y | Y | Y + werase | Y | Y | Y + clrtobot | Y | Y | Y + wclrtobot | Y | Y | Y + clrtoeol | Y | Y | Y + wclrtoeol | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +color +----- + +### Synopsis + + bool has_colors(void); + int start_color(void); + int init_pair(short pair, short fg, short bg); + int pair_content(short pair, short *fg, short *bg); + bool can_change_color(void); + int init_color(short color, short red, short green, short blue); + int color_content(short color, short *red, short *green, short *blue); + + int alloc_pair(int fg, int bg); + int assume_default_colors(int f, int b); + int find_pair(int fg, int bg); + int free_pair(int pair); + int use_default_colors(void); + + int PDC_set_line_color(short color); + +### Description + + To use these routines, first, call start_color(). Colors are always + used in pairs, referred to as color-pairs. A color-pair is created by + init_pair(), and consists of a foreground color and a background + color. After initialization, COLOR_PAIR(n) can be used like any other + video attribute. + + has_colors() reports whether the terminal supports color. + + start_color() initializes eight basic colors (black, red, green, + yellow, blue, magenta, cyan, and white), and two global variables: + COLORS and COLOR_PAIRS (respectively defining the maximum number of + colors and color-pairs the terminal is capable of displaying). + + init_pair() changes the definition of a color-pair. It takes three + arguments: the number of the color-pair to be redefined, and the new + values of the foreground and background colors. The pair number must + be between 0 and COLOR_PAIRS - 1, inclusive. The foreground and + background must be between 0 and COLORS - 1, inclusive. If the color + pair was previously initialized, the screen is refreshed, and all + occurrences of that color-pair are changed to the new definition. + + pair_content() is used to determine what the colors of a given color- + pair consist of. + + can_change_color() indicates if the terminal has the capability to + change the definition of its colors. + + init_color() is used to redefine a color, if possible. Each of the + components -- red, green, and blue -- is specified in a range from 0 + to 1000, inclusive. + + color_content() reports the current definition of a color in the same + format as used by init_color(). + + assume_default_colors() and use_default_colors() emulate the ncurses + extensions of the same names. assume_default_colors(f, b) is + essentially the same as init_pair(0, f, b) (which isn't allowed); it + redefines the default colors. use_default_colors() allows the use of + -1 as a foreground or background color with init_pair(), and calls + assume_default_colors(-1, -1); -1 represents the foreground or + background color that the terminal had at startup. If the environment + variable PDC_ORIGINAL_COLORS is set at the time start_color() is + called, that's equivalent to calling use_default_colors(). + + alloc_pair(), find_pair() and free_pair() are also from ncurses. + free_pair() marks a pair as unused; find_pair() returns an existing + pair with the specified foreground and background colors, if one + exists. And alloc_pair() returns such a pair whether or not it was + previously set, overwriting the oldest initialized pair if there are + no free pairs. + + PDC_set_line_color() is used to set the color, globally, for the + color of the lines drawn for the attributes: A_UNDERLINE, A_LEFT and + A_RIGHT. A value of -1 (the default) indicates that the current + foreground color should be used. + + NOTE: COLOR_PAIR() and PAIR_NUMBER() are implemented as macros. + +### Return Value + + Most functions return OK on success and ERR on error. has_colors() + and can_change_colors() return TRUE or FALSE. alloc_pair() and + find_pair() return a pair number, or -1 on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + has_colors | Y | Y | Y + start_color | Y | Y | Y + init_pair | Y | Y | Y + pair_content | Y | Y | Y + can_change_color | Y | Y | Y + init_color | Y | Y | Y + color_content | Y | Y | Y + alloc_pair | - | Y | - + assume_default_colors | - | Y | Y + find_pair | - | Y | - + free_pair | - | Y | - + use_default_colors | - | Y | Y + PDC_set_line_color | - | - | - + + + +-------------------------------------------------------------------------- + + +debug +----- + +### Synopsis + + void traceon(void); + void traceoff(void); + void PDC_debug(const char *, ...); + +### Description + + traceon() and traceoff() toggle the recording of debugging + information to the file "trace". Although not standard, similar + functions are in some other curses implementations. + + PDC_debug() is the function that writes to the file, based on whether + traceon() has been called. It's used from the PDC_LOG() macro. + + The environment variable PDC_TRACE_FLUSH controls whether the trace + file contents are fflushed after each write. The default is not. Set + it to enable this (may affect performance). + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + traceon | - | - | - + traceoff | - | - | - + PDC_debug | - | - | - + + + +-------------------------------------------------------------------------- + + +delch +----- + +### Synopsis + + int delch(void); + int wdelch(WINDOW *win); + int mvdelch(int y, int x); + int mvwdelch(WINDOW *win, int y, int x); + +### Description + + The character under the cursor in the window is deleted. All + characters to the right on the same line are moved to the left one + position and the last character on the line is filled with a blank. + The cursor position does not change (after moving to y, x if + coordinates are specified). + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + delch | Y | Y | Y + wdelch | Y | Y | Y + mvdelch | Y | Y | Y + mvwdelch | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +deleteln +-------- + +### Synopsis + + int deleteln(void); + int wdeleteln(WINDOW *win); + int insdelln(int n); + int winsdelln(WINDOW *win, int n); + int insertln(void); + int winsertln(WINDOW *win); + + int mvdeleteln(int y, int x); + int mvwdeleteln(WINDOW *win, int y, int x); + int mvinsertln(int y, int x); + int mvwinsertln(WINDOW *win, int y, int x); + +### Description + + With the deleteln() and wdeleteln() functions, the line under the + cursor in the window is deleted. All lines below the current line are + moved up one line. The bottom line of the window is cleared. The + cursor position does not change. + + With the insertln() and winsertn() functions, a blank line is + inserted above the current line and the bottom line is lost. + + mvdeleteln(), mvwdeleteln(), mvinsertln() and mvwinsertln() allow + moving the cursor and inserting/deleting in one call. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + deleteln | Y | Y | Y + wdeleteln | Y | Y | Y + mvdeleteln | - | - | - + mvwdeleteln | - | - | - + insdelln | Y | Y | Y + winsdelln | Y | Y | Y + insertln | Y | Y | Y + winsertln | Y | Y | Y + mvinsertln | - | - | - + mvwinsertln | - | - | - + + + +-------------------------------------------------------------------------- + + +getch +----- + +### Synopsis + + int getch(void); + int wgetch(WINDOW *win); + int mvgetch(int y, int x); + int mvwgetch(WINDOW *win, int y, int x); + int ungetch(int ch); + int flushinp(void); + + int get_wch(wint_t *wch); + int wget_wch(WINDOW *win, wint_t *wch); + int mvget_wch(int y, int x, wint_t *wch); + int mvwget_wch(WINDOW *win, int y, int x, wint_t *wch); + int unget_wch(const wchar_t wch); + + unsigned long PDC_get_key_modifiers(void); + int PDC_return_key_modifiers(bool flag); + +### Description + + With the getch(), wgetch(), mvgetch(), and mvwgetch() functions, a + character is read from the terminal associated with the window. In + nodelay mode, if there is no input waiting, the value ERR is + returned. In delay mode, the program will hang until the system + passes text through to the program. Depending on the setting of + cbreak(), this will be after one character or after the first + newline. Unless noecho() has been set, the character will also be + echoed into the designated window. + + If keypad() is TRUE, and a function key is pressed, the token for + that function key will be returned instead of the raw characters. + Possible function keys are defined in with integers + beginning with 0401, whose names begin with KEY_. + + If nodelay(win, TRUE) has been called on the window and no input is + waiting, the value ERR is returned. + + ungetch() places ch back onto the input queue to be returned by the + next call to wgetch(). + + flushinp() throws away any type-ahead that has been typed by the user + and has not yet been read by the program. + + wget_wch() is the wide-character version of wgetch(), available when + PDCurses is built with the PDC_WIDE option. It takes a pointer to a + wint_t rather than returning the key as an int, and instead returns + KEY_CODE_YES if the key is a function key. Otherwise, it returns OK + or ERR. It's important to check for KEY_CODE_YES, since regular wide + characters can have the same values as function key codes. + + unget_wch() puts a wide character on the input queue. + + PDC_get_key_modifiers() returns the keyboard modifiers (shift, + control, alt, numlock) effective at the time of the last getch() + call. Use the macros PDC_KEY_MODIFIER_* to determine which + modifier(s) were set. PDC_return_key_modifiers() tells getch() to + return modifier keys pressed alone as keystrokes (KEY_ALT_L, etc.). + These may not work on all platforms. + + NOTE: getch() and ungetch() are implemented as macros, to avoid + conflict with many DOS compiler's runtime libraries. + +### Return Value + + These functions return ERR or the value of the character, meta + character or function key token. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + getch | Y | Y | Y + wgetch | Y | Y | Y + mvgetch | Y | Y | Y + mvwgetch | Y | Y | Y + ungetch | Y | Y | Y + flushinp | Y | Y | Y + get_wch | Y | Y | Y + wget_wch | Y | Y | Y + mvget_wch | Y | Y | Y + mvwget_wch | Y | Y | Y + unget_wch | Y | Y | Y + PDC_get_key_modifiers | - | - | - + + + +-------------------------------------------------------------------------- + + +getstr +------ + +### Synopsis + + int getstr(char *str); + int wgetstr(WINDOW *win, char *str); + int mvgetstr(int y, int x, char *str); + int mvwgetstr(WINDOW *win, int y, int x, char *str); + int getnstr(char *str, int n); + int wgetnstr(WINDOW *win, char *str, int n); + int mvgetnstr(int y, int x, char *str, int n); + int mvwgetnstr(WINDOW *win, int y, int x, char *str, int n); + + int get_wstr(wint_t *wstr); + int wget_wstr(WINDOW *win, wint_t *wstr); + int mvget_wstr(int y, int x, wint_t *wstr); + int mvwget_wstr(WINDOW *win, int, int, wint_t *wstr); + int getn_wstr(wint_t *wstr, int n); + int wgetn_wstr(WINDOW *win, wint_t *wstr, int n); + int mvgetn_wstr(int y, int x, wint_t *wstr, int n); + int mvwgetn_wstr(WINDOW *win, int y, int x, wint_t *wstr, int n); + +### Description + + These routines call wgetch() repeatedly to build a string, + interpreting erase and kill characters along the way, until a newline + or carriage return is received. When PDCurses is built with wide- + character support enabled, the narrow-character functions convert the + wgetch()'d values into a multibyte string in the current locale + before returning it. The resulting string is placed in the area + pointed to by *str. The routines with n as the last argument read at + most n characters. + + Note that there's no way to know how long the buffer passed to + wgetstr() is, so use wgetnstr() to avoid buffer overflows. + +### Return Value + + These functions return ERR on failure or any other value on success. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + getstr | Y | Y | Y + wgetstr | Y | Y | Y + mvgetstr | Y | Y | Y + mvwgetstr | Y | Y | Y + getnstr | Y | Y | Y + wgetnstr | Y | Y | Y + mvgetnstr | Y | Y | Y + mvwgetnstr | Y | Y | Y + get_wstr | Y | Y | Y + wget_wstr | Y | Y | Y + mvget_wstr | Y | Y | Y + mvwget_wstr | Y | Y | Y + getn_wstr | Y | Y | Y + wgetn_wstr | Y | Y | Y + mvgetn_wstr | Y | Y | Y + mvwgetn_wstr | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +getyx +----- + +### Synopsis + + void getyx(WINDOW *win, int y, int x); + void getparyx(WINDOW *win, int y, int x); + void getbegyx(WINDOW *win, int y, int x); + void getmaxyx(WINDOW *win, int y, int x); + + void getsyx(int y, int x); + void setsyx(int y, int x); + + int getbegy(WINDOW *win); + int getbegx(WINDOW *win); + int getcury(WINDOW *win); + int getcurx(WINDOW *win); + int getpary(WINDOW *win); + int getparx(WINDOW *win); + int getmaxy(WINDOW *win); + int getmaxx(WINDOW *win); + +### Description + + The getyx() macro (defined in curses.h -- the prototypes here are + merely illustrative) puts the current cursor position of the + specified window into y and x. getbegyx() and getmaxyx() return the + starting coordinates and size of the specified window, respectively. + getparyx() returns the starting coordinates of the parent's window, + if the specified window is a subwindow; otherwise it sets y and x to + -1. These are all macros. + + getsyx() gets the coordinates of the virtual screen cursor, and + stores them in y and x. If leaveok() is TRUE, it returns -1, -1. If + lines have been removed with ripoffline(), then getsyx() includes + these lines in its count; so, the returned y and x values should only + be used with setsyx(). + + setsyx() sets the virtual screen cursor to the y, x coordinates. If + either y or x is -1, leaveok() is set TRUE, else it's set FALSE. + + getsyx() and setsyx() are meant to be used by a library routine that + manipulates curses windows without altering the position of the + cursor. Note that getsyx() is defined only as a macro. + + getbegy(), getbegx(), getcurx(), getcury(), getmaxy(), getmaxx(), + getpary(), and getparx() return the appropriate coordinate or size + values, or ERR in the case of a NULL window. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + getyx | Y | Y | Y + getparyx | Y | Y | Y + getbegyx | Y | Y | Y + getmaxyx | Y | Y | Y + getsyx | - | Y | Y + setsyx | - | Y | Y + getbegy | - | Y | Y + getbegx | - | Y | Y + getcury | - | Y | Y + getcurx | - | Y | Y + getpary | - | Y | Y + getparx | - | Y | Y + getmaxy | - | Y | Y + getmaxx | - | Y | Y + + + +-------------------------------------------------------------------------- + + +inch +---- + +### Synopsis + + chtype inch(void); + chtype winch(WINDOW *win); + chtype mvinch(int y, int x); + chtype mvwinch(WINDOW *win, int y, int x); + + int in_wch(cchar_t *wcval); + int win_wch(WINDOW *win, cchar_t *wcval); + int mvin_wch(int y, int x, cchar_t *wcval); + int mvwin_wch(WINDOW *win, int y, int x, cchar_t *wcval); + +### Description + + The inch() functions retrieve the character and attribute from the + current or specified window position, in the form of a chtype. If a + NULL window is specified, (chtype)ERR is returned. + + The in_wch() functions are the wide-character versions; instead of + returning a chtype, they store a cchar_t at the address specified by + wcval, and return OK or ERR. (No value is stored when ERR is + returned.) Note that in PDCurses, chtype and cchar_t are the same. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + inch | Y | Y | Y + winch | Y | Y | Y + mvinch | Y | Y | Y + mvwinch | Y | Y | Y + in_wch | Y | Y | Y + win_wch | Y | Y | Y + mvin_wch | Y | Y | Y + mvwin_wch | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +inchstr +------- + +### Synopsis + + int inchstr(chtype *ch); + int inchnstr(chtype *ch, int n); + int winchstr(WINDOW *win, chtype *ch); + int winchnstr(WINDOW *win, chtype *ch, int n); + int mvinchstr(int y, int x, chtype *ch); + int mvinchnstr(int y, int x, chtype *ch, int n); + int mvwinchstr(WINDOW *, int y, int x, chtype *ch); + int mvwinchnstr(WINDOW *, int y, int x, chtype *ch, int n); + + int in_wchstr(cchar_t *wch); + int in_wchnstr(cchar_t *wch, int n); + int win_wchstr(WINDOW *win, cchar_t *wch); + int win_wchnstr(WINDOW *win, cchar_t *wch, int n); + int mvin_wchstr(int y, int x, cchar_t *wch); + int mvin_wchnstr(int y, int x, cchar_t *wch, int n); + int mvwin_wchstr(WINDOW *win, int y, int x, cchar_t *wch); + int mvwin_wchnstr(WINDOW *win, int y, int x, cchar_t *wch, int n); + +### Description + + These routines read a chtype or cchar_t string from the window, + starting at the current or specified position, and ending at the + right margin, or after n elements, whichever is less. + +### Return Value + + All functions return the number of elements read, or ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + inchstr | Y | Y | Y + winchstr | Y | Y | Y + mvinchstr | Y | Y | Y + mvwinchstr | Y | Y | Y + inchnstr | Y | Y | Y + winchnstr | Y | Y | Y + mvinchnstr | Y | Y | Y + mvwinchnstr | Y | Y | Y + in_wchstr | Y | Y | Y + win_wchstr | Y | Y | Y + mvin_wchstr | Y | Y | Y + mvwin_wchstr | Y | Y | Y + in_wchnstr | Y | Y | Y + win_wchnstr | Y | Y | Y + mvin_wchnstr | Y | Y | Y + mvwin_wchnstr | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +initscr +------- + +### Synopsis + + WINDOW *initscr(void); + WINDOW *Xinitscr(int argc, char **argv); + int endwin(void); + bool isendwin(void); + SCREEN *newterm(const char *type, FILE *outfd, FILE *infd); + SCREEN *set_term(SCREEN *new); + void delscreen(SCREEN *sp); + + int resize_term(int nlines, int ncols); + bool is_termresized(void); + const char *curses_version(void); + void PDC_get_version(PDC_VERSION *ver); + + int set_tabsize(int tabsize); + +### Description + + initscr() should be the first curses routine called. It will + initialize all curses data structures, and arrange that the first + call to refresh() will clear the screen. In case of error, initscr() + will write a message to standard error and end the program. + + endwin() should be called before exiting or escaping from curses mode + temporarily. It will restore tty modes, move the cursor to the lower + left corner of the screen and reset the terminal into the proper + non-visual mode. To resume curses after a temporary escape, call + refresh() or doupdate(). + + isendwin() returns TRUE if endwin() has been called without a + subsequent refresh, unless SP is NULL. + + In some implementations of curses, newterm() allows the use of + multiple terminals. Here, it's just an alternative interface for + initscr(). It always returns SP, or NULL. + + delscreen() frees the memory allocated by newterm() or initscr(), + since it's not freed by endwin(). This function is usually not + needed. In PDCurses, the parameter must be the value of SP, and + delscreen() sets SP to NULL. + + set_term() does nothing meaningful in PDCurses, but is included for + compatibility with other curses implementations. + + resize_term() is effectively two functions: When called with nonzero + values for nlines and ncols, it attempts to resize the screen to the + given size. When called with (0, 0), it merely adjusts the internal + structures to match the current size after the screen is resized by + the user. On the currently supported platforms, SDL, Windows console, + and X11 allow user resizing, while DOS, OS/2, SDL and Windows console + allow programmatic resizing. If you want to support user resizing, + you should check for getch() returning KEY_RESIZE, and/or call + is_termresized() at appropriate times; if either condition occurs, + call resize_term(0, 0). Then, with either user or programmatic + resizing, you'll have to resize any windows you've created, as + appropriate; resize_term() only handles stdscr and curscr. + + is_termresized() returns TRUE if the curses screen has been resized + by the user, and a call to resize_term() is needed. Checking for + KEY_RESIZE is generally preferable, unless you're not handling the + keyboard. + + curses_version() returns a string describing the version of PDCurses. + + PDC_get_version() fills a PDC_VERSION structure provided by the user + with more detailed version info (see curses.h). + + set_tabsize() sets the tab interval, stored in TABSIZE. + +### Return Value + + All functions return NULL on error, except endwin(), which always + returns OK, and resize_term(), which returns either OK or ERR. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + initscr | Y | Y | Y + endwin | Y | Y | Y + isendwin | Y | Y | Y + newterm | Y | Y | Y + set_term | Y | Y | Y + delscreen | Y | Y | Y + resize_term | - | Y | Y + set_tabsize | - | Y | Y + curses_version | - | Y | - + is_termresized | - | - | - + + + +-------------------------------------------------------------------------- + + +inopts +------ + +### Synopsis + + int cbreak(void); + int nocbreak(void); + int echo(void); + int noecho(void); + int halfdelay(int tenths); + int intrflush(WINDOW *win, bool bf); + int keypad(WINDOW *win, bool bf); + int meta(WINDOW *win, bool bf); + int nl(void); + int nonl(void); + int nodelay(WINDOW *win, bool bf); + int notimeout(WINDOW *win, bool bf); + int raw(void); + int noraw(void); + void noqiflush(void); + void qiflush(void); + void timeout(int delay); + void wtimeout(WINDOW *win, int delay); + int wgetdelay(const WINDOW *win); + int typeahead(int fildes); + + int crmode(void); + int nocrmode(void); + + bool is_keypad(const WINDOW *win); + bool is_nodelay(const WINDOW *win); + bool is_notimeout(const WINDOW *win); + +### Description + + cbreak() and nocbreak() toggle cbreak mode. In cbreak mode, + characters typed by the user are made available immediately, and + erase/kill character processing is not performed. In nocbreak mode, + typed characters are buffered until a newline or carriage return. + Interrupt and flow control characters are unaffected by this mode. + PDCurses always starts in cbreak mode. + + echo() and noecho() control whether typed characters are echoed by + the input routine. Initially, input characters are echoed. Subsequent + calls to echo() and noecho() do not flush type-ahead. + + halfdelay() is similar to cbreak(), but allows for a time limit to be + specified, in tenths of a second. This causes getch() to block for + that period before returning ERR if no key has been received. tenths + must be between 1 and 255. + + keypad() controls whether getch() returns function/special keys as + single key codes (e.g., the left arrow key as KEY_LEFT). Per X/Open, + the default for keypad mode is OFF. You'll probably want it on. With + keypad mode off, if a special key is pressed, getch() does nothing or + returns ERR. + + nodelay() controls whether wgetch() is a non-blocking call. If the + option is enabled, and no input is ready, wgetch() will return ERR. + If disabled, wgetch() will hang until input is ready. + + nl() enables the translation of a carriage return into a newline on + input. nonl() disables this. Initially, the translation does occur. + + raw() and noraw() toggle raw mode. Raw mode is similar to cbreak + mode, in that characters typed are immediately passed through to the + user program. The difference is that in raw mode, the INTR, QUIT, + SUSP, and STOP characters are passed through without being + interpreted, and without generating a signal. + + In PDCurses, the meta() function sets raw mode on or off. + + timeout() and wtimeout() set blocking or non-blocking reads for the + specified window. If the delay is negative, a blocking read is used; + if zero, then non-blocking reads are done -- if no input is waiting, + ERR is returned immediately. If the delay is positive, the read + blocks for the delay period; if the period expires, ERR is returned. + The delay is given in milliseconds, but this is rounded down to 50ms + (1/20th sec) intervals, with a minimum of one interval if a postive + delay is given; i.e., 1-99 will wait 50ms, 100-149 will wait 100ms, + etc. + + wgetdelay() returns the delay timeout as set in wtimeout(). + + intrflush(), notimeout(), noqiflush(), qiflush() and typeahead() do + nothing in PDCurses, but are included for compatibility with other + curses implementations. + + crmode() and nocrmode() are archaic equivalents to cbreak() and + nocbreak(), respectively. + + is_keypad() reports whether the specified window is in keypad mode. + + is_nodelay() reports whether the specified window is in nodelay mode. + +### Return Value + + is_keypad() and is_nodelay() return TRUE or FALSE. is_notimeout() is + provided for compatibility with other curses implementations, and + always returns FALSE. All others return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + cbreak | Y | Y | Y + nocbreak | Y | Y | Y + echo | Y | Y | Y + noecho | Y | Y | Y + halfdelay | Y | Y | Y + intrflush | Y | Y | Y + keypad | Y | Y | Y + meta | Y | Y | Y + nl | Y | Y | Y + nonl | Y | Y | Y + nodelay | Y | Y | Y + notimeout | Y | Y | Y + raw | Y | Y | Y + noraw | Y | Y | Y + noqiflush | Y | Y | Y + qiflush | Y | Y | Y + timeout | Y | Y | Y + wtimeout | Y | Y | Y + wgetdelay | - | Y | - + typeahead | Y | Y | Y + crmode | Y | Y | Y + nocrmode | Y | Y | Y + is_keypad | - | Y | Y + is_nodelay | - | Y | - + is_notimeout | - | Y | - + + + +-------------------------------------------------------------------------- + + +insch +----- + +### Synopsis + + int insch(chtype ch); + int winsch(WINDOW *win, chtype ch); + int mvinsch(int y, int x, chtype ch); + int mvwinsch(WINDOW *win, int y, int x, chtype ch); + + int insrawch(chtype ch); + int winsrawch(WINDOW *win, chtype ch); + int mvinsrawch(int y, int x, chtype ch); + int mvwinsrawch(WINDOW *win, int y, int x, chtype ch); + + int ins_wch(const cchar_t *wch); + int wins_wch(WINDOW *win, const cchar_t *wch); + int mvins_wch(int y, int x, const cchar_t *wch); + int mvwins_wch(WINDOW *win, int y, int x, const cchar_t *wch); + +### Description + + The insch() functions insert a chtype into the window at the current + or specified cursor position. The cursor is NOT advanced. A newline + is equivalent to clrtoeol(); tabs are expanded; other control + characters are converted as with unctrl(). + + The ins_wch() functions are the wide-character equivalents, taking + cchar_t pointers rather than chtypes. + + Video attributes can be combined with a character by ORing them into + the parameter. Text, including attributes, can be copied from one + place to another using inch() and insch(). + + insrawch() etc. are PDCurses-specific wrappers for insch() etc. that + disable the translation of control characters. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + insch | Y | Y | Y + winsch | Y | Y | Y + mvinsch | Y | Y | Y + mvwinsch | Y | Y | Y + ins_wch | Y | Y | Y + wins_wch | Y | Y | Y + mvins_wch | Y | Y | Y + mvwins_wch | Y | Y | Y + insrawch | - | - | - + winsrawch | - | - | - + + + +-------------------------------------------------------------------------- + + +insstr +------ + +### Synopsis + + int insstr(const char *str); + int insnstr(const char *str, int n); + int winsstr(WINDOW *win, const char *str); + int winsnstr(WINDOW *win, const char *str, int n); + int mvinsstr(int y, int x, const char *str); + int mvinsnstr(int y, int x, const char *str, int n); + int mvwinsstr(WINDOW *win, int y, int x, const char *str); + int mvwinsnstr(WINDOW *win, int y, int x, const char *str, int n); + + int ins_wstr(const wchar_t *wstr); + int ins_nwstr(const wchar_t *wstr, int n); + int wins_wstr(WINDOW *win, const wchar_t *wstr); + int wins_nwstr(WINDOW *win, const wchar_t *wstr, int n); + int mvins_wstr(int y, int x, const wchar_t *wstr); + int mvins_nwstr(int y, int x, const wchar_t *wstr, int n); + int mvwins_wstr(WINDOW *win, int y, int x, const wchar_t *wstr); + int mvwins_nwstr(WINDOW *win, int y, int x, const wchar_t *wstr, int n); + +### Description + + The insstr() functions insert a character string into a window at the + current cursor position, by repeatedly calling winsch(). When + PDCurses is built with wide-character support enabled, the narrow- + character functions treat the string as a multibyte string in the + current locale, and convert it first. All characters to the right of + the cursor are moved to the right, with the possibility of the + rightmost characters on the line being lost. The cursor position + does not change (after moving to y, x, if specified). The routines + with n as the last argument insert at most n characters; if n is + negative, then the entire string is inserted. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + insstr | Y | Y | Y + winsstr | Y | Y | Y + mvinsstr | Y | Y | Y + mvwinsstr | Y | Y | Y + insnstr | Y | Y | Y + winsnstr | Y | Y | Y + mvinsnstr | Y | Y | Y + mvwinsnstr | Y | Y | Y + ins_wstr | Y | Y | Y + wins_wstr | Y | Y | Y + mvins_wstr | Y | Y | Y + mvwins_wstr | Y | Y | Y + ins_nwstr | Y | Y | Y + wins_nwstr | Y | Y | Y + mvins_nwstr | Y | Y | Y + mvwins_nwstr | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +instr +----- + +### Synopsis + + int instr(char *str); + int innstr(char *str, int n); + int winstr(WINDOW *win, char *str); + int winnstr(WINDOW *win, char *str, int n); + int mvinstr(int y, int x, char *str); + int mvinnstr(int y, int x, char *str, int n); + int mvwinstr(WINDOW *win, int y, int x, char *str); + int mvwinnstr(WINDOW *win, int y, int x, char *str, int n); + + int inwstr(wchar_t *wstr); + int innwstr(wchar_t *wstr, int n); + int winwstr(WINDOW *win, wchar_t *wstr); + int winnwstr(WINDOW *win, wchar_t *wstr, int n); + int mvinwstr(int y, int x, wchar_t *wstr); + int mvinnwstr(int y, int x, wchar_t *wstr, int n); + int mvwinwstr(WINDOW *win, int y, int x, wchar_t *wstr); + int mvwinnwstr(WINDOW *win, int y, int x, wchar_t *wstr, int n); + +### Description + + These functions take characters (or wide characters) from the current + or specified position in the window, and return them as a string in + str (or wstr). Attributes are ignored. The functions with n as the + last argument return a string at most n characters long. + +### Return Value + + Upon successful completion, innstr(), mvinnstr(), mvwinnstr() and + winnstr() return the number of characters actually read into the + string; instr(), mvinstr(), mvwinstr() and winstr() return OK. + Otherwise, all these functions return ERR. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + instr | Y | Y | Y + winstr | Y | Y | Y + mvinstr | Y | Y | Y + mvwinstr | Y | Y | Y + innstr | Y | Y | Y + winnstr | Y | Y | Y + mvinnstr | Y | Y | Y + mvwinnstr | Y | Y | Y + inwstr | Y | Y | Y + winwstr | Y | Y | Y + mvinwstr | Y | Y | Y + mvwinwstr | Y | Y | Y + innwstr | Y | Y | Y + winnwstr | Y | Y | Y + mvinnwstr | Y | Y | Y + mvwinnwstr | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +kernel +------ + +### Synopsis + + int def_prog_mode(void); + int def_shell_mode(void); + int reset_prog_mode(void); + int reset_shell_mode(void); + int resetty(void); + int savetty(void); + int ripoffline(int line, int (*init)(WINDOW *, int)); + int curs_set(int visibility); + int napms(int ms); + + int draino(int ms); + int resetterm(void); + int fixterm(void); + int saveterm(void); + +### Description + + def_prog_mode() and def_shell_mode() save the current terminal modes + as the "program" (in curses) or "shell" (not in curses) state for use + by the reset_prog_mode() and reset_shell_mode() functions. This is + done automatically by initscr(). + + reset_prog_mode() and reset_shell_mode() restore the terminal to + "program" (in curses) or "shell" (not in curses) state. These are + done automatically by endwin() and doupdate() after an endwin(), so + they would normally not be called before these functions. + + savetty() and resetty() save and restore the state of the terminal + modes. savetty() saves the current state in a buffer, and resetty() + restores the state to what it was at the last call to savetty(). + + curs_set() alters the appearance of the cursor. A visibility of 0 + makes it disappear; 1 makes it appear "normal" (usually an underline) + and 2 makes it "highly visible" (usually a block). + + ripoffline() reduces the size of stdscr by one line. If the "line" + parameter is positive, the line is removed from the top of the + screen; if negative, from the bottom. Up to 5 lines can be ripped off + stdscr by calling ripoffline() repeatedly. The function argument, + init, is called from within initscr() or newterm(), so ripoffline() + must be called before either of these functions. The init function + receives a pointer to a one-line WINDOW, and the width of the window. + Calling ripoffline() with a NULL init function pointer is an error. + + napms() suspends the program for the specified number of + milliseconds. draino() is an archaic equivalent. Note that since + napms() attempts to give up a time slice and yield control back to + the OS, all times are approximate. (In DOS, the delay is actually + rounded down to 50ms (1/20th sec) intervals, with a minimum of one + interval; i.e., 1-99 will wait 50ms, 100-149 will wait 100ms, etc.) + 0 returns immediately. + + resetterm(), fixterm() and saveterm() are archaic equivalents for + reset_shell_mode(), reset_prog_mode() and def_prog_mode(), + respectively. + +### Return Value + + All functions return OK on success and ERR on error, except + curs_set(), which returns the previous visibility. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + def_prog_mode | Y | Y | Y + def_shell_mode | Y | Y | Y + reset_prog_mode | Y | Y | Y + reset_shell_mode | Y | Y | Y + resetty | Y | Y | Y + savetty | Y | Y | Y + ripoffline | Y | Y | Y + curs_set | Y | Y | Y + napms | Y | Y | Y + fixterm | - | Y | - + resetterm | - | Y | - + saveterm | - | Y | - + draino | - | - | - + + + +-------------------------------------------------------------------------- + + +keyname +------- + +### Synopsis + + char *keyname(int key); + + char *key_name(wchar_t c); + + bool has_key(int key); + +### Description + + keyname() returns a string corresponding to the argument key. key may + be any key returned by wgetch(). + + key_name() is the wide-character version. It takes a wchar_t + parameter, but still returns a char *. + + has_key() returns TRUE for recognized keys, FALSE otherwise. This + function is an ncurses extension. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + keyname | Y | Y | Y + key_name | Y | Y | Y + has_key | - | Y | Y + + + +-------------------------------------------------------------------------- + + +mouse +----- + +### Synopsis + + int mouse_set(mmask_t mbe); + int mouse_on(mmask_t mbe); + int mouse_off(mmask_t mbe); + int request_mouse_pos(void); + void wmouse_position(WINDOW *win, int *y, int *x); + mmask_t getmouse(void); + + int mouseinterval(int wait); + bool wenclose(const WINDOW *win, int y, int x); + bool wmouse_trafo(const WINDOW *win, int *y, int *x, bool to_screen); + bool mouse_trafo(int *y, int *x, bool to_screen); + mmask_t mousemask(mmask_t mask, mmask_t *oldmask); + int nc_getmouse(MEVENT *event); + int ungetmouse(MEVENT *event); + bool has_mouse(void); + +### Description + + As of PDCurses 3.0, there are two separate mouse interfaces: the + classic interface, which is based on the undocumented Sys V mouse + functions; and an ncurses-compatible interface. Both are active at + all times, and you can mix and match functions from each, though it's + not recommended. The ncurses interface is essentially an emulation + layer built on top of the classic interface; it's here to allow + easier porting of ncurses apps. + + The classic interface: mouse_set(), mouse_on(), mouse_off(), + request_mouse_pos(), wmouse_position(), and getmouse(). An + application using this interface would start by calling mouse_set() + or mouse_on() with a non-zero value, often ALL_MOUSE_EVENTS. Then it + would check for a KEY_MOUSE return from getch(). If found, it would + call request_mouse_pos() to get the current mouse status. + + mouse_set(), mouse_on() and mouse_off() are analagous to attrset(), + attron() and attroff(). These functions set the mouse button events + to trap. The button masks used in these functions are defined in + curses.h and can be or'ed together. They are the group of masks + starting with BUTTON1_RELEASED. + + request_mouse_pos() requests curses to fill in the Mouse_status + structure with the current state of the mouse. + + wmouse_position() determines if the current mouse position is within + the window passed as an argument. If the mouse is outside the current + window, -1 is returned in the y and x arguments; otherwise the y and + x coordinates of the mouse (relative to the top left corner of the + window) are returned in y and x. + + getmouse() returns the current status of the trapped mouse buttons as + set by mouse_set() or mouse_on(). + + The ncurses interface: mouseinterval(), wenclose(), wmouse_trafo(), + mouse_trafo(), mousemask(), nc_getmouse(), ungetmouse() and + has_mouse(). A typical application using this interface would start + by calling mousemask() with a non-zero value, often ALL_MOUSE_EVENTS. + Then it would check for a KEY_MOUSE return from getch(). If found, it + would call nc_getmouse() to get the current mouse status. + + mouseinterval() sets the timeout for a mouse click. On all current + platforms, PDCurses receives mouse button press and release events, + but must synthesize click events. It does this by checking whether a + release event is queued up after a press event. If it gets a press + event, and there are no more events waiting, it will wait for the + timeout interval, then check again for a release. A press followed by + a release is reported as BUTTON_CLICKED; otherwise it's passed + through as BUTTON_PRESSED. The default timeout is 150ms; valid values + are 0 (no clicks reported) through 1000ms. In x11, the timeout can + also be set via the clickPeriod resource. The return value from + mouseinterval() is the old timeout. To check the old value without + setting a new one, call it with a parameter of -1. Note that although + there's no classic equivalent for this function (apart from the + clickPeriod resource), the value set applies in both interfaces. + + wenclose() reports whether the given screen-relative y, x coordinates + fall within the given window. + + wmouse_trafo() converts between screen-relative and window-relative + coordinates. A to_screen parameter of TRUE means to convert from + window to screen; otherwise the reverse. The function returns FALSE + if the coordinates aren't within the window, or if any of the + parameters are NULL. The coordinates have been converted when the + function returns TRUE. + + mouse_trafo() is the stdscr version of wmouse_trafo(). + + mousemask() is nearly equivalent to mouse_set(), but instead of + OK/ERR, it returns the value of the mask after setting it. (This + isn't necessarily the same value passed in, since the mask could be + altered on some platforms.) And if the second parameter is a non-null + pointer, mousemask() stores the previous mask value there. Also, + since the ncurses interface doesn't work with PDCurses' BUTTON_MOVED + events, mousemask() filters them out. + + nc_getmouse() returns the current mouse status in an MEVENT struct. + This is equivalent to ncurses' getmouse(), renamed to avoid conflict + with PDCurses' getmouse(). But if you define PDC_NCMOUSE before + including curses.h, it defines getmouse() to nc_getmouse(), along + with a few other redefintions needed for compatibility with ncurses + code. nc_getmouse() calls request_mouse_pos(), which (not getmouse()) + is the classic equivalent. + + ungetmouse() is the mouse equivalent of ungetch(). However, PDCurses + doesn't maintain a queue of mouse events; only one can be pushed + back, and it can overwrite or be overwritten by real mouse events. + + has_mouse() reports whether the mouse is available at all on the + current platform. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + mouse_set | - | - | - + mouse_on | - | - | - + mouse_off | - | - | - + request_mouse_pos | - | - | - + wmouse_position | - | - | - + getmouse | - | * | - + mouseinterval | - | Y | - + wenclose | - | Y | - + wmouse_trafo | - | Y | - + mouse_trafo | - | Y | - + mousemask | - | Y | - + nc_getmouse | - | * | - + ungetmouse | - | Y | - + has_mouse | - | Y | - + + \* See above, under Description + + + +-------------------------------------------------------------------------- + + +move +---- + +### Synopsis + + int move(int y, int x); + int mvcur(int oldrow, int oldcol, int newrow, int newcol); + int wmove(WINDOW *win, int y, int x); + +### Description + + move() and wmove() move the cursor associated with the window to the + given location. This does not move the physical cursor of the + terminal until refresh() is called. The position specified is + relative to the upper left corner of the window, which is (0,0). + + mvcur() moves the physical cursor without updating any window cursor + positions. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + move | Y | Y | Y + mvcur | Y | Y | Y + wmove | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +outopts +------- + +### Synopsis + + int clearok(WINDOW *win, bool bf); + int idlok(WINDOW *win, bool bf); + void idcok(WINDOW *win, bool bf); + void immedok(WINDOW *win, bool bf); + int leaveok(WINDOW *win, bool bf); + int setscrreg(int top, int bot); + int wsetscrreg(WINDOW *win, int top, int bot); + int wgetscrreg(const WINDOW *win, int *top, int *bot); + int scrollok(WINDOW *win, bool bf); + + int raw_output(bool bf); + + bool is_cleared(const WINDOW *win); + bool is_idlok(const WINDOW *win); + bool is_idcok(const WINDOW *win); + bool is_immedok(const WINDOW *win); + bool is_leaveok(const WINDOW *win); + bool is_scrollok(const WINDOW *win); + +### Description + + With clearok(), if bf is TRUE, the next call to wrefresh() with this + window will clear the screen completely and redraw the entire screen. + + immedok(), called with a second argument of TRUE, causes an automatic + wrefresh() every time a change is made to the specified window. + + Normally, the hardware cursor is left at the location of the window + being refreshed. leaveok() allows the cursor to be left wherever the + update happens to leave it. It's useful for applications where the + cursor is not used, since it reduces the need for cursor motions. If + possible, the cursor is made invisible when this option is enabled. + + wsetscrreg() sets a scrolling region in a window; "top" and "bot" are + the line numbers for the top and bottom margins. If this option and + scrollok() are enabled, any attempt to move off the bottom margin + will cause all lines in the scrolling region to scroll up one line. + setscrreg() is the stdscr version. + + wgetscrreg() gets the top and bottom margins as set in wsetscrreg(). + + idlok() and idcok() do nothing in PDCurses, but are provided for + compatibility with other curses implementations, likewise is_idlok() + and is_idcok(). + + raw_output() enables the output of raw characters using the standard + *add* and *ins* curses functions (that is, it disables translation of + control characters). + + is_cleared() reports whether the specified window causes clear at next + refresh. + + is_immedok() reports whether the specified window is in immedok mode. + + is_leaveok() reports whether the specified window is in leaveok mode. + + is_scrollok() reports whether the specified window allows scrolling. + +### Return Value + + is_cleared(), is_immedok(), is_leaveok() and is_scrollok() return TRUE + or FALSE. is_idlok() and is_idcok() are provided for compatibility with + other curses implementations, and always return FALSE. All others + return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + clearok | Y | Y | Y + idlok | Y | Y | Y + idcok | Y | Y | Y + immedok | Y | Y | Y + leaveok | Y | Y | Y + setscrreg | Y | Y | Y + wsetscrreg | Y | Y | Y + wgetscrreg | - | Y | - + scrollok | Y | Y | Y + is_cleared | - | Y | - + is_idlok | - | Y | - + is_idcok | - | Y | - + is_immedok | - | Y | - + is_leaveok | - | Y | Y + is_scrollok | - | Y | - + raw_output | - | - | - + + + +-------------------------------------------------------------------------- + + +overlay +------- + +### Synopsis + + int overlay(const WINDOW *src_w, WINDOW *dst_w) + int overwrite(const WINDOW *src_w, WINDOW *dst_w) + int copywin(const WINDOW *src_w, WINDOW *dst_w, int src_tr, + int src_tc, int dst_tr, int dst_tc, int dst_br, + int dst_bc, int _overlay) + +### Description + + overlay() and overwrite() copy all the text from src_w into dst_w. + The windows need not be the same size. Those characters in the source + window that intersect with the destination window are copied, so that + the characters appear in the same physical position on the screen. + The difference between the two functions is that overlay() is non- + destructive (blanks are not copied) while overwrite() is destructive + (blanks are copied). + + copywin() is similar, but doesn't require that the two windows + overlap. The arguments src_tc and src_tr specify the top left corner + of the region to be copied. dst_tc, dst_tr, dst_br, and dst_bc + specify the region within the destination window to copy to. The + argument "overlay", if TRUE, indicates that the copy is done non- + destructively (as in overlay()); blanks in the source window are not + copied to the destination window. When overlay is FALSE, blanks are + copied. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + overlay | Y | Y | Y + overwrite | Y | Y | Y + copywin | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +pad +--- + +### Synopsis + + WINDOW *newpad(int nlines, int ncols); + WINDOW *subpad(WINDOW *orig, int nlines, int ncols, + int begy, int begx); + int prefresh(WINDOW *win, int py, int px, int sy1, int sx1, + int sy2, int sx2); + int pnoutrefresh(WINDOW *w, int py, int px, int sy1, int sx1, + int sy2, int sx2); + int pechochar(WINDOW *pad, chtype ch); + int pecho_wchar(WINDOW *pad, const cchar_t *wch); + + bool is_pad(const WINDOW *pad); + +### Description + + A pad is a special kind of window, which is not restricted by the + screen size, and is not necessarily associated with a particular part + of the screen. You can use a pad when you need a large window, and + only a part of the window will be on the screen at one time. Pads are + not refreshed automatically (e.g., from scrolling or echoing of + input). You can't call wrefresh() with a pad as an argument; use + prefresh() or pnoutrefresh() instead. Note that these routines + require additional parameters to specify the part of the pad to be + displayed, and the location to use on the screen. + + newpad() creates a new pad data structure. + + subpad() creates a new sub-pad within a pad, at position (begy, + begx), with dimensions of nlines lines and ncols columns. This + position is relative to the pad, and not to the screen as with + subwin. Changes to either the parent pad or sub-pad will affect both. + When using sub-pads, you may need to call touchwin() before calling + prefresh(). + + pnoutrefresh() copies the specified pad to the virtual screen. + + prefresh() calls pnoutrefresh(), followed by doupdate(). + + These routines are analogous to wnoutrefresh() and wrefresh(). (py, + px) specifies the upper left corner of the part of the pad to be + displayed; (sy1, sx1) and (sy2, sx2) describe the screen rectangle + that will contain the selected part of the pad. + + pechochar() is functionally equivalent to addch() followed by a call + to prefresh(), with the last-used coordinates and dimensions. + pecho_wchar() is the wide-character version. + + is_pad() reports whether the specified window is a pad. + +### Return Value + + All functions except is_pad() return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + newpad | Y | Y | Y + subpad | Y | Y | Y + prefresh | Y | Y | Y + pnoutrefresh | Y | Y | Y + pechochar | Y | Y | Y + pecho_wchar | Y | Y | Y + is_pad | - | Y | Y + + + +-------------------------------------------------------------------------- + + +panel +----- + +### Synopsis + + int bottom_panel(PANEL *pan); + int del_panel(PANEL *pan); + int hide_panel(PANEL *pan); + int move_panel(PANEL *pan, int starty, int startx); + PANEL *new_panel(WINDOW *win); + PANEL *panel_above(const PANEL *pan); + PANEL *panel_below(const PANEL *pan); + int panel_hidden(const PANEL *pan); + const void *panel_userptr(const PANEL *pan); + WINDOW *panel_window(const PANEL *pan); + int replace_panel(PANEL *pan, WINDOW *win); + int set_panel_userptr(PANEL *pan, const void *uptr); + int show_panel(PANEL *pan); + int top_panel(PANEL *pan); + void update_panels(void); + +### Description + + For historic reasons, and for compatibility with other versions of + curses, the panel functions are prototyped in a separate header, + panel.h. In many implementations, they're also in a separate library, + but PDCurses incorporates them. + + The panel functions provide a way to have depth relationships between + curses windows. Panels can overlap without making visible the + overlapped portions of underlying windows. The initial curses window, + stdscr, lies beneath all panels. The set of currently visible panels + is the 'deck' of panels. + + You can create panels, fetch and set their associated windows, + shuffle panels in the deck, and manipulate them in other ways. + + bottom_panel() places pan at the bottom of the deck. The size, + location and contents of the panel are unchanged. + + del_panel() deletes pan, but not its associated winwow. + + hide_panel() removes a panel from the deck and thus hides it from + view. + + move_panel() moves the curses window associated with pan, so that its + upper lefthand corner is at the supplied coordinates. (Don't use + mvwin() on the window.) + + new_panel() creates a new panel associated with win and returns the + panel pointer. The new panel is placed at the top of the deck. + + panel_above() returns a pointer to the panel in the deck above pan, + or NULL if pan is the top panel. If the value of pan passed is NULL, + this function returns a pointer to the bottom panel in the deck. + + panel_below() returns a pointer to the panel in the deck below pan, + or NULL if pan is the bottom panel. If the value of pan passed is + NULL, this function returns a pointer to the top panel in the deck. + + panel_hidden() returns OK if pan is hidden and ERR if it is not. + + panel_userptr() - Each panel has a user pointer available for + maintaining relevant information. This function returns a pointer to + that information previously set up by set_panel_userptr(). + + panel_window() returns a pointer to the curses window associated with + the panel. + + replace_panel() replaces the current window of pan with win. + + set_panel_userptr() - Each panel has a user pointer available for + maintaining relevant information. This function sets the value of + that information. + + show_panel() makes a previously hidden panel visible and places it + back in the deck on top. + + top_panel() places pan on the top of the deck. The size, location and + contents of the panel are unchanged. + + update_panels() refreshes the virtual screen to reflect the depth + relationships between the panels in the deck. The user must use + doupdate() to refresh the physical screen. + +### Return Value + + Each routine that returns a pointer to an object returns NULL if an + error occurs. Each panel routine that returns an integer, returns OK + if it executes successfully and ERR if it does not. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + bottom_panel | - | Y | Y + del_panel | - | Y | Y + hide_panel | - | Y | Y + move_panel | - | Y | Y + new_panel | - | Y | Y + panel_above | - | Y | Y + panel_below | - | Y | Y + panel_hidden | - | Y | Y + panel_userptr | - | Y | Y + panel_window | - | Y | Y + replace_panel | - | Y | Y + set_panel_userptr | - | Y | Y + show_panel | - | Y | Y + top_panel | - | Y | Y + update_panels | - | Y | Y + +### Credits + + Original Author - Warren Tucker + + + +-------------------------------------------------------------------------- + + +printw +------ + +### Synopsis + + int printw(const char *fmt, ...); + int wprintw(WINDOW *win, const char *fmt, ...); + int mvprintw(int y, int x, const char *fmt, ...); + int mvwprintw(WINDOW *win, int y, int x, const char *fmt,...); + int vwprintw(WINDOW *win, const char *fmt, va_list varglist); + int vw_printw(WINDOW *win, const char *fmt, va_list varglist); + +### Description + + The printw() functions add a formatted string to the window at the + current or specified cursor position. The format strings are the same + as used in the standard C library's printf(). (printw() can be used + as a drop-in replacement for printf().) + + The duplication between vwprintw() and vw_printw() is for historic + reasons. In PDCurses, they're the same. + +### Return Value + + All functions return the number of characters printed, or ERR on + error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + printw | Y | Y | Y + wprintw | Y | Y | Y + mvprintw | Y | Y | Y + mvwprintw | Y | Y | Y + vwprintw | Y | Y | Y + vw_printw | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +refresh +------- + +### Synopsis + + int refresh(void); + int wrefresh(WINDOW *win); + int wnoutrefresh(WINDOW *win); + int doupdate(void); + int redrawwin(WINDOW *win); + int wredrawln(WINDOW *win, int beg_line, int num_lines); + +### Description + + wrefresh() copies the named window to the physical terminal screen, + taking into account what is already there in order to optimize cursor + movement. refresh() does the same, using stdscr. These routines must + be called to get any output on the terminal, as other routines only + manipulate data structures. Unless leaveok() has been enabled, the + physical cursor of the terminal is left at the location of the + window's cursor. + + wnoutrefresh() and doupdate() allow multiple updates with more + efficiency than wrefresh() alone. wrefresh() works by first calling + wnoutrefresh(), which copies the named window to the virtual screen. + It then calls doupdate(), which compares the virtual screen to the + physical screen and does the actual update. A series of calls to + wrefresh() will result in alternating calls to wnoutrefresh() and + doupdate(), causing several bursts of output to the screen. By first + calling wnoutrefresh() for each window, it is then possible to call + doupdate() only once. + + In PDCurses, redrawwin() is equivalent to touchwin(), and wredrawln() + is the same as touchline(). In some other curses implementations, + there's a subtle distinction, but it has no meaning in PDCurses. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + refresh | Y | Y | Y + wrefresh | Y | Y | Y + wnoutrefresh | Y | Y | Y + doupdate | Y | Y | Y + redrawwin | Y | Y | Y + wredrawln | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +scanw +----- + +### Synopsis + + int scanw(const char *fmt, ...); + int wscanw(WINDOW *win, const char *fmt, ...); + int mvscanw(int y, int x, const char *fmt, ...); + int mvwscanw(WINDOW *win, int y, int x, const char *fmt, ...); + int vwscanw(WINDOW *win, const char *fmt, va_list varglist); + int vw_scanw(WINDOW *win, const char *fmt, va_list varglist); + +### Description + + These routines correspond to the standard C library's scanf() family. + Each gets a string from the window via wgetnstr(), and uses the + resulting line as input for the scan. + + The duplication between vwscanw() and vw_scanw() is for historic + reasons. In PDCurses, they're the same. + +### Return Value + + On successful completion, these functions return the number of items + successfully matched. Otherwise they return ERR. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + scanw | Y | Y | Y + wscanw | Y | Y | Y + mvscanw | Y | Y | Y + mvwscanw | Y | Y | Y + vwscanw | Y | Y | Y + vw_scanw | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +scr_dump +-------- + +### Synopsis + + int putwin(WINDOW *win, FILE *filep); + WINDOW *getwin(FILE *filep); + int scr_dump(const char *filename); + int scr_init(const char *filename); + int scr_restore(const char *filename); + int scr_set(const char *filename); + +### Description + + getwin() reads window-related data previously stored in a file by + putwin(). It then creates and initialises a new window using that + data. + + putwin() writes all data associated with a window into a file, using + an unspecified format. This information can be retrieved later using + getwin(). + + scr_dump() writes the current contents of the virtual screen to the + file named by filename in an unspecified format. + + scr_restore() function sets the virtual screen to the contents of the + file named by filename, which must have been written using + scr_dump(). The next refresh operation restores the screen to the way + it looked in the dump file. + + In PDCurses, scr_init() does nothing, and scr_set() is a synonym for + scr_restore(). Also, scr_dump() and scr_restore() save and load from + curscr. This differs from some other implementations, where + scr_init() works with curscr, and scr_restore() works with newscr; + but the effect should be the same. (PDCurses has no newscr.) + +### Return Value + + On successful completion, getwin() returns a pointer to the window it + created. Otherwise, it returns a null pointer. Other functions return + OK or ERR. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + putwin | Y | Y | Y + getwin | Y | Y | Y + scr_dump | Y | Y | - + scr_init | Y | Y | - + scr_restore | Y | Y | - + scr_set | Y | Y | - + + + +-------------------------------------------------------------------------- + + +scroll +------ + +### Synopsis + + int scroll(WINDOW *win); + int scrl(int n); + int wscrl(WINDOW *win, int n); + +### Description + + scroll() causes the window to scroll up one line. This involves + moving the lines in the window data strcture. + + With a positive n, scrl() and wscrl() scroll the window up n lines + (line i + n becomes i); otherwise they scroll the window down n + lines. + + For these functions to work, scrolling must be enabled via + scrollok(). Note also that scrolling is not allowed if the supplied + window is a pad. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + scroll | Y | Y | Y + scrl | Y | Y | Y + wscrl | Y | Y | Y + + + +-------------------------------------------------------------------------- + + +slk +--- + +### Synopsis + + int slk_init(int fmt); + int slk_set(int labnum, const char *label, int justify); + int slk_refresh(void); + int slk_noutrefresh(void); + char *slk_label(int labnum); + int slk_clear(void); + int slk_restore(void); + int slk_touch(void); + int slk_attron(const chtype attrs); + int slk_attr_on(const attr_t attrs, void *opts); + int slk_attrset(const chtype attrs); + int slk_attr_set(const attr_t attrs, short color_pair, void *opts); + int slk_attroff(const chtype attrs); + int slk_attr_off(const attr_t attrs, void *opts); + int slk_color(short color_pair); + + int slk_wset(int labnum, const wchar_t *label, int justify); + + int PDC_mouse_in_slk(int y, int x); + void PDC_slk_free(void); + void PDC_slk_initialize(void); + + wchar_t *slk_wlabel(int labnum) + +### Description + + These functions manipulate a window that contain Soft Label Keys + (SLK). To use the SLK functions, a call to slk_init() must be made + BEFORE initscr() or newterm(). slk_init() removes 1 or 2 lines from + the useable screen, depending on the format selected. + + The line(s) removed from the screen are used as a separate window, in + which SLKs are displayed. + + slk_init() requires a single parameter which describes the format of + the SLKs as follows: + + 0 3-2-3 format + 1 4-4 format + 2 4-4-4 format (ncurses extension) + 3 4-4-4 format with index line (ncurses extension) + 2 lines used + 55 5-5 format (pdcurses format) + + slk_refresh(), slk_noutrefresh() and slk_touch() are analogous to + refresh(), noutrefresh() and touch(). + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + slk_init | Y | Y | Y + slk_set | Y | Y | Y + slk_refresh | Y | Y | Y + slk_noutrefresh | Y | Y | Y + slk_label | Y | Y | Y + slk_clear | Y | Y | Y + slk_restore | Y | Y | Y + slk_touch | Y | Y | Y + slk_attron | Y | Y | Y + slk_attrset | Y | Y | Y + slk_attroff | Y | Y | Y + slk_attr_on | Y | Y | Y + slk_attr_set | Y | Y | Y + slk_attr_off | Y | Y | Y + slk_wset | Y | Y | Y + PDC_mouse_in_slk | - | - | - + PDC_slk_free | - | - | - + PDC_slk_initialize | - | - | - + slk_wlabel | - | - | - + + + +-------------------------------------------------------------------------- + + +termattr +-------- + +### Synopsis + + int baudrate(void); + char erasechar(void); + bool has_ic(void); + bool has_il(void); + char killchar(void); + char *longname(void); + chtype termattrs(void); + attr_t term_attrs(void); + char *termname(void); + + int erasewchar(wchar_t *ch); + int killwchar(wchar_t *ch); + + char wordchar(void); + +### Description + + baudrate() is supposed to return the output speed of the terminal. In + PDCurses, it simply returns INT_MAX. + + has_ic and has_il() return TRUE. These functions have meaning in some + other implementations of curses. + + erasechar() and killchar() return ^H and ^U, respectively -- the + ERASE and KILL characters. In other curses implementations, these may + vary by terminal type. erasewchar() and killwchar() are the wide- + character versions; they take a pointer to a location in which to + store the character, and return OK or ERR. + + longname() returns a pointer to a static area containing a verbose + description of the current terminal. The maximum length of the string + is 128 characters. It is defined only after the call to initscr() or + newterm(). + + termname() returns a pointer to a static area containing a short + description of the current terminal (14 characters). + + termattrs() returns a logical OR of all video attributes supported by + the terminal. + + wordchar() is a PDCurses extension of the concept behind the + functions erasechar() and killchar(), returning the "delete word" + character, ^W. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + baudrate | Y | Y | Y + erasechar | Y | Y | Y + has_ic | Y | Y | Y + has_il | Y | Y | Y + killchar | Y | Y | Y + longname | Y | Y | Y + termattrs | Y | Y | Y + termname | Y | Y | Y + erasewchar | Y | Y | Y + killwchar | Y | Y | Y + term_attrs | Y | Y | Y + wordchar | - | - | - + + + +-------------------------------------------------------------------------- + + +touch +----- + +### Synopsis + + int touchwin(WINDOW *win); + int touchline(WINDOW *win, int start, int count); + int untouchwin(WINDOW *win); + int wtouchln(WINDOW *win, int y, int n, int changed); + bool is_linetouched(WINDOW *win, int line); + bool is_wintouched(WINDOW *win); + + int touchoverlap(const WINDOW *win1, WINDOW *win2); + +### Description + + touchwin() and touchline() throw away all information about which + parts of the window have been touched, pretending that the entire + window has been drawn on. This is sometimes necessary when using + overlapping windows, since a change to one window will affect the + other window, but the records of which lines have been changed in the + other window will not reflect the change. + + untouchwin() marks all lines in the window as unchanged since the + last call to wrefresh(). + + wtouchln() makes n lines in the window, starting at line y, look as + if they have (changed == 1) or have not (changed == 0) been changed + since the last call to wrefresh(). + + is_linetouched() returns TRUE if the specified line in the specified + window has been changed since the last call to wrefresh(). + + is_wintouched() returns TRUE if the specified window has been changed + since the last call to wrefresh(). + + touchoverlap(win1, win2) marks the portion of win2 which overlaps + with win1 as modified. + +### Return Value + + All functions return OK on success and ERR on error except + is_wintouched() and is_linetouched(). + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + touchwin | Y | Y | Y + touchline | Y | Y | Y + untouchwin | Y | Y | Y + wtouchln | Y | Y | Y + is_linetouched | Y | Y | Y + is_wintouched | Y | Y | Y + touchoverlap | - | - | Y + + + +-------------------------------------------------------------------------- + + +util +---- + +### Synopsis + + char *unctrl(chtype c); + void filter(void); + void use_env(bool x); + int delay_output(int ms); + + int getcchar(const cchar_t *wcval, wchar_t *wch, attr_t *attrs, + short *color_pair, void *opts); + int setcchar(cchar_t *wcval, const wchar_t *wch, const attr_t attrs, + short color_pair, const void *opts); + wchar_t *wunctrl(cchar_t *wc); + + int PDC_mbtowc(wchar_t *pwc, const char *s, size_t n); + size_t PDC_mbstowcs(wchar_t *dest, const char *src, size_t n); + size_t PDC_wcstombs(char *dest, const wchar_t *src, size_t n); + +### Description + + unctrl() expands the text portion of the chtype c into a printable + string. Control characters are changed to the "^X" notation; others + are passed through. wunctrl() is the wide-character version of the + function. + + filter() and use_env() are no-ops in PDCurses. + + delay_output() inserts an ms millisecond pause in output. + + getcchar() works in two modes: When wch is not NULL, it reads the + cchar_t pointed to by wcval and stores the attributes in attrs, the + color pair in color_pair, and the text in the wide-character string + wch. When wch is NULL, getcchar() merely returns the number of wide + characters in wcval. In either mode, the opts argument is unused. + + setcchar constructs a cchar_t at wcval from the wide-character text + at wch, the attributes in attr and the color pair in color_pair. The + opts argument is unused. + + Currently, the length returned by getcchar() is always 1 or 0. + Similarly, setcchar() will only take the first wide character from + wch, and ignore any others that it "should" take (i.e., combining + characters). Nor will it correctly handle any character outside the + basic multilingual plane (UCS-2). + +### Return Value + + wunctrl() returns NULL on failure. delay_output() always returns OK. + + getcchar() returns the number of wide characters wcval points to when + wch is NULL; when it's not, getcchar() returns OK or ERR. + + setcchar() returns OK or ERR. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + unctrl | Y | Y | Y + filter | Y | Y | Y + use_env | Y | Y | Y + delay_output | Y | Y | Y + getcchar | Y | Y | Y + setcchar | Y | Y | Y + wunctrl | Y | Y | Y + PDC_mbtowc | - | - | - + PDC_mbstowcs | - | - | - + PDC_wcstombs | - | - | - + + + +-------------------------------------------------------------------------- + + +window +------ + +### Synopsis + + WINDOW *newwin(int nlines, int ncols, int begy, int begx); + WINDOW *derwin(WINDOW* orig, int nlines, int ncols, + int begy, int begx); + WINDOW *subwin(WINDOW* orig, int nlines, int ncols, + int begy, int begx); + WINDOW *dupwin(WINDOW *win); + WINDOW *wgetparent(const WINDOW *win); + int delwin(WINDOW *win); + int mvwin(WINDOW *win, int y, int x); + int mvderwin(WINDOW *win, int pary, int parx); + int syncok(WINDOW *win, bool bf); + bool is_subwin(const WINDOW *win); + bool is_syncok(const WINDOW *win); + void wsyncup(WINDOW *win); + void wcursyncup(WINDOW *win); + void wsyncdown(WINDOW *win); + + WINDOW *resize_window(WINDOW *win, int nlines, int ncols); + int wresize(WINDOW *win, int nlines, int ncols); + WINDOW *PDC_makelines(WINDOW *win); + WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx); + void PDC_sync(WINDOW *win); + +### Description + + newwin() creates a new window with the given number of lines, nlines + and columns, ncols. The upper left corner of the window is at line + begy, column begx. If nlines is zero, it defaults to LINES - begy; + ncols to COLS - begx. Create a new full-screen window by calling + newwin(0, 0, 0, 0). + + delwin() deletes the named window, freeing all associated memory. In + the case of overlapping windows, subwindows should be deleted before + the main window. + + mvwin() moves the window so that the upper left-hand corner is at + position (y,x). If the move would cause the window to be off the + screen, it is an error and the window is not moved. Moving subwindows + is allowed. + + subwin() creates a new subwindow within a window. The dimensions of + the subwindow are nlines lines and ncols columns. The subwindow is at + position (begy, begx) on the screen. This position is relative to the + screen, and not to the window orig. Changes made to either window + will affect both. When using this routine, you will often need to + call touchwin() before calling wrefresh(). + + derwin() is the same as subwin(), except that begy and begx are + relative to the origin of the window orig rather than the screen. + There is no difference between subwindows and derived windows. + + mvderwin() moves a derived window (or subwindow) inside its parent + window. The screen-relative parameters of the window are not changed. + This routine is used to display different parts of the parent window + at the same physical position on the screen. + + dupwin() creates an exact duplicate of the window win. + + wgetparent() returns the parent WINDOW pointer for subwindows, or NULL + for windows having no parent. + + wsyncup() causes a touchwin() of all of the window's parents. + + If syncok() is called with a second argument of TRUE, this causes a + wsyncup() to be called every time the window is changed. + + is_subwin() reports whether the specified window is a subwindow, + created by subwin() or derwin(). + + is_syncok() reports whether the specified window is in syncok mode. + + wcursyncup() causes the current cursor position of all of a window's + ancestors to reflect the current cursor position of the current + window. + + wsyncdown() causes a touchwin() of the current window if any of its + parent's windows have been touched. + + resize_window() allows the user to resize an existing window. It + returns the pointer to the new window, or NULL on failure. + + wresize() is an ncurses-compatible wrapper for resize_window(). Note + that, unlike ncurses, it will NOT process any subwindows of the + window. (However, you still can call it _on_ subwindows.) It returns + OK or ERR. + + PDC_makenew() allocates all data for a new WINDOW * except the actual + lines themselves. If it's unable to allocate memory for the window + structure, it will free all allocated memory and return a NULL + pointer. + + PDC_makelines() allocates the memory for the lines. + + PDC_sync() handles wrefresh() and wsyncup() calls when a window is + changed. + +### Return Value + + newwin(), subwin(), derwin() and dupwin() return a pointer to the new + window, or NULL on failure. delwin(), mvwin(), mvderwin() and + syncok() return OK or ERR. wsyncup(), wcursyncup() and wsyncdown() + return nothing. + + is_subwin() and is_syncok() returns TRUE or FALSE. + +### Errors + + It is an error to call resize_window() before calling initscr(). + Also, an error will be generated if we fail to create a newly sized + replacement window for curscr, or stdscr. This could happen when + increasing the window size. NOTE: If this happens, the previously + successfully allocated windows are left alone; i.e., the resize is + NOT cancelled for those windows. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + newwin | Y | Y | Y + delwin | Y | Y | Y + mvwin | Y | Y | Y + subwin | Y | Y | Y + derwin | Y | Y | Y + mvderwin | Y | Y | Y + dupwin | Y | Y | Y + wgetparent | - | Y | - + wsyncup | Y | Y | Y + syncok | Y | Y | Y + is_subwin | - | Y | - + is_syncok | - | Y | - + wcursyncup | Y | Y | Y + wsyncdown | Y | Y | Y + wresize | - | Y | Y + resize_window | - | - | - + PDC_makelines | - | - | - + PDC_makenew | - | - | - + PDC_sync | - | - | - + + + +-------------------------------------------------------------------------- + + +clipboard +--------- + +### Synopsis + + int PDC_getclipboard(char **contents, long *length); + int PDC_setclipboard(const char *contents, long length); + int PDC_freeclipboard(char *contents); + int PDC_clearclipboard(void); + +### Description + + PDC_getclipboard() gets the textual contents of the system's + clipboard. This function returns the contents of the clipboard in the + contents argument. It is the responsibility of the caller to free the + memory returned, via PDC_freeclipboard(). The length of the clipboard + contents is returned in the length argument. + + PDC_setclipboard copies the supplied text into the system's + clipboard, emptying the clipboard prior to the copy. + + PDC_clearclipboard() clears the internal clipboard. + +### Return Values + + PDC_CLIP_SUCCESS the call was successful + PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for + the clipboard contents + PDC_CLIP_EMPTY the clipboard contains no text + PDC_CLIP_ACCESS_ERROR no clipboard support + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + PDC_getclipboard | - | - | - + PDC_setclipboard | - | - | - + PDC_freeclipboard | - | - | - + PDC_clearclipboard | - | - | - + + + +-------------------------------------------------------------------------- + + +pdcsetsc +-------- + +### Synopsis + + int PDC_set_blink(bool blinkon); + int PDC_set_bold(bool boldon); + void PDC_set_title(const char *title); + +### Description + + PDC_set_blink() toggles whether the A_BLINK attribute sets an actual + blink mode (TRUE), or sets the background color to high intensity + (FALSE). The default is platform-dependent (FALSE in most cases). It + returns OK if it could set the state to match the given parameter, + ERR otherwise. + + PDC_set_bold() toggles whether the A_BOLD attribute selects an actual + bold font (TRUE), or sets the foreground color to high intensity + (FALSE). It returns OK if it could set the state to match the given + parameter, ERR otherwise. + + PDC_set_title() sets the title of the window in which the curses + program is running. This function may not do anything on some + platforms. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + PDC_set_blink | - | - | - + PDC_set_bold | - | - | - + PDC_set_title | - | - | - + + + +-------------------------------------------------------------------------- + + +sb +-- + +### Synopsis + + int sb_init(void) + int sb_set_horz(int total, int viewport, int cur) + int sb_set_vert(int total, int viewport, int cur) + int sb_get_horz(int *total, int *viewport, int *cur) + int sb_get_vert(int *total, int *viewport, int *cur) + int sb_refresh(void); + +### Description + + These functions manipulate the scrollbar (X11 only). + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + sb_init | - | - | - + sb_set_horz | - | - | - + sb_set_vert | - | - | - + sb_get_horz | - | - | - + sb_get_vert | - | - | - + sb_refresh | - | - | - + + + +-------------------------------------------------------------------------- + diff --git a/vendor/pdcurses/docs/README.md b/vendor/pdcurses/docs/README.md new file mode 100644 index 0000000..020504b --- /dev/null +++ b/vendor/pdcurses/docs/README.md @@ -0,0 +1,37 @@ +PDCurses Documentation +====================== + +The main documentation for PDCurses is here: + +- [User's Guide] - Basic overview +- [Implementor's Guide] - What you need to know to port PDCurses +- [Manual] - Each function, etc. +- [History] + +Also consult the README for each specific platform you'll be using: + +- [DOS] +- [OS/2] +- [SDL 1.x] +- [SDL 2.x] +- [Windows] +- [X11] + + +Building +-------- + +- To rebuild MANUAL.md from the "man page" sections of the source code, + type "./mkman.sh". Needs a Unix-like shell and an Awk interpreter. + + +[User's Guide]: USERS.md +[Implementor's Guide]: IMPLEMNT.md +[Manual]: MANUAL.md +[History]: HISTORY.md +[DOS]: ../dos/README.md +[OS/2]: ../os2/README.md +[SDL 1.x]: ../sdl1/README.md +[SDL 2.x]: ../sdl2/README.md +[Windows]: ../wincon/README.md +[X11]: ../x11/README.md diff --git a/vendor/pdcurses/docs/USERS.md b/vendor/pdcurses/docs/USERS.md new file mode 100644 index 0000000..de870ae --- /dev/null +++ b/vendor/pdcurses/docs/USERS.md @@ -0,0 +1,380 @@ +PDCurses User's Guide +===================== + +Curses Overview +--------------- + +The X/Open Curses Interface Definition describes a set of C-Language +functions that provide screen-handling and updating, which are +collectively known as the curses library. + +The curses library permits manipulation of data structures called +windows which may be thought of as two-dimensional arrays of +characters representing all or part of a terminal's screen. The +windows are manipulated using a procedural interface described +[elsewhere]. The curses package maintains a record of what characters +are on the screen. At the most basic level, manipulation is done with +the routines move() and addch() which are used to "move" the curses +around and add characters to the default window, stdscr, which +represents the whole screen. + +An application may use these routines to add data to the window in any +convenient order. Once all data have been added, the routine +refresh() is called. The package then determines what changes have +been made which affect the screen. The screen contents are then +changed to reflect those characters now in the window, using a +sequence of operations optimized for the type of terminal in use. + +At a higher level routines combining the actions of move() and addch() +are defined, as are routines to add whole strings and to perform +format conversions in the manner of printf(). + +Interfaces are also defined to erase the entire window and to specify +the attributes of individual characters in the window. Attributes +such as inverse video, underline and blink can be used on a +per-character basis. + +New windows can be created by allowing the application to build +several images of the screen and display the appropriate one very +quickly. New windows are created using the routine newwin(). For +each routine that manipulates the default window, stdscr, there is a +corresponding routine prefixed with w to manipulate the contents of a +specified window; for example, move() and wmove(). In fact, move(...) +is functionally equivalent to wmove( stdscr, ...). This is similar to +the interface offered by printf(...) and fprintf(stdout, ...). + +Windows do not have to correspond to the entire screen. It is +possible to create smaller windows, and also to indicate that the +window is only partially visible on the screen. Furthermore, large +windows or pads, which are bigger than the actual screen size, may be +created. + +Interfaces are also defined to allow input character manipulation and +to disable and enable many input attributes: character echo, single +character input with or without signal processing (cbreak or raw +modes), carriage returns mapping to newlines, screen scrolling, etc. + + +Data Types and the \ Header +-------------------------------------- + +The data types supported by curses are described in this section. + +As the library supports a procedural interface to the data types, actual +structure contents are not described. All curses data are manipulated +using the routines provided. + + +### The \ Header + +The \ header defines various constants and declares the data +types that are available to the application. + + +### Data Types + +The following data types are declared: + + Type | Description + :------------|:------------------------------------ + WINDOW * | pointer to screen representation + SCREEN * | pointer to terminal descriptor + bool | boolean data type + chtype | representation of a character in a window + cchar_t | the wide-character equivalent of chtype + attr_t | for WA_-style attributes + +The actual WINDOW and SCREEN objects used to store information are +created by the corresponding routines and a pointer to them is provided. +All manipulation is through that pointer. + + +### Variables + +The following variables are defined: + + Variable | Description + :------------|:------------------------------------ + LINES | number of lines on terminal screen + COLS | number of columns on terminal screen + stdscr | pointer to the default screen window + curscr | pointer to the current screen image + SP | pointer to the current SCREEN struct + Mouse_status | status of the mouse + COLORS | number of colors available + COLOR_PAIRS | number of color pairs available + TABSIZE | size of one TAB block + acs_map[] | alternate character set map + ttytype[] | terminal name/description + + +### Constants + +The following constants are defined: + +#### General + + Constant | Description + :------------|:------------------------------------ + FALSE | boolean false value + TRUE | boolean true value + NULL | zero pointer value + ERR | value returned on error condition + OK | value returned on successful completion + +#### Video Attributes + +Normally, attributes are a property of the character. + +For chtype: + + Attribute | Description + :------------|:------------------------------------ + A_ALTCHARSET | use the alternate character set + A_BLINK | bright background or blinking + A_BOLD | bright foreground or bold + A_DIM | half bright -- no effect in PDCurses + A_INVIS | invisible -- no effect in PDCurses + A_ITALIC | italic + A_LEFT | line along the left edge + A_PROTECT | protected -- no effect in PDCurses + A_REVERSE | reverse video + A_RIGHT | line along the right edge + A_STANDOUT | terminal's best highlighting mode + A_UNDERLINE | underline + A_ATTRIBUTES | bit-mask to extract attributes + A_CHARTEXT | bit-mask to extract a character + A_COLOR | bit-mask to extract a color-pair + +Not all attributes will work on all terminals. A_ITALIC is not standard, +but is shared with ncurses. + +For attr_t: + + Attribute | Description + :------------|:------------------------------------- + WA_ALTCHARSET| same as A_ALTCHARSET + WA_BLINK | same as A_BLINK + WA_BOLD | same as A_BOLD + WA_DIM | same as A_DIM + WA_INVIS | same as A_INVIS + WA_ITALIC | same as A_ITALIC + WA_LEFT | same as A_LEFT + WA_PROTECT | same as A_PROTECT + WA_REVERSE | same as A_REVERSE + WA_RIGHT | same as A_RIGHT + WA_STANDOUT | same as A_STANDOUT + WA_UNDERLINE | same as A_UNDERLINE + +The following are also defined, for compatibility, but currently have no +effect in PDCurses: A_HORIZONTAL, A_LOW, A_TOP, A_VERTICAL and their +WA_* equivalents. + +### The Alternate Character Set + +For use in chtypes and with related functions. These are a portable way +to represent graphics characters on different terminals. + +VT100-compatible symbols -- box characters: + + Name | Description + :------------|:------------------------------------- + ACS_ULCORNER | upper left box corner + ACS_LLCORNER | lower left box corner + ACS_URCORNER | upper right box corner + ACS_LRCORNER | lower right box corner + ACS_RTEE | right "T" + ACS_LTEE | left "T" + ACS_BTEE | bottom "T" + ACS_TTEE | top "T" + ACS_HLINE | horizontal line + ACS_VLINE | vertical line + ACS_PLUS | plus sign, cross, or four-corner piece + +VT100-compatible symbols -- other: + + Name | Description + :------------|:------------------------------------- + ACS_S1 | scan line 1 + ACS_S9 | scan line 9 + ACS_DIAMOND | diamond + ACS_CKBOARD | checkerboard -- 50% grey + ACS_DEGREE | degree symbol + ACS_PLMINUS | plus/minus sign + ACS_BULLET | bullet + +Teletype 5410v1 symbols -- these are defined in SysV curses, but are not +well-supported by most terminals. Stick to VT100 characters for optimum +portability: + + Name | Description + :------------|:------------------------------------- + ACS_LARROW | left arrow + ACS_RARROW | right arrow + ACS_DARROW | down arrow + ACS_UARROW | up arrow + ACS_BOARD | checkerboard -- less dense than ACS_CKBOARD + ACS_LANTERN | lantern symbol + ACS_BLOCK | solid block + +That goes double for these -- undocumented SysV symbols. Don't use them: + + Name | Description + :------------|:------------------------------------- + ACS_S3 | scan line 3 + ACS_S7 | scan line 7 + ACS_LEQUAL | less than or equal + ACS_GEQUAL | greater than or equal + ACS_PI | pi + ACS_NEQUAL | not equal + ACS_STERLING | pounds sterling symbol + +Box character aliases: + + Name | Description + :------------|:------------------------------------- + ACS_BSSB | same as ACS_ULCORNER + ACS_SSBB | same as ACS_LLCORNER + ACS_BBSS | same as ACS_URCORNER + ACS_SBBS | same as ACS_LRCORNER + ACS_SBSS | same as ACS_RTEE + ACS_SSSB | same as ACS_LTEE + ACS_SSBS | same as ACS_BTEE + ACS_BSSS | same as ACS_TTEE + ACS_BSBS | same as ACS_HLINE + ACS_SBSB | same as ACS_VLINE + ACS_SSSS | same as ACS_PLUS + +For cchar_t and wide-character functions, WACS_ equivalents are also +defined. + +### Colors + +For use with init_pair(), color_set(), etc.: + + Name | BGR value | RGB value + :------------|:---------:|:---------: + COLOR_BLACK | 0 | 0 + COLOR_BLUE | 1 | 4 + COLOR_GREEN | 2 | 2 + COLOR_CYAN | 3 | 6 + COLOR_RED | 4 | 1 + COLOR_MAGENTA| 5 | 5 + COLOR_YELLOW | 6 | 3 + COLOR_WHITE | 7 | 7 + +Use the symbolic names instead of numeric values. The definition of the +colors depends on the implementation of curses. + + +### Input Values + +The following constants might be returned by getch() if keypad() has +been enabled. Note that not all of these may be supported on a +particular terminal: + + Name | Description + :------------|:------------------------------------- + KEY_BREAK | break key + KEY_DOWN | the four arrow keys + KEY_UP | + KEY_LEFT | + KEY_RIGHT | + KEY_HOME | home key (upward+left arrow) + KEY_BACKSPACE| backspace + KEY_F0 | function keys; space for 64 keys is reserved + KEY_F(n) | (KEY_F0+(n)) + KEY_DL | delete line + KEY_IL | insert line + KEY_DC | delete character + KEY_IC | insert character + KEY_EIC | exit insert character mode + KEY_CLEAR | clear screen + KEY_EOS | clear to end of screen + KEY_EOL | clear to end of line + KEY_SF | scroll 1 line forwards + KEY_SR | scroll 1 line backwards (reverse) + KEY_NPAGE | next page + KEY_PPAGE | previous page + KEY_STAB | set tab + KEY_CTAB | clear tab + KEY_CATAB | clear all tabs + KEY_ENTER | enter or send + KEY_SRESET | soft (partial) reset + KEY_RESET | reset or hard reset + KEY_PRINT | print or copy + KEY_LL | home down or bottom (lower left) + KEY_A1 | upper left of virtual keypad + KEY_A3 | upper right of virtual keypad + KEY_B2 | center of virtual keypad + KEY_C1 | lower left of virtual keypad + KEY_C3 | lower right of virtual keypad + KEY_BTAB | Back tab key + KEY_BEG | Beginning key + KEY_CANCEL | Cancel key + 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| Reference key + KEY_REFRESH | Refresh key + KEY_REPLACE | Replace key + KEY_RESTART | Restart key + KEY_RESUME | Resume key + KEY_SAVE | Save key + KEY_SBEG | Shifted beginning key + KEY_SCANCEL | 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_SLEFT | Shifted left arrow key + KEY_SMESSAGE | Shifted message key + KEY_SMOVE | Shifted move key + KEY_SNEXT | Shifted next key + KEY_SOPTIONS | Shifted options key + KEY_SPREVIOUS| Shifted prev key + KEY_SPRINT | Shifted print key + KEY_SREDO | Shifted 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 suspend key + KEY_SUNDO | Shifted undo key + KEY_SUSPEND | Suspend key + KEY_UNDO | Undo key + +The virtual keypad is arranged like this: + + A1 up A3 + left B2 right + C1 down C3 + +This list is incomplete -- see curses.h for the full list, and use the +testcurs demo to see what values are actually returned. The above are +just the keys required by X/Open. In particular, PDCurses defines many +CTL_ and ALT_ combinations; these are not portable. + +[elsewhere]: MANUAL.md diff --git a/vendor/pdcurses/docs/manext.awk b/vendor/pdcurses/docs/manext.awk new file mode 100755 index 0000000..f607565 --- /dev/null +++ b/vendor/pdcurses/docs/manext.awk @@ -0,0 +1,15 @@ +#!/usr/bin/awk -f +BEGIN { + inman=0; + bar="\n\n--------------------------------------------------------------------------\n"; +} +{ + if (inman) { + if ($0 ~ /^\*\*man-end/) { + inman=0; + print bar; + } else + print; + } else if ($0 ~ /^\/\*man-start\*/) + inman=1; +} diff --git a/vendor/pdcurses/docs/mkman.sh b/vendor/pdcurses/docs/mkman.sh new file mode 100755 index 0000000..a5cb0fc --- /dev/null +++ b/vendor/pdcurses/docs/mkman.sh @@ -0,0 +1,7 @@ +echo Definitions and Variables \(curses.h\) > MANUAL.md +echo ==================================== >> MANUAL.md +./manext.awk ../curses.h >> MANUAL.md +echo Functions >> MANUAL.md +echo ========= >> MANUAL.md +./manext.awk ../pdcurses/*.c >> MANUAL.md +./manext.awk ../x11/*.c >> MANUAL.md diff --git a/vendor/pdcurses/dos/Makefile b/vendor/pdcurses/dos/Makefile new file mode 100644 index 0000000..e137fc8 --- /dev/null +++ b/vendor/pdcurses/dos/Makefile @@ -0,0 +1,82 @@ +# GNU Makefile for PDCurses - DOS +# +# Usage: make [-f path\Makefile] [DEBUG=Y] [target] +# +# where target can be any of: +# [all|libs|demos|pdcurses.a|testcurs.exe...] + +O = o +E = .exe +RM = del + +ifndef PDCURSES_SRCDIR + PDCURSES_SRCDIR = .. +endif + +include $(PDCURSES_SRCDIR)/common/libobjs.mif + +osdir = $(PDCURSES_SRCDIR)/dos + +PDCURSES_DOS_H = $(osdir)/pdcdos.h + +CC = gcc + +ifeq ($(DEBUG),Y) + CFLAGS = -g -Wall -DPDCDEBUG + LDFLAGS = -g +else + CFLAGS = -O2 -Wall + LDFLAGS = +endif + +CFLAGS += -I$(PDCURSES_SRCDIR) + +LINK = gcc + +LIBEXE = ar +LIBFLAGS = rcv + +LIBCURSES = pdcurses.a + +.PHONY: all libs clean demos dist + +all: libs + +libs: $(LIBCURSES) + +clean: + -$(RM) *.o + -$(RM) *.a + -$(RM) *.exe + +demos: $(DEMOS) +ifneq ($(DEBUG),Y) + strip *.exe +endif + +$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) + $(LIBEXE) $(LIBFLAGS) $@ $? + +$(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) +$(PDCOBJS) : $(PDCURSES_DOS_H) +$(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) +panel.o : $(PANEL_HEADER) + +$(LIBOBJS) : %.o: $(srcdir)/%.c + $(CC) -c $(CFLAGS) $< + +$(PDCOBJS) : %.o: $(osdir)/%.c + $(CC) -c $(CFLAGS) $< + +firework.exe ozdemo.exe rain.exe testcurs.exe worm.exe xmas.exe \ +ptest.exe: %.exe: $(demodir)/%.c + $(CC) $(CFLAGS) -o$@ $< $(LIBCURSES) + +tuidemo.exe: tuidemo.o tui.o + $(LINK) $(LDFLAGS) -o$@ tuidemo.o tui.o $(LIBCURSES) + +tui.o: $(demodir)/tui.c $(demodir)/tui.h $(PDCURSES_CURSES_H) + $(CC) -c $(CFLAGS) -I$(demodir) -o$@ $< + +tuidemo.o: $(demodir)/tuidemo.c $(PDCURSES_CURSES_H) + $(CC) -c $(CFLAGS) -I$(demodir) -o$@ $< diff --git a/vendor/pdcurses/dos/Makefile.bcc b/vendor/pdcurses/dos/Makefile.bcc new file mode 100644 index 0000000..c23ed2c --- /dev/null +++ b/vendor/pdcurses/dos/Makefile.bcc @@ -0,0 +1,76 @@ +# Borland Makefile for PDCurses - DOS +# +# Usage: make -f [path\]Makefile.bcc [DEBUG=] [MODEL=c|h|l|m|s] [target] +# +# where target can be any of: +# [all|demos|pdcurses.lib|testcurs.exe...] + +!ifndef MODEL +MODEL = l +!endif + +O = obj +E = .exe +RM = del + +!ifndef PDCURSES_SRCDIR +PDCURSES_SRCDIR = .. +!endif + +!include $(PDCURSES_SRCDIR)\common\libobjs.mif + +osdir = $(PDCURSES_SRCDIR)\dos + +!ifdef DEBUG +CFLAGS = -N -v -y -DPDCDEBUG +!else +CFLAGS = -O +!endif + +CPPFLAGS = -I$(PDCURSES_SRCDIR) + +BUILD = $(CC) -1- -G -d -w-par -c -m$(MODEL) $(CFLAGS) $(CPPFLAGS) + +LIBEXE = tlib /C /E + +LIBCURSES = pdcurses.lib + +all: $(LIBCURSES) + +clean: + -$(RM) *.obj + -$(RM) *.lib + -$(RM) *.map + -$(RM) *.exe + +demos: $(LIBCURSES) $(DEMOS) + +$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) + -$(RM) $@ + $(LIBEXE) $@ @$(PDCURSES_SRCDIR)\common\borland.lrf + +.autodepend + +{$(srcdir)\}.c.obj: + $(BUILD) $< + +{$(osdir)\}.c.obj: + $(BUILD) $< + +{$(demodir)\}.c.obj: + $(BUILD) $< + +.c.obj: + $(BUILD) $< + +.obj.exe: + $(CC) -m$(MODEL) -e$@ $** $(LIBCURSES) + +tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES) + $(CC) -m$(MODEL) -e$@ $** + +tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(PDCURSES_CURSES_H) + $(BUILD) -I$(demodir) $(demodir)\tui.c + +tuidemo.obj: $(demodir)\tuidemo.c $(PDCURSES_CURSES_H) + $(BUILD) -I$(demodir) $(demodir)\tuidemo.c diff --git a/vendor/pdcurses/dos/Makefile.wcc b/vendor/pdcurses/dos/Makefile.wcc new file mode 100644 index 0000000..eabf9e9 --- /dev/null +++ b/vendor/pdcurses/dos/Makefile.wcc @@ -0,0 +1,35 @@ +# Watcom Makefile for PDCurses - DOS +# +# Usage: wmake -f [path\]Makefile.wcc [DEBUG=Y] [MODEL=c|h|l|m|s|f] [target] +# +# where target can be any of: +# [all|demos|pdcurses.lib|testcurs.exe...] + +!ifndef MODEL +MODEL = l +!endif + +!ifdef %PDCURSES_SRCDIR +PDCURSES_SRCDIR = $(%PDCURSES_SRCDIR) +!else +PDCURSES_SRCDIR = .. +!endif + +osdir = $(PDCURSES_SRCDIR)/dos + +!ifeq MODEL f +CC = wcc386 +TARGET = dos4g +!else +CC = wcc +TARGET = dos +!endif + +CFLAGS = -bt=$(TARGET) -m$(MODEL) + +!include $(PDCURSES_SRCDIR)/common/watcom.mif + +$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) + %write wccdos.lrf $(LIBOBJS) $(PDCOBJS) + $(LIBEXE) $@ @wccdos.lrf + -$(RM) wccdos.lrf diff --git a/vendor/pdcurses/dos/README.md b/vendor/pdcurses/dos/README.md new file mode 100644 index 0000000..26c4a03 --- /dev/null +++ b/vendor/pdcurses/dos/README.md @@ -0,0 +1,41 @@ +PDCurses for DOS +================ + +This directory contains PDCurses source code files specific to DOS. + + +Building +-------- + +- Choose the appropriate makefile for your compiler: + + Makefile - DJGPP + Makefile.bcc - Borland C++ + Makefile.wcc - Watcom + +- For 16-bit compilers, you can change the memory MODEL as a command- + line option. (Large model is the default, and recommended.) With + Watcom, specifying "MODEL=f" (flat) will automatically switch to a + 32-bit build. + +- Optionally, you can build in a different directory than the platform + directory by setting PDCURSES_SRCDIR to point to the directory where + you unpacked PDCurses, and changing to your target directory: + + set PDCURSES_SRCDIR=c:\pdcurses + +- Build it: + + make -f makefile + + (For Watcom, use "wmake" instead of "make".) You'll get the library + (pdcurses.lib or .a, depending on your compiler) and a lot of object + files. Add the target "demos" to build the sample programs. + + +Acknowledgements +---------------- + +Watcom C port was provided by Pieter Kunst + +DJGPP port was provided by David Nugent diff --git a/vendor/pdcurses/dos/pdcclip.c b/vendor/pdcurses/dos/pdcclip.c new file mode 100644 index 0000000..d5a81d5 --- /dev/null +++ b/vendor/pdcurses/dos/pdcclip.c @@ -0,0 +1,133 @@ +/* PDCurses */ + +#include "pdcdos.h" + +#include + +/*man-start************************************************************** + +clipboard +--------- + +### Synopsis + + int PDC_getclipboard(char **contents, long *length); + int PDC_setclipboard(const char *contents, long length); + int PDC_freeclipboard(char *contents); + int PDC_clearclipboard(void); + +### Description + + PDC_getclipboard() gets the textual contents of the system's + clipboard. This function returns the contents of the clipboard in the + contents argument. It is the responsibility of the caller to free the + memory returned, via PDC_freeclipboard(). The length of the clipboard + contents is returned in the length argument. + + PDC_setclipboard copies the supplied text into the system's + clipboard, emptying the clipboard prior to the copy. + + PDC_clearclipboard() clears the internal clipboard. + +### Return Values + + PDC_CLIP_SUCCESS the call was successful + PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for + the clipboard contents + PDC_CLIP_EMPTY the clipboard contains no text + PDC_CLIP_ACCESS_ERROR no clipboard support + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + PDC_getclipboard | - | - | - + PDC_setclipboard | - | - | - + PDC_freeclipboard | - | - | - + PDC_clearclipboard | - | - | - + +**man-end****************************************************************/ + +/* global clipboard contents, should be NULL if none set */ + +static char *pdc_DOS_clipboard = NULL; + +int PDC_getclipboard(char **contents, long *length) +{ + int len; + + PDC_LOG(("PDC_getclipboard() - called\n")); + + if (!pdc_DOS_clipboard) + return PDC_CLIP_EMPTY; + + len = strlen(pdc_DOS_clipboard); + *contents = malloc(len + 1); + if (!*contents) + return PDC_CLIP_MEMORY_ERROR; + + strcpy(*contents, pdc_DOS_clipboard); + *length = len; + + return PDC_CLIP_SUCCESS; +} + +int PDC_setclipboard(const char *contents, long length) +{ + PDC_LOG(("PDC_setclipboard() - called\n")); + + if (pdc_DOS_clipboard) + { + free(pdc_DOS_clipboard); + pdc_DOS_clipboard = NULL; + } + + if (contents) + { + pdc_DOS_clipboard = malloc(length + 1); + if (!pdc_DOS_clipboard) + return PDC_CLIP_MEMORY_ERROR; + + strcpy(pdc_DOS_clipboard, contents); + } + + return PDC_CLIP_SUCCESS; +} + +int PDC_freeclipboard(char *contents) +{ + PDC_LOG(("PDC_freeclipboard() - called\n")); + + /* should we also free empty the system clipboard? probably not */ + + if (contents) + { + /* NOTE: We free the memory, but we can not set caller's pointer + to NULL, so if caller calls again then will try to access + free'd memory. We 1st overwrite memory with a string so if + caller tries to use free memory they won't get what they + expect & hopefully notice. */ + + /* memset(contents, 0xFD, strlen(contents)); */ + + if (strlen(contents) >= strlen("PDCURSES")) + strcpy(contents, "PDCURSES"); + + free(contents); + } + + return PDC_CLIP_SUCCESS; +} + +int PDC_clearclipboard(void) +{ + PDC_LOG(("PDC_clearclipboard() - called\n")); + + if (pdc_DOS_clipboard) + { + free(pdc_DOS_clipboard); + pdc_DOS_clipboard = NULL; + } + + return PDC_CLIP_SUCCESS; +} diff --git a/vendor/pdcurses/dos/pdcdisp.c b/vendor/pdcurses/dos/pdcdisp.c new file mode 100644 index 0000000..5f30d28 --- /dev/null +++ b/vendor/pdcurses/dos/pdcdisp.c @@ -0,0 +1,155 @@ +/* PDCurses */ + +#include "pdcdos.h" +#include "../common/acs437.h" + +/* position hardware cursor at (y, x) */ + +void PDC_gotoyx(int row, int col) +{ + PDCREGS regs; + + PDC_LOG(("PDC_gotoyx() - called: row %d col %d\n", row, col)); + + regs.h.ah = 0x02; + regs.h.bh = 0; + regs.h.dh = (unsigned char) row; + regs.h.dl = (unsigned char) col; + PDCINT(0x10, regs); +} + +void _new_packet(attr_t attr, int lineno, int x, int len, const chtype *srcp) +{ + attr_t sysattrs; + int j; + short fore, back; + unsigned char mapped_attr; + + sysattrs = SP->termattrs; + pair_content(PAIR_NUMBER(attr), &fore, &back); + + if (attr & A_BOLD) + fore |= 8; + if (attr & A_BLINK) + back |= 8; + + fore = pdc_curstoreal[fore]; + back = pdc_curstoreal[back]; + + if (attr & A_REVERSE) + { + if (sysattrs & A_BLINK) + mapped_attr = (back & 7) | (((fore & 7) | (back & 8)) << 4); + else + mapped_attr = back | (fore << 4); + } + else + { + if ((attr & A_UNDERLINE) && (sysattrs & A_UNDERLINE)) + fore = (fore & 8) | 1; + + mapped_attr = fore | (back << 4); + } + + if (pdc_direct_video) + { +#if SMALL || MEDIUM + struct SREGS segregs; + int ds; +#endif + /* this should be enough for the maximum width of a screen */ + + struct {unsigned char text, attr;} temp_line[256]; + + /* replace the attribute part of the chtype with the actual + color value for each chtype in the line */ + + for (j = 0; j < len; j++) + { + chtype ch = srcp[j]; + + temp_line[j].attr = mapped_attr; + + if (ch & A_ALTCHARSET && !(ch & 0xff80)) + ch = acs_map[ch & 0x7f]; + + temp_line[j].text = ch & 0xff; + } + +#ifdef __DJGPP__ + dosmemput(temp_line, len * 2, + (unsigned long)_FAR_POINTER(pdc_video_seg, + pdc_video_ofs + (lineno * curscr->_maxx + x) * 2)); +#else +# if SMALL || MEDIUM + segread(&segregs); + ds = segregs.ds; + movedata(ds, (int)temp_line, pdc_video_seg, + pdc_video_ofs + (lineno * curscr->_maxx + x) * 2, len * 2); +# else + memcpy((void *)_FAR_POINTER(pdc_video_seg, + pdc_video_ofs + (lineno * curscr->_maxx + x) * 2), + temp_line, len * 2); +# endif +#endif + + } + else + for (j = 0; j < len;) + { + PDCREGS regs; + unsigned short count = 1; + chtype ch = srcp[j]; + + while ((j + count < len) && (ch == srcp[j + count])) + count++; + + PDC_gotoyx(lineno, j + x); + + regs.h.ah = 0x09; + regs.W.bx = mapped_attr; + regs.W.cx = count; + + if (ch & A_ALTCHARSET && !(ch & 0xff80)) + ch = acs_map[ch & 0x7f]; + + regs.h.al = (unsigned char) (ch & 0xff); + + PDCINT(0x10, regs); + + j += count; + } +} + +/* update the given physical line to look like the corresponding line in + curscr */ + +void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) +{ + attr_t old_attr, attr; + int i, j; + + PDC_LOG(("PDC_transform_line() - called: lineno=%d\n", lineno)); + + old_attr = *srcp & (A_ATTRIBUTES ^ A_ALTCHARSET); + + for (i = 1, j = 1; j < len; i++, j++) + { + attr = srcp[i] & (A_ATTRIBUTES ^ A_ALTCHARSET); + + if (attr != old_attr) + { + _new_packet(old_attr, lineno, x, i, srcp); + old_attr = attr; + srcp += i; + x += i; + i = 0; + } + } + + _new_packet(old_attr, lineno, x, i, srcp); +} + +void PDC_doupdate(void) +{ +} diff --git a/vendor/pdcurses/dos/pdcdos.h b/vendor/pdcurses/dos/pdcdos.h new file mode 100644 index 0000000..e935d81 --- /dev/null +++ b/vendor/pdcurses/dos/pdcdos.h @@ -0,0 +1,168 @@ +/* PDCurses */ + +#include +#include + +/*---------------------------------------------------------------------- + * MEMORY MODEL SUPPORT: + * + * MODELS + * TINY cs,ds,ss all in 1 segment (not enough memory!) + * SMALL cs:1 segment, ds:1 segment + * MEDIUM cs:many segments, ds:1 segment + * COMPACT cs:1 segment, ds:many segments + * LARGE cs:many segments, ds:many segments + * HUGE cs:many segments, ds:segments > 64K + */ + +#ifdef __TINY__ +# define SMALL 1 +#endif +#ifdef __SMALL__ +# define SMALL 1 +#endif +#ifdef __MEDIUM__ +# define MEDIUM 1 +#endif +#ifdef __COMPACT__ +# define COMPACT 1 +#endif +#ifdef __LARGE__ +# define LARGE 1 +#endif +#ifdef __HUGE__ +# define HUGE 1 +#endif + +#include + +extern short pdc_curstoreal[16]; +extern int pdc_adapter; +extern int pdc_scrnmode; +extern int pdc_font; +extern bool pdc_direct_video; +extern bool pdc_bogus_adapter; +extern unsigned pdc_video_seg; +extern unsigned pdc_video_ofs; + +#ifdef __DJGPP__ /* Note: works only in plain DOS... */ +# if DJGPP == 2 +# define _FAR_POINTER(s,o) ((((int)(s)) << 4) + ((int)(o))) +# else +# define _FAR_POINTER(s,o) (0xe0000000 + (((int)(s)) << 4) + ((int)(o))) +# endif +# define _FP_SEGMENT(p) (unsigned short)((((long)p) >> 4) & 0xffff) +#else +# ifdef __TURBOC__ +# define _FAR_POINTER(s,o) MK_FP(s,o) +# else +# if defined(__WATCOMC__) && defined(__FLAT__) +# define _FAR_POINTER(s,o) ((((int)(s)) << 4) + ((int)(o))) +# else +# define _FAR_POINTER(s,o) (((long)s << 16) | (long)o) +# endif +# endif +# define _FP_SEGMENT(p) (unsigned short)(((long)p) >> 4) +#endif +#define _FP_OFFSET(p) ((unsigned short)p & 0x000f) + +#ifdef __DJGPP__ +# include +unsigned char getdosmembyte(int offs); +unsigned short getdosmemword(int offs); +unsigned long getdosmemdword(int offs); +void setdosmembyte(int offs, unsigned char b); +void setdosmemword(int offs, unsigned short w); +#else +# if SMALL || MEDIUM +# define PDC_FAR far +# else +# define PDC_FAR +# endif +# define getdosmembyte(offs) \ + (*((unsigned char PDC_FAR *) _FAR_POINTER(0,offs))) +# define getdosmemword(offs) \ + (*((unsigned short PDC_FAR *) _FAR_POINTER(0,offs))) +# define getdosmemdword(offs) \ + (*((unsigned long PDC_FAR *) _FAR_POINTER(0,offs))) +# define setdosmembyte(offs,x) \ + (*((unsigned char PDC_FAR *) _FAR_POINTER(0,offs)) = (x)) +# define setdosmemword(offs,x) \ + (*((unsigned short PDC_FAR *) _FAR_POINTER(0,offs)) = (x)) +#endif + +#if defined(__WATCOMC__) && defined(__386__) + +typedef union +{ + struct + { + unsigned long edi, esi, ebp, res, ebx, edx, ecx, eax; + } d; + + struct + { + unsigned short di, di_hi, si, si_hi, bp, bp_hi, res, res_hi, + bx, bx_hi, dx, dx_hi, cx, cx_hi, ax, ax_hi, + flags, es, ds, fs, gs, ip, cs, sp, ss; + } w; + + struct + { + unsigned char edi[4], esi[4], ebp[4], res[4], + bl, bh, ebx_b2, ebx_b3, dl, dh, edx_b2, edx_b3, + cl, ch, ecx_b2, ecx_b3, al, ah, eax_b2, eax_b3; + } h; +} pdc_dpmi_regs; + +void PDC_dpmi_int(int, pdc_dpmi_regs *); + +#endif + +#ifdef __DJGPP__ +# include +# define PDCREGS __dpmi_regs +# define PDCINT(vector, regs) __dpmi_int(vector, ®s) +#else +# ifdef __WATCOMC__ +# ifdef __386__ +# define PDCREGS pdc_dpmi_regs +# define PDCINT(vector, regs) PDC_dpmi_int(vector, ®s) +# else +# define PDCREGS union REGPACK +# define PDCINT(vector, regs) intr(vector, ®s) +# endif +# else +# define PDCREGS union REGS +# define PDCINT(vector, regs) int86(vector, ®s, ®s) +# endif +#endif + +/* Wide registers in REGS: w or x? */ + +#ifdef __WATCOMC__ +# define W w +#else +# define W x +#endif + +/* Monitor (terminal) type information */ + +enum +{ + _NONE, _MDA, _CGA, + _EGACOLOR = 0x04, _EGAMONO, + _VGACOLOR = 0x07, _VGAMONO, + _MCGACOLOR = 0x0a, _MCGAMONO, + _MDS_GENIUS = 0x30 +}; + +/* Text-mode font size information */ + +enum +{ + _FONT8 = 8, + _FONT14 = 14, + _FONT15, /* GENIUS */ + _FONT16 +}; diff --git a/vendor/pdcurses/dos/pdcgetsc.c b/vendor/pdcurses/dos/pdcgetsc.c new file mode 100644 index 0000000..cef9bd0 --- /dev/null +++ b/vendor/pdcurses/dos/pdcgetsc.c @@ -0,0 +1,81 @@ +/* PDCurses */ + +#include "pdcdos.h" + +#include + +/* return width of screen/viewport */ + +int PDC_get_columns(void) +{ + PDCREGS regs; + int cols; + + PDC_LOG(("PDC_get_columns() - called\n")); + + regs.h.ah = 0x0f; + PDCINT(0x10, regs); + cols = (int)regs.h.ah; + + PDC_LOG(("PDC_get_columns() - returned: cols %d\n", cols)); + + return cols; +} + +/* get the cursor size/shape */ + +int PDC_get_cursor_mode(void) +{ + PDC_LOG(("PDC_get_cursor_mode() - called\n")); + + return getdosmemword(0x460); +} + +/* return number of screen rows */ + +int PDC_get_rows(void) +{ + int rows; + + PDC_LOG(("PDC_get_rows() - called\n")); + + rows = getdosmembyte(0x484) + 1; + + if (rows == 1 && pdc_adapter == _MDS_GENIUS) + rows = 66; + if (rows == 1 && pdc_adapter == _MDA) + rows = 25; + + if (rows == 1) + { + rows = 25; + pdc_direct_video = FALSE; + } + + switch (pdc_adapter) + { + case _EGACOLOR: + case _EGAMONO: + switch (rows) + { + case 25: + case 43: + break; + default: + rows = 25; + } + break; + + case _VGACOLOR: + case _VGAMONO: + break; + + default: + rows = 25; + break; + } + + PDC_LOG(("PDC_get_rows() - returned: rows %d\n", rows)); + + return rows; +} diff --git a/vendor/pdcurses/dos/pdckbd.c b/vendor/pdcurses/dos/pdckbd.c new file mode 100644 index 0000000..beb58b0 --- /dev/null +++ b/vendor/pdcurses/dos/pdckbd.c @@ -0,0 +1,472 @@ +/* PDCurses */ + +#include "pdcdos.h" + +#ifdef __DJGPP__ +# include +# include +# include +#endif + +/************************************************************************ + * Table for key code translation of function keys in keypad mode * + * These values are for strict IBM keyboard compatibles only * + ************************************************************************/ + +static short key_table[] = +{ + -1, ALT_ESC, -1, 0, + -1, -1, -1, -1, + -1, -1, -1, -1, + -1, -1, ALT_BKSP, KEY_BTAB, + ALT_Q, ALT_W, ALT_E, ALT_R, + ALT_T, ALT_Y, ALT_U, ALT_I, + ALT_O, ALT_P, ALT_LBRACKET, ALT_RBRACKET, + ALT_ENTER, -1, ALT_A, ALT_S, + ALT_D, ALT_F, ALT_G, ALT_H, + ALT_J, ALT_K, ALT_L, ALT_SEMICOLON, + ALT_FQUOTE, ALT_BQUOTE, -1, ALT_BSLASH, + ALT_Z, ALT_X, ALT_C, ALT_V, + ALT_B, ALT_N, ALT_M, ALT_COMMA, + ALT_STOP, ALT_FSLASH, -1, ALT_PADSTAR, + -1, -1, -1, KEY_F(1), + KEY_F(2), KEY_F(3), KEY_F(4), KEY_F(5), + KEY_F(6), KEY_F(7), KEY_F(8), KEY_F(9), + KEY_F(10), -1, -1, KEY_HOME, + KEY_UP, KEY_PPAGE, ALT_PADMINUS, KEY_LEFT, + KEY_B2, KEY_RIGHT, ALT_PADPLUS, KEY_END, + KEY_DOWN, KEY_NPAGE, KEY_IC, KEY_DC, + KEY_F(13), KEY_F(14), KEY_F(15), KEY_F(16), + KEY_F(17), KEY_F(18), KEY_F(19), KEY_F(20), + KEY_F(21), KEY_F(22), KEY_F(25), KEY_F(26), + KEY_F(27), KEY_F(28), KEY_F(29), KEY_F(30), + KEY_F(31), KEY_F(32), KEY_F(33), KEY_F(34), + KEY_F(37), KEY_F(38), KEY_F(39), KEY_F(40), + KEY_F(41), KEY_F(42), KEY_F(43), KEY_F(44), + KEY_F(45), KEY_F(46), -1, CTL_LEFT, + CTL_RIGHT, CTL_END, CTL_PGDN, CTL_HOME, + ALT_1, ALT_2, ALT_3, ALT_4, + ALT_5, ALT_6, ALT_7, ALT_8, + ALT_9, ALT_0, ALT_MINUS, ALT_EQUAL, + CTL_PGUP, KEY_F(11), KEY_F(12), KEY_F(23), + KEY_F(24), KEY_F(35), KEY_F(36), KEY_F(47), + KEY_F(48), CTL_UP, CTL_PADMINUS, CTL_PADCENTER, + CTL_PADPLUS, CTL_DOWN, CTL_INS, CTL_DEL, + CTL_TAB, CTL_PADSLASH, CTL_PADSTAR, ALT_HOME, + ALT_UP, ALT_PGUP, -1, ALT_LEFT, + -1, ALT_RIGHT, -1, ALT_END, + ALT_DOWN, ALT_PGDN, ALT_INS, ALT_DEL, + ALT_PADSLASH, ALT_TAB, ALT_PADENTER, -1 +}; + +static struct {unsigned short pressed, released;} button[3]; + +static bool mouse_avail = FALSE, mouse_vis = FALSE, mouse_moved = FALSE, + mouse_button = FALSE, key_pressed = FALSE; + +static unsigned char mouse_scroll = 0; +static PDCREGS ms_regs, old_ms; +static unsigned short shift_status, old_shift = 0; +static unsigned char keyboard_function = 0xff, shift_function = 0xff, + check_function = 0xff; + +static const unsigned short button_map[3] = {0, 2, 1}; + +void PDC_set_keyboard_binary(bool on) +{ + PDC_LOG(("PDC_set_keyboard_binary() - called\n")); + +#ifdef __DJGPP__ + setmode(fileno(stdin), on ? O_BINARY : O_TEXT); + signal(SIGINT, on ? SIG_IGN : SIG_DFL); +#endif +} + +/* check if a key or mouse event is waiting */ + +bool PDC_check_key(void) +{ + PDCREGS regs; + + if (shift_function == 0xff) + { + int scan; + + /* get shift status for all keyboards */ + + regs.h.ah = 0x02; + PDCINT(0x16, regs); + scan = regs.h.al; + + /* get shift status for enhanced keyboards */ + + regs.h.ah = 0x12; + PDCINT(0x16, regs); + + if (scan == regs.h.al && getdosmembyte(0x496) == 0x10) + { + keyboard_function = 0x10; + check_function = 0x11; + shift_function = 0x12; + } + else + { + keyboard_function = 0; + check_function = 1; + shift_function = 2; + } + } + + regs.h.ah = shift_function; + PDCINT(0x16, regs); + + shift_status = regs.W.ax; + + if (mouse_vis) + { + unsigned short i; + + ms_regs.W.ax = 3; + PDCINT(0x33, ms_regs); + + mouse_button = FALSE; + + for (i = 0; i < 3; i++) + { + regs.W.ax = 6; + regs.W.bx = button_map[i]; + PDCINT(0x33, regs); + button[i].released = regs.W.bx; + if (regs.W.bx) + { + ms_regs.W.cx = regs.W.cx; + ms_regs.W.dx = regs.W.dx; + mouse_button = TRUE; + } + + regs.W.ax = 5; + regs.W.bx = button_map[i]; + PDCINT(0x33, regs); + button[i].pressed = regs.W.bx; + if (regs.W.bx) + { + ms_regs.W.cx = regs.W.cx; + ms_regs.W.dx = regs.W.dx; + mouse_button = TRUE; + } + } + + mouse_scroll = ms_regs.h.bh; + + mouse_moved = !mouse_button && ms_regs.h.bl && + ms_regs.h.bl == old_ms.h.bl && + (((ms_regs.W.cx ^ old_ms.W.cx) >> 3) || + ((ms_regs.W.dx ^ old_ms.W.dx) >> 3)); + + if (mouse_scroll || mouse_button || mouse_moved) + return TRUE; + } + + if (old_shift && !shift_status) /* modifier released */ + { + if (!key_pressed && SP->return_key_modifiers) + return TRUE; + } + else if (!old_shift && shift_status) /* modifier pressed */ + key_pressed = FALSE; + + old_shift = shift_status; + + regs.h.ah = check_function; + PDCINT(0x16, regs); + + return !(regs.W.flags & 64); +} + +static int _process_mouse_events(void) +{ + int i; + short shift_flags = 0; + + memset(&SP->mouse_status, 0, sizeof(SP->mouse_status)); + + key_pressed = TRUE; + old_shift = shift_status; + SP->key_code = TRUE; + + /* Set shift modifiers */ + + if (shift_status & 3) + shift_flags |= BUTTON_SHIFT; + + if (shift_status & 4) + shift_flags |= BUTTON_CONTROL; + + if (shift_status & 8) + shift_flags |= BUTTON_ALT; + + /* Scroll wheel support for CuteMouse */ + + if (mouse_scroll) + { + SP->mouse_status.changes = mouse_scroll & 0x80 ? + PDC_MOUSE_WHEEL_UP : PDC_MOUSE_WHEEL_DOWN; + } + else if (mouse_moved) + { + SP->mouse_status.changes = PDC_MOUSE_MOVED; + + for (i = 0; i < 3; i++) + { + if (ms_regs.h.bl & (1 << button_map[i])) + { + SP->mouse_status.button[i] = BUTTON_MOVED | shift_flags; + SP->mouse_status.changes |= (1 << i); + } + } + } + else /* button event */ + { + for (i = 0; i < 3; i++) + { + if (button[i].pressed) + { + /* Check for a click -- a PRESS followed + immediately by a release */ + + if (!button[i].released) + { + if (SP->mouse_wait) + { + PDCREGS regs; + + napms(SP->mouse_wait); + + regs.W.ax = 6; + regs.W.bx = button_map[i]; + PDCINT(0x33, regs); + + SP->mouse_status.button[i] = regs.W.bx ? + BUTTON_CLICKED : BUTTON_PRESSED; + } + else + SP->mouse_status.button[i] = BUTTON_PRESSED; + } + else + SP->mouse_status.button[i] = BUTTON_CLICKED; + } + + if (button[i].pressed || button[i].released) + { + SP->mouse_status.button[i] |= shift_flags; + SP->mouse_status.changes |= (1 << i); + } + } + } + + SP->mouse_status.x = ms_regs.W.cx >> 3; + SP->mouse_status.y = ms_regs.W.dx >> 3; + + old_ms = ms_regs; + + return KEY_MOUSE; +} + +/* return the next available key or mouse event */ + +int PDC_get_key(void) +{ + PDCREGS regs; + int key, scan; + + SP->key_modifiers = 0; + + if (mouse_vis && (mouse_scroll || mouse_button || mouse_moved)) + return _process_mouse_events(); + + /* Return modifiers as keys? */ + + if (old_shift && !shift_status) + { + key = -1; + + if (old_shift & 1) + key = KEY_SHIFT_R; + + if (old_shift & 2) + key = KEY_SHIFT_L; + + if (shift_function == 0x12) + { + if (old_shift & 0x400) + key = KEY_CONTROL_R; + + if (old_shift & 0x100) + key = KEY_CONTROL_L; + + if (old_shift & 0x800) + key = KEY_ALT_R; + + if (old_shift & 0x200) + key = KEY_ALT_L; + } + else + { + if (old_shift & 4) + key = KEY_CONTROL_R; + + if (old_shift & 8) + key = KEY_ALT_R; + } + + key_pressed = FALSE; + old_shift = shift_status; + + SP->key_code = TRUE; + return key; + } + + regs.h.ah = keyboard_function; + PDCINT(0x16, regs); + key = regs.h.al; + scan = regs.h.ah; + + if (shift_status & 3) + SP->key_modifiers |= PDC_KEY_MODIFIER_SHIFT; + + if (shift_status & 4) + SP->key_modifiers |= PDC_KEY_MODIFIER_CONTROL; + + if (shift_status & 8) + SP->key_modifiers |= PDC_KEY_MODIFIER_ALT; + + if (shift_status & 0x20) + SP->key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; + + if (scan == 0x1c && key == 0x0a) /* ^Enter */ + key = CTL_ENTER; + else if (scan == 0xe0 && key == 0x0d) /* PadEnter */ + key = PADENTER; + else if (scan == 0xe0 && key == 0x0a) /* ^PadEnter */ + key = CTL_PADENTER; + else if (scan == 0x37 && key == 0x2a) /* Star */ + key = PADSTAR; + else if (scan == 0x4a && key == 0x2d) /* Minus */ + key = PADMINUS; + else if (scan == 0x4e && key == 0x2b) /* Plus */ + key = PADPLUS; + else if (scan == 0xe0 && key == 0x2f) /* Slash */ + key = PADSLASH; + else if (key == 0x00 || (key == 0xe0 && scan > 53 && scan != 86)) + key = (scan > 0xa7) ? -1 : key_table[scan]; + + if (shift_status & 3) + { + switch (key) + { + case KEY_HOME: /* Shift Home */ + key = KEY_SHOME; + break; + case KEY_UP: /* Shift Up */ + key = KEY_SUP; + break; + case KEY_PPAGE: /* Shift PgUp */ + key = KEY_SPREVIOUS; + break; + case KEY_LEFT: /* Shift Left */ + key = KEY_SLEFT; + break; + case KEY_RIGHT: /* Shift Right */ + key = KEY_SRIGHT; + break; + case KEY_END: /* Shift End */ + key = KEY_SEND; + break; + case KEY_DOWN: /* Shift Down */ + key = KEY_SDOWN; + break; + case KEY_NPAGE: /* Shift PgDn */ + key = KEY_SNEXT; + break; + case KEY_IC: /* Shift Ins */ + key = KEY_SIC; + break; + case KEY_DC: /* Shift Del */ + key = KEY_SDC; + } + } + + key_pressed = TRUE; + SP->key_code = ((unsigned)key >= 256); + + return key; +} + +/* discard any pending keyboard or mouse input -- this is the core + routine for flushinp() */ + +void PDC_flushinp(void) +{ + PDC_LOG(("PDC_flushinp() - called\n")); + + /* Force the BIOS keyboard buffer head and tail pointers to be + the same... Real nasty trick... */ + + setdosmemword(0x41a, getdosmemword(0x41c)); +} + +bool PDC_has_mouse(void) +{ + PDCREGS regs; + + if (!mouse_avail) + { + regs.W.ax = 0; + PDCINT(0x33, regs); + + mouse_avail = !!(regs.W.ax); + } + + return mouse_avail; +} + +int PDC_mouse_set(void) +{ + PDCREGS regs; + unsigned long mbe = SP->_trap_mbe; + + if (mbe && !mouse_avail) + mouse_avail = PDC_has_mouse(); + + if (mbe) + { + if (mouse_avail && !mouse_vis) + { + memset(&old_ms, 0, sizeof(old_ms)); + + regs.W.ax = 1; + PDCINT(0x33, regs); + + mouse_vis = TRUE; + } + } + else + { + if (mouse_avail && mouse_vis) + { + regs.W.ax = 2; + PDCINT(0x33, regs); + + mouse_vis = FALSE; + } + } + + return (mouse_avail || !mbe) ? OK : ERR; +} + +int PDC_modifiers_set(void) +{ + key_pressed = FALSE; + + return OK; +} diff --git a/vendor/pdcurses/dos/pdcscrn.c b/vendor/pdcurses/dos/pdcscrn.c new file mode 100644 index 0000000..cc1988a --- /dev/null +++ b/vendor/pdcurses/dos/pdcscrn.c @@ -0,0 +1,684 @@ +/* PDCurses */ + +#include "pdcdos.h" + +#include + +int pdc_adapter; /* screen type */ +int pdc_scrnmode; /* default screen mode */ +int pdc_font; /* default font size */ +bool pdc_direct_video; /* allow direct screen memory writes */ +bool pdc_bogus_adapter; /* TRUE if adapter has insane values */ +unsigned pdc_video_seg; /* video base segment */ +unsigned pdc_video_ofs; /* video base offset */ + +static short realtocurs[16] = +{ + COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN, COLOR_RED, + COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE, COLOR_BLACK + 8, + COLOR_BLUE + 8, COLOR_GREEN + 8, COLOR_CYAN + 8, COLOR_RED + 8, + COLOR_MAGENTA + 8, COLOR_YELLOW + 8, COLOR_WHITE + 8 +}; + +short pdc_curstoreal[16]; + +static bool sizeable = FALSE; /* TRUE if adapter is resizeable */ + +static unsigned short *saved_screen = NULL; +static int saved_lines = 0; +static int saved_cols = 0; + +static int saved_scrnmode[3]; +static int saved_font[3]; + +/* Thanks to Jeff Duntemann, K16RA for providing the impetus + (through the Dr. Dobbs Journal, March 1989 issue) for getting + the routines below merged into Bjorn Larsson's PDCurses 1.3... + -- frotz@dri.com 900730 */ + +/* _get_font() - Get the current font size */ + +static int _get_font(void) +{ + int retval; + + retval = getdosmemword(0x485); + + /* Assume the MDS Genius is in 66 line mode. */ + + if ((retval == 0) && (pdc_adapter == _MDS_GENIUS)) + retval = _FONT15; + + switch (pdc_adapter) + { + case _MDA: + retval = 10; /* POINTS is not certain on MDA/Hercules */ + break; + + case _EGACOLOR: + case _EGAMONO: + switch (retval) + { + case _FONT8: + case _FONT14: + break; + default: + retval = _FONT14; + } + break; + + case _CGA: + retval = _FONT8; + } + + return retval; +} + +/* _set_font() - Sets the current font size, if the adapter allows such a + change. It is an error to attempt to change the font size on a + "bogus" adapter. The reason for this is that we have a known video + adapter identity problem. e.g. Two adapters report the same identifying + characteristics. */ + +static void _set_font(int size) +{ + PDCREGS regs; + + if (pdc_bogus_adapter) + return; + + switch (pdc_adapter) + { + case _CGA: + case _MDA: + case _MCGACOLOR: + case _MCGAMONO: + case _MDS_GENIUS: + break; + + case _EGACOLOR: + case _EGAMONO: + if (sizeable && (pdc_font != size)) + { + switch (size) + { + case _FONT8: + regs.W.ax = 0x1112; + regs.h.bl = 0x00; + PDCINT(0x10, regs); + break; + case _FONT14: + regs.W.ax = 0x1111; + regs.h.bl = 0x00; + PDCINT(0x10, regs); + } + } + break; + + case _VGACOLOR: + case _VGAMONO: + if (sizeable && (pdc_font != size)) + { + switch (size) + { + case _FONT8: + regs.W.ax = 0x1112; + regs.h.bl = 0x00; + PDCINT(0x10, regs); + break; + case _FONT14: + regs.W.ax = 0x1111; + regs.h.bl = 0x00; + PDCINT(0x10, regs); + break; + case _FONT16: + regs.W.ax = 0x1114; + regs.h.bl = 0x00; + PDCINT(0x10, regs); + } + } + } + + curs_set(SP->visibility); + + pdc_font = _get_font(); +} + +/* _set_80x25() - force a known screen state: 80x25 text mode. Forces the + appropriate 80x25 alpha mode given the display adapter. */ + +static void _set_80x25(void) +{ + PDCREGS regs; + + switch (pdc_adapter) + { + case _CGA: + case _EGACOLOR: + case _EGAMONO: + case _VGACOLOR: + case _VGAMONO: + case _MCGACOLOR: + case _MCGAMONO: + regs.h.ah = 0x00; + regs.h.al = 0x03; + PDCINT(0x10, regs); + break; + case _MDA: + regs.h.ah = 0x00; + regs.h.al = 0x07; + PDCINT(0x10, regs); + } +} + +/* _get_scrn_mode() - Return the current BIOS video mode */ + +static int _get_scrn_mode(void) +{ + PDCREGS regs; + + regs.h.ah = 0x0f; + PDCINT(0x10, regs); + + return (int)regs.h.al; +} + +/* _set_scrn_mode() - Sets the BIOS Video Mode Number only if it is + different from the current video mode. */ + +static void _set_scrn_mode(int new_mode) +{ + PDCREGS regs; + + if (_get_scrn_mode() != new_mode) + { + regs.h.ah = 0; + regs.h.al = (unsigned char) new_mode; + PDCINT(0x10, regs); + } + + pdc_font = _get_font(); + pdc_scrnmode = new_mode; + LINES = PDC_get_rows(); + COLS = PDC_get_columns(); +} + +/* _sanity_check() - A video adapter identification sanity check. This + routine will force sane values for various control flags. */ + +static int _sanity_check(int adapter) +{ + int fontsize = _get_font(); + int rows = PDC_get_rows(); + + PDC_LOG(("_sanity_check() - called: Adapter %d\n", adapter)); + + switch (adapter) + { + case _EGACOLOR: + case _EGAMONO: + switch (rows) + { + case 25: + case 43: + break; + default: + pdc_bogus_adapter = TRUE; + } + + switch (fontsize) + { + case _FONT8: + case _FONT14: + break; + default: + pdc_bogus_adapter = TRUE; + } + break; + + case _VGACOLOR: + case _VGAMONO: + break; + + case _CGA: + case _MDA: + case _MCGACOLOR: + case _MCGAMONO: + switch (rows) + { + case 25: + break; + default: + pdc_bogus_adapter = TRUE; + } + break; + + default: + pdc_bogus_adapter = TRUE; + } + + if (pdc_bogus_adapter) + { + sizeable = FALSE; + pdc_direct_video = FALSE; + } + + return adapter; +} + +/* _query_adapter_type() - Determine PC video adapter type. */ + +static int _query_adapter_type(void) +{ + PDCREGS regs; + int retval = _NONE; + + /* thanks to paganini@ax.apc.org for the GO32 fix */ + +#if !defined(__DJGPP__) && !defined(__WATCOMC__) + struct SREGS segs; +#endif + short video_base = getdosmemword(0x463); + + PDC_LOG(("_query_adapter_type() - called\n")); + + /* attempt to call VGA Identify Adapter Function */ + + regs.W.ax = 0x1a00; + PDCINT(0x10, regs); + + if ((regs.h.al == 0x1a) && (retval == _NONE)) + { + /* We know that the PS/2 video BIOS is alive and well. */ + + switch (regs.h.al) + { + case 0: + retval = _NONE; + break; + case 1: + retval = _MDA; + break; + case 2: + retval = _CGA; + break; + case 4: + retval = _EGACOLOR; + sizeable = TRUE; + break; + case 5: + retval = _EGAMONO; + break; + case 26: /* ...alt. VGA BIOS... */ + case 7: + retval = _VGACOLOR; + sizeable = TRUE; + break; + case 8: + retval = _VGAMONO; + break; + case 10: + case 13: + retval = _MCGACOLOR; + break; + case 12: + retval = _MCGAMONO; + break; + default: + retval = _CGA; + } + } + else + { + /* No VGA BIOS, check for an EGA BIOS by selecting an + Alternate Function Service... + + bx == 0x0010 --> return EGA information */ + + regs.h.ah = 0x12; + regs.W.bx = 0x10; + PDCINT(0x10, regs); + + if ((regs.h.bl != 0x10) && (retval == _NONE)) + { + /* An EGA BIOS exists */ + + regs.h.ah = 0x12; + regs.h.bl = 0x10; + PDCINT(0x10, regs); + + if (regs.h.bh == 0) + retval = _EGACOLOR; + else + retval = _EGAMONO; + } + else if (retval == _NONE) + { + /* Now we know we only have CGA or MDA */ + + PDCINT(0x11, regs); + + switch (regs.h.al & 0x30) + { + case 0x10: + case 0x20: + retval = _CGA; + break; + case 0x30: + retval = _MDA; + break; + default: + retval = _NONE; + } + } + } + + if (video_base == 0x3d4) + { + pdc_video_seg = 0xb800; + switch (retval) + { + case _EGAMONO: + retval = _EGACOLOR; + break; + case _VGAMONO: + retval = _VGACOLOR; + } + } + + if (video_base == 0x3b4) + { + pdc_video_seg = 0xb000; + switch (retval) + { + case _EGACOLOR: + retval = _EGAMONO; + break; + case _VGACOLOR: + retval = _VGAMONO; + } + } + + if ((retval == _NONE) +#ifndef CGA_DIRECT + || (retval == _CGA) +#endif + ) + pdc_direct_video = FALSE; + + if ((unsigned)pdc_video_seg == 0xb000) + SP->mono = TRUE; + else + SP->mono = FALSE; + + /* Check for DESQview shadow buffer + thanks to paganini@ax.apc.org for the GO32 fix */ + +#ifndef __WATCOMC__ + regs.h.ah = 0xfe; + regs.h.al = 0; + regs.x.di = pdc_video_ofs; +# ifdef __DJGPP__ + regs.x.es = pdc_video_seg; + __dpmi_int(0x10, ®s); + pdc_video_seg = regs.x.es; +# else + segs.es = pdc_video_seg; + int86x(0x10, ®s, ®s, &segs); + pdc_video_seg = segs.es; +# endif + pdc_video_ofs = regs.x.di; +#endif + if (!pdc_adapter) + pdc_adapter = retval; + + return _sanity_check(retval); +} + +/* close the physical screen -- may restore the screen to its state + before PDC_scr_open(); miscellaneous cleanup */ + +void PDC_scr_close(void) +{ +#if SMALL || MEDIUM + struct SREGS segregs; + int ds; +#endif + PDC_LOG(("PDC_scr_close() - called\n")); + + if (getenv("PDC_RESTORE_SCREEN") && saved_screen) + { +#ifdef __DJGPP__ + dosmemput(saved_screen, saved_lines * saved_cols * 2, + (unsigned long)_FAR_POINTER(pdc_video_seg, + pdc_video_ofs)); +#else +# if (SMALL || MEDIUM) + segread(&segregs); + ds = segregs.ds; + movedata(ds, (int)saved_screen, pdc_video_seg, pdc_video_ofs, + (saved_lines * saved_cols * 2)); +# else + memcpy((void *)_FAR_POINTER(pdc_video_seg, pdc_video_ofs), + (void *)saved_screen, (saved_lines * saved_cols * 2)); +# endif +#endif + free(saved_screen); + saved_screen = NULL; + } + + reset_shell_mode(); + + if (SP->visibility != 1) + curs_set(1); + + /* Position cursor to the bottom left of the screen. */ + + PDC_gotoyx(PDC_get_rows() - 2, 0); +} + +void PDC_scr_free(void) +{ +} + +/* open the physical screen -- miscellaneous initialization, may save + the existing screen for later restoration */ + +int PDC_scr_open(void) +{ +#if SMALL || MEDIUM + struct SREGS segregs; + int ds; +#endif + int i; + + PDC_LOG(("PDC_scr_open() - called\n")); + + for (i = 0; i < 16; i++) + pdc_curstoreal[realtocurs[i]] = i; + + SP->orig_attr = FALSE; + + pdc_direct_video = TRUE; /* Assume that we can */ + pdc_video_seg = 0xb000; /* Base screen segment addr */ + pdc_video_ofs = 0x0; /* Base screen segment ofs */ + + pdc_adapter = _query_adapter_type(); + pdc_scrnmode = _get_scrn_mode(); + pdc_font = _get_font(); + + SP->mouse_wait = PDC_CLICK_PERIOD; + SP->audible = TRUE; + + SP->termattrs = (SP->mono ? A_UNDERLINE : A_COLOR) | A_REVERSE | A_BLINK; + + /* If the environment variable PDCURSES_BIOS is set, the DOS int10() + BIOS calls are used in place of direct video memory access. */ + + if (getenv("PDCURSES_BIOS")) + pdc_direct_video = FALSE; + + /* This code for preserving the current screen. */ + + if (getenv("PDC_RESTORE_SCREEN")) + { + saved_lines = PDC_get_rows(); + saved_cols = PDC_get_columns(); + + saved_screen = malloc(saved_lines * saved_cols * 2); + + if (!saved_screen) + { + SP->_preserve = FALSE; + return OK; + } +#ifdef __DJGPP__ + dosmemget((unsigned long)_FAR_POINTER(pdc_video_seg, pdc_video_ofs), + saved_lines * saved_cols * 2, saved_screen); +#else +# if SMALL || MEDIUM + segread(&segregs); + ds = segregs.ds; + movedata(pdc_video_seg, pdc_video_ofs, ds, (int)saved_screen, + (saved_lines * saved_cols * 2)); +# else + memcpy((void *)saved_screen, + (void *)_FAR_POINTER(pdc_video_seg, pdc_video_ofs), + (saved_lines * saved_cols * 2)); +# endif +#endif + } + + SP->_preserve = (getenv("PDC_PRESERVE_SCREEN") != NULL); + + return OK; +} + +/* the core of resize_term() */ + +int PDC_resize_screen(int nlines, int ncols) +{ + PDC_LOG(("PDC_resize_screen() - called. Lines: %d Cols: %d\n", + nlines, ncols)); + + /* Trash the stored value of orig_cursor -- it's only good if the + video mode doesn't change */ + + SP->orig_cursor = 0x0607; + + switch (pdc_adapter) + { + case _EGACOLOR: + if (nlines >= 43) + _set_font(_FONT8); + else + _set_80x25(); + break; + + case _VGACOLOR: + if (nlines > 28) + _set_font(_FONT8); + else + if (nlines > 25) + _set_font(_FONT14); + else + _set_80x25(); + } + + PDC_set_blink(COLORS == 8); + + return OK; +} + +void PDC_reset_prog_mode(void) +{ + PDC_LOG(("PDC_reset_prog_mode() - called.\n")); +} + +void PDC_reset_shell_mode(void) +{ + PDC_LOG(("PDC_reset_shell_mode() - called.\n")); +} + +void PDC_restore_screen_mode(int i) +{ + if (i >= 0 && i <= 2) + { + pdc_font = _get_font(); + _set_font(saved_font[i]); + + if (_get_scrn_mode() != saved_scrnmode[i]) + _set_scrn_mode(saved_scrnmode[i]); + } +} + +void PDC_save_screen_mode(int i) +{ + if (i >= 0 && i <= 2) + { + saved_font[i] = pdc_font; + saved_scrnmode[i] = pdc_scrnmode; + } +} + +/* _egapal() - Find the EGA palette value (0-63) for the color (0-15). + On VGA, this is an index into the DAC. */ + +static short _egapal(short color) +{ + PDCREGS regs; + + regs.W.ax = 0x1007; + regs.h.bl = pdc_curstoreal[color]; + + PDCINT(0x10, regs); + + return regs.h.bh; +} + +bool PDC_can_change_color(void) +{ + return (pdc_adapter == _VGACOLOR); +} + +/* These are only valid when pdc_adapter == _VGACOLOR */ + +int PDC_color_content(short color, short *red, short *green, short *blue) +{ + PDCREGS regs; + + /* Read single DAC register */ + + regs.W.ax = 0x1015; + regs.h.bl = _egapal(color); + + PDCINT(0x10, regs); + + /* Scale and store */ + + *red = DIVROUND((unsigned)(regs.h.dh) * 1000, 63); + *green = DIVROUND((unsigned)(regs.h.ch) * 1000, 63); + *blue = DIVROUND((unsigned)(regs.h.cl) * 1000, 63); + + return OK; +} + +int PDC_init_color(short color, short red, short green, short blue) +{ + PDCREGS regs; + + /* Scale */ + + regs.h.dh = DIVROUND((unsigned)red * 63, 1000); + regs.h.ch = DIVROUND((unsigned)green * 63, 1000); + regs.h.cl = DIVROUND((unsigned)blue * 63, 1000); + + /* Set single DAC register */ + + regs.W.ax = 0x1010; + regs.W.bx = _egapal(color); + + PDCINT(0x10, regs); + + return OK; +} diff --git a/vendor/pdcurses/dos/pdcsetsc.c b/vendor/pdcurses/dos/pdcsetsc.c new file mode 100644 index 0000000..16922ff --- /dev/null +++ b/vendor/pdcurses/dos/pdcsetsc.c @@ -0,0 +1,122 @@ +/* PDCurses */ + +#include "pdcdos.h" + +/*man-start************************************************************** + +pdcsetsc +-------- + +### Synopsis + + int PDC_set_blink(bool blinkon); + int PDC_set_bold(bool boldon); + void PDC_set_title(const char *title); + +### Description + + PDC_set_blink() toggles whether the A_BLINK attribute sets an actual + blink mode (TRUE), or sets the background color to high intensity + (FALSE). The default is platform-dependent (FALSE in most cases). It + returns OK if it could set the state to match the given parameter, + ERR otherwise. On DOS, this function also adjusts the value of COLORS + -- 16 for FALSE, and 8 for TRUE. + + PDC_set_bold() toggles whether the A_BOLD attribute selects an actual + bold font (TRUE), or sets the foreground color to high intensity + (FALSE). It returns OK if it could set the state to match the given + parameter, ERR otherwise. + + PDC_set_title() sets the title of the window in which the curses + program is running. This function may not do anything on some + platforms. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + PDC_set_blink | - | - | - + PDC_set_bold | - | - | - + PDC_set_title | - | - | - + +**man-end****************************************************************/ + +int PDC_curs_set(int visibility) +{ + PDCREGS regs; + int ret_vis, start, end; + + PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); + + ret_vis = SP->visibility; + SP->visibility = visibility; + + switch (visibility) + { + case 0: /* invisible */ + start = 32; + end = 0; /* was 32 */ + break; + case 2: /* highly visible */ + start = 0; /* full-height block */ + end = 7; + break; + default: /* normal visibility */ + start = (SP->orig_cursor >> 8) & 0xff; + end = SP->orig_cursor & 0xff; + } + + /* if scrnmode is not set, some BIOSes hang */ + + regs.h.ah = 0x01; + regs.h.al = (unsigned char)pdc_scrnmode; + regs.h.ch = (unsigned char)start; + regs.h.cl = (unsigned char)end; + PDCINT(0x10, regs); + + return ret_vis; +} + +void PDC_set_title(const char *title) +{ + PDC_LOG(("PDC_set_title() - called: <%s>\n", title)); +} + +int PDC_set_blink(bool blinkon) +{ + PDCREGS regs; + + if (!SP) + return ERR; + + switch (pdc_adapter) + { + case _EGACOLOR: + case _EGAMONO: + case _VGACOLOR: + case _VGAMONO: + regs.W.ax = 0x1003; + regs.W.bx = blinkon; + + PDCINT(0x10, regs); + + if (SP->color_started) + COLORS = blinkon ? 8 : 16; + + break; + default: + COLORS = 8; + } + + if (blinkon && (COLORS == 8)) + SP->termattrs |= A_BLINK; + else if (!blinkon && (COLORS == 16)) + SP->termattrs &= ~A_BLINK; + + return (COLORS - (blinkon * 8) != 8) ? OK : ERR; +} + +int PDC_set_bold(bool boldon) +{ + return boldon ? ERR : OK; +} diff --git a/vendor/pdcurses/dos/pdcurses.lib b/vendor/pdcurses/dos/pdcurses.lib new file mode 100644 index 0000000000000000000000000000000000000000..91852424cb66d445d696427ad5c7f9461049e4df GIT binary patch literal 115712 zcmeEv3qVv={{Oi%!^|)sAd>HlOi9y-QKO8^7tHuTK)_3x&4h@-reH7w)$*#r*6StK zZQHg7?b7!6x$SOSt!r&=g^HlUwxa!7Q-5aGnuy!q%q2o%{-5tTcZQc%yKBFn?S_8u zoOABI=iKx9p6~g-&Z#dX_6vy(W)l1E??12wDoiXObH$3RoQidNR`FE&Iy0+yB4$-` z_KK(0EoK$1zpqVSI{%s_h1ms#*JR$2xoTBzrt2Deu4|rq`PC@}`QOXVaur^)+I?^C z>dZT{uPMsTTajOI&6*Wi?t;SX!kz#xB0B58)-BZXocmAbNm;Kc$SsP_`Qy6zT5hxd zrQEU$qjP>q)o%@cB#JS^+~oKKL;URY+4?zYY5MfUG-JFyHF-&jh1bHFo^W&eZyq(V zoD73WCq29_fK_xSOV2)nmYkcMl$QP%+?&UkSuYKG#LSF5ZOYRkF;FiB(}PaR{;wj< zqL+dm$Aey-SMN2XR)sOWGcARgo$0gZq|INNz>d{!q3J1SEK&aIIXP5mP~>jK(WxYL zt=;Q3t*vwGTeq^C#xOZYJ^&%Q{*#o>4x${aV5s`zpUL`vTv=o zXnE6M|yOW*n+Yqxbt?$3TFsdA^aPEG1kZ0$-?N994}`Xn;LGwYeBGqSJ)8E1Ps zErquu;Pi9`x|b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y*7VqNn?ea_?8*?WQ)i2O z+-KJ1_0i+1mPK>zH}J^yVx51^%p@YZacDb$$m;i0m3b03F!N5+r8mhQWO$gVX>* zvXvb8bAIE}8u3bO6;JsO^C6;bp%TE#e?39@tW1!9(%25ZyI2Pv-@sFqC-S-vXvnwA*Tr7O3HQ?uk zHr3qGchAiEn^<&=-o3|UbM_+yqc@f`EE3Gz_%7FU% z@dhJH7d{ki7CsMGb=e*Bx$fAYSWl`x9SO$S{kp!4~H zzx{2|{_}Ce1L|_}2cM6@%4GwJ7ZBk)Gk}B&_Zo1KWa}uRgsR0ZQd3m`v}F;JQm6=> z%w#dsT(XBOGX{>3QvO&BMZnt<*x~+K+IJE;`2QtiDdwbCjGdrIXZ0G-Oxx1U`_&J4jI~|<_)yqNjKQd!3 zU%2L&2M5jg*{Y^SbT95agTBVK3$C`KFwZ>LH?H_5tSc5RYum4(M|x^C$gU^t(!@Lt z(-rw)7HT~*NBC|?n4kkDs4L-wz-Fa~Q~<0ygX6m)xneo@W^B$kHEbV*?hzojL}X{o zt`LJGsZ2VNm&K(JeeHBG)ahU&hKZaqd%7&vjLz({?aYFc3d_(2yR(A*csRiR`4!H% z{(?gma@4hax^alggR3(6js;4uA&QwLZrivp$kb(PgH8S%fNl+;GD%2G>SD=nt7Od^!26O`{{5oI&c1<==M9<|X z5Yy$`N~s$;Ll{$Ku$xih3l0p+>97NQJ%4_|jQX74nhRbTIDzsXrG_<+&65eUaB=Cw zxt7+G;OE@*R9{)h|^(Lhyo#i}1z9PDIuJ!O8~ zvEEa}^iptfb$5;A (current = getdosmemdword(0x46c))) + { + if (current < start) /* in case of midnight reset */ + return; + + regs.W.ax = 0x1680; + PDCINT(0x2f, regs); + PDCINT(0x28, regs); + } +} + +const char *PDC_sysname(void) +{ + return "DOS"; +} + +#ifdef __DJGPP__ + +unsigned char getdosmembyte(int offset) +{ + unsigned char b; + + dosmemget(offset, sizeof(unsigned char), &b); + return b; +} + +unsigned short getdosmemword(int offset) +{ + unsigned short w; + + dosmemget(offset, sizeof(unsigned short), &w); + return w; +} + +unsigned long getdosmemdword(int offset) +{ + unsigned long dw; + + dosmemget(offset, sizeof(unsigned long), &dw); + return dw; +} + +void setdosmembyte(int offset, unsigned char b) +{ + dosmemput(&b, sizeof(unsigned char), offset); +} + +void setdosmemword(int offset, unsigned short w) +{ + dosmemput(&w, sizeof(unsigned short), offset); +} + +#endif + +#if defined(__WATCOMC__) && defined(__386__) + +void PDC_dpmi_int(int vector, pdc_dpmi_regs *rmregs) +{ + union REGPACK regs = {0}; + + rmregs->w.ss = 0; + rmregs->w.sp = 0; + rmregs->w.flags = 0; + + regs.w.ax = 0x300; + regs.h.bl = vector; + regs.x.edi = FP_OFF(rmregs); + regs.x.es = FP_SEG(rmregs); + + intr(0x31, ®s); +} + +#endif diff --git a/vendor/pdcurses/os2/Makefile b/vendor/pdcurses/os2/Makefile new file mode 100644 index 0000000..8b4f86f --- /dev/null +++ b/vendor/pdcurses/os2/Makefile @@ -0,0 +1,95 @@ +# GNU Makefile for PDCurses - OS/2 +# +# Usage: make [-f path\Makefile] [DEBUG=Y] [target] +# +# where target can be any of: +# [all|demos|pdcurses.a|testcurs.exe...] + +O = o +E = .exe +RM = del + +ifndef PDCURSES_SRCDIR + PDCURSES_SRCDIR = .. +endif + +include $(PDCURSES_SRCDIR)/common/libobjs.mif + +osdir = $(PDCURSES_SRCDIR)/os2 + +PDCURSES_OS2_H = $(osdir)/pdcos2.h + +CC = gcc + +CFLAGS = -c -I$(PDCURSES_SRCDIR) -Ic:/emx/include -Wall + +ifeq ($(DEBUG),Y) + CFLAGS += -g -DPDCDEBUG + LDFLAGS = -g +else + CFLAGS += -O2 + LDFLAGS = +endif + +LINK = gcc +EMXBIND = emxbind +EMXOMF = emxomf + +LIBEXE = ar +LIBFLAGS = rcv + +LIBCURSES = pdcurses.a +LIBDEPS = $(LIBOBJS) $(PDCOBJS) +PDCLIBS = $(LIBCURSES) +EXEPOST = $(EMXBIND) $* +TUIPOST = $(EMXBIND) tuidemo +CLEAN = *.a testcurs ozdemo xmas tuidemo firework ptest rain worm + +.PHONY: all libs clean demos dist + +all: libs + +libs: $(PDCLIBS) + +clean: + -$(RM) *.o + -$(RM) *.exe + -$(RM) $(CLEAN) + +demos: $(DEMOS) + +DEMOOBJS = testcurs.o ozdemo.o xmas.o tui.o tuidemo.o firework.o \ +ptest.o rain.o worm.o + +$(LIBCURSES) : $(LIBDEPS) + $(LIBEXE) $(LIBFLAGS) $@ $? + +$(LIBOBJS) $(PDCOBJS) $(DEMOOBJS) : $(PDCURSES_HEADERS) +$(PDCOBJS) : $(PDCURSES_OS2_H) +$(DEMOS) : $(LIBCURSES) +panel.o ptest.o: $(PANEL_HEADER) + +$(LIBOBJS) : %.o: $(srcdir)/%.c + $(CC) $(CFLAGS) -o$@ $< + +$(PDCOBJS) : %.o: $(osdir)/%.c + $(CC) $(CFLAGS) -o$@ $< + +firework.exe ozdemo.exe rain.exe testcurs.exe worm.exe xmas.exe \ +ptest.exe: %.exe: %.o + $(LINK) $(LDFLAGS) -o $* $< $(LIBCURSES) + $(EXEPOST) + +tuidemo.exe: tuidemo.o tui.o + $(LINK) $(LDFLAGS) -o tuidemo tuidemo.o tui.o $(LIBCURSES) + $(TUIPOST) + +firework.o ozdemo.o ptest.o rain.o testcurs.o worm.o xmas.o: %.o: \ +$(demodir)/%.c + $(CC) $(CFLAGS) -o$@ $< + +tui.o: $(demodir)\tui.c $(demodir)\tui.h + $(CC) $(CFLAGS) -I$(demodir) -o $@ $< + +tuidemo.o: $(demodir)\tuidemo.c + $(CC) $(CFLAGS) -I$(demodir) -o $@ $< diff --git a/vendor/pdcurses/os2/Makefile.bcc b/vendor/pdcurses/os2/Makefile.bcc new file mode 100644 index 0000000..fb8e6cf --- /dev/null +++ b/vendor/pdcurses/os2/Makefile.bcc @@ -0,0 +1,76 @@ +# Borland Makefile for PDCurses - OS/2 +# +# Usage: make -f [path\]Makefile.bcc [DEBUG=] [target] +# +# where target can be any of: +# [all|demos|pdcurses.lib|testcurs.exe...] + +O = obj +E = .exe +RM = del + +!ifndef PDCURSES_SRCDIR +PDCURSES_SRCDIR = .. +!endif + +!include $(PDCURSES_SRCDIR)\common\libobjs.mif + +osdir = $(PDCURSES_SRCDIR)\os2 + +CC = bcc + +!ifdef DEBUG +CFLAGS = -N -v -y -DPDCDEBUG +!else +CFLAGS = -O +!endif + +CPPFLAGS = -I$(PDCURSES_SRCDIR) + +BUILD = $(CC) -w-par -c $(CFLAGS) $(CPPFLAGS) + +LINK = tlink + +LIBEXE = tlib /C /E + +LIBCURSES = pdcurses.lib + +all: $(LIBCURSES) + +clean: + -$(RM) *.obj + -$(RM) *.lib + -$(RM) *.map + -$(RM) *.exe + +demos: $(LIBCURSES) $(DEMOS) + +$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) + -$(RM) $@ + $(LIBEXE) $@ @$(PDCURSES_SRCDIR)\common\borland.lrf + +.autodepend + +{$(srcdir)\}.c.obj: + $(BUILD) $< + +{$(osdir)\}.c.obj: + $(BUILD) $< + +{$(demodir)\}.c.obj: + $(BUILD) $< + +.c.obj: + $(BUILD) $< + +.obj.exe: + $(CC) -e$@ $** $(LIBCURSES) + +tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES) + $(CC) -e$@ $** + +tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(PDCURSES_CURSES_H) + $(BUILD) -I$(demodir) $(demodir)\tui.c + +tuidemo.obj: $(demodir)\tuidemo.c $(PDCURSES_CURSES_H) + $(BUILD) -I$(demodir) $(demodir)\tuidemo.c diff --git a/vendor/pdcurses/os2/Makefile.wcc b/vendor/pdcurses/os2/Makefile.wcc new file mode 100644 index 0000000..3dbe9a9 --- /dev/null +++ b/vendor/pdcurses/os2/Makefile.wcc @@ -0,0 +1,24 @@ +# Watcom Makefile for PDCurses - OS/2 +# +# Usage: wmake -f [path\]Makefile.wcc [DEBUG=Y] [target] +# +# where target can be any of: +# [all|demos|pdcurses.lib|testcurs.exe...] + +!ifdef %PDCURSES_SRCDIR +PDCURSES_SRCDIR = $(%PDCURSES_SRCDIR) +!else +PDCURSES_SRCDIR = .. +!endif + +osdir = $(PDCURSES_SRCDIR)/os2 + +CC = wcc386 +TARGET = os2v2 + +CFLAGS = -bt=$(TARGET) -i=c:\watcom\h\os2 + +!include $(PDCURSES_SRCDIR)/common/watcom.mif + +$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) + $(LIBEXE) $@ $(LIBOBJS) $(PDCOBJS) diff --git a/vendor/pdcurses/os2/README.md b/vendor/pdcurses/os2/README.md new file mode 100644 index 0000000..2a03e00 --- /dev/null +++ b/vendor/pdcurses/os2/README.md @@ -0,0 +1,28 @@ +PDCurses for OS/2 +================= + +This directory contains PDCurses source code files specific to OS/2. + + +Building +-------- + +- Choose the appropriate makefile for your compiler: + + Makefile - GCC/EMX + Makefile.bcc - Borland C++ + Makefile.wcc - Watcom + +- Optionally, you can build in a different directory than the platform + directory by setting PDCURSES_SRCDIR to point to the directory where + you unpacked PDCurses, and changing to your target directory: + + set PDCURSES_SRCDIR=c:\pdcurses + +- Build it: + + make -f makefilename + + (For Watcom, use "wmake" instead of "make".) You'll get the library + (pdcurses.lib or .a, depending on your compiler) and a lot of object + files. Add the target "demos" to build the sample programs. diff --git a/vendor/pdcurses/os2/pdcclip.c b/vendor/pdcurses/os2/pdcclip.c new file mode 100644 index 0000000..f8682ec --- /dev/null +++ b/vendor/pdcurses/os2/pdcclip.c @@ -0,0 +1,173 @@ +/* PDCurses */ + +#include "pdcos2.h" + +/*man-start************************************************************** + +clipboard +--------- + +### Synopsis + + int PDC_getclipboard(char **contents, long *length); + int PDC_setclipboard(const char *contents, long length); + int PDC_freeclipboard(char *contents); + int PDC_clearclipboard(void); + +### Description + + PDC_getclipboard() gets the textual contents of the system's + clipboard. This function returns the contents of the clipboard in the + contents argument. It is the responsibility of the caller to free the + memory returned, via PDC_freeclipboard(). The length of the clipboard + contents is returned in the length argument. + + PDC_setclipboard copies the supplied text into the system's + clipboard, emptying the clipboard prior to the copy. + + PDC_clearclipboard() clears the internal clipboard. + +### Return Values + + PDC_CLIP_SUCCESS the call was successful + PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for + the clipboard contents + PDC_CLIP_EMPTY the clipboard contains no text + PDC_CLIP_ACCESS_ERROR no clipboard support + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + PDC_getclipboard | - | - | - + PDC_setclipboard | - | - | - + PDC_freeclipboard | - | - | - + PDC_clearclipboard | - | - | - + +**man-end****************************************************************/ + +int PDC_getclipboard(char **contents, long *length) +{ + HMQ hmq; + HAB hab; + PTIB ptib; + PPIB ppib; + ULONG ulRet; + long len; + int rc; + + PDC_LOG(("PDC_getclipboard() - called\n")); + + DosGetInfoBlocks(&ptib, &ppib); + ppib->pib_ultype = 3; + hab = WinInitialize(0); + hmq = WinCreateMsgQueue(hab, 0); + + if (!WinOpenClipbrd(hab)) + { + WinDestroyMsgQueue(hmq); + WinTerminate(hab); + return PDC_CLIP_ACCESS_ERROR; + } + + rc = PDC_CLIP_EMPTY; + + ulRet = WinQueryClipbrdData(hab, CF_TEXT); + + if (ulRet) + { + len = strlen((char *)ulRet); + *contents = malloc(len + 1); + + if (!*contents) + rc = PDC_CLIP_MEMORY_ERROR; + else + { + strcpy((char *)*contents, (char *)ulRet); + *length = len; + rc = PDC_CLIP_SUCCESS; + } + } + + WinCloseClipbrd(hab); + WinDestroyMsgQueue(hmq); + WinTerminate(hab); + + return rc; +} + +int PDC_setclipboard(const char *contents, long length) +{ + HAB hab; + PTIB ptib; + PPIB ppib; + ULONG ulRC; + PSZ szTextOut = NULL; + int rc; + + PDC_LOG(("PDC_setclipboard() - called\n")); + + DosGetInfoBlocks(&ptib, &ppib); + ppib->pib_ultype = 3; + hab = WinInitialize(0); + + if (!WinOpenClipbrd(hab)) + { + WinTerminate(hab); + return PDC_CLIP_ACCESS_ERROR; + } + + rc = PDC_CLIP_MEMORY_ERROR; + + ulRC = DosAllocSharedMem((PVOID)&szTextOut, NULL, length + 1, + PAG_WRITE | PAG_COMMIT | OBJ_GIVEABLE); + + if (ulRC == 0) + { + strcpy(szTextOut, contents); + WinEmptyClipbrd(hab); + + if (WinSetClipbrdData(hab, (ULONG)szTextOut, CF_TEXT, CFI_POINTER)) + rc = PDC_CLIP_SUCCESS; + else + { + DosFreeMem(szTextOut); + rc = PDC_CLIP_ACCESS_ERROR; + } + } + + WinCloseClipbrd(hab); + WinTerminate(hab); + + return rc; +} + +int PDC_freeclipboard(char *contents) +{ + PDC_LOG(("PDC_freeclipboard() - called\n")); + + if (contents) + free(contents); + + return PDC_CLIP_SUCCESS; +} + +int PDC_clearclipboard(void) +{ + HAB hab; + PTIB ptib; + PPIB ppib; + + PDC_LOG(("PDC_clearclipboard() - called\n")); + + DosGetInfoBlocks(&ptib, &ppib); + ppib->pib_ultype = 3; + hab = WinInitialize(0); + + WinEmptyClipbrd(hab); + + WinCloseClipbrd(hab); + WinTerminate(hab); + + return PDC_CLIP_SUCCESS; +} diff --git a/vendor/pdcurses/os2/pdcdisp.c b/vendor/pdcurses/os2/pdcdisp.c new file mode 100644 index 0000000..58866c7 --- /dev/null +++ b/vendor/pdcurses/os2/pdcdisp.c @@ -0,0 +1,126 @@ +/* PDCurses */ + +#include "pdcos2.h" +#include "../common/acs437.h" + +ULONG pdc_last_blink; +static bool blinked_off = FALSE; + +/* position hardware cursor at (y, x) */ + +void PDC_gotoyx(int row, int col) +{ + PDC_LOG(("PDC_gotoyx() - called: row %d col %d\n", row, col)); + + VioSetCurPos(row, col, 0); +} + +void _new_packet(attr_t attr, int lineno, int x, int len, const chtype *srcp) +{ + /* this should be enough for the maximum width of a screen. */ + + char temp_line[256]; + int j; + short fore, back; + unsigned char mapped_attr; + bool blink; + + pair_content(PAIR_NUMBER(attr), &fore, &back); + blink = (SP->termattrs & A_BLINK) && (attr & A_BLINK); + + if (blink) + attr &= ~A_BLINK; + + if (attr & A_BOLD) + fore |= 8; + if (attr & A_BLINK) + back |= 8; + + fore = pdc_curstoreal[fore]; + back = pdc_curstoreal[back]; + + if (attr & A_REVERSE) + mapped_attr = back | (fore << 4); + else + mapped_attr = fore | (back << 4); + + /* replace the attribute part of the chtype with the + actual color value for each chtype in the line */ + + for (j = 0; j < len; j++) + { + chtype ch = srcp[j]; + + if (ch & A_ALTCHARSET && !(ch & 0xff80)) + ch = acs_map[ch & 0x7f]; + + if (blink && blinked_off) + ch = ' '; + + temp_line[j] = ch & 0xff; + } + + VioWrtCharStrAtt((PCH)temp_line, (USHORT)len, (USHORT)lineno, + (USHORT)x, (PBYTE)&mapped_attr, 0); +} + +/* update the given physical line to look like the corresponding line in + curscr */ + +void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) +{ + attr_t old_attr, attr; + int i, j; + + PDC_LOG(("PDC_transform_line() - called: lineno=%d\n", lineno)); + + old_attr = *srcp & (A_ATTRIBUTES ^ A_ALTCHARSET); + + for (i = 1, j = 1; j < len; i++, j++) + { + attr = srcp[i] & (A_ATTRIBUTES ^ A_ALTCHARSET); + + if (attr != old_attr) + { + _new_packet(old_attr, lineno, x, i, srcp); + old_attr = attr; + srcp += i; + x += i; + i = 0; + } + } + + _new_packet(old_attr, lineno, x, i, srcp); +} + +void PDC_blink_text(void) +{ + int i, j, k; + + if (!(SP->termattrs & A_BLINK)) + blinked_off = FALSE; + else + blinked_off = !blinked_off; + + for (i = 0; i < SP->lines; i++) + { + const chtype *srcp = curscr->_y[i]; + + for (j = 0; j < SP->cols; j++) + if (srcp[j] & A_BLINK) + { + k = j; + while (k < SP->cols && (srcp[k] & A_BLINK)) + k++; + PDC_transform_line(i, j, k - j, srcp + j); + j = k; + } + } + + PDC_gotoyx(SP->cursrow, SP->curscol); + pdc_last_blink = PDC_ms_count(); +} + +void PDC_doupdate(void) +{ +} diff --git a/vendor/pdcurses/os2/pdcgetsc.c b/vendor/pdcurses/os2/pdcgetsc.c new file mode 100644 index 0000000..2a5e8f6 --- /dev/null +++ b/vendor/pdcurses/os2/pdcgetsc.c @@ -0,0 +1,52 @@ +/* PDCurses */ + +#include "pdcos2.h" + +/* return width of screen/viewport */ + +int PDC_get_columns(void) +{ + VIOMODEINFO modeInfo = {0}; + int cols = 0; + + PDC_LOG(("PDC_get_columns() - called\n")); + + modeInfo.cb = sizeof(modeInfo); + VioGetMode(&modeInfo, 0); + cols = modeInfo.col; + + PDC_LOG(("PDC_get_columns() - returned: cols %d\n", cols)); + + return cols; +} + +/* get the cursor size/shape */ + +int PDC_get_cursor_mode(void) +{ + VIOCURSORINFO cursorInfo; + + PDC_LOG(("PDC_get_cursor_mode() - called\n")); + + VioGetCurType (&cursorInfo, 0); + + return (cursorInfo.yStart << 8) | cursorInfo.cEnd; +} + +/* return number of screen rows */ + +int PDC_get_rows(void) +{ + VIOMODEINFO modeInfo = {0}; + int rows = 0; + + PDC_LOG(("PDC_get_rows() - called\n")); + + modeInfo.cb = sizeof(modeInfo); + VioGetMode(&modeInfo, 0); + rows = modeInfo.row; + + PDC_LOG(("PDC_get_rows() - returned: rows %d\n", rows)); + + return rows; +} diff --git a/vendor/pdcurses/os2/pdckbd.c b/vendor/pdcurses/os2/pdckbd.c new file mode 100644 index 0000000..c74ae40 --- /dev/null +++ b/vendor/pdcurses/os2/pdckbd.c @@ -0,0 +1,437 @@ +/* PDCurses */ + +#if defined(__EMX__) || defined(__WATCOMC__) || defined(__IBMC__) || \ +defined(__TURBOC__) +# define HAVE_SIGNAL +# include +#endif + +#include "pdcos2.h" + +static KBDINFO kbdinfo; /* default keyboard mode */ +static HMOU mouse_handle = 0; +static MOUSE_STATUS old_mouse_status; +static USHORT old_shift = 0; +static bool key_pressed = FALSE; +static int mouse_events = 0; + +/************************************************************************ + * Table for key code translation of function keys in keypad mode * + * These values are for strict IBM keyboard compatibles only * + ************************************************************************/ + +static short key_table[] = +{ + -1, ALT_ESC, -1, 0, + -1, -1, -1, -1, + -1, -1, -1, -1, + -1, -1, ALT_BKSP, KEY_BTAB, + ALT_Q, ALT_W, ALT_E, ALT_R, + ALT_T, ALT_Y, ALT_U, ALT_I, + ALT_O, ALT_P, ALT_LBRACKET, ALT_RBRACKET, + ALT_ENTER, -1, ALT_A, ALT_S, + ALT_D, ALT_F, ALT_G, ALT_H, + ALT_J, ALT_K, ALT_L, ALT_SEMICOLON, + ALT_FQUOTE, ALT_BQUOTE, -1, ALT_BSLASH, + ALT_Z, ALT_X, ALT_C, ALT_V, + ALT_B, ALT_N, ALT_M, ALT_COMMA, + ALT_STOP, ALT_FSLASH, -1, ALT_PADSTAR, + -1, -1, -1, KEY_F(1), + KEY_F(2), KEY_F(3), KEY_F(4), KEY_F(5), + KEY_F(6), KEY_F(7), KEY_F(8), KEY_F(9), + KEY_F(10), -1, -1, KEY_HOME, + KEY_UP, KEY_PPAGE, ALT_PADMINUS, KEY_LEFT, + KEY_B2, KEY_RIGHT, ALT_PADPLUS, KEY_END, + KEY_DOWN, KEY_NPAGE, KEY_IC, KEY_DC, + KEY_F(13), KEY_F(14), KEY_F(15), KEY_F(16), + KEY_F(17), KEY_F(18), KEY_F(19), KEY_F(20), + KEY_F(21), KEY_F(22), KEY_F(25), KEY_F(26), + KEY_F(27), KEY_F(28), KEY_F(29), KEY_F(30), + KEY_F(31), KEY_F(32), KEY_F(33), KEY_F(34), + KEY_F(37), KEY_F(38), KEY_F(39), KEY_F(40), + KEY_F(41), KEY_F(42), KEY_F(43), KEY_F(44), + KEY_F(45), KEY_F(46), -1, CTL_LEFT, + CTL_RIGHT, CTL_END, CTL_PGDN, CTL_HOME, + ALT_1, ALT_2, ALT_3, ALT_4, + ALT_5, ALT_6, ALT_7, ALT_8, + ALT_9, ALT_0, ALT_MINUS, ALT_EQUAL, + CTL_PGUP, KEY_F(11), KEY_F(12), KEY_F(23), + KEY_F(24), KEY_F(35), KEY_F(36), KEY_F(47), + KEY_F(48), CTL_UP, CTL_PADMINUS, CTL_PADCENTER, + CTL_PADPLUS, CTL_DOWN, CTL_INS, CTL_DEL, + CTL_TAB, CTL_PADSLASH, CTL_PADSTAR, ALT_HOME, + ALT_UP, ALT_PGUP, -1, ALT_LEFT, + -1, ALT_RIGHT, -1, ALT_END, + ALT_DOWN, ALT_PGDN, ALT_INS, ALT_DEL, + ALT_PADSLASH, ALT_TAB, ALT_PADENTER, -1 +}; + +void PDC_get_keyboard_info(void) +{ + kbdinfo.cb = sizeof(kbdinfo); + KbdGetStatus(&kbdinfo, 0); +} + +void PDC_set_keyboard_default(void) +{ + KbdSetStatus(&kbdinfo, 0); +} + +void PDC_set_keyboard_binary(bool on) +{ + PDC_LOG(("PDC_set_keyboard_binary() - called\n")); + + if (on) + { + kbdinfo.fsMask &= ~(KEYBOARD_ASCII_MODE); + kbdinfo.fsMask |= KEYBOARD_BINARY_MODE; + } + else + { + kbdinfo.fsMask &= ~(KEYBOARD_BINARY_MODE); + kbdinfo.fsMask |= KEYBOARD_ASCII_MODE; + } + + KbdSetStatus(&kbdinfo, 0); + +#ifdef HAVE_SIGNAL + signal(SIGBREAK, on ? SIG_IGN : SIG_DFL); +#endif +} + +/* check if a key or mouse event is waiting */ + +bool PDC_check_key(void) +{ + KBDKEYINFO keyInfo = {0}; + + KbdGetStatus(&kbdinfo, 0); + + if (mouse_handle) + { + MOUQUEINFO queue; + + MouGetNumQueEl(&queue, mouse_handle); + mouse_events = queue.cEvents; + + if (mouse_events) + return TRUE; + } + + if (old_shift && !kbdinfo.fsState) /* modifier released */ + { + if (!key_pressed && SP->return_key_modifiers) + return TRUE; + } + else if (!old_shift && kbdinfo.fsState) /* modifier pressed */ + key_pressed = FALSE; + + old_shift = kbdinfo.fsState; + + KbdPeek(&keyInfo, 0); /* peek at keyboard */ + return (keyInfo.fbStatus != 0); +} + +static int _process_mouse_events(void) +{ + MOUEVENTINFO event; + static const USHORT button_mask[] = {6, 96, 24}, + move_mask[] = {2, 32, 8}, + press_mask[] = {4, 64, 16}; + USHORT count = 1; + short shift_flags = 0; + int i; + + MouReadEventQue(&event, &count, mouse_handle); + mouse_events--; + + for (i = 0; i < 3; i++) + { + SP->mouse_status.button[i] = + ((event.fs & move_mask[i]) ? BUTTON_MOVED : 0) | + ((event.fs & press_mask[i]) ? BUTTON_PRESSED : 0); + + /* PRESS events are sometimes mistakenly reported as MOVE + events. A MOVE should always follow a PRESS, so treat a MOVE + immediately after a RELEASE as a PRESS. */ + + if ((SP->mouse_status.button[i] == BUTTON_MOVED) && + (old_mouse_status.button[i] == BUTTON_RELEASED)) + { + SP->mouse_status.button[i] = BUTTON_PRESSED; + } + + if (SP->mouse_status.button[i] == BUTTON_PRESSED && SP->mouse_wait) + { + /* Check for a click -- a PRESS followed immediately by a + release */ + + if (!mouse_events) + { + MOUQUEINFO queue; + + napms(SP->mouse_wait); + + MouGetNumQueEl(&queue, mouse_handle); + mouse_events = queue.cEvents; + } + + if (mouse_events) + { + MouReadEventQue(&event, &count, mouse_handle); + + if (!(event.fs & button_mask[i])) + SP->mouse_status.button[i] = BUTTON_CLICKED; + } + } + } + + SP->mouse_status.x = event.col; + SP->mouse_status.y = event.row; + + SP->mouse_status.changes = 0; + + for (i = 0; i < 3; i++) + { + if (old_mouse_status.button[i] != SP->mouse_status.button[i]) + SP->mouse_status.changes |= (1 << i); + + if (SP->mouse_status.button[i] == BUTTON_MOVED) + { + /* Discard non-moved "moves" */ + + if (SP->mouse_status.x == old_mouse_status.x && + SP->mouse_status.y == old_mouse_status.y) + return -1; + + /* Motion events always flag the button as changed */ + + SP->mouse_status.changes |= (1 << i); + SP->mouse_status.changes |= PDC_MOUSE_MOVED; + break; + } + } + + old_mouse_status = SP->mouse_status; + + /* Treat click events as release events for comparison purposes */ + + for (i = 0; i < 3; i++) + { + if (old_mouse_status.button[i] == BUTTON_CLICKED) + old_mouse_status.button[i] = BUTTON_RELEASED; + } + + /* Check for SHIFT/CONTROL/ALT */ + + if (kbdinfo.fsState & KBDSTF_ALT) + shift_flags |= BUTTON_ALT; + + if (kbdinfo.fsState & KBDSTF_CONTROL) + shift_flags |= BUTTON_CONTROL; + + if (kbdinfo.fsState & (KBDSTF_LEFTSHIFT|KBDSTF_RIGHTSHIFT)) + shift_flags |= BUTTON_SHIFT; + + if (shift_flags) + { + for (i = 0; i < 3; i++) + { + if (SP->mouse_status.changes & (1 << i)) + SP->mouse_status.button[i] |= shift_flags; + } + } + + old_shift = kbdinfo.fsState; + key_pressed = TRUE; + + SP->key_code = TRUE; + return KEY_MOUSE; +} + +/* return the next available key or mouse event */ + +int PDC_get_key(void) +{ + int key, scan; + KBDKEYINFO keyInfo = {0}; + + SP->key_modifiers = 0L; + + if (mouse_handle && mouse_events) + return _process_mouse_events(); + + if (old_shift && !kbdinfo.fsState) + { + key = -1; + + if (old_shift & KBDSTF_LEFTALT) + { + key = KEY_ALT_L; + } + else if (old_shift & KBDSTF_RIGHTALT) + { + key = KEY_ALT_R; + } + else if (old_shift & KBDSTF_LEFTCONTROL) + { + key = KEY_CONTROL_L; + } + else if (old_shift & KBDSTF_RIGHTCONTROL) + { + key = KEY_CONTROL_R; + } + else if (old_shift & KBDSTF_LEFTSHIFT) + { + key = KEY_SHIFT_L; + } + else if (old_shift & KBDSTF_RIGHTSHIFT) + { + key = KEY_SHIFT_R; + } + + key_pressed = FALSE; + old_shift = kbdinfo.fsState; + + SP->key_code = TRUE; + return key; + } + + KbdCharIn(&keyInfo, IO_WAIT, 0); /* get a character */ + + key = keyInfo.chChar; + scan = keyInfo.chScan; + + if (keyInfo.fsState & KBDSTF_ALT) + SP->key_modifiers |= PDC_KEY_MODIFIER_ALT; + + if (keyInfo.fsState & KBDSTF_CONTROL) + SP->key_modifiers |= PDC_KEY_MODIFIER_CONTROL; + + if (keyInfo.fsState & KBDSTF_NUMLOCK_ON) + SP->key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; + + if (keyInfo.fsState & (KBDSTF_LEFTSHIFT|KBDSTF_RIGHTSHIFT)) + SP->key_modifiers |= PDC_KEY_MODIFIER_SHIFT; + + if (scan == 0x1c && key == 0x0a) /* ^Enter */ + key = CTL_ENTER; + else if (scan == 0xe0 && key == 0x0d) /* PadEnter */ + key = PADENTER; + else if (scan == 0xe0 && key == 0x0a) /* ^PadEnter */ + key = CTL_PADENTER; + else if (scan == 0x37 && key == 0x2a) /* Star */ + key = PADSTAR; + else if (scan == 0x4a && key == 0x2d) /* Minus */ + key = PADMINUS; + else if (scan == 0x4e && key == 0x2b) /* Plus */ + key = PADPLUS; + else if (scan == 0xe0 && key == 0x2f) /* Slash */ + key = PADSLASH; + else if (key == 0x00 || (key == 0xe0 && scan > 53 && scan != 86)) + key = (scan > 0xa7) ? -1 : key_table[scan]; + + if (keyInfo.fsState & (KBDSTF_LEFTSHIFT|KBDSTF_RIGHTSHIFT)) + { + switch (key) + { + case KEY_HOME: /* Shift Home */ + key = KEY_SHOME; + break; + case KEY_UP: /* Shift Up */ + key = KEY_SUP; + break; + case KEY_PPAGE: /* Shift PgUp */ + key = KEY_SPREVIOUS; + break; + case KEY_LEFT: /* Shift Left */ + key = KEY_SLEFT; + break; + case KEY_RIGHT: /* Shift Right */ + key = KEY_SRIGHT; + break; + case KEY_END: /* Shift End */ + key = KEY_SEND; + break; + case KEY_DOWN: /* Shift Down */ + key = KEY_SDOWN; + break; + case KEY_NPAGE: /* Shift PgDn */ + key = KEY_SNEXT; + break; + case KEY_IC: /* Shift Ins */ + key = KEY_SIC; + break; + case KEY_DC: /* Shift Del */ + key = KEY_SDC; + } + } + + key_pressed = TRUE; + SP->key_code = ((unsigned)key >= 256); + + return key; +} + +/* discard any pending keyboard or mouse input -- this is the core + routine for flushinp() */ + +void PDC_flushinp(void) +{ + PDC_LOG(("PDC_flushinp() - called\n")); + + if (mouse_handle) + MouFlushQue(mouse_handle); + + KbdFlushBuffer(0); +} + +bool PDC_has_mouse(void) +{ + if (!mouse_handle) + { + memset(&old_mouse_status, 0, sizeof(MOUSE_STATUS)); + MouOpen(NULL, &mouse_handle); + } + + return !!mouse_handle; +} + +int PDC_mouse_set(void) +{ + unsigned long mbe = SP->_trap_mbe; + + if (mbe && !mouse_handle) + { + if (PDC_has_mouse()) + MouDrawPtr(mouse_handle); + } + else if (!mbe && mouse_handle) + { + MouClose(mouse_handle); + mouse_handle = 0; + } + + if (mbe && mouse_handle) + { + USHORT mask = ((mbe & (BUTTON1_PRESSED | BUTTON1_CLICKED | + BUTTON1_MOVED)) ? 6 : 0) | + + ((mbe & (BUTTON3_PRESSED | BUTTON3_CLICKED | + BUTTON3_MOVED)) ? 24 : 0) | + + ((mbe & (BUTTON2_PRESSED | BUTTON2_CLICKED | + BUTTON2_MOVED)) ? 96 : 0); + + MouSetEventMask(&mask, mouse_handle); + } + + return OK; +} + +int PDC_modifiers_set(void) +{ + key_pressed = FALSE; + + return OK; +} diff --git a/vendor/pdcurses/os2/pdcos2.h b/vendor/pdcurses/os2/pdcos2.h new file mode 100644 index 0000000..cdfea40 --- /dev/null +++ b/vendor/pdcurses/os2/pdcos2.h @@ -0,0 +1,23 @@ +/* PDCurses */ + +#include +#include + +#define INCL_DOS +#define INCL_DOSMISC +#define INCL_WIN +#define INCL_VIO +#define INCL_KBD +#define INCL_MOU +#include + +#include + +extern ULONG pdc_last_blink; +extern short pdc_curstoreal[16]; +extern int pdc_font; + +extern ULONG PDC_ms_count(void); +extern void PDC_get_keyboard_info(void); +extern void PDC_set_keyboard_default(void); +extern void PDC_blink_text(void); diff --git a/vendor/pdcurses/os2/pdcscrn.c b/vendor/pdcurses/os2/pdcscrn.c new file mode 100644 index 0000000..0403402 --- /dev/null +++ b/vendor/pdcurses/os2/pdcscrn.c @@ -0,0 +1,224 @@ +/* PDCurses */ + +#include "pdcos2.h" + +static short realtocurs[16] = +{ + COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN, COLOR_RED, + COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE, COLOR_BLACK + 8, + COLOR_BLUE + 8, COLOR_GREEN + 8, COLOR_CYAN + 8, COLOR_RED + 8, + COLOR_MAGENTA + 8, COLOR_YELLOW + 8, COLOR_WHITE + 8 +}; + +static PCH saved_screen = NULL; +static USHORT saved_lines = 0; +static USHORT saved_cols = 0; +static VIOMODEINFO scrnmode; /* default screen mode */ +static VIOMODEINFO saved_scrnmode[3]; +static int saved_font[3]; + +short pdc_curstoreal[16]; +int pdc_font; /* default font size */ + +static int _get_font(void) +{ + VIOMODEINFO modeInfo = {0}; + + modeInfo.cb = sizeof(modeInfo); + + VioGetMode(&modeInfo, 0); + return (modeInfo.vres / modeInfo.row); +} + +static void _set_font(int size) +{ + VIOMODEINFO modeInfo = {0}; + + if (pdc_font != size) + { + modeInfo.cb = sizeof(modeInfo); + + /* set most parameters of modeInfo */ + + VioGetMode(&modeInfo, 0); + modeInfo.cb = 8; /* ignore horiz an vert resolution */ + modeInfo.row = modeInfo.vres / size; + VioSetMode(&modeInfo, 0); + } + + curs_set(SP->visibility); + + pdc_font = _get_font(); +} + +/* close the physical screen -- may restore the screen to its state + before PDC_scr_open(); miscellaneous cleanup */ + +void PDC_scr_close(void) +{ + PDC_LOG(("PDC_scr_close() - called\n")); + + if (saved_screen && getenv("PDC_RESTORE_SCREEN")) + { + VioWrtCellStr(saved_screen, saved_lines * saved_cols * 2, + 0, 0, (HVIO)NULL); + + free(saved_screen); + saved_screen = NULL; + } + + reset_shell_mode(); + + if (SP->visibility != 1) + curs_set(1); + + /* Position cursor to the bottom left of the screen. */ + + PDC_gotoyx(PDC_get_rows() - 2, 0); +} + +void PDC_scr_free(void) +{ +} + +/* open the physical screen -- miscellaneous initialization, may save + the existing screen for later restoration */ + +int PDC_scr_open(void) +{ + USHORT totchars; + int i; + + PDC_LOG(("PDC_scr_open() - called\n")); + + for (i = 0; i < 16; i++) + pdc_curstoreal[realtocurs[i]] = i; + + SP->orig_attr = FALSE; + + VioGetMode(&scrnmode, 0); + PDC_get_keyboard_info(); + pdc_font = _get_font(); + + SP->mouse_wait = PDC_CLICK_PERIOD; + SP->audible = TRUE; + + SP->termattrs = (SP->mono ? 0 : A_COLOR) | A_REVERSE | A_BLINK; + + /* This code for preserving the current screen */ + + if (getenv("PDC_RESTORE_SCREEN")) + { + saved_lines = PDC_get_rows(); + saved_cols = PDC_get_columns(); + + saved_screen = malloc(2 * saved_lines * saved_cols); + + if (!saved_screen) + { + SP->_preserve = FALSE; + return OK; + } + + totchars = saved_lines * saved_cols * 2; + VioReadCellStr((PCH)saved_screen, &totchars, 0, 0, (HVIO)NULL); + } + + SP->_preserve = (getenv("PDC_PRESERVE_SCREEN") != NULL); + + return OK; +} + +/* the core of resize_term() */ + +int PDC_resize_screen(int nlines, int ncols) +{ + VIOMODEINFO modeInfo = {0}; + USHORT result; + + PDC_LOG(("PDC_resize_screen() - called. Lines: %d Cols: %d\n", + nlines, ncols)); + + modeInfo.cb = sizeof(modeInfo); + + /* set most parameters of modeInfo */ + + VioGetMode(&modeInfo, 0); + modeInfo.fbType = 1; + modeInfo.row = nlines; + modeInfo.col = ncols; + result = VioSetMode(&modeInfo, 0); + + return (result == 0) ? OK : ERR; +} + +void PDC_reset_prog_mode(void) +{ + PDC_LOG(("PDC_reset_prog_mode() - called.\n")); + + PDC_set_keyboard_binary(TRUE); +} + +void PDC_reset_shell_mode(void) +{ + PDC_LOG(("PDC_reset_shell_mode() - called.\n")); + + PDC_set_keyboard_default(); +} + +static bool _screen_mode_equals(VIOMODEINFO *oldmode) +{ + VIOMODEINFO current = {0}; + + VioGetMode(¤t, 0); + + return ((current.cb == oldmode->cb) && + (current.fbType == oldmode->fbType) && + (current.color == oldmode->color) && + (current.col == oldmode->col) && + (current.row == oldmode->row) && + (current.hres == oldmode->vres) && + (current.vres == oldmode->vres)); +} + +void PDC_restore_screen_mode(int i) +{ + if (i >= 0 && i <= 2) + { + pdc_font = _get_font(); + _set_font(saved_font[i]); + + if (!_screen_mode_equals(&saved_scrnmode[i])) + if (VioSetMode(&saved_scrnmode[i], 0) != 0) + { + pdc_font = _get_font(); + scrnmode = saved_scrnmode[i]; + LINES = PDC_get_rows(); + COLS = PDC_get_columns(); + } + } +} + +void PDC_save_screen_mode(int i) +{ + if (i >= 0 && i <= 2) + { + saved_font[i] = pdc_font; + saved_scrnmode[i] = scrnmode; + } +} + +bool PDC_can_change_color(void) +{ + return FALSE; +} + +int PDC_color_content(short color, short *red, short *green, short *blue) +{ + return ERR; +} + +int PDC_init_color(short color, short red, short green, short blue) +{ + return ERR; +} diff --git a/vendor/pdcurses/os2/pdcsetsc.c b/vendor/pdcurses/os2/pdcsetsc.c new file mode 100644 index 0000000..7a54693 --- /dev/null +++ b/vendor/pdcurses/os2/pdcsetsc.c @@ -0,0 +1,116 @@ +/* PDCurses */ + +#include "pdcos2.h" + +/*man-start************************************************************** + +pdcsetsc +-------- + +### Synopsis + + int PDC_set_blink(bool blinkon); + int PDC_set_bold(bool boldon); + void PDC_set_title(const char *title); + +### Description + + PDC_set_blink() toggles whether the A_BLINK attribute sets an actual + blink mode (TRUE), or sets the background color to high intensity + (FALSE). The default is platform-dependent (FALSE in most cases). It + returns OK if it could set the state to match the given parameter, + ERR otherwise. + + PDC_set_bold() toggles whether the A_BOLD attribute selects an actual + bold font (TRUE), or sets the foreground color to high intensity + (FALSE). It returns OK if it could set the state to match the given + parameter, ERR otherwise. + + PDC_set_title() sets the title of the window in which the curses + program is running. This function may not do anything on some + platforms. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + PDC_set_blink | - | - | - + PDC_set_bold | - | - | - + PDC_set_title | - | - | - + +**man-end****************************************************************/ + +int PDC_curs_set(int visibility) +{ + VIOCURSORINFO pvioCursorInfo; + int ret_vis, hidden = 0, start = 0, end = 0; + + PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); + + ret_vis = SP->visibility; + SP->visibility = visibility; + + switch(visibility) + { + case 0: /* invisible */ + start = pdc_font / 4; + end = pdc_font; + hidden = -1; + break; + + case 2: /* highly visible */ + start = 2; /* almost full-height block */ + end = pdc_font - 1; + break; + + default: /* normal visibility */ + start = (SP->orig_cursor >> 8) & 0xff; + end = SP->orig_cursor & 0xff; + } + + pvioCursorInfo.yStart = (USHORT)start; + pvioCursorInfo.cEnd = (USHORT)end; + pvioCursorInfo.cx = (USHORT)1; + pvioCursorInfo.attr = hidden; + VioSetCurType((PVIOCURSORINFO)&pvioCursorInfo, 0); + + return ret_vis; +} + +void PDC_set_title(const char *title) +{ + PDC_LOG(("PDC_set_title() - called:<%s>\n", title)); +} + +int PDC_set_blink(bool blinkon) +{ + if (!SP) + return ERR; + + if (SP->color_started) + COLORS = 16; + + if (blinkon) + { + if (!(SP->termattrs & A_BLINK)) + { + SP->termattrs |= A_BLINK; + pdc_last_blink = PDC_ms_count(); + } + } + else + { + if (SP->termattrs & A_BLINK) + { + SP->termattrs &= ~A_BLINK; + PDC_blink_text(); + } + } + + return OK; +} + +int PDC_set_bold(bool boldon) +{ + return boldon ? ERR : OK; +} diff --git a/vendor/pdcurses/os2/pdcutil.c b/vendor/pdcurses/os2/pdcutil.c new file mode 100644 index 0000000..b087266 --- /dev/null +++ b/vendor/pdcurses/os2/pdcutil.c @@ -0,0 +1,38 @@ +/* PDCurses */ + +#include "pdcos2.h" + +#if defined(OS2) && !defined(__EMX__) +APIRET APIENTRY DosSleep(ULONG ulTime); +#endif + +void PDC_beep(void) +{ + PDC_LOG(("PDC_beep() - called\n")); + + DosBeep(1380, 100); +} + +ULONG PDC_ms_count(void) +{ + ULONG now; + + DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &now, sizeof(ULONG)); + + return now; +} + +void PDC_napms(int ms) +{ + PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); + + if ((SP->termattrs & A_BLINK) && (PDC_ms_count() >= pdc_last_blink + 500)) + PDC_blink_text(); + + DosSleep(ms); +} + +const char *PDC_sysname(void) +{ + return "OS/2"; +} diff --git a/vendor/pdcurses/panel.h b/vendor/pdcurses/panel.h new file mode 100644 index 0000000..83d4f2c --- /dev/null +++ b/vendor/pdcurses/panel.h @@ -0,0 +1,54 @@ +/*----------------------------------------------------------------------* + * Panels for PDCurses * + *----------------------------------------------------------------------*/ + +#ifndef __PDCURSES_PANEL_H__ +#define __PDCURSES_PANEL_H__ 1 + +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + +typedef struct panelobs +{ + struct panelobs *above; + struct panel *pan; +} PANELOBS; + +typedef struct panel +{ + WINDOW *win; + int wstarty; + int wendy; + int wstartx; + int wendx; + struct panel *below; + struct panel *above; + const void *user; + struct panelobs *obscure; +} PANEL; + +PDCEX int bottom_panel(PANEL *pan); +PDCEX int del_panel(PANEL *pan); +PDCEX int hide_panel(PANEL *pan); +PDCEX int move_panel(PANEL *pan, int starty, int startx); +PDCEX PANEL *new_panel(WINDOW *win); +PDCEX PANEL *panel_above(const PANEL *pan); +PDCEX PANEL *panel_below(const PANEL *pan); +PDCEX int panel_hidden(const PANEL *pan); +PDCEX const void *panel_userptr(const PANEL *pan); +PDCEX WINDOW *panel_window(const PANEL *pan); +PDCEX int replace_panel(PANEL *pan, WINDOW *win); +PDCEX int set_panel_userptr(PANEL *pan, const void *uptr); +PDCEX int show_panel(PANEL *pan); +PDCEX int top_panel(PANEL *pan); +PDCEX void update_panels(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __PDCURSES_PANEL_H__ */ diff --git a/vendor/pdcurses/pdcurses/README.md b/vendor/pdcurses/pdcurses/README.md new file mode 100644 index 0000000..10a6b4c --- /dev/null +++ b/vendor/pdcurses/pdcurses/README.md @@ -0,0 +1,19 @@ +PDCurses Portable Core +====================== + +This directory contains core PDCurses source code files common to all +platforms. + + +Building +-------- + +These modules are built by the platform-specific makefiles, in the +platform directories. + + +Acknowledgements +---------------- + +The panel library was originally provided by +Warren Tucker diff --git a/vendor/pdcurses/pdcurses/addch.c b/vendor/pdcurses/pdcurses/addch.c new file mode 100644 index 0000000..076064f --- /dev/null +++ b/vendor/pdcurses/pdcurses/addch.c @@ -0,0 +1,410 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +addch +----- + +### Synopsis + + int addch(const chtype ch); + int waddch(WINDOW *win, const chtype ch); + int mvaddch(int y, int x, const chtype ch); + int mvwaddch(WINDOW *win, int y, int x, const chtype ch); + int echochar(const chtype ch); + int wechochar(WINDOW *win, const chtype ch); + + int addrawch(chtype ch); + int waddrawch(WINDOW *win, chtype ch); + int mvaddrawch(int y, int x, chtype ch); + int mvwaddrawch(WINDOW *win, int y, int x, chtype ch); + + int add_wch(const cchar_t *wch); + int wadd_wch(WINDOW *win, const cchar_t *wch); + int mvadd_wch(int y, int x, const cchar_t *wch); + int mvwadd_wch(WINDOW *win, int y, int x, const cchar_t *wch); + int echo_wchar(const cchar_t *wch); + int wecho_wchar(WINDOW *win, const cchar_t *wch); + +### Description + + addch() adds the chtype ch to the default window (stdscr) at the + current cursor position, and advances the cursor. Note that chtypes + can convey both text (a single character) and attributes, including a + color pair. add_wch() is the wide-character version of this function, + taking a pointer to a cchar_t instead of a chtype. + + waddch() is like addch(), but also lets you specify the window. (This + is in fact the core output routine.) wadd_wch() is the wide version. + + mvaddch() moves the cursor to the specified (y, x) position, and adds + ch to stdscr. mvadd_wch() is the wide version. + + mvwaddch() moves the cursor to the specified position and adds ch to + the specified window. mvwadd_wch() is the wide version. + + echochar() adds ch to stdscr at the current cursor position and calls + refresh(). echo_wchar() is the wide version. + + wechochar() adds ch to the specified window and calls wrefresh(). + wecho_wchar() is the wide version. + + addrawch(), waddrawch(), mvaddrawch() and mvwaddrawch() are PDCurses- + specific wrappers for addch() etc. that disable the translation of + control characters. + + The following applies to all these functions: + + If the cursor moves on to the right margin, an automatic newline is + performed. If scrollok is enabled, and a character is added to the + bottom right corner of the window, the scrolling region will be + scrolled up one line. If scrolling is not allowed, ERR will be + returned. + + If ch is a tab, newline, or backspace, the cursor will be moved + appropriately within the window. If ch is a newline, the clrtoeol + routine is called before the cursor is moved to the beginning of the + next line. If newline mapping is off, the cursor will be moved to + the next line, but the x coordinate will be unchanged. If ch is a + tab the cursor is moved to the next tab position within the window. + If ch is another control character, it will be drawn in the ^X + notation. Calling the inch() routine after adding a control + character returns the representation of the control character, not + the control character. + + Video attributes can be combined with a character by ORing them into + the parameter. Text, including attributes, can be copied from one + place to another by using inch() and addch(). + + Note that in PDCurses, for now, a cchar_t and a chtype are the same. + The text field is 16 bits wide, and is treated as Unicode (UCS-2) + when PDCurses is built with wide-character support (define PDC_WIDE). + So, in functions that take a chtype, like addch(), both the wide and + narrow versions will handle Unicode. But for portability, you should + use the wide functions. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + addch | Y | Y | Y + waddch | Y | Y | Y + mvaddch | Y | Y | Y + mvwaddch | Y | Y | Y + echochar | Y | Y | Y + wechochar | Y | Y | Y + add_wch | Y | Y | Y + wadd_wch | Y | Y | Y + mvadd_wch | Y | Y | Y + mvwadd_wch | Y | Y | Y + echo_wchar | Y | Y | Y + wecho_wchar | Y | Y | Y + addrawch | - | - | - + waddrawch | - | - | - + mvaddrawch | - | - | - + mvwaddrawch | - | - | - + +**man-end****************************************************************/ + +int waddch(WINDOW *win, const chtype ch) +{ + int x, y; + chtype text, attr; + bool xlat; + + PDC_LOG(("waddch() - called: win=%p ch=%x (text=%c attr=0x%x)\n", + win, ch, ch & A_CHARTEXT, ch & A_ATTRIBUTES)); + + if (!win || !SP) + return ERR; + + x = win->_curx; + y = win->_cury; + + if (y > win->_maxy || x > win->_maxx || y < 0 || x < 0) + return ERR; + + xlat = !SP->raw_out && !(ch & A_ALTCHARSET); + text = ch & A_CHARTEXT; + attr = ch & A_ATTRIBUTES; + + if (xlat && (text < ' ' || text == 0x7f)) + { + int x2; + + switch (text) + { + case '\t': + for (x2 = ((x / TABSIZE) + 1) * TABSIZE; x < x2; x++) + { + if (waddch(win, attr | ' ') == ERR) + return ERR; + + /* if tab to next line, exit the loop */ + + if (!win->_curx) + break; + } + return OK; + + case '\n': + /* if lf -> crlf */ + + if (!SP->raw_out) + x = 0; + + wclrtoeol(win); + + if (++y > win->_bmarg) + { + y--; + + if (wscrl(win, 1) == ERR) + return ERR; + } + + break; + + case '\b': + /* don't back over left margin */ + + if (--x < 0) + case '\r': + x = 0; + + break; + + case 0x7f: + if (waddch(win, attr | '^') == ERR) + return ERR; + + return waddch(win, attr | '?'); + + default: + /* handle control chars */ + + if (waddch(win, attr | '^') == ERR) + return ERR; + + return waddch(win, ch + '@'); + } + } + else + { + /* If the incoming character doesn't have its own attribute, + then use the current attributes for the window. If it has + attributes but not a color component, OR the attributes to + the current attributes for the window. If it has a color + component, use the attributes solely from the incoming + character. */ + + if (!(attr & A_COLOR)) + attr |= win->_attrs; + + /* wrs (4/10/93): Apply the same sort of logic for the window + background, in that it only takes precedence if other color + attributes are not there and that the background character + will only print if the printing character is blank. */ + + if (!(attr & A_COLOR)) + attr |= win->_bkgd & A_ATTRIBUTES; + else + attr |= win->_bkgd & (A_ATTRIBUTES ^ A_COLOR); + + if (text == ' ') + text = win->_bkgd & A_CHARTEXT; + + /* Add the attribute back into the character. */ + + text |= attr; + + /* Only change _firstch/_lastch if the character to be added is + different from the character/attribute that is already in + that position in the window. */ + + if (win->_y[y][x] != text) + { + if (win->_firstch[y] == _NO_CHANGE) + win->_firstch[y] = win->_lastch[y] = x; + else + if (x < win->_firstch[y]) + win->_firstch[y] = x; + else + if (x > win->_lastch[y]) + win->_lastch[y] = x; + + win->_y[y][x] = text; + } + + if (++x >= win->_maxx) + { + /* wrap around test */ + + x = 0; + + if (++y > win->_bmarg) + { + y--; + + if (wscrl(win, 1) == ERR) + { + PDC_sync(win); + return ERR; + } + } + } + } + + win->_curx = x; + win->_cury = y; + + if (win->_immed) + wrefresh(win); + if (win->_sync) + wsyncup(win); + + return OK; +} + +int addch(const chtype ch) +{ + PDC_LOG(("addch() - called: ch=%x\n", ch)); + + return waddch(stdscr, ch); +} + +int mvaddch(int y, int x, const chtype ch) +{ + PDC_LOG(("mvaddch() - called: y=%d x=%d ch=%x\n", y, x, ch)); + + if (move(y,x) == ERR) + return ERR; + + return waddch(stdscr, ch); +} + +int mvwaddch(WINDOW *win, int y, int x, const chtype ch) +{ + PDC_LOG(("mvwaddch() - called: win=%p y=%d x=%d ch=%d\n", win, y, x, ch)); + + if (wmove(win, y, x) == ERR) + return ERR; + + return waddch(win, ch); +} + +int echochar(const chtype ch) +{ + PDC_LOG(("echochar() - called: ch=%x\n", ch)); + + return wechochar(stdscr, ch); +} + +int wechochar(WINDOW *win, const chtype ch) +{ + PDC_LOG(("wechochar() - called: win=%p ch=%x\n", win, ch)); + + if (waddch(win, ch) == ERR) + return ERR; + + return wrefresh(win); +} + +int waddrawch(WINDOW *win, chtype ch) +{ + PDC_LOG(("waddrawch() - called: win=%p ch=%x (text=%c attr=0x%x)\n", + win, ch, ch & A_CHARTEXT, ch & A_ATTRIBUTES)); + + if ((ch & A_CHARTEXT) < ' ' || (ch & A_CHARTEXT) == 0x7f) + ch |= A_ALTCHARSET; + + return waddch(win, ch); +} + +int addrawch(chtype ch) +{ + PDC_LOG(("addrawch() - called: ch=%x\n", ch)); + + return waddrawch(stdscr, ch); +} + +int mvaddrawch(int y, int x, chtype ch) +{ + PDC_LOG(("mvaddrawch() - called: y=%d x=%d ch=%d\n", y, x, ch)); + + if (move(y, x) == ERR) + return ERR; + + return waddrawch(stdscr, ch); +} + +int mvwaddrawch(WINDOW *win, int y, int x, chtype ch) +{ + PDC_LOG(("mvwaddrawch() - called: win=%p y=%d x=%d ch=%d\n", + win, y, x, ch)); + + if (wmove(win, y, x) == ERR) + return ERR; + + return waddrawch(win, ch); +} + +#ifdef PDC_WIDE +int wadd_wch(WINDOW *win, const cchar_t *wch) +{ + PDC_LOG(("wadd_wch() - called: win=%p wch=%x\n", win, *wch)); + + return wch ? waddch(win, *wch) : ERR; +} + +int add_wch(const cchar_t *wch) +{ + PDC_LOG(("add_wch() - called: wch=%x\n", *wch)); + + return wadd_wch(stdscr, wch); +} + +int mvadd_wch(int y, int x, const cchar_t *wch) +{ + PDC_LOG(("mvaddch() - called: y=%d x=%d wch=%x\n", y, x, *wch)); + + if (move(y,x) == ERR) + return ERR; + + return wadd_wch(stdscr, wch); +} + +int mvwadd_wch(WINDOW *win, int y, int x, const cchar_t *wch) +{ + PDC_LOG(("mvwaddch() - called: win=%p y=%d x=%d wch=%d\n", + win, y, x, *wch)); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wadd_wch(win, wch); +} + +int echo_wchar(const cchar_t *wch) +{ + PDC_LOG(("echo_wchar() - called: wch=%x\n", *wch)); + + return wecho_wchar(stdscr, wch); +} + +int wecho_wchar(WINDOW *win, const cchar_t *wch) +{ + PDC_LOG(("wecho_wchar() - called: win=%p wch=%x\n", win, *wch)); + + if (!wch || (wadd_wch(win, wch) == ERR)) + return ERR; + + return wrefresh(win); +} +#endif diff --git a/vendor/pdcurses/pdcurses/addchstr.c b/vendor/pdcurses/pdcurses/addchstr.c new file mode 100644 index 0000000..acb34ed --- /dev/null +++ b/vendor/pdcurses/pdcurses/addchstr.c @@ -0,0 +1,246 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +addchstr +-------- + +### Synopsis + + int addchstr(const chtype *ch); + int addchnstr(const chtype *ch, int n); + int waddchstr(WINDOW *win, const chtype *ch); + int waddchnstr(WINDOW *win, const chtype *ch, int n); + int mvaddchstr(int y, int x, const chtype *ch); + int mvaddchnstr(int y, int x, const chtype *ch, int n); + int mvwaddchstr(WINDOW *, int y, int x, const chtype *ch); + int mvwaddchnstr(WINDOW *, int y, int x, const chtype *ch, int n); + + int add_wchstr(const cchar_t *wch); + int add_wchnstr(const cchar_t *wch, int n); + int wadd_wchstr(WINDOW *win, const cchar_t *wch); + int wadd_wchnstr(WINDOW *win, const cchar_t *wch, int n); + int mvadd_wchstr(int y, int x, const cchar_t *wch); + int mvadd_wchnstr(int y, int x, const cchar_t *wch, int n); + int mvwadd_wchstr(WINDOW *win, int y, int x, const cchar_t *wch); + int mvwadd_wchnstr(WINDOW *win, int y, int x, const cchar_t *wch, + int n); + +### Description + + These routines write a chtype or cchar_t string directly into the + window structure, starting at the current or specified position. The + four routines with n as the last argument copy at most n elements, + but no more than will fit on the line. If n == -1 then the whole + string is copied, up to the maximum number that will fit on the line. + + The cursor position is not advanced. These routines do not check for + newline or other special characters, nor does any line wrapping + occur. + +### Return Value + + All functions return OK or ERR. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + addchstr | Y | Y | Y + waddchstr | Y | Y | Y + mvaddchstr | Y | Y | Y + mvwaddchstr | Y | Y | Y + addchnstr | Y | Y | Y + waddchnstr | Y | Y | Y + mvaddchnstr | Y | Y | Y + mvwaddchnstr | Y | Y | Y + add_wchstr | Y | Y | Y + wadd_wchstr | Y | Y | Y + mvadd_wchstr | Y | Y | Y + mvwadd_wchstr | Y | Y | Y + add_wchnstr | Y | Y | Y + wadd_wchnstr | Y | Y | Y + mvadd_wchnstr | Y | Y | Y + mvwadd_wchnstr | Y | Y | Y + +**man-end****************************************************************/ + +#include + +int waddchnstr(WINDOW *win, const chtype *ch, int n) +{ + int y, x, maxx, minx; + chtype *ptr; + + PDC_LOG(("waddchnstr() - called: win=%p n=%d\n", win, n)); + + if (!win || !ch || !n || n < -1) + return ERR; + + x = win->_curx; + y = win->_cury; + ptr = &(win->_y[y][x]); + + if (n == -1 || n > win->_maxx - x) + n = win->_maxx - x; + + minx = win->_firstch[y]; + maxx = win->_lastch[y]; + + for (; n && *ch; n--, x++, ptr++, ch++) + { + if (*ptr != *ch) + { + if (x < minx || minx == _NO_CHANGE) + minx = x; + + if (x > maxx) + maxx = x; + + PDC_LOG(("y %d x %d minx %d maxx %d *ptr %x *ch" + " %x firstch: %d lastch: %d\n", + y, x, minx, maxx, *ptr, *ch, + win->_firstch[y], win->_lastch[y])); + + *ptr = *ch; + } + } + + win->_firstch[y] = minx; + win->_lastch[y] = maxx; + + return OK; +} + +int addchstr(const chtype *ch) +{ + PDC_LOG(("addchstr() - called\n")); + + return waddchnstr(stdscr, ch, -1); +} + +int addchnstr(const chtype *ch, int n) +{ + PDC_LOG(("addchnstr() - called\n")); + + return waddchnstr(stdscr, ch, n); +} + +int waddchstr(WINDOW *win, const chtype *ch) +{ + PDC_LOG(("waddchstr() - called: win=%p\n", win)); + + return waddchnstr(win, ch, -1); +} + +int mvaddchstr(int y, int x, const chtype *ch) +{ + PDC_LOG(("mvaddchstr() - called: y %d x %d\n", y, x)); + + if (move(y, x) == ERR) + return ERR; + + return waddchnstr(stdscr, ch, -1); +} + +int mvaddchnstr(int y, int x, const chtype *ch, int n) +{ + PDC_LOG(("mvaddchnstr() - called: y %d x %d n %d\n", y, x, n)); + + if (move(y, x) == ERR) + return ERR; + + return waddchnstr(stdscr, ch, n); +} + +int mvwaddchstr(WINDOW *win, int y, int x, const chtype *ch) +{ + PDC_LOG(("mvwaddchstr() - called:\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return waddchnstr(win, ch, -1); +} + +int mvwaddchnstr(WINDOW *win, int y, int x, const chtype *ch, int n) +{ + PDC_LOG(("mvwaddchnstr() - called: y %d x %d n %d \n", y, x, n)); + + if (wmove(win, y, x) == ERR) + return ERR; + + return waddchnstr(win, ch, n); +} + +#ifdef PDC_WIDE +int wadd_wchnstr(WINDOW *win, const cchar_t *wch, int n) +{ + PDC_LOG(("wadd_wchnstr() - called: win=%p n=%d\n", win, n)); + + return waddchnstr(win, wch, n); +} + +int add_wchstr(const cchar_t *wch) +{ + PDC_LOG(("add_wchstr() - called\n")); + + return wadd_wchnstr(stdscr, wch, -1); +} + +int add_wchnstr(const cchar_t *wch, int n) +{ + PDC_LOG(("add_wchnstr() - called\n")); + + return wadd_wchnstr(stdscr, wch, n); +} + +int wadd_wchstr(WINDOW *win, const cchar_t *wch) +{ + PDC_LOG(("wadd_wchstr() - called: win=%p\n", win)); + + return wadd_wchnstr(win, wch, -1); +} + +int mvadd_wchstr(int y, int x, const cchar_t *wch) +{ + PDC_LOG(("mvadd_wchstr() - called: y %d x %d\n", y, x)); + + if (move(y, x) == ERR) + return ERR; + + return wadd_wchnstr(stdscr, wch, -1); +} + +int mvadd_wchnstr(int y, int x, const cchar_t *wch, int n) +{ + PDC_LOG(("mvadd_wchnstr() - called: y %d x %d n %d\n", y, x, n)); + + if (move(y, x) == ERR) + return ERR; + + return wadd_wchnstr(stdscr, wch, n); +} + +int mvwadd_wchstr(WINDOW *win, int y, int x, const cchar_t *wch) +{ + PDC_LOG(("mvwadd_wchstr() - called:\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wadd_wchnstr(win, wch, -1); +} + +int mvwadd_wchnstr(WINDOW *win, int y, int x, const cchar_t *wch, int n) +{ + PDC_LOG(("mvwadd_wchnstr() - called: y %d x %d n %d \n", y, x, n)); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wadd_wchnstr(win, wch, n); +} +#endif diff --git a/vendor/pdcurses/pdcurses/addstr.c b/vendor/pdcurses/pdcurses/addstr.c new file mode 100644 index 0000000..6a62f35 --- /dev/null +++ b/vendor/pdcurses/pdcurses/addstr.c @@ -0,0 +1,241 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +addstr +------ + +### Synopsis + + int addstr(const char *str); + int addnstr(const char *str, int n); + int waddstr(WINDOW *win, const char *str); + int waddnstr(WINDOW *win, const char *str, int n); + int mvaddstr(int y, int x, const char *str); + int mvaddnstr(int y, int x, const char *str, int n); + int mvwaddstr(WINDOW *win, int y, int x, const char *str); + int mvwaddnstr(WINDOW *win, int y, int x, const char *str, int n); + + int addwstr(const wchar_t *wstr); + int addnwstr(const wchar_t *wstr, int n); + int waddwstr(WINDOW *win, const wchar_t *wstr); + int waddnwstr(WINDOW *win, const wchar_t *wstr, int n); + int mvaddwstr(int y, int x, const wchar_t *wstr); + int mvaddnwstr(int y, int x, const wchar_t *wstr, int n); + int mvwaddwstr(WINDOW *win, int y, int x, const wchar_t *wstr); + int mvwaddnwstr(WINDOW *win, int y, int x, const wchar_t *wstr, int n); + +### Description + + These routines write all the characters of the null-terminated string + str or wide-character string wstr to the given window. The + functionality is similar to calling waddch() once for each character + in the string; except that, when PDCurses is built with wide- + character support enabled, the narrow-character functions treat the + string as a multibyte string in the current locale, and convert it. + The routines with n as the last argument write at most n characters; + if n is negative, then the entire string will be added. + +### Return Value + + All functions return OK or ERR. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + addstr | Y | Y | Y + waddstr | Y | Y | Y + mvaddstr | Y | Y | Y + mvwaddstr | Y | Y | Y + addnstr | Y | Y | Y + waddnstr | Y | Y | Y + mvaddnstr | Y | Y | Y + mvwaddnstr | Y | Y | Y + addwstr | Y | Y | Y + waddwstr | Y | Y | Y + mvaddwstr | Y | Y | Y + mvwaddwstr | Y | Y | Y + addnwstr | Y | Y | Y + waddnwstr | Y | Y | Y + mvaddnwstr | Y | Y | Y + mvwaddnwstr | Y | Y | Y + +**man-end****************************************************************/ + +int waddnstr(WINDOW *win, const char *str, int n) +{ + int i = 0; + + PDC_LOG(("waddnstr() - called: string=\"%s\" n %d \n", str, n)); + + if (!win || !str) + return ERR; + + while (str[i] && (i < n || n < 0)) + { +#ifdef PDC_WIDE + wchar_t wch; + int retval = PDC_mbtowc(&wch, str + i, n >= 0 ? n - i : 6); + + if (retval <= 0) + return OK; + + i += retval; +#else + chtype wch = (unsigned char)(str[i++]); +#endif + if (waddch(win, wch) == ERR) + return ERR; + } + + return OK; +} + +int addstr(const char *str) +{ + PDC_LOG(("addstr() - called: string=\"%s\"\n", str)); + + return waddnstr(stdscr, str, -1); +} + +int addnstr(const char *str, int n) +{ + PDC_LOG(("addnstr() - called: string=\"%s\" n %d \n", str, n)); + + return waddnstr(stdscr, str, n); +} + +int waddstr(WINDOW *win, const char *str) +{ + PDC_LOG(("waddstr() - called: string=\"%s\"\n", str)); + + return waddnstr(win, str, -1); +} + +int mvaddstr(int y, int x, const char *str) +{ + PDC_LOG(("mvaddstr() - called: y %d x %d string=\"%s\"\n", y, x, str)); + + if (move(y, x) == ERR) + return ERR; + + return waddnstr(stdscr, str, -1); +} + +int mvaddnstr(int y, int x, const char *str, int n) +{ + PDC_LOG(("mvaddnstr() - called: y %d x %d string=\"%s\" n %d \n", + y, x, str, n)); + + if (move(y, x) == ERR) + return ERR; + + return waddnstr(stdscr, str, n); +} + +int mvwaddstr(WINDOW *win, int y, int x, const char *str) +{ + PDC_LOG(("mvwaddstr() - called: string=\"%s\"\n", str)); + + if (wmove(win, y, x) == ERR) + return ERR; + + return waddnstr(win, str, -1); +} + +int mvwaddnstr(WINDOW *win, int y, int x, const char *str, int n) +{ + PDC_LOG(("mvwaddnstr() - called: y %d x %d string=\"%s\" n %d \n", + y, x, str, n)); + + if (wmove(win, y, x) == ERR) + return ERR; + + return waddnstr(win, str, n); +} + +#ifdef PDC_WIDE +int waddnwstr(WINDOW *win, const wchar_t *wstr, int n) +{ + int i = 0; + + PDC_LOG(("waddnwstr() - called\n")); + + if (!win || !wstr) + return ERR; + + while (wstr[i] && (i < n || n < 0)) + { + chtype wch = wstr[i++]; + + if (waddch(win, wch) == ERR) + return ERR; + } + + return OK; +} + +int addwstr(const wchar_t *wstr) +{ + PDC_LOG(("addwstr() - called\n")); + + return waddnwstr(stdscr, wstr, -1); +} + +int addnwstr(const wchar_t *wstr, int n) +{ + PDC_LOG(("addnwstr() - called\n")); + + return waddnwstr(stdscr, wstr, n); +} + +int waddwstr(WINDOW *win, const wchar_t *wstr) +{ + PDC_LOG(("waddwstr() - called\n")); + + return waddnwstr(win, wstr, -1); +} + +int mvaddwstr(int y, int x, const wchar_t *wstr) +{ + PDC_LOG(("mvaddstr() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return waddnwstr(stdscr, wstr, -1); +} + +int mvaddnwstr(int y, int x, const wchar_t *wstr, int n) +{ + PDC_LOG(("mvaddnstr() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return waddnwstr(stdscr, wstr, n); +} + +int mvwaddwstr(WINDOW *win, int y, int x, const wchar_t *wstr) +{ + PDC_LOG(("mvwaddstr() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return waddnwstr(win, wstr, -1); +} + +int mvwaddnwstr(WINDOW *win, int y, int x, const wchar_t *wstr, int n) +{ + PDC_LOG(("mvwaddnstr() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return waddnwstr(win, wstr, n); +} +#endif diff --git a/vendor/pdcurses/pdcurses/attr.c b/vendor/pdcurses/pdcurses/attr.c new file mode 100644 index 0000000..70414cc --- /dev/null +++ b/vendor/pdcurses/pdcurses/attr.c @@ -0,0 +1,411 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +attr +---- + +### Synopsis + + int attroff(chtype attrs); + int wattroff(WINDOW *win, chtype attrs); + int attron(chtype attrs); + int wattron(WINDOW *win, chtype attrs); + int attrset(chtype attrs); + int wattrset(WINDOW *win, chtype attrs); + int standend(void); + int wstandend(WINDOW *win); + int standout(void); + int wstandout(WINDOW *win); + + int color_set(short color_pair, void *opts); + int wcolor_set(WINDOW *win, short color_pair, void *opts); + + int attr_get(attr_t *attrs, short *color_pair, void *opts); + int attr_off(attr_t attrs, void *opts); + int attr_on(attr_t attrs, void *opts); + int attr_set(attr_t attrs, short color_pair, void *opts); + int wattr_get(WINDOW *win, attr_t *attrs, short *color_pair, + void *opts); + int wattr_off(WINDOW *win, attr_t attrs, void *opts); + int wattr_on(WINDOW *win, attr_t attrs, void *opts); + int wattr_set(WINDOW *win, attr_t attrs, short color_pair, + void *opts); + + int chgat(int n, attr_t attr, short color, const void *opts); + int mvchgat(int y, int x, int n, attr_t attr, short color, + const void *opts); + int mvwchgat(WINDOW *win, int y, int x, int n, attr_t attr, + short color, const void *opts); + int wchgat(WINDOW *win, int n, attr_t attr, short color, + const void *opts); + + chtype getattrs(WINDOW *win); + + int underend(void); + int wunderend(WINDOW *win); + int underscore(void); + int wunderscore(WINDOW *win); + +### Description + + These functions manipulate the current attributes and/or colors of + the named window. These attributes can be any combination of + A_STANDOUT, A_REVERSE, A_BOLD, A_DIM, A_BLINK, A_UNDERLINE. These + constants are defined in and can be combined with the + bitwise-OR operator (|). + + The current attributes of a window are applied to all chtypes that + are written into the window with waddch(). Attributes are a property + of the chtype, and move with the character through any scrolling or + insert/delete operations. + + wattrset() sets the current attributes of the given window to attrs. + attrset() is the stdscr version. + + wattroff() turns off the named attributes without affecting any other + attributes; wattron() turns them on. + + wcolor_set() sets the window color to the value of color_pair. opts + is unused. + + standout() is the same as attron(A_STANDOUT). standend() is the same + as attrset(A_NORMAL); that is, it turns off all attributes. + + The attr_* and wattr_* functions are intended for use with the WA_* + attributes. In PDCurses, these are the same as A_*, and there is no + difference in bevahior from the chtype-based functions. In all cases, + opts is unused. + + wattr_get() retrieves the attributes and color pair for the specified + window. + + wchgat() sets the color pair and attributes for the next n cells on + the current line of a given window, without changing the existing + text, or alterting the window's attributes. An n of -1 extends the + change to the edge of the window. The changes take effect + immediately. opts is unused. + + wunderscore() turns on the A_UNDERLINE attribute; wunderend() turns + it off. underscore() and underend() are the stdscr versions. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + attroff | Y | Y | Y + wattroff | Y | Y | Y + attron | Y | Y | Y + wattron | Y | Y | Y + attrset | Y | Y | Y + wattrset | Y | Y | Y + standend | Y | Y | Y + wstandend | Y | Y | Y + standout | Y | Y | Y + wstandout | Y | Y | Y + color_set | Y | Y | Y + wcolor_set | Y | Y | Y + attr_get | Y | Y | Y + wattr_get | Y | Y | Y + attr_on | Y | Y | Y + wattr_on | Y | Y | Y + attr_off | Y | Y | Y + wattr_off | Y | Y | Y + attr_set | Y | Y | Y + wattr_set | Y | Y | Y + chgat | Y | Y | Y + wchgat | Y | Y | Y + mvchgat | Y | Y | Y + mvwchgat | Y | Y | Y + getattrs | - | Y | Y + underend | - | - | Y + wunderend | - | - | Y + underscore | - | - | Y + wunderscore | - | - | Y + +**man-end****************************************************************/ + +int wattroff(WINDOW *win, chtype attrs) +{ + PDC_LOG(("wattroff() - called\n")); + + if (!win) + return ERR; + + win->_attrs &= (~attrs & A_ATTRIBUTES); + + return OK; +} + +int attroff(chtype attrs) +{ + PDC_LOG(("attroff() - called\n")); + + return wattroff(stdscr, attrs); +} + +int wattron(WINDOW *win, chtype attrs) +{ + chtype newcolr, oldcolr, newattr, oldattr; + + PDC_LOG(("wattron() - called\n")); + + if (!win) + return ERR; + + if ((win->_attrs & A_COLOR) && (attrs & A_COLOR)) + { + oldcolr = win->_attrs & A_COLOR; + oldattr = win->_attrs ^ oldcolr; + newcolr = attrs & A_COLOR; + newattr = (attrs & A_ATTRIBUTES) ^ newcolr; + newattr |= oldattr; + win->_attrs = newattr | newcolr; + } + else + win->_attrs |= (attrs & A_ATTRIBUTES); + + return OK; +} + +int attron(chtype attrs) +{ + PDC_LOG(("attron() - called\n")); + + return wattron(stdscr, attrs); +} + +int wattrset(WINDOW *win, chtype attrs) +{ + PDC_LOG(("wattrset() - called\n")); + + if (!win) + return ERR; + + win->_attrs = attrs & A_ATTRIBUTES; + + return OK; +} + +int attrset(chtype attrs) +{ + PDC_LOG(("attrset() - called\n")); + + return wattrset(stdscr, attrs); +} + +int standend(void) +{ + PDC_LOG(("standend() - called\n")); + + return wattrset(stdscr, A_NORMAL); +} + +int standout(void) +{ + PDC_LOG(("standout() - called\n")); + + return wattrset(stdscr, A_STANDOUT); +} + +int wstandend(WINDOW *win) +{ + PDC_LOG(("wstandend() - called\n")); + + return wattrset(win, A_NORMAL); +} + +int wstandout(WINDOW *win) +{ + PDC_LOG(("wstandout() - called\n")); + + return wattrset(win, A_STANDOUT); +} + +chtype getattrs(WINDOW *win) +{ + return win ? win->_attrs : 0; +} + +int wcolor_set(WINDOW *win, short color_pair, void *opts) +{ + PDC_LOG(("wcolor_set() - called\n")); + + if (!win) + return ERR; + + win->_attrs = (win->_attrs & ~A_COLOR) | COLOR_PAIR(color_pair); + + return OK; +} + +int color_set(short color_pair, void *opts) +{ + PDC_LOG(("color_set() - called\n")); + + return wcolor_set(stdscr, color_pair, opts); +} + +int wattr_get(WINDOW *win, attr_t *attrs, short *color_pair, void *opts) +{ + PDC_LOG(("wattr_get() - called\n")); + + if (!win) + return ERR; + + if (attrs) + *attrs = win->_attrs & (A_ATTRIBUTES & ~A_COLOR); + + if (color_pair) + *color_pair = PAIR_NUMBER(win->_attrs); + + return OK; +} + +int attr_get(attr_t *attrs, short *color_pair, void *opts) +{ + PDC_LOG(("attr_get() - called\n")); + + return wattr_get(stdscr, attrs, color_pair, opts); +} + +int wattr_off(WINDOW *win, attr_t attrs, void *opts) +{ + PDC_LOG(("wattr_off() - called\n")); + + return wattroff(win, attrs); +} + +int attr_off(attr_t attrs, void *opts) +{ + PDC_LOG(("attr_off() - called\n")); + + return wattroff(stdscr, attrs); +} + +int wattr_on(WINDOW *win, attr_t attrs, void *opts) +{ + PDC_LOG(("wattr_off() - called\n")); + + return wattron(win, attrs); +} + +int attr_on(attr_t attrs, void *opts) +{ + PDC_LOG(("attr_on() - called\n")); + + return wattron(stdscr, attrs); +} + +int wattr_set(WINDOW *win, attr_t attrs, short color_pair, void *opts) +{ + PDC_LOG(("wattr_set() - called\n")); + + if (!win) + return ERR; + + win->_attrs = (attrs & (A_ATTRIBUTES & ~A_COLOR)) | COLOR_PAIR(color_pair); + + return OK; +} + +int attr_set(attr_t attrs, short color_pair, void *opts) +{ + PDC_LOG(("attr_get() - called\n")); + + return wattr_set(stdscr, attrs, color_pair, opts); +} + +int wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts) +{ + chtype *dest, newattr; + int startpos, endpos; + + PDC_LOG(("wchgat() - called\n")); + + if (!win) + return ERR; + + newattr = (attr & A_ATTRIBUTES) | COLOR_PAIR(color); + + startpos = win->_curx; + endpos = ((n < 0) ? win->_maxx : min(startpos + n, win->_maxx)) - 1; + dest = win->_y[win->_cury]; + + for (n = startpos; n <= endpos; n++) + dest[n] = (dest[n] & A_CHARTEXT) | newattr; + + n = win->_cury; + + if (startpos < win->_firstch[n] || win->_firstch[n] == _NO_CHANGE) + win->_firstch[n] = startpos; + + if (endpos > win->_lastch[n]) + win->_lastch[n] = endpos; + + PDC_sync(win); + + return OK; +} + +int chgat(int n, attr_t attr, short color, const void *opts) +{ + PDC_LOG(("chgat() - called\n")); + + return wchgat(stdscr, n, attr, color, opts); +} + +int mvchgat(int y, int x, int n, attr_t attr, short color, const void *opts) +{ + PDC_LOG(("mvchgat() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return wchgat(stdscr, n, attr, color, opts); +} + +int mvwchgat(WINDOW *win, int y, int x, int n, attr_t attr, short color, + const void *opts) +{ + PDC_LOG(("mvwchgat() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wchgat(win, n, attr, color, opts); +} + +int underend(void) +{ + PDC_LOG(("underend() - called\n")); + + return wattroff(stdscr, A_UNDERLINE); +} + +int wunderend(WINDOW *win) +{ + PDC_LOG(("wunderend() - called\n")); + + return wattroff(win, A_UNDERLINE); +} + +int underscore(void) +{ + PDC_LOG(("underscore() - called\n")); + + return wattron(stdscr, A_UNDERLINE); +} + +int wunderscore(WINDOW *win) +{ + PDC_LOG(("wunderscore() - called\n")); + + return wattron(win, A_UNDERLINE); +} diff --git a/vendor/pdcurses/pdcurses/beep.c b/vendor/pdcurses/pdcurses/beep.c new file mode 100644 index 0000000..65fe609 --- /dev/null +++ b/vendor/pdcurses/pdcurses/beep.c @@ -0,0 +1,76 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +beep +---- + +### Synopsis + + int beep(void); + int flash(void); + +### Description + + beep() sounds the audible bell on the terminal, if possible; if not, + it calls flash(). + + flash() "flashes" the screen, by inverting the foreground and + background of every cell, pausing, and then restoring the original + attributes. + +### Return Value + + These functions return ERR if called before initscr(), otherwise OK. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + beep | Y | Y | Y + flash | Y | Y | Y + +**man-end****************************************************************/ + +int beep(void) +{ + PDC_LOG(("beep() - called\n")); + + if (!SP) + return ERR; + + if (SP->audible) + PDC_beep(); + else + flash(); + + return OK; +} + +int flash(void) +{ + int z, y, x; + + PDC_LOG(("flash() - called\n")); + + if (!curscr) + return ERR; + + /* Reverse each cell; wait; restore the screen */ + + for (z = 0; z < 2; z++) + { + for (y = 0; y < LINES; y++) + for (x = 0; x < COLS; x++) + curscr->_y[y][x] ^= A_REVERSE; + + wrefresh(curscr); + + if (!z) + napms(50); + } + + return OK; +} diff --git a/vendor/pdcurses/pdcurses/bkgd.c b/vendor/pdcurses/pdcurses/bkgd.c new file mode 100644 index 0000000..3f44df3 --- /dev/null +++ b/vendor/pdcurses/pdcurses/bkgd.c @@ -0,0 +1,228 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +bkgd +---- + +### Synopsis + + int bkgd(chtype ch); + void bkgdset(chtype ch); + chtype getbkgd(WINDOW *win); + int wbkgd(WINDOW *win, chtype ch); + void wbkgdset(WINDOW *win, chtype ch); + + int bkgrnd(const cchar_t *wch); + void bkgrndset(const cchar_t *wch); + int getbkgrnd(cchar_t *wch); + int wbkgrnd(WINDOW *win, const cchar_t *wch); + void wbkgrndset(WINDOW *win, const cchar_t *wch); + int wgetbkgrnd(WINDOW *win, cchar_t *wch); + +### Description + + bkgdset() and wbkgdset() manipulate the background of a window. The + background is a chtype consisting of any combination of attributes + and a character; it is combined with each chtype added or inserted to + the window by waddch() or winsch(). Only the attribute part is used + to set the background of non-blank characters, while both character + and attributes are used for blank positions. + + bkgd() and wbkgd() not only change the background, but apply it + immediately to every cell in the window. + + wbkgrnd(), wbkgrndset() and wgetbkgrnd() are the "wide-character" + versions of these functions, taking a pointer to a cchar_t instead of + a chtype. However, in PDCurses, cchar_t and chtype are the same. + + The attributes that are defined with the attrset()/attron() set of + functions take precedence over the background attributes if there is + a conflict (e.g., different color pairs). + +### Return Value + + bkgd() and wbkgd() return OK, unless the window is NULL, in which + case they return ERR. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + bkgd | Y | Y | Y + bkgdset | Y | Y | Y + getbkgd | Y | Y | Y + wbkgd | Y | Y | Y + wbkgdset | Y | Y | Y + bkgrnd | Y | Y | Y + bkgrndset | Y | Y | Y + getbkgrnd | Y | Y | Y + wbkgrnd | Y | Y | Y + wbkgrndset | Y | Y | Y + wgetbkgrnd | Y | Y | Y + +**man-end****************************************************************/ + +int wbkgd(WINDOW *win, chtype ch) +{ + int x, y; + chtype oldcolr, oldch, newcolr, newch, colr, attr; + chtype oldattr = 0, newattr = 0; + chtype *winptr; + + PDC_LOG(("wbkgd() - called\n")); + + if (!win) + return ERR; + + if (win->_bkgd == ch) + return OK; + + oldcolr = win->_bkgd & A_COLOR; + if (oldcolr) + oldattr = (win->_bkgd & A_ATTRIBUTES) ^ oldcolr; + + oldch = win->_bkgd & A_CHARTEXT; + + wbkgdset(win, ch); + + newcolr = win->_bkgd & A_COLOR; + if (newcolr) + newattr = (win->_bkgd & A_ATTRIBUTES) ^ newcolr; + + newch = win->_bkgd & A_CHARTEXT; + + /* what follows is what seems to occur in the System V + implementation of this routine */ + + for (y = 0; y < win->_maxy; y++) + { + for (x = 0; x < win->_maxx; x++) + { + winptr = win->_y[y] + x; + + ch = *winptr; + + /* determine the colors and attributes of the character read + from the window */ + + colr = ch & A_COLOR; + attr = ch & (A_ATTRIBUTES ^ A_COLOR); + + /* if the color is the same as the old background color, + then make it the new background color, otherwise leave it */ + + if (colr == oldcolr) + colr = newcolr; + + /* remove any attributes (non color) from the character that + were part of the old background, then combine the + remaining ones with the new background */ + + attr ^= oldattr; + attr |= newattr; + + /* change character if it is there because it was the old + background character */ + + ch &= A_CHARTEXT; + if (ch == oldch) + ch = newch; + + ch |= (attr | colr); + + *winptr = ch; + + } + } + + touchwin(win); + PDC_sync(win); + return OK; +} + +int bkgd(chtype ch) +{ + PDC_LOG(("bkgd() - called\n")); + + return wbkgd(stdscr, ch); +} + +void wbkgdset(WINDOW *win, chtype ch) +{ + PDC_LOG(("wbkgdset() - called\n")); + + if (win) + { + if (!(ch & A_CHARTEXT)) + ch |= ' '; + + win->_bkgd = ch; + } +} + +void bkgdset(chtype ch) +{ + PDC_LOG(("bkgdset() - called\n")); + + wbkgdset(stdscr, ch); +} + +chtype getbkgd(WINDOW *win) +{ + PDC_LOG(("getbkgd() - called\n")); + + return win ? win->_bkgd : (chtype)ERR; +} + +#ifdef PDC_WIDE +int wbkgrnd(WINDOW *win, const cchar_t *wch) +{ + PDC_LOG(("wbkgrnd() - called\n")); + + return wch ? wbkgd(win, *wch) : ERR; +} + +int bkgrnd(const cchar_t *wch) +{ + PDC_LOG(("bkgrnd() - called\n")); + + return wbkgrnd(stdscr, wch); +} + +void wbkgrndset(WINDOW *win, const cchar_t *wch) +{ + PDC_LOG(("wbkgdset() - called\n")); + + if (wch) + wbkgdset(win, *wch); +} + +void bkgrndset(const cchar_t *wch) +{ + PDC_LOG(("bkgrndset() - called\n")); + + wbkgrndset(stdscr, wch); +} + +int wgetbkgrnd(WINDOW *win, cchar_t *wch) +{ + PDC_LOG(("wgetbkgrnd() - called\n")); + + if (!win || !wch) + return ERR; + + *wch = win->_bkgd; + + return OK; +} + +int getbkgrnd(cchar_t *wch) +{ + PDC_LOG(("getbkgrnd() - called\n")); + + return wgetbkgrnd(stdscr, wch); +} +#endif diff --git a/vendor/pdcurses/pdcurses/border.c b/vendor/pdcurses/pdcurses/border.c new file mode 100644 index 0000000..d8a81a1 --- /dev/null +++ b/vendor/pdcurses/pdcurses/border.c @@ -0,0 +1,418 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +border +------ + +### Synopsis + + int border(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, + chtype tr, chtype bl, chtype br); + int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, + chtype bs, chtype tl, chtype tr, chtype bl, chtype br); + int box(WINDOW *win, chtype verch, chtype horch); + int hline(chtype ch, int n); + int vline(chtype ch, int n); + int whline(WINDOW *win, chtype ch, int n); + int wvline(WINDOW *win, chtype ch, int n); + int mvhline(int y, int x, chtype ch, int n); + int mvvline(int y, int x, chtype ch, int n); + int mvwhline(WINDOW *win, int y, int x, chtype ch, int n); + int mvwvline(WINDOW *win, int y, int x, chtype ch, int n); + + int border_set(const cchar_t *ls, const cchar_t *rs, + const cchar_t *ts, const cchar_t *bs, + const cchar_t *tl, const cchar_t *tr, + const cchar_t *bl, const cchar_t *br); + int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs, + const cchar_t *ts, const cchar_t *bs, + const cchar_t *tl, const cchar_t *tr, + const cchar_t *bl, const cchar_t *br); + int box_set(WINDOW *win, const cchar_t *verch, const cchar_t *horch); + int hline_set(const cchar_t *wch, int n); + int vline_set(const cchar_t *wch, int n); + int whline_set(WINDOW *win, const cchar_t *wch, int n); + int wvline_set(WINDOW *win, const cchar_t *wch, int n); + int mvhline_set(int y, int x, const cchar_t *wch, int n); + int mvvline_set(int y, int x, const cchar_t *wch, int n); + int mvwhline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n); + int mvwvline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n); + +### Description + + border(), wborder(), and box() draw a border around the edge of the + window. If any argument is zero, an appropriate default is used: + + Name | Element | Default + :----|:------------------------------|:------------ + ls | left side of border | ACS_VLINE + rs | right side of border | ACS_VLINE + ts | top side of border | ACS_HLINE + bs | bottom side of border | ACS_HLINE + tl | top left corner of border | ACS_ULCORNER + tr | top right corner of border | ACS_URCORNER + bl | bottom left corner of border | ACS_LLCORNER + br | bottom right corner of border | ACS_LRCORNER + + hline() and whline() draw a horizontal line, using ch, starting from + the current cursor position. The cursor position does not change. The + line is at most n characters long, or as many as will fit in the + window. + + vline() and wvline() draw a vertical line, using ch, starting from + the current cursor position. The cursor position does not change. The + line is at most n characters long, or as many as will fit in the + window. + + The *_set functions are the "wide-character" versions, taking + pointers to cchar_t instead of chtype. Note that in PDCurses, chtype + and cchar_t are the same. + +### Return Value + + These functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + border | Y | Y | Y + wborder | Y | Y | Y + box | Y | Y | Y + hline | Y | Y | Y + vline | Y | Y | Y + whline | Y | Y | Y + wvline | Y | Y | Y + mvhline | Y | Y | Y + mvvline | Y | Y | Y + mvwhline | Y | Y | Y + mvwvline | Y | Y | Y + border_set | Y | Y | Y + wborder_set | Y | Y | Y + box_set | Y | Y | Y + hline_set | Y | Y | Y + vline_set | Y | Y | Y + whline_set | Y | Y | Y + wvline_set | Y | Y | Y + mvhline_set | Y | Y | Y + mvvline_set | Y | Y | Y + mvwhline_set | Y | Y | Y + mvwvline_set | Y | Y | Y + +**man-end****************************************************************/ + +/* _attr_passthru() -- Takes a single chtype 'ch' and checks if the + current attribute of window 'win', as set by wattrset(), and/or the + current background of win, as set by wbkgd(), should by combined with + it. Attributes set explicitly in ch take precedence. */ + +static chtype _attr_passthru(WINDOW *win, chtype ch) +{ + chtype attr; + + /* If the incoming character doesn't have its own attribute, then + use the current attributes for the window. If the incoming + character has attributes, but not a color component, OR the + attributes to the current attributes for the window. If the + incoming character has a color component, use only the attributes + from the incoming character. */ + + attr = ch & A_ATTRIBUTES; + if (!(attr & A_COLOR)) + attr |= win->_attrs; + + /* wrs (4/10/93) -- Apply the same sort of logic for the window + background, in that it only takes precedence if other color + attributes are not there. */ + + if (!(attr & A_COLOR)) + attr |= win->_bkgd & A_ATTRIBUTES; + else + attr |= win->_bkgd & (A_ATTRIBUTES ^ A_COLOR); + + ch = (ch & A_CHARTEXT) | attr; + + return ch; +} + +int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, + chtype tl, chtype tr, chtype bl, chtype br) +{ + int i, ymax, xmax; + + PDC_LOG(("wborder() - called\n")); + + if (!win) + return ERR; + + ymax = win->_maxy - 1; + xmax = win->_maxx - 1; + + ls = _attr_passthru(win, ls ? ls : ACS_VLINE); + rs = _attr_passthru(win, rs ? rs : ACS_VLINE); + ts = _attr_passthru(win, ts ? ts : ACS_HLINE); + bs = _attr_passthru(win, bs ? bs : ACS_HLINE); + tl = _attr_passthru(win, tl ? tl : ACS_ULCORNER); + tr = _attr_passthru(win, tr ? tr : ACS_URCORNER); + bl = _attr_passthru(win, bl ? bl : ACS_LLCORNER); + br = _attr_passthru(win, br ? br : ACS_LRCORNER); + + for (i = 1; i < xmax; i++) + { + win->_y[0][i] = ts; + win->_y[ymax][i] = bs; + } + + for (i = 1; i < ymax; i++) + { + win->_y[i][0] = ls; + win->_y[i][xmax] = rs; + } + + win->_y[0][0] = tl; + win->_y[0][xmax] = tr; + win->_y[ymax][0] = bl; + win->_y[ymax][xmax] = br; + + for (i = 0; i <= ymax; i++) + { + win->_firstch[i] = 0; + win->_lastch[i] = xmax; + } + + PDC_sync(win); + + return OK; +} + +int border(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, + chtype tr, chtype bl, chtype br) +{ + PDC_LOG(("border() - called\n")); + + return wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br); +} + +int box(WINDOW *win, chtype verch, chtype horch) +{ + PDC_LOG(("box() - called\n")); + + return wborder(win, verch, verch, horch, horch, 0, 0, 0, 0); +} + +int whline(WINDOW *win, chtype ch, int n) +{ + chtype *dest; + int startpos, endpos; + + PDC_LOG(("whline() - called\n")); + + if (!win || n < 1) + return ERR; + + startpos = win->_curx; + endpos = min(startpos + n, win->_maxx) - 1; + dest = win->_y[win->_cury]; + ch = _attr_passthru(win, ch ? ch : ACS_HLINE); + + for (n = startpos; n <= endpos; n++) + dest[n] = ch; + + n = win->_cury; + + if (startpos < win->_firstch[n] || win->_firstch[n] == _NO_CHANGE) + win->_firstch[n] = startpos; + + if (endpos > win->_lastch[n]) + win->_lastch[n] = endpos; + + PDC_sync(win); + + return OK; +} + +int hline(chtype ch, int n) +{ + PDC_LOG(("hline() - called\n")); + + return whline(stdscr, ch, n); +} + +int mvhline(int y, int x, chtype ch, int n) +{ + PDC_LOG(("mvhline() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return whline(stdscr, ch, n); +} + +int mvwhline(WINDOW *win, int y, int x, chtype ch, int n) +{ + PDC_LOG(("mvwhline() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return whline(win, ch, n); +} + +int wvline(WINDOW *win, chtype ch, int n) +{ + int endpos, x; + + PDC_LOG(("wvline() - called\n")); + + if (!win || n < 1) + return ERR; + + endpos = min(win->_cury + n, win->_maxy); + x = win->_curx; + + ch = _attr_passthru(win, ch ? ch : ACS_VLINE); + + for (n = win->_cury; n < endpos; n++) + { + win->_y[n][x] = ch; + + if (x < win->_firstch[n] || win->_firstch[n] == _NO_CHANGE) + win->_firstch[n] = x; + + if (x > win->_lastch[n]) + win->_lastch[n] = x; + } + + PDC_sync(win); + + return OK; +} + +int vline(chtype ch, int n) +{ + PDC_LOG(("vline() - called\n")); + + return wvline(stdscr, ch, n); +} + +int mvvline(int y, int x, chtype ch, int n) +{ + PDC_LOG(("mvvline() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return wvline(stdscr, ch, n); +} + +int mvwvline(WINDOW *win, int y, int x, chtype ch, int n) +{ + PDC_LOG(("mvwvline() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wvline(win, ch, n); +} + +#ifdef PDC_WIDE +int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs, + const cchar_t *ts, const cchar_t *bs, const cchar_t *tl, + const cchar_t *tr, const cchar_t *bl, const cchar_t *br) +{ + PDC_LOG(("wborder_set() - called\n")); + + return wborder(win, ls ? *ls : 0, rs ? *rs : 0, ts ? *ts : 0, + bs ? *bs : 0, tl ? *tl : 0, tr ? *tr : 0, + bl ? *bl : 0, br ? *br : 0); +} + +int border_set(const cchar_t *ls, const cchar_t *rs, const cchar_t *ts, + const cchar_t *bs, const cchar_t *tl, const cchar_t *tr, + const cchar_t *bl, const cchar_t *br) +{ + PDC_LOG(("border_set() - called\n")); + + return wborder_set(stdscr, ls, rs, ts, bs, tl, tr, bl, br); +} + +int box_set(WINDOW *win, const cchar_t *verch, const cchar_t *horch) +{ + PDC_LOG(("box_set() - called\n")); + + return wborder_set(win, verch, verch, horch, horch, + (const cchar_t *)NULL, (const cchar_t *)NULL, + (const cchar_t *)NULL, (const cchar_t *)NULL); +} + +int whline_set(WINDOW *win, const cchar_t *wch, int n) +{ + PDC_LOG(("whline_set() - called\n")); + + return wch ? whline(win, *wch, n) : ERR; +} + +int hline_set(const cchar_t *wch, int n) +{ + PDC_LOG(("hline_set() - called\n")); + + return whline_set(stdscr, wch, n); +} + +int mvhline_set(int y, int x, const cchar_t *wch, int n) +{ + PDC_LOG(("mvhline_set() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return whline_set(stdscr, wch, n); +} + +int mvwhline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n) +{ + PDC_LOG(("mvwhline_set() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return whline_set(win, wch, n); +} + +int wvline_set(WINDOW *win, const cchar_t *wch, int n) +{ + PDC_LOG(("wvline_set() - called\n")); + + return wch ? wvline(win, *wch, n) : ERR; +} + +int vline_set(const cchar_t *wch, int n) +{ + PDC_LOG(("vline_set() - called\n")); + + return wvline_set(stdscr, wch, n); +} + +int mvvline_set(int y, int x, const cchar_t *wch, int n) +{ + PDC_LOG(("mvvline_set() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return wvline_set(stdscr, wch, n); +} + +int mvwvline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n) +{ + PDC_LOG(("mvwvline_set() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wvline_set(win, wch, n); +} +#endif diff --git a/vendor/pdcurses/pdcurses/clear.c b/vendor/pdcurses/pdcurses/clear.c new file mode 100644 index 0000000..55c77ea --- /dev/null +++ b/vendor/pdcurses/pdcurses/clear.c @@ -0,0 +1,161 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +clear +----- + +### Synopsis + + int clear(void); + int wclear(WINDOW *win); + int erase(void); + int werase(WINDOW *win); + int clrtobot(void); + int wclrtobot(WINDOW *win); + int clrtoeol(void); + int wclrtoeol(WINDOW *win); + +### Description + + erase() and werase() copy blanks (i.e. the background chtype) to + every cell of the window. + + clear() and wclear() are similar to erase() and werase(), but they + also call clearok() to ensure that the the window is cleared on the + next wrefresh(). + + clrtobot() and wclrtobot() clear the window from the current cursor + position to the end of the window. + + clrtoeol() and wclrtoeol() clear the window from the current cursor + position to the end of the current line. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + clear | Y | Y | Y + wclear | Y | Y | Y + erase | Y | Y | Y + werase | Y | Y | Y + clrtobot | Y | Y | Y + wclrtobot | Y | Y | Y + clrtoeol | Y | Y | Y + wclrtoeol | Y | Y | Y + +**man-end****************************************************************/ + +int wclrtoeol(WINDOW *win) +{ + int x, y, minx; + chtype blank, *ptr; + + PDC_LOG(("wclrtoeol() - called: Row: %d Col: %d\n", + win->_cury, win->_curx)); + + if (!win) + return ERR; + + y = win->_cury; + x = win->_curx; + + /* wrs (4/10/93) account for window background */ + + blank = win->_bkgd; + + for (minx = x, ptr = &win->_y[y][x]; minx < win->_maxx; minx++, ptr++) + *ptr = blank; + + if (x < win->_firstch[y] || win->_firstch[y] == _NO_CHANGE) + win->_firstch[y] = x; + + win->_lastch[y] = win->_maxx - 1; + + PDC_sync(win); + return OK; +} + +int clrtoeol(void) +{ + PDC_LOG(("clrtoeol() - called\n")); + + return wclrtoeol(stdscr); +} + +int wclrtobot(WINDOW *win) +{ + int savey, savex; + + PDC_LOG(("wclrtobot() - called\n")); + + if (!win) + return ERR; + + savey = win->_cury; + savex = win->_curx; + + /* should this involve scrolling region somehow ? */ + + if (win->_cury + 1 < win->_maxy) + { + win->_curx = 0; + win->_cury++; + for (; win->_maxy > win->_cury; win->_cury++) + wclrtoeol(win); + win->_cury = savey; + win->_curx = savex; + } + wclrtoeol(win); + + PDC_sync(win); + return OK; +} + +int clrtobot(void) +{ + PDC_LOG(("clrtobot() - called\n")); + + return wclrtobot(stdscr); +} + +int werase(WINDOW *win) +{ + PDC_LOG(("werase() - called\n")); + + if (wmove(win, 0, 0) == ERR) + return ERR; + + return wclrtobot(win); +} + +int erase(void) +{ + PDC_LOG(("erase() - called\n")); + + return werase(stdscr); +} + +int wclear(WINDOW *win) +{ + PDC_LOG(("wclear() - called\n")); + + if (!win) + return ERR; + + win->_clear = TRUE; + return werase(win); +} + +int clear(void) +{ + PDC_LOG(("clear() - called\n")); + + return wclear(stdscr); +} diff --git a/vendor/pdcurses/pdcurses/color.c b/vendor/pdcurses/pdcurses/color.c new file mode 100644 index 0000000..f0fc4b2 --- /dev/null +++ b/vendor/pdcurses/pdcurses/color.c @@ -0,0 +1,364 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +color +----- + +### Synopsis + + bool has_colors(void); + int start_color(void); + int init_pair(short pair, short fg, short bg); + int pair_content(short pair, short *fg, short *bg); + bool can_change_color(void); + int init_color(short color, short red, short green, short blue); + int color_content(short color, short *red, short *green, short *blue); + + int alloc_pair(int fg, int bg); + int assume_default_colors(int f, int b); + int find_pair(int fg, int bg); + int free_pair(int pair); + int use_default_colors(void); + + int PDC_set_line_color(short color); + +### Description + + To use these routines, first, call start_color(). Colors are always + used in pairs, referred to as color-pairs. A color-pair is created by + init_pair(), and consists of a foreground color and a background + color. After initialization, COLOR_PAIR(n) can be used like any other + video attribute. + + has_colors() reports whether the terminal supports color. + + start_color() initializes eight basic colors (black, red, green, + yellow, blue, magenta, cyan, and white), and two global variables: + COLORS and COLOR_PAIRS (respectively defining the maximum number of + colors and color-pairs the terminal is capable of displaying). + + init_pair() changes the definition of a color-pair. It takes three + arguments: the number of the color-pair to be redefined, and the new + values of the foreground and background colors. The pair number must + be between 0 and COLOR_PAIRS - 1, inclusive. The foreground and + background must be between 0 and COLORS - 1, inclusive. If the color + pair was previously initialized, the screen is refreshed, and all + occurrences of that color-pair are changed to the new definition. + + pair_content() is used to determine what the colors of a given color- + pair consist of. + + can_change_color() indicates if the terminal has the capability to + change the definition of its colors. + + init_color() is used to redefine a color, if possible. Each of the + components -- red, green, and blue -- is specified in a range from 0 + to 1000, inclusive. + + color_content() reports the current definition of a color in the same + format as used by init_color(). + + assume_default_colors() and use_default_colors() emulate the ncurses + extensions of the same names. assume_default_colors(f, b) is + essentially the same as init_pair(0, f, b) (which isn't allowed); it + redefines the default colors. use_default_colors() allows the use of + -1 as a foreground or background color with init_pair(), and calls + assume_default_colors(-1, -1); -1 represents the foreground or + background color that the terminal had at startup. If the environment + variable PDC_ORIGINAL_COLORS is set at the time start_color() is + called, that's equivalent to calling use_default_colors(). + + alloc_pair(), find_pair() and free_pair() are also from ncurses. + free_pair() marks a pair as unused; find_pair() returns an existing + pair with the specified foreground and background colors, if one + exists. And alloc_pair() returns such a pair whether or not it was + previously set, overwriting the oldest initialized pair if there are + no free pairs. + + PDC_set_line_color() is used to set the color, globally, for the + color of the lines drawn for the attributes: A_UNDERLINE, A_LEFT and + A_RIGHT. A value of -1 (the default) indicates that the current + foreground color should be used. + + NOTE: COLOR_PAIR() and PAIR_NUMBER() are implemented as macros. + +### Return Value + + Most functions return OK on success and ERR on error. has_colors() + and can_change_colors() return TRUE or FALSE. alloc_pair() and + find_pair() return a pair number, or -1 on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + has_colors | Y | Y | Y + start_color | Y | Y | Y + init_pair | Y | Y | Y + pair_content | Y | Y | Y + can_change_color | Y | Y | Y + init_color | Y | Y | Y + color_content | Y | Y | Y + alloc_pair | - | Y | - + assume_default_colors | - | Y | Y + find_pair | - | Y | - + free_pair | - | Y | - + use_default_colors | - | Y | Y + PDC_set_line_color | - | - | - + +**man-end****************************************************************/ + +#include +#include + +int COLORS = 0; +int COLOR_PAIRS = PDC_COLOR_PAIRS; + +static bool default_colors = FALSE; +static short first_col = 0; +static int allocnum = 0; + +int start_color(void) +{ + PDC_LOG(("start_color() - called\n")); + + if (!SP || SP->mono) + return ERR; + + SP->color_started = TRUE; + + PDC_set_blink(FALSE); /* Also sets COLORS */ + + if (!default_colors && SP->orig_attr && getenv("PDC_ORIGINAL_COLORS")) + default_colors = TRUE; + + PDC_init_atrtab(); + + return OK; +} + +static void _normalize(short *fg, short *bg) +{ + if (*fg == -1) + *fg = SP->orig_attr ? SP->orig_fore : COLOR_WHITE; + + if (*bg == -1) + *bg = SP->orig_attr ? SP->orig_back : COLOR_BLACK; +} + +static void _init_pair_core(short pair, short fg, short bg) +{ + PDC_PAIR *p = SP->atrtab + pair; + + _normalize(&fg, &bg); + + /* To allow the PDC_PRESERVE_SCREEN option to work, we only reset + curscr if this call to init_pair() alters a color pair created by + the user. */ + + if (p->set) + { + if (p->f != fg || p->b != bg) + curscr->_clear = TRUE; + } + + p->f = fg; + p->b = bg; + p->count = allocnum++; + p->set = TRUE; +} + +int init_pair(short pair, short fg, short bg) +{ + PDC_LOG(("init_pair() - called: pair %d fg %d bg %d\n", pair, fg, bg)); + + if (!SP || !SP->color_started || pair < 1 || pair >= COLOR_PAIRS || + fg < first_col || fg >= COLORS || bg < first_col || bg >= COLORS) + return ERR; + + _init_pair_core(pair, fg, bg); + + return OK; +} + +bool has_colors(void) +{ + PDC_LOG(("has_colors() - called\n")); + + return SP ? !(SP->mono) : FALSE; +} + +int init_color(short color, short red, short green, short blue) +{ + PDC_LOG(("init_color() - called\n")); + + if (!SP || color < 0 || color >= COLORS || !PDC_can_change_color() || + red < -1 || red > 1000 || green < -1 || green > 1000 || + blue < -1 || blue > 1000) + return ERR; + + SP->dirty = TRUE; + + return PDC_init_color(color, red, green, blue); +} + +int color_content(short color, short *red, short *green, short *blue) +{ + PDC_LOG(("color_content() - called\n")); + + if (color < 0 || color >= COLORS || !red || !green || !blue) + return ERR; + + if (PDC_can_change_color()) + return PDC_color_content(color, red, green, blue); + else + { + /* Simulated values for platforms that don't support palette + changing */ + + short maxval = (color & 8) ? 1000 : 680; + + *red = (color & COLOR_RED) ? maxval : 0; + *green = (color & COLOR_GREEN) ? maxval : 0; + *blue = (color & COLOR_BLUE) ? maxval : 0; + + return OK; + } +} + +bool can_change_color(void) +{ + PDC_LOG(("can_change_color() - called\n")); + + return PDC_can_change_color(); +} + +int pair_content(short pair, short *fg, short *bg) +{ + PDC_LOG(("pair_content() - called\n")); + + if (pair < 0 || pair >= COLOR_PAIRS || !fg || !bg) + return ERR; + + *fg = SP->atrtab[pair].f; + *bg = SP->atrtab[pair].b; + + return OK; +} + +int assume_default_colors(int f, int b) +{ + PDC_LOG(("assume_default_colors() - called: f %d b %d\n", f, b)); + + if (f < -1 || f >= COLORS || b < -1 || b >= COLORS) + return ERR; + + if (SP->color_started) + _init_pair_core(0, f, b); + + return OK; +} + +int use_default_colors(void) +{ + PDC_LOG(("use_default_colors() - called\n")); + + default_colors = TRUE; + first_col = -1; + + return assume_default_colors(-1, -1); +} + +int PDC_set_line_color(short color) +{ + PDC_LOG(("PDC_set_line_color() - called: %d\n", color)); + + if (!SP || color < -1 || color >= COLORS) + return ERR; + + SP->line_color = color; + + return OK; +} + +void PDC_init_atrtab(void) +{ + PDC_PAIR *p = SP->atrtab; + short i, fg, bg; + + if (SP->color_started && !default_colors) + { + fg = COLOR_WHITE; + bg = COLOR_BLACK; + } + else + fg = bg = -1; + + _normalize(&fg, &bg); + + for (i = 0; i < PDC_COLOR_PAIRS; i++) + { + p[i].f = fg; + p[i].b = bg; + p[i].set = FALSE; + } +} + +int free_pair(int pair) +{ + if (pair < 1 || pair >= PDC_COLOR_PAIRS || !(SP->atrtab[pair].set)) + return ERR; + + SP->atrtab[pair].set = FALSE; + return OK; +} + +int find_pair(int fg, int bg) +{ + int i; + PDC_PAIR *p = SP->atrtab; + + for (i = 0; i < PDC_COLOR_PAIRS; i++) + if (p[i].set && p[i].f == fg && p[i].b == bg) + return i; + + return -1; +} + +static int _find_oldest() +{ + int i, lowind = 0, lowval = 0; + PDC_PAIR *p = SP->atrtab; + + for (i = 1; i < PDC_COLOR_PAIRS; i++) + { + if (!p[i].set) + return i; + + if (!lowval || (p[i].count < lowval)) + { + lowind = i; + lowval = p[i].count; + } + } + + return lowind; +} + +int alloc_pair(int fg, int bg) +{ + int i = find_pair(fg, bg); + + if (-1 == i) + { + i = _find_oldest(); + + if (ERR == init_pair(i, fg, bg)) + return -1; + } + + return i; +} diff --git a/vendor/pdcurses/pdcurses/debug.c b/vendor/pdcurses/pdcurses/debug.c new file mode 100644 index 0000000..330ef2b --- /dev/null +++ b/vendor/pdcurses/pdcurses/debug.c @@ -0,0 +1,108 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +debug +----- + +### Synopsis + + void traceon(void); + void traceoff(void); + void PDC_debug(const char *, ...); + +### Description + + traceon() and traceoff() toggle the recording of debugging + information to the file "trace". Although not standard, similar + functions are in some other curses implementations. + + PDC_debug() is the function that writes to the file, based on whether + traceon() has been called. It's used from the PDC_LOG() macro. + + The environment variable PDC_TRACE_FLUSH controls whether the trace + file contents are fflushed after each write. The default is not. Set + it to enable this (may affect performance). + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + traceon | - | - | - + traceoff | - | - | - + PDC_debug | - | - | - + +**man-end****************************************************************/ + +#include +#include +#include +#include + +static bool want_fflush = FALSE; + +void PDC_debug(const char *fmt, ...) +{ + va_list args; + char hms[9]; + time_t now; + + if (!SP || !SP->dbfp) + return; + + time(&now); + strftime(hms, 9, "%H:%M:%S", localtime(&now)); + fprintf(SP->dbfp, "At: %8.8ld - %s ", (long) clock(), hms); + + va_start(args, fmt); + vfprintf(SP->dbfp, fmt, args); + va_end(args); + + /* If you are crashing and losing debugging information, enable this + by setting the environment variable PDC_TRACE_FLUSH. This may + impact performance. */ + + if (want_fflush) + fflush(SP->dbfp); + + /* If with PDC_TRACE_FLUSH enabled you are still losing logging in + crashes, you may need to add a platform-dependent mechanism to + flush the OS buffers as well (such as fsync() on POSIX) -- but + expect terrible performance. */ +} + +void traceon(void) +{ + if (!SP) + return; + + if (SP->dbfp) + fclose(SP->dbfp); + + /* open debug log file append */ + SP->dbfp = fopen("trace", "a"); + if (!SP->dbfp) + { + fprintf(stderr, "PDC_debug(): Unable to open debug log file\n"); + return; + } + + if (getenv("PDC_TRACE_FLUSH")) + want_fflush = TRUE; + + PDC_LOG(("traceon() - called\n")); +} + +void traceoff(void) +{ + if (!SP || !SP->dbfp) + return; + + PDC_LOG(("traceoff() - called\n")); + + fclose(SP->dbfp); + SP->dbfp = NULL; + want_fflush = FALSE; +} diff --git a/vendor/pdcurses/pdcurses/delch.c b/vendor/pdcurses/pdcurses/delch.c new file mode 100644 index 0000000..861648b --- /dev/null +++ b/vendor/pdcurses/pdcurses/delch.c @@ -0,0 +1,98 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +delch +----- + +### Synopsis + + int delch(void); + int wdelch(WINDOW *win); + int mvdelch(int y, int x); + int mvwdelch(WINDOW *win, int y, int x); + +### Description + + The character under the cursor in the window is deleted. All + characters to the right on the same line are moved to the left one + position and the last character on the line is filled with a blank. + The cursor position does not change (after moving to y, x if + coordinates are specified). + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + delch | Y | Y | Y + wdelch | Y | Y | Y + mvdelch | Y | Y | Y + mvwdelch | Y | Y | Y + +**man-end****************************************************************/ + +#include + +int wdelch(WINDOW *win) +{ + int y, x, maxx; + chtype *temp1; + + PDC_LOG(("wdelch() - called\n")); + + if (!win) + return ERR; + + y = win->_cury; + x = win->_curx; + maxx = win->_maxx - 1; + temp1 = &win->_y[y][x]; + + memmove(temp1, temp1 + 1, (maxx - x) * sizeof(chtype)); + + /* wrs (4/10/93) account for window background */ + + win->_y[y][maxx] = win->_bkgd; + + win->_lastch[y] = maxx; + + if ((win->_firstch[y] == _NO_CHANGE) || (win->_firstch[y] > x)) + win->_firstch[y] = x; + + PDC_sync(win); + + return OK; +} + +int delch(void) +{ + PDC_LOG(("delch() - called\n")); + + return wdelch(stdscr); +} + +int mvdelch(int y, int x) +{ + PDC_LOG(("mvdelch() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return wdelch(stdscr); +} + +int mvwdelch(WINDOW *win, int y, int x) +{ + PDC_LOG(("mvwdelch() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wdelch(win); +} diff --git a/vendor/pdcurses/pdcurses/deleteln.c b/vendor/pdcurses/pdcurses/deleteln.c new file mode 100644 index 0000000..007a34f --- /dev/null +++ b/vendor/pdcurses/pdcurses/deleteln.c @@ -0,0 +1,213 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +deleteln +-------- + +### Synopsis + + int deleteln(void); + int wdeleteln(WINDOW *win); + int insdelln(int n); + int winsdelln(WINDOW *win, int n); + int insertln(void); + int winsertln(WINDOW *win); + + int mvdeleteln(int y, int x); + int mvwdeleteln(WINDOW *win, int y, int x); + int mvinsertln(int y, int x); + int mvwinsertln(WINDOW *win, int y, int x); + +### Description + + With the deleteln() and wdeleteln() functions, the line under the + cursor in the window is deleted. All lines below the current line are + moved up one line. The bottom line of the window is cleared. The + cursor position does not change. + + With the insertln() and winsertn() functions, a blank line is + inserted above the current line and the bottom line is lost. + + mvdeleteln(), mvwdeleteln(), mvinsertln() and mvwinsertln() allow + moving the cursor and inserting/deleting in one call. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + deleteln | Y | Y | Y + wdeleteln | Y | Y | Y + mvdeleteln | - | - | - + mvwdeleteln | - | - | - + insdelln | Y | Y | Y + winsdelln | Y | Y | Y + insertln | Y | Y | Y + winsertln | Y | Y | Y + mvinsertln | - | - | - + mvwinsertln | - | - | - + +**man-end****************************************************************/ + +int wdeleteln(WINDOW *win) +{ + chtype blank, *temp, *ptr; + int y; + + PDC_LOG(("wdeleteln() - called\n")); + + if (!win) + return ERR; + + /* wrs (4/10/93) account for window background */ + + blank = win->_bkgd; + + temp = win->_y[win->_cury]; + + for (y = win->_cury; y < win->_bmarg; y++) + { + win->_y[y] = win->_y[y + 1]; + win->_firstch[y] = 0; + win->_lastch[y] = win->_maxx - 1; + } + + for (ptr = temp; (ptr - temp < win->_maxx); ptr++) + *ptr = blank; /* make a blank line */ + + if (win->_cury <= win->_bmarg) + { + win->_firstch[win->_bmarg] = 0; + win->_lastch[win->_bmarg] = win->_maxx - 1; + win->_y[win->_bmarg] = temp; + } + + return OK; +} + +int deleteln(void) +{ + PDC_LOG(("deleteln() - called\n")); + + return wdeleteln(stdscr); +} + +int mvdeleteln(int y, int x) +{ + PDC_LOG(("mvdeleteln() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return wdeleteln(stdscr); +} + +int mvwdeleteln(WINDOW *win, int y, int x) +{ + PDC_LOG(("mvwdeleteln() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wdeleteln(win); +} + +int winsdelln(WINDOW *win, int n) +{ + int i; + + PDC_LOG(("winsdelln() - called\n")); + + if (!win) + return ERR; + + if (n > 0) + { + for (i = 0; i < n; i++) + if (winsertln(win) == ERR) + return ERR; + } + else if (n < 0) + { + n = -n; + for (i = 0; i < n; i++) + if (wdeleteln(win) == ERR) + return ERR; + } + + return OK; +} + +int insdelln(int n) +{ + PDC_LOG(("insdelln() - called\n")); + + return winsdelln(stdscr, n); +} + +int winsertln(WINDOW *win) +{ + chtype blank, *temp, *end; + int y; + + PDC_LOG(("winsertln() - called\n")); + + if (!win) + return ERR; + + /* wrs (4/10/93) account for window background */ + + blank = win->_bkgd; + + temp = win->_y[win->_maxy - 1]; + + for (y = win->_maxy - 1; y > win->_cury; y--) + { + win->_y[y] = win->_y[y - 1]; + win->_firstch[y] = 0; + win->_lastch[y] = win->_maxx - 1; + } + + win->_y[win->_cury] = temp; + + for (end = &temp[win->_maxx - 1]; temp <= end; temp++) + *temp = blank; + + win->_firstch[win->_cury] = 0; + win->_lastch[win->_cury] = win->_maxx - 1; + + return OK; +} + +int insertln(void) +{ + PDC_LOG(("insertln() - called\n")); + + return winsertln(stdscr); +} + +int mvinsertln(int y, int x) +{ + PDC_LOG(("mvinsertln() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return winsertln(stdscr); +} + +int mvwinsertln(WINDOW *win, int y, int x) +{ + PDC_LOG(("mvwinsertln() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return winsertln(win); +} diff --git a/vendor/pdcurses/pdcurses/getch.c b/vendor/pdcurses/pdcurses/getch.c new file mode 100644 index 0000000..209f5c6 --- /dev/null +++ b/vendor/pdcurses/pdcurses/getch.c @@ -0,0 +1,591 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +getch +----- + +### Synopsis + + int getch(void); + int wgetch(WINDOW *win); + int mvgetch(int y, int x); + int mvwgetch(WINDOW *win, int y, int x); + int ungetch(int ch); + int flushinp(void); + + int get_wch(wint_t *wch); + int wget_wch(WINDOW *win, wint_t *wch); + int mvget_wch(int y, int x, wint_t *wch); + int mvwget_wch(WINDOW *win, int y, int x, wint_t *wch); + int unget_wch(const wchar_t wch); + + unsigned long PDC_get_key_modifiers(void); + int PDC_return_key_modifiers(bool flag); + +### Description + + With the getch(), wgetch(), mvgetch(), and mvwgetch() functions, a + character is read from the terminal associated with the window. In + nodelay mode, if there is no input waiting, the value ERR is + returned. In delay mode, the program will hang until the system + passes text through to the program. Depending on the setting of + cbreak(), this will be after one character or after the first + newline. Unless noecho() has been set, the character will also be + echoed into the designated window. + + If keypad() is TRUE, and a function key is pressed, the token for + that function key will be returned instead of the raw characters. + Possible function keys are defined in with integers + beginning with 0401, whose names begin with KEY_. + + If nodelay(win, TRUE) has been called on the window and no input is + waiting, the value ERR is returned. + + ungetch() places ch back onto the input queue to be returned by the + next call to wgetch(). + + flushinp() throws away any type-ahead that has been typed by the user + and has not yet been read by the program. + + wget_wch() is the wide-character version of wgetch(), available when + PDCurses is built with the PDC_WIDE option. It takes a pointer to a + wint_t rather than returning the key as an int, and instead returns + KEY_CODE_YES if the key is a function key. Otherwise, it returns OK + or ERR. It's important to check for KEY_CODE_YES, since regular wide + characters can have the same values as function key codes. + + unget_wch() puts a wide character on the input queue. + + PDC_get_key_modifiers() returns the keyboard modifiers (shift, + control, alt, numlock) effective at the time of the last getch() + call. Use the macros PDC_KEY_MODIFIER_* to determine which + modifier(s) were set. PDC_return_key_modifiers() tells getch() to + return modifier keys pressed alone as keystrokes (KEY_ALT_L, etc.). + These may not work on all platforms. + + NOTE: getch() and ungetch() are implemented as macros, to avoid + conflict with many DOS compiler's runtime libraries. + +### Return Value + + These functions return ERR or the value of the character, meta + character or function key token. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + getch | Y | Y | Y + wgetch | Y | Y | Y + mvgetch | Y | Y | Y + mvwgetch | Y | Y | Y + ungetch | Y | Y | Y + flushinp | Y | Y | Y + get_wch | Y | Y | Y + wget_wch | Y | Y | Y + mvget_wch | Y | Y | Y + mvwget_wch | Y | Y | Y + unget_wch | Y | Y | Y + PDC_get_key_modifiers | - | - | - + +**man-end****************************************************************/ + +#include + +static int _get_box(int *y_start, int *y_end, int *x_start, int *x_end) +{ + int start, end; + + if (SP->sel_start < SP->sel_end) + { + start = SP->sel_start; + end = SP->sel_end; + } + else + { + start = SP->sel_end; + end = SP->sel_start; + } + + *y_start = start / COLS; + *x_start = start % COLS; + + *y_end = end / COLS; + *x_end = end % COLS; + + return (end - start) + (*y_end - *y_start); +} + +static void _highlight(void) +{ + int i, j, y_start, y_end, x_start, x_end; + + if (-1 == SP->sel_start) + return; + + _get_box(&y_start, &y_end, &x_start, &x_end); + + for (j = y_start; j <= y_end; j++) + for (i = (j == y_start ? x_start : 0); + i < (j == y_end ? x_end : COLS); i++) + curscr->_y[j][i] ^= A_REVERSE; + + wrefresh(curscr); +} + +static void _copy(void) +{ +#ifdef PDC_WIDE + wchar_t *wtmp; +# define TMP wtmp +# define MASK A_CHARTEXT +#else +# define TMP tmp +# define MASK 0xff +#endif + char *tmp; + long pos; + int i, j, y_start, y_end, x_start, x_end, len; + + if (-1 == SP->sel_start) + return; + + len = _get_box(&y_start, &y_end, &x_start, &x_end); + + if (!len) + return; + +#ifdef PDC_WIDE + wtmp = malloc((len + 1) * sizeof(wchar_t)); + len *= 4; +#endif + tmp = malloc(len + 1); + + for (j = y_start, pos = 0; j <= y_end; j++) + { + for (i = (j == y_start ? x_start : 0); + i < (j == y_end ? x_end : COLS); i++) + TMP[pos++] = curscr->_y[j][i] & MASK; + + while (y_start != y_end && pos > 0 && TMP[pos - 1] == 32) + pos--; + + if (j < y_end) + TMP[pos++] = 10; + } + TMP[pos] = 0; + +#ifdef PDC_WIDE + pos = PDC_wcstombs(tmp, wtmp, len); +#endif + + PDC_setclipboard(tmp, pos); + free(tmp); +#ifdef PDC_WIDE + free(wtmp); +#endif +} + +static int _paste(void) +{ +#ifdef PDC_WIDE + wchar_t *wpaste; +# define PASTE wpaste +#else +# define PASTE paste +#endif + char *paste; + long len, newmax; + int key; + + key = PDC_getclipboard(&paste, &len); + if (PDC_CLIP_SUCCESS != key || !len) + return -1; + +#ifdef PDC_WIDE + wpaste = malloc(len * sizeof(wchar_t)); + len = PDC_mbstowcs(wpaste, paste, len); +#endif + newmax = len + SP->c_ungind; + if (newmax > SP->c_ungmax) + { + SP->c_ungch = realloc(SP->c_ungch, newmax * sizeof(int)); + if (!SP->c_ungch) + return -1; + SP->c_ungmax = newmax; + } + while (len > 1) + PDC_ungetch(PASTE[--len]); + key = *PASTE; +#ifdef PDC_WIDE + free(wpaste); +#endif + PDC_freeclipboard(paste); + SP->key_modifiers = 0; + + return key; +} + +static int _mouse_key(void) +{ + int i, key = KEY_MOUSE, changes = SP->mouse_status.changes; + unsigned long mbe = SP->_trap_mbe; + + /* Selection highlighting? */ + + if ((!mbe || SP->mouse_status.button[0] & BUTTON_SHIFT) && changes & 1) + { + i = SP->mouse_status.y * COLS + SP->mouse_status.x; + switch (SP->mouse_status.button[0] & BUTTON_ACTION_MASK) + { + case BUTTON_PRESSED: + _highlight(); + SP->sel_start = SP->sel_end = i; + return -1; + case BUTTON_MOVED: + _highlight(); + SP->sel_end = i; + _highlight(); + return -1; + case BUTTON_RELEASED: + _copy(); + return -1; + } + } + else if ((!mbe || SP->mouse_status.button[1] & BUTTON_SHIFT) && + changes & 2 && (SP->mouse_status.button[1] & + BUTTON_ACTION_MASK) == BUTTON_CLICKED) + { + SP->key_code = FALSE; + return _paste(); + } + + /* Filter unwanted mouse events */ + + for (i = 0; i < 3; i++) + { + if (changes & (1 << i)) + { + int shf = i * 5; + short button = SP->mouse_status.button[i] & BUTTON_ACTION_MASK; + + if ( (!(mbe & (BUTTON1_PRESSED << shf)) && + (button == BUTTON_PRESSED)) + + || (!(mbe & (BUTTON1_CLICKED << shf)) && + (button == BUTTON_CLICKED)) + + || (!(mbe & (BUTTON1_DOUBLE_CLICKED << shf)) && + (button == BUTTON_DOUBLE_CLICKED)) + + || (!(mbe & (BUTTON1_MOVED << shf)) && + (button == BUTTON_MOVED)) + + || (!(mbe & (BUTTON1_RELEASED << shf)) && + (button == BUTTON_RELEASED)) + ) + SP->mouse_status.changes ^= (1 << i); + } + } + + if (changes & PDC_MOUSE_MOVED) + { + if (!(mbe & (BUTTON1_MOVED|BUTTON2_MOVED|BUTTON3_MOVED))) + SP->mouse_status.changes ^= PDC_MOUSE_MOVED; + } + + if (changes & (PDC_MOUSE_WHEEL_UP|PDC_MOUSE_WHEEL_DOWN)) + { + if (!(mbe & MOUSE_WHEEL_SCROLL)) + SP->mouse_status.changes &= + ~(PDC_MOUSE_WHEEL_UP|PDC_MOUSE_WHEEL_DOWN); + } + + if (!changes) + return -1; + + /* Check for click in slk area */ + + i = PDC_mouse_in_slk(SP->mouse_status.y, SP->mouse_status.x); + + if (i) + { + if (SP->mouse_status.button[0] & (BUTTON_PRESSED|BUTTON_CLICKED)) + key = KEY_F(i); + else + key = -1; + } + + return key; +} + +int wgetch(WINDOW *win) +{ + int key, waitcount; + + PDC_LOG(("wgetch() - called\n")); + + if (!win || !SP) + return ERR; + + waitcount = 0; + + /* set the number of 1/20th second napms() calls */ + + if (SP->delaytenths) + waitcount = 2 * SP->delaytenths; + else + if (win->_delayms) + { + /* Can't really do millisecond intervals, so delay in + 1/20ths of a second (50ms) */ + + waitcount = win->_delayms / 50; + if (!waitcount) + waitcount = 1; + } + + /* refresh window when wgetch is called if there have been changes + to it and it is not a pad */ + + if (!(win->_flags & _PAD) && ((!win->_leaveit && + (win->_begx + win->_curx != SP->curscol || + win->_begy + win->_cury != SP->cursrow)) || is_wintouched(win))) + wrefresh(win); + + /* if ungotten char exists, remove and return it */ + + if (SP->c_ungind) + return SP->c_ungch[--(SP->c_ungind)]; + + /* if normal and data in buffer */ + + if ((!SP->raw_inp && !SP->cbreak) && (SP->c_gindex < SP->c_pindex)) + return SP->c_buffer[SP->c_gindex++]; + + /* prepare to buffer data */ + + SP->c_pindex = 0; + SP->c_gindex = 0; + + /* to get here, no keys are buffered. go and get one. */ + + for (;;) /* loop for any buffering */ + { + /* is there a keystroke ready? */ + + if (!PDC_check_key()) + { + /* if not, handle timeout() and halfdelay() */ + + if (SP->delaytenths || win->_delayms) + { + if (!waitcount) + return ERR; + + waitcount--; + } + else + if (win->_nodelay) + return ERR; + + napms(50); /* sleep for 1/20th second */ + continue; /* then check again */ + } + + /* if there is, fetch it */ + + key = PDC_get_key(); + + /* copy or paste? */ + + if (SP->key_modifiers & PDC_KEY_MODIFIER_SHIFT) + { + if (0x03 == key) + { + _copy(); + continue; + } + else if (0x16 == key) + key = _paste(); + } + + /* filter mouse events; translate mouse clicks in the slk + area to function keys */ + + if (SP->key_code && key == KEY_MOUSE) + key = _mouse_key(); + + /* filter special keys if not in keypad mode */ + + if (SP->key_code && !win->_use_keypad) + key = -1; + + /* unwanted key? loop back */ + + if (key == -1) + continue; + + _highlight(); + SP->sel_start = SP->sel_end = -1; + + /* translate CR */ + + if (key == '\r' && SP->autocr && !SP->raw_inp) + key = '\n'; + + /* if echo is enabled */ + + if (SP->echo && !SP->key_code) + { + waddch(win, key); + wrefresh(win); + } + + /* if no buffering */ + + if (SP->raw_inp || SP->cbreak) + return key; + + /* if no overflow, put data in buffer */ + + if (key == '\b') + { + if (SP->c_pindex > SP->c_gindex) + SP->c_pindex--; + } + else + if (SP->c_pindex < _INBUFSIZ - 2) + SP->c_buffer[SP->c_pindex++] = key; + + /* if we got a line */ + + if (key == '\n' || key == '\r') + return SP->c_buffer[SP->c_gindex++]; + } +} + +int mvgetch(int y, int x) +{ + PDC_LOG(("mvgetch() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return wgetch(stdscr); +} + +int mvwgetch(WINDOW *win, int y, int x) +{ + PDC_LOG(("mvwgetch() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wgetch(win); +} + +int PDC_ungetch(int ch) +{ + PDC_LOG(("ungetch() - called\n")); + + if (SP->c_ungind >= SP->c_ungmax) /* pushback stack full */ + return ERR; + + SP->c_ungch[SP->c_ungind++] = ch; + + return OK; +} + +int flushinp(void) +{ + PDC_LOG(("flushinp() - called\n")); + + if (!SP) + return ERR; + + PDC_flushinp(); + + SP->c_gindex = 1; /* set indices to kill buffer */ + SP->c_pindex = 0; + SP->c_ungind = 0; /* clear SP->c_ungch array */ + + return OK; +} + +unsigned long PDC_get_key_modifiers(void) +{ + PDC_LOG(("PDC_get_key_modifiers() - called\n")); + + if (!SP) + return ERR; + + return SP->key_modifiers; +} + +int PDC_return_key_modifiers(bool flag) +{ + PDC_LOG(("PDC_return_key_modifiers() - called\n")); + + if (!SP) + return ERR; + + SP->return_key_modifiers = flag; + return PDC_modifiers_set(); +} + +#ifdef PDC_WIDE +int wget_wch(WINDOW *win, wint_t *wch) +{ + int key; + + PDC_LOG(("wget_wch() - called\n")); + + if (!wch) + return ERR; + + key = wgetch(win); + + if (key == ERR) + return ERR; + + *wch = key; + + return SP->key_code ? KEY_CODE_YES : OK; +} + +int get_wch(wint_t *wch) +{ + PDC_LOG(("get_wch() - called\n")); + + return wget_wch(stdscr, wch); +} + +int mvget_wch(int y, int x, wint_t *wch) +{ + PDC_LOG(("mvget_wch() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return wget_wch(stdscr, wch); +} + +int mvwget_wch(WINDOW *win, int y, int x, wint_t *wch) +{ + PDC_LOG(("mvwget_wch() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wget_wch(win, wch); +} + +int unget_wch(const wchar_t wch) +{ + return PDC_ungetch(wch); +} +#endif diff --git a/vendor/pdcurses/pdcurses/getstr.c b/vendor/pdcurses/pdcurses/getstr.c new file mode 100644 index 0000000..12e4c2e --- /dev/null +++ b/vendor/pdcurses/pdcurses/getstr.c @@ -0,0 +1,480 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +getstr +------ + +### Synopsis + + int getstr(char *str); + int wgetstr(WINDOW *win, char *str); + int mvgetstr(int y, int x, char *str); + int mvwgetstr(WINDOW *win, int y, int x, char *str); + int getnstr(char *str, int n); + int wgetnstr(WINDOW *win, char *str, int n); + int mvgetnstr(int y, int x, char *str, int n); + int mvwgetnstr(WINDOW *win, int y, int x, char *str, int n); + + int get_wstr(wint_t *wstr); + int wget_wstr(WINDOW *win, wint_t *wstr); + int mvget_wstr(int y, int x, wint_t *wstr); + int mvwget_wstr(WINDOW *win, int, int, wint_t *wstr); + int getn_wstr(wint_t *wstr, int n); + int wgetn_wstr(WINDOW *win, wint_t *wstr, int n); + int mvgetn_wstr(int y, int x, wint_t *wstr, int n); + int mvwgetn_wstr(WINDOW *win, int y, int x, wint_t *wstr, int n); + +### Description + + These routines call wgetch() repeatedly to build a string, + interpreting erase and kill characters along the way, until a newline + or carriage return is received. When PDCurses is built with wide- + character support enabled, the narrow-character functions convert the + wgetch()'d values into a multibyte string in the current locale + before returning it. The resulting string is placed in the area + pointed to by *str. The routines with n as the last argument read at + most n characters. + + Note that there's no way to know how long the buffer passed to + wgetstr() is, so use wgetnstr() to avoid buffer overflows. + +### Return Value + + These functions return ERR on failure or any other value on success. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + getstr | Y | Y | Y + wgetstr | Y | Y | Y + mvgetstr | Y | Y | Y + mvwgetstr | Y | Y | Y + getnstr | Y | Y | Y + wgetnstr | Y | Y | Y + mvgetnstr | Y | Y | Y + mvwgetnstr | Y | Y | Y + get_wstr | Y | Y | Y + wget_wstr | Y | Y | Y + mvget_wstr | Y | Y | Y + mvwget_wstr | Y | Y | Y + getn_wstr | Y | Y | Y + wgetn_wstr | Y | Y | Y + mvgetn_wstr | Y | Y | Y + mvwgetn_wstr | Y | Y | Y + +**man-end****************************************************************/ + +#define MAXLINE 255 + +int wgetnstr(WINDOW *win, char *str, int n) +{ +#ifdef PDC_WIDE + wchar_t wstr[MAXLINE + 1]; + wint_t wintstr[MAXLINE + 1]; + int i; + + if (n < 0 || n > MAXLINE) + n = MAXLINE; + + if (wgetn_wstr(win, wintstr, n) == ERR) + return ERR; + for (i = 0; i < n; ++i) { + wstr[i] = (wchar_t)wintstr[i]; + } + + return PDC_wcstombs(str, wstr, n); +#else + int ch, i, num, x, chars; + char *p; + bool stop, oldecho, oldcbreak, oldnodelay; + + PDC_LOG(("wgetnstr() - called\n")); + + if (!win || !str) + return ERR; + + chars = 0; + p = str; + stop = FALSE; + + x = win->_curx; + + oldcbreak = SP->cbreak; /* remember states */ + oldecho = SP->echo; + oldnodelay = win->_nodelay; + + SP->echo = FALSE; /* we do echo ourselves */ + cbreak(); /* ensure each key is returned immediately */ + win->_nodelay = FALSE; /* don't return -1 */ + + wrefresh(win); + + while (!stop) + { + ch = wgetch(win); + + switch (ch) + { + + case '\t': + ch = ' '; + num = TABSIZE - (win->_curx - x) % TABSIZE; + for (i = 0; i < num; i++) + { + if (chars < n) + { + if (oldecho) + waddch(win, ch); + *p++ = ch; + ++chars; + } + else + beep(); + } + break; + + case _ECHAR: /* CTRL-H -- Delete character */ + if (p > str) + { + if (oldecho) + waddstr(win, "\b \b"); + ch = (unsigned char)(*--p); + if ((ch < ' ') && (oldecho)) + waddstr(win, "\b \b"); + chars--; + } + break; + + case _DLCHAR: /* CTRL-U -- Delete line */ + while (p > str) + { + if (oldecho) + waddstr(win, "\b \b"); + ch = (unsigned char)(*--p); + if ((ch < ' ') && (oldecho)) + waddstr(win, "\b \b"); + } + chars = 0; + break; + + case _DWCHAR: /* CTRL-W -- Delete word */ + + while ((p > str) && (*(p - 1) == ' ')) + { + if (oldecho) + waddstr(win, "\b \b"); + + --p; /* remove space */ + chars--; + } + while ((p > str) && (*(p - 1) != ' ')) + { + if (oldecho) + waddstr(win, "\b \b"); + + ch = (unsigned char)(*--p); + if ((ch < ' ') && (oldecho)) + waddstr(win, "\b \b"); + chars--; + } + break; + + case '\n': + case '\r': + stop = TRUE; + if (oldecho) + waddch(win, '\n'); + break; + + default: + if (chars < n) + { + if (!SP->key_code && ch < 0x100) + { + *p++ = ch; + if (oldecho) + waddch(win, ch); + chars++; + } + } + else + beep(); + + break; + + } + + wrefresh(win); + } + + *p = '\0'; + + SP->echo = oldecho; /* restore old settings */ + SP->cbreak = oldcbreak; + win->_nodelay = oldnodelay; + + return OK; +#endif +} + +int getstr(char *str) +{ + PDC_LOG(("getstr() - called\n")); + + return wgetnstr(stdscr, str, MAXLINE); +} + +int wgetstr(WINDOW *win, char *str) +{ + PDC_LOG(("wgetstr() - called\n")); + + return wgetnstr(win, str, MAXLINE); +} + +int mvgetstr(int y, int x, char *str) +{ + PDC_LOG(("mvgetstr() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return wgetnstr(stdscr, str, MAXLINE); +} + +int mvwgetstr(WINDOW *win, int y, int x, char *str) +{ + PDC_LOG(("mvwgetstr() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wgetnstr(win, str, MAXLINE); +} + +int getnstr(char *str, int n) +{ + PDC_LOG(("getnstr() - called\n")); + + return wgetnstr(stdscr, str, n); +} + +int mvgetnstr(int y, int x, char *str, int n) +{ + PDC_LOG(("mvgetnstr() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return wgetnstr(stdscr, str, n); +} + +int mvwgetnstr(WINDOW *win, int y, int x, char *str, int n) +{ + PDC_LOG(("mvwgetnstr() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wgetnstr(win, str, n); +} + +#ifdef PDC_WIDE +int wgetn_wstr(WINDOW *win, wint_t *wstr, int n) +{ + int ch, i, num, x, chars; + wint_t *p; + bool stop, oldecho, oldcbreak, oldnodelay; + + PDC_LOG(("wgetn_wstr() - called\n")); + + if (!win || !wstr) + return ERR; + + chars = 0; + p = wstr; + stop = FALSE; + + x = win->_curx; + + oldcbreak = SP->cbreak; /* remember states */ + oldecho = SP->echo; + oldnodelay = win->_nodelay; + + SP->echo = FALSE; /* we do echo ourselves */ + cbreak(); /* ensure each key is returned immediately */ + win->_nodelay = FALSE; /* don't return -1 */ + + wrefresh(win); + + while (!stop) + { + ch = wgetch(win); + + switch (ch) + { + + case '\t': + ch = ' '; + num = TABSIZE - (win->_curx - x) % TABSIZE; + for (i = 0; i < num; i++) + { + if (chars < n) + { + if (oldecho) + waddch(win, ch); + *p++ = ch; + ++chars; + } + else + beep(); + } + break; + + case _ECHAR: /* CTRL-H -- Delete character */ + if (p > wstr) + { + if (oldecho) + waddstr(win, "\b \b"); + ch = *--p; + if ((ch < ' ') && (oldecho)) + waddstr(win, "\b \b"); + chars--; + } + break; + + case _DLCHAR: /* CTRL-U -- Delete line */ + while (p > wstr) + { + if (oldecho) + waddstr(win, "\b \b"); + ch = *--p; + if ((ch < ' ') && (oldecho)) + waddstr(win, "\b \b"); + } + chars = 0; + break; + + case _DWCHAR: /* CTRL-W -- Delete word */ + + while ((p > wstr) && (*(p - 1) == ' ')) + { + if (oldecho) + waddstr(win, "\b \b"); + + --p; /* remove space */ + chars--; + } + while ((p > wstr) && (*(p - 1) != ' ')) + { + if (oldecho) + waddstr(win, "\b \b"); + + ch = *--p; + if ((ch < ' ') && (oldecho)) + waddstr(win, "\b \b"); + chars--; + } + break; + + case '\n': + case '\r': + stop = TRUE; + if (oldecho) + waddch(win, '\n'); + break; + + default: + if (chars < n) + { + if (!SP->key_code) + { + *p++ = ch; + if (oldecho) + waddch(win, ch); + chars++; + } + } + else + beep(); + + break; + + } + + wrefresh(win); + } + + *p = '\0'; + + SP->echo = oldecho; /* restore old settings */ + SP->cbreak = oldcbreak; + win->_nodelay = oldnodelay; + + return OK; +} + +int get_wstr(wint_t *wstr) +{ + PDC_LOG(("get_wstr() - called\n")); + + return wgetn_wstr(stdscr, wstr, MAXLINE); +} + +int wget_wstr(WINDOW *win, wint_t *wstr) +{ + PDC_LOG(("wget_wstr() - called\n")); + + return wgetn_wstr(win, wstr, MAXLINE); +} + +int mvget_wstr(int y, int x, wint_t *wstr) +{ + PDC_LOG(("mvget_wstr() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return wgetn_wstr(stdscr, wstr, MAXLINE); +} + +int mvwget_wstr(WINDOW *win, int y, int x, wint_t *wstr) +{ + PDC_LOG(("mvwget_wstr() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wgetn_wstr(win, wstr, MAXLINE); +} + +int getn_wstr(wint_t *wstr, int n) +{ + PDC_LOG(("getn_wstr() - called\n")); + + return wgetn_wstr(stdscr, wstr, n); +} + +int mvgetn_wstr(int y, int x, wint_t *wstr, int n) +{ + PDC_LOG(("mvgetn_wstr() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return wgetn_wstr(stdscr, wstr, n); +} + +int mvwgetn_wstr(WINDOW *win, int y, int x, wint_t *wstr, int n) +{ + PDC_LOG(("mvwgetn_wstr() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wgetn_wstr(win, wstr, n); +} +#endif diff --git a/vendor/pdcurses/pdcurses/getyx.c b/vendor/pdcurses/pdcurses/getyx.c new file mode 100644 index 0000000..4222f3f --- /dev/null +++ b/vendor/pdcurses/pdcurses/getyx.c @@ -0,0 +1,144 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +getyx +----- + +### Synopsis + + void getyx(WINDOW *win, int y, int x); + void getparyx(WINDOW *win, int y, int x); + void getbegyx(WINDOW *win, int y, int x); + void getmaxyx(WINDOW *win, int y, int x); + + void getsyx(int y, int x); + void setsyx(int y, int x); + + int getbegy(WINDOW *win); + int getbegx(WINDOW *win); + int getcury(WINDOW *win); + int getcurx(WINDOW *win); + int getpary(WINDOW *win); + int getparx(WINDOW *win); + int getmaxy(WINDOW *win); + int getmaxx(WINDOW *win); + +### Description + + The getyx() macro (defined in curses.h -- the prototypes here are + merely illustrative) puts the current cursor position of the + specified window into y and x. getbegyx() and getmaxyx() return the + starting coordinates and size of the specified window, respectively. + getparyx() returns the starting coordinates of the parent's window, + if the specified window is a subwindow; otherwise it sets y and x to + -1. These are all macros. + + getsyx() gets the coordinates of the virtual screen cursor, and + stores them in y and x. If leaveok() is TRUE, it returns -1, -1. If + lines have been removed with ripoffline(), then getsyx() includes + these lines in its count; so, the returned y and x values should only + be used with setsyx(). + + setsyx() sets the virtual screen cursor to the y, x coordinates. If + either y or x is -1, leaveok() is set TRUE, else it's set FALSE. + + getsyx() and setsyx() are meant to be used by a library routine that + manipulates curses windows without altering the position of the + cursor. Note that getsyx() is defined only as a macro. + + getbegy(), getbegx(), getcurx(), getcury(), getmaxy(), getmaxx(), + getpary(), and getparx() return the appropriate coordinate or size + values, or ERR in the case of a NULL window. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + getyx | Y | Y | Y + getparyx | Y | Y | Y + getbegyx | Y | Y | Y + getmaxyx | Y | Y | Y + getsyx | - | Y | Y + setsyx | - | Y | Y + getbegy | - | Y | Y + getbegx | - | Y | Y + getcury | - | Y | Y + getcurx | - | Y | Y + getpary | - | Y | Y + getparx | - | Y | Y + getmaxy | - | Y | Y + getmaxx | - | Y | Y + +**man-end****************************************************************/ + +int getbegy(WINDOW *win) +{ + PDC_LOG(("getbegy() - called\n")); + + return win ? win->_begy : ERR; +} + +int getbegx(WINDOW *win) +{ + PDC_LOG(("getbegx() - called\n")); + + return win ? win->_begx : ERR; +} + +int getcury(WINDOW *win) +{ + PDC_LOG(("getcury() - called\n")); + + return win ? win->_cury : ERR; +} + +int getcurx(WINDOW *win) +{ + PDC_LOG(("getcurx() - called\n")); + + return win ? win->_curx : ERR; +} + +int getpary(WINDOW *win) +{ + PDC_LOG(("getpary() - called\n")); + + return win ? win->_pary : ERR; +} + +int getparx(WINDOW *win) +{ + PDC_LOG(("getparx() - called\n")); + + return win ? win->_parx : ERR; +} + +int getmaxy(WINDOW *win) +{ + PDC_LOG(("getmaxy() - called\n")); + + return win ? win->_maxy : ERR; +} + +int getmaxx(WINDOW *win) +{ + PDC_LOG(("getmaxx() - called\n")); + + return win ? win->_maxx : ERR; +} + +void setsyx(int y, int x) +{ + PDC_LOG(("setsyx() - called\n")); + + if (curscr) + { + curscr->_leaveit = y == -1 || x == -1; + + if (!curscr->_leaveit) + wmove(curscr, y, x); + } +} diff --git a/vendor/pdcurses/pdcurses/inch.c b/vendor/pdcurses/pdcurses/inch.c new file mode 100644 index 0000000..a790c95 --- /dev/null +++ b/vendor/pdcurses/pdcurses/inch.c @@ -0,0 +1,128 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +inch +---- + +### Synopsis + + chtype inch(void); + chtype winch(WINDOW *win); + chtype mvinch(int y, int x); + chtype mvwinch(WINDOW *win, int y, int x); + + int in_wch(cchar_t *wcval); + int win_wch(WINDOW *win, cchar_t *wcval); + int mvin_wch(int y, int x, cchar_t *wcval); + int mvwin_wch(WINDOW *win, int y, int x, cchar_t *wcval); + +### Description + + The inch() functions retrieve the character and attribute from the + current or specified window position, in the form of a chtype. If a + NULL window is specified, (chtype)ERR is returned. + + The in_wch() functions are the wide-character versions; instead of + returning a chtype, they store a cchar_t at the address specified by + wcval, and return OK or ERR. (No value is stored when ERR is + returned.) Note that in PDCurses, chtype and cchar_t are the same. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + inch | Y | Y | Y + winch | Y | Y | Y + mvinch | Y | Y | Y + mvwinch | Y | Y | Y + in_wch | Y | Y | Y + win_wch | Y | Y | Y + mvin_wch | Y | Y | Y + mvwin_wch | Y | Y | Y + +**man-end****************************************************************/ + +chtype winch(WINDOW *win) +{ + PDC_LOG(("winch() - called\n")); + + if (!win) + return (chtype)ERR; + + return win->_y[win->_cury][win->_curx]; +} + +chtype inch(void) +{ + PDC_LOG(("inch() - called\n")); + + return winch(stdscr); +} + +chtype mvinch(int y, int x) +{ + PDC_LOG(("mvinch() - called\n")); + + if (move(y, x) == ERR) + return (chtype)ERR; + + return stdscr->_y[stdscr->_cury][stdscr->_curx]; +} + +chtype mvwinch(WINDOW *win, int y, int x) +{ + PDC_LOG(("mvwinch() - called\n")); + + if (wmove(win, y, x) == ERR) + return (chtype)ERR; + + return win->_y[win->_cury][win->_curx]; +} + +#ifdef PDC_WIDE +int win_wch(WINDOW *win, cchar_t *wcval) +{ + PDC_LOG(("win_wch() - called\n")); + + if (!win || !wcval) + return ERR; + + *wcval = win->_y[win->_cury][win->_curx]; + + return OK; +} + +int in_wch(cchar_t *wcval) +{ + PDC_LOG(("in_wch() - called\n")); + + return win_wch(stdscr, wcval); +} + +int mvin_wch(int y, int x, cchar_t *wcval) +{ + PDC_LOG(("mvin_wch() - called\n")); + + if (!wcval || (move(y, x) == ERR)) + return ERR; + + *wcval = stdscr->_y[stdscr->_cury][stdscr->_curx]; + + return OK; +} + +int mvwin_wch(WINDOW *win, int y, int x, cchar_t *wcval) +{ + PDC_LOG(("mvwin_wch() - called\n")); + + if (!wcval || (wmove(win, y, x) == ERR)) + return ERR; + + *wcval = win->_y[win->_cury][win->_curx]; + + return OK; +} +#endif diff --git a/vendor/pdcurses/pdcurses/inchstr.c b/vendor/pdcurses/pdcurses/inchstr.c new file mode 100644 index 0000000..2863d9f --- /dev/null +++ b/vendor/pdcurses/pdcurses/inchstr.c @@ -0,0 +1,215 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +inchstr +------- + +### Synopsis + + int inchstr(chtype *ch); + int inchnstr(chtype *ch, int n); + int winchstr(WINDOW *win, chtype *ch); + int winchnstr(WINDOW *win, chtype *ch, int n); + int mvinchstr(int y, int x, chtype *ch); + int mvinchnstr(int y, int x, chtype *ch, int n); + int mvwinchstr(WINDOW *, int y, int x, chtype *ch); + int mvwinchnstr(WINDOW *, int y, int x, chtype *ch, int n); + + int in_wchstr(cchar_t *wch); + int in_wchnstr(cchar_t *wch, int n); + int win_wchstr(WINDOW *win, cchar_t *wch); + int win_wchnstr(WINDOW *win, cchar_t *wch, int n); + int mvin_wchstr(int y, int x, cchar_t *wch); + int mvin_wchnstr(int y, int x, cchar_t *wch, int n); + int mvwin_wchstr(WINDOW *win, int y, int x, cchar_t *wch); + int mvwin_wchnstr(WINDOW *win, int y, int x, cchar_t *wch, int n); + +### Description + + These routines read a chtype or cchar_t string from the window, + starting at the current or specified position, and ending at the + right margin, or after n elements, whichever is less. + +### Return Value + + All functions return the number of elements read, or ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + inchstr | Y | Y | Y + winchstr | Y | Y | Y + mvinchstr | Y | Y | Y + mvwinchstr | Y | Y | Y + inchnstr | Y | Y | Y + winchnstr | Y | Y | Y + mvinchnstr | Y | Y | Y + mvwinchnstr | Y | Y | Y + in_wchstr | Y | Y | Y + win_wchstr | Y | Y | Y + mvin_wchstr | Y | Y | Y + mvwin_wchstr | Y | Y | Y + in_wchnstr | Y | Y | Y + win_wchnstr | Y | Y | Y + mvin_wchnstr | Y | Y | Y + mvwin_wchnstr | Y | Y | Y + +**man-end****************************************************************/ + +int winchnstr(WINDOW *win, chtype *ch, int n) +{ + chtype *src; + int i; + + PDC_LOG(("winchnstr() - called\n")); + + if (!win || !ch || n < 0) + return ERR; + + if ((win->_curx + n) > win->_maxx) + n = win->_maxx - win->_curx; + + src = win->_y[win->_cury] + win->_curx; + + for (i = 0; i < n; i++) + *ch++ = *src++; + + *ch = (chtype)0; + + return OK; +} + +int inchstr(chtype *ch) +{ + PDC_LOG(("inchstr() - called\n")); + + return winchnstr(stdscr, ch, stdscr->_maxx - stdscr->_curx); +} + +int winchstr(WINDOW *win, chtype *ch) +{ + PDC_LOG(("winchstr() - called\n")); + + return winchnstr(win, ch, win->_maxx - win->_curx); +} + +int mvinchstr(int y, int x, chtype *ch) +{ + PDC_LOG(("mvinchstr() - called: y %d x %d\n", y, x)); + + if (move(y, x) == ERR) + return ERR; + + return winchnstr(stdscr, ch, stdscr->_maxx - stdscr->_curx); +} + +int mvwinchstr(WINDOW *win, int y, int x, chtype *ch) +{ + PDC_LOG(("mvwinchstr() - called:\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return winchnstr(win, ch, win->_maxx - win->_curx); +} + +int inchnstr(chtype *ch, int n) +{ + PDC_LOG(("inchnstr() - called\n")); + + return winchnstr(stdscr, ch, n); +} + +int mvinchnstr(int y, int x, chtype *ch, int n) +{ + PDC_LOG(("mvinchnstr() - called: y %d x %d n %d\n", y, x, n)); + + if (move(y, x) == ERR) + return ERR; + + return winchnstr(stdscr, ch, n); +} + +int mvwinchnstr(WINDOW *win, int y, int x, chtype *ch, int n) +{ + PDC_LOG(("mvwinchnstr() - called: y %d x %d n %d \n", y, x, n)); + + if (wmove(win, y, x) == ERR) + return ERR; + + return winchnstr(win, ch, n); +} + +#ifdef PDC_WIDE +int win_wchnstr(WINDOW *win, cchar_t *wch, int n) +{ + PDC_LOG(("win_wchnstr() - called\n")); + + return winchnstr(win, wch, n); +} + +int in_wchstr(cchar_t *wch) +{ + PDC_LOG(("in_wchstr() - called\n")); + + return win_wchnstr(stdscr, wch, stdscr->_maxx - stdscr->_curx); +} + +int win_wchstr(WINDOW *win, cchar_t *wch) +{ + PDC_LOG(("win_wchstr() - called\n")); + + return win_wchnstr(win, wch, win->_maxx - win->_curx); +} + +int mvin_wchstr(int y, int x, cchar_t *wch) +{ + PDC_LOG(("mvin_wchstr() - called: y %d x %d\n", y, x)); + + if (move(y, x) == ERR) + return ERR; + + return win_wchnstr(stdscr, wch, stdscr->_maxx - stdscr->_curx); +} + +int mvwin_wchstr(WINDOW *win, int y, int x, cchar_t *wch) +{ + PDC_LOG(("mvwin_wchstr() - called:\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return win_wchnstr(win, wch, win->_maxx - win->_curx); +} + +int in_wchnstr(cchar_t *wch, int n) +{ + PDC_LOG(("in_wchnstr() - called\n")); + + return win_wchnstr(stdscr, wch, n); +} + +int mvin_wchnstr(int y, int x, cchar_t *wch, int n) +{ + PDC_LOG(("mvin_wchnstr() - called: y %d x %d n %d\n", y, x, n)); + + if (move(y, x) == ERR) + return ERR; + + return win_wchnstr(stdscr, wch, n); +} + +int mvwin_wchnstr(WINDOW *win, int y, int x, cchar_t *wch, int n) +{ + PDC_LOG(("mvwinchnstr() - called: y %d x %d n %d \n", y, x, n)); + + if (wmove(win, y, x) == ERR) + return ERR; + + return win_wchnstr(win, wch, n); +} +#endif diff --git a/vendor/pdcurses/pdcurses/initscr.c b/vendor/pdcurses/pdcurses/initscr.c new file mode 100644 index 0000000..846acca --- /dev/null +++ b/vendor/pdcurses/pdcurses/initscr.c @@ -0,0 +1,433 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +initscr +------- + +### Synopsis + + WINDOW *initscr(void); + WINDOW *Xinitscr(int argc, char **argv); + int endwin(void); + bool isendwin(void); + SCREEN *newterm(const char *type, FILE *outfd, FILE *infd); + SCREEN *set_term(SCREEN *new); + void delscreen(SCREEN *sp); + + int resize_term(int nlines, int ncols); + bool is_termresized(void); + const char *curses_version(void); + void PDC_get_version(PDC_VERSION *ver); + + int set_tabsize(int tabsize); + +### Description + + initscr() should be the first curses routine called. It will + initialize all curses data structures, and arrange that the first + call to refresh() will clear the screen. In case of error, initscr() + will write a message to standard error and end the program. + + endwin() should be called before exiting or escaping from curses mode + temporarily. It will restore tty modes, move the cursor to the lower + left corner of the screen and reset the terminal into the proper + non-visual mode. To resume curses after a temporary escape, call + refresh() or doupdate(). + + isendwin() returns TRUE if endwin() has been called without a + subsequent refresh, unless SP is NULL. + + In some implementations of curses, newterm() allows the use of + multiple terminals. Here, it's just an alternative interface for + initscr(). It always returns SP, or NULL. + + delscreen() frees the memory allocated by newterm() or initscr(), + since it's not freed by endwin(). This function is usually not + needed. In PDCurses, the parameter must be the value of SP, and + delscreen() sets SP to NULL. + + set_term() does nothing meaningful in PDCurses, but is included for + compatibility with other curses implementations. + + resize_term() is effectively two functions: When called with nonzero + values for nlines and ncols, it attempts to resize the screen to the + given size. When called with (0, 0), it merely adjusts the internal + structures to match the current size after the screen is resized by + the user. On the currently supported platforms, SDL, Windows console, + and X11 allow user resizing, while DOS, OS/2, SDL and Windows console + allow programmatic resizing. If you want to support user resizing, + you should check for getch() returning KEY_RESIZE, and/or call + is_termresized() at appropriate times; if either condition occurs, + call resize_term(0, 0). Then, with either user or programmatic + resizing, you'll have to resize any windows you've created, as + appropriate; resize_term() only handles stdscr and curscr. + + is_termresized() returns TRUE if the curses screen has been resized + by the user, and a call to resize_term() is needed. Checking for + KEY_RESIZE is generally preferable, unless you're not handling the + keyboard. + + curses_version() returns a string describing the version of PDCurses. + + PDC_get_version() fills a PDC_VERSION structure provided by the user + with more detailed version info (see curses.h). + + set_tabsize() sets the tab interval, stored in TABSIZE. + +### Return Value + + All functions return NULL on error, except endwin(), which always + returns OK, and resize_term(), which returns either OK or ERR. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + initscr | Y | Y | Y + endwin | Y | Y | Y + isendwin | Y | Y | Y + newterm | Y | Y | Y + set_term | Y | Y | Y + delscreen | Y | Y | Y + resize_term | - | Y | Y + set_tabsize | - | Y | Y + curses_version | - | Y | - + is_termresized | - | - | - + +**man-end****************************************************************/ + +#include + +char ttytype[128]; + +const char *_curses_notice = "PDCurses " PDC_VERDOT " - " __DATE__; + +SCREEN *SP = (SCREEN*)NULL; /* curses variables */ +WINDOW *curscr = (WINDOW *)NULL; /* the current screen image */ +WINDOW *stdscr = (WINDOW *)NULL; /* the default screen window */ + +int LINES = 0; /* current terminal height */ +int COLS = 0; /* current terminal width */ +int TABSIZE = 8; + +MOUSE_STATUS Mouse_status; + +extern RIPPEDOFFLINE linesripped[5]; +extern char linesrippedoff; + +WINDOW *initscr(void) +{ + int i; + + PDC_LOG(("initscr() - called\n")); + + if (SP && SP->alive) + return NULL; + + SP = calloc(1, sizeof(SCREEN)); + if (!SP) + return NULL; + + if (PDC_scr_open() == ERR) + { + fprintf(stderr, "initscr(): Unable to create SP\n"); + exit(8); + } + + SP->autocr = TRUE; /* cr -> lf by default */ + SP->raw_out = FALSE; /* tty I/O modes */ + SP->raw_inp = FALSE; /* tty I/O modes */ + SP->cbreak = TRUE; + SP->key_modifiers = 0L; + SP->return_key_modifiers = FALSE; + SP->echo = TRUE; + SP->visibility = 1; + SP->resized = FALSE; + SP->_trap_mbe = 0L; + SP->linesrippedoff = 0; + SP->linesrippedoffontop = 0; + SP->delaytenths = 0; + SP->line_color = -1; + SP->lastscr = (WINDOW *)NULL; + SP->dbfp = NULL; + SP->color_started = FALSE; + SP->dirty = FALSE; + SP->sel_start = -1; + SP->sel_end = -1; + + SP->orig_cursor = PDC_get_cursor_mode(); + + LINES = SP->lines = PDC_get_rows(); + COLS = SP->cols = PDC_get_columns(); + + if (LINES < 2 || COLS < 2) + { + fprintf(stderr, "initscr(): LINES=%d COLS=%d: too small.\n", + LINES, COLS); + exit(4); + } + + curscr = newwin(LINES, COLS, 0, 0); + if (!curscr) + { + fprintf(stderr, "initscr(): Unable to create curscr.\n"); + exit(2); + } + + SP->lastscr = newwin(LINES, COLS, 0, 0); + if (!SP->lastscr) + { + fprintf(stderr, "initscr(): Unable to create SP->lastscr.\n"); + exit(2); + } + + wattrset(SP->lastscr, (chtype)(-1)); + werase(SP->lastscr); + + PDC_slk_initialize(); + LINES -= SP->slklines; + + /* We have to sort out ripped off lines here, and reduce the height + of stdscr by the number of lines ripped off */ + + for (i = 0; i < linesrippedoff; i++) + { + if (linesripped[i].line < 0) + (*linesripped[i].init)(newwin(1, COLS, LINES - 1, 0), COLS); + else + (*linesripped[i].init)(newwin(1, COLS, + SP->linesrippedoffontop++, 0), COLS); + + SP->linesrippedoff++; + LINES--; + } + + linesrippedoff = 0; + + stdscr = newwin(LINES, COLS, SP->linesrippedoffontop, 0); + if (!stdscr) + { + fprintf(stderr, "initscr(): Unable to create stdscr.\n"); + exit(1); + } + + wclrtobot(stdscr); + + /* If preserving the existing screen, don't allow a screen clear */ + + if (SP->_preserve) + { + untouchwin(curscr); + untouchwin(stdscr); + stdscr->_clear = FALSE; + curscr->_clear = FALSE; + } + else + curscr->_clear = TRUE; + + SP->atrtab = calloc(PDC_COLOR_PAIRS, sizeof(PDC_PAIR)); + if (!SP->atrtab) + return NULL; + PDC_init_atrtab(); /* set up default colors */ + + MOUSE_X_POS = MOUSE_Y_POS = -1; + BUTTON_STATUS(1) = BUTTON_RELEASED; + BUTTON_STATUS(2) = BUTTON_RELEASED; + BUTTON_STATUS(3) = BUTTON_RELEASED; + Mouse_status.changes = 0; + + SP->alive = TRUE; + + def_shell_mode(); + + sprintf(ttytype, "pdcurses|PDCurses for %s", PDC_sysname()); + + SP->c_buffer = malloc(_INBUFSIZ * sizeof(int)); + if (!SP->c_buffer) + return NULL; + SP->c_pindex = 0; + SP->c_gindex = 1; + + SP->c_ungch = malloc(NUNGETCH * sizeof(int)); + if (!SP->c_ungch) + return NULL; + SP->c_ungind = 0; + SP->c_ungmax = NUNGETCH; + + return stdscr; +} + +#ifdef XCURSES +WINDOW *Xinitscr(int argc, char **argv) +{ + PDC_LOG(("Xinitscr() - called\n")); + + PDC_set_args(argc, argv); + return initscr(); +} +#endif + +int endwin(void) +{ + PDC_LOG(("endwin() - called\n")); + + /* Allow temporary exit from curses using endwin() */ + + def_prog_mode(); + PDC_scr_close(); + + SP->alive = FALSE; + + return OK; +} + +bool isendwin(void) +{ + PDC_LOG(("isendwin() - called\n")); + + return SP ? !(SP->alive) : FALSE; +} + +SCREEN *newterm(const char *type, FILE *outfd, FILE *infd) +{ + PDC_LOG(("newterm() - called\n")); + + return initscr() ? SP : NULL; +} + +SCREEN *set_term(SCREEN *new) +{ + PDC_LOG(("set_term() - called\n")); + + /* We only support one screen */ + + return (new == SP) ? SP : NULL; +} + +void delscreen(SCREEN *sp) +{ + PDC_LOG(("delscreen() - called\n")); + + if (!SP || sp != SP) + return; + + free(SP->c_ungch); + free(SP->c_buffer); + free(SP->atrtab); + + PDC_slk_free(); /* free the soft label keys, if needed */ + + delwin(stdscr); + delwin(curscr); + delwin(SP->lastscr); + stdscr = (WINDOW *)NULL; + curscr = (WINDOW *)NULL; + SP->lastscr = (WINDOW *)NULL; + + SP->alive = FALSE; + + PDC_scr_free(); + + free(SP); + SP = (SCREEN *)NULL; +} + +int resize_term(int nlines, int ncols) +{ + PDC_LOG(("resize_term() - called: nlines %d\n", nlines)); + + if (!stdscr || PDC_resize_screen(nlines, ncols) == ERR) + return ERR; + + SP->resized = FALSE; + + SP->lines = PDC_get_rows(); + LINES = SP->lines - SP->linesrippedoff - SP->slklines; + SP->cols = COLS = PDC_get_columns(); + + if (SP->cursrow >= SP->lines) + SP->cursrow = SP->lines - 1; + if (SP->curscol >= SP->cols) + SP->curscol = SP->cols - 1; + + if (wresize(curscr, SP->lines, SP->cols) == ERR || + wresize(stdscr, LINES, COLS) == ERR || + wresize(SP->lastscr, SP->lines, SP->cols) == ERR) + return ERR; + + werase(SP->lastscr); + curscr->_clear = TRUE; + + if (SP->slk_winptr) + { + if (wresize(SP->slk_winptr, SP->slklines, COLS) == ERR) + return ERR; + + wmove(SP->slk_winptr, 0, 0); + wclrtobot(SP->slk_winptr); + PDC_slk_initialize(); + slk_noutrefresh(); + } + + touchwin(stdscr); + wnoutrefresh(stdscr); + + return OK; +} + +bool is_termresized(void) +{ + PDC_LOG(("is_termresized() - called\n")); + + return SP->resized; +} + +const char *curses_version(void) +{ + return _curses_notice; +} + +void PDC_get_version(PDC_VERSION *ver) +{ + if (!ver) + return; + + ver->flags = 0 +#ifdef PDCDEBUG + | PDC_VFLAG_DEBUG +#endif +#ifdef PDC_WIDE + | PDC_VFLAG_WIDE +#endif +#ifdef PDC_FORCE_UTF8 + | PDC_VFLAG_UTF8 +#endif +#ifdef PDC_DLL_BUILD + | PDC_VFLAG_DLL +#endif +#ifdef PDC_RGB + | PDC_VFLAG_RGB +#endif + ; + + ver->build = PDC_BUILD; + ver->major = PDC_VER_MAJOR; + ver->minor = PDC_VER_MINOR; + ver->csize = sizeof(chtype); + ver->bsize = sizeof(bool); +} + +int set_tabsize(int tabsize) +{ + PDC_LOG(("set_tabsize() - called: tabsize %d\n", tabsize)); + + if (tabsize < 1) + return ERR; + + TABSIZE = tabsize; + + return OK; +} diff --git a/vendor/pdcurses/pdcurses/inopts.c b/vendor/pdcurses/pdcurses/inopts.c new file mode 100644 index 0000000..04e4334 --- /dev/null +++ b/vendor/pdcurses/pdcurses/inopts.c @@ -0,0 +1,410 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +inopts +------ + +### Synopsis + + int cbreak(void); + int nocbreak(void); + int echo(void); + int noecho(void); + int halfdelay(int tenths); + int intrflush(WINDOW *win, bool bf); + int keypad(WINDOW *win, bool bf); + int meta(WINDOW *win, bool bf); + int nl(void); + int nonl(void); + int nodelay(WINDOW *win, bool bf); + int notimeout(WINDOW *win, bool bf); + int raw(void); + int noraw(void); + void noqiflush(void); + void qiflush(void); + void timeout(int delay); + void wtimeout(WINDOW *win, int delay); + int wgetdelay(const WINDOW *win); + int typeahead(int fildes); + + int crmode(void); + int nocrmode(void); + + bool is_keypad(const WINDOW *win); + bool is_nodelay(const WINDOW *win); + bool is_notimeout(const WINDOW *win); + +### Description + + cbreak() and nocbreak() toggle cbreak mode. In cbreak mode, + characters typed by the user are made available immediately, and + erase/kill character processing is not performed. In nocbreak mode, + typed characters are buffered until a newline or carriage return. + Interrupt and flow control characters are unaffected by this mode. + PDCurses always starts in cbreak mode. + + echo() and noecho() control whether typed characters are echoed by + the input routine. Initially, input characters are echoed. Subsequent + calls to echo() and noecho() do not flush type-ahead. + + halfdelay() is similar to cbreak(), but allows for a time limit to be + specified, in tenths of a second. This causes getch() to block for + that period before returning ERR if no key has been received. tenths + must be between 1 and 255. + + keypad() controls whether getch() returns function/special keys as + single key codes (e.g., the left arrow key as KEY_LEFT). Per X/Open, + the default for keypad mode is OFF. You'll probably want it on. With + keypad mode off, if a special key is pressed, getch() does nothing or + returns ERR. + + nodelay() controls whether wgetch() is a non-blocking call. If the + option is enabled, and no input is ready, wgetch() will return ERR. + If disabled, wgetch() will hang until input is ready. + + nl() enables the translation of a carriage return into a newline on + input. nonl() disables this. Initially, the translation does occur. + + raw() and noraw() toggle raw mode. Raw mode is similar to cbreak + mode, in that characters typed are immediately passed through to the + user program. The difference is that in raw mode, the INTR, QUIT, + SUSP, and STOP characters are passed through without being + interpreted, and without generating a signal. + + In PDCurses, the meta() function sets raw mode on or off. + + timeout() and wtimeout() set blocking or non-blocking reads for the + specified window. If the delay is negative, a blocking read is used; + if zero, then non-blocking reads are done -- if no input is waiting, + ERR is returned immediately. If the delay is positive, the read + blocks for the delay period; if the period expires, ERR is returned. + The delay is given in milliseconds, but this is rounded down to 50ms + (1/20th sec) intervals, with a minimum of one interval if a postive + delay is given; i.e., 1-99 will wait 50ms, 100-149 will wait 100ms, + etc. + + wgetdelay() returns the delay timeout as set in wtimeout(). + + intrflush(), notimeout(), noqiflush(), qiflush() and typeahead() do + nothing in PDCurses, but are included for compatibility with other + curses implementations. + + crmode() and nocrmode() are archaic equivalents to cbreak() and + nocbreak(), respectively. + + is_keypad() reports whether the specified window is in keypad mode. + + is_nodelay() reports whether the specified window is in nodelay mode. + +### Return Value + + is_keypad() and is_nodelay() return TRUE or FALSE. is_notimeout() is + provided for compatibility with other curses implementations, and + always returns FALSE. All others return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + cbreak | Y | Y | Y + nocbreak | Y | Y | Y + echo | Y | Y | Y + noecho | Y | Y | Y + halfdelay | Y | Y | Y + intrflush | Y | Y | Y + keypad | Y | Y | Y + meta | Y | Y | Y + nl | Y | Y | Y + nonl | Y | Y | Y + nodelay | Y | Y | Y + notimeout | Y | Y | Y + raw | Y | Y | Y + noraw | Y | Y | Y + noqiflush | Y | Y | Y + qiflush | Y | Y | Y + timeout | Y | Y | Y + wtimeout | Y | Y | Y + wgetdelay | - | Y | - + typeahead | Y | Y | Y + crmode | Y | Y | Y + nocrmode | Y | Y | Y + is_keypad | - | Y | Y + is_nodelay | - | Y | - + is_notimeout | - | Y | - + +**man-end****************************************************************/ + +int cbreak(void) +{ + PDC_LOG(("cbreak() - called\n")); + + if (!SP) + return ERR; + + SP->cbreak = TRUE; + + return OK; +} + +int nocbreak(void) +{ + PDC_LOG(("nocbreak() - called\n")); + + if (!SP) + return ERR; + + SP->cbreak = FALSE; + SP->delaytenths = 0; + + return OK; +} + +int echo(void) +{ + PDC_LOG(("echo() - called\n")); + + if (!SP) + return ERR; + + SP->echo = TRUE; + + return OK; +} + +int noecho(void) +{ + PDC_LOG(("noecho() - called\n")); + + if (!SP) + return ERR; + + SP->echo = FALSE; + + return OK; +} + +int halfdelay(int tenths) +{ + PDC_LOG(("halfdelay() - called\n")); + + if (!SP || tenths < 1 || tenths > 255) + return ERR; + + SP->delaytenths = tenths; + + return OK; +} + +int intrflush(WINDOW *win, bool bf) +{ + PDC_LOG(("intrflush() - called\n")); + + return OK; +} + +int keypad(WINDOW *win, bool bf) +{ + PDC_LOG(("keypad() - called\n")); + + if (!win) + return ERR; + + win->_use_keypad = bf; + + return OK; +} + +int meta(WINDOW *win, bool bf) +{ + PDC_LOG(("meta() - called\n")); + + if (!SP) + return ERR; + + SP->raw_inp = bf; + + return OK; +} + +int nl(void) +{ + PDC_LOG(("nl() - called\n")); + + if (!SP) + return ERR; + + SP->autocr = TRUE; + + return OK; +} + +int nonl(void) +{ + PDC_LOG(("nonl() - called\n")); + + if (!SP) + return ERR; + + SP->autocr = FALSE; + + return OK; +} + +int nodelay(WINDOW *win, bool flag) +{ + PDC_LOG(("nodelay() - called\n")); + + if (!win) + return ERR; + + win->_nodelay = flag; + + return OK; +} + +int notimeout(WINDOW *win, bool flag) +{ + PDC_LOG(("notimeout() - called\n")); + + return OK; +} + +int raw(void) +{ + PDC_LOG(("raw() - called\n")); + + if (!SP) + return ERR; + + PDC_set_keyboard_binary(TRUE); + SP->raw_inp = TRUE; + + return OK; +} + +int noraw(void) +{ + PDC_LOG(("noraw() - called\n")); + + if (!SP) + return ERR; + + PDC_set_keyboard_binary(FALSE); + SP->raw_inp = FALSE; + + return OK; +} + +void noqiflush(void) +{ + PDC_LOG(("noqiflush() - called\n")); +} + +void qiflush(void) +{ + PDC_LOG(("qiflush() - called\n")); +} + +void timeout(int delay) +{ + PDC_LOG(("timeout() - called\n")); + + wtimeout(stdscr, delay); +} + +void wtimeout(WINDOW *win, int delay) +{ + PDC_LOG(("wtimeout() - called\n")); + + if (!win) + return; + + if (delay < 0) + { + /* This causes a blocking read on the window, so turn on delay + mode */ + + win->_nodelay = FALSE; + win->_delayms = 0; + } + else if (!delay) + { + /* This causes a non-blocking read on the window, so turn off + delay mode */ + + win->_nodelay = TRUE; + win->_delayms = 0; + } + else + { + /* This causes the read on the window to delay for the number of + milliseconds. Also forces the window into non-blocking read + mode */ + + /*win->_nodelay = TRUE;*/ + win->_delayms = delay; + } +} + +int wgetdelay(const WINDOW *win) +{ + PDC_LOG(("wgetdelay() - called\n")); + + if (!win) + return 0; + + return win->_delayms; +} + +int typeahead(int fildes) +{ + PDC_LOG(("typeahead() - called\n")); + + return OK; +} + +int crmode(void) +{ + PDC_LOG(("crmode() - called\n")); + + return cbreak(); +} + +int nocrmode(void) +{ + PDC_LOG(("nocrmode() - called\n")); + + return nocbreak(); +} + +bool is_keypad(const WINDOW *win) +{ + PDC_LOG(("is_keypad() - called\n")); + + if (!win) + return FALSE; + + return win->_use_keypad; +} + +bool is_nodelay(const WINDOW *win) +{ + PDC_LOG(("is_nodelay() - called\n")); + + if (!win) + return FALSE; + + return win->_nodelay; +} + +bool is_notimeout(const WINDOW *win) +{ + (void) win; + + PDC_LOG(("is_notimeout() - called - returning FALSE...\n")); + + return FALSE; +} diff --git a/vendor/pdcurses/pdcurses/insch.c b/vendor/pdcurses/pdcurses/insch.c new file mode 100644 index 0000000..4c71b2f --- /dev/null +++ b/vendor/pdcurses/pdcurses/insch.c @@ -0,0 +1,272 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +insch +----- + +### Synopsis + + int insch(chtype ch); + int winsch(WINDOW *win, chtype ch); + int mvinsch(int y, int x, chtype ch); + int mvwinsch(WINDOW *win, int y, int x, chtype ch); + + int insrawch(chtype ch); + int winsrawch(WINDOW *win, chtype ch); + int mvinsrawch(int y, int x, chtype ch); + int mvwinsrawch(WINDOW *win, int y, int x, chtype ch); + + int ins_wch(const cchar_t *wch); + int wins_wch(WINDOW *win, const cchar_t *wch); + int mvins_wch(int y, int x, const cchar_t *wch); + int mvwins_wch(WINDOW *win, int y, int x, const cchar_t *wch); + +### Description + + The insch() functions insert a chtype into the window at the current + or specified cursor position. The cursor is NOT advanced. A newline + is equivalent to clrtoeol(); tabs are expanded; other control + characters are converted as with unctrl(). + + The ins_wch() functions are the wide-character equivalents, taking + cchar_t pointers rather than chtypes. + + Video attributes can be combined with a character by ORing them into + the parameter. Text, including attributes, can be copied from one + place to another using inch() and insch(). + + insrawch() etc. are PDCurses-specific wrappers for insch() etc. that + disable the translation of control characters. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + insch | Y | Y | Y + winsch | Y | Y | Y + mvinsch | Y | Y | Y + mvwinsch | Y | Y | Y + ins_wch | Y | Y | Y + wins_wch | Y | Y | Y + mvins_wch | Y | Y | Y + mvwins_wch | Y | Y | Y + insrawch | - | - | - + winsrawch | - | - | - + +**man-end****************************************************************/ + +#include + +int winsch(WINDOW *win, chtype ch) +{ + int x, y; + chtype attr; + bool xlat; + + PDC_LOG(("winsch() - called: win=%p ch=%x (text=%c attr=0x%x)\n", + win, ch, ch & A_CHARTEXT, ch & A_ATTRIBUTES)); + + if (!win) + return ERR; + + x = win->_curx; + y = win->_cury; + + if (y > win->_maxy || x > win->_maxx || y < 0 || x < 0) + return ERR; + + xlat = !SP->raw_out && !(ch & A_ALTCHARSET); + attr = ch & A_ATTRIBUTES; + ch &= A_CHARTEXT; + + if (xlat && (ch < ' ' || ch == 0x7f)) + { + int x2; + + switch (ch) + { + case '\t': + for (x2 = ((x / TABSIZE) + 1) * TABSIZE; x < x2; x++) + { + if (winsch(win, attr | ' ') == ERR) + return ERR; + } + return OK; + + case '\n': + wclrtoeol(win); + break; + + case 0x7f: + if (winsch(win, attr | '?') == ERR) + return ERR; + + return winsch(win, attr | '^'); + + default: + /* handle control chars */ + + if (winsch(win, attr | (ch + '@')) == ERR) + return ERR; + + return winsch(win, attr | '^'); + } + } + else + { + int maxx; + chtype *temp; + + /* If the incoming character doesn't have its own attribute, + then use the current attributes for the window. If it has + attributes but not a color component, OR the attributes to + the current attributes for the window. If it has a color + component, use the attributes solely from the incoming + character. */ + + if (!(attr & A_COLOR)) + attr |= win->_attrs; + + /* wrs (4/10/93): Apply the same sort of logic for the window + background, in that it only takes precedence if other color + attributes are not there and that the background character + will only print if the printing character is blank. */ + + if (!(attr & A_COLOR)) + attr |= win->_bkgd & A_ATTRIBUTES; + else + attr |= win->_bkgd & (A_ATTRIBUTES ^ A_COLOR); + + if (ch == ' ') + ch = win->_bkgd & A_CHARTEXT; + + /* Add the attribute back into the character. */ + + ch |= attr; + + maxx = win->_maxx; + temp = &win->_y[y][x]; + + memmove(temp + 1, temp, (maxx - x - 1) * sizeof(chtype)); + + win->_lastch[y] = maxx - 1; + + if ((win->_firstch[y] == _NO_CHANGE) || (win->_firstch[y] > x)) + win->_firstch[y] = x; + + *temp = ch; + } + + PDC_sync(win); + + return OK; +} + +int insch(chtype ch) +{ + PDC_LOG(("insch() - called\n")); + + return winsch(stdscr, ch); +} + +int mvinsch(int y, int x, chtype ch) +{ + PDC_LOG(("mvinsch() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return winsch(stdscr, ch); +} + +int mvwinsch(WINDOW *win, int y, int x, chtype ch) +{ + PDC_LOG(("mvwinsch() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return winsch(win, ch); +} + +int winsrawch(WINDOW *win, chtype ch) +{ + PDC_LOG(("winsrawch() - called: win=%p ch=%x " + "(char=%c attr=0x%x)\n", win, ch, + ch & A_CHARTEXT, ch & A_ATTRIBUTES)); + + if ((ch & A_CHARTEXT) < ' ' || (ch & A_CHARTEXT) == 0x7f) + ch |= A_ALTCHARSET; + + return winsch(win, ch); +} + +int insrawch(chtype ch) +{ + PDC_LOG(("insrawch() - called\n")); + + return winsrawch(stdscr, ch); +} + +int mvinsrawch(int y, int x, chtype ch) +{ + PDC_LOG(("mvinsrawch() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return winsrawch(stdscr, ch); +} + +int mvwinsrawch(WINDOW *win, int y, int x, chtype ch) +{ + PDC_LOG(("mvwinsrawch() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return winsrawch(win, ch); +} + +#ifdef PDC_WIDE +int wins_wch(WINDOW *win, const cchar_t *wch) +{ + PDC_LOG(("wins_wch() - called\n")); + + return wch ? winsch(win, *wch) : ERR; +} + +int ins_wch(const cchar_t *wch) +{ + PDC_LOG(("ins_wch() - called\n")); + + return wins_wch(stdscr, wch); +} + +int mvins_wch(int y, int x, const cchar_t *wch) +{ + PDC_LOG(("mvins_wch() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return wins_wch(stdscr, wch); +} + +int mvwins_wch(WINDOW *win, int y, int x, const cchar_t *wch) +{ + PDC_LOG(("mvwins_wch() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wins_wch(win, wch); +} +#endif diff --git a/vendor/pdcurses/pdcurses/insstr.c b/vendor/pdcurses/pdcurses/insstr.c new file mode 100644 index 0000000..094cdc7 --- /dev/null +++ b/vendor/pdcurses/pdcurses/insstr.c @@ -0,0 +1,265 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +insstr +------ + +### Synopsis + + int insstr(const char *str); + int insnstr(const char *str, int n); + int winsstr(WINDOW *win, const char *str); + int winsnstr(WINDOW *win, const char *str, int n); + int mvinsstr(int y, int x, const char *str); + int mvinsnstr(int y, int x, const char *str, int n); + int mvwinsstr(WINDOW *win, int y, int x, const char *str); + int mvwinsnstr(WINDOW *win, int y, int x, const char *str, int n); + + int ins_wstr(const wchar_t *wstr); + int ins_nwstr(const wchar_t *wstr, int n); + int wins_wstr(WINDOW *win, const wchar_t *wstr); + int wins_nwstr(WINDOW *win, const wchar_t *wstr, int n); + int mvins_wstr(int y, int x, const wchar_t *wstr); + int mvins_nwstr(int y, int x, const wchar_t *wstr, int n); + int mvwins_wstr(WINDOW *win, int y, int x, const wchar_t *wstr); + int mvwins_nwstr(WINDOW *win, int y, int x, const wchar_t *wstr, int n); + +### Description + + The insstr() functions insert a character string into a window at the + current cursor position, by repeatedly calling winsch(). When + PDCurses is built with wide-character support enabled, the narrow- + character functions treat the string as a multibyte string in the + current locale, and convert it first. All characters to the right of + the cursor are moved to the right, with the possibility of the + rightmost characters on the line being lost. The cursor position + does not change (after moving to y, x, if specified). The routines + with n as the last argument insert at most n characters; if n is + negative, then the entire string is inserted. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + insstr | Y | Y | Y + winsstr | Y | Y | Y + mvinsstr | Y | Y | Y + mvwinsstr | Y | Y | Y + insnstr | Y | Y | Y + winsnstr | Y | Y | Y + mvinsnstr | Y | Y | Y + mvwinsnstr | Y | Y | Y + ins_wstr | Y | Y | Y + wins_wstr | Y | Y | Y + mvins_wstr | Y | Y | Y + mvwins_wstr | Y | Y | Y + ins_nwstr | Y | Y | Y + wins_nwstr | Y | Y | Y + mvins_nwstr | Y | Y | Y + mvwins_nwstr | Y | Y | Y + +**man-end****************************************************************/ + +#include + +int winsnstr(WINDOW *win, const char *str, int n) +{ +#ifdef PDC_WIDE + wchar_t wstr[513], *p; + int i; +#endif + int len; + + PDC_LOG(("winsnstr() - called: string=\"%s\" n %d \n", str, n)); + + if (!win || !str) + return ERR; + + len = strlen(str); + + if (n < 0 || n > len) + n = len; + +#ifdef PDC_WIDE + if (n > 512) + n = 512; + + p = wstr; + i = 0; + + while (str[i] && i < n) + { + int retval = PDC_mbtowc(p, str + i, n - i); + + if (retval <= 0) + break; + p++; + i += retval; + } + + while (p > wstr) + if (winsch(win, *--p) == ERR) +#else + while (n) + if (winsch(win, (unsigned char)(str[--n])) == ERR) +#endif + return ERR; + + return OK; +} + +int insstr(const char *str) +{ + PDC_LOG(("insstr() - called: string=\"%s\"\n", str)); + + return winsnstr(stdscr, str, -1); +} + +int winsstr(WINDOW *win, const char *str) +{ + PDC_LOG(("winsstr() - called: string=\"%s\"\n", str)); + + return winsnstr(win, str, -1); +} + +int mvinsstr(int y, int x, const char *str) +{ + PDC_LOG(("mvinsstr() - called: y %d x %d string=\"%s\"\n", y, x, str)); + + if (move(y, x) == ERR) + return ERR; + + return winsnstr(stdscr, str, -1); +} + +int mvwinsstr(WINDOW *win, int y, int x, const char *str) +{ + PDC_LOG(("mvwinsstr() - called: string=\"%s\"\n", str)); + + if (wmove(win, y, x) == ERR) + return ERR; + + return winsnstr(win, str, -1); +} + +int insnstr(const char *str, int n) +{ + PDC_LOG(("insnstr() - called: string=\"%s\" n %d \n", str, n)); + + return winsnstr(stdscr, str, n); +} + +int mvinsnstr(int y, int x, const char *str, int n) +{ + PDC_LOG(("mvinsnstr() - called: y %d x %d string=\"%s\" n %d \n", + y, x, str, n)); + + if (move(y, x) == ERR) + return ERR; + + return winsnstr(stdscr, str, n); +} + +int mvwinsnstr(WINDOW *win, int y, int x, const char *str, int n) +{ + PDC_LOG(("mvwinsnstr() - called: y %d x %d string=\"%s\" n %d \n", + y, x, str, n)); + + if (wmove(win, y, x) == ERR) + return ERR; + + return winsnstr(win, str, n); +} + +#ifdef PDC_WIDE +int wins_nwstr(WINDOW *win, const wchar_t *wstr, int n) +{ + const wchar_t *p; + int len; + + PDC_LOG(("wins_nwstr() - called\n")); + + if (!win || !wstr) + return ERR; + + for (len = 0, p = wstr; *p; p++) + len++; + + if (n < 0 || n > len) + n = len; + + while (n) + if (winsch(win, wstr[--n]) == ERR) + return ERR; + + return OK; +} + +int ins_wstr(const wchar_t *wstr) +{ + PDC_LOG(("ins_wstr() - called\n")); + + return wins_nwstr(stdscr, wstr, -1); +} + +int wins_wstr(WINDOW *win, const wchar_t *wstr) +{ + PDC_LOG(("wins_wstr() - called\n")); + + return wins_nwstr(win, wstr, -1); +} + +int mvins_wstr(int y, int x, const wchar_t *wstr) +{ + PDC_LOG(("mvins_wstr() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return wins_nwstr(stdscr, wstr, -1); +} + +int mvwins_wstr(WINDOW *win, int y, int x, const wchar_t *wstr) +{ + PDC_LOG(("mvwinsstr() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wins_nwstr(win, wstr, -1); +} + +int ins_nwstr(const wchar_t *wstr, int n) +{ + PDC_LOG(("ins_nwstr() - called\n")); + + return wins_nwstr(stdscr, wstr, n); +} + +int mvins_nwstr(int y, int x, const wchar_t *wstr, int n) +{ + PDC_LOG(("mvinsnstr() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return wins_nwstr(stdscr, wstr, n); +} + +int mvwins_nwstr(WINDOW *win, int y, int x, const wchar_t *wstr, int n) +{ + PDC_LOG(("mvwinsnstr() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wins_nwstr(win, wstr, n); +} +#endif diff --git a/vendor/pdcurses/pdcurses/instr.c b/vendor/pdcurses/pdcurses/instr.c new file mode 100644 index 0000000..702e8fb --- /dev/null +++ b/vendor/pdcurses/pdcurses/instr.c @@ -0,0 +1,247 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +instr +----- + +### Synopsis + + int instr(char *str); + int innstr(char *str, int n); + int winstr(WINDOW *win, char *str); + int winnstr(WINDOW *win, char *str, int n); + int mvinstr(int y, int x, char *str); + int mvinnstr(int y, int x, char *str, int n); + int mvwinstr(WINDOW *win, int y, int x, char *str); + int mvwinnstr(WINDOW *win, int y, int x, char *str, int n); + + int inwstr(wchar_t *wstr); + int innwstr(wchar_t *wstr, int n); + int winwstr(WINDOW *win, wchar_t *wstr); + int winnwstr(WINDOW *win, wchar_t *wstr, int n); + int mvinwstr(int y, int x, wchar_t *wstr); + int mvinnwstr(int y, int x, wchar_t *wstr, int n); + int mvwinwstr(WINDOW *win, int y, int x, wchar_t *wstr); + int mvwinnwstr(WINDOW *win, int y, int x, wchar_t *wstr, int n); + +### Description + + These functions take characters (or wide characters) from the current + or specified position in the window, and return them as a string in + str (or wstr). Attributes are ignored. The functions with n as the + last argument return a string at most n characters long. + +### Return Value + + Upon successful completion, innstr(), mvinnstr(), mvwinnstr() and + winnstr() return the number of characters actually read into the + string; instr(), mvinstr(), mvwinstr() and winstr() return OK. + Otherwise, all these functions return ERR. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + instr | Y | Y | Y + winstr | Y | Y | Y + mvinstr | Y | Y | Y + mvwinstr | Y | Y | Y + innstr | Y | Y | Y + winnstr | Y | Y | Y + mvinnstr | Y | Y | Y + mvwinnstr | Y | Y | Y + inwstr | Y | Y | Y + winwstr | Y | Y | Y + mvinwstr | Y | Y | Y + mvwinwstr | Y | Y | Y + innwstr | Y | Y | Y + winnwstr | Y | Y | Y + mvinnwstr | Y | Y | Y + mvwinnwstr | Y | Y | Y + +**man-end****************************************************************/ + +int winnstr(WINDOW *win, char *str, int n) +{ +#ifdef PDC_WIDE + wchar_t wstr[513]; + + if (n < 0 || n > 512) + n = 512; + + if (winnwstr(win, wstr, n) == ERR) + return ERR; + + return PDC_wcstombs(str, wstr, n); +#else + chtype *src; + int i; + + PDC_LOG(("winnstr() - called: n %d \n", n)); + + if (!win || !str) + return ERR; + + if (n < 0 || (win->_curx + n) > win->_maxx) + n = win->_maxx - win->_curx; + + src = win->_y[win->_cury] + win->_curx; + + for (i = 0; i < n; i++) + str[i] = src[i] & A_CHARTEXT; + + str[i] = '\0'; + + return i; +#endif +} + +int instr(char *str) +{ + PDC_LOG(("instr() - called: string=\"%s\"\n", str)); + + return (ERR == winnstr(stdscr, str, stdscr->_maxx)) ? ERR : OK; +} + +int winstr(WINDOW *win, char *str) +{ + PDC_LOG(("winstr() - called: \n")); + + return (ERR == winnstr(win, str, win->_maxx)) ? ERR : OK; +} + +int mvinstr(int y, int x, char *str) +{ + PDC_LOG(("mvinstr() - called: y %d x %d \n", y, x)); + + if (move(y, x) == ERR) + return ERR; + + return (ERR == winnstr(stdscr, str, stdscr->_maxx)) ? ERR : OK; +} + +int mvwinstr(WINDOW *win, int y, int x, char *str) +{ + PDC_LOG(("mvwinstr() - called: y %d x %d \n", y, x)); + + if (wmove(win, y, x) == ERR) + return ERR; + + return (ERR == winnstr(win, str, win->_maxx)) ? ERR : OK; +} + +int innstr(char *str, int n) +{ + PDC_LOG(("innstr() - called: n %d \n", n)); + + return winnstr(stdscr, str, n); +} + +int mvinnstr(int y, int x, char *str, int n) +{ + PDC_LOG(("mvinnstr() - called: y %d x %d n %d \n", y, x, n)); + + if (move(y, x) == ERR) + return ERR; + + return winnstr(stdscr, str, n); +} + +int mvwinnstr(WINDOW *win, int y, int x, char *str, int n) +{ + PDC_LOG(("mvwinnstr() - called: y %d x %d n %d \n", y, x, n)); + + if (wmove(win, y, x) == ERR) + return ERR; + + return winnstr(win, str, n); +} + +#ifdef PDC_WIDE +int winnwstr(WINDOW *win, wchar_t *wstr, int n) +{ + chtype *src; + int i; + + PDC_LOG(("winnstr() - called: n %d \n", n)); + + if (!win || !wstr) + return ERR; + + if (n < 0 || (win->_curx + n) > win->_maxx) + n = win->_maxx - win->_curx; + + src = win->_y[win->_cury] + win->_curx; + + for (i = 0; i < n; i++) + wstr[i] = src[i] & A_CHARTEXT; + + wstr[i] = L'\0'; + + return i; +} + +int inwstr(wchar_t *wstr) +{ + PDC_LOG(("inwstr() - called\n")); + + return (ERR == winnwstr(stdscr, wstr, stdscr->_maxx)) ? ERR : OK; +} + +int winwstr(WINDOW *win, wchar_t *wstr) +{ + PDC_LOG(("winwstr() - called\n")); + + return (ERR == winnwstr(win, wstr, win->_maxx)) ? ERR : OK; +} + +int mvinwstr(int y, int x, wchar_t *wstr) +{ + PDC_LOG(("mvinwstr() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return (ERR == winnwstr(stdscr, wstr, stdscr->_maxx)) ? ERR : OK; +} + +int mvwinwstr(WINDOW *win, int y, int x, wchar_t *wstr) +{ + PDC_LOG(("mvwinstr() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return (ERR == winnwstr(win, wstr, win->_maxx)) ? ERR : OK; +} + +int innwstr(wchar_t *wstr, int n) +{ + PDC_LOG(("innwstr() - called\n")); + + return winnwstr(stdscr, wstr, n); +} + +int mvinnwstr(int y, int x, wchar_t *wstr, int n) +{ + PDC_LOG(("mvinnstr() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return winnwstr(stdscr, wstr, n); +} + +int mvwinnwstr(WINDOW *win, int y, int x, wchar_t *wstr, int n) +{ + PDC_LOG(("mvwinnwstr() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return winnwstr(win, wstr, n); +} +#endif diff --git a/vendor/pdcurses/pdcurses/kernel.c b/vendor/pdcurses/pdcurses/kernel.c new file mode 100644 index 0000000..83d734b --- /dev/null +++ b/vendor/pdcurses/pdcurses/kernel.c @@ -0,0 +1,299 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +kernel +------ + +### Synopsis + + int def_prog_mode(void); + int def_shell_mode(void); + int reset_prog_mode(void); + int reset_shell_mode(void); + int resetty(void); + int savetty(void); + int ripoffline(int line, int (*init)(WINDOW *, int)); + int curs_set(int visibility); + int napms(int ms); + + int draino(int ms); + int resetterm(void); + int fixterm(void); + int saveterm(void); + +### Description + + def_prog_mode() and def_shell_mode() save the current terminal modes + as the "program" (in curses) or "shell" (not in curses) state for use + by the reset_prog_mode() and reset_shell_mode() functions. This is + done automatically by initscr(). + + reset_prog_mode() and reset_shell_mode() restore the terminal to + "program" (in curses) or "shell" (not in curses) state. These are + done automatically by endwin() and doupdate() after an endwin(), so + they would normally not be called before these functions. + + savetty() and resetty() save and restore the state of the terminal + modes. savetty() saves the current state in a buffer, and resetty() + restores the state to what it was at the last call to savetty(). + + curs_set() alters the appearance of the cursor. A visibility of 0 + makes it disappear; 1 makes it appear "normal" (usually an underline) + and 2 makes it "highly visible" (usually a block). + + ripoffline() reduces the size of stdscr by one line. If the "line" + parameter is positive, the line is removed from the top of the + screen; if negative, from the bottom. Up to 5 lines can be ripped off + stdscr by calling ripoffline() repeatedly. The function argument, + init, is called from within initscr() or newterm(), so ripoffline() + must be called before either of these functions. The init function + receives a pointer to a one-line WINDOW, and the width of the window. + Calling ripoffline() with a NULL init function pointer is an error. + + napms() suspends the program for the specified number of + milliseconds. draino() is an archaic equivalent. Note that since + napms() attempts to give up a time slice and yield control back to + the OS, all times are approximate. (In DOS, the delay is actually + rounded down to 50ms (1/20th sec) intervals, with a minimum of one + interval; i.e., 1-99 will wait 50ms, 100-149 will wait 100ms, etc.) + 0 returns immediately. + + resetterm(), fixterm() and saveterm() are archaic equivalents for + reset_shell_mode(), reset_prog_mode() and def_prog_mode(), + respectively. + +### Return Value + + All functions return OK on success and ERR on error, except + curs_set(), which returns the previous visibility. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + def_prog_mode | Y | Y | Y + def_shell_mode | Y | Y | Y + reset_prog_mode | Y | Y | Y + reset_shell_mode | Y | Y | Y + resetty | Y | Y | Y + savetty | Y | Y | Y + ripoffline | Y | Y | Y + curs_set | Y | Y | Y + napms | Y | Y | Y + fixterm | - | Y | - + resetterm | - | Y | - + saveterm | - | Y | - + draino | - | - | - + +**man-end****************************************************************/ + +#include + +RIPPEDOFFLINE linesripped[5]; +char linesrippedoff = 0; + +static struct cttyset +{ + bool been_set; + SCREEN saved; +} ctty[3]; + +enum { PDC_SH_TTY, PDC_PR_TTY, PDC_SAVE_TTY }; + +static void _save_mode(int i) +{ + ctty[i].been_set = TRUE; + + memcpy(&(ctty[i].saved), SP, sizeof(SCREEN)); + + PDC_save_screen_mode(i); +} + +static int _restore_mode(int i) +{ + if (ctty[i].been_set == TRUE) + { + memcpy(SP, &(ctty[i].saved), sizeof(SCREEN)); + + if (ctty[i].saved.raw_out) + raw(); + + PDC_restore_screen_mode(i); + + if ((LINES != ctty[i].saved.lines) || + (COLS != ctty[i].saved.cols)) + resize_term(ctty[i].saved.lines, ctty[i].saved.cols); + + PDC_curs_set(ctty[i].saved.visibility); + + PDC_gotoyx(ctty[i].saved.cursrow, ctty[i].saved.curscol); + } + + return ctty[i].been_set ? OK : ERR; +} + +int def_prog_mode(void) +{ + PDC_LOG(("def_prog_mode() - called\n")); + + if (!SP) + return ERR; + + _save_mode(PDC_PR_TTY); + + return OK; +} + +int def_shell_mode(void) +{ + PDC_LOG(("def_shell_mode() - called\n")); + + if (!SP) + return ERR; + + _save_mode(PDC_SH_TTY); + + return OK; +} + +int reset_prog_mode(void) +{ + PDC_LOG(("reset_prog_mode() - called\n")); + + if (!SP) + return ERR; + + _restore_mode(PDC_PR_TTY); + PDC_reset_prog_mode(); + + return OK; +} + +int reset_shell_mode(void) +{ + PDC_LOG(("reset_shell_mode() - called\n")); + + if (!SP) + return ERR; + + _restore_mode(PDC_SH_TTY); + PDC_reset_shell_mode(); + + return OK; +} + +int resetty(void) +{ + PDC_LOG(("resetty() - called\n")); + + if (!SP) + return ERR; + + return _restore_mode(PDC_SAVE_TTY); +} + +int savetty(void) +{ + PDC_LOG(("savetty() - called\n")); + + if (!SP) + return ERR; + + _save_mode(PDC_SAVE_TTY); + + return OK; +} + +int curs_set(int visibility) +{ + int ret_vis; + + PDC_LOG(("curs_set() - called: visibility=%d\n", visibility)); + + if (!SP || visibility < 0 || visibility > 2) + return ERR; + + ret_vis = PDC_curs_set(visibility); + + /* If the cursor is changing from invisible to visible, update + its position */ + + if (visibility && !ret_vis) + PDC_gotoyx(SP->cursrow, SP->curscol); + + return ret_vis; +} + +int napms(int ms) +{ + PDC_LOG(("napms() - called: ms=%d\n", ms)); + + if (!SP) + return ERR; + + if (SP->dirty) + { + int curs_state = SP->visibility; + bool leave_state = is_leaveok(curscr); + + SP->dirty = FALSE; + + leaveok(curscr, TRUE); + + wrefresh(curscr); + + leaveok(curscr, leave_state); + curs_set(curs_state); + } + + if (ms) + PDC_napms(ms); + + return OK; +} + +int ripoffline(int line, int (*init)(WINDOW *, int)) +{ + PDC_LOG(("ripoffline() - called: line=%d\n", line)); + + if (linesrippedoff < 5 && line && init) + { + linesripped[(int)linesrippedoff].line = line; + linesripped[(int)linesrippedoff++].init = init; + + return OK; + } + + return ERR; +} + +int draino(int ms) +{ + PDC_LOG(("draino() - called\n")); + + return napms(ms); +} + +int resetterm(void) +{ + PDC_LOG(("resetterm() - called\n")); + + return reset_shell_mode(); +} + +int fixterm(void) +{ + PDC_LOG(("fixterm() - called\n")); + + return reset_prog_mode(); +} + +int saveterm(void) +{ + PDC_LOG(("saveterm() - called\n")); + + return def_prog_mode(); +} diff --git a/vendor/pdcurses/pdcurses/keyname.c b/vendor/pdcurses/pdcurses/keyname.c new file mode 100644 index 0000000..fcdea68 --- /dev/null +++ b/vendor/pdcurses/pdcurses/keyname.c @@ -0,0 +1,131 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +keyname +------- + +### Synopsis + + char *keyname(int key); + + char *key_name(wchar_t c); + + bool has_key(int key); + +### Description + + keyname() returns a string corresponding to the argument key. key may + be any key returned by wgetch(). + + key_name() is the wide-character version. It takes a wchar_t + parameter, but still returns a char *. + + has_key() returns TRUE for recognized keys, FALSE otherwise. This + function is an ncurses extension. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + keyname | Y | Y | Y + key_name | Y | Y | Y + has_key | - | Y | Y + +**man-end****************************************************************/ + +#include + +static const char *names[] = +{ + "KEY_BREAK", "KEY_DOWN", "KEY_UP", "KEY_LEFT", "KEY_RIGHT", + "KEY_HOME", "KEY_BACKSPACE", "KEY_F0", "KEY_F(1)", "KEY_F(2)", + "KEY_F(3)", "KEY_F(4)", "KEY_F(5)", "KEY_F(6)", "KEY_F(7)", + "KEY_F(8)", "KEY_F(9)", "KEY_F(10)", "KEY_F(11)", "KEY_F(12)", + "KEY_F(13)", "KEY_F(14)", "KEY_F(15)", "KEY_F(16)", "KEY_F(17)", + "KEY_F(18)", "KEY_F(19)", "KEY_F(20)", "KEY_F(21)", "KEY_F(22)", + "KEY_F(23)", "KEY_F(24)", "KEY_F(25)", "KEY_F(26)", "KEY_F(27)", + "KEY_F(28)", "KEY_F(29)", "KEY_F(30)", "KEY_F(31)", "KEY_F(32)", + "KEY_F(33)", "KEY_F(34)", "KEY_F(35)", "KEY_F(36)", "KEY_F(37)", + "KEY_F(38)", "KEY_F(39)", "KEY_F(40)", "KEY_F(41)", "KEY_F(42)", + "KEY_F(43)", "KEY_F(44)", "KEY_F(45)", "KEY_F(46)", "KEY_F(47)", + "KEY_F(48)", "KEY_F(49)", "KEY_F(50)", "KEY_F(51)", "KEY_F(52)", + "KEY_F(53)", "KEY_F(54)", "KEY_F(55)", "KEY_F(56)", "KEY_F(57)", + "KEY_F(58)", "KEY_F(59)", "KEY_F(60)", "KEY_F(61)", "KEY_F(62)", + "KEY_F(63)", "KEY_DL", "KEY_IL", "KEY_DC", "KEY_IC", "KEY_EIC", + "KEY_CLEAR", "KEY_EOS", "KEY_EOL", "KEY_SF", "KEY_SR", "KEY_NPAGE", + "KEY_PPAGE", "KEY_STAB", "KEY_CTAB", "KEY_CATAB", "KEY_ENTER", + "KEY_SRESET", "KEY_RESET", "KEY_PRINT", "KEY_LL", "KEY_ABORT", + "KEY_SHELP", "KEY_LHELP", "KEY_BTAB", "KEY_BEG", "KEY_CANCEL", + "KEY_CLOSE", "KEY_COMMAND", "KEY_COPY", "KEY_CREATE", "KEY_END", + "KEY_EXIT", "KEY_FIND", "KEY_HELP", "KEY_MARK", "KEY_MESSAGE", + "KEY_MOVE", "KEY_NEXT", "KEY_OPEN", "KEY_OPTIONS", "KEY_PREVIOUS", + "KEY_REDO", "KEY_REFERENCE", "KEY_REFRESH", "KEY_REPLACE", + "KEY_RESTART", "KEY_RESUME", "KEY_SAVE", "KEY_SBEG", "KEY_SCANCEL", + "KEY_SCOMMAND", "KEY_SCOPY", "KEY_SCREATE", "KEY_SDC", "KEY_SDL", + "KEY_SELECT", "KEY_SEND", "KEY_SEOL", "KEY_SEXIT", "KEY_SFIND", + "KEY_SHOME", "KEY_SIC", "UNKNOWN KEY", "KEY_SLEFT", "KEY_SMESSAGE", + "KEY_SMOVE", "KEY_SNEXT", "KEY_SOPTIONS", "KEY_SPREVIOUS", + "KEY_SPRINT", "KEY_SREDO", "KEY_SREPLACE", "KEY_SRIGHT", + "KEY_SRSUME", "KEY_SSAVE", "KEY_SSUSPEND", "KEY_SUNDO", + "KEY_SUSPEND", "KEY_UNDO", "ALT_0", "ALT_1", "ALT_2", "ALT_3", + "ALT_4", "ALT_5", "ALT_6", "ALT_7", "ALT_8", "ALT_9", "ALT_A", + "ALT_B", "ALT_C", "ALT_D", "ALT_E", "ALT_F", "ALT_G", "ALT_H", + "ALT_I", "ALT_J", "ALT_K", "ALT_L", "ALT_M", "ALT_N", "ALT_O", + "ALT_P", "ALT_Q", "ALT_R", "ALT_S", "ALT_T", "ALT_U", "ALT_V", + "ALT_W", "ALT_X", "ALT_Y", "ALT_Z", "CTL_LEFT", "CTL_RIGHT", + "CTL_PGUP", "CTL_PGDN", "CTL_HOME", "CTL_END", "KEY_A1", "KEY_A2", + "KEY_A3", "KEY_B1", "KEY_B2", "KEY_B3", "KEY_C1", "KEY_C2", + "KEY_C3", "PADSLASH", "PADENTER", "CTL_PADENTER", "ALT_PADENTER", + "PADSTOP", "PADSTAR", "PADMINUS", "PADPLUS", "CTL_PADSTOP", + "CTL_PADCENTER", "CTL_PADPLUS", "CTL_PADMINUS", "CTL_PADSLASH", + "CTL_PADSTAR", "ALT_PADPLUS", "ALT_PADMINUS", "ALT_PADSLASH", + "ALT_PADSTAR", "ALT_PADSTOP", "CTL_INS", "ALT_DEL", "ALT_INS", + "CTL_UP", "CTL_DOWN", "CTL_TAB", "ALT_TAB", "ALT_MINUS", + "ALT_EQUAL", "ALT_HOME", "ALT_PGUP", "ALT_PGDN", "ALT_END", + "ALT_UP", "ALT_DOWN", "ALT_RIGHT", "ALT_LEFT", "ALT_ENTER", + "ALT_ESC", "ALT_BQUOTE", "ALT_LBRACKET", "ALT_RBRACKET", + "ALT_SEMICOLON", "ALT_FQUOTE", "ALT_COMMA", "ALT_STOP", + "ALT_FSLASH", "ALT_BKSP", "CTL_BKSP", "PAD0", "CTL_PAD0", + "CTL_PAD1", "CTL_PAD2", "CTL_PAD3", "CTL_PAD4", "CTL_PAD5", + "CTL_PAD6", "CTL_PAD7","CTL_PAD8", "CTL_PAD9", "ALT_PAD0", + "ALT_PAD1", "ALT_PAD2", "ALT_PAD3", "ALT_PAD4", "ALT_PAD5", + "ALT_PAD6", "ALT_PAD7", "ALT_PAD8", "ALT_PAD9", "CTL_DEL", + "ALT_BSLASH", "CTL_ENTER", "SHF_PADENTER", "SHF_PADSLASH", + "SHF_PADSTAR", "SHF_PADPLUS", "SHF_PADMINUS", "SHF_UP", "SHF_DOWN", + "SHF_IC", "SHF_DC", "KEY_MOUSE", "KEY_SHIFT_L", "KEY_SHIFT_R", + "KEY_CONTROL_L", "KEY_CONTROL_R", "KEY_ALT_L", "KEY_ALT_R", + "KEY_RESIZE", "KEY_SUP", "KEY_SDOWN" +}; + +char *keyname(int key) +{ + static char _keyname[14]; + + /* Key names must be in exactly the same order as in curses.h */ + + PDC_LOG(("keyname() - called: key %d\n", key)); + + strcpy(_keyname, ((key >= 0) && (key < 0x80)) ? unctrl((chtype)key) : + has_key(key) ? names[key - KEY_MIN] : "UNKNOWN KEY"); + + return _keyname; +} + +bool has_key(int key) +{ + PDC_LOG(("has_key() - called: key %d\n", key)); + + return (key >= KEY_MIN && key <= KEY_MAX); +} + +#ifdef PDC_WIDE +char *key_name(wchar_t c) +{ + PDC_LOG(("key_name() - called\n")); + + return keyname((int)c); +} +#endif diff --git a/vendor/pdcurses/pdcurses/mouse.c b/vendor/pdcurses/pdcurses/mouse.c new file mode 100644 index 0000000..8cf685b --- /dev/null +++ b/vendor/pdcurses/pdcurses/mouse.c @@ -0,0 +1,423 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +mouse +----- + +### Synopsis + + int mouse_set(mmask_t mbe); + int mouse_on(mmask_t mbe); + int mouse_off(mmask_t mbe); + int request_mouse_pos(void); + void wmouse_position(WINDOW *win, int *y, int *x); + mmask_t getmouse(void); + + int mouseinterval(int wait); + bool wenclose(const WINDOW *win, int y, int x); + bool wmouse_trafo(const WINDOW *win, int *y, int *x, bool to_screen); + bool mouse_trafo(int *y, int *x, bool to_screen); + mmask_t mousemask(mmask_t mask, mmask_t *oldmask); + int nc_getmouse(MEVENT *event); + int ungetmouse(MEVENT *event); + bool has_mouse(void); + +### Description + + As of PDCurses 3.0, there are two separate mouse interfaces: the + classic interface, which is based on the undocumented Sys V mouse + functions; and an ncurses-compatible interface. Both are active at + all times, and you can mix and match functions from each, though it's + not recommended. The ncurses interface is essentially an emulation + layer built on top of the classic interface; it's here to allow + easier porting of ncurses apps. + + The classic interface: mouse_set(), mouse_on(), mouse_off(), + request_mouse_pos(), wmouse_position(), and getmouse(). An + application using this interface would start by calling mouse_set() + or mouse_on() with a non-zero value, often ALL_MOUSE_EVENTS. Then it + would check for a KEY_MOUSE return from getch(). If found, it would + call request_mouse_pos() to get the current mouse status. + + mouse_set(), mouse_on() and mouse_off() are analagous to attrset(), + attron() and attroff(). These functions set the mouse button events + to trap. The button masks used in these functions are defined in + curses.h and can be or'ed together. They are the group of masks + starting with BUTTON1_RELEASED. + + request_mouse_pos() requests curses to fill in the Mouse_status + structure with the current state of the mouse. + + wmouse_position() determines if the current mouse position is within + the window passed as an argument. If the mouse is outside the current + window, -1 is returned in the y and x arguments; otherwise the y and + x coordinates of the mouse (relative to the top left corner of the + window) are returned in y and x. + + getmouse() returns the current status of the trapped mouse buttons as + set by mouse_set() or mouse_on(). + + The ncurses interface: mouseinterval(), wenclose(), wmouse_trafo(), + mouse_trafo(), mousemask(), nc_getmouse(), ungetmouse() and + has_mouse(). A typical application using this interface would start + by calling mousemask() with a non-zero value, often ALL_MOUSE_EVENTS. + Then it would check for a KEY_MOUSE return from getch(). If found, it + would call nc_getmouse() to get the current mouse status. + + mouseinterval() sets the timeout for a mouse click. On all current + platforms, PDCurses receives mouse button press and release events, + but must synthesize click events. It does this by checking whether a + release event is queued up after a press event. If it gets a press + event, and there are no more events waiting, it will wait for the + timeout interval, then check again for a release. A press followed by + a release is reported as BUTTON_CLICKED; otherwise it's passed + through as BUTTON_PRESSED. The default timeout is 150ms; valid values + are 0 (no clicks reported) through 1000ms. In x11, the timeout can + also be set via the clickPeriod resource. The return value from + mouseinterval() is the old timeout. To check the old value without + setting a new one, call it with a parameter of -1. Note that although + there's no classic equivalent for this function (apart from the + clickPeriod resource), the value set applies in both interfaces. + + wenclose() reports whether the given screen-relative y, x coordinates + fall within the given window. + + wmouse_trafo() converts between screen-relative and window-relative + coordinates. A to_screen parameter of TRUE means to convert from + window to screen; otherwise the reverse. The function returns FALSE + if the coordinates aren't within the window, or if any of the + parameters are NULL. The coordinates have been converted when the + function returns TRUE. + + mouse_trafo() is the stdscr version of wmouse_trafo(). + + mousemask() is nearly equivalent to mouse_set(), but instead of + OK/ERR, it returns the value of the mask after setting it. (This + isn't necessarily the same value passed in, since the mask could be + altered on some platforms.) And if the second parameter is a non-null + pointer, mousemask() stores the previous mask value there. Also, + since the ncurses interface doesn't work with PDCurses' BUTTON_MOVED + events, mousemask() filters them out. + + nc_getmouse() returns the current mouse status in an MEVENT struct. + This is equivalent to ncurses' getmouse(), renamed to avoid conflict + with PDCurses' getmouse(). But if you define PDC_NCMOUSE before + including curses.h, it defines getmouse() to nc_getmouse(), along + with a few other redefintions needed for compatibility with ncurses + code. nc_getmouse() calls request_mouse_pos(), which (not getmouse()) + is the classic equivalent. + + ungetmouse() is the mouse equivalent of ungetch(). However, PDCurses + doesn't maintain a queue of mouse events; only one can be pushed + back, and it can overwrite or be overwritten by real mouse events. + + has_mouse() reports whether the mouse is available at all on the + current platform. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + mouse_set | - | - | - + mouse_on | - | - | - + mouse_off | - | - | - + request_mouse_pos | - | - | - + wmouse_position | - | - | - + getmouse | - | * | - + mouseinterval | - | Y | - + wenclose | - | Y | - + wmouse_trafo | - | Y | - + mouse_trafo | - | Y | - + mousemask | - | Y | - + nc_getmouse | - | * | - + ungetmouse | - | Y | - + has_mouse | - | Y | - + + \* See above, under Description + +**man-end****************************************************************/ + +#include + +static bool ungot = FALSE; + +int mouse_set(mmask_t mbe) +{ + PDC_LOG(("mouse_set() - called: event %x\n", mbe)); + + if (!SP) + return ERR; + + SP->_trap_mbe = mbe; + return PDC_mouse_set(); +} + +int mouse_on(mmask_t mbe) +{ + PDC_LOG(("mouse_on() - called: event %x\n", mbe)); + + if (!SP) + return ERR; + + SP->_trap_mbe |= mbe; + return PDC_mouse_set(); +} + +int mouse_off(mmask_t mbe) +{ + PDC_LOG(("mouse_off() - called: event %x\n", mbe)); + + if (!SP) + return ERR; + + SP->_trap_mbe &= ~mbe; + return PDC_mouse_set(); +} + +int request_mouse_pos(void) +{ + PDC_LOG(("request_mouse_pos() - called\n")); + + Mouse_status = SP->mouse_status; + + return OK; +} + +void wmouse_position(WINDOW *win, int *y, int *x) +{ + PDC_LOG(("wmouse_position() - called\n")); + + if (win && wenclose(win, MOUSE_Y_POS, MOUSE_X_POS)) + { + if (y) + *y = MOUSE_Y_POS - win->_begy; + if (x) + *x = MOUSE_X_POS - win->_begx; + } + else + { + if (y) + *y = -1; + if (x) + *x = -1; + } +} + +mmask_t getmouse(void) +{ + PDC_LOG(("getmouse() - called\n")); + + return SP ? SP->_trap_mbe : (mmask_t)0; +} + +/* ncurses mouse interface */ + +int mouseinterval(int wait) +{ + int old_wait; + + PDC_LOG(("mouseinterval() - called: %d\n", wait)); + + if (!SP) + return ERR; + + old_wait = SP->mouse_wait; + + if (wait >= 0 && wait <= 1000) + SP->mouse_wait = wait; + + return old_wait; +} + +bool wenclose(const WINDOW *win, int y, int x) +{ + PDC_LOG(("wenclose() - called: %p %d %d\n", win, y, x)); + + return (win && y >= win->_begy && y < win->_begy + win->_maxy + && x >= win->_begx && x < win->_begx + win->_maxx); +} + +bool wmouse_trafo(const WINDOW *win, int *y, int *x, bool to_screen) +{ + int newy, newx; + + PDC_LOG(("wmouse_trafo() - called\n")); + + if (!win || !y || !x) + return FALSE; + + newy = *y; + newx = *x; + + if (to_screen) + { + newy += win->_begy; + newx += win->_begx; + + if (!wenclose(win, newy, newx)) + return FALSE; + } + else + { + if (wenclose(win, newy, newx)) + { + newy -= win->_begy; + newx -= win->_begx; + } + else + return FALSE; + } + + *y = newy; + *x = newx; + + return TRUE; +} + +bool mouse_trafo(int *y, int *x, bool to_screen) +{ + PDC_LOG(("mouse_trafo() - called\n")); + + return wmouse_trafo(stdscr, y, x, to_screen); +} + +mmask_t mousemask(mmask_t mask, mmask_t *oldmask) +{ + PDC_LOG(("mousemask() - called\n")); + + if (!SP) + return (mmask_t)0; + + if (oldmask) + *oldmask = SP->_trap_mbe; + + /* The ncurses interface doesn't work with our move events, so + filter them here */ + + mask &= ~(BUTTON1_MOVED | BUTTON2_MOVED | BUTTON3_MOVED); + + mouse_set(mask); + + return SP->_trap_mbe; +} + +int nc_getmouse(MEVENT *event) +{ + int i; + mmask_t bstate = 0; + + PDC_LOG(("nc_getmouse() - called\n")); + + if (!event || !SP) + return ERR; + + ungot = FALSE; + + request_mouse_pos(); + + event->id = 0; + + event->x = Mouse_status.x; + event->y = Mouse_status.y; + event->z = 0; + + for (i = 0; i < 3; i++) + { + if (Mouse_status.changes & (1 << i)) + { + int shf = i * 5; + short button = Mouse_status.button[i] & BUTTON_ACTION_MASK; + + if (button == BUTTON_RELEASED) + bstate |= (BUTTON1_RELEASED << shf); + else if (button == BUTTON_PRESSED) + bstate |= (BUTTON1_PRESSED << shf); + else if (button == BUTTON_CLICKED) + bstate |= (BUTTON1_CLICKED << shf); + else if (button == BUTTON_DOUBLE_CLICKED) + bstate |= (BUTTON1_DOUBLE_CLICKED << shf); + + button = Mouse_status.button[i] & BUTTON_MODIFIER_MASK; + + if (button & PDC_BUTTON_SHIFT) + bstate |= BUTTON_MODIFIER_SHIFT; + if (button & PDC_BUTTON_CONTROL) + bstate |= BUTTON_MODIFIER_CONTROL; + if (button & PDC_BUTTON_ALT) + bstate |= BUTTON_MODIFIER_ALT; + } + } + + if (MOUSE_WHEEL_UP) + bstate |= BUTTON4_PRESSED; + else if (MOUSE_WHEEL_DOWN) + bstate |= BUTTON5_PRESSED; + + /* extra filter pass -- mainly for button modifiers */ + + event->bstate = bstate & SP->_trap_mbe; + + return OK; +} + +int ungetmouse(MEVENT *event) +{ + int i; + mmask_t bstate; + + PDC_LOG(("ungetmouse() - called\n")); + + if (!event || ungot) + return ERR; + + ungot = TRUE; + + SP->mouse_status.x = event->x; + SP->mouse_status.y = event->y; + + SP->mouse_status.changes = 0; + bstate = event->bstate; + + for (i = 0; i < 3; i++) + { + int shf = i * 5; + short button = 0; + + if (bstate & ((BUTTON1_RELEASED | BUTTON1_PRESSED | + BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED) << shf)) + { + SP->mouse_status.changes |= 1 << i; + + if (bstate & (BUTTON1_PRESSED << shf)) + button = BUTTON_PRESSED; + if (bstate & (BUTTON1_CLICKED << shf)) + button = BUTTON_CLICKED; + if (bstate & (BUTTON1_DOUBLE_CLICKED << shf)) + button = BUTTON_DOUBLE_CLICKED; + + if (bstate & BUTTON_MODIFIER_SHIFT) + button |= PDC_BUTTON_SHIFT; + if (bstate & BUTTON_MODIFIER_CONTROL) + button |= PDC_BUTTON_CONTROL; + if (bstate & BUTTON_MODIFIER_ALT) + button |= PDC_BUTTON_ALT; + } + + SP->mouse_status.button[i] = button; + } + + if (bstate & BUTTON4_PRESSED) + SP->mouse_status.changes |= PDC_MOUSE_WHEEL_UP; + else if (bstate & BUTTON5_PRESSED) + SP->mouse_status.changes |= PDC_MOUSE_WHEEL_DOWN; + + return PDC_ungetch(KEY_MOUSE); +} + +bool has_mouse(void) +{ + return PDC_has_mouse(); +} diff --git a/vendor/pdcurses/pdcurses/move.c b/vendor/pdcurses/pdcurses/move.c new file mode 100644 index 0000000..19e8f66 --- /dev/null +++ b/vendor/pdcurses/pdcurses/move.c @@ -0,0 +1,79 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +move +---- + +### Synopsis + + int move(int y, int x); + int mvcur(int oldrow, int oldcol, int newrow, int newcol); + int wmove(WINDOW *win, int y, int x); + +### Description + + move() and wmove() move the cursor associated with the window to the + given location. This does not move the physical cursor of the + terminal until refresh() is called. The position specified is + relative to the upper left corner of the window, which is (0,0). + + mvcur() moves the physical cursor without updating any window cursor + positions. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + move | Y | Y | Y + mvcur | Y | Y | Y + wmove | Y | Y | Y + +**man-end****************************************************************/ + +int move(int y, int x) +{ + PDC_LOG(("move() - called: y=%d x=%d\n", y, x)); + + if (!stdscr || x < 0 || y < 0 || x >= stdscr->_maxx || y >= stdscr->_maxy) + return ERR; + + stdscr->_curx = x; + stdscr->_cury = y; + + return OK; +} + +int mvcur(int oldrow, int oldcol, int newrow, int newcol) +{ + PDC_LOG(("mvcur() - called: oldrow %d oldcol %d newrow %d newcol %d\n", + oldrow, oldcol, newrow, newcol)); + + if (!SP || newrow < 0 || newrow >= LINES || newcol < 0 || newcol >= COLS) + return ERR; + + PDC_gotoyx(newrow, newcol); + SP->cursrow = newrow; + SP->curscol = newcol; + + return OK; +} + +int wmove(WINDOW *win, int y, int x) +{ + PDC_LOG(("wmove() - called: y=%d x=%d\n", y, x)); + + if (!win || x < 0 || y < 0 || x >= win->_maxx || y >= win->_maxy) + return ERR; + + win->_curx = x; + win->_cury = y; + + return OK; +} diff --git a/vendor/pdcurses/pdcurses/outopts.c b/vendor/pdcurses/pdcurses/outopts.c new file mode 100644 index 0000000..7a758f4 --- /dev/null +++ b/vendor/pdcurses/pdcurses/outopts.c @@ -0,0 +1,262 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +outopts +------- + +### Synopsis + + int clearok(WINDOW *win, bool bf); + int idlok(WINDOW *win, bool bf); + void idcok(WINDOW *win, bool bf); + void immedok(WINDOW *win, bool bf); + int leaveok(WINDOW *win, bool bf); + int setscrreg(int top, int bot); + int wsetscrreg(WINDOW *win, int top, int bot); + int wgetscrreg(const WINDOW *win, int *top, int *bot); + int scrollok(WINDOW *win, bool bf); + + int raw_output(bool bf); + + bool is_cleared(const WINDOW *win); + bool is_idlok(const WINDOW *win); + bool is_idcok(const WINDOW *win); + bool is_immedok(const WINDOW *win); + bool is_leaveok(const WINDOW *win); + bool is_scrollok(const WINDOW *win); + +### Description + + With clearok(), if bf is TRUE, the next call to wrefresh() with this + window will clear the screen completely and redraw the entire screen. + + immedok(), called with a second argument of TRUE, causes an automatic + wrefresh() every time a change is made to the specified window. + + Normally, the hardware cursor is left at the location of the window + being refreshed. leaveok() allows the cursor to be left wherever the + update happens to leave it. It's useful for applications where the + cursor is not used, since it reduces the need for cursor motions. If + possible, the cursor is made invisible when this option is enabled. + + wsetscrreg() sets a scrolling region in a window; "top" and "bot" are + the line numbers for the top and bottom margins. If this option and + scrollok() are enabled, any attempt to move off the bottom margin + will cause all lines in the scrolling region to scroll up one line. + setscrreg() is the stdscr version. + + wgetscrreg() gets the top and bottom margins as set in wsetscrreg(). + + idlok() and idcok() do nothing in PDCurses, but are provided for + compatibility with other curses implementations, likewise is_idlok() + and is_idcok(). + + raw_output() enables the output of raw characters using the standard + *add* and *ins* curses functions (that is, it disables translation of + control characters). + + is_cleared() reports whether the specified window causes clear at next + refresh. + + is_immedok() reports whether the specified window is in immedok mode. + + is_leaveok() reports whether the specified window is in leaveok mode. + + is_scrollok() reports whether the specified window allows scrolling. + +### Return Value + + is_cleared(), is_immedok(), is_leaveok() and is_scrollok() return TRUE + or FALSE. is_idlok() and is_idcok() are provided for compatibility with + other curses implementations, and always return FALSE. All others + return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + clearok | Y | Y | Y + idlok | Y | Y | Y + idcok | Y | Y | Y + immedok | Y | Y | Y + leaveok | Y | Y | Y + setscrreg | Y | Y | Y + wsetscrreg | Y | Y | Y + wgetscrreg | - | Y | - + scrollok | Y | Y | Y + is_cleared | - | Y | - + is_idlok | - | Y | - + is_idcok | - | Y | - + is_immedok | - | Y | - + is_leaveok | - | Y | Y + is_scrollok | - | Y | - + raw_output | - | - | - + +**man-end****************************************************************/ + +int clearok(WINDOW *win, bool bf) +{ + PDC_LOG(("clearok() - called\n")); + + if (!win) + return ERR; + + win->_clear = bf; + + return OK; +} + +int idlok(WINDOW *win, bool bf) +{ + PDC_LOG(("idlok() - called\n")); + + return OK; +} + +void idcok(WINDOW *win, bool bf) +{ + PDC_LOG(("idcok() - called\n")); +} + +void immedok(WINDOW *win, bool bf) +{ + PDC_LOG(("immedok() - called\n")); + + if (win) + win->_immed = bf; +} + +int leaveok(WINDOW *win, bool bf) +{ + PDC_LOG(("leaveok() - called\n")); + + if (!win) + return ERR; + + win->_leaveit = bf; + + curs_set(!bf); + + return OK; +} + +int setscrreg(int top, int bottom) +{ + PDC_LOG(("setscrreg() - called: top %d bottom %d\n", top, bottom)); + + return wsetscrreg(stdscr, top, bottom); +} + +int wsetscrreg(WINDOW *win, int top, int bottom) +{ + PDC_LOG(("wsetscrreg() - called: top %d bottom %d\n", top, bottom)); + + if (win && 0 <= top && top <= win->_cury && + win->_cury <= bottom && bottom < win->_maxy) + { + win->_tmarg = top; + win->_bmarg = bottom; + + return OK; + } + else + return ERR; +} + +int wgetscrreg(const WINDOW *win, int *top, int *bot) +{ + PDC_LOG(("wgetscrreg() - called\n")); + + if (!win || !top || !bot) + return ERR; + + *top = win->_tmarg; + *bot = win->_bmarg; + + return OK; +} + +int scrollok(WINDOW *win, bool bf) +{ + PDC_LOG(("scrollok() - called\n")); + + if (!win) + return ERR; + + win->_scroll = bf; + + return OK; +} + +int raw_output(bool bf) +{ + PDC_LOG(("raw_output() - called\n")); + + if (!SP) + return ERR; + + SP->raw_out = bf; + + return OK; +} + +bool is_cleared(const WINDOW *win) +{ + PDC_LOG(("is_cleared() - called\n")); + + if (!win) + return FALSE; + + return win->_clear; +} + +bool is_idlok(const WINDOW *win) +{ + (void) win; + + PDC_LOG(("is_idlok() - called\n")); + + return FALSE; +} + +bool is_idcok(const WINDOW *win) +{ + (void) win; + + PDC_LOG(("is_idcok() - called\n")); + + return FALSE; +} + +bool is_immedok(const WINDOW *win) +{ + PDC_LOG(("is_immedok() - called\n")); + + if (!win) + return FALSE; + + return win->_immed; +} + +bool is_leaveok(const WINDOW *win) +{ + PDC_LOG(("is_leaveok() - called\n")); + + if (!win) + return FALSE; + + return win->_leaveit; +} + +bool is_scrollok(const WINDOW *win) +{ + PDC_LOG(("is_scrollok() - called\n")); + + if (!win) + return FALSE; + + return win->_scroll; +} diff --git a/vendor/pdcurses/pdcurses/overlay.c b/vendor/pdcurses/pdcurses/overlay.c new file mode 100644 index 0000000..e784805 --- /dev/null +++ b/vendor/pdcurses/pdcurses/overlay.c @@ -0,0 +1,216 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +overlay +------- + +### Synopsis + + int overlay(const WINDOW *src_w, WINDOW *dst_w) + int overwrite(const WINDOW *src_w, WINDOW *dst_w) + int copywin(const WINDOW *src_w, WINDOW *dst_w, int src_tr, + int src_tc, int dst_tr, int dst_tc, int dst_br, + int dst_bc, int _overlay) + +### Description + + overlay() and overwrite() copy all the text from src_w into dst_w. + The windows need not be the same size. Those characters in the source + window that intersect with the destination window are copied, so that + the characters appear in the same physical position on the screen. + The difference between the two functions is that overlay() is non- + destructive (blanks are not copied) while overwrite() is destructive + (blanks are copied). + + copywin() is similar, but doesn't require that the two windows + overlap. The arguments src_tc and src_tr specify the top left corner + of the region to be copied. dst_tc, dst_tr, dst_br, and dst_bc + specify the region within the destination window to copy to. The + argument "overlay", if TRUE, indicates that the copy is done non- + destructively (as in overlay()); blanks in the source window are not + copied to the destination window. When overlay is FALSE, blanks are + copied. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + overlay | Y | Y | Y + overwrite | Y | Y | Y + copywin | Y | Y | Y + +**man-end****************************************************************/ + +/* Thanks to Andreas Otte for the + corrected overlay()/overwrite() behavior. */ + +static int _copy_win(const WINDOW *src_w, WINDOW *dst_w, int src_tr, + int src_tc, int src_br, int src_bc, int dst_tr, + int dst_tc, bool _overlay) +{ + int col, line, y1, fc, *minchng, *maxchng; + chtype *w1ptr, *w2ptr; + + int lc = 0; + int xdiff = src_bc - src_tc; + int ydiff = src_br - src_tr; + + if (!src_w || !dst_w) + return ERR; + + minchng = dst_w->_firstch; + maxchng = dst_w->_lastch; + + for (y1 = 0; y1 < dst_tr; y1++) + { + minchng++; + maxchng++; + } + + for (line = 0; line < ydiff; line++) + { + w1ptr = src_w->_y[line + src_tr] + src_tc; + w2ptr = dst_w->_y[line + dst_tr] + dst_tc; + + fc = _NO_CHANGE; + + for (col = 0; col < xdiff; col++) + { + if ((*w1ptr) != (*w2ptr) && + !((*w1ptr & A_CHARTEXT) == ' ' && _overlay)) + { + *w2ptr = *w1ptr; + + if (fc == _NO_CHANGE) + fc = col + dst_tc; + + lc = col + dst_tc; + } + + w1ptr++; + w2ptr++; + } + + if (*minchng == _NO_CHANGE) + { + *minchng = fc; + *maxchng = lc; + } + else if (fc != _NO_CHANGE) + { + if (fc < *minchng) + *minchng = fc; + if (lc > *maxchng) + *maxchng = lc; + } + + minchng++; + maxchng++; + } + + return OK; +} + +int _copy_overlap(const WINDOW *src_w, WINDOW *dst_w, bool overlay) +{ + int first_line, first_col, last_line, last_col; + int src_start_x, src_start_y, dst_start_x, dst_start_y; + int xdiff, ydiff; + + if (!src_w || !dst_w) + return ERR; + + first_col = max(dst_w->_begx, src_w->_begx); + first_line = max(dst_w->_begy, src_w->_begy); + + last_col = min(src_w->_begx + src_w->_maxx, dst_w->_begx + dst_w->_maxx); + last_line = min(src_w->_begy + src_w->_maxy, dst_w->_begy + dst_w->_maxy); + + /* determine the overlapping region of the two windows in real + coordinates */ + + /* if no overlapping region, do nothing */ + + if ((last_col < first_col) || (last_line < first_line)) + return OK; + + /* size of overlapping region */ + + xdiff = last_col - first_col; + ydiff = last_line - first_line; + + if (src_w->_begx <= dst_w->_begx) + { + src_start_x = dst_w->_begx - src_w->_begx; + dst_start_x = 0; + } + else + { + dst_start_x = src_w->_begx - dst_w->_begx; + src_start_x = 0; + } + + if (src_w->_begy <= dst_w->_begy) + { + src_start_y = dst_w->_begy - src_w->_begy; + dst_start_y = 0; + } + else + { + dst_start_y = src_w->_begy - dst_w->_begy; + src_start_y = 0; + } + + return _copy_win(src_w, dst_w, src_start_y, src_start_x, + src_start_y + ydiff, src_start_x + xdiff, + dst_start_y, dst_start_x, overlay); +} + +int overlay(const WINDOW *src_w, WINDOW *dst_w) +{ + PDC_LOG(("overlay() - called\n")); + + return _copy_overlap(src_w, dst_w, TRUE); +} + +int overwrite(const WINDOW *src_w, WINDOW *dst_w) +{ + PDC_LOG(("overwrite() - called\n")); + + return _copy_overlap(src_w, dst_w, FALSE); +} + +int copywin(const WINDOW *src_w, WINDOW *dst_w, int src_tr, int src_tc, + int dst_tr, int dst_tc, int dst_br, int dst_bc, int _overlay) +{ + int src_end_x, src_end_y; + int src_rows, src_cols, dst_rows, dst_cols; + int min_rows, min_cols; + + PDC_LOG(("copywin() - called\n")); + + if (!src_w || !dst_w || dst_w == curscr || dst_br >= dst_w->_maxy + || dst_bc >= dst_w->_maxx || dst_tr < 0 || dst_tc < 0) + return ERR; + + src_rows = src_w->_maxy - src_tr; + src_cols = src_w->_maxx - src_tc; + dst_rows = dst_br - dst_tr + 1; + dst_cols = dst_bc - dst_tc + 1; + + min_rows = min(src_rows, dst_rows); + min_cols = min(src_cols, dst_cols); + + src_end_y = src_tr + min_rows; + src_end_x = src_tc + min_cols; + + return _copy_win(src_w, dst_w, src_tr, src_tc, src_end_y, src_end_x, + dst_tr, dst_tc, _overlay); +} diff --git a/vendor/pdcurses/pdcurses/pad.c b/vendor/pdcurses/pdcurses/pad.c new file mode 100644 index 0000000..bdf9aaa --- /dev/null +++ b/vendor/pdcurses/pdcurses/pad.c @@ -0,0 +1,276 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +pad +--- + +### Synopsis + + WINDOW *newpad(int nlines, int ncols); + WINDOW *subpad(WINDOW *orig, int nlines, int ncols, + int begy, int begx); + int prefresh(WINDOW *win, int py, int px, int sy1, int sx1, + int sy2, int sx2); + int pnoutrefresh(WINDOW *w, int py, int px, int sy1, int sx1, + int sy2, int sx2); + int pechochar(WINDOW *pad, chtype ch); + int pecho_wchar(WINDOW *pad, const cchar_t *wch); + + bool is_pad(const WINDOW *pad); + +### Description + + A pad is a special kind of window, which is not restricted by the + screen size, and is not necessarily associated with a particular part + of the screen. You can use a pad when you need a large window, and + only a part of the window will be on the screen at one time. Pads are + not refreshed automatically (e.g., from scrolling or echoing of + input). You can't call wrefresh() with a pad as an argument; use + prefresh() or pnoutrefresh() instead. Note that these routines + require additional parameters to specify the part of the pad to be + displayed, and the location to use on the screen. + + newpad() creates a new pad data structure. + + subpad() creates a new sub-pad within a pad, at position (begy, + begx), with dimensions of nlines lines and ncols columns. This + position is relative to the pad, and not to the screen as with + subwin. Changes to either the parent pad or sub-pad will affect both. + When using sub-pads, you may need to call touchwin() before calling + prefresh(). + + pnoutrefresh() copies the specified pad to the virtual screen. + + prefresh() calls pnoutrefresh(), followed by doupdate(). + + These routines are analogous to wnoutrefresh() and wrefresh(). (py, + px) specifies the upper left corner of the part of the pad to be + displayed; (sy1, sx1) and (sy2, sx2) describe the screen rectangle + that will contain the selected part of the pad. + + pechochar() is functionally equivalent to addch() followed by a call + to prefresh(), with the last-used coordinates and dimensions. + pecho_wchar() is the wide-character version. + + is_pad() reports whether the specified window is a pad. + +### Return Value + + All functions except is_pad() return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + newpad | Y | Y | Y + subpad | Y | Y | Y + prefresh | Y | Y | Y + pnoutrefresh | Y | Y | Y + pechochar | Y | Y | Y + pecho_wchar | Y | Y | Y + is_pad | - | Y | Y + +**man-end****************************************************************/ + +#include + +WINDOW *newpad(int nlines, int ncols) +{ + WINDOW *win; + + PDC_LOG(("newpad() - called: lines=%d cols=%d\n", nlines, ncols)); + + win = PDC_makenew(nlines, ncols, 0, 0); + if (win) + win = PDC_makelines(win); + + if (!win) + return (WINDOW *)NULL; + + werase(win); + + win->_flags = _PAD; + win->_pad._pad_y = 0; + win->_pad._pad_x = 0; + win->_pad._pad_top = 0; + win->_pad._pad_left = 0; + win->_pad._pad_bottom = min(LINES, nlines) - 1; + win->_pad._pad_right = min(COLS, ncols) - 1; + + return win; +} + +WINDOW *subpad(WINDOW *orig, int nlines, int ncols, int begy, int begx) +{ + WINDOW *win; + int i; + + PDC_LOG(("subpad() - called: lines=%d cols=%d begy=%d begx=%d\n", + nlines, ncols, begy, begx)); + + if (!orig || !(orig->_flags & _PAD)) + return (WINDOW *)NULL; + + /* make sure window fits inside the original one */ + + if (begy < 0 || begx < 0 || + (begy + nlines) > orig->_maxy || + (begx + ncols) > orig->_maxx) + return (WINDOW *)NULL; + + if (!nlines) + nlines = orig->_maxy - begy; + + if (!ncols) + ncols = orig->_maxx - begx; + + win = PDC_makenew(nlines, ncols, begy, begx); + if (!win) + return (WINDOW *)NULL; + + /* initialize window variables */ + + win->_attrs = orig->_attrs; + win->_leaveit = orig->_leaveit; + win->_scroll = orig->_scroll; + win->_nodelay = orig->_nodelay; + win->_use_keypad = orig->_use_keypad; + win->_parent = orig; + + for (i = 0; i < nlines; i++) + win->_y[i] = orig->_y[begy + i] + begx; + + win->_flags = _SUBPAD; + win->_pad._pad_y = 0; + win->_pad._pad_x = 0; + win->_pad._pad_top = 0; + win->_pad._pad_left = 0; + win->_pad._pad_bottom = min(LINES, nlines) - 1; + win->_pad._pad_right = min(COLS, ncols) - 1; + + return win; +} + +int prefresh(WINDOW *win, int py, int px, int sy1, int sx1, int sy2, int sx2) +{ + PDC_LOG(("prefresh() - called\n")); + + if (pnoutrefresh(win, py, px, sy1, sx1, sy2, sx2) == ERR) + return ERR; + + doupdate(); + return OK; +} + +int pnoutrefresh(WINDOW *w, int py, int px, int sy1, int sx1, int sy2, int sx2) +{ + int num_cols; + int sline; + int pline; + + PDC_LOG(("pnoutrefresh() - called\n")); + + if (py < 0) + py = 0; + if (px < 0) + px = 0; + if (sy1 < 0) + sy1 = 0; + if (sx1 < 0) + sx1 = 0; + + if ((!w || !(w->_flags & (_PAD|_SUBPAD)) || + (sy2 >= LINES) || (sx2 >= COLS)) || + (sy2 < sy1) || (sx2 < sx1)) + return ERR; + + sline = sy1; + pline = py; + + num_cols = min((sx2 - sx1 + 1), (w->_maxx - px)); + + while (sline <= sy2) + { + if (pline < w->_maxy) + { + memcpy(curscr->_y[sline] + sx1, w->_y[pline] + px, + num_cols * sizeof(chtype)); + + if ((curscr->_firstch[sline] == _NO_CHANGE) + || (curscr->_firstch[sline] > sx1)) + curscr->_firstch[sline] = sx1; + + if (sx2 > curscr->_lastch[sline]) + curscr->_lastch[sline] = sx2; + + w->_firstch[pline] = _NO_CHANGE; /* updated now */ + w->_lastch[pline] = _NO_CHANGE; /* updated now */ + } + + sline++; + pline++; + } + + if (w->_clear) + { + w->_clear = FALSE; + curscr->_clear = TRUE; + } + + /* position the cursor to the pad's current position if possible -- + is the pad current position going to end up displayed? if not, + then don't move the cursor; if so, move it to the correct place */ + + if (!w->_leaveit && w->_cury >= py && w->_curx >= px && + w->_cury <= py + (sy2 - sy1) && w->_curx <= px + (sx2 - sx1)) + { + curscr->_cury = (w->_cury - py) + sy1; + curscr->_curx = (w->_curx - px) + sx1; + } + + w->_pad._pad_y = py; + w->_pad._pad_x = px; + w->_pad._pad_top = sy1; + w->_pad._pad_left = sx1; + w->_pad._pad_bottom = sy2; + w->_pad._pad_right = sx2; + + return OK; +} + +int pechochar(WINDOW *pad, chtype ch) +{ + PDC_LOG(("pechochar() - called\n")); + + if (waddch(pad, ch) == ERR) + return ERR; + + return 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); +} + +#ifdef PDC_WIDE +int pecho_wchar(WINDOW *pad, const cchar_t *wch) +{ + PDC_LOG(("pecho_wchar() - called\n")); + + if (!wch || (waddch(pad, *wch) == ERR)) + return ERR; + + return 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); +} +#endif + +bool is_pad(const WINDOW *pad) +{ + PDC_LOG(("is_pad() - called\n")); + + if (!pad) + return FALSE; + + return (pad->_flags & _PAD) ? TRUE : FALSE; +} diff --git a/vendor/pdcurses/pdcurses/panel.c b/vendor/pdcurses/pdcurses/panel.c new file mode 100644 index 0000000..437d085 --- /dev/null +++ b/vendor/pdcurses/pdcurses/panel.c @@ -0,0 +1,646 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +panel +----- + +### Synopsis + + int bottom_panel(PANEL *pan); + int del_panel(PANEL *pan); + int hide_panel(PANEL *pan); + int move_panel(PANEL *pan, int starty, int startx); + PANEL *new_panel(WINDOW *win); + PANEL *panel_above(const PANEL *pan); + PANEL *panel_below(const PANEL *pan); + int panel_hidden(const PANEL *pan); + const void *panel_userptr(const PANEL *pan); + WINDOW *panel_window(const PANEL *pan); + int replace_panel(PANEL *pan, WINDOW *win); + int set_panel_userptr(PANEL *pan, const void *uptr); + int show_panel(PANEL *pan); + int top_panel(PANEL *pan); + void update_panels(void); + +### Description + + For historic reasons, and for compatibility with other versions of + curses, the panel functions are prototyped in a separate header, + panel.h. In many implementations, they're also in a separate library, + but PDCurses incorporates them. + + The panel functions provide a way to have depth relationships between + curses windows. Panels can overlap without making visible the + overlapped portions of underlying windows. The initial curses window, + stdscr, lies beneath all panels. The set of currently visible panels + is the 'deck' of panels. + + You can create panels, fetch and set their associated windows, + shuffle panels in the deck, and manipulate them in other ways. + + bottom_panel() places pan at the bottom of the deck. The size, + location and contents of the panel are unchanged. + + del_panel() deletes pan, but not its associated winwow. + + hide_panel() removes a panel from the deck and thus hides it from + view. + + move_panel() moves the curses window associated with pan, so that its + upper lefthand corner is at the supplied coordinates. (Don't use + mvwin() on the window.) + + new_panel() creates a new panel associated with win and returns the + panel pointer. The new panel is placed at the top of the deck. + + panel_above() returns a pointer to the panel in the deck above pan, + or NULL if pan is the top panel. If the value of pan passed is NULL, + this function returns a pointer to the bottom panel in the deck. + + panel_below() returns a pointer to the panel in the deck below pan, + or NULL if pan is the bottom panel. If the value of pan passed is + NULL, this function returns a pointer to the top panel in the deck. + + panel_hidden() returns OK if pan is hidden and ERR if it is not. + + panel_userptr() - Each panel has a user pointer available for + maintaining relevant information. This function returns a pointer to + that information previously set up by set_panel_userptr(). + + panel_window() returns a pointer to the curses window associated with + the panel. + + replace_panel() replaces the current window of pan with win. + + set_panel_userptr() - Each panel has a user pointer available for + maintaining relevant information. This function sets the value of + that information. + + show_panel() makes a previously hidden panel visible and places it + back in the deck on top. + + top_panel() places pan on the top of the deck. The size, location and + contents of the panel are unchanged. + + update_panels() refreshes the virtual screen to reflect the depth + relationships between the panels in the deck. The user must use + doupdate() to refresh the physical screen. + +### Return Value + + Each routine that returns a pointer to an object returns NULL if an + error occurs. Each panel routine that returns an integer, returns OK + if it executes successfully and ERR if it does not. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + bottom_panel | - | Y | Y + del_panel | - | Y | Y + hide_panel | - | Y | Y + move_panel | - | Y | Y + new_panel | - | Y | Y + panel_above | - | Y | Y + panel_below | - | Y | Y + panel_hidden | - | Y | Y + panel_userptr | - | Y | Y + panel_window | - | Y | Y + replace_panel | - | Y | Y + set_panel_userptr | - | Y | Y + show_panel | - | Y | Y + top_panel | - | Y | Y + update_panels | - | Y | Y + +### Credits + + Original Author - Warren Tucker + +**man-end****************************************************************/ + +#include +#include + +PANEL *_bottom_panel = (PANEL *)0; +PANEL *_top_panel = (PANEL *)0; +PANEL _stdscr_pseudo_panel = { (WINDOW *)0 }; + +#ifdef PANEL_DEBUG + +static void dPanel(char *text, PANEL *pan) +{ + PDC_LOG(("%s id=%s b=%s a=%s y=%d x=%d", text, pan->user, + pan->below ? pan->below->user : "--", + pan->above ? pan->above->user : "--", + pan->wstarty, pan->wstartx)); +} + +static void dStack(char *fmt, int num, PANEL *pan) +{ + char s80[80]; + + sprintf(s80, fmt, num, pan); + PDC_LOG(("%s b=%s t=%s", s80, _bottom_panel ? _bottom_panel->user : "--", + _top_panel ? _top_panel->user : "--")); + + if (pan) + PDC_LOG(("pan id=%s", pan->user)); + + pan = _bottom_panel; + + while (pan) + { + dPanel("stk", pan); + pan = pan->above; + } +} + +/* debugging hook for wnoutrefresh */ + +static void Wnoutrefresh(PANEL *pan) +{ + dPanel("wnoutrefresh", pan); + wnoutrefresh(pan->win); +} + +static void Touchpan(PANEL *pan) +{ + dPanel("Touchpan", pan); + touchwin(pan->win); +} + +static void Touchline(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); +} + +#else /* PANEL_DEBUG */ + +#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 /* PANEL_DEBUG */ + +static bool _panels_overlapped(PANEL *pan1, PANEL *pan2) +{ + if (!pan1 || !pan2) + return FALSE; + + return ((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)); +} + +static void _free_obscure(PANEL *pan) +{ + PANELOBS *tobs = pan->obscure; /* "this" one */ + PANELOBS *nobs; /* "next" one */ + + while (tobs) + { + nobs = tobs->above; + free((char *)tobs); + tobs = nobs; + } + pan->obscure = (PANELOBS *)0; +} + +static void _pairwise_override(PANEL *pan, PANEL *pan2) +{ + const int sy1 = pan->wstarty, sy2 = pan2->wstarty; + const int end_y = min(pan->wendy, pan2->wendy); + int y = max(sy1, sy2); + + while (y < end_y) + { + if (is_linetouched(pan->win, y - sy1)) + Touchline(pan2, y - sy2, 1); + y++; + } +} + +static void _override(PANEL *pan, int show) +{ + PANEL *pan2; + PANELOBS *tobs = pan->obscure; /* "this" one */ + + if (show == 1) + Touchpan(pan); + else if (!show) + { + Touchpan(pan); + Touchpan(&_stdscr_pseudo_panel); + } + else if (show == -1) + while (tobs && (tobs->pan != pan)) + tobs = tobs->above; + + while (tobs) + { + if ((pan2 = tobs->pan) != pan) + _pairwise_override(pan, pan2); + + tobs = tobs->above; + } + _pairwise_override(&_stdscr_pseudo_panel, pan); +} + +static void _calculate_obscure(void) +{ + PANEL *pan, *pan2; + PANELOBS *tobs; /* "this" one */ + PANELOBS *lobs; /* last one */ + + pan = _bottom_panel; + + while (pan) + { + if (pan->obscure) + _free_obscure(pan); + + lobs = (PANELOBS *)0; + pan2 = _bottom_panel; + + while (pan2) + { + if (_panels_overlapped(pan, pan2)) + { + if ((tobs = malloc(sizeof(PANELOBS))) == NULL) + return; + + tobs->pan = pan2; + dPanel("obscured", pan2); + tobs->above = (PANELOBS *)0; + + if (lobs) + lobs->above = tobs; + else + pan->obscure = tobs; + + lobs = tobs; + } + + pan2 = pan2->above; + } + + _override(pan, 1); + pan = pan->above; + } +} + +/* check to see if panel is in the stack */ + +static bool _panel_is_linked(const PANEL *pan) +{ + PANEL *pan2 = _bottom_panel; + + while (pan2) + { + if (pan2 == pan) + return TRUE; + + pan2 = pan2->above; + } + + return FALSE; +} + +/* link panel into stack at top */ + +static void _panel_link_top(PANEL *pan) +{ +#ifdef PANEL_DEBUG + 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); +} + +/* link panel into stack at bottom */ + +static void _panel_link_bottom(PANEL *pan) +{ +#ifdef PANEL_DEBUG + dStack("", 1, pan); + if (_panel_is_linked(pan)) + return; +#endif + pan->above = (PANEL *)0; + pan->below = (PANEL *)0; + + if (_bottom_panel) + { + _bottom_panel->below = pan; + pan->above = _bottom_panel; + } + + _bottom_panel = pan; + + if (!_top_panel) + _top_panel = pan; + + _calculate_obscure(); + dStack("", 9, pan); +} + +static void _panel_unlink(PANEL *pan) +{ + PANEL *prev; + PANEL *next; + +#ifdef PANEL_DEBUG + dStack("", 1, pan); + if (!_panel_is_linked(pan)) + return; +#endif + _override(pan, 0); + _free_obscure(pan); + + prev = pan->below; + next = pan->above; + + /* if non-zero, we will not update the list head */ + + if (prev) + { + 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); + +} + +/************************************************************************ + * The following are the public functions for the panels library. * + ************************************************************************/ + +int bottom_panel(PANEL *pan) +{ + if (!pan) + return ERR; + + if (pan == _bottom_panel) + return OK; + + if (_panel_is_linked(pan)) + hide_panel(pan); + + _panel_link_bottom(pan); + + return OK; +} + +int del_panel(PANEL *pan) +{ + if (pan) + { + if (_panel_is_linked(pan)) + hide_panel(pan); + + free((char *)pan); + return OK; + } + + return ERR; +} + +int hide_panel(PANEL *pan) +{ + if (!pan) + return ERR; + + if (!_panel_is_linked(pan)) + { + pan->above = (PANEL *)0; + pan->below = (PANEL *)0; + return ERR; + } + + _panel_unlink(pan); + + return OK; +} + +int move_panel(PANEL *pan, int starty, int startx) +{ + WINDOW *win; + int maxy, maxx; + + if (!pan) + return ERR; + + if (_panel_is_linked(pan)) + _override(pan, 0); + + win = pan->win; + + if (mvwin(win, starty, startx) == ERR) + return ERR; + + getbegyx(win, pan->wstarty, pan->wstartx); + getmaxyx(win, maxy, maxx); + pan->wendy = pan->wstarty + maxy; + pan->wendx = pan->wstartx + maxx; + + if (_panel_is_linked(pan)) + _calculate_obscure(); + + return OK; +} + +PANEL *new_panel(WINDOW *win) +{ + PANEL *pan; + + if (!win) + return (PANEL *)NULL; + + pan = malloc(sizeof(PANEL)); + + if (!_stdscr_pseudo_panel.win) + { + _stdscr_pseudo_panel.win = stdscr; + _stdscr_pseudo_panel.wstarty = 0; + _stdscr_pseudo_panel.wstartx = 0; + _stdscr_pseudo_panel.wendy = LINES; + _stdscr_pseudo_panel.wendx = COLS; + _stdscr_pseudo_panel.user = "stdscr"; + _stdscr_pseudo_panel.obscure = (PANELOBS *)0; + } + + if (pan) + { + int maxy, maxx; + + pan->win = win; + pan->above = (PANEL *)0; + pan->below = (PANEL *)0; + getbegyx(win, pan->wstarty, pan->wstartx); + getmaxyx(win, maxy, maxx); + pan->wendy = pan->wstarty + maxy; + pan->wendx = pan->wstartx + maxx; +#ifdef PANEL_DEBUG + pan->user = "new"; +#else + pan->user = (char *)0; +#endif + pan->obscure = (PANELOBS *)0; + show_panel(pan); + } + + return pan; +} + +PANEL *panel_above(const PANEL *pan) +{ + return pan ? pan->above : _bottom_panel; +} + +PANEL *panel_below(const PANEL *pan) +{ + return pan ? pan->below : _top_panel; +} + +int panel_hidden(const PANEL *pan) +{ + if (!pan) + return ERR; + + return _panel_is_linked(pan) ? ERR : OK; +} + +const void *panel_userptr(const PANEL *pan) +{ + return pan ? pan->user : NULL; +} + +WINDOW *panel_window(const PANEL *pan) +{ + PDC_LOG(("panel_window() - called\n")); + + if (!pan) + return (WINDOW *)NULL; + + return pan->win; +} + +int replace_panel(PANEL *pan, WINDOW *win) +{ + int maxy, maxx; + + if (!pan) + return ERR; + + if (_panel_is_linked(pan)) + _override(pan, 0); + + pan->win = win; + getbegyx(win, pan->wstarty, pan->wstartx); + getmaxyx(win, maxy, maxx); + pan->wendy = pan->wstarty + maxy; + pan->wendx = pan->wstartx + maxx; + + if (_panel_is_linked(pan)) + _calculate_obscure(); + + return OK; +} + +int set_panel_userptr(PANEL *pan, const void *uptr) +{ + if (!pan) + return ERR; + + pan->user = uptr; + return OK; +} + +int show_panel(PANEL *pan) +{ + if (!pan) + return ERR; + + if (pan == _top_panel) + return OK; + + if (_panel_is_linked(pan)) + hide_panel(pan); + + _panel_link_top(pan); + + return OK; +} + +int top_panel(PANEL *pan) +{ + return show_panel(pan); +} + +void update_panels(void) +{ + PANEL *pan; + + PDC_LOG(("update_panels() - called\n")); + + pan = _bottom_panel; + + while (pan) + { + _override(pan, -1); + pan = pan->above; + } + + if (is_wintouched(stdscr)) + Wnoutrefresh(&_stdscr_pseudo_panel); + + pan = _bottom_panel; + + while (pan) + { + if (is_wintouched(pan->win) || !pan->above) + Wnoutrefresh(pan); + + pan = pan->above; + } +} diff --git a/vendor/pdcurses/pdcurses/printw.c b/vendor/pdcurses/pdcurses/printw.c new file mode 100644 index 0000000..bd5fd22 --- /dev/null +++ b/vendor/pdcurses/pdcurses/printw.c @@ -0,0 +1,131 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +printw +------ + +### Synopsis + + int printw(const char *fmt, ...); + int wprintw(WINDOW *win, const char *fmt, ...); + int mvprintw(int y, int x, const char *fmt, ...); + int mvwprintw(WINDOW *win, int y, int x, const char *fmt,...); + int vwprintw(WINDOW *win, const char *fmt, va_list varglist); + int vw_printw(WINDOW *win, const char *fmt, va_list varglist); + +### Description + + The printw() functions add a formatted string to the window at the + current or specified cursor position. The format strings are the same + as used in the standard C library's printf(). (printw() can be used + as a drop-in replacement for printf().) + + The duplication between vwprintw() and vw_printw() is for historic + reasons. In PDCurses, they're the same. + +### Return Value + + All functions return the number of characters printed, or ERR on + error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + printw | Y | Y | Y + wprintw | Y | Y | Y + mvprintw | Y | Y | Y + mvwprintw | Y | Y | Y + vwprintw | Y | Y | Y + vw_printw | Y | Y | Y + +**man-end****************************************************************/ + +#include + +int vwprintw(WINDOW *win, const char *fmt, va_list varglist) +{ + char printbuf[513]; + int len; + + PDC_LOG(("vwprintw() - called\n")); + +#ifdef HAVE_VSNPRINTF + len = vsnprintf(printbuf, 512, fmt, varglist); +#else + len = vsprintf(printbuf, fmt, varglist); +#endif + return (waddstr(win, printbuf) == ERR) ? ERR : len; +} + +int printw(const char *fmt, ...) +{ + va_list args; + int retval; + + PDC_LOG(("printw() - called\n")); + + va_start(args, fmt); + retval = vwprintw(stdscr, fmt, args); + va_end(args); + + return retval; +} + +int wprintw(WINDOW *win, const char *fmt, ...) +{ + va_list args; + int retval; + + PDC_LOG(("wprintw() - called\n")); + + va_start(args, fmt); + retval = vwprintw(win, fmt, args); + va_end(args); + + return retval; +} + +int mvprintw(int y, int x, const char *fmt, ...) +{ + va_list args; + int retval; + + PDC_LOG(("mvprintw() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + va_start(args, fmt); + retval = vwprintw(stdscr, fmt, args); + va_end(args); + + return retval; +} + +int mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...) +{ + va_list args; + int retval; + + PDC_LOG(("mvwprintw() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + va_start(args, fmt); + retval = vwprintw(win, fmt, args); + va_end(args); + + return retval; +} + +int vw_printw(WINDOW *win, const char *fmt, va_list varglist) +{ + PDC_LOG(("vw_printw() - called\n")); + + return vwprintw(win, fmt, varglist); +} diff --git a/vendor/pdcurses/pdcurses/refresh.c b/vendor/pdcurses/pdcurses/refresh.c new file mode 100644 index 0000000..42ba6fe --- /dev/null +++ b/vendor/pdcurses/pdcurses/refresh.c @@ -0,0 +1,289 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +refresh +------- + +### Synopsis + + int refresh(void); + int wrefresh(WINDOW *win); + int wnoutrefresh(WINDOW *win); + int doupdate(void); + int redrawwin(WINDOW *win); + int wredrawln(WINDOW *win, int beg_line, int num_lines); + +### Description + + wrefresh() copies the named window to the physical terminal screen, + taking into account what is already there in order to optimize cursor + movement. refresh() does the same, using stdscr. These routines must + be called to get any output on the terminal, as other routines only + manipulate data structures. Unless leaveok() has been enabled, the + physical cursor of the terminal is left at the location of the + window's cursor. + + wnoutrefresh() and doupdate() allow multiple updates with more + efficiency than wrefresh() alone. wrefresh() works by first calling + wnoutrefresh(), which copies the named window to the virtual screen. + It then calls doupdate(), which compares the virtual screen to the + physical screen and does the actual update. A series of calls to + wrefresh() will result in alternating calls to wnoutrefresh() and + doupdate(), causing several bursts of output to the screen. By first + calling wnoutrefresh() for each window, it is then possible to call + doupdate() only once. + + In PDCurses, redrawwin() is equivalent to touchwin(), and wredrawln() + is the same as touchline(). In some other curses implementations, + there's a subtle distinction, but it has no meaning in PDCurses. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + refresh | Y | Y | Y + wrefresh | Y | Y | Y + wnoutrefresh | Y | Y | Y + doupdate | Y | Y | Y + redrawwin | Y | Y | Y + wredrawln | Y | Y | Y + +**man-end****************************************************************/ + +#include + +int wnoutrefresh(WINDOW *win) +{ + int begy, begx; /* window's place on screen */ + int i, j; + + PDC_LOG(("wnoutrefresh() - called: win=%p\n", win)); + + if (!win) + return ERR; + if (is_pad(win)) + return pnoutrefresh(win, + win->_pad._pad_y, + win->_pad._pad_x, + win->_pad._pad_top, + win->_pad._pad_left, + win->_pad._pad_bottom, + win->_pad._pad_right); + + begy = win->_begy; + begx = win->_begx; + + for (i = 0, j = begy; i < win->_maxy; i++, j++) + { + if (win->_firstch[i] != _NO_CHANGE) + { + chtype *src = win->_y[i]; + chtype *dest = curscr->_y[j] + begx; + + int first = win->_firstch[i]; /* first changed */ + int last = win->_lastch[i]; /* last changed */ + + /* ignore areas on the outside that are marked as changed, + but really aren't */ + + while (first <= last && src[first] == dest[first]) + first++; + + while (last >= first && src[last] == dest[last]) + last--; + + /* if any have really changed... */ + + if (first <= last) + { + memcpy(dest + first, src + first, + (last - first + 1) * sizeof(chtype)); + + first += begx; + last += begx; + + if (first < curscr->_firstch[j] || + curscr->_firstch[j] == _NO_CHANGE) + curscr->_firstch[j] = first; + + if (last > curscr->_lastch[j]) + curscr->_lastch[j] = last; + } + + win->_firstch[i] = _NO_CHANGE; /* updated now */ + } + + win->_lastch[i] = _NO_CHANGE; /* updated now */ + } + + if (win->_clear) + win->_clear = FALSE; + + if (!win->_leaveit) + { + curscr->_cury = win->_cury + begy; + curscr->_curx = win->_curx + begx; + } + + return OK; +} + +int doupdate(void) +{ + int y; + bool clearall; + + PDC_LOG(("doupdate() - called\n")); + + if (!SP || !curscr) + return ERR; + + if (isendwin()) /* coming back after endwin() called */ + { + reset_prog_mode(); + clearall = TRUE; + SP->alive = TRUE; /* so isendwin() result is correct */ + } + else + clearall = curscr->_clear; + + for (y = 0; y < SP->lines; y++) + { + PDC_LOG(("doupdate() - Transforming line %d of %d: %s\n", + y, SP->lines, (curscr->_firstch[y] != _NO_CHANGE) ? + "Yes" : "No")); + + if (clearall || curscr->_firstch[y] != _NO_CHANGE) + { + int first, last; + + chtype *src = curscr->_y[y]; + chtype *dest = SP->lastscr->_y[y]; + + if (clearall) + { + first = 0; + last = COLS - 1; + } + else + { + first = curscr->_firstch[y]; + last = curscr->_lastch[y]; + } + + while (first <= last) + { + int len = 0; + + /* build up a run of changed cells; if two runs are + separated by a single unchanged cell, ignore the + break */ + + if (clearall) + len = last - first + 1; + else + while (first + len <= last && + (src[first + len] != dest[first + len] || + (len && first + len < last && + src[first + len + 1] != dest[first + len + 1]) + ) + ) + len++; + + /* update the screen, and SP->lastscr */ + + if (len) + { + PDC_transform_line(y, first, len, src + first); + memcpy(dest + first, src + first, len * sizeof(chtype)); + first += len; + } + + /* skip over runs of unchanged cells */ + + while (first <= last && src[first] == dest[first]) + first++; + } + + curscr->_firstch[y] = _NO_CHANGE; + curscr->_lastch[y] = _NO_CHANGE; + } + } + + curscr->_clear = FALSE; + + if (SP->visibility) + PDC_gotoyx(curscr->_cury, curscr->_curx); + + SP->cursrow = curscr->_cury; + SP->curscol = curscr->_curx; + + PDC_doupdate(); + + return OK; +} + +int wrefresh(WINDOW *win) +{ + bool save_clear; + + PDC_LOG(("wrefresh() - called\n")); + + if ( !win || (win->_flags & (_PAD|_SUBPAD)) ) + return ERR; + + save_clear = win->_clear; + + if (win == curscr) + curscr->_clear = TRUE; + else + wnoutrefresh(win); + + if (save_clear && win->_maxy == SP->lines && win->_maxx == SP->cols) + curscr->_clear = TRUE; + + return doupdate(); +} + +int refresh(void) +{ + PDC_LOG(("refresh() - called\n")); + + return wrefresh(stdscr); +} + +int wredrawln(WINDOW *win, int start, int num) +{ + int i; + + PDC_LOG(("wredrawln() - called: win=%p start=%d num=%d\n", + win, start, num)); + + if (!win || start > win->_maxy || start + num > win->_maxy) + return ERR; + + for (i = start; i < start + num; i++) + { + win->_firstch[i] = 0; + win->_lastch[i] = win->_maxx - 1; + } + + return OK; +} + +int redrawwin(WINDOW *win) +{ + PDC_LOG(("redrawwin() - called: win=%p\n", win)); + + if (!win) + return ERR; + + return wredrawln(win, 0, win->_maxy); +} diff --git a/vendor/pdcurses/pdcurses/scanw.c b/vendor/pdcurses/pdcurses/scanw.c new file mode 100644 index 0000000..44ffbe6 --- /dev/null +++ b/vendor/pdcurses/pdcurses/scanw.c @@ -0,0 +1,583 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +scanw +----- + +### Synopsis + + int scanw(const char *fmt, ...); + int wscanw(WINDOW *win, const char *fmt, ...); + int mvscanw(int y, int x, const char *fmt, ...); + int mvwscanw(WINDOW *win, int y, int x, const char *fmt, ...); + int vwscanw(WINDOW *win, const char *fmt, va_list varglist); + int vw_scanw(WINDOW *win, const char *fmt, va_list varglist); + +### Description + + These routines correspond to the standard C library's scanf() family. + Each gets a string from the window via wgetnstr(), and uses the + resulting line as input for the scan. + + The duplication between vwscanw() and vw_scanw() is for historic + reasons. In PDCurses, they're the same. + +### Return Value + + On successful completion, these functions return the number of items + successfully matched. Otherwise they return ERR. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + scanw | Y | Y | Y + wscanw | Y | Y | Y + mvscanw | Y | Y | Y + mvwscanw | Y | Y | Y + vwscanw | Y | Y | Y + vw_scanw | Y | Y | Y + +**man-end****************************************************************/ + +#include + +#ifndef HAVE_VSSCANF +# include +# include +# include + +static int _pdc_vsscanf(const char *, const char *, va_list); + +# define vsscanf _pdc_vsscanf +#endif + +int vwscanw(WINDOW *win, const char *fmt, va_list varglist) +{ + char scanbuf[256]; + + PDC_LOG(("vwscanw() - called\n")); + + if (wgetnstr(win, scanbuf, 255) == ERR) + return ERR; + + return vsscanf(scanbuf, fmt, varglist); +} + +int scanw(const char *fmt, ...) +{ + va_list args; + int retval; + + PDC_LOG(("scanw() - called\n")); + + va_start(args, fmt); + retval = vwscanw(stdscr, fmt, args); + va_end(args); + + return retval; +} + +int wscanw(WINDOW *win, const char *fmt, ...) +{ + va_list args; + int retval; + + PDC_LOG(("wscanw() - called\n")); + + va_start(args, fmt); + retval = vwscanw(win, fmt, args); + va_end(args); + + return retval; +} + +int mvscanw(int y, int x, const char *fmt, ...) +{ + va_list args; + int retval; + + PDC_LOG(("mvscanw() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + va_start(args, fmt); + retval = vwscanw(stdscr, fmt, args); + va_end(args); + + return retval; +} + +int mvwscanw(WINDOW *win, int y, int x, const char *fmt, ...) +{ + va_list args; + int retval; + + PDC_LOG(("mvscanw() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + va_start(args, fmt); + retval = vwscanw(win, fmt, args); + va_end(args); + + return retval; +} + +int vw_scanw(WINDOW *win, const char *fmt, va_list varglist) +{ + PDC_LOG(("vw_scanw() - called\n")); + + return vwscanw(win, fmt, varglist); +} + +#ifndef HAVE_VSSCANF + +/* _pdc_vsscanf() - Internal routine to parse and format an input + buffer. It scans a series of input fields; each field is formatted + according to a supplied format string and the formatted input is + stored in the variable number of addresses passed. Returns the number + of input fields or EOF on error. + + Don't compile this unless required. Some compilers (at least Borland + C++ 3.0) have to link with math libraries due to the use of floats. + + Based on vsscanf.c and input.c from emx 0.8f library source, + Copyright (c) 1990-1992 by Eberhard Mattes, who has kindly agreed to + its inclusion in PDCurses. */ + +#define WHITE(x) ((x) == ' ' || (x) == '\t' || (x) == '\n') + +#define NEXT(x) \ + do { \ + x = *buf++; \ + if (!x) \ + return (count ? count : EOF); \ + ++chars; \ + } while (0) + +#define UNGETC() \ + do { \ + --buf; --chars; \ + } while (0) + +static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr) +{ + int count, chars, c, width, radix, d, i; + int *int_ptr; + long *long_ptr; + short *short_ptr; + char *char_ptr; + unsigned char f; + char neg, assign, ok, size; + long n; + char map[256], end; + double dx, dd, *dbl_ptr; + float *flt_ptr; + int exp; + char eneg; + + count = 0; + chars = 0; + c = 0; + while ((f = *fmt) != 0) + { + if (WHITE(f)) + { + do + { + ++fmt; + f = *fmt; + } + while (WHITE(f)); + do + { + c = *buf++; + if (!c) + { + if (!f || count) + return count; + else + return EOF; + } else + ++chars; + } + while (WHITE(c)); + UNGETC(); + } else if (f != '%') + { + NEXT(c); + if (c != f) + return count; + ++fmt; + } else + { + assign = TRUE; + width = INT_MAX; + char_ptr = NULL; + ++fmt; + if (*fmt == '*') + { + assign = FALSE; + ++fmt; + } + if (isdigit(*fmt)) + { + width = 0; + while (isdigit(*fmt)) + width = width * 10 + (*fmt++ - '0'); + if (!width) + width = INT_MAX; + } + size = 0; + if (*fmt == 'h' || *fmt == 'l') + size = *fmt++; + f = *fmt; + switch (f) + { + case 'c': + if (width == INT_MAX) + width = 1; + if (assign) + char_ptr = va_arg(arg_ptr, char *); + while (width > 0) + { + --width; + NEXT(c); + if (assign) + { + *char_ptr++ = (char) c; + ++count; + } + } + break; + case '[': + memset(map, 0, 256); + end = 0; + ++fmt; + if (*fmt == '^') + { + ++fmt; + end = 1; + } + i = 0; + for (;;) + { + f = (unsigned char) *fmt; + switch (f) + { + case 0: + /* avoid skipping past 0 */ + --fmt; + NEXT(c); + goto string; + case ']': + if (i > 0) + { + NEXT(c); + goto string; + } + /* no break */ + default: + if (fmt[1] == '-' && fmt[2] + && f < (unsigned char)fmt[2]) + { + memset(map + f, 1, (unsigned char)fmt[2] - f); + fmt += 2; + } + else + map[f] = 1; + break; + } + ++fmt; + ++i; + } + case 's': + memset(map, 0, 256); + map[' '] = 1; + map['\n'] = 1; + map['\r'] = 1; + map['\t'] = 1; + end = 1; + do + { + NEXT(c); + } + while (WHITE(c)); + string: + if (assign) + char_ptr = va_arg(arg_ptr, char *); + while (width > 0 && map[(unsigned char) c] != end) + { + --width; + if (assign) + *char_ptr++ = (char) c; + c = *buf++; + if (!c) + break; + else + ++chars; + } + if (assign) + { + *char_ptr = 0; + ++count; + } + if (!c) + return count; + else + UNGETC(); + break; + case 'f': + case 'e': + case 'E': + case 'g': + case 'G': + neg = ok = FALSE; + dx = 0.0; + do + { + NEXT(c); + } + while (WHITE(c)); + if (c == '+') + { + NEXT(c); + --width; + } else if (c == '-') + { + neg = TRUE; + NEXT(c); + --width; + } + while (width > 0 && isdigit(c)) + { + --width; + dx = dx * 10.0 + (double) (c - '0'); + ok = TRUE; + c = *buf++; + if (!c) + break; + else + ++chars; + } + if (width > 0 && c == '.') + { + --width; + dd = 10.0; + NEXT(c); + while (width > 0 && isdigit(c)) + { + --width; + dx += (double) (c - '0') / dd; + dd *= 10.0; + ok = TRUE; + c = *buf++; + if (!c) + break; + else + ++chars; + } + } + if (!ok) + return count; + if (width > 0 && (c == 'e' || c == 'E')) + { + eneg = FALSE; + exp = 0; + NEXT(c); + --width; + if (width > 0 && c == '+') + { + NEXT(c); + --width; + } else if (width > 0 && c == '-') + { + eneg = TRUE; + NEXT(c); + --width; + } + if (!(width > 0 && isdigit(c))) + { + UNGETC(); + return count; + } + while (width > 0 && isdigit(c)) + { + --width; + exp = exp * 10 + (c - '0'); + c = *buf++; + if (!c) + break; + else + ++chars; + } + if (eneg) + exp = -exp; + while (exp > 0) + { + dx *= 10.0; + --exp; + } + while (exp < 0) + { + dx /= 10.0; + ++exp; + } + } + if (assign) + { + if (neg) + dx = -dx; + if (size == 'l') + { + dbl_ptr = va_arg(arg_ptr, double *); + *dbl_ptr = dx; + } + else + { + flt_ptr = va_arg(arg_ptr, float *); + *flt_ptr = (float)dx; + } + ++count; + } + if (!c) + return count; + else + UNGETC(); + break; + case 'i': + neg = FALSE; + radix = 10; + do + { + NEXT(c); + } + while (WHITE(c)); + if (!(width > 0 && c == '0')) + goto scan_complete_number; + NEXT(c); + --width; + if (width > 0 && (c == 'x' || c == 'X')) + { + NEXT(c); + radix = 16; + --width; + } + else if (width > 0 && (c >= '0' && c <= '7')) + radix = 8; + goto scan_unsigned_number; + case 'd': + case 'u': + case 'o': + case 'x': + case 'X': + do + { + NEXT(c); + } + while (WHITE(c)); + switch (f) + { + case 'o': + radix = 8; + break; + case 'x': + case 'X': + radix = 16; + break; + default: + radix = 10; + break; + } + scan_complete_number: + neg = FALSE; + if (width > 0 && c == '+') + { + NEXT(c); + --width; + } + else if (width > 0 && c == '-' && radix == 10) + { + neg = TRUE; + NEXT(c); + --width; + } + scan_unsigned_number: + n = 0; + ok = FALSE; + while (width > 0) + { + --width; + if (isdigit(c)) + d = c - '0'; + else if (isupper(c)) + d = c - 'A' + 10; + else if (islower(c)) + d = c - 'a' + 10; + else + break; + if (d < 0 || d >= radix) + break; + ok = TRUE; + n = n * radix + d; + c = *buf++; + if (!c) + break; + else + ++chars; + } + if (!ok) + return count; + if (assign) + { + if (neg) + n = -n; + switch (size) + { + case 'h': + short_ptr = va_arg(arg_ptr, short *); + *short_ptr = (short) n; + break; + case 'l': + long_ptr = va_arg(arg_ptr, long *); + *long_ptr = (long) n; + break; + default: + int_ptr = va_arg(arg_ptr, int *); + *int_ptr = (int) n; + } + ++count; + } + if (!c) + return count; + else + UNGETC(); + break; + case 'n': + if (assign) + { + int_ptr = va_arg(arg_ptr, int *); + *int_ptr = chars; + ++count; + } + break; + default: + if (!f) /* % at end of string */ + return count; + NEXT(c); + if (c != f) + return count; + break; + } + ++fmt; + } + } + return count; +} +#endif /* HAVE_VSSCANF */ diff --git a/vendor/pdcurses/pdcurses/scr_dump.c b/vendor/pdcurses/pdcurses/scr_dump.c new file mode 100644 index 0000000..b73fa54 --- /dev/null +++ b/vendor/pdcurses/pdcurses/scr_dump.c @@ -0,0 +1,219 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +scr_dump +-------- + +### Synopsis + + int putwin(WINDOW *win, FILE *filep); + WINDOW *getwin(FILE *filep); + int scr_dump(const char *filename); + int scr_init(const char *filename); + int scr_restore(const char *filename); + int scr_set(const char *filename); + +### Description + + getwin() reads window-related data previously stored in a file by + putwin(). It then creates and initialises a new window using that + data. + + putwin() writes all data associated with a window into a file, using + an unspecified format. This information can be retrieved later using + getwin(). + + scr_dump() writes the current contents of the virtual screen to the + file named by filename in an unspecified format. + + scr_restore() function sets the virtual screen to the contents of the + file named by filename, which must have been written using + scr_dump(). The next refresh operation restores the screen to the way + it looked in the dump file. + + In PDCurses, scr_init() does nothing, and scr_set() is a synonym for + scr_restore(). Also, scr_dump() and scr_restore() save and load from + curscr. This differs from some other implementations, where + scr_init() works with curscr, and scr_restore() works with newscr; + but the effect should be the same. (PDCurses has no newscr.) + +### Return Value + + On successful completion, getwin() returns a pointer to the window it + created. Otherwise, it returns a null pointer. Other functions return + OK or ERR. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + putwin | Y | Y | Y + getwin | Y | Y | Y + scr_dump | Y | Y | - + scr_init | Y | Y | - + scr_restore | Y | Y | - + scr_set | Y | Y | - + +**man-end****************************************************************/ + +#include +#include + +#define DUMPVER 1 /* Should be updated whenever the WINDOW struct is + changed */ + +int putwin(WINDOW *win, FILE *filep) +{ + static const char *marker = "PDC"; + static const unsigned char version = DUMPVER; + + PDC_LOG(("putwin() - called\n")); + + /* write the marker and the WINDOW struct */ + + if (filep && fwrite(marker, strlen(marker), 1, filep) + && fwrite(&version, 1, 1, filep) + && fwrite(win, sizeof(WINDOW), 1, filep)) + { + int i; + + /* write each line */ + + for (i = 0; i < win->_maxy && win->_y[i]; i++) + if (!fwrite(win->_y[i], win->_maxx * sizeof(chtype), 1, filep)) + return ERR; + + return OK; + } + + return ERR; +} + +WINDOW *getwin(FILE *filep) +{ + WINDOW *win; + char marker[4]; + int i, nlines, ncols; + + PDC_LOG(("getwin() - called\n")); + + win = malloc(sizeof(WINDOW)); + if (!win) + return (WINDOW *)NULL; + + /* check for the marker, and load the WINDOW struct */ + + if (!filep || !fread(marker, 4, 1, filep) || strncmp(marker, "PDC", 3) + || marker[3] != DUMPVER || !fread(win, sizeof(WINDOW), 1, filep)) + { + free(win); + return (WINDOW *)NULL; + } + + nlines = win->_maxy; + ncols = win->_maxx; + + /* allocate the line pointer array */ + + win->_y = malloc(nlines * sizeof(chtype *)); + if (!win->_y) + { + free(win); + return (WINDOW *)NULL; + } + + /* allocate the minchng and maxchng arrays */ + + win->_firstch = malloc(nlines * sizeof(int)); + if (!win->_firstch) + { + free(win->_y); + free(win); + return (WINDOW *)NULL; + } + + win->_lastch = malloc(nlines * sizeof(int)); + if (!win->_lastch) + { + free(win->_firstch); + free(win->_y); + free(win); + return (WINDOW *)NULL; + } + + /* allocate the lines */ + + win = PDC_makelines(win); + if (!win) + return (WINDOW *)NULL; + + /* read them */ + + for (i = 0; i < nlines; i++) + { + if (!fread(win->_y[i], ncols * sizeof(chtype), 1, filep)) + { + delwin(win); + return (WINDOW *)NULL; + } + } + + touchwin(win); + + return win; +} + +int scr_dump(const char *filename) +{ + FILE *filep; + + PDC_LOG(("scr_dump() - called: filename %s\n", filename)); + + if (filename && (filep = fopen(filename, "wb")) != NULL) + { + int result = putwin(curscr, filep); + fclose(filep); + return result; + } + + return ERR; +} + +int scr_init(const char *filename) +{ + PDC_LOG(("scr_init() - called: filename %s\n", filename)); + + return OK; +} + +int scr_restore(const char *filename) +{ + FILE *filep; + + PDC_LOG(("scr_restore() - called: filename %s\n", filename)); + + if (filename && (filep = fopen(filename, "rb")) != NULL) + { + WINDOW *replacement = getwin(filep); + fclose(filep); + + if (replacement) + { + int result = overwrite(replacement, curscr); + delwin(replacement); + return result; + } + } + + return ERR; +} + +int scr_set(const char *filename) +{ + PDC_LOG(("scr_set() - called: filename %s\n", filename)); + + return scr_restore(filename); +} diff --git a/vendor/pdcurses/pdcurses/scroll.c b/vendor/pdcurses/pdcurses/scroll.c new file mode 100644 index 0000000..6436712 --- /dev/null +++ b/vendor/pdcurses/pdcurses/scroll.c @@ -0,0 +1,103 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +scroll +------ + +### Synopsis + + int scroll(WINDOW *win); + int scrl(int n); + int wscrl(WINDOW *win, int n); + +### Description + + scroll() causes the window to scroll up one line. This involves + moving the lines in the window data strcture. + + With a positive n, scrl() and wscrl() scroll the window up n lines + (line i + n becomes i); otherwise they scroll the window down n + lines. + + For these functions to work, scrolling must be enabled via + scrollok(). Note also that scrolling is not allowed if the supplied + window is a pad. + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + scroll | Y | Y | Y + scrl | Y | Y | Y + wscrl | Y | Y | Y + +**man-end****************************************************************/ + +int wscrl(WINDOW *win, int n) +{ + int i, l, dir, start, end; + chtype blank, *temp; + + /* Check if window scrolls. Valid for window AND pad */ + + if (!win || !win->_scroll || !n) + return ERR; + + blank = win->_bkgd; + + if (n > 0) + { + start = win->_tmarg; + end = win->_bmarg; + dir = 1; + } + else + { + start = win->_bmarg; + end = win->_tmarg; + dir = -1; + } + + for (l = 0; l < (n * dir); l++) + { + temp = win->_y[start]; + + /* re-arrange line pointers */ + + for (i = start; i != end; i += dir) + win->_y[i] = win->_y[i + dir]; + + win->_y[end] = temp; + + /* make a blank line */ + + for (i = 0; i < win->_maxx; i++) + *temp++ = blank; + } + + touchline(win, win->_tmarg, win->_bmarg - win->_tmarg + 1); + + PDC_sync(win); + return OK; +} + +int scrl(int n) +{ + PDC_LOG(("scrl() - called\n")); + + return wscrl(stdscr, n); +} + +int scroll(WINDOW *win) +{ + PDC_LOG(("scroll() - called\n")); + + return wscrl(win, 1); +} diff --git a/vendor/pdcurses/pdcurses/slk.c b/vendor/pdcurses/pdcurses/slk.c new file mode 100644 index 0000000..2d1676c --- /dev/null +++ b/vendor/pdcurses/pdcurses/slk.c @@ -0,0 +1,673 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +slk +--- + +### Synopsis + + int slk_init(int fmt); + int slk_set(int labnum, const char *label, int justify); + int slk_refresh(void); + int slk_noutrefresh(void); + char *slk_label(int labnum); + int slk_clear(void); + int slk_restore(void); + int slk_touch(void); + int slk_attron(const chtype attrs); + int slk_attr_on(const attr_t attrs, void *opts); + int slk_attrset(const chtype attrs); + int slk_attr_set(const attr_t attrs, short color_pair, void *opts); + int slk_attroff(const chtype attrs); + int slk_attr_off(const attr_t attrs, void *opts); + int slk_color(short color_pair); + + int slk_wset(int labnum, const wchar_t *label, int justify); + + int PDC_mouse_in_slk(int y, int x); + void PDC_slk_free(void); + void PDC_slk_initialize(void); + + wchar_t *slk_wlabel(int labnum) + +### Description + + These functions manipulate a window that contain Soft Label Keys + (SLK). To use the SLK functions, a call to slk_init() must be made + BEFORE initscr() or newterm(). slk_init() removes 1 or 2 lines from + the useable screen, depending on the format selected. + + The line(s) removed from the screen are used as a separate window, in + which SLKs are displayed. + + slk_init() requires a single parameter which describes the format of + the SLKs as follows: + + 0 3-2-3 format + 1 4-4 format + 2 4-4-4 format (ncurses extension) + 3 4-4-4 format with index line (ncurses extension) + 2 lines used + 55 5-5 format (pdcurses format) + + slk_refresh(), slk_noutrefresh() and slk_touch() are analogous to + refresh(), noutrefresh() and touch(). + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + slk_init | Y | Y | Y + slk_set | Y | Y | Y + slk_refresh | Y | Y | Y + slk_noutrefresh | Y | Y | Y + slk_label | Y | Y | Y + slk_clear | Y | Y | Y + slk_restore | Y | Y | Y + slk_touch | Y | Y | Y + slk_attron | Y | Y | Y + slk_attrset | Y | Y | Y + slk_attroff | Y | Y | Y + slk_attr_on | Y | Y | Y + slk_attr_set | Y | Y | Y + slk_attr_off | Y | Y | Y + slk_wset | Y | Y | Y + PDC_mouse_in_slk | - | - | - + PDC_slk_free | - | - | - + PDC_slk_initialize | - | - | - + slk_wlabel | - | - | - + +**man-end****************************************************************/ + +#include + +enum { LABEL_NORMAL = 8, LABEL_EXTENDED = 10, LABEL_NCURSES_EXTENDED = 12 }; + +static int label_length = 0; +static int labels = 0; +static int label_fmt = 0; +static int label_line = 0; +static bool hidden = FALSE; + +static struct SLK { + chtype label[32]; + int len; + int format; + int start_col; +} *slk = (struct SLK *)NULL; + +/* slk_init() is the slk initialization routine. + This must be called before initscr(). + + label_fmt = 0, 1 or 55. + 0 = 3-2-3 format + 1 = 4 - 4 format + 2 = 4-4-4 format (ncurses extension for PC 12 function keys) + 3 = 4-4-4 format (ncurses extension for PC 12 function keys - + with index line) + 55 = 5 - 5 format (extended for PC, 10 function keys) */ + +int slk_init(int fmt) +{ + PDC_LOG(("slk_init() - called\n")); + + if (SP) + return ERR; + + switch (fmt) + { + case 0: /* 3 - 2 - 3 */ + labels = LABEL_NORMAL; + break; + + case 1: /* 4 - 4 */ + labels = LABEL_NORMAL; + break; + + case 2: /* 4 4 4 */ + labels = LABEL_NCURSES_EXTENDED; + break; + + case 3: /* 4 4 4 with index */ + labels = LABEL_NCURSES_EXTENDED; + break; + + case 55: /* 5 - 5 */ + labels = LABEL_EXTENDED; + break; + + default: + return ERR; + } + + label_fmt = fmt; + + slk = calloc(labels, sizeof(struct SLK)); + + if (!slk) + labels = 0; + + return slk ? OK : ERR; +} + +/* draw a single button */ + +static void _drawone(int num) +{ + int i, col, slen; + + if (hidden) + return; + + slen = slk[num].len; + + switch (slk[num].format) + { + case 0: /* LEFT */ + col = 0; + break; + + case 1: /* CENTER */ + col = (label_length - slen) / 2; + + if (col + slen > label_length) + --col; + break; + + default: /* RIGHT */ + col = label_length - slen; + } + + wmove(SP->slk_winptr, label_line, slk[num].start_col); + + for (i = 0; i < label_length; ++i) + waddch(SP->slk_winptr, (i >= col && i < (col + slen)) ? + slk[num].label[i - col] : ' '); +} + +/* redraw each button */ + +static void _redraw(void) +{ + int i; + + for (i = 0; i < labels; ++i) + _drawone(i); +} + +/* slk_set() Used to set a slk label to a string. + + labnum = 1 - 8 (or 10) (number of the label) + label = string (8 or 7 bytes total), or NULL + justify = 0 : left, 1 : center, 2 : right */ + +int slk_set(int labnum, const char *label, int justify) +{ +#ifdef PDC_WIDE + wchar_t wlabel[32]; + + PDC_mbstowcs(wlabel, label, 31); + return slk_wset(labnum, wlabel, justify); +#else + PDC_LOG(("slk_set() - called\n")); + + if (labnum < 1 || labnum > labels || justify < 0 || justify > 2) + return ERR; + + labnum--; + + if (!label || !(*label)) + { + /* Clear the label */ + + *slk[labnum].label = 0; + slk[labnum].format = 0; + slk[labnum].len = 0; + } + else + { + int i, j = 0; + + /* Skip leading spaces */ + + while (label[j] == ' ') + j++; + + /* Copy it */ + + for (i = 0; i < label_length; i++) + { + chtype ch = label[i + j]; + + slk[labnum].label[i] = ch; + + if (!ch) + break; + } + + /* Drop trailing spaces */ + + while ((i + j) && (label[i + j - 1] == ' ')) + i--; + + slk[labnum].label[i] = 0; + slk[labnum].format = justify; + slk[labnum].len = i; + } + + _drawone(labnum); + + return OK; +#endif +} + +int slk_refresh(void) +{ + PDC_LOG(("slk_refresh() - called\n")); + + return (slk_noutrefresh() == ERR) ? ERR : doupdate(); +} + +int slk_noutrefresh(void) +{ + PDC_LOG(("slk_noutrefresh() - called\n")); + + if (!SP) + return ERR; + + return wnoutrefresh(SP->slk_winptr); +} + +char *slk_label(int labnum) +{ + static char temp[33]; +#ifdef PDC_WIDE + wchar_t *wtemp = slk_wlabel(labnum); + + PDC_wcstombs(temp, wtemp, 32); +#else + chtype *p; + int i; + + PDC_LOG(("slk_label() - called\n")); + + if (labnum < 1 || labnum > labels) + return (char *)0; + + for (i = 0, p = slk[labnum - 1].label; *p; i++) + temp[i] = *p++; + + temp[i] = '\0'; +#endif + return temp; +} + +int slk_clear(void) +{ + PDC_LOG(("slk_clear() - called\n")); + + if (!SP) + return ERR; + + hidden = TRUE; + werase(SP->slk_winptr); + return wrefresh(SP->slk_winptr); +} + +int slk_restore(void) +{ + PDC_LOG(("slk_restore() - called\n")); + + if (!SP) + return ERR; + + hidden = FALSE; + _redraw(); + return wrefresh(SP->slk_winptr); +} + +int slk_touch(void) +{ + PDC_LOG(("slk_touch() - called\n")); + + if (!SP) + return ERR; + + return touchwin(SP->slk_winptr); +} + +int slk_attron(const chtype attrs) +{ + int rc; + + PDC_LOG(("slk_attron() - called\n")); + + if (!SP) + return ERR; + + rc = wattron(SP->slk_winptr, attrs); + _redraw(); + + return rc; +} + +int slk_attr_on(const attr_t attrs, void *opts) +{ + PDC_LOG(("slk_attr_on() - called\n")); + + return slk_attron(attrs); +} + +int slk_attroff(const chtype attrs) +{ + int rc; + + PDC_LOG(("slk_attroff() - called\n")); + + if (!SP) + return ERR; + + rc = wattroff(SP->slk_winptr, attrs); + _redraw(); + + return rc; +} + +int slk_attr_off(const attr_t attrs, void *opts) +{ + PDC_LOG(("slk_attr_off() - called\n")); + + return slk_attroff(attrs); +} + +int slk_attrset(const chtype attrs) +{ + int rc; + + PDC_LOG(("slk_attrset() - called\n")); + + if (!SP) + return ERR; + + rc = wattrset(SP->slk_winptr, attrs); + _redraw(); + + return rc; +} + +int slk_color(short color_pair) +{ + int rc; + + PDC_LOG(("slk_color() - called\n")); + + if (!SP) + return ERR; + + rc = wcolor_set(SP->slk_winptr, color_pair, NULL); + _redraw(); + + return rc; +} + +int slk_attr_set(const attr_t attrs, short color_pair, void *opts) +{ + PDC_LOG(("slk_attr_set() - called\n")); + + return slk_attrset(attrs | COLOR_PAIR(color_pair)); +} + +static void _slk_calc(void) +{ + int i, center, col = 0; + label_length = COLS / labels; + + if (label_length > 31) + label_length = 31; + + switch (label_fmt) + { + case 0: /* 3 - 2 - 3 F-Key layout */ + + --label_length; + + slk[0].start_col = col; + slk[1].start_col = (col += label_length); + slk[2].start_col = (col += label_length); + + center = COLS / 2; + + slk[3].start_col = center - label_length + 1; + slk[4].start_col = center + 1; + + col = COLS - (label_length * 3) + 1; + + slk[5].start_col = col; + slk[6].start_col = (col += label_length); + slk[7].start_col = (col += label_length); + break; + + case 1: /* 4 - 4 F-Key layout */ + + for (i = 0; i < 8; i++) + { + slk[i].start_col = col; + col += label_length; + + if (i == 3) + col = COLS - (label_length * 4) + 1; + } + + break; + + case 2: /* 4 4 4 F-Key layout */ + case 3: /* 4 4 4 F-Key layout with index */ + + for (i = 0; i < 4; i++) + { + slk[i].start_col = col; + col += label_length; + } + + center = COLS / 2; + + slk[4].start_col = center - (label_length * 2) + 1; + slk[5].start_col = center - label_length + 1; + slk[6].start_col = center + 1; + slk[7].start_col = center + label_length + 1; + + col = COLS - (label_length * 4) + 1; + + for (i = 8; i < 12; i++) + { + slk[i].start_col = col; + col += label_length; + } + + break; + + default: /* 5 - 5 F-Key layout */ + + for (i = 0; i < 10; i++) + { + slk[i].start_col = col; + col += label_length; + + if (i == 4) + col = COLS - (label_length * 5) + 1; + } + } + + --label_length; + + /* make sure labels are all in window */ + + _redraw(); +} + +void PDC_slk_initialize(void) +{ + if (slk) + { + if (label_fmt == 3) + { + SP->slklines = 2; + label_line = 1; + } + else + SP->slklines = 1; + + if (!SP->slk_winptr) + { + SP->slk_winptr = newwin(SP->slklines, COLS, + LINES - SP->slklines, 0); + if (!SP->slk_winptr) + return; + + wattrset(SP->slk_winptr, A_REVERSE); + } + + _slk_calc(); + + /* if we have an index line, display it now */ + + if (label_fmt == 3) + { + chtype save_attr; + int i; + + save_attr = SP->slk_winptr->_attrs; + wattrset(SP->slk_winptr, A_NORMAL); + wmove(SP->slk_winptr, 0, 0); + whline(SP->slk_winptr, 0, COLS); + + for (i = 0; i < labels; i++) + mvwprintw(SP->slk_winptr, 0, slk[i].start_col, "F%d", i + 1); + + SP->slk_winptr->_attrs = save_attr; + } + + touchwin(SP->slk_winptr); + } +} + +void PDC_slk_free(void) +{ + if (slk) + { + if (SP->slk_winptr) + { + delwin(SP->slk_winptr); + SP->slk_winptr = (WINDOW *)NULL; + } + + free(slk); + slk = (struct SLK *)NULL; + + label_length = 0; + labels = 0; + label_fmt = 0; + label_line = 0; + hidden = FALSE; + } +} + +int PDC_mouse_in_slk(int y, int x) +{ + int i; + + PDC_LOG(("PDC_mouse_in_slk() - called: y->%d x->%d\n", y, x)); + + /* If the line on which the mouse was clicked is NOT the last line + of the screen, we are not interested in it. */ + + if (!slk || !SP->slk_winptr || (y != SP->slk_winptr->_begy + label_line)) + return 0; + + for (i = 0; i < labels; i++) + if (x >= slk[i].start_col && x < (slk[i].start_col + label_length)) + return i + 1; + + return 0; +} + +#ifdef PDC_WIDE +int slk_wset(int labnum, const wchar_t *label, int justify) +{ + PDC_LOG(("slk_wset() - called\n")); + + if (labnum < 1 || labnum > labels || justify < 0 || justify > 2) + return ERR; + + labnum--; + + if (!label || !(*label)) + { + /* Clear the label */ + + *slk[labnum].label = 0; + slk[labnum].format = 0; + slk[labnum].len = 0; + } + else + { + int i, j = 0; + + /* Skip leading spaces */ + + while (label[j] == L' ') + j++; + + /* Copy it */ + + for (i = 0; i < label_length; i++) + { + chtype ch = label[i + j]; + + slk[labnum].label[i] = ch; + + if (!ch) + break; + } + + /* Drop trailing spaces */ + + while ((i + j) && (label[i + j - 1] == L' ')) + i--; + + slk[labnum].label[i] = 0; + slk[labnum].format = justify; + slk[labnum].len = i; + } + + _drawone(labnum); + + return OK; +} + +wchar_t *slk_wlabel(int labnum) +{ + static wchar_t temp[33]; + chtype *p; + int i; + + PDC_LOG(("slk_wlabel() - called\n")); + + if (labnum < 1 || labnum > labels) + return (wchar_t *)0; + + for (i = 0, p = slk[labnum - 1].label; *p; i++) + temp[i] = *p++; + + temp[i] = '\0'; + + return temp; +} +#endif diff --git a/vendor/pdcurses/pdcurses/termattr.c b/vendor/pdcurses/pdcurses/termattr.c new file mode 100644 index 0000000..b858e81 --- /dev/null +++ b/vendor/pdcurses/pdcurses/termattr.c @@ -0,0 +1,174 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +termattr +-------- + +### Synopsis + + int baudrate(void); + char erasechar(void); + bool has_ic(void); + bool has_il(void); + char killchar(void); + char *longname(void); + chtype termattrs(void); + attr_t term_attrs(void); + char *termname(void); + + int erasewchar(wchar_t *ch); + int killwchar(wchar_t *ch); + + char wordchar(void); + +### Description + + baudrate() is supposed to return the output speed of the terminal. In + PDCurses, it simply returns INT_MAX. + + has_ic and has_il() return TRUE. These functions have meaning in some + other implementations of curses. + + erasechar() and killchar() return ^H and ^U, respectively -- the + ERASE and KILL characters. In other curses implementations, these may + vary by terminal type. erasewchar() and killwchar() are the wide- + character versions; they take a pointer to a location in which to + store the character, and return OK or ERR. + + longname() returns a pointer to a static area containing a verbose + description of the current terminal. The maximum length of the string + is 128 characters. It is defined only after the call to initscr() or + newterm(). + + termname() returns a pointer to a static area containing a short + description of the current terminal (14 characters). + + termattrs() returns a logical OR of all video attributes supported by + the terminal. + + wordchar() is a PDCurses extension of the concept behind the + functions erasechar() and killchar(), returning the "delete word" + character, ^W. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + baudrate | Y | Y | Y + erasechar | Y | Y | Y + has_ic | Y | Y | Y + has_il | Y | Y | Y + killchar | Y | Y | Y + longname | Y | Y | Y + termattrs | Y | Y | Y + termname | Y | Y | Y + erasewchar | Y | Y | Y + killwchar | Y | Y | Y + term_attrs | Y | Y | Y + wordchar | - | - | - + +**man-end****************************************************************/ + +#include +#include + +int baudrate(void) +{ + PDC_LOG(("baudrate() - called\n")); + + return INT_MAX; +} + +char erasechar(void) +{ + PDC_LOG(("erasechar() - called\n")); + + return _ECHAR; /* character delete char (^H) */ +} + +bool has_ic(void) +{ + PDC_LOG(("has_ic() - called\n")); + + return TRUE; +} + +bool has_il(void) +{ + PDC_LOG(("has_il() - called\n")); + + return TRUE; +} + +char killchar(void) +{ + PDC_LOG(("killchar() - called\n")); + + return _DLCHAR; /* line delete char (^U) */ +} + +char *longname(void) +{ + PDC_LOG(("longname() - called\n")); + + return ttytype + 9; /* skip "pdcurses|" */ +} + +chtype termattrs(void) +{ + PDC_LOG(("termattrs() - called\n")); + + return SP ? SP->termattrs : (chtype)0; +} + +attr_t term_attrs(void) +{ + PDC_LOG(("term_attrs() - called\n")); + + return SP ? SP->termattrs : (attr_t)0; +} + +char *termname(void) +{ + static char _termname[14] = "pdcurses"; + + PDC_LOG(("termname() - called\n")); + + return _termname; +} + +char wordchar(void) +{ + PDC_LOG(("wordchar() - called\n")); + + return _DWCHAR; /* word delete char */ +} + +#ifdef PDC_WIDE +int erasewchar(wchar_t *ch) +{ + PDC_LOG(("erasewchar() - called\n")); + + if (!ch) + return ERR; + + *ch = (wchar_t)_ECHAR; + + return OK; +} + +int killwchar(wchar_t *ch) +{ + PDC_LOG(("killwchar() - called\n")); + + if (!ch) + return ERR; + + *ch = (wchar_t)_DLCHAR; + + return OK; +} +#endif diff --git a/vendor/pdcurses/pdcurses/touch.c b/vendor/pdcurses/pdcurses/touch.c new file mode 100644 index 0000000..7905bae --- /dev/null +++ b/vendor/pdcurses/pdcurses/touch.c @@ -0,0 +1,210 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +touch +----- + +### Synopsis + + int touchwin(WINDOW *win); + int touchline(WINDOW *win, int start, int count); + int untouchwin(WINDOW *win); + int wtouchln(WINDOW *win, int y, int n, int changed); + bool is_linetouched(WINDOW *win, int line); + bool is_wintouched(WINDOW *win); + + int touchoverlap(const WINDOW *win1, WINDOW *win2); + +### Description + + touchwin() and touchline() throw away all information about which + parts of the window have been touched, pretending that the entire + window has been drawn on. This is sometimes necessary when using + overlapping windows, since a change to one window will affect the + other window, but the records of which lines have been changed in the + other window will not reflect the change. + + untouchwin() marks all lines in the window as unchanged since the + last call to wrefresh(). + + wtouchln() makes n lines in the window, starting at line y, look as + if they have (changed == 1) or have not (changed == 0) been changed + since the last call to wrefresh(). + + is_linetouched() returns TRUE if the specified line in the specified + window has been changed since the last call to wrefresh(). + + is_wintouched() returns TRUE if the specified window has been changed + since the last call to wrefresh(). + + touchoverlap(win1, win2) marks the portion of win2 which overlaps + with win1 as modified. + +### Return Value + + All functions return OK on success and ERR on error except + is_wintouched() and is_linetouched(). + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + touchwin | Y | Y | Y + touchline | Y | Y | Y + untouchwin | Y | Y | Y + wtouchln | Y | Y | Y + is_linetouched | Y | Y | Y + is_wintouched | Y | Y | Y + touchoverlap | - | - | Y + +**man-end****************************************************************/ + +int touchwin(WINDOW *win) +{ + int i; + + PDC_LOG(("touchwin() - called: Win=%x\n", win)); + + if (!win) + return ERR; + + for (i = 0; i < win->_maxy; i++) + { + win->_firstch[i] = 0; + win->_lastch[i] = win->_maxx - 1; + } + + return OK; +} + +int touchline(WINDOW *win, int start, int count) +{ + int i; + + PDC_LOG(("touchline() - called: win=%p start %d count %d\n", + win, start, count)); + + if (!win || start > win->_maxy || start + count > win->_maxy) + return ERR; + + for (i = start; i < start + count; i++) + { + win->_firstch[i] = 0; + win->_lastch[i] = win->_maxx - 1; + } + + return OK; +} + +int untouchwin(WINDOW *win) +{ + int i; + + PDC_LOG(("untouchwin() - called: win=%p", win)); + + if (!win) + return ERR; + + for (i = 0; i < win->_maxy; i++) + { + win->_firstch[i] = _NO_CHANGE; + win->_lastch[i] = _NO_CHANGE; + } + + return OK; +} + +int wtouchln(WINDOW *win, int y, int n, int changed) +{ + int i; + + PDC_LOG(("wtouchln() - called: win=%p y=%d n=%d changed=%d\n", + win, y, n, changed)); + + if (!win || y > win->_maxy || y + n > win->_maxy) + return ERR; + + for (i = y; i < y + n; i++) + { + if (changed) + { + win->_firstch[i] = 0; + win->_lastch[i] = win->_maxx - 1; + } + else + { + win->_firstch[i] = _NO_CHANGE; + win->_lastch[i] = _NO_CHANGE; + } + } + + return OK; +} + +bool is_linetouched(WINDOW *win, int line) +{ + PDC_LOG(("is_linetouched() - called: win=%p line=%d\n", win, line)); + + if (!win || line > win->_maxy || line < 0) + return FALSE; + + return (win->_firstch[line] != _NO_CHANGE) ? TRUE : FALSE; +} + +bool is_wintouched(WINDOW *win) +{ + int i; + + PDC_LOG(("is_wintouched() - called: win=%p\n", win)); + + if (win) + for (i = 0; i < win->_maxy; i++) + if (win->_firstch[i] != _NO_CHANGE) + return TRUE; + + return FALSE; +} + +int touchoverlap(const WINDOW *win1, WINDOW *win2) +{ + int y, endy, endx, starty, startx, begy1, begx1, begy2, begx2; + + PDC_LOG(("touchoverlap() - called: win1=%p win2=%p\n", win1, win2)); + + if (!win1 || !win2) + return ERR; + + begy1 = win1->_begy; + begx1 = win1->_begx; + begy2 = win2->_begy; + begx2 = win2->_begy; + + starty = max(begy1, begy2); + startx = max(begx1, begx2); + endy = min(win1->_maxy + begy1, win2->_maxy + begy2); + endx = min(win1->_maxx + begx1, win2->_maxx + begx2); + + if (starty >= endy || startx >= endx) + return OK; + + starty -= begy2; + startx -= begx2; + endy -= begy2; + endx -= begx2; + endx -= 1; + + for (y = starty; y < endy; y++) + { + int first = win2->_firstch[y]; + + if (first == _NO_CHANGE || win2->_lastch[y] < endx) + win2->_lastch[y] = endx; + if (first == _NO_CHANGE || first > startx) + win2->_firstch[y] = startx; + } + + return OK; +} diff --git a/vendor/pdcurses/pdcurses/util.c b/vendor/pdcurses/pdcurses/util.c new file mode 100644 index 0000000..b1754b7 --- /dev/null +++ b/vendor/pdcurses/pdcurses/util.c @@ -0,0 +1,310 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +util +---- + +### Synopsis + + char *unctrl(chtype c); + void filter(void); + void use_env(bool x); + int delay_output(int ms); + + int getcchar(const cchar_t *wcval, wchar_t *wch, attr_t *attrs, + short *color_pair, void *opts); + int setcchar(cchar_t *wcval, const wchar_t *wch, const attr_t attrs, + short color_pair, const void *opts); + wchar_t *wunctrl(cchar_t *wc); + + int PDC_mbtowc(wchar_t *pwc, const char *s, size_t n); + size_t PDC_mbstowcs(wchar_t *dest, const char *src, size_t n); + size_t PDC_wcstombs(char *dest, const wchar_t *src, size_t n); + +### Description + + unctrl() expands the text portion of the chtype c into a printable + string. Control characters are changed to the "^X" notation; others + are passed through. wunctrl() is the wide-character version of the + function. + + filter() and use_env() are no-ops in PDCurses. + + delay_output() inserts an ms millisecond pause in output. + + getcchar() works in two modes: When wch is not NULL, it reads the + cchar_t pointed to by wcval and stores the attributes in attrs, the + color pair in color_pair, and the text in the wide-character string + wch. When wch is NULL, getcchar() merely returns the number of wide + characters in wcval. In either mode, the opts argument is unused. + + setcchar constructs a cchar_t at wcval from the wide-character text + at wch, the attributes in attr and the color pair in color_pair. The + opts argument is unused. + + Currently, the length returned by getcchar() is always 1 or 0. + Similarly, setcchar() will only take the first wide character from + wch, and ignore any others that it "should" take (i.e., combining + characters). Nor will it correctly handle any character outside the + basic multilingual plane (UCS-2). + +### Return Value + + wunctrl() returns NULL on failure. delay_output() always returns OK. + + getcchar() returns the number of wide characters wcval points to when + wch is NULL; when it's not, getcchar() returns OK or ERR. + + setcchar() returns OK or ERR. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + unctrl | Y | Y | Y + filter | Y | Y | Y + use_env | Y | Y | Y + delay_output | Y | Y | Y + getcchar | Y | Y | Y + setcchar | Y | Y | Y + wunctrl | Y | Y | Y + PDC_mbtowc | - | - | - + PDC_mbstowcs | - | - | - + PDC_wcstombs | - | - | - + +**man-end****************************************************************/ + +#include +#include + +char *unctrl(chtype c) +{ + static char strbuf[3] = {0, 0, 0}; + + chtype ic; + + PDC_LOG(("unctrl() - called\n")); + + ic = c & A_CHARTEXT; + + if (ic >= 0x20 && ic != 0x7f) /* normal characters */ + { + strbuf[0] = (char)ic; + strbuf[1] = '\0'; + return strbuf; + } + + strbuf[0] = '^'; /* '^' prefix */ + + if (ic == 0x7f) /* 0x7f == DEL */ + strbuf[1] = '?'; + else /* other control */ + strbuf[1] = (char)(ic + '@'); + + return strbuf; +} + +void filter(void) +{ + PDC_LOG(("filter() - called\n")); +} + +void use_env(bool x) +{ + PDC_LOG(("use_env() - called: x %d\n", x)); +} + +int delay_output(int ms) +{ + PDC_LOG(("delay_output() - called: ms %d\n", ms)); + + return napms(ms); +} + +#ifdef PDC_WIDE +int getcchar(const cchar_t *wcval, wchar_t *wch, attr_t *attrs, + short *color_pair, void *opts) +{ + if (!wcval) + return ERR; + + if (wch) + { + if (!attrs || !color_pair) + return ERR; + + *wch = (*wcval & A_CHARTEXT); + *attrs = (*wcval & (A_ATTRIBUTES & ~A_COLOR)); + *color_pair = PAIR_NUMBER(*wcval & A_COLOR); + + if (*wch) + *++wch = L'\0'; + + return OK; + } + else + return ((*wcval & A_CHARTEXT) != L'\0'); +} + +int setcchar(cchar_t *wcval, const wchar_t *wch, const attr_t attrs, + short color_pair, const void *opts) +{ + if (!wcval || !wch) + return ERR; + + *wcval = *wch | attrs | COLOR_PAIR(color_pair); + + return OK; +} + +wchar_t *wunctrl(cchar_t *wc) +{ + static wchar_t strbuf[3] = {0, 0, 0}; + + cchar_t ic; + + PDC_LOG(("wunctrl() - called\n")); + + if (!wc) + return NULL; + + ic = *wc & A_CHARTEXT; + + if (ic >= 0x20 && ic != 0x7f) /* normal characters */ + { + strbuf[0] = (wchar_t)ic; + strbuf[1] = L'\0'; + return strbuf; + } + + strbuf[0] = '^'; /* '^' prefix */ + + if (ic == 0x7f) /* 0x7f == DEL */ + strbuf[1] = '?'; + else /* other control */ + strbuf[1] = (wchar_t)(ic + '@'); + + return strbuf; +} + +int PDC_mbtowc(wchar_t *pwc, const char *s, size_t n) +{ +# ifdef PDC_FORCE_UTF8 + wchar_t key; + int i = -1; + const unsigned char *string; + + if (!s || (n < 1)) + return -1; + + if (!*s) + return 0; + + string = (const unsigned char *)s; + + key = string[0]; + + /* Simplistic UTF-8 decoder -- only does the BMP, minimal validation */ + + if (key & 0x80) + { + if ((key & 0xe0) == 0xc0) + { + if (1 < n) + { + key = ((key & 0x1f) << 6) | (string[1] & 0x3f); + i = 2; + } + } + else if ((key & 0xe0) == 0xe0) + { + if (2 < n) + { + key = ((key & 0x0f) << 12) | ((string[1] & 0x3f) << 6) | + (string[2] & 0x3f); + i = 3; + } + } + } + else + i = 1; + + if (i) + *pwc = key; + + return i; +# else + return mbtowc(pwc, s, n); +# endif +} + +size_t PDC_mbstowcs(wchar_t *dest, const char *src, size_t n) +{ +# ifdef PDC_FORCE_UTF8 + size_t i = 0, len; + + if (!src || !dest) + return 0; + + len = strlen(src); + + while (*src && i < n) + { + int retval = PDC_mbtowc(dest + i, src, len); + + if (retval < 1) + return -1; + + src += retval; + len -= retval; + i++; + } +# else + size_t i = mbstowcs(dest, src, n); +# endif + dest[i] = 0; + return i; +} + +size_t PDC_wcstombs(char *dest, const wchar_t *src, size_t n) +{ +# ifdef PDC_FORCE_UTF8 + size_t i = 0; + + if (!src || !dest) + return 0; + + while (*src && i < n) + { + chtype code = *src++; + + if (code < 0x80) + { + dest[i] = code; + i++; + } + else + if (code < 0x800) + { + dest[i] = ((code & 0x07c0) >> 6) | 0xc0; + dest[i + 1] = (code & 0x003f) | 0x80; + i += 2; + } + else + { + dest[i] = ((code & 0xf000) >> 12) | 0xe0; + dest[i + 1] = ((code & 0x0fc0) >> 6) | 0x80; + dest[i + 2] = (code & 0x003f) | 0x80; + i += 3; + } + } +# else + size_t i = wcstombs(dest, src, n); +# endif + dest[i] = '\0'; + return i; +} +#endif diff --git a/vendor/pdcurses/pdcurses/window.c b/vendor/pdcurses/pdcurses/window.c new file mode 100644 index 0000000..ed06763 --- /dev/null +++ b/vendor/pdcurses/pdcurses/window.c @@ -0,0 +1,639 @@ +/* PDCurses */ + +#include + +/*man-start************************************************************** + +window +------ + +### Synopsis + + WINDOW *newwin(int nlines, int ncols, int begy, int begx); + WINDOW *derwin(WINDOW* orig, int nlines, int ncols, + int begy, int begx); + WINDOW *subwin(WINDOW* orig, int nlines, int ncols, + int begy, int begx); + WINDOW *dupwin(WINDOW *win); + WINDOW *wgetparent(const WINDOW *win); + int delwin(WINDOW *win); + int mvwin(WINDOW *win, int y, int x); + int mvderwin(WINDOW *win, int pary, int parx); + int syncok(WINDOW *win, bool bf); + bool is_subwin(const WINDOW *win); + bool is_syncok(const WINDOW *win); + void wsyncup(WINDOW *win); + void wcursyncup(WINDOW *win); + void wsyncdown(WINDOW *win); + + WINDOW *resize_window(WINDOW *win, int nlines, int ncols); + int wresize(WINDOW *win, int nlines, int ncols); + WINDOW *PDC_makelines(WINDOW *win); + WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx); + void PDC_sync(WINDOW *win); + +### Description + + newwin() creates a new window with the given number of lines, nlines + and columns, ncols. The upper left corner of the window is at line + begy, column begx. If nlines is zero, it defaults to LINES - begy; + ncols to COLS - begx. Create a new full-screen window by calling + newwin(0, 0, 0, 0). + + delwin() deletes the named window, freeing all associated memory. In + the case of overlapping windows, subwindows should be deleted before + the main window. + + mvwin() moves the window so that the upper left-hand corner is at + position (y,x). If the move would cause the window to be off the + screen, it is an error and the window is not moved. Moving subwindows + is allowed. + + subwin() creates a new subwindow within a window. The dimensions of + the subwindow are nlines lines and ncols columns. The subwindow is at + position (begy, begx) on the screen. This position is relative to the + screen, and not to the window orig. Changes made to either window + will affect both. When using this routine, you will often need to + call touchwin() before calling wrefresh(). + + derwin() is the same as subwin(), except that begy and begx are + relative to the origin of the window orig rather than the screen. + There is no difference between subwindows and derived windows. + + mvderwin() moves a derived window (or subwindow) inside its parent + window. The screen-relative parameters of the window are not changed. + This routine is used to display different parts of the parent window + at the same physical position on the screen. + + dupwin() creates an exact duplicate of the window win. + + wgetparent() returns the parent WINDOW pointer for subwindows, or NULL + for windows having no parent. + + wsyncup() causes a touchwin() of all of the window's parents. + + If syncok() is called with a second argument of TRUE, this causes a + wsyncup() to be called every time the window is changed. + + is_subwin() reports whether the specified window is a subwindow, + created by subwin() or derwin(). + + is_syncok() reports whether the specified window is in syncok mode. + + wcursyncup() causes the current cursor position of all of a window's + ancestors to reflect the current cursor position of the current + window. + + wsyncdown() causes a touchwin() of the current window if any of its + parent's windows have been touched. + + resize_window() allows the user to resize an existing window. It + returns the pointer to the new window, or NULL on failure. + + wresize() is an ncurses-compatible wrapper for resize_window(). Note + that, unlike ncurses, it will NOT process any subwindows of the + window. (However, you still can call it _on_ subwindows.) It returns + OK or ERR. + + PDC_makenew() allocates all data for a new WINDOW * except the actual + lines themselves. If it's unable to allocate memory for the window + structure, it will free all allocated memory and return a NULL + pointer. + + PDC_makelines() allocates the memory for the lines. + + PDC_sync() handles wrefresh() and wsyncup() calls when a window is + changed. + +### Return Value + + newwin(), subwin(), derwin() and dupwin() return a pointer to the new + window, or NULL on failure. delwin(), mvwin(), mvderwin() and + syncok() return OK or ERR. wsyncup(), wcursyncup() and wsyncdown() + return nothing. + + is_subwin() and is_syncok() returns TRUE or FALSE. + +### Errors + + It is an error to call resize_window() before calling initscr(). + Also, an error will be generated if we fail to create a newly sized + replacement window for curscr, or stdscr. This could happen when + increasing the window size. NOTE: If this happens, the previously + successfully allocated windows are left alone; i.e., the resize is + NOT cancelled for those windows. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + newwin | Y | Y | Y + delwin | Y | Y | Y + mvwin | Y | Y | Y + subwin | Y | Y | Y + derwin | Y | Y | Y + mvderwin | Y | Y | Y + dupwin | Y | Y | Y + wgetparent | - | Y | - + wsyncup | Y | Y | Y + syncok | Y | Y | Y + is_subwin | - | Y | - + is_syncok | - | Y | - + wcursyncup | Y | Y | Y + wsyncdown | Y | Y | Y + wresize | - | Y | Y + resize_window | - | - | - + PDC_makelines | - | - | - + PDC_makenew | - | - | - + PDC_sync | - | - | - + +**man-end****************************************************************/ + +#include + +WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx) +{ + WINDOW *win; + + PDC_LOG(("PDC_makenew() - called: lines %d cols %d begy %d begx %d\n", + nlines, ncols, begy, begx)); + + /* allocate the window structure itself */ + + win = calloc(1, sizeof(WINDOW)); + if (!win) + return win; + + /* allocate the line pointer array */ + + win->_y = malloc(nlines * sizeof(chtype *)); + if (!win->_y) + { + free(win); + return (WINDOW *)NULL; + } + + /* allocate the minchng and maxchng arrays */ + + win->_firstch = malloc(nlines * sizeof(int)); + if (!win->_firstch) + { + free(win->_y); + free(win); + return (WINDOW *)NULL; + } + + win->_lastch = malloc(nlines * sizeof(int)); + if (!win->_lastch) + { + free(win->_firstch); + free(win->_y); + free(win); + return (WINDOW *)NULL; + } + + /* initialize window variables */ + + win->_maxy = nlines; /* real max screen size */ + win->_maxx = ncols; /* real max screen size */ + win->_begy = begy; + win->_begx = begx; + win->_bkgd = ' '; /* wrs 4/10/93 -- initialize background to blank */ + win->_clear = (bool) ((nlines == LINES) && (ncols == COLS)); + win->_bmarg = nlines - 1; + win->_parx = win->_pary = -1; + + /* initialize pad variables*/ + + win->_pad._pad_y = -1; + win->_pad._pad_x = -1; + win->_pad._pad_top = -1; + win->_pad._pad_left = -1; + win->_pad._pad_bottom = -1; + win->_pad._pad_right = -1; + + /* init to say window all changed */ + + touchwin(win); + + return win; +} + +WINDOW *PDC_makelines(WINDOW *win) +{ + int i, j, nlines, ncols; + + PDC_LOG(("PDC_makelines() - called\n")); + + if (!win) + return (WINDOW *)NULL; + + nlines = win->_maxy; + ncols = win->_maxx; + + for (i = 0; i < nlines; i++) + { + win->_y[i] = malloc(ncols * sizeof(chtype)); + if (!win->_y[i]) + { + /* if error, free all the data */ + + for (j = 0; j < i; j++) + free(win->_y[j]); + + free(win->_firstch); + free(win->_lastch); + free(win->_y); + free(win); + + return (WINDOW *)NULL; + } + } + + return win; +} + +void PDC_sync(WINDOW *win) +{ + PDC_LOG(("PDC_sync() - called:\n")); + + if (win->_immed) + wrefresh(win); + if (win->_sync) + wsyncup(win); +} + +WINDOW *newwin(int nlines, int ncols, int begy, int begx) +{ + WINDOW *win; + + PDC_LOG(("newwin() - called:lines=%d cols=%d begy=%d begx=%d\n", + nlines, ncols, begy, begx)); + + if (!nlines) + nlines = LINES - begy; + if (!ncols) + ncols = COLS - begx; + + if (!SP || begy + nlines > SP->lines || begx + ncols > SP->cols) + return (WINDOW *)NULL; + + win = PDC_makenew(nlines, ncols, begy, begx); + if (win) + win = PDC_makelines(win); + + if (win) + werase(win); + + return win; +} + +int delwin(WINDOW *win) +{ + int i; + + PDC_LOG(("delwin() - called\n")); + + if (!win) + return ERR; + + /* subwindows use parents' lines */ + + if (!(win->_flags & (_SUBWIN|_SUBPAD))) + for (i = 0; i < win->_maxy && win->_y[i]; i++) + if (win->_y[i]) + free(win->_y[i]); + + free(win->_firstch); + free(win->_lastch); + free(win->_y); + free(win); + + return OK; +} + +int mvwin(WINDOW *win, int y, int x) +{ + PDC_LOG(("mvwin() - called\n")); + + if (!win || (y + win->_maxy > LINES || y < 0) + || (x + win->_maxx > COLS || x < 0)) + return ERR; + + win->_begy = y; + win->_begx = x; + touchwin(win); + + return OK; +} + +WINDOW *subwin(WINDOW *orig, int nlines, int ncols, int begy, int begx) +{ + WINDOW *win; + int i, j, k; + + PDC_LOG(("subwin() - called: lines %d cols %d begy %d begx %d\n", + nlines, ncols, begy, begx)); + + /* make sure window fits inside the original one */ + + if (!orig || (begy < orig->_begy) || (begx < orig->_begx) || + (begy + nlines) > (orig->_begy + orig->_maxy) || + (begx + ncols) > (orig->_begx + orig->_maxx)) + return (WINDOW *)NULL; + + j = begy - orig->_begy; + k = begx - orig->_begx; + + if (!nlines) + nlines = orig->_maxy - j; + if (!ncols) + ncols = orig->_maxx - k; + + win = PDC_makenew(nlines, ncols, begy, begx); + if (!win) + return (WINDOW *)NULL; + + /* initialize window variables */ + + win->_attrs = orig->_attrs; + win->_bkgd = orig->_bkgd; + win->_leaveit = orig->_leaveit; + win->_scroll = orig->_scroll; + win->_nodelay = orig->_nodelay; + win->_delayms = orig->_delayms; + win->_use_keypad = orig->_use_keypad; + win->_immed = orig->_immed; + win->_sync = orig->_sync; + win->_pary = j; + win->_parx = k; + win->_parent = orig; + + for (i = 0; i < nlines; i++, j++) + win->_y[i] = orig->_y[j] + k; + + win->_flags |= _SUBWIN; + + return win; +} + +WINDOW *derwin(WINDOW *orig, int nlines, int ncols, int begy, int begx) +{ + return subwin(orig, nlines, ncols, begy + orig->_begy, begx + orig->_begx); +} + +int mvderwin(WINDOW *win, int pary, int parx) +{ + int i, j; + WINDOW *mypar; + + if (!win || !(win->_parent)) + return ERR; + + mypar = win->_parent; + + if (pary < 0 || parx < 0 || (pary + win->_maxy) > mypar->_maxy || + (parx + win->_maxx) > mypar->_maxx) + return ERR; + + j = pary; + + for (i = 0; i < win->_maxy; i++) + win->_y[i] = (mypar->_y[j++]) + parx; + + win->_pary = pary; + win->_parx = parx; + + return OK; +} + +WINDOW *dupwin(WINDOW *win) +{ + WINDOW *new; + chtype *ptr, *ptr1; + int nlines, ncols, begy, begx, i; + + if (!win) + return (WINDOW *)NULL; + + nlines = win->_maxy; + ncols = win->_maxx; + begy = win->_begy; + begx = win->_begx; + + new = PDC_makenew(nlines, ncols, begy, begx); + if (new) + new = PDC_makelines(new); + + if (!new) + return (WINDOW *)NULL; + + /* copy the contents of win into new */ + + for (i = 0; i < nlines; i++) + { + for (ptr = new->_y[i], ptr1 = win->_y[i]; + ptr < new->_y[i] + ncols; ptr++, ptr1++) + *ptr = *ptr1; + + new->_firstch[i] = 0; + new->_lastch[i] = ncols - 1; + } + + new->_curx = win->_curx; + new->_cury = win->_cury; + new->_maxy = win->_maxy; + new->_maxx = win->_maxx; + new->_begy = win->_begy; + new->_begx = win->_begx; + new->_flags = win->_flags; + new->_attrs = win->_attrs; + new->_clear = win->_clear; + new->_leaveit = win->_leaveit; + new->_scroll = win->_scroll; + new->_nodelay = win->_nodelay; + new->_delayms = win->_delayms; + new->_use_keypad = win->_use_keypad; + new->_tmarg = win->_tmarg; + new->_bmarg = win->_bmarg; + new->_parx = win->_parx; + new->_pary = win->_pary; + new->_parent = win->_parent; + new->_bkgd = win->_bkgd; + new->_flags = win->_flags; + + return new; +} + +WINDOW *wgetparent(const WINDOW *win) +{ + PDC_LOG(("wgetparent() - called\n")); + + if (!win || !win->_parent) + return NULL; + + return win->_parent; +} + +WINDOW *resize_window(WINDOW *win, int nlines, int ncols) +{ + WINDOW *new; + int i, save_cury, save_curx, new_begy, new_begx; + + PDC_LOG(("resize_window() - called: nlines %d ncols %d\n", + nlines, ncols)); + + if (!win || !SP) + return (WINDOW *)NULL; + + if (win->_flags & _SUBPAD) + { + new = subpad(win->_parent, nlines, ncols, win->_begy, win->_begx); + if (!new) + return (WINDOW *)NULL; + } + else if (win->_flags & _SUBWIN) + { + new = subwin(win->_parent, nlines, ncols, win->_begy, win->_begx); + if (!new) + return (WINDOW *)NULL; + } + else + { + if (win == SP->slk_winptr) + { + new_begy = SP->lines - SP->slklines; + new_begx = 0; + } + else + { + new_begy = win->_begy; + new_begx = win->_begx; + } + + new = PDC_makenew(nlines, ncols, new_begy, new_begx); + if (!new) + return (WINDOW *)NULL; + } + + save_curx = min(win->_curx, (new->_maxx - 1)); + save_cury = min(win->_cury, (new->_maxy - 1)); + + if (!(win->_flags & (_SUBPAD|_SUBWIN))) + { + new = PDC_makelines(new); + if (!new) + return (WINDOW *)NULL; + + new->_bkgd = win->_bkgd; + werase(new); + + copywin(win, new, 0, 0, 0, 0, min(win->_maxy, new->_maxy) - 1, + min(win->_maxx, new->_maxx) - 1, FALSE); + + for (i = 0; i < win->_maxy && win->_y[i]; i++) + if (win->_y[i]) + free(win->_y[i]); + } + + new->_flags = win->_flags; + new->_attrs = win->_attrs; + new->_clear = win->_clear; + new->_leaveit = win->_leaveit; + new->_scroll = win->_scroll; + new->_nodelay = win->_nodelay; + new->_delayms = win->_delayms; + new->_use_keypad = win->_use_keypad; + new->_tmarg = (win->_tmarg > new->_maxy - 1) ? 0 : win->_tmarg; + new->_bmarg = (win->_bmarg == win->_maxy - 1) ? + new->_maxy - 1 : min(win->_bmarg, (new->_maxy - 1)); + new->_parent = win->_parent; + new->_immed = win->_immed; + new->_sync = win->_sync; + new->_bkgd = win->_bkgd; + + new->_curx = save_curx; + new->_cury = save_cury; + + free(win->_firstch); + free(win->_lastch); + free(win->_y); + + *win = *new; + free(new); + + return win; +} + +int wresize(WINDOW *win, int nlines, int ncols) +{ + return (resize_window(win, nlines, ncols) ? OK : ERR); +} + +void wsyncup(WINDOW *win) +{ + WINDOW *tmp; + + PDC_LOG(("wsyncup() - called\n")); + + for (tmp = win; tmp; tmp = tmp->_parent) + touchwin(tmp); +} + +int syncok(WINDOW *win, bool bf) +{ + PDC_LOG(("syncok() - called\n")); + + if (!win) + return ERR; + + win->_sync = bf; + + return OK; +} + +bool is_subwin(const WINDOW *win) +{ + PDC_LOG(("is_subwin() - called\n")); + + if (!win) + return FALSE; + + return ((win->_flags & _SUBWIN) ? TRUE : FALSE); +} + +bool is_syncok(const WINDOW *win) +{ + PDC_LOG(("is_syncok() - called\n")); + + if (!win) + return FALSE; + + return win->_sync; +} + +void wcursyncup(WINDOW *win) +{ + WINDOW *tmp; + + PDC_LOG(("wcursyncup() - called\n")); + + for (tmp = win; tmp && tmp->_parent; tmp = tmp->_parent) + wmove(tmp->_parent, tmp->_pary + tmp->_cury, tmp->_parx + tmp->_curx); +} + +void wsyncdown(WINDOW *win) +{ + WINDOW *tmp; + + PDC_LOG(("wsyncdown() - called\n")); + + for (tmp = win; tmp; tmp = tmp->_parent) + { + if (is_wintouched(tmp)) + { + touchwin(win); + break; + } + } +} diff --git a/vendor/pdcurses/sdl1/Makefile b/vendor/pdcurses/sdl1/Makefile new file mode 100644 index 0000000..abbed51 --- /dev/null +++ b/vendor/pdcurses/sdl1/Makefile @@ -0,0 +1,105 @@ +# Makefile for PDCurses for SDL + +O = o + +ifndef PDCURSES_SRCDIR + PDCURSES_SRCDIR = .. +endif + +include $(PDCURSES_SRCDIR)/common/libobjs.mif + +osdir = $(PDCURSES_SRCDIR)/sdl1 + +PDCURSES_SDL_H = $(osdir)/pdcsdl.h + +SFLAGS = $(shell sdl-config --cflags) +SLIBS = $(shell sdl-config --libs) + +ifeq ($(DEBUG),Y) + CFLAGS = -g -Wall -DPDCDEBUG -fPIC +else + CFLAGS = -O2 -Wall -fPIC +endif + +ifeq ($(WIDE),Y) + CFLAGS += -DPDC_WIDE + SLIBS += -lSDL_ttf +endif + +ifeq ($(UTF8),Y) + CFLAGS += -DPDC_FORCE_UTF8 +endif + +BUILD = $(CC) $(CFLAGS) -I$(PDCURSES_SRCDIR) + +LINK = $(CC) +LDFLAGS = $(LIBCURSES) $(SLIBS) +RANLIB = ranlib +LIBCURSES = pdcurses.a + +DEMOS += sdltest + +.PHONY: all libs clean demos + +all: libs + +libs: $(LIBCURSES) + +clean: + -rm -rf *.o trace $(LIBCURSES) $(DEMOS) + +demos: $(DEMOS) +ifneq ($(DEBUG),Y) + strip $(DEMOS) +endif + +$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) + ar rv $@ $? + -$(RANLIB) $@ + +$(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) +$(PDCOBJS) : $(PDCURSES_SDL_H) +$(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) +tui.o tuidemo.o : $(PDCURSES_CURSES_H) +panel.o ptest: $(PANEL_HEADER) + +$(LIBOBJS) : %.o: $(srcdir)/%.c + $(BUILD) -c $< + +$(PDCOBJS) : %.o: $(osdir)/%.c + $(BUILD) $(SFLAGS) -c $< + +firework: $(demodir)/firework.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +ozdemo: $(demodir)/ozdemo.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +ptest: $(demodir)/ptest.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +rain: $(demodir)/rain.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +testcurs: $(demodir)/testcurs.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +tuidemo: tuidemo.o tui.o + $(LINK) tui.o tuidemo.o -o $@ $(LDFLAGS) + +worm: $(demodir)/worm.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +xmas: $(demodir)/xmas.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +sdltest: $(osdir)/sdltest.c + $(BUILD) $(DEMOFLAGS) $(SFLAGS) -o $@ $< $(LDFLAGS) + +tui.o: $(demodir)/tui.c $(demodir)/tui.h + $(BUILD) -c $(DEMOFLAGS) $(demodir)/tui.c + +tuidemo.o: $(demodir)/tuidemo.c + $(BUILD) -c $(DEMOFLAGS) $(demodir)/tuidemo.c + +include $(demodir)/nctests.mif diff --git a/vendor/pdcurses/sdl1/README.md b/vendor/pdcurses/sdl1/README.md new file mode 100644 index 0000000..a9dcc54 --- /dev/null +++ b/vendor/pdcurses/sdl1/README.md @@ -0,0 +1,179 @@ +PDCurses for SDL 1.x +==================== + +This is a port of PDCurses for version 1.x of SDL. + + +Building +-------- + +- On *nix (including Linux), run "make" in the sdl1 directory. There is + no configure script (yet?) for this port. This assumes a working + sdl-config, and GNU make. It builds the library pdcurses.a (dynamic + lib not implemented). + +- The makefile accepts the optional parameter "DEBUG=Y", and recognizes + the optional PDCURSES_SRCDIR environment variable, as with the console + ports. "WIDE=Y" builds a version that not only uses 16-bit Unicode + characters, but depends on the SDL_ttf library, instead of using + simple bitmap fonts. "UTF8=Y" makes PDCurses ignore the system locale, + and treat all narrow-character strings as UTF-8; this option has no + effect unless WIDE=Y is also set. Add the target "demos" to build the + sample programs. + + +Usage +----- + +There are no special requirements to use PDCurses for SDL -- all +PDCurses-compatible code should work fine. Nothing extra is needed +beyond the base SDL library. However, there are some optional special +features, described here. + +The SDL ports operate in one of two ways, depending on whether or not +they were built with WIDE=Y: + + +### 8-bit mode + +The font is a simple BMP, 32 characters wide by 8 characters tall, +preferably with a palette. (BMPs without palettes still work, but in +that case, no attributes will be available, nor will the cursor work.) +The first entry in the palette (usually black) is treated as the +background color; the last entry (usually white) is treated as the +foreground. These are changed or made transparent as appropriate; any +other colors in the palette are passed through unchanged. So -- although +a one-bit depth is sufficient for a normal font -- you could redraw some +characters as multi-colored tiles. + +The font must be monospaced. The size of each character is derived by +dividing the width of the BMP by 32 and the height by 8. There is no +constraint on the dimensions. + +As provided in the default font and expected by acs_map[], the font is +in Code Page 437 form. But you can of course use any layout if you're +not relying on correct values for the ACS_* macros. + +The font can be set via the environment variable PDC_FONT. If it's not +set, PDCurses looks for a file named "pdcfont.bmp" in the current +directory at the time of initscr(). If neither is found, it uses the +built-in default font encoded in font437.h. + + +### 16-bit mode + +Instead of a BMP, PDC_FONT points to a TrueType font. Only true +monospaced fonts work well. The font can be set at compile time via +PDC_FONT_PATH, and/or at runtime via pdc_ttffont. The environment +variable PDC_FONT_SIZE is also available to control the font size (also +as a compile-time define, and at runtime as pdc_font_size.) The +character mapping for chtypes is 16-bit Unicode (the Basic Multilingual +Plane). + +The default font is: /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf + + +Backgrounds +----------- + +PDCurses for SDL supports an optional background image BMP. This is used +whenever start_color() has not been called (see the ptest demo for an +example), or when use_default_colors() has been called after +start_color(), and the background color of a pair has been set to -1 +(see ozdemo, worm, and rain for examples). The usage parallels that of +ncurses in an appropriate terminal (e.g., Gnome Terminal). The image is +tiled to cover the PDCurses window, and can be any size or depth. + +As with the font, you can point to a location for the background via the +environment variable PDC_BACKGROUND; "pdcback.bmp" is the fallback. +(There is no default background.) + + +Icons +----- + +The icon (used with SDL_WM_SetIcon() -- not used for the executable +file) can be set via the environment variable PDC_ICON, and falls back +to "pdcicon.bmp", and then to the built-in icon from iconbmp.h. The +built-in icon is the PDCurses logo, as seen in ../common/icon32.xpm. + +If pdc_screen is preinitialized (see below), PDCurses does not attempt +to set the icon. + + +Screen size +----------- + +The default screen size is 80x25 characters (whatever size they may be), +but you can override this via the environment variables PDC_COLS and/or +PDC_LINES. If pdc_screen is preinitialized (see below), these are +ignored. + + +Integration with SDL +-------------------- + +If you want to go further, you can mix PDCurses and SDL functions. (Of +course this is extremely non-portable!) To aid you, there are several +external variables and functions specific to the SDL ports; you could +include pdcsdl.h, or just add the declarations you need in your code: + + PDCEX SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back; + PDCEX int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset; + + PDCEX void PDC_update_rects(void); + PDCEX void PDC_retile(void); + +pdc_screen is the main surface, created by SDL_SetVideoMode(), unless +it's preset before initscr(). (See sdltest.c for examples.) You can +perform normal SDL operations on this surface, but PDCurses won't +respect them when it updates. (For that, see PDC_retile().) As an +alternative, you can preinitialize this surface before calling +initscr(). In that case, you can use pdc_sheight, pdc_swidth, +pdc_yoffset and/or pdc_xoffset (q.v.) to confine PDCurses to only a +specific area of the surface, reserving the rest for other SDL +operations. If you preinitialize pdc_screen, you'll have to close it +yourself; PDCurses will ignore resize events, and won't try to set the +icon. Also note that if you preinitialize pdc_screen, it need not be the +display surface. + +pdc_font (in 8-bit mode), pdc_icon, and pdc_back are the SDL_surfaces +for the font, icon, and background, respectively. You can set any or all +of them before initscr(), and thus override any of the other ways to set +them. But note that pdc_icon will be ignored if pdc_screen is preset. + +pdc_sheight and pdc_swidth are the dimensions of the area of pdc_screen +to be used by PDCurses. You can preset them before initscr(); if either +is not set, it defaults to the full screen size minus the x or y offset, +as appropriate. + +pdc_xoffset and pdc_yoffset are the x and y offset for the area of +pdc_screen to be used by PDCurses. See the sdltest demo for an example. + +PDC_retile() makes a copy of pdc_screen, then tiles it with the +background image, if any. The resulting surface is used as the +background for transparent character cells. PDC_retile() is called from +initscr() and resize_term(). However, you can also use it at other +times, to take advantage of the way it copies pdc_screen: Draw some SDL +stuff; call PDC_retile(); do some curses stuff -- it will use whatever +was on pdc_screen as the background. Then you can erase the curses +screen, do some more SDL stuff, and call PDC_retile() again to make a +new background. (If you don't erase the curses screen, it will be +incorporated into the background when you call PDC_retile().) But this +only works if no background image is set. + + +Interaction with stdio +---------------------- + +As with X11, it's a bad idea to mix curses and stdio calls. (In fact, +that's true for PDCurses on any platform; but especially these two, +which don't run under terminals.) Depending on how SDL is built, stdout +and stderr may be redirected to files. + + +Acknowledgements +---------------- + +Original SDL port was provided by William McBrine +TTF support based on contributions by Laura Michaels diff --git a/vendor/pdcurses/sdl1/pdcclip.c b/vendor/pdcurses/sdl1/pdcclip.c new file mode 100644 index 0000000..87e0ce7 --- /dev/null +++ b/vendor/pdcurses/sdl1/pdcclip.c @@ -0,0 +1,132 @@ +/* PDCurses */ + +#include "pdcsdl.h" + +#include +#include + +/*man-start************************************************************** + +clipboard +--------- + +### Synopsis + + int PDC_getclipboard(char **contents, long *length); + int PDC_setclipboard(const char *contents, long length); + int PDC_freeclipboard(char *contents); + int PDC_clearclipboard(void); + +### Description + + PDC_getclipboard() gets the textual contents of the system's + clipboard. This function returns the contents of the clipboard in the + contents argument. It is the responsibility of the caller to free the + memory returned, via PDC_freeclipboard(). The length of the clipboard + contents is returned in the length argument. + + PDC_setclipboard copies the supplied text into the system's + clipboard, emptying the clipboard prior to the copy. + + PDC_clearclipboard() clears the internal clipboard. + +### Return Values + + PDC_CLIP_SUCCESS the call was successful + PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for + the clipboard contents + PDC_CLIP_EMPTY the clipboard contains no text + PDC_CLIP_ACCESS_ERROR no clipboard support + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + PDC_getclipboard | - | - | - + PDC_setclipboard | - | - | - + PDC_freeclipboard | - | - | - + PDC_clearclipboard | - | - | - + +**man-end****************************************************************/ + +/* global clipboard contents, should be NULL if none set */ + +static char *pdc_SDL_clipboard = NULL; + +int PDC_getclipboard(char **contents, long *length) +{ + int len; + + PDC_LOG(("PDC_getclipboard() - called\n")); + + if (!pdc_SDL_clipboard) + return PDC_CLIP_EMPTY; + + len = strlen(pdc_SDL_clipboard); + if ((*contents = malloc(len + 1)) == NULL) + return PDC_CLIP_MEMORY_ERROR; + + strcpy(*contents, pdc_SDL_clipboard); + *length = len; + + return PDC_CLIP_SUCCESS; +} + +int PDC_setclipboard(const char *contents, long length) +{ + PDC_LOG(("PDC_setclipboard() - called\n")); + + if (pdc_SDL_clipboard) + { + free(pdc_SDL_clipboard); + pdc_SDL_clipboard = NULL; + } + + if (contents) + { + if ((pdc_SDL_clipboard = malloc(length + 1)) == NULL) + return PDC_CLIP_MEMORY_ERROR; + + strcpy(pdc_SDL_clipboard, contents); + } + + return PDC_CLIP_SUCCESS; +} + +int PDC_freeclipboard(char *contents) +{ + PDC_LOG(("PDC_freeclipboard() - called\n")); + + /* should we also free empty the system clipboard? probably not */ + + if (contents) + { + /* NOTE: We free the memory, but we can not set caller's pointer + to NULL, so if caller calls again then will try to access + free'd memory. We 1st overwrite memory with a string so if + caller tries to use free memory they won't get what they + expect & hopefully notice. */ + + /* memset(contents, 0xFD, strlen(contents)); */ + + if (strlen(contents) >= strlen("PDCURSES")) + strcpy(contents, "PDCURSES"); + + free(contents); + } + + return PDC_CLIP_SUCCESS; +} + +int PDC_clearclipboard(void) +{ + PDC_LOG(("PDC_clearclipboard() - called\n")); + + if (pdc_SDL_clipboard) + { + free(pdc_SDL_clipboard); + pdc_SDL_clipboard = NULL; + } + + return PDC_CLIP_SUCCESS; +} diff --git a/vendor/pdcurses/sdl1/pdcdisp.c b/vendor/pdcurses/sdl1/pdcdisp.c new file mode 100644 index 0000000..e25a6a6 --- /dev/null +++ b/vendor/pdcurses/sdl1/pdcdisp.c @@ -0,0 +1,529 @@ +/* PDCurses */ + +#include "pdcsdl.h" + +#include +#include + +#ifdef PDC_WIDE +# include "../common/acsgr.h" +#else +# include "../common/acs437.h" +#endif + +#define MAXRECT 200 /* maximum number of rects to queue up before + an update is forced; the number was chosen + arbitrarily */ + +static SDL_Rect uprect[MAXRECT]; /* table of rects to update */ +static chtype oldch = (chtype)(-1); /* current attribute */ +static int rectcount = 0; /* index into uprect */ +static short foregr = -2, backgr = -2; /* current foreground, background */ +static bool blinked_off = FALSE; + +/* do the real updates on a delay */ + +void PDC_update_rects(void) +{ + if (rectcount) + { + /* if the maximum number of rects has been reached, we're + probably better off doing a full screen update */ + + if (rectcount == MAXRECT) + SDL_Flip(pdc_screen); + else + SDL_UpdateRects(pdc_screen, rectcount, uprect); + + rectcount = 0; + } +} + +/* set the font colors to match the chtype's attribute */ + +static void _set_attr(chtype ch) +{ + attr_t sysattrs = SP->termattrs; + +#ifdef PDC_WIDE + TTF_SetFontStyle(pdc_ttffont, + ( ((ch & A_BOLD) && (sysattrs & A_BOLD)) ? + TTF_STYLE_BOLD : 0) | + ( ((ch & A_ITALIC) && (sysattrs & A_ITALIC)) ? + TTF_STYLE_ITALIC : 0) ); +#endif + + ch &= (A_COLOR|A_BOLD|A_BLINK|A_REVERSE); + + if (oldch != ch) + { + short newfg, newbg; + + if (SP->mono) + return; + + pair_content(PAIR_NUMBER(ch), &newfg, &newbg); + + if ((ch & A_BOLD) && !(sysattrs & A_BOLD)) + newfg |= 8; + if ((ch & A_BLINK) && !(sysattrs & A_BLINK)) + newbg |= 8; + + if (ch & A_REVERSE) + { + short tmp = newfg; + newfg = newbg; + newbg = tmp; + } + + if (newfg != foregr) + { +#ifndef PDC_WIDE + SDL_SetPalette(pdc_font, SDL_LOGPAL, + pdc_color + newfg, pdc_flastc, 1); +#endif + foregr = newfg; + } + + if (newbg != backgr) + { +#ifndef PDC_WIDE + if (newbg == -1) + SDL_SetColorKey(pdc_font, SDL_SRCCOLORKEY, 0); + else + { + if (backgr == -1) + SDL_SetColorKey(pdc_font, 0, 0); + + SDL_SetPalette(pdc_font, SDL_LOGPAL, + pdc_color + newbg, 0, 1); + } +#endif + backgr = newbg; + } + + oldch = ch; + } +} + +#ifdef PDC_WIDE + +/* Draw some of the ACS_* "graphics" */ + +bool _grprint(chtype ch, SDL_Rect dest) +{ + Uint32 col = pdc_mapped[foregr]; + int hmid = (pdc_fheight - pdc_fthick) >> 1; + int wmid = (pdc_fwidth - pdc_fthick) >> 1; + + switch (ch) + { + case ACS_ULCORNER: + dest.h = pdc_fheight - hmid; + dest.y += hmid; + dest.w = pdc_fthick; + dest.x += wmid; + SDL_FillRect(pdc_screen, &dest, col); + dest.w = pdc_fwidth - wmid; + goto S1; + case ACS_LLCORNER: + dest.h = hmid; + dest.w = pdc_fthick; + dest.x += wmid; + SDL_FillRect(pdc_screen, &dest, col); + dest.w = pdc_fwidth - wmid; + dest.y += hmid; + goto S1; + case ACS_URCORNER: + dest.h = pdc_fheight - hmid; + dest.w = pdc_fthick; + dest.y += hmid; + dest.x += wmid; + SDL_FillRect(pdc_screen, &dest, col); + dest.w = wmid; + dest.x -= wmid; + goto S1; + case ACS_LRCORNER: + dest.h = hmid + pdc_fthick; + dest.w = pdc_fthick; + dest.x += wmid; + SDL_FillRect(pdc_screen, &dest, col); + dest.w = wmid; + dest.x -= wmid; + dest.y += hmid; + goto S1; + case ACS_LTEE: + dest.h = pdc_fthick; + dest.w = pdc_fwidth - wmid; + dest.x += wmid; + dest.y += hmid; + SDL_FillRect(pdc_screen, &dest, col); + dest.w = pdc_fthick; + dest.x -= wmid; + goto VLINE; + case ACS_RTEE: + dest.w = wmid; + case ACS_PLUS: + dest.h = pdc_fthick; + dest.y += hmid; + SDL_FillRect(pdc_screen, &dest, col); + VLINE: + dest.h = pdc_fheight; + dest.y -= hmid; + case ACS_VLINE: + dest.w = pdc_fthick; + dest.x += wmid; + goto DRAW; + case ACS_TTEE: + dest.h = pdc_fheight - hmid; + dest.w = pdc_fthick; + dest.x += wmid; + dest.y += hmid; + SDL_FillRect(pdc_screen, &dest, col); + dest.w = pdc_fwidth; + dest.x -= wmid; + goto S1; + case ACS_BTEE: + dest.h = hmid; + dest.w = pdc_fthick; + dest.x += wmid; + SDL_FillRect(pdc_screen, &dest, col); + dest.w = pdc_fwidth; + dest.x -= wmid; + case ACS_HLINE: + dest.y += hmid; + goto S1; + case ACS_S3: + dest.y += hmid >> 1; + goto S1; + case ACS_S7: + dest.y += hmid + (hmid >> 1); + goto S1; + case ACS_S9: + dest.y += pdc_fheight - pdc_fthick; + case ACS_S1: + S1: + dest.h = pdc_fthick; + case ACS_BLOCK: + DRAW: + SDL_FillRect(pdc_screen, &dest, col); + return TRUE; + default: ; + } + + return FALSE; /* didn't draw it -- fall back to acs_map */ +} + +#endif + +/* draw a cursor at (y, x) */ + +void PDC_gotoyx(int row, int col) +{ + SDL_Rect src, dest; + chtype ch; + int oldrow, oldcol; +#ifdef PDC_WIDE + Uint16 chstr[2] = {0, 0}; +#endif + + PDC_LOG(("PDC_gotoyx() - called: row %d col %d from row %d col %d\n", + row, col, SP->cursrow, SP->curscol)); + + oldrow = SP->cursrow; + oldcol = SP->curscol; + + /* clear the old cursor */ + + PDC_transform_line(oldrow, oldcol, 1, curscr->_y[oldrow] + oldcol); + + if (!SP->visibility) + return; + + /* draw a new cursor by overprinting the existing character in + reverse, either the full cell (when visibility == 2) or the + lowest quarter of it (when visibility == 1) */ + + ch = curscr->_y[row][col] ^ A_REVERSE; + + _set_attr(ch); + + src.h = (SP->visibility == 1) ? pdc_fheight >> 2 : pdc_fheight; + src.w = pdc_fwidth; + + dest.y = (row + 1) * pdc_fheight - src.h + pdc_yoffset; + dest.x = col * pdc_fwidth + pdc_xoffset; + dest.h = src.h; + dest.w = src.w; + +#ifdef PDC_WIDE + SDL_FillRect(pdc_screen, &dest, pdc_mapped[backgr]); + + if (!(SP->visibility == 2 && (ch & A_ALTCHARSET && !(ch & 0xff80)) && + _grprint(ch & (0x7f | A_ALTCHARSET), dest))) + { + if (ch & A_ALTCHARSET && !(ch & 0xff80)) + ch = acs_map[ch & 0x7f]; + + chstr[0] = ch & A_CHARTEXT; + + pdc_font = TTF_RenderUNICODE_Blended(pdc_ttffont, chstr, + pdc_color[foregr]); + if (pdc_font) + { + int center = pdc_fwidth > pdc_font->w ? + (pdc_fwidth - pdc_font->w) >> 1 : 0; + src.x = 0; + src.y = pdc_fheight - src.h; + dest.x += center; + SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest); + dest.x -= center; + SDL_FreeSurface(pdc_font); + pdc_font = NULL; + } + } +#else + if (ch & A_ALTCHARSET && !(ch & 0xff80)) + ch = acs_map[ch & 0x7f]; + + src.x = (ch & 0xff) % 32 * pdc_fwidth; + src.y = (ch & 0xff) / 32 * pdc_fheight + (pdc_fheight - src.h); + + SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest); +#endif + + if (oldrow != row || oldcol != col) + { + if (rectcount == MAXRECT) + PDC_update_rects(); + + uprect[rectcount++] = dest; + } +} + +void _new_packet(attr_t attr, int lineno, int x, int len, const chtype *srcp) +{ + SDL_Rect src, dest, lastrect; + int j; +#ifdef PDC_WIDE + Uint16 chstr[2] = {0, 0}; +#endif + attr_t sysattrs = SP->termattrs; + short hcol = SP->line_color; + bool blink = blinked_off && (attr & A_BLINK) && (sysattrs & A_BLINK); + + if (rectcount == MAXRECT) + PDC_update_rects(); + +#ifdef PDC_WIDE + src.x = 0; + src.y = 0; +#endif + src.h = pdc_fheight; + src.w = pdc_fwidth; + + dest.y = pdc_fheight * lineno + pdc_yoffset; + dest.x = pdc_fwidth * x + pdc_xoffset; + dest.h = pdc_fheight; + dest.w = pdc_fwidth * len; + + /* if the previous rect was just above this one, with the same width + and horizontal position, then merge the new one with it instead + of adding a new entry */ + + if (rectcount) + lastrect = uprect[rectcount - 1]; + + if (rectcount && lastrect.x == dest.x && lastrect.w == dest.w) + { + if (lastrect.y + lastrect.h == dest.y) + uprect[rectcount - 1].h = lastrect.h + pdc_fheight; + else + if (lastrect.y != dest.y) + uprect[rectcount++] = dest; + } + else + uprect[rectcount++] = dest; + + _set_attr(attr); + + if (backgr == -1) + SDL_LowerBlit(pdc_tileback, &dest, pdc_screen, &dest); +#ifdef PDC_WIDE + else + SDL_FillRect(pdc_screen, &dest, pdc_mapped[backgr]); +#endif + + if (hcol == -1) + hcol = foregr; + + for (j = 0; j < len; j++) + { + chtype ch = srcp[j]; + + if (blink) + ch = ' '; + + dest.w = pdc_fwidth; + + if (ch & A_ALTCHARSET && !(ch & 0xff80)) + { +#ifdef PDC_WIDE + if (_grprint(ch & (0x7f | A_ALTCHARSET), dest)) + { + dest.x += pdc_fwidth; + continue; + } +#endif + ch = acs_map[ch & 0x7f]; + } + +#ifdef PDC_WIDE + ch &= A_CHARTEXT; + + if (ch != ' ') + { + if (chstr[0] != ch) + { + chstr[0] = ch; + + if (pdc_font) + SDL_FreeSurface(pdc_font); + + pdc_font = TTF_RenderUNICODE_Blended(pdc_ttffont, chstr, + pdc_color[foregr]); + } + + if (pdc_font) + { + int center = pdc_fwidth > pdc_font->w ? + (pdc_fwidth - pdc_font->w) >> 1 : 0; + dest.x += center; + SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest); + dest.x -= center; + } + } +#else + src.x = (ch & 0xff) % 32 * pdc_fwidth; + src.y = (ch & 0xff) / 32 * pdc_fheight; + + SDL_LowerBlit(pdc_font, &src, pdc_screen, &dest); +#endif + + if (!blink && (attr & (A_LEFT | A_RIGHT))) + { + dest.w = pdc_fthick; + + if (attr & A_LEFT) + SDL_FillRect(pdc_screen, &dest, pdc_mapped[hcol]); + + if (attr & A_RIGHT) + { + dest.x += pdc_fwidth - pdc_fthick; + SDL_FillRect(pdc_screen, &dest, pdc_mapped[hcol]); + dest.x -= pdc_fwidth - pdc_fthick; + } + } + + dest.x += pdc_fwidth; + } + +#ifdef PDC_WIDE + if (pdc_font) + { + SDL_FreeSurface(pdc_font); + pdc_font = NULL; + } +#endif + + if (!blink && (attr & A_UNDERLINE)) + { + dest.y += pdc_fheight - pdc_fthick; + dest.x = pdc_fwidth * x + pdc_xoffset; + dest.h = pdc_fthick; + dest.w = pdc_fwidth * len; + + SDL_FillRect(pdc_screen, &dest, pdc_mapped[hcol]); + } +} + +/* update the given physical line to look like the corresponding line in + curscr */ + +void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) +{ + attr_t old_attr, attr; + int i, j; + + PDC_LOG(("PDC_transform_line() - called: lineno=%d\n", lineno)); + + old_attr = *srcp & (A_ATTRIBUTES ^ A_ALTCHARSET); + + for (i = 1, j = 1; j < len; i++, j++) + { + attr = srcp[i] & (A_ATTRIBUTES ^ A_ALTCHARSET); + + if (attr != old_attr) + { + _new_packet(old_attr, lineno, x, i, srcp); + old_attr = attr; + srcp += i; + x += i; + i = 0; + } + } + + _new_packet(old_attr, lineno, x, i, srcp); +} + +static Uint32 _blink_timer(Uint32 interval, void *param) +{ + SDL_Event event; + + event.type = SDL_USEREVENT; + SDL_PushEvent(&event); + return(interval); +} + +void PDC_blink_text(void) +{ + static SDL_TimerID blinker_id = 0; + int i, j, k; + + oldch = (chtype)(-1); + + if (!(SP->termattrs & A_BLINK)) + { + SDL_RemoveTimer(blinker_id); + blinker_id = 0; + } + else if (!blinker_id) + { + blinker_id = SDL_AddTimer(500, _blink_timer, NULL); + blinked_off = TRUE; + } + + blinked_off = !blinked_off; + + for (i = 0; i < SP->lines; i++) + { + const chtype *srcp = curscr->_y[i]; + + for (j = 0; j < SP->cols; j++) + if (srcp[j] & A_BLINK) + { + k = j; + while (k < SP->cols && (srcp[k] & A_BLINK)) + k++; + PDC_transform_line(i, j, k - j, srcp + j); + j = k; + } + } + + oldch = (chtype)(-1); +} + +void PDC_doupdate(void) +{ + PDC_napms(1); +} diff --git a/vendor/pdcurses/sdl1/pdcgetsc.c b/vendor/pdcurses/sdl1/pdcgetsc.c new file mode 100644 index 0000000..3dd2e18 --- /dev/null +++ b/vendor/pdcurses/sdl1/pdcgetsc.c @@ -0,0 +1,30 @@ +/* PDCurses */ + +#include "pdcsdl.h" + +/* get the cursor size/shape */ + +int PDC_get_cursor_mode(void) +{ + PDC_LOG(("PDC_get_cursor_mode() - called\n")); + + return 0; +} + +/* return number of screen rows */ + +int PDC_get_rows(void) +{ + PDC_LOG(("PDC_get_rows() - called\n")); + + return pdc_sheight / pdc_fheight; +} + +/* return width of screen/viewport */ + +int PDC_get_columns(void) +{ + PDC_LOG(("PDC_get_columns() - called\n")); + + return pdc_swidth / pdc_fwidth; +} diff --git a/vendor/pdcurses/sdl1/pdckbd.c b/vendor/pdcurses/sdl1/pdckbd.c new file mode 100644 index 0000000..d1f9299 --- /dev/null +++ b/vendor/pdcurses/sdl1/pdckbd.c @@ -0,0 +1,373 @@ +/* PDCurses */ + +#include "pdcsdl.h" + +#include + +static SDL_Event event; +static SDLKey oldkey; +static MOUSE_STATUS old_mouse_status; + +static struct +{ + SDLKey keycode; + bool numkeypad; + unsigned short normal; + unsigned short shifted; + unsigned short control; + unsigned short alt; +} key_table[] = +{ +/* keycode keypad normal shifted control alt*/ + {SDLK_LEFT, FALSE, KEY_LEFT, KEY_SLEFT, CTL_LEFT, ALT_LEFT}, + {SDLK_RIGHT, FALSE, KEY_RIGHT, KEY_SRIGHT, CTL_RIGHT, ALT_RIGHT}, + {SDLK_UP, FALSE, KEY_UP, KEY_SUP, CTL_UP, ALT_UP}, + {SDLK_DOWN, FALSE, KEY_DOWN, KEY_SDOWN, CTL_DOWN, ALT_DOWN}, + {SDLK_HOME, FALSE, KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME}, + {SDLK_END, FALSE, KEY_END, KEY_SEND, CTL_END, ALT_END}, + {SDLK_PAGEUP, FALSE, KEY_PPAGE, KEY_SPREVIOUS,CTL_PGUP, ALT_PGUP}, + {SDLK_PAGEDOWN,FALSE, KEY_NPAGE, KEY_SNEXT, CTL_PGDN, ALT_PGDN}, + {SDLK_INSERT, FALSE, KEY_IC, KEY_SIC, CTL_INS, ALT_INS}, + {SDLK_DELETE, FALSE, KEY_DC, KEY_SDC, CTL_DEL, ALT_DEL}, + {SDLK_F1, FALSE, KEY_F(1), KEY_F(13), KEY_F(25), KEY_F(37)}, + {SDLK_F2, FALSE, KEY_F(2), KEY_F(14), KEY_F(26), KEY_F(38)}, + {SDLK_F3, FALSE, KEY_F(3), KEY_F(15), KEY_F(27), KEY_F(39)}, + {SDLK_F4, FALSE, KEY_F(4), KEY_F(16), KEY_F(28), KEY_F(40)}, + {SDLK_F5, FALSE, KEY_F(5), KEY_F(17), KEY_F(29), KEY_F(41)}, + {SDLK_F6, FALSE, KEY_F(6), KEY_F(18), KEY_F(30), KEY_F(42)}, + {SDLK_F7, FALSE, KEY_F(7), KEY_F(19), KEY_F(31), KEY_F(43)}, + {SDLK_F8, FALSE, KEY_F(8), KEY_F(20), KEY_F(32), KEY_F(44)}, + {SDLK_F9, FALSE, KEY_F(9), KEY_F(21), KEY_F(33), KEY_F(45)}, + {SDLK_F10, FALSE, KEY_F(10), KEY_F(22), KEY_F(34), KEY_F(46)}, + {SDLK_F11, FALSE, KEY_F(11), KEY_F(23), KEY_F(35), KEY_F(47)}, + {SDLK_F12, FALSE, KEY_F(12), KEY_F(24), KEY_F(36), KEY_F(48)}, + {SDLK_F13, FALSE, KEY_F(13), KEY_F(25), KEY_F(37), KEY_F(49)}, + {SDLK_F14, FALSE, KEY_F(14), KEY_F(26), KEY_F(38), KEY_F(50)}, + {SDLK_F15, FALSE, KEY_F(15), KEY_F(27), KEY_F(39), KEY_F(51)}, + {SDLK_BACKSPACE,FALSE, 0x08, 0x08, CTL_BKSP, ALT_BKSP}, + {SDLK_TAB, FALSE, 0x09, KEY_BTAB, CTL_TAB, ALT_TAB}, + {SDLK_PRINT, FALSE, KEY_PRINT, KEY_SPRINT, KEY_PRINT, KEY_PRINT}, + {SDLK_PAUSE, FALSE, KEY_SUSPEND, KEY_SSUSPEND, KEY_SUSPEND, KEY_SUSPEND}, + {SDLK_CLEAR, FALSE, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR}, + {SDLK_BREAK, FALSE, KEY_BREAK, KEY_BREAK, KEY_BREAK, KEY_BREAK}, + {SDLK_HELP, FALSE, KEY_HELP, KEY_SHELP, KEY_LHELP, KEY_HELP}, + {SDLK_MENU, FALSE, KEY_OPTIONS, KEY_SOPTIONS, KEY_OPTIONS, KEY_OPTIONS}, + {SDLK_ESCAPE, FALSE, 0x1B, 0x1B, 0x1B, ALT_ESC}, + {SDLK_KP_ENTER,TRUE, PADENTER, PADENTER, CTL_PADENTER,ALT_PADENTER}, + {SDLK_KP_PLUS, TRUE, PADPLUS, '+', CTL_PADPLUS, ALT_PADPLUS}, + {SDLK_KP_MINUS,TRUE, PADMINUS, '-', CTL_PADMINUS,ALT_PADMINUS}, + {SDLK_KP_MULTIPLY,TRUE,PADSTAR, '*', CTL_PADSTAR, ALT_PADSTAR}, + {SDLK_KP_DIVIDE,TRUE, PADSLASH, '/', CTL_PADSLASH,ALT_PADSLASH}, + {SDLK_KP_PERIOD,TRUE, PADSTOP, '.', CTL_PADSTOP, ALT_PADSTOP}, + {SDLK_KP0, TRUE, PAD0, '0', CTL_PAD0, ALT_PAD0}, + {SDLK_KP1, TRUE, KEY_C1, '1', CTL_PAD1, ALT_PAD1}, + {SDLK_KP2, TRUE, KEY_C2, '2', CTL_PAD2, ALT_PAD2}, + {SDLK_KP3, TRUE, KEY_C3, '3', CTL_PAD3, ALT_PAD3}, + {SDLK_KP4, TRUE, KEY_B1, '4', CTL_PAD4, ALT_PAD4}, + {SDLK_KP5, TRUE, KEY_B2, '5', CTL_PAD5, ALT_PAD5}, + {SDLK_KP6, TRUE, KEY_B3, '6', CTL_PAD6, ALT_PAD6}, + {SDLK_KP7, TRUE, KEY_A1, '7', CTL_PAD7, ALT_PAD7}, + {SDLK_KP8, TRUE, KEY_A2, '8', CTL_PAD8, ALT_PAD8}, + {SDLK_KP9, TRUE, KEY_A3, '9', CTL_PAD9, ALT_PAD9}, + {0, 0, 0, 0, 0, 0} +}; + +void PDC_set_keyboard_binary(bool on) +{ + PDC_LOG(("PDC_set_keyboard_binary() - called\n")); +} + +/* check if a key or mouse event is waiting */ + +bool PDC_check_key(void) +{ + int haveevent = SDL_PollEvent(&event); + + return haveevent; +} + +static int _process_key_event(void) +{ + int i, key = 0; + + SP->key_modifiers = 0L; + SP->key_code = FALSE; + + if (event.type == SDL_KEYUP) + { + if (SP->return_key_modifiers && event.key.keysym.sym == oldkey) + { + SP->key_code = TRUE; + + switch (oldkey) + { + case SDLK_RSHIFT: + return KEY_SHIFT_R; + case SDLK_LSHIFT: + return KEY_SHIFT_L; + case SDLK_RCTRL: + return KEY_CONTROL_R; + case SDLK_LCTRL: + return KEY_CONTROL_L; + case SDLK_RALT: + return KEY_ALT_R; + case SDLK_LALT: + return KEY_ALT_L; + default: + break; + } + + SP->key_code = FALSE; + } + + return -1; + } + + oldkey = event.key.keysym.sym; + + if (event.key.keysym.mod & KMOD_NUM) + SP->key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; + + if (event.key.keysym.mod & KMOD_SHIFT) + SP->key_modifiers |= PDC_KEY_MODIFIER_SHIFT; + + if (event.key.keysym.mod & KMOD_CTRL) + SP->key_modifiers |= PDC_KEY_MODIFIER_CONTROL; + + if (event.key.keysym.mod & KMOD_ALT) + SP->key_modifiers |= PDC_KEY_MODIFIER_ALT; + + for (i = 0; key_table[i].keycode; i++) + { + if (key_table[i].keycode == event.key.keysym.sym) + { + if ((event.key.keysym.mod & KMOD_SHIFT) || + (key_table[i].numkeypad && (event.key.keysym.mod & KMOD_NUM))) + { + key = key_table[i].shifted; + } + else if (event.key.keysym.mod & KMOD_CTRL) + { + key = key_table[i].control; + } + else if (event.key.keysym.mod & KMOD_ALT) + { + key = key_table[i].alt; + } + + /* To get here, we ignore all other modifiers */ + + else + key = key_table[i].normal; + + SP->key_code = (key > 0x100); + break; + } + } + + if (!key) + { + key = event.key.keysym.unicode; + + if (key > 0x7f) + key = 0; + } + + /* Handle ALT letters and numbers */ + + if (event.key.keysym.mod & KMOD_ALT) + { + if (key >= 'A' && key <= 'Z') + { + key += ALT_A - 'A'; + SP->key_code = TRUE; + } + + if (key >= 'a' && key <= 'z') + { + key += ALT_A - 'a'; + SP->key_code = TRUE; + } + + if (key >= '0' && key <= '9') + { + key += ALT_0 - '0'; + SP->key_code = TRUE; + } + } + + return key ? key : -1; +} + +static int _process_mouse_event(void) +{ + SDLMod keymods; + short shift_flags = 0; + + memset(&SP->mouse_status, 0, sizeof(MOUSE_STATUS)); + + keymods = SDL_GetModState(); + + if (keymods & KMOD_SHIFT) + shift_flags |= BUTTON_SHIFT; + + if (keymods & KMOD_CTRL) + shift_flags |= BUTTON_CONTROL; + + if (keymods & KMOD_ALT) + shift_flags |= BUTTON_ALT; + + if (event.type == SDL_MOUSEMOTION) + { + int i; + + SP->mouse_status.x = (event.motion.x - pdc_xoffset) / pdc_fwidth; + SP->mouse_status.y = (event.motion.y - pdc_yoffset) / pdc_fheight; + + if (!event.motion.state || + (SP->mouse_status.x == old_mouse_status.x && + SP->mouse_status.y == old_mouse_status.y)) + return -1; + + SP->mouse_status.changes = PDC_MOUSE_MOVED; + + for (i = 0; i < 3; i++) + { + if (event.motion.state & SDL_BUTTON(i + 1)) + { + SP->mouse_status.button[i] = BUTTON_MOVED | shift_flags; + SP->mouse_status.changes |= (1 << i); + } + } + } + else + { + short action = (event.button.state == SDL_PRESSED) ? + BUTTON_PRESSED : BUTTON_RELEASED; + Uint8 btn = event.button.button; + + SP->mouse_status.x = (event.button.x - pdc_xoffset) / pdc_fwidth; + SP->mouse_status.y = (event.button.y - pdc_yoffset) / pdc_fheight; + + /* handle scroll wheel */ + + if ((btn >= 4 && btn <= 7) && action == BUTTON_RELEASED) + { + switch (btn) + { + case 4: + SP->mouse_status.changes = PDC_MOUSE_WHEEL_UP; + break; + case 5: + SP->mouse_status.changes = PDC_MOUSE_WHEEL_DOWN; + break; + case 6: + SP->mouse_status.changes = PDC_MOUSE_WHEEL_LEFT; + break; + case 7: + SP->mouse_status.changes = PDC_MOUSE_WHEEL_RIGHT; + } + + SP->key_code = TRUE; + return KEY_MOUSE; + } + + if (btn < 1 || btn > 3) + return -1; + + /* check for a click -- a press followed immediately by a release */ + + if (action == BUTTON_PRESSED && SP->mouse_wait) + { + SDL_Event rel; + + napms(SP->mouse_wait); + + if (SDL_PollEvent(&rel)) + { + if (rel.type == SDL_MOUSEBUTTONUP && rel.button.button == btn) + action = BUTTON_CLICKED; + else + SDL_PushEvent(&rel); + } + } + + btn--; + + SP->mouse_status.button[btn] = action | shift_flags; + SP->mouse_status.changes = (1 << btn); + } + + old_mouse_status = SP->mouse_status; + + SP->key_code = TRUE; + return KEY_MOUSE; +} + +/* return the next available key or mouse event */ + +int PDC_get_key(void) +{ + switch (event.type) + { + case SDL_QUIT: + exit(1); + case SDL_VIDEORESIZE: + if (pdc_own_screen && + (event.resize.h / pdc_fheight != LINES || + event.resize.w / pdc_fwidth != COLS)) + { + pdc_sheight = event.resize.h; + pdc_swidth = event.resize.w; + + if (!SP->resized) + { + SP->resized = TRUE; + SP->key_code = TRUE; + return KEY_RESIZE; + } + } + break; + case SDL_MOUSEMOTION: + SDL_ShowCursor(SDL_ENABLE); + case SDL_MOUSEBUTTONUP: + case SDL_MOUSEBUTTONDOWN: + oldkey = SDLK_SPACE; + return _process_mouse_event(); + case SDL_KEYUP: + case SDL_KEYDOWN: + PDC_mouse_set(); + return _process_key_event(); + case SDL_USEREVENT: + PDC_blink_text(); + } + + return -1; +} + +/* discard any pending keyboard or mouse input -- this is the core + routine for flushinp() */ + +void PDC_flushinp(void) +{ + PDC_LOG(("PDC_flushinp() - called\n")); + + while (PDC_check_key()); +} + +bool PDC_has_mouse(void) +{ + return TRUE; +} + +int PDC_mouse_set(void) +{ + SDL_ShowCursor(SP->_trap_mbe ? SDL_ENABLE : SDL_DISABLE); + + return OK; +} + +int PDC_modifiers_set(void) +{ + return OK; +} diff --git a/vendor/pdcurses/sdl1/pdcscrn.c b/vendor/pdcurses/sdl1/pdcscrn.c new file mode 100644 index 0000000..44a9163 --- /dev/null +++ b/vendor/pdcurses/sdl1/pdcscrn.c @@ -0,0 +1,368 @@ +/* PDCurses */ + +#include "pdcsdl.h" + +#include +#ifndef PDC_WIDE +#include "../common/font437.h" +#endif +#include "../common/iconbmp.h" + +#ifdef PDC_WIDE +# ifndef PDC_FONT_PATH +# if defined(__APPLE__) +# define PDC_FONT_PATH "/System/Library/Fonts/Menlo.ttc" +# else +# define PDC_FONT_PATH "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf" +# endif +# endif +TTF_Font *pdc_ttffont = NULL; +int pdc_font_size = 17; +#endif + +SDL_Surface *pdc_screen = NULL, *pdc_font = NULL, *pdc_icon = NULL, + *pdc_back = NULL, *pdc_tileback = NULL; +int pdc_sheight = 0, pdc_swidth = 0, pdc_yoffset = 0, pdc_xoffset = 0; + +SDL_Color pdc_color[PDC_MAXCOL]; +Uint32 pdc_mapped[PDC_MAXCOL]; +int pdc_fheight, pdc_fwidth, pdc_fthick, pdc_flastc; +bool pdc_own_screen; + +static int max_height, max_width; + +static void _clean(void) +{ +#ifdef PDC_WIDE + if (pdc_ttffont) + { + TTF_CloseFont(pdc_ttffont); + TTF_Quit(); + } +#endif + SDL_FreeSurface(pdc_tileback); + SDL_FreeSurface(pdc_back); + SDL_FreeSurface(pdc_icon); + SDL_FreeSurface(pdc_font); + + SDL_Quit(); +} + +void PDC_retile(void) +{ + if (pdc_tileback) + SDL_FreeSurface(pdc_tileback); + + pdc_tileback = SDL_DisplayFormat(pdc_screen); + if (pdc_tileback == NULL) + return; + + if (pdc_back) + { + SDL_Rect dest; + + dest.y = 0; + + while (dest.y < pdc_tileback->h) + { + dest.x = 0; + + while (dest.x < pdc_tileback->w) + { + SDL_BlitSurface(pdc_back, 0, pdc_tileback, &dest); + dest.x += pdc_back->w; + } + + dest.y += pdc_back->h; + } + + SDL_BlitSurface(pdc_tileback, 0, pdc_screen, 0); + } +} + +void PDC_scr_close(void) +{ + PDC_LOG(("PDC_scr_close() - called\n")); +} + +void PDC_scr_free(void) +{ +} + +static void _initialize_colors(void) +{ + int i, r, g, b; + + for (i = 0; i < 8; i++) + { + pdc_color[i].r = (i & COLOR_RED) ? 0xc0 : 0; + pdc_color[i].g = (i & COLOR_GREEN) ? 0xc0 : 0; + pdc_color[i].b = (i & COLOR_BLUE) ? 0xc0 : 0; + + pdc_color[i + 8].r = (i & COLOR_RED) ? 0xff : 0x40; + pdc_color[i + 8].g = (i & COLOR_GREEN) ? 0xff : 0x40; + pdc_color[i + 8].b = (i & COLOR_BLUE) ? 0xff : 0x40; + } + + /* 256-color xterm extended palette: 216 colors in a 6x6x6 color + cube, plus 24 shades of gray */ + + for (i = 16, r = 0; r < 6; r++) + for (g = 0; g < 6; g++) + for (b = 0; b < 6; b++, i++) + { + pdc_color[i].r = (r ? r * 40 + 55 : 0); + pdc_color[i].g = (g ? g * 40 + 55 : 0); + pdc_color[i].b = (b ? b * 40 + 55 : 0); + } + + for (i = 232; i < 256; i++) + pdc_color[i].r = pdc_color[i].g = pdc_color[i].b = (i - 232) * 10 + 8; + + for (i = 0; i < 256; i++) + pdc_mapped[i] = SDL_MapRGB(pdc_screen->format, pdc_color[i].r, + pdc_color[i].g, pdc_color[i].b); +} + +/* open the physical screen -- miscellaneous initialization */ + +int PDC_scr_open(void) +{ + PDC_LOG(("PDC_scr_open() - called\n")); + + pdc_own_screen = !pdc_screen; + + if (pdc_own_screen) + { + if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER) < 0) + { + fprintf(stderr, "Could not start SDL: %s\n", SDL_GetError()); + return ERR; + } + + atexit(_clean); + } + +#ifdef PDC_WIDE + if (!pdc_ttffont) + { + const char *ptsz, *fname; + + if (TTF_Init() == -1) + { + fprintf(stderr, "Could not start SDL_TTF: %s\n", SDL_GetError()); + return ERR; + } + + ptsz = getenv("PDC_FONT_SIZE"); + if (ptsz != NULL) + pdc_font_size = atoi(ptsz); + if (pdc_font_size <= 0) + pdc_font_size = 18; + + fname = getenv("PDC_FONT"); + pdc_ttffont = TTF_OpenFont(fname ? fname : PDC_FONT_PATH, + pdc_font_size); + } + + if (!pdc_ttffont) + { + fprintf(stderr, "Could not load font\n"); + return ERR; + } + + TTF_SetFontKerning(pdc_ttffont, 0); + TTF_SetFontHinting(pdc_ttffont, TTF_HINTING_MONO); + + SP->mono = FALSE; +#else + if (!pdc_font) + { + const char *fname = getenv("PDC_FONT"); + pdc_font = SDL_LoadBMP(fname ? fname : "pdcfont.bmp"); + } + + if (!pdc_font) + pdc_font = SDL_LoadBMP_RW(SDL_RWFromMem(font437, sizeof(font437)), 0); + + if (!pdc_font) + { + fprintf(stderr, "Could not load font\n"); + return ERR; + } + + SP->mono = !pdc_font->format->palette; +#endif + + if (!SP->mono && !pdc_back) + { + const char *bname = getenv("PDC_BACKGROUND"); + pdc_back = SDL_LoadBMP(bname ? bname : "pdcback.bmp"); + } + + if (!SP->mono && (pdc_back || !pdc_own_screen)) + { + SP->orig_attr = TRUE; + SP->orig_fore = COLOR_WHITE; + SP->orig_back = -1; + } + else + SP->orig_attr = FALSE; + +#ifdef PDC_WIDE + TTF_SizeText(pdc_ttffont, "W", &pdc_fwidth, &pdc_fheight); + pdc_fthick = pdc_font_size / 20 + 1; +#else + pdc_fheight = pdc_font->h / 8; + pdc_fwidth = pdc_font->w / 32; + pdc_fthick = 1; + + if (!SP->mono) + pdc_flastc = pdc_font->format->palette->ncolors - 1; +#endif + + if (pdc_own_screen && !pdc_icon) + { + const char *iname = getenv("PDC_ICON"); + pdc_icon = SDL_LoadBMP(iname ? iname : "pdcicon.bmp"); + + if (!pdc_icon) + pdc_icon = SDL_LoadBMP_RW(SDL_RWFromMem(iconbmp, + sizeof(iconbmp)), 0); + + if (pdc_icon) + SDL_WM_SetIcon(pdc_icon, NULL); + } + + if (pdc_own_screen) + { + const SDL_VideoInfo *info = SDL_GetVideoInfo(); + max_height = info->current_h; + max_width = info->current_w; + + const char *env = getenv("PDC_LINES"); + pdc_sheight = (env ? atoi(env) : 25) * pdc_fheight; + + env = getenv("PDC_COLS"); + pdc_swidth = (env ? atoi(env) : 80) * pdc_fwidth; + + pdc_screen = SDL_SetVideoMode(pdc_swidth, pdc_sheight, 0, + SDL_SWSURFACE|SDL_ANYFORMAT|SDL_RESIZABLE); + } + else + { + if (!pdc_sheight) + pdc_sheight = pdc_screen->h - pdc_yoffset; + + if (!pdc_swidth) + pdc_swidth = pdc_screen->w - pdc_xoffset; + } + + if (!pdc_screen) + { + fprintf(stderr, "Couldn't create a surface: %s\n", SDL_GetError()); + return ERR; + } + + if (SP->orig_attr) + PDC_retile(); + + _initialize_colors(); + + SDL_EnableUNICODE(1); + + PDC_mouse_set(); + + if (pdc_own_screen) + PDC_set_title("PDCurses"); + + SP->mouse_wait = PDC_CLICK_PERIOD; + SP->audible = FALSE; + + SP->termattrs = A_COLOR | A_UNDERLINE | A_LEFT | A_RIGHT | A_REVERSE; +#ifdef PDC_WIDE + SP->termattrs |= A_ITALIC; +#endif + + PDC_reset_prog_mode(); + + return OK; +} + +/* the core of resize_term() */ + +int PDC_resize_screen(int nlines, int ncols) +{ + if (!pdc_own_screen) + return ERR; + + if (nlines && ncols) + { + while (nlines * pdc_fheight > max_height) + nlines--; + pdc_sheight = nlines * pdc_fheight; + while (ncols * pdc_fwidth > max_width) + ncols--; + pdc_swidth = ncols * pdc_fwidth; + } + + SDL_FreeSurface(pdc_screen); + + pdc_screen = SDL_SetVideoMode(pdc_swidth, pdc_sheight, 0, + SDL_SWSURFACE|SDL_ANYFORMAT|SDL_RESIZABLE); + + if (pdc_tileback) + PDC_retile(); + + return OK; +} + +void PDC_reset_prog_mode(void) +{ + PDC_LOG(("PDC_reset_prog_mode() - called.\n")); + + PDC_flushinp(); + SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); +} + +void PDC_reset_shell_mode(void) +{ + PDC_LOG(("PDC_reset_shell_mode() - called.\n")); + + SDL_EnableKeyRepeat(0, 0); + PDC_flushinp(); +} + +void PDC_restore_screen_mode(int i) +{ +} + +void PDC_save_screen_mode(int i) +{ +} + +bool PDC_can_change_color(void) +{ + return TRUE; +} + +int PDC_color_content(short color, short *red, short *green, short *blue) +{ + *red = DIVROUND(pdc_color[color].r * 1000, 255); + *green = DIVROUND(pdc_color[color].g * 1000, 255); + *blue = DIVROUND(pdc_color[color].b * 1000, 255); + + return OK; +} + +int PDC_init_color(short color, short red, short green, short blue) +{ + pdc_color[color].r = DIVROUND(red * 255, 1000); + pdc_color[color].g = DIVROUND(green * 255, 1000); + pdc_color[color].b = DIVROUND(blue * 255, 1000); + + pdc_mapped[color] = SDL_MapRGB(pdc_screen->format, pdc_color[color].r, + pdc_color[color].g, pdc_color[color].b); + + return OK; +} diff --git a/vendor/pdcurses/sdl1/pdcsdl.h b/vendor/pdcurses/sdl1/pdcsdl.h new file mode 100644 index 0000000..e499efb --- /dev/null +++ b/vendor/pdcurses/sdl1/pdcsdl.h @@ -0,0 +1,34 @@ +/* PDCurses */ + +#include +#ifdef PDC_WIDE +#include +#endif + +#include + +#ifdef PDC_WIDE +PDCEX TTF_Font *pdc_ttffont; +PDCEX int pdc_font_size; +#endif +PDCEX SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back; +PDCEX int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset; + +extern SDL_Surface *pdc_tileback; /* used to regenerate the background + of "transparent" cells */ +extern SDL_Color pdc_color[PDC_MAXCOL]; /* colors for font palette */ +extern Uint32 pdc_mapped[PDC_MAXCOL]; /* colors for FillRect(), as + used in _highlight() */ +extern int pdc_fheight, pdc_fwidth; /* font height and width */ +extern int pdc_fthick; /* thickness for highlights and + rendered ACS glyphs */ +extern int pdc_flastc; /* font palette's last color + (treated as the foreground) */ +extern bool pdc_own_screen; /* if pdc_screen was not set + before initscr(), PDCurses is + responsible for (owns) it */ + +PDCEX void PDC_update_rects(void); +PDCEX void PDC_retile(void); + +extern void PDC_blink_text(void); diff --git a/vendor/pdcurses/sdl1/pdcsetsc.c b/vendor/pdcurses/sdl1/pdcsetsc.c new file mode 100644 index 0000000..52438f2 --- /dev/null +++ b/vendor/pdcurses/sdl1/pdcsetsc.c @@ -0,0 +1,108 @@ +/* PDCurses */ + +#include "pdcsdl.h" + +/*man-start************************************************************** + +pdcsetsc +-------- + +### Synopsis + + int PDC_set_blink(bool blinkon); + int PDC_set_bold(bool boldon); + void PDC_set_title(const char *title); + +### Description + + PDC_set_blink() toggles whether the A_BLINK attribute sets an actual + blink mode (TRUE), or sets the background color to high intensity + (FALSE). The default is platform-dependent (FALSE in most cases). It + returns OK if it could set the state to match the given parameter, + ERR otherwise. + + PDC_set_bold() toggles whether the A_BOLD attribute selects an actual + bold font (TRUE), or sets the foreground color to high intensity + (FALSE). It returns OK if it could set the state to match the given + parameter, ERR otherwise. + + PDC_set_title() sets the title of the window in which the curses + program is running. This function may not do anything on some + platforms. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + PDC_set_blink | - | - | - + PDC_set_bold | - | - | - + PDC_set_title | - | - | - + +**man-end****************************************************************/ + +int PDC_curs_set(int visibility) +{ + int ret_vis; + + PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); + + ret_vis = SP->visibility; + + SP->visibility = visibility; + + PDC_gotoyx(SP->cursrow, SP->curscol); + + return ret_vis; +} + +void PDC_set_title(const char *title) +{ + PDC_LOG(("PDC_set_title() - called:<%s>\n", title)); + + SDL_WM_SetCaption(title, title); +} + +int PDC_set_blink(bool blinkon) +{ + if (!SP) + return ERR; + + if (SP->color_started) + COLORS = PDC_MAXCOL; + + if (blinkon) + { + if (!(SP->termattrs & A_BLINK)) + { + SP->termattrs |= A_BLINK; + PDC_blink_text(); + } + } + else + { + if (SP->termattrs & A_BLINK) + { + SP->termattrs &= ~A_BLINK; + PDC_blink_text(); + } + } + + return OK; +} + +int PDC_set_bold(bool boldon) +{ + if (!SP) + return ERR; + +#ifdef PDC_WIDE + if (boldon) + SP->termattrs |= A_BOLD; + else + SP->termattrs &= ~A_BOLD; + + return OK; +#else + return boldon ? ERR : OK; +#endif +} diff --git a/vendor/pdcurses/sdl1/pdcutil.c b/vendor/pdcurses/sdl1/pdcutil.c new file mode 100644 index 0000000..87674d4 --- /dev/null +++ b/vendor/pdcurses/sdl1/pdcutil.c @@ -0,0 +1,28 @@ +/* PDCurses */ + +#include "pdcsdl.h" + +void PDC_beep(void) +{ + PDC_LOG(("PDC_beep() - called\n")); +} + +void PDC_napms(int ms) +{ + PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); + + PDC_update_rects(); + while (ms > 50) + { + SDL_PumpEvents(); + SDL_Delay(50); + ms -= 50; + } + SDL_PumpEvents(); + SDL_Delay(ms); +} + +const char *PDC_sysname(void) +{ + return "SDL"; +} diff --git a/vendor/pdcurses/sdl1/sdltest.c b/vendor/pdcurses/sdl1/sdltest.c new file mode 100644 index 0000000..ac8c9cb --- /dev/null +++ b/vendor/pdcurses/sdl1/sdltest.c @@ -0,0 +1,79 @@ +/* Here's a simple example of combining SDL and PDCurses functionality. + The top portion of the window is devoted to SDL, with a four-line + (assuming the default 8x16 font) stdscr at the bottom. +*/ + +#include +#include +#include +#include + +/* You could #include pdcsdl.h, or just add the relevant declarations + here: */ + +PDCEX SDL_Surface *pdc_screen; +PDCEX int pdc_yoffset; + +int main(int argc, char **argv) +{ + char inp[60]; + int i, j, seed; + + seed = time((time_t *)0); + srand(seed); + + /* Initialize SDL */ + + if (SDL_Init(SDL_INIT_VIDEO) < 0) + exit(1); + + atexit(SDL_Quit); + + pdc_screen = SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE|SDL_ANYFORMAT); + + /* Initialize PDCurses */ + + pdc_yoffset = 416; /* 480 - 4 * 16 */ + + initscr(); + start_color(); + scrollok(stdscr, TRUE); + + PDC_set_title("PDCurses for SDL"); + + /* Do some SDL stuff */ + + for (i = 640, j = 416; j; i -= 2, j -= 2) + { + SDL_Rect dest; + + dest.x = (640 - i) / 2; + dest.y = (416 - j) / 2; + dest.w = i; + dest.h = j; + + SDL_FillRect(pdc_screen, &dest, + SDL_MapRGB(pdc_screen->format, rand() % 256, + rand() % 256, rand() % 256)); + } + + SDL_UpdateRect(pdc_screen, 0, 0, 640, 416); + + /* Do some curses stuff */ + + init_pair(1, COLOR_WHITE + 8, COLOR_BLUE); + bkgd(COLOR_PAIR(1)); + + addstr("This is a demo of "); + attron(A_UNDERLINE); + addstr("PDCurses for SDL"); + attroff(A_UNDERLINE); + addstr(".\nYour comments here: "); + getnstr(inp, 59); + addstr("Press any key to exit."); + + getch(); + endwin(); + + return 0; +} diff --git a/vendor/pdcurses/sdl2/Makefile b/vendor/pdcurses/sdl2/Makefile new file mode 100644 index 0000000..1dc91b1 --- /dev/null +++ b/vendor/pdcurses/sdl2/Makefile @@ -0,0 +1,156 @@ +# Makefile for PDCurses for SDL2 + +O = o + +ifndef PDCURSES_SRCDIR + PDCURSES_SRCDIR = .. +endif + +osdir = $(PDCURSES_SRCDIR)/sdl2 +common = $(PDCURSES_SRCDIR)/common + +include $(common)/libobjs.mif + +ifeq ($(OS),Windows_NT) + E = .exe + CC = gcc + RM = cmd /c del + + include $(osdir)/versions.mif + + PLATFORM = $(shell $(CC) -dumpmachine) + + SFLAGS = -I$(SDLBASE)/$(PLATFORM)/include/SDL2 + SLIBS = -L$(SDLBASE)/$(PLATFORM)/lib -lSDL2main -lSDL2 + + TFLAGS = -I$(TTFBASE)/$(PLATFORM)/include/SDL2 + TLIBS =-L$(TTFBASE)/$(PLATFORM)/lib -lSDL2_ttf + + DEMOFLAGS = -mwindows +else + RM = rm -f + + SFLAGS = $(shell sdl2-config --cflags) + SLIBS = $(shell sdl2-config --libs) + + TLIBS = -lSDL2_ttf +endif + +PDCURSES_SDL_H = $(osdir)/pdcsdl.h + +ifeq ($(DEBUG),Y) + CFLAGS = -g -Wall -DPDCDEBUG -fPIC +else + CFLAGS += -O2 -Wall -fPIC +endif + +ifeq ($(WIDE),Y) + CFLAGS += -DPDC_WIDE + SFLAGS += $(TFLAGS) + SLIBS += $(TLIBS) +endif + +ifeq ($(UTF8),Y) + CFLAGS += -DPDC_FORCE_UTF8 +endif + +ifeq ($(DLL),Y) + ifeq ($(OS),Windows_NT) + CFLAGS += -DPDC_DLL_BUILD + LIBEXE = $(CC) + LIBFLAGS = -Wl,--out-implib,pdcurses.a -shared -o + LIBCURSES = pdcurses.dll + RESOURCE = pdcurses.o + LIBLIBS = $(SLIBS) + LDFLAGS = $(LIBCURSES) + else + ifeq ($(shell uname -s),Darwin) + DLL_SUFFIX = .dylib + else + DLL_SUFFIX = .so + endif + LIBEXE = $(CC) + LIBFLAGS = -shared -o + LIBCURSES = pdcurses$(DLL_SUFFIX) + LIBLIBS = $(SLIBS) + LDFLAGS = $(LIBCURSES) + endif +else + LIBEXE = $(AR) + LIBFLAGS = rcv + LIBCURSES = pdcurses.a + LDFLAGS = $(LIBCURSES) $(SLIBS) +endif + +BUILD = $(CC) $(CFLAGS) -I$(PDCURSES_SRCDIR) + +LINK = $(CC) + +DEMOS += sdltest$(E) + +.PHONY: all libs clean demos + +all: libs + +libs: $(LIBCURSES) + +clean: + -$(RM) *.o trace *.a *.dll *.so *.dylib $(DEMOS) + +demos: $(DEMOS) +ifneq ($(DEBUG),Y) + strip $(DEMOS) +endif + +$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(RESOURCE) + $(LIBEXE) $(LIBFLAGS) $@ $? $(LIBLIBS) + +pdcurses.o: $(common)/pdcurses.rc + windres -i $(common)/pdcurses.rc pdcurses.o + +$(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) +$(PDCOBJS) : $(PDCURSES_SDL_H) +$(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) +tui.o tuidemo.o : $(PDCURSES_CURSES_H) +panel.o ptest$(E): $(PANEL_HEADER) + +$(LIBOBJS) : %.o: $(srcdir)/%.c + $(BUILD) -c $< + +$(PDCOBJS) : %.o: $(osdir)/%.c + $(BUILD) $(SFLAGS) -c $< + +firework$(E): $(demodir)/firework.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +ozdemo$(E): $(demodir)/ozdemo.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +ptest$(E): $(demodir)/ptest.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +rain$(E): $(demodir)/rain.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +testcurs$(E): $(demodir)/testcurs.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +tuidemo$(E): tuidemo.o tui.o + $(LINK) tui.o tuidemo.o -o $@ $(LDFLAGS) + +worm$(E): $(demodir)/worm.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +xmas$(E): $(demodir)/xmas.c + $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) + +sdltest$(E): $(osdir)/sdltest.c + $(BUILD) $(SFLAGS) $(DEMOFLAGS) -o $@ $< $(LIBCURSES) $(SLIBS) + +tui.o: $(demodir)/tui.c $(demodir)/tui.h + $(BUILD) -c $(DEMOFLAGS) $(demodir)/tui.c + +tuidemo.o: $(demodir)/tuidemo.c + $(BUILD) -c $(DEMOFLAGS) $(demodir)/tuidemo.c + +include $(demodir)/nctests.mif diff --git a/vendor/pdcurses/sdl2/Makefile.vc b/vendor/pdcurses/sdl2/Makefile.vc new file mode 100644 index 0000000..3f451d7 --- /dev/null +++ b/vendor/pdcurses/sdl2/Makefile.vc @@ -0,0 +1,129 @@ +# Visual C++ Makefile for PDCurses - SDL2 +# +# Usage: nmake -f [path\]Makefile.vc [DEBUG=Y] [DLL=Y] [WIDE=Y] [UTF8=Y] +# [INFOEX=N] [target] +# +# where target can be any of: +# [all|demos|pdcurses.lib|testcurs.exe...] + +O = obj +E = .exe +RM = del + +!ifndef PDCURSES_SRCDIR +PDCURSES_SRCDIR = .. +!endif + +osdir = $(PDCURSES_SRCDIR)\sdl2 +common = $(PDCURSES_SRCDIR)\common + +!include $(common)\libobjs.mif +!include $(osdir)\versions.mif + +SDL2_INCLUDE = -I$(SDLBASE)\include +SDL2_LIB = $(SDLBASE)\lib\$(PLATFORM)\SDL2.lib +SDL2_LIBMAIN = $(SDLBASE)\lib\$(PLATFORM)\SDL2main.lib + +PDCURSES_WIN_H = $(osdir)\pdcsdl.h + +CC = cl.exe -nologo + +!ifdef DEBUG +CFLAGS = -Z7 -DPDCDEBUG +LDFLAGS = -debug -pdb:none +!else +CFLAGS = -O1 +LDFLAGS = +!endif + +!ifdef WIDE +WIDEOPT = -DPDC_WIDE +TTF_INCLUDE = -I$(TTFBASE)\include +TTF_LIB = $(TTFBASE)\lib\$(PLATFORM)\SDL2_ttf.lib +!endif + +!ifdef UTF8 +UTF8OPT = -DPDC_FORCE_UTF8 +!endif + +!ifdef INFOEX +INFOPT = -DHAVE_NO_INFOEX +!endif + +SHL_LD = link $(LDFLAGS) -nologo -dll -machine:$(PLATFORM) -out:pdcurses.dll + +LINK = link.exe -nologo -subsystem:windows + +LIBEXE = lib -nologo + +LIBCURSES = pdcurses.lib +CURSESDLL = pdcurses.dll + +!ifdef DLL +DLLOPT = -DPDC_DLL_BUILD +PDCLIBS = $(CURSESDLL) +LIBLIBS = $(SDL2_LIB) $(TTF_LIB) +CCLIBS = $(SDL2_LIBMAIN) $(SDL2_LIB) +!else +PDCLIBS = $(LIBCURSES) +CCLIBS = $(SDL2_LIBMAIN) $(SDL2_LIB) $(TTF_LIB) +!endif + +BUILD = $(CC) -I$(PDCURSES_SRCDIR) \ +-c $(CFLAGS) $(DLLOPT) $(WIDEOPT) $(UTF8OPT) $(INFOPT) + +all: $(PDCLIBS) + +clean: + -$(RM) *.obj + -$(RM) *.lib + -$(RM) *.exe + -$(RM) *.dll + -$(RM) *.exp + -$(RM) *.res + +demos: $(PDCLIBS) $(DEMOS) sdltest.exe + +DEMOOBJS = $(DEMOS:.exe=.obj) tui.obj sdltest.obj + +$(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) +$(PDCOBJS) : $(PDCURSES_WIN_H) +$(DEMOOBJS) : $(PDCURSES_CURSES_H) +$(DEMOS) : $(LIBCURSES) +panel.obj : $(PANEL_HEADER) + +!ifndef DLL +$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) + $(LIBEXE) -out:$@ $(LIBOBJS) $(PDCOBJS) +!endif + +$(CURSESDLL) : $(LIBOBJS) $(PDCOBJS) pdcurses.obj + $(SHL_LD) $(LIBOBJS) $(PDCOBJS) pdcurses.obj $(LIBLIBS) + +pdcurses.res pdcurses.obj: $(common)\pdcurses.rc + rc -r -fopdcurses.res $(common)\pdcurses.rc + cvtres -machine:$(PLATFORM) -nologo -out:pdcurses.obj pdcurses.res + +{$(srcdir)\}.c{}.obj:: + $(BUILD) $< + +{$(osdir)\}.c{}.obj:: + $(BUILD) -Dmain=SDL_main $(SDL2_INCLUDE) $(TTF_INCLUDE) $< + +{$(demodir)\}.c{}.obj:: + $(BUILD) -Dmain=SDL_main $< + +.obj.exe: + $(LINK) $(LDFLAGS) $< $(LIBCURSES) $(CCLIBS) + +tuidemo.exe: tuidemo.obj tui.obj + $(LINK) $(LDFLAGS) $*.obj tui.obj $(LIBCURSES) $(CCLIBS) + +tui.obj: $(demodir)\tui.c $(demodir)\tui.h + $(BUILD) -I$(demodir) $(demodir)\tui.c + +tuidemo.obj: $(demodir)\tuidemo.c + $(BUILD) -Dmain=SDL_main -I$(demodir) $(demodir)\tuidemo.c + +sdltest.exe: sdltest.obj + $(LINK) $(LDFLAGS) $*.obj $(LIBCURSES) $(LIBLIBS) $(CCLIBS) diff --git a/vendor/pdcurses/sdl2/README.md b/vendor/pdcurses/sdl2/README.md new file mode 100644 index 0000000..339576c --- /dev/null +++ b/vendor/pdcurses/sdl2/README.md @@ -0,0 +1,194 @@ +PDCurses for SDL 2.x +==================== + +This is a port of PDCurses for version 2.x of SDL (aka SDL2). + + +Building +-------- + +- On *nix (including Linux and Mac OS X), run "make" in the sdl2 + directory. There is no configure script (yet?) for this port. This + assumes a working sdl-config, and GNU make. It builds the library + pdcurses.a (or pdcurses.so/pdcurses.dylib with DLL=Y). + +- With MinGW, edit the Makefile to point to the appropriate include and + library paths, and then run "mingw32-make". + +- With MSVC, edit Makefile.vc if needed, and do "nmake -f Makefile.vc". + +- The makefile recognizes the optional PDCURSES_SRCDIR environment + variable, and the option "DEBUG=Y", as with the console ports. + "WIDE=Y" builds a version that not only uses 16-bit Unicode + characters, but depends on the SDL2_ttf library, instead of using + simple bitmap fonts. "UTF8=Y" makes PDCurses ignore the system locale, + and treat all narrow-character strings as UTF-8; this option has no + effect unless WIDE=Y is also set. You can specify "DLL=Y" to build a dynamic + rather than static library. The dynamic library is called pdcurses.dll, + pdcurses.so, or pdcurses.dylib on Windows, Linux, or Mac OS X respectively. + And on all platforms, add the target "demos" to build the sample programs. + + +Usage +----- + +There are no special requirements to use PDCurses for SDL -- all +PDCurses-compatible code should work fine. Nothing extra is needed +beyond the base SDL library. However, there are some optional special +features, described here. + +The SDL ports operate in one of two ways, depending on whether or not +they were built with WIDE=Y: + + +### 8-bit mode + +The font is a simple BMP, 32 characters wide by 8 characters tall, +preferably with a palette. (BMPs without palettes still work, but in +that case, no attributes will be available, nor will the cursor work.) +The first entry in the palette (usually black) is treated as the +background color; the last entry (usually white) is treated as the +foreground. These are changed or made transparent as appropriate; any +other colors in the palette are passed through unchanged. So -- although +a one-bit depth is sufficient for a normal font -- you could redraw some +characters as multi-colored tiles. + +The font must be monospaced. The size of each character is derived by +dividing the width of the BMP by 32 and the height by 8. There is no +constraint on the dimensions. + +As provided in the default font and expected by acs_map[], the font is +in Code Page 437 form. But you can of course use any layout if you're +not relying on correct values for the ACS_* macros. + +The font can be set via the environment variable PDC_FONT. If it's not +set, PDCurses looks for a file named "pdcfont.bmp" in the current +directory at the time of initscr(). If neither is found, it uses the +built-in default font encoded in font437.h. + + +### 16-bit mode + +Instead of a BMP, PDC_FONT points to a TrueType font. Only true +monospaced fonts work well. The font can be set at compile time via +PDC_FONT_PATH, and/or at runtime via pdc_ttffont. The environment +variable PDC_FONT_SIZE is also available to control the font size (also +as a compile-time define, and at runtime as pdc_font_size.) The +character mapping for chtypes is 16-bit Unicode (the Basic Multilingual +Plane). + +The default font (if not redefined) is based on the OS: + +- Windows: C:/Windows/Fonts/consola.ttf + +- Mac: /Library/Fonts/Menlo.ttc + +- Other: /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf + + +Backgrounds +----------- + +PDCurses for SDL supports an optional background image BMP. This is used +whenever start_color() has not been called (see the ptest demo for an +example), or when use_default_colors() has been called after +start_color(), and the background color of a pair has been set to -1 +(see ozdemo, worm, and rain for examples). The usage parallels that of +ncurses in an appropriate terminal (e.g., Gnome Terminal). The image is +tiled to cover the PDCurses window, and can be any size or depth. + +As with the font, you can point to a location for the background via the +environment variable PDC_BACKGROUND; "pdcback.bmp" is the fallback. +(There is no default background.) + + +Icons +----- + +The icon (used with SDL_SetWindowIcon() -- not used for the executable +file) can be set via the environment variable PDC_ICON, and falls back +to "pdcicon.bmp", and then to the built-in icon from iconbmp.h. The +built-in icon is the PDCurses logo, as seen in ../common/icon32.xpm. + +If pdc_screen is preinitialized (see below), PDCurses does not attempt +to set the icon. + + +Screen size +----------- + +The default screen size is 80x25 characters (whatever size they may be), +but you can override this via the environment variables PDC_COLS and/or +PDC_LINES. If pdc_screen is preinitialized (see below), these are +ignored. + + +Integration with SDL +-------------------- + +If you want to go further, you can mix PDCurses and SDL functions. (Of +course this is extremely non-portable!) To aid you, there are several +external variables and functions specific to the SDL ports; you could +include pdcsdl.h, or just add the declarations you need in your code: + + PDCEX SDL_Window *pdc_window; + PDCEX SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back; + PDCEX int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset; + + PDCEX void PDC_update_rects(void); + PDCEX void PDC_retile(void); + +pdc_window is the main window, created by SDL_CreateWindow(), unless +it's preset before initscr(); and pdc_screen is the main surface, set by +SDL_GetWindowSurface(pdc_window). (See sdltest.c for examples.) You can +perform normal SDL operations on this surface, but PDCurses won't +respect them when it updates. (For that, see PDC_retile().) As an +alternative, you can preinitialize this surface before calling +initscr(). In that case, you can use pdc_sheight, pdc_swidth, +pdc_yoffset and/or pdc_xoffset (q.v.) to confine PDCurses to only a +specific area of the surface, reserving the rest for other SDL +operations. If you preinitialize pdc_window, you'll have to close it +yourself; PDCurses will ignore resize events, and won't try to set the +icon. Also note that if you preinitialize pdc_screen, it need not be the +display surface. + +pdc_font (in 8-bit mode), pdc_icon, and pdc_back are the SDL_surfaces +for the font, icon, and background, respectively. You can set any or all +of them before initscr(), and thus override any of the other ways to set +them. But note that pdc_icon will be ignored if pdc_screen is preset. + +pdc_sheight and pdc_swidth are the dimensions of the area of pdc_screen +to be used by PDCurses. You can preset them before initscr(); if either +is not set, it defaults to the full screen size minus the x or y offset, +as appropriate. + +pdc_xoffset and pdc_yoffset are the x and y offset for the area of +pdc_screen to be used by PDCurses. See the sdltest demo for an example. + +PDC_retile() makes a copy of pdc_screen, then tiles it with the +background image, if any. The resulting surface is used as the +background for transparent character cells. PDC_retile() is called from +initscr() and resize_term(). However, you can also use it at other +times, to take advantage of the way it copies pdc_screen: Draw some SDL +stuff; call PDC_retile(); do some curses stuff -- it will use whatever +was on pdc_screen as the background. Then you can erase the curses +screen, do some more SDL stuff, and call PDC_retile() again to make a +new background. (If you don't erase the curses screen, it will be +incorporated into the background when you call PDC_retile().) But this +only works if no background image is set. + + +Interaction with stdio +---------------------- + +As with X11, it's a bad idea to mix curses and stdio calls. (In fact, +that's true for PDCurses on any platform; but especially these two, +which don't run under terminals.) Depending on how SDL is built, stdout +and stderr may be redirected to files. + + +Acknowledgements +---------------- + +Original SDL port was provided by William McBrine +SDL2 modifications by Laura Michaels and Robin Gustafsson diff --git a/vendor/pdcurses/sdl2/pdcclip.c b/vendor/pdcurses/sdl2/pdcclip.c new file mode 100644 index 0000000..b792a90 --- /dev/null +++ b/vendor/pdcurses/sdl2/pdcclip.c @@ -0,0 +1,93 @@ +/* PDCurses */ + +#include "pdcsdl.h" + +#include +#include + +/*man-start************************************************************** + +clipboard +--------- + +### Synopsis + + int PDC_getclipboard(char **contents, long *length); + int PDC_setclipboard(const char *contents, long length); + int PDC_freeclipboard(char *contents); + int PDC_clearclipboard(void); + +### Description + + PDC_getclipboard() gets the textual contents of the system's + clipboard. This function returns the contents of the clipboard in the + contents argument. It is the responsibility of the caller to free the + memory returned, via PDC_freeclipboard(). The length of the clipboard + contents is returned in the length argument. + + PDC_setclipboard copies the supplied text into the system's + clipboard, emptying the clipboard prior to the copy. + + PDC_clearclipboard() clears the internal clipboard. + +### Return Values + + PDC_CLIP_SUCCESS the call was successful + PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for + the clipboard contents + PDC_CLIP_EMPTY the clipboard contains no text + PDC_CLIP_ACCESS_ERROR no clipboard support + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + PDC_getclipboard | - | - | - + PDC_setclipboard | - | - | - + PDC_freeclipboard | - | - | - + PDC_clearclipboard | - | - | - + +**man-end****************************************************************/ + +int PDC_getclipboard(char **contents, long *length) +{ + PDC_LOG(("PDC_getclipboard() - called\n")); + + if (SDL_HasClipboardText() == SDL_FALSE) + return PDC_CLIP_EMPTY; + *contents = SDL_GetClipboardText(); + *length = strlen(*contents); + + return PDC_CLIP_SUCCESS; +} + +int PDC_setclipboard(const char *contents, long length) +{ + PDC_LOG(("PDC_setclipboard() - called\n")); + + if (SDL_SetClipboardText(contents) != 0) + return PDC_CLIP_ACCESS_ERROR; + + return PDC_CLIP_SUCCESS; +} + +int PDC_freeclipboard(char *contents) +{ + PDC_LOG(("PDC_freeclipboard() - called\n")); + + SDL_free(contents); + + return PDC_CLIP_SUCCESS; +} + +int PDC_clearclipboard(void) +{ + PDC_LOG(("PDC_clearclipboard() - called\n")); + + if (SDL_HasClipboardText() == SDL_TRUE) + { + SDL_SetClipboardText(NULL); + } + + return PDC_CLIP_SUCCESS; +} diff --git a/vendor/pdcurses/sdl2/pdcdisp.c b/vendor/pdcurses/sdl2/pdcdisp.c new file mode 100644 index 0000000..1bf6f98 --- /dev/null +++ b/vendor/pdcurses/sdl2/pdcdisp.c @@ -0,0 +1,581 @@ +/* PDCurses */ + +#include "pdcsdl.h" + +#include +#include + +#ifdef PDC_WIDE +# include "../common/acsgr.h" +#else +# include "../common/acs437.h" +#endif + +#define MAXRECT 200 /* maximum number of rects to queue up before + an update is forced; the number was chosen + arbitrarily */ + +static SDL_Rect uprect[MAXRECT]; /* table of rects to update */ +static chtype oldch = (chtype)(-1); /* current attribute */ +static int rectcount = 0; /* index into uprect */ +static short foregr = -2, backgr = -2; /* current foreground, background */ +static bool blinked_off = FALSE; + +/* do the real updates on a delay */ + +void PDC_update_rects(void) +{ + int i; + + if (rectcount) + { + /* if the maximum number of rects has been reached, we're + probably better off doing a full screen update */ + + if (rectcount == MAXRECT) + SDL_UpdateWindowSurface(pdc_window); + else + { + int w = pdc_screen->w; + int h = pdc_screen->h; + + for (i = 0; i < rectcount; i++) + { + if (uprect[i].x > w || + uprect[i].y > h || + !uprect[i].w || !uprect[i].h) + { + if (i + 1 < rectcount) + { + memmove(uprect + i, uprect + i + 1, + (rectcount - i + 1) * sizeof(*uprect)); + --i; + } + rectcount--; + continue; + } + + if (uprect[i].x + uprect[i].w > w) + uprect[i].w = min(w, w - uprect[i].x); + + if (uprect[i].y + uprect[i].h > h) + uprect[i].h = min(h, h - uprect[i].y); + } + + if (rectcount > 0) + SDL_UpdateWindowSurfaceRects(pdc_window, uprect, rectcount); + } + + rectcount = 0; + } +} + +/* set the font colors to match the chtype's attribute */ + +static void _set_attr(chtype ch) +{ + attr_t sysattrs = SP->termattrs; + +#ifdef PDC_WIDE + TTF_SetFontStyle(pdc_ttffont, + ( ((ch & A_BOLD) && (sysattrs & A_BOLD)) ? + TTF_STYLE_BOLD : 0) | + ( ((ch & A_ITALIC) && (sysattrs & A_ITALIC)) ? + TTF_STYLE_ITALIC : 0) ); +#endif + + ch &= (A_COLOR|A_BOLD|A_BLINK|A_REVERSE); + + if (oldch != ch) + { + short newfg, newbg; + + if (SP->mono) + return; + + pair_content(PAIR_NUMBER(ch), &newfg, &newbg); + + if ((ch & A_BOLD) && !(sysattrs & A_BOLD)) + newfg |= 8; + if ((ch & A_BLINK) && !(sysattrs & A_BLINK)) + newbg |= 8; + + if (ch & A_REVERSE) + { + short tmp = newfg; + newfg = newbg; + newbg = tmp; + } + + if (newfg != foregr) + { +#ifndef PDC_WIDE + SDL_SetPaletteColors(pdc_font->format->palette, + pdc_color + newfg, pdc_flastc, 1); +#endif + foregr = newfg; + } + + if (newbg != backgr) + { +#ifndef PDC_WIDE + if (newbg == -1) + SDL_SetColorKey(pdc_font, SDL_TRUE, 0); + else + { + if (backgr == -1) + SDL_SetColorKey(pdc_font, SDL_FALSE, 0); + + SDL_SetPaletteColors(pdc_font->format->palette, + pdc_color + newbg, 0, 1); + } +#endif + backgr = newbg; + } + + oldch = ch; + } +} + +#ifdef PDC_WIDE + +/* Draw some of the ACS_* "graphics" */ + +bool _grprint(chtype ch, SDL_Rect dest) +{ + Uint32 col = pdc_mapped[foregr]; + int hmid = (pdc_fheight - pdc_fthick) >> 1; + int wmid = (pdc_fwidth - pdc_fthick) >> 1; + + switch (ch) + { + case ACS_ULCORNER: + dest.h = pdc_fheight - hmid; + dest.y += hmid; + dest.w = pdc_fthick; + dest.x += wmid; + SDL_FillRect(pdc_screen, &dest, col); + dest.w = pdc_fwidth - wmid; + goto S1; + case ACS_LLCORNER: + dest.h = hmid; + dest.w = pdc_fthick; + dest.x += wmid; + SDL_FillRect(pdc_screen, &dest, col); + dest.w = pdc_fwidth - wmid; + dest.y += hmid; + goto S1; + case ACS_URCORNER: + dest.h = pdc_fheight - hmid; + dest.w = pdc_fthick; + dest.y += hmid; + dest.x += wmid; + SDL_FillRect(pdc_screen, &dest, col); + dest.w = wmid; + dest.x -= wmid; + goto S1; + case ACS_LRCORNER: + dest.h = hmid + pdc_fthick; + dest.w = pdc_fthick; + dest.x += wmid; + SDL_FillRect(pdc_screen, &dest, col); + dest.w = wmid; + dest.x -= wmid; + dest.y += hmid; + goto S1; + case ACS_LTEE: + dest.h = pdc_fthick; + dest.w = pdc_fwidth - wmid; + dest.x += wmid; + dest.y += hmid; + SDL_FillRect(pdc_screen, &dest, col); + dest.w = pdc_fthick; + dest.x -= wmid; + goto VLINE; + case ACS_RTEE: + dest.w = wmid; + case ACS_PLUS: + dest.h = pdc_fthick; + dest.y += hmid; + SDL_FillRect(pdc_screen, &dest, col); + VLINE: + dest.h = pdc_fheight; + dest.y -= hmid; + case ACS_VLINE: + dest.w = pdc_fthick; + dest.x += wmid; + goto DRAW; + case ACS_TTEE: + dest.h = pdc_fheight - hmid; + dest.w = pdc_fthick; + dest.x += wmid; + dest.y += hmid; + SDL_FillRect(pdc_screen, &dest, col); + dest.w = pdc_fwidth; + dest.x -= wmid; + goto S1; + case ACS_BTEE: + dest.h = hmid; + dest.w = pdc_fthick; + dest.x += wmid; + SDL_FillRect(pdc_screen, &dest, col); + dest.w = pdc_fwidth; + dest.x -= wmid; + case ACS_HLINE: + dest.y += hmid; + goto S1; + case ACS_S3: + dest.y += hmid >> 1; + goto S1; + case ACS_S7: + dest.y += hmid + (hmid >> 1); + goto S1; + case ACS_S9: + dest.y += pdc_fheight - pdc_fthick; + case ACS_S1: + S1: + dest.h = pdc_fthick; + case ACS_BLOCK: + DRAW: + SDL_FillRect(pdc_screen, &dest, col); + return TRUE; + default: ; + } + + return FALSE; /* didn't draw it -- fall back to acs_map */ +} + +#endif + +/* draw a cursor at (y, x) */ + +void PDC_gotoyx(int row, int col) +{ + SDL_Rect src, dest; + chtype ch; + int oldrow, oldcol; +#ifdef PDC_WIDE + Uint16 chstr[2] = {0, 0}; +#endif + + PDC_LOG(("PDC_gotoyx() - called: row %d col %d from row %d col %d\n", + row, col, SP->cursrow, SP->curscol)); + + oldrow = SP->cursrow; + oldcol = SP->curscol; + + /* clear the old cursor */ + + PDC_transform_line(oldrow, oldcol, 1, curscr->_y[oldrow] + oldcol); + + if (!SP->visibility) + return; + + /* draw a new cursor by overprinting the existing character in + reverse, either the full cell (when visibility == 2) or the + lowest quarter of it (when visibility == 1) */ + + ch = curscr->_y[row][col] ^ A_REVERSE; + + _set_attr(ch); + + src.h = (SP->visibility == 1) ? pdc_fheight >> 2 : pdc_fheight; + src.w = pdc_fwidth; + + dest.y = (row + 1) * pdc_fheight - src.h + pdc_yoffset; + dest.x = col * pdc_fwidth + pdc_xoffset; + dest.h = src.h; + dest.w = src.w; + +#ifdef PDC_WIDE + SDL_FillRect(pdc_screen, &dest, pdc_mapped[backgr]); + + if (!(SP->visibility == 2 && (ch & A_ALTCHARSET && !(ch & 0xff80)) && + _grprint(ch & (0x7f | A_ALTCHARSET), dest))) + { + if (ch & A_ALTCHARSET && !(ch & 0xff80)) + ch = acs_map[ch & 0x7f]; + + chstr[0] = ch & A_CHARTEXT; + + pdc_font = TTF_RenderUNICODE_Blended(pdc_ttffont, chstr, + pdc_color[foregr]); + if (pdc_font) + { + int center = pdc_fwidth > pdc_font->w ? + (pdc_fwidth - pdc_font->w) >> 1 : 0; + src.x = 0; + src.y = pdc_fheight - src.h; + dest.x += center; + SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest); + dest.x -= center; + SDL_FreeSurface(pdc_font); + pdc_font = NULL; + } + } +#else + if (ch & A_ALTCHARSET && !(ch & 0xff80)) + ch = acs_map[ch & 0x7f]; + + src.x = (ch & 0xff) % 32 * pdc_fwidth; + src.y = (ch & 0xff) / 32 * pdc_fheight + (pdc_fheight - src.h); + + SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest); +#endif + + if (oldrow != row || oldcol != col) + { + if (rectcount == MAXRECT) + PDC_update_rects(); + + uprect[rectcount++] = dest; + } +} + +void _new_packet(attr_t attr, int lineno, int x, int len, const chtype *srcp) +{ + SDL_Rect src, dest, lastrect; + int j; +#ifdef PDC_WIDE + Uint16 chstr[2] = {0, 0}; +#endif + attr_t sysattrs = SP->termattrs; + short hcol = SP->line_color; + bool blink = blinked_off && (attr & A_BLINK) && (sysattrs & A_BLINK); + + if (rectcount == MAXRECT) + PDC_update_rects(); + +#ifdef PDC_WIDE + src.x = 0; + src.y = 0; +#endif + src.h = pdc_fheight; + src.w = pdc_fwidth; + + dest.y = pdc_fheight * lineno + pdc_yoffset; + dest.x = pdc_fwidth * x + pdc_xoffset; + dest.h = pdc_fheight; + dest.w = pdc_fwidth * len; + + /* if the previous rect was just above this one, with the same width + and horizontal position, then merge the new one with it instead + of adding a new entry */ + + if (rectcount) + lastrect = uprect[rectcount - 1]; + + if (rectcount && lastrect.x == dest.x && lastrect.w == dest.w) + { + if (lastrect.y + lastrect.h == dest.y) + uprect[rectcount - 1].h = lastrect.h + pdc_fheight; + else + if (lastrect.y != dest.y) + uprect[rectcount++] = dest; + } + else + uprect[rectcount++] = dest; + + _set_attr(attr); + + if (backgr == -1) + SDL_BlitSurface(pdc_tileback, &dest, pdc_screen, &dest); +#ifdef PDC_WIDE + else + SDL_FillRect(pdc_screen, &dest, pdc_mapped[backgr]); +#endif + + if (hcol == -1) + hcol = foregr; + + for (j = 0; j < len; j++) + { + chtype ch = srcp[j]; + + if (blink) + ch = ' '; + + dest.w = pdc_fwidth; + + if (ch & A_ALTCHARSET && !(ch & 0xff80)) + { +#ifdef PDC_WIDE + if (_grprint(ch & (0x7f | A_ALTCHARSET), dest)) + { + dest.x += pdc_fwidth; + continue; + } +#endif + ch = acs_map[ch & 0x7f]; + } + +#ifdef PDC_WIDE + ch &= A_CHARTEXT; + + if (ch != ' ') + { + if (chstr[0] != ch) + { + chstr[0] = ch; + + if (pdc_font) + SDL_FreeSurface(pdc_font); + + pdc_font = TTF_RenderUNICODE_Blended(pdc_ttffont, chstr, + pdc_color[foregr]); + } + + if (pdc_font) + { + int center = pdc_fwidth > pdc_font->w ? + (pdc_fwidth - pdc_font->w) >> 1 : 0; + dest.x += center; + SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest); + dest.x -= center; + } + } +#else + src.x = (ch & 0xff) % 32 * pdc_fwidth; + src.y = (ch & 0xff) / 32 * pdc_fheight; + + SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest); +#endif + + if (!blink && (attr & (A_LEFT | A_RIGHT))) + { + dest.w = pdc_fthick; + + if (attr & A_LEFT) + SDL_FillRect(pdc_screen, &dest, pdc_mapped[hcol]); + + if (attr & A_RIGHT) + { + dest.x += pdc_fwidth - pdc_fthick; + SDL_FillRect(pdc_screen, &dest, pdc_mapped[hcol]); + dest.x -= pdc_fwidth - pdc_fthick; + } + } + + dest.x += pdc_fwidth; + } + +#ifdef PDC_WIDE + if (pdc_font) + { + SDL_FreeSurface(pdc_font); + pdc_font = NULL; + } +#endif + + if (!blink && (attr & A_UNDERLINE)) + { + dest.y += pdc_fheight - pdc_fthick; + dest.x = pdc_fwidth * x + pdc_xoffset; + dest.h = pdc_fthick; + dest.w = pdc_fwidth * len; + + SDL_FillRect(pdc_screen, &dest, pdc_mapped[hcol]); + } +} + +/* update the given physical line to look like the corresponding line in + curscr */ + +void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) +{ + attr_t old_attr, attr; + int i, j; + + PDC_LOG(("PDC_transform_line() - called: lineno=%d\n", lineno)); + + old_attr = *srcp & (A_ATTRIBUTES ^ A_ALTCHARSET); + + for (i = 1, j = 1; j < len; i++, j++) + { + attr = srcp[i] & (A_ATTRIBUTES ^ A_ALTCHARSET); + + if (attr != old_attr) + { + _new_packet(old_attr, lineno, x, i, srcp); + old_attr = attr; + srcp += i; + x += i; + i = 0; + } + } + + _new_packet(old_attr, lineno, x, i, srcp); +} + +static Uint32 _blink_timer(Uint32 interval, void *param) +{ + SDL_Event event; + + event.type = SDL_USEREVENT; + SDL_PushEvent(&event); + return(interval); +} + +void PDC_blink_text(void) +{ + static SDL_TimerID blinker_id = 0; + int i, j, k; + + oldch = (chtype)(-1); + + if (!(SP->termattrs & A_BLINK)) + { + SDL_RemoveTimer(blinker_id); + blinker_id = 0; + } + else if (!blinker_id) + { + blinker_id = SDL_AddTimer(500, _blink_timer, NULL); + blinked_off = TRUE; + } + + blinked_off = !blinked_off; + + for (i = 0; i < SP->lines; i++) + { + const chtype *srcp = curscr->_y[i]; + + for (j = 0; j < SP->cols; j++) + if (srcp[j] & A_BLINK) + { + k = j; + while (k < SP->cols && (srcp[k] & A_BLINK)) + k++; + PDC_transform_line(i, j, k - j, srcp + j); + j = k; + } + } + + oldch = (chtype)(-1); + + PDC_doupdate(); +} + +void PDC_doupdate(void) +{ + PDC_update_rects(); +} + +void PDC_pump_and_peep(void) +{ + SDL_Event event; + + if (SDL_PollEvent(&event)) + { + if (SDL_WINDOWEVENT == event.type && + (SDL_WINDOWEVENT_RESTORED == event.window.event || + SDL_WINDOWEVENT_EXPOSED == event.window.event || + SDL_WINDOWEVENT_SHOWN == event.window.event)) + { + SDL_UpdateWindowSurface(pdc_window); + rectcount = 0; + } + else + SDL_PushEvent(&event); + } +} diff --git a/vendor/pdcurses/sdl2/pdcgetsc.c b/vendor/pdcurses/sdl2/pdcgetsc.c new file mode 100644 index 0000000..3dd2e18 --- /dev/null +++ b/vendor/pdcurses/sdl2/pdcgetsc.c @@ -0,0 +1,30 @@ +/* PDCurses */ + +#include "pdcsdl.h" + +/* get the cursor size/shape */ + +int PDC_get_cursor_mode(void) +{ + PDC_LOG(("PDC_get_cursor_mode() - called\n")); + + return 0; +} + +/* return number of screen rows */ + +int PDC_get_rows(void) +{ + PDC_LOG(("PDC_get_rows() - called\n")); + + return pdc_sheight / pdc_fheight; +} + +/* return width of screen/viewport */ + +int PDC_get_columns(void) +{ + PDC_LOG(("PDC_get_columns() - called\n")); + + return pdc_swidth / pdc_fwidth; +} diff --git a/vendor/pdcurses/sdl2/pdckbd.c b/vendor/pdcurses/sdl2/pdckbd.c new file mode 100644 index 0000000..7f5bcf4 --- /dev/null +++ b/vendor/pdcurses/sdl2/pdckbd.c @@ -0,0 +1,478 @@ +/* PDCurses */ + +#include "pdcsdl.h" + +#include +#include + +static SDL_Event event; +static SDL_Keycode oldkey; +static MOUSE_STATUS old_mouse_status; + +static struct +{ + SDL_Keycode keycode; + bool numkeypad; + unsigned short normal; + unsigned short shifted; + unsigned short control; + unsigned short alt; +} key_table[] = +{ +/* keycode keypad normal shifted control alt*/ + {SDLK_LEFT, FALSE, KEY_LEFT, KEY_SLEFT, CTL_LEFT, ALT_LEFT}, + {SDLK_RIGHT, FALSE, KEY_RIGHT, KEY_SRIGHT, CTL_RIGHT, ALT_RIGHT}, + {SDLK_UP, FALSE, KEY_UP, KEY_SUP, CTL_UP, ALT_UP}, + {SDLK_DOWN, FALSE, KEY_DOWN, KEY_SDOWN, CTL_DOWN, ALT_DOWN}, + {SDLK_HOME, FALSE, KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME}, + {SDLK_END, FALSE, KEY_END, KEY_SEND, CTL_END, ALT_END}, + {SDLK_PAGEUP, FALSE, KEY_PPAGE, KEY_SPREVIOUS,CTL_PGUP, ALT_PGUP}, + {SDLK_PAGEDOWN,FALSE, KEY_NPAGE, KEY_SNEXT, CTL_PGDN, ALT_PGDN}, + {SDLK_INSERT, FALSE, KEY_IC, KEY_SIC, CTL_INS, ALT_INS}, + {SDLK_DELETE, FALSE, KEY_DC, KEY_SDC, CTL_DEL, ALT_DEL}, + {SDLK_F1, FALSE, KEY_F(1), KEY_F(13), KEY_F(25), KEY_F(37)}, + {SDLK_F2, FALSE, KEY_F(2), KEY_F(14), KEY_F(26), KEY_F(38)}, + {SDLK_F3, FALSE, KEY_F(3), KEY_F(15), KEY_F(27), KEY_F(39)}, + {SDLK_F4, FALSE, KEY_F(4), KEY_F(16), KEY_F(28), KEY_F(40)}, + {SDLK_F5, FALSE, KEY_F(5), KEY_F(17), KEY_F(29), KEY_F(41)}, + {SDLK_F6, FALSE, KEY_F(6), KEY_F(18), KEY_F(30), KEY_F(42)}, + {SDLK_F7, FALSE, KEY_F(7), KEY_F(19), KEY_F(31), KEY_F(43)}, + {SDLK_F8, FALSE, KEY_F(8), KEY_F(20), KEY_F(32), KEY_F(44)}, + {SDLK_F9, FALSE, KEY_F(9), KEY_F(21), KEY_F(33), KEY_F(45)}, + {SDLK_F10, FALSE, KEY_F(10), KEY_F(22), KEY_F(34), KEY_F(46)}, + {SDLK_F11, FALSE, KEY_F(11), KEY_F(23), KEY_F(35), KEY_F(47)}, + {SDLK_F12, FALSE, KEY_F(12), KEY_F(24), KEY_F(36), KEY_F(48)}, + {SDLK_F13, FALSE, KEY_F(13), KEY_F(25), KEY_F(37), KEY_F(49)}, + {SDLK_F14, FALSE, KEY_F(14), KEY_F(26), KEY_F(38), KEY_F(50)}, + {SDLK_F15, FALSE, KEY_F(15), KEY_F(27), KEY_F(39), KEY_F(51)}, + {SDLK_BACKSPACE,FALSE, 0x08, 0x08, CTL_BKSP, ALT_BKSP}, + {SDLK_TAB, FALSE, 0x09, KEY_BTAB, CTL_TAB, ALT_TAB}, + {SDLK_PRINTSCREEN,FALSE,KEY_PRINT, KEY_SPRINT, KEY_PRINT, KEY_PRINT}, + {SDLK_PAUSE, FALSE, KEY_SUSPEND, KEY_SSUSPEND, KEY_SUSPEND, KEY_SUSPEND}, + {SDLK_CLEAR, FALSE, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR}, + {SDLK_HELP, FALSE, KEY_HELP, KEY_SHELP, KEY_LHELP, KEY_HELP}, + {SDLK_MENU, FALSE, KEY_OPTIONS, KEY_SOPTIONS, KEY_OPTIONS, KEY_OPTIONS}, + {SDLK_ESCAPE, FALSE, 0x1B, 0x1B, 0x1B, ALT_ESC}, + {SDLK_KP_ENTER,TRUE, PADENTER, PADENTER, CTL_PADENTER,ALT_PADENTER}, + {SDLK_KP_PLUS, TRUE, PADPLUS, '+', CTL_PADPLUS, ALT_PADPLUS}, + {SDLK_KP_MINUS,TRUE, PADMINUS, '-', CTL_PADMINUS,ALT_PADMINUS}, + {SDLK_KP_MULTIPLY,TRUE,PADSTAR, '*', CTL_PADSTAR, ALT_PADSTAR}, + {SDLK_KP_DIVIDE,TRUE, PADSLASH, '/', CTL_PADSLASH,ALT_PADSLASH}, + {SDLK_KP_PERIOD,TRUE, PADSTOP, '.', CTL_PADSTOP, ALT_PADSTOP}, + {SDLK_KP_0, TRUE, PAD0, '0', CTL_PAD0, ALT_PAD0}, + {SDLK_KP_1, TRUE, KEY_C1, '1', CTL_PAD1, ALT_PAD1}, + {SDLK_KP_2, TRUE, KEY_C2, '2', CTL_PAD2, ALT_PAD2}, + {SDLK_KP_3, TRUE, KEY_C3, '3', CTL_PAD3, ALT_PAD3}, + {SDLK_KP_4, TRUE, KEY_B1, '4', CTL_PAD4, ALT_PAD4}, + {SDLK_KP_5, TRUE, KEY_B2, '5', CTL_PAD5, ALT_PAD5}, + {SDLK_KP_6, TRUE, KEY_B3, '6', CTL_PAD6, ALT_PAD6}, + {SDLK_KP_7, TRUE, KEY_A1, '7', CTL_PAD7, ALT_PAD7}, + {SDLK_KP_8, TRUE, KEY_A2, '8', CTL_PAD8, ALT_PAD8}, + {SDLK_KP_9, TRUE, KEY_A3, '9', CTL_PAD9, ALT_PAD9}, + {0, 0, 0, 0, 0, 0} +}; + +void PDC_set_keyboard_binary(bool on) +{ + PDC_LOG(("PDC_set_keyboard_binary() - called\n")); +} + +/* check if a key or mouse event is waiting */ + +bool PDC_check_key(void) +{ + int haveevent; + + PDC_pump_and_peep(); + + /* SDL_TEXTINPUT can return multiple chars from the IME which we + should handle before polling for additional events. */ + + if (event.type == SDL_TEXTINPUT && event.text.text[0]) + haveevent = 1; + else + haveevent = SDL_PollEvent(&event); + + return haveevent; +} + +#ifdef PDC_WIDE +static int _utf8_to_unicode(char *chstr, size_t *b) +{ + int i, bytes, unicode; + unsigned char byte = chstr[0]; + + if (byte > 0xf0) + { + bytes = 4; + unicode = byte & 0x7; + } + else if (byte > 0xe0) + { + bytes = 3; + unicode = byte & 0xf; + } + else if (byte > 0xc0) + { + bytes = 2; + unicode = byte & 0x1f; + } + else if (byte > 0x80) { + /* starts with a continuation byte; invalid character */ + return -1; + } + else + { + bytes = 1; + unicode = byte; + } + + for (i = 1; i < bytes; i++) + unicode = (unicode << 6) + (chstr[i] & 0x3f); + + *b = bytes; + return unicode; +} +#endif + +/* Handle ALT and CTRL sequences */ +static int _handle_alt_keys(int key) +{ + if (key > 0x7f) + return key; + + if (SP->key_modifiers & PDC_KEY_MODIFIER_CONTROL) + { + if (key >= 'A' && key <= 'Z') key -= 64; + if (key >= 'a' && key <= 'z') key -= 96; + } + else if (SP->key_modifiers & PDC_KEY_MODIFIER_ALT) + { + if (key >= 'A' && key <= 'Z') + { + key += ALT_A - 'A'; + SP->key_code = TRUE; + } else if (key >= 'a' && key <= 'z') + { + key += ALT_A - 'a'; + SP->key_code = TRUE; + } else if (key >= '0' && key <= '9') + { + key += ALT_0 - '0'; + SP->key_code = TRUE; + } + } + + return key; +} + +static int _process_key_event(void) +{ + int i, key = 0; + +#ifdef PDC_WIDE + size_t bytes; +#endif + + SP->key_code = FALSE; + + if (event.type == SDL_KEYUP) + { + switch (event.key.keysym.sym) + { + case SDLK_LCTRL: + case SDLK_RCTRL: + SP->key_modifiers &= ~PDC_KEY_MODIFIER_CONTROL; + break; + case SDLK_LALT: + case SDLK_RALT: + SP->key_modifiers &= ~PDC_KEY_MODIFIER_ALT; + break; + case SDLK_LSHIFT: + case SDLK_RSHIFT: + SP->key_modifiers &= ~PDC_KEY_MODIFIER_SHIFT; + break; + } + + if (!(SDL_GetModState() & KMOD_NUM)) + SP->key_modifiers &= ~PDC_KEY_MODIFIER_NUMLOCK; + + if (SP->return_key_modifiers && event.key.keysym.sym == oldkey) + { + SP->key_code = TRUE; + switch (event.key.keysym.sym) + { + case SDLK_RSHIFT: + return KEY_SHIFT_R; + case SDLK_LSHIFT: + return KEY_SHIFT_L; + case SDLK_RCTRL: + return KEY_CONTROL_R; + case SDLK_LCTRL: + return KEY_CONTROL_L; + case SDLK_RALT: + return KEY_ALT_R; + case SDLK_LALT: + return KEY_ALT_L; + default: + break; + } + } + + SP->key_code = FALSE; + return -1; + } + else if (event.type == SDL_TEXTINPUT) + { +#ifdef PDC_WIDE + if ((key = _utf8_to_unicode(event.text.text, &bytes)) == -1) + { + event.text.text[0] = '\0'; + } + else + { + memmove(event.text.text, event.text.text + bytes, + strlen(event.text.text) - bytes + 1); + } + return _handle_alt_keys(key); +#else + key = (unsigned char)event.text.text[0]; + memmove(event.text.text, event.text.text + 1, + strlen(event.text.text)); + return key > 0x7f ? -1 : _handle_alt_keys(key); +#endif + } + + oldkey = event.key.keysym.sym; + if (SDL_GetModState() & KMOD_NUM) + SP->key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; + + switch (event.key.keysym.sym) + { + case SDLK_LCTRL: + case SDLK_RCTRL: + SP->key_modifiers |= PDC_KEY_MODIFIER_CONTROL; + break; + case SDLK_LALT: + case SDLK_RALT: + SP->key_modifiers |= PDC_KEY_MODIFIER_ALT; + break; + case SDLK_LSHIFT: + case SDLK_RSHIFT: + SP->key_modifiers |= PDC_KEY_MODIFIER_SHIFT; + break; + case SDLK_RETURN: + return 0x0d; + default: + key = event.key.keysym.sym; + } + + for (i = 0; key_table[i].keycode; i++) + { + if (key_table[i].keycode == event.key.keysym.sym) + { + if ((event.key.keysym.mod & KMOD_SHIFT) || + (key_table[i].numkeypad && (event.key.keysym.mod & KMOD_NUM))) + { + key = key_table[i].shifted; + } + else if (event.key.keysym.mod & KMOD_CTRL) + { + key = key_table[i].control; + } + else if (event.key.keysym.mod & KMOD_ALT) + { + key = key_table[i].alt; + } + else + { + /* To get here, we ignore all other modifiers */ + key = key_table[i].normal; + } + + SP->key_code = (key > 0x100); + return key; + } + } + + /* SDL with TextInput ignores keys with CTRL */ + if (key && SP->key_modifiers & PDC_KEY_MODIFIER_CONTROL) + return _handle_alt_keys(key); + return -1; +} + +static int _process_mouse_event(void) +{ + SDL_Keymod keymods; + short shift_flags = 0; + + memset(&SP->mouse_status, 0, sizeof(MOUSE_STATUS)); + + keymods = SDL_GetModState(); + + if (keymods & KMOD_SHIFT) + shift_flags |= BUTTON_SHIFT; + + if (keymods & KMOD_CTRL) + shift_flags |= BUTTON_CONTROL; + + if (keymods & KMOD_ALT) + shift_flags |= BUTTON_ALT; + + if (event.type == SDL_MOUSEMOTION) + { + int i; + + SP->mouse_status.x = (event.motion.x - pdc_xoffset) / pdc_fwidth; + SP->mouse_status.y = (event.motion.y - pdc_yoffset) / pdc_fheight; + + if (!event.motion.state || + (SP->mouse_status.x == old_mouse_status.x && + SP->mouse_status.y == old_mouse_status.y)) + return -1; + + SP->mouse_status.changes = PDC_MOUSE_MOVED; + + for (i = 0; i < 3; i++) + { + if (event.motion.state & SDL_BUTTON(i + 1)) + { + SP->mouse_status.button[i] = BUTTON_MOVED | shift_flags; + SP->mouse_status.changes |= (1 << i); + } + } + } + else if (event.type == SDL_MOUSEWHEEL) + { + int x, y; + + SDL_GetMouseState(&x, &y); + SP->mouse_status.x = (x - pdc_xoffset) / pdc_fwidth; + SP->mouse_status.y = (y - pdc_yoffset) / pdc_fheight; + + if (event.wheel.y > 0) + SP->mouse_status.changes = PDC_MOUSE_WHEEL_UP; + else if (event.wheel.y < 0) + SP->mouse_status.changes = PDC_MOUSE_WHEEL_DOWN; + else if (event.wheel.x > 0) + SP->mouse_status.changes = PDC_MOUSE_WHEEL_RIGHT; + else if (event.wheel.x < 0) + SP->mouse_status.changes = PDC_MOUSE_WHEEL_LEFT; + else + return -1; + + SP->key_code = TRUE; + return KEY_MOUSE; + } + else + { + short action = (event.button.state == SDL_PRESSED) ? + BUTTON_PRESSED : BUTTON_RELEASED; + Uint8 btn = event.button.button; + + if (btn < 1 || btn > 3) + return -1; + + /* check for a click -- a press followed immediately by a release */ + + if (action == BUTTON_PRESSED && SP->mouse_wait) + { + SDL_Event rel; + + napms(SP->mouse_wait); + + if (SDL_PollEvent(&rel)) + { + if (rel.type == SDL_MOUSEBUTTONUP && rel.button.button == btn) + action = BUTTON_CLICKED; + else + SDL_PushEvent(&rel); + } + } + + SP->mouse_status.x = (event.button.x - pdc_xoffset) / pdc_fwidth; + SP->mouse_status.y = (event.button.y - pdc_yoffset) / pdc_fheight; + + btn--; + + SP->mouse_status.button[btn] = action | shift_flags; + SP->mouse_status.changes = (1 << btn); + } + + old_mouse_status = SP->mouse_status; + + SP->key_code = TRUE; + return KEY_MOUSE; +} + +/* return the next available key or mouse event */ + +int PDC_get_key(void) +{ + switch (event.type) + { + case SDL_QUIT: + exit(1); + case SDL_WINDOWEVENT: + if (SDL_WINDOWEVENT_SIZE_CHANGED == event.window.event) + { + pdc_screen = SDL_GetWindowSurface(pdc_window); + pdc_sheight = pdc_screen->h - pdc_xoffset; + pdc_swidth = pdc_screen->w - pdc_yoffset; + touchwin(curscr); + wrefresh(curscr); + + if (!SP->resized) + { + SP->resized = TRUE; + SP->key_code = TRUE; + return KEY_RESIZE; + } + } + break; + case SDL_MOUSEMOTION: + SDL_ShowCursor(SDL_ENABLE); + case SDL_MOUSEBUTTONUP: + case SDL_MOUSEBUTTONDOWN: + case SDL_MOUSEWHEEL: + oldkey = SDLK_SPACE; + return _process_mouse_event(); + case SDL_KEYUP: + case SDL_KEYDOWN: + case SDL_TEXTINPUT: + PDC_mouse_set(); + return _process_key_event(); + case SDL_USEREVENT: + PDC_blink_text(); + } + + return -1; +} + +/* discard any pending keyboard or mouse input -- this is the core + routine for flushinp() */ + +void PDC_flushinp(void) +{ + PDC_LOG(("PDC_flushinp() - called\n")); + + while (PDC_check_key()) + PDC_get_key(); +} + +bool PDC_has_mouse(void) +{ + return TRUE; +} + +int PDC_mouse_set(void) +{ + SDL_ShowCursor(SP->_trap_mbe ? SDL_ENABLE : SDL_DISABLE); + + return OK; +} + +int PDC_modifiers_set(void) +{ + return OK; +} diff --git a/vendor/pdcurses/sdl2/pdcscrn.c b/vendor/pdcurses/sdl2/pdcscrn.c new file mode 100644 index 0000000..14bb0c2 --- /dev/null +++ b/vendor/pdcurses/sdl2/pdcscrn.c @@ -0,0 +1,426 @@ +/* PDCurses */ + +#include "pdcsdl.h" + +#include +#ifndef PDC_WIDE +# include "../common/font437.h" +#endif +#include "../common/iconbmp.h" + +#ifdef PDC_WIDE +# ifndef PDC_FONT_PATH +# ifdef _WIN32 +# define PDC_FONT_PATH "C:/Windows/Fonts/consola.ttf" +# elif defined(__APPLE__) +# define PDC_FONT_PATH "/System/Library/Fonts/Menlo.ttc" +# else +# define PDC_FONT_PATH "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf" +# endif +# endif +TTF_Font *pdc_ttffont = NULL; +int pdc_font_size = +# ifdef _WIN32 + 16; +# else + 17; +# endif +#endif + +SDL_Window *pdc_window = NULL; +SDL_Surface *pdc_screen = NULL, *pdc_font = NULL, *pdc_icon = NULL, + *pdc_back = NULL, *pdc_tileback = NULL; +int pdc_sheight = 0, pdc_swidth = 0, pdc_yoffset = 0, pdc_xoffset = 0; + +SDL_Color pdc_color[PDC_MAXCOL]; +Uint32 pdc_mapped[PDC_MAXCOL]; +int pdc_fheight, pdc_fwidth, pdc_fthick, pdc_flastc; +bool pdc_own_window; + +static void _clean(void) +{ +#ifdef PDC_WIDE + if (pdc_ttffont) + { + TTF_CloseFont(pdc_ttffont); + TTF_Quit(); + } +#endif + SDL_FreeSurface(pdc_tileback); + SDL_FreeSurface(pdc_back); + SDL_FreeSurface(pdc_icon); + SDL_FreeSurface(pdc_font); + SDL_DestroyWindow(pdc_window); + SDL_Quit(); +} + +void PDC_retile(void) +{ + if (pdc_tileback) + SDL_FreeSurface(pdc_tileback); + + pdc_tileback = SDL_ConvertSurface(pdc_screen, pdc_screen->format, 0); + if (pdc_tileback == NULL) + return; + + if (pdc_back) + { + SDL_Rect dest; + + dest.y = 0; + + while (dest.y < pdc_tileback->h) + { + dest.x = 0; + + while (dest.x < pdc_tileback->w) + { + SDL_BlitSurface(pdc_back, 0, pdc_tileback, &dest); + dest.x += pdc_back->w; + } + + dest.y += pdc_back->h; + } + + SDL_BlitSurface(pdc_tileback, 0, pdc_screen, 0); + } +} + +void PDC_scr_close(void) +{ + PDC_LOG(("PDC_scr_close() - called\n")); +} + +void PDC_scr_free(void) +{ +} + +static void _initialize_colors(void) +{ + int i, r, g, b; + + for (i = 0; i < 8; i++) + { + pdc_color[i].r = (i & COLOR_RED) ? 0xc0 : 0; + pdc_color[i].g = (i & COLOR_GREEN) ? 0xc0 : 0; + pdc_color[i].b = (i & COLOR_BLUE) ? 0xc0 : 0; + + pdc_color[i + 8].r = (i & COLOR_RED) ? 0xff : 0x40; + pdc_color[i + 8].g = (i & COLOR_GREEN) ? 0xff : 0x40; + pdc_color[i + 8].b = (i & COLOR_BLUE) ? 0xff : 0x40; + } + + /* 256-color xterm extended palette: 216 colors in a 6x6x6 color + cube, plus 24 shades of gray */ + + for (i = 16, r = 0; r < 6; r++) + for (g = 0; g < 6; g++) + for (b = 0; b < 6; b++, i++) + { + pdc_color[i].r = (r ? r * 40 + 55 : 0); + pdc_color[i].g = (g ? g * 40 + 55 : 0); + pdc_color[i].b = (b ? b * 40 + 55 : 0); + } + + for (i = 232; i < 256; i++) + pdc_color[i].r = pdc_color[i].g = pdc_color[i].b = (i - 232) * 10 + 8; + + for (i = 0; i < 256; i++) + pdc_mapped[i] = SDL_MapRGB(pdc_screen->format, pdc_color[i].r, + pdc_color[i].g, pdc_color[i].b); +} + +/* find the display where the mouse pointer is */ + +int _get_displaynum(void) +{ + SDL_Rect size; + int i, xpos, ypos, displays; + + displays = SDL_GetNumVideoDisplays(); + + if (displays > 1) + { + SDL_GetGlobalMouseState(&xpos, &ypos); + + for (i = 0; i < displays; i++) + { + SDL_GetDisplayBounds(i, &size); + if (size.x <= xpos && xpos < size.x + size.w && + size.y <= ypos && ypos < size.y + size.h) + return i; + } + } + + return 0; +} + +/* open the physical screen -- miscellaneous initialization */ + +int PDC_scr_open(void) +{ + SDL_Event event; + int displaynum = 0; + + PDC_LOG(("PDC_scr_open() - called\n")); + + pdc_own_window = !pdc_window; + + if (pdc_own_window) + { + if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_EVENTS) < 0) + { + fprintf(stderr, "Could not start SDL: %s\n", SDL_GetError()); + return ERR; + } + + atexit(_clean); + + displaynum = _get_displaynum(); + } + +#ifdef PDC_WIDE + if (!pdc_ttffont) + { + const char *ptsz, *fname; + + if (TTF_Init() == -1) + { + fprintf(stderr, "Could not start SDL_TTF: %s\n", SDL_GetError()); + return ERR; + } + + ptsz = getenv("PDC_FONT_SIZE"); + if (ptsz != NULL) + pdc_font_size = atoi(ptsz); + if (pdc_font_size <= 0) + pdc_font_size = 18; + + fname = getenv("PDC_FONT"); + pdc_ttffont = TTF_OpenFont(fname ? fname : PDC_FONT_PATH, + pdc_font_size); + } + + if (!pdc_ttffont) + { + fprintf(stderr, "Could not load font\n"); + return ERR; + } + + TTF_SetFontKerning(pdc_ttffont, 0); + TTF_SetFontHinting(pdc_ttffont, TTF_HINTING_MONO); + + SP->mono = FALSE; +#else + if (!pdc_font) + { + const char *fname = getenv("PDC_FONT"); + pdc_font = SDL_LoadBMP(fname ? fname : "pdcfont.bmp"); + } + + if (!pdc_font) + pdc_font = SDL_LoadBMP_RW(SDL_RWFromMem(font437, sizeof(font437)), 0); + + if (!pdc_font) + { + fprintf(stderr, "Could not load font\n"); + return ERR; + } + + SP->mono = !pdc_font->format->palette; +#endif + + if (!SP->mono && !pdc_back) + { + const char *bname = getenv("PDC_BACKGROUND"); + pdc_back = SDL_LoadBMP(bname ? bname : "pdcback.bmp"); + } + + if (!SP->mono && (pdc_back || !pdc_own_window)) + { + SP->orig_attr = TRUE; + SP->orig_fore = COLOR_WHITE; + SP->orig_back = -1; + } + else + SP->orig_attr = FALSE; + +#ifdef PDC_WIDE + TTF_SizeText(pdc_ttffont, "W", &pdc_fwidth, &pdc_fheight); + pdc_fthick = pdc_font_size / 20 + 1; +#else + pdc_fheight = pdc_font->h / 8; + pdc_fwidth = pdc_font->w / 32; + pdc_fthick = 1; + + if (!SP->mono) + pdc_flastc = pdc_font->format->palette->ncolors - 1; +#endif + + if (pdc_own_window && !pdc_icon) + { + const char *iname = getenv("PDC_ICON"); + pdc_icon = SDL_LoadBMP(iname ? iname : "pdcicon.bmp"); + + if (!pdc_icon) + pdc_icon = SDL_LoadBMP_RW(SDL_RWFromMem(iconbmp, + sizeof(iconbmp)), 0); + } + + if (pdc_own_window) + { + const char *env = getenv("PDC_LINES"); + pdc_sheight = (env ? atoi(env) : 25) * pdc_fheight; + + env = getenv("PDC_COLS"); + pdc_swidth = (env ? atoi(env) : 80) * pdc_fwidth; + + pdc_window = SDL_CreateWindow("PDCurses", + SDL_WINDOWPOS_CENTERED_DISPLAY(displaynum), + SDL_WINDOWPOS_CENTERED_DISPLAY(displaynum), + pdc_swidth, pdc_sheight, SDL_WINDOW_RESIZABLE); + + if (pdc_window == NULL) + { + fprintf(stderr, "Could not open SDL window: %s\n", SDL_GetError()); + return ERR; + } + + SDL_SetWindowIcon(pdc_window, pdc_icon); + } + + /* Events must be pumped before calling SDL_GetWindowSurface, or + initial modifiers (e.g. numlock) will be ignored and out-of-sync. */ + + SDL_PumpEvents(); + + /* Wait until window is exposed before getting surface */ + + while (SDL_PollEvent(&event)) + if (SDL_WINDOWEVENT == event.type && + SDL_WINDOWEVENT_EXPOSED == event.window.event) + break; + + if (!pdc_screen) + { + pdc_screen = SDL_GetWindowSurface(pdc_window); + + if (!pdc_screen) + { + fprintf(stderr, "Could not open SDL window surface: %s\n", + SDL_GetError()); + return ERR; + } + } + + if (!pdc_sheight) + pdc_sheight = pdc_screen->h - pdc_yoffset; + + if (!pdc_swidth) + pdc_swidth = pdc_screen->w - pdc_xoffset; + + if (SP->orig_attr) + PDC_retile(); + + _initialize_colors(); + + SDL_StartTextInput(); + + PDC_mouse_set(); + + SP->mouse_wait = PDC_CLICK_PERIOD; + SP->audible = FALSE; + + SP->termattrs = A_COLOR | A_UNDERLINE | A_LEFT | A_RIGHT | A_REVERSE; +#ifdef PDC_WIDE + SP->termattrs |= A_ITALIC; +#endif + + PDC_reset_prog_mode(); + + return OK; +} + +/* the core of resize_term() */ + +int PDC_resize_screen(int nlines, int ncols) +{ + if (!pdc_own_window) + return ERR; + + if (nlines && ncols) + { +#if SDL_VERSION_ATLEAST(2, 0, 5) + SDL_Rect max; + int top, left, bottom, right; + + SDL_GetDisplayUsableBounds(0, &max); + SDL_GetWindowBordersSize(pdc_window, &top, &left, &bottom, &right); + max.h -= top + bottom; + max.w -= left + right; + + while (nlines * pdc_fheight > max.h) + nlines--; + while (ncols * pdc_fwidth > max.w) + ncols--; +#endif + pdc_sheight = nlines * pdc_fheight; + pdc_swidth = ncols * pdc_fwidth; + + SDL_SetWindowSize(pdc_window, pdc_swidth, pdc_sheight); + pdc_screen = SDL_GetWindowSurface(pdc_window); + } + + if (pdc_tileback) + PDC_retile(); + + return OK; +} + +void PDC_reset_prog_mode(void) +{ + PDC_LOG(("PDC_reset_prog_mode() - called.\n")); + + PDC_flushinp(); +} + +void PDC_reset_shell_mode(void) +{ + PDC_LOG(("PDC_reset_shell_mode() - called.\n")); + + PDC_flushinp(); +} + +void PDC_restore_screen_mode(int i) +{ +} + +void PDC_save_screen_mode(int i) +{ +} + +bool PDC_can_change_color(void) +{ + return TRUE; +} + +int PDC_color_content(short color, short *red, short *green, short *blue) +{ + *red = DIVROUND(pdc_color[color].r * 1000, 255); + *green = DIVROUND(pdc_color[color].g * 1000, 255); + *blue = DIVROUND(pdc_color[color].b * 1000, 255); + + return OK; +} + +int PDC_init_color(short color, short red, short green, short blue) +{ + pdc_color[color].r = DIVROUND(red * 255, 1000); + pdc_color[color].g = DIVROUND(green * 255, 1000); + pdc_color[color].b = DIVROUND(blue * 255, 1000); + + pdc_mapped[color] = SDL_MapRGB(pdc_screen->format, pdc_color[color].r, + pdc_color[color].g, pdc_color[color].b); + + return OK; +} diff --git a/vendor/pdcurses/sdl2/pdcsdl.h b/vendor/pdcurses/sdl2/pdcsdl.h new file mode 100644 index 0000000..d2e1f3c --- /dev/null +++ b/vendor/pdcurses/sdl2/pdcsdl.h @@ -0,0 +1,36 @@ +/* PDCurses */ + +#include +#ifdef PDC_WIDE +# include +#endif + +#include + +#ifdef PDC_WIDE +PDCEX TTF_Font *pdc_ttffont; +PDCEX int pdc_font_size; +#endif +PDCEX SDL_Window *pdc_window; +PDCEX SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back; +PDCEX int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset; + +extern SDL_Surface *pdc_tileback; /* used to regenerate the background + of "transparent" cells */ +extern SDL_Color pdc_color[PDC_MAXCOL]; /* colors for font palette */ +extern Uint32 pdc_mapped[PDC_MAXCOL]; /* colors for FillRect(), as + used in _highlight() */ +extern int pdc_fheight, pdc_fwidth; /* font height and width */ +extern int pdc_fthick; /* thickness for highlights and + rendered ACS glyphs */ +extern int pdc_flastc; /* font palette's last color + (treated as the foreground) */ +extern bool pdc_own_window; /* if pdc_window was not set + before initscr(), PDCurses is + responsible for (owns) it */ + +PDCEX void PDC_update_rects(void); +PDCEX void PDC_retile(void); + +extern void PDC_pump_and_peep(void); +extern void PDC_blink_text(void); diff --git a/vendor/pdcurses/sdl2/pdcsetsc.c b/vendor/pdcurses/sdl2/pdcsetsc.c new file mode 100644 index 0000000..a1cbb56 --- /dev/null +++ b/vendor/pdcurses/sdl2/pdcsetsc.c @@ -0,0 +1,108 @@ +/* PDCurses */ + +#include "pdcsdl.h" + +/*man-start************************************************************** + +pdcsetsc +-------- + +### Synopsis + + int PDC_set_blink(bool blinkon); + int PDC_set_bold(bool boldon); + void PDC_set_title(const char *title); + +### Description + + PDC_set_blink() toggles whether the A_BLINK attribute sets an actual + blink mode (TRUE), or sets the background color to high intensity + (FALSE). The default is platform-dependent (FALSE in most cases). It + returns OK if it could set the state to match the given parameter, + ERR otherwise. + + PDC_set_bold() toggles whether the A_BOLD attribute selects an actual + bold font (TRUE), or sets the foreground color to high intensity + (FALSE). It returns OK if it could set the state to match the given + parameter, ERR otherwise. + + PDC_set_title() sets the title of the window in which the curses + program is running. This function may not do anything on some + platforms. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + PDC_set_blink | - | - | - + PDC_set_bold | - | - | - + PDC_set_title | - | - | - + +**man-end****************************************************************/ + +int PDC_curs_set(int visibility) +{ + int ret_vis; + + PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); + + ret_vis = SP->visibility; + + SP->visibility = visibility; + + PDC_gotoyx(SP->cursrow, SP->curscol); + + return ret_vis; +} + +void PDC_set_title(const char *title) +{ + PDC_LOG(("PDC_set_title() - called:<%s>\n", title)); + + SDL_SetWindowTitle(pdc_window, title); +} + +int PDC_set_blink(bool blinkon) +{ + if (!SP) + return ERR; + + if (SP->color_started) + COLORS = PDC_MAXCOL; + + if (blinkon) + { + if (!(SP->termattrs & A_BLINK)) + { + SP->termattrs |= A_BLINK; + PDC_blink_text(); + } + } + else + { + if (SP->termattrs & A_BLINK) + { + SP->termattrs &= ~A_BLINK; + PDC_blink_text(); + } + } + + return OK; +} + +int PDC_set_bold(bool boldon) +{ + if (!SP) + return ERR; + +#ifdef PDC_WIDE + if (boldon) + SP->termattrs |= A_BOLD; + else + SP->termattrs &= ~A_BOLD; + + return OK; +#else + return boldon ? ERR : OK; +#endif +} diff --git a/vendor/pdcurses/sdl2/pdcutil.c b/vendor/pdcurses/sdl2/pdcutil.c new file mode 100644 index 0000000..ffa2eac --- /dev/null +++ b/vendor/pdcurses/sdl2/pdcutil.c @@ -0,0 +1,27 @@ +/* PDCurses */ + +#include "pdcsdl.h" + +void PDC_beep(void) +{ + PDC_LOG(("PDC_beep() - called\n")); +} + +void PDC_napms(int ms) +{ + PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); + + while (ms > 50) + { + PDC_pump_and_peep(); + SDL_Delay(50); + ms -= 50; + } + PDC_pump_and_peep(); + SDL_Delay(ms); +} + +const char *PDC_sysname(void) +{ + return "SDL2"; +} diff --git a/vendor/pdcurses/sdl2/sdltest.c b/vendor/pdcurses/sdl2/sdltest.c new file mode 100644 index 0000000..9dc0c2c --- /dev/null +++ b/vendor/pdcurses/sdl2/sdltest.c @@ -0,0 +1,84 @@ +/* Here's a simple example of combining SDL and PDCurses functionality. + The top portion of the window is devoted to SDL, with a four-line + (assuming the default 8x16 font) stdscr at the bottom. +*/ + +#define SDL_MAIN_HANDLED + +#include +#include +#include +#include + +/* You could #include pdcsdl.h, or just add the relevant declarations + here: */ + +PDCEX SDL_Window *pdc_window; +PDCEX SDL_Surface *pdc_screen; +PDCEX int pdc_yoffset; + +int main(int argc, char **argv) +{ + char inp[60]; + int i, j, seed; + + seed = time((time_t *)0); + srand(seed); + + /* Initialize SDL */ + + if (SDL_Init(SDL_INIT_VIDEO) < 0) + exit(1); + + atexit(SDL_Quit); + + pdc_window = SDL_CreateWindow("PDCurses for SDL", SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, 640, 480, 0); + pdc_screen = SDL_GetWindowSurface(pdc_window); + + /* Initialize PDCurses */ + + pdc_yoffset = 416; /* 480 - 4 * 16 */ + + initscr(); + start_color(); + scrollok(stdscr, TRUE); + + PDC_set_title("PDCurses for SDL"); + + /* Do some SDL stuff */ + + for (i = 640, j = 416; j; i -= 2, j -= 2) + { + SDL_Rect dest; + + dest.x = (640 - i) / 2; + dest.y = (416 - j) / 2; + dest.w = i; + dest.h = j; + + SDL_FillRect(pdc_screen, &dest, + SDL_MapRGB(pdc_screen->format, rand() % 256, + rand() % 256, rand() % 256)); + } + + SDL_UpdateWindowSurface(pdc_window); + + /* Do some curses stuff */ + + init_pair(1, COLOR_WHITE + 8, COLOR_BLUE); + bkgd(COLOR_PAIR(1)); + + addstr("This is a demo of "); + attron(A_UNDERLINE); + addstr("PDCurses for SDL"); + attroff(A_UNDERLINE); + addstr(".\nYour comments here: "); + getnstr(inp, 59); + addstr("Press any key to exit."); + + getch(); + endwin(); + + return 0; +} diff --git a/vendor/pdcurses/sdl2/versions.mif b/vendor/pdcurses/sdl2/versions.mif new file mode 100644 index 0000000..3b93aa7 --- /dev/null +++ b/vendor/pdcurses/sdl2/versions.mif @@ -0,0 +1,2 @@ +SDLBASE = C:\SDL2-2.0.10 +TTFBASE = C:\SDL2_ttf-2.0.15 diff --git a/vendor/pdcurses/wincon/Makefile b/vendor/pdcurses/wincon/Makefile new file mode 100644 index 0000000..b7d7c90 --- /dev/null +++ b/vendor/pdcurses/wincon/Makefile @@ -0,0 +1,115 @@ +# GNU Makefile for PDCurses - Windows console +# +# Usage: make [-f path\Makefile] [DEBUG=Y] [DLL=Y] [WIDE=Y] [UTF8=Y] +# [INFOEX=N] [tgt] +# +# where tgt can be any of: +# [all|demos|pdcurses.a|testcurs.exe...] + +O = o +E = .exe + +ifeq ($(OS),Windows_NT) + RM = cmd /c del +else + RM = rm -f +endif + +ifndef PDCURSES_SRCDIR + PDCURSES_SRCDIR = .. +endif + +osdir = $(PDCURSES_SRCDIR)/wincon +common = $(PDCURSES_SRCDIR)/common + +include $(common)/libobjs.mif + +PDCURSES_WIN_H = $(osdir)/pdcwin.h + +CC = gcc +AR = ar +STRIP = strip +LINK = gcc +WINDRES = windres + +ifeq ($(DEBUG),Y) + CFLAGS = -g -Wall -DPDCDEBUG + LDFLAGS = -g +else + CFLAGS = -O2 -Wall + LDFLAGS = +endif + +CFLAGS += -I$(PDCURSES_SRCDIR) + +ifeq ($(WIDE),Y) + CFLAGS += -DPDC_WIDE +endif + +ifeq ($(UTF8),Y) + CFLAGS += -DPDC_FORCE_UTF8 +endif + +ifeq ($(DLL),Y) + CFLAGS += -DPDC_DLL_BUILD + LIBEXE = $(CC) + LIBFLAGS = -Wl,--out-implib,pdcurses.a -shared -o + LIBCURSES = pdcurses.dll + CLEAN = $(LIBCURSES) *.a + RESOURCE = pdcurses.o +else + LIBEXE = $(AR) + LIBFLAGS = rcv + LIBCURSES = pdcurses.a + CLEAN = *.a +endif + +ifeq ($(INFOEX),N) + CFLAGS += -DHAVE_NO_INFOEX +endif + +.PHONY: all libs clean demos dist + +all: libs + +libs: $(LIBCURSES) + +clean: + -$(RM) *.o + -$(RM) *.exe + -$(RM) $(CLEAN) + +demos: $(DEMOS) +ifneq ($(DEBUG),Y) + $(STRIP) *.exe +endif + +$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(RESOURCE) + $(LIBEXE) $(LIBFLAGS) $@ $? + +pdcurses.o: $(common)/pdcurses.rc + $(WINDRES) -i $(common)/pdcurses.rc pdcurses.o + +$(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) +$(PDCOBJS) : $(PDCURSES_WIN_H) +$(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) +panel.o : $(PANEL_HEADER) + +$(LIBOBJS) : %.o: $(srcdir)/%.c + $(CC) -c $(CFLAGS) $< + +$(PDCOBJS) : %.o: $(osdir)/%.c + $(CC) -c $(CFLAGS) $< + +firework.exe ozdemo.exe rain.exe testcurs.exe worm.exe xmas.exe \ +ptest.exe: %.exe: $(demodir)/%.c + $(CC) $(CFLAGS) -o$@ $< $(LIBCURSES) + +tuidemo.exe: tuidemo.o tui.o + $(LINK) $(LDFLAGS) -o$@ tuidemo.o tui.o $(LIBCURSES) + +tui.o: $(demodir)/tui.c $(demodir)/tui.h $(PDCURSES_CURSES_H) + $(CC) -c $(CFLAGS) -I$(demodir) -o$@ $< + +tuidemo.o: $(demodir)/tuidemo.c $(PDCURSES_CURSES_H) + $(CC) -c $(CFLAGS) -I$(demodir) -o$@ $< diff --git a/vendor/pdcurses/wincon/Makefile.bcc b/vendor/pdcurses/wincon/Makefile.bcc new file mode 100644 index 0000000..0dc4e5f --- /dev/null +++ b/vendor/pdcurses/wincon/Makefile.bcc @@ -0,0 +1,87 @@ +# Borland Makefile for PDCurses - Windows console +# +# Usage: make -f [path\]Makefile.bcc [DEBUG=Y] [WIDE=Y] [UTF8=Y] +# [INFOEX=N] [target] +# +# where target can be any of: +# [all|demos|pdcurses.lib|testcurs.exe...] + +O = obj +E = .exe +RM = del + +!ifndef PDCURSES_SRCDIR +PDCURSES_SRCDIR = .. +!endif + +!include $(PDCURSES_SRCDIR)\common\libobjs.mif + +osdir = $(PDCURSES_SRCDIR)\wincon + +CC = bcc32c -q + +!ifdef DEBUG +CFLAGS = -N -v -y -DPDCDEBUG +!else +CFLAGS = -O +!endif + +!ifdef WIDE +WIDEOPT = -DPDC_WIDE +!endif + +!ifdef UTF8 +UTF8OPT = -DPDC_FORCE_UTF8 +!endif + +!ifdef INFOEX +INFOPT = -DHAVE_NO_INFOEX +!endif + +BUILD = $(CC) -I$(PDCURSES_SRCDIR) -c -Tpe $(CFLAGS) \ +$(WIDEOPT) $(UTF8OPT) $(INFOPT) +BUILD_OS = $(BUILD) -Xdriver -Wno-deprecated-declarations + +LIBEXE = tlib /C /E /0 /a + +LIBCURSES = pdcurses.lib + +all: $(LIBCURSES) + +clean: + -$(RM) *.obj + -$(RM) *.lib + -$(RM) *.tds + -$(RM) *.exe + +demos: $(LIBCURSES) $(DEMOS) + +$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) + -$(RM) $@ + $(LIBEXE) $@ $(LIBOBJS) $(PDCOBJS) + +.autodepend + +{$(srcdir)\}.c.obj: + $(BUILD) $< + +{$(osdir)\}.c.obj: + $(BUILD_OS) $< + +{$(demodir)\}.c.obj: + $(BUILD) $< + +.c.obj: + $(BUILD_OS) $< + +.obj.exe: + $(CC) -e$@ $** $(LIBCURSES) + +tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES) + $(CC) -e$@ $** + +tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(PDCURSES_CURSES_H) + $(BUILD) -I$(demodir) $(demodir)\tui.c + +tuidemo.obj: $(demodir)\tuidemo.c $(PDCURSES_CURSES_H) + $(BUILD) -I$(demodir) $(demodir)\tuidemo.c diff --git a/vendor/pdcurses/wincon/Makefile.vc b/vendor/pdcurses/wincon/Makefile.vc new file mode 100644 index 0000000..80c4689 --- /dev/null +++ b/vendor/pdcurses/wincon/Makefile.vc @@ -0,0 +1,120 @@ +# Visual C++ Makefile for PDCurses - Windows console +# +# Usage: nmake -f [path\]Makefile.vc [DEBUG=Y] [DLL=Y] [WIDE=Y] [UTF8=Y] +# [INFOEX=N] [target] +# +# where target can be any of: +# [all|demos|pdcurses.lib|testcurs.exe...] + +O = obj +E = .exe +RM = del + +!ifndef PDCURSES_SRCDIR +PDCURSES_SRCDIR = .. +!endif + +!include $(PDCURSES_SRCDIR)\common\libobjs.mif + +osdir = $(PDCURSES_SRCDIR)\wincon +common = $(PDCURSES_SRCDIR)\common + +PDCURSES_WIN_H = $(osdir)\pdcwin.h + +CC = cl.exe -nologo + +!ifdef DEBUG +CFLAGS = -Z7 -DPDCDEBUG +LDFLAGS = -debug -pdb:none +!else +CFLAGS = -O1 +LDFLAGS = +!endif + +!ifdef WIDE +WIDEOPT = -DPDC_WIDE +!endif + +!ifdef UTF8 +UTF8OPT = -DPDC_FORCE_UTF8 +!endif + +!ifdef INFOEX +INFOPT = -DHAVE_NO_INFOEX +!endif + +SHL_LD = link $(LDFLAGS) -nologo -dll -machine:$(PLATFORM) -out:pdcurses.dll + +LINK = link.exe -nologo + +CCLIBS = user32.lib advapi32.lib +# may need to add msvcrt for older compilers +#CCLIBS = msvcrt.lib user32.lib advapi32.lib + +LIBEXE = lib -nologo + +LIBCURSES = pdcurses.lib +CURSESDLL = pdcurses.dll + +!ifdef DLL +DLLOPT = -DPDC_DLL_BUILD +PDCLIBS = $(CURSESDLL) +!else +PDCLIBS = $(LIBCURSES) +!endif + +BUILD = $(CC) -I$(PDCURSES_SRCDIR) -c $(CFLAGS) $(DLLOPT) \ +$(WIDEOPT) $(UTF8OPT) $(INFOPT) + +all: $(PDCLIBS) + +clean: + -$(RM) *.obj + -$(RM) *.lib + -$(RM) *.exe + -$(RM) *.dll + -$(RM) *.exp + -$(RM) *.res + +demos: $(PDCLIBS) $(DEMOS) + +DEMOOBJS = $(DEMOS:.exe=.obj) tui.obj + +$(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) +$(PDCOBJS) : $(PDCURSES_WIN_H) +$(DEMOOBJS) : $(PDCURSES_CURSES_H) +$(DEMOS) : $(LIBCURSES) +panel.obj : $(PANEL_HEADER) + +!ifndef DLL +$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) + $(LIBEXE) -out:$@ $(LIBOBJS) $(PDCOBJS) +!endif + +$(CURSESDLL) : $(LIBOBJS) $(PDCOBJS) pdcurses.obj + $(SHL_LD) $(LIBOBJS) $(PDCOBJS) pdcurses.obj $(CCLIBS) + +pdcurses.res pdcurses.obj: $(common)\pdcurses.rc + rc -r -fopdcurses.res $(common)\pdcurses.rc + cvtres -machine:$(PLATFORM) -nologo -out:pdcurses.obj pdcurses.res + +{$(srcdir)\}.c{}.obj:: + $(BUILD) $< + +{$(osdir)\}.c{}.obj:: + $(BUILD) $< + +{$(demodir)\}.c{}.obj:: + $(BUILD) $< + +.obj.exe: + $(LINK) $(LDFLAGS) $< $(LIBCURSES) $(CCLIBS) + +tuidemo.exe: tuidemo.obj tui.obj + $(LINK) $(LDFLAGS) $*.obj tui.obj $(LIBCURSES) $(CCLIBS) + +tui.obj: $(demodir)\tui.c $(demodir)\tui.h + $(BUILD) -I$(demodir) $(demodir)\tui.c + +tuidemo.obj: $(demodir)\tuidemo.c + $(BUILD) -I$(demodir) $(demodir)\tuidemo.c diff --git a/vendor/pdcurses/wincon/Makefile.wcc b/vendor/pdcurses/wincon/Makefile.wcc new file mode 100644 index 0000000..d769c9f --- /dev/null +++ b/vendor/pdcurses/wincon/Makefile.wcc @@ -0,0 +1,37 @@ +# Watcom Makefile for PDCurses - Windows console +# +# Usage: wmake -f [path\]Makefile.wcc [DEBUG=Y] [WIDE=Y] [UTF8=Y] +# [INFOEX=N] [target] +# +# where target can be any of: +# [all|demos|pdcurses.lib|testcurs.exe...] + +!ifdef %PDCURSES_SRCDIR +PDCURSES_SRCDIR = $(%PDCURSES_SRCDIR) +!else +PDCURSES_SRCDIR = .. +!endif + +osdir = $(PDCURSES_SRCDIR)/wincon + +CC = wcc386 +TARGET = nt + +CFLAGS = -bt=$(TARGET) + +!ifeq WIDE Y +CFLAGS += -DPDC_WIDE +!endif + +!ifeq UTF8 Y +CFLAGS += -DPDC_FORCE_UTF8 +!endif + +!ifeq INFOEX N +CFLAGS += -DHAVE_NO_INFOEX +!endif + +!include $(PDCURSES_SRCDIR)/common/watcom.mif + +$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) + $(LIBEXE) $@ $(LIBOBJS) $(PDCOBJS) diff --git a/vendor/pdcurses/wincon/README.md b/vendor/pdcurses/wincon/README.md new file mode 100644 index 0000000..0c34e85 --- /dev/null +++ b/vendor/pdcurses/wincon/README.md @@ -0,0 +1,70 @@ +PDCurses for Windows console +============================ + +This directory contains PDCurses source code files specific to the +Microsoft Windows console. Although historically called "Win32", this +port can just as easily be built for 64-bit systems. Windows 95 through +Windows 10 are covered. (Some features require later versions.) + + +Building +-------- + +- Choose the appropriate makefile for your compiler: + + Makefile - GCC (MinGW or Cygnus) + Makefile.bcc - Borland C++ + Makefile.vc - Microsoft Visual C++ + Makefile.wcc - Watcom + +- Optionally, you can build in a different directory than the platform + directory by setting PDCURSES_SRCDIR to point to the directory where + you unpacked PDCurses, and changing to your target directory: + + set PDCURSES_SRCDIR=c:\pdcurses + +- Build it: + + make -f makefilename + + (For Watcom, use "wmake" instead of "make"; for MSVC, "nmake"; for + MinGW, "mingw32-make".) You'll get the library (pdcurses.lib or .a, + depending on your compiler) and a lot of object files. + + You can also give the optional parameter "WIDE=Y", to build the + library with wide-character (Unicode) support: + + wmake -f Makefile.wcc WIDE=Y + + When built this way, the library is not compatible with Windows 9x, + unless you also link with the Microsoft Layer for Unicode (not + tested). + + Another option, "UTF8=Y", makes PDCurses ignore the system locale, and + treat all narrow-character strings as UTF-8. This option has no effect + unless WIDE=Y is also set. Use it to get around the poor support for + UTF-8 in the Windows console: + + make -f Makefile.bcc WIDE=Y UTF8=Y + + You can also use the optional parameter "DLL=Y" with Visual C++, + MinGW or Cygwin, to build the library as a DLL: + + nmake -f Makefile.vc WIDE=Y DLL=Y + + When you build the library as a Windows DLL, you must always define + PDC_DLL_BUILD when linking against it. (Or, if you only want to use + the DLL, you could add this definition to your curses.h.) + + Add the target "demos" to build the sample programs. + +- If your build stops with errors about PCONSOLE_SCREEN_BUFFER_INFOEX, + add the parameter "INFOEX=N" to your make command line and try again. + (This will happen with older compile environments.) + + +Acknowledgements +---------------- + +Windows console port was originally provided by Chris Szurgot + diff --git a/vendor/pdcurses/wincon/pdcclip.c b/vendor/pdcurses/wincon/pdcclip.c new file mode 100644 index 0000000..888c8d6 --- /dev/null +++ b/vendor/pdcurses/wincon/pdcclip.c @@ -0,0 +1,150 @@ +/* PDCurses */ + +#include "pdcwin.h" + +#include + +/*man-start************************************************************** + +clipboard +--------- + +### Synopsis + + int PDC_getclipboard(char **contents, long *length); + int PDC_setclipboard(const char *contents, long length); + int PDC_freeclipboard(char *contents); + int PDC_clearclipboard(void); + +### Description + + PDC_getclipboard() gets the textual contents of the system's + clipboard. This function returns the contents of the clipboard in the + contents argument. It is the responsibility of the caller to free the + memory returned, via PDC_freeclipboard(). The length of the clipboard + contents is returned in the length argument. + + PDC_setclipboard copies the supplied text into the system's + clipboard, emptying the clipboard prior to the copy. + + PDC_clearclipboard() clears the internal clipboard. + +### Return Values + + PDC_CLIP_SUCCESS the call was successful + PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for + the clipboard contents + PDC_CLIP_EMPTY the clipboard contains no text + PDC_CLIP_ACCESS_ERROR no clipboard support + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + PDC_getclipboard | - | - | - + PDC_setclipboard | - | - | - + PDC_freeclipboard | - | - | - + PDC_clearclipboard | - | - | - + +**man-end****************************************************************/ + +#ifdef PDC_WIDE +# define PDC_TEXT CF_UNICODETEXT +#else +# define PDC_TEXT CF_OEMTEXT +#endif + +int PDC_getclipboard(char **contents, long *length) +{ + HANDLE handle; + long len; + + PDC_LOG(("PDC_getclipboard() - called\n")); + + if (!OpenClipboard(NULL)) + return PDC_CLIP_ACCESS_ERROR; + + if ((handle = GetClipboardData(PDC_TEXT)) == NULL) + { + CloseClipboard(); + return PDC_CLIP_EMPTY; + } + +#ifdef PDC_WIDE + len = wcslen((wchar_t *)handle) * 3; +#else + len = strlen((char *)handle); +#endif + *contents = (char *)GlobalAlloc(GMEM_FIXED, len + 1); + + if (!*contents) + { + CloseClipboard(); + return PDC_CLIP_MEMORY_ERROR; + } + +#ifdef PDC_WIDE + len = PDC_wcstombs((char *)*contents, (wchar_t *)handle, len); +#else + strcpy((char *)*contents, (char *)handle); +#endif + *length = len; + CloseClipboard(); + + return PDC_CLIP_SUCCESS; +} + +int PDC_setclipboard(const char *contents, long length) +{ + HGLOBAL ptr1; + LPTSTR ptr2; + + PDC_LOG(("PDC_setclipboard() - called\n")); + + if (!OpenClipboard(NULL)) + return PDC_CLIP_ACCESS_ERROR; + + ptr1 = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, + (length + 1) * sizeof(TCHAR)); + + if (!ptr1) + return PDC_CLIP_MEMORY_ERROR; + + ptr2 = GlobalLock(ptr1); + +#ifdef PDC_WIDE + PDC_mbstowcs((wchar_t *)ptr2, contents, length); +#else + memcpy((char *)ptr2, contents, length + 1); +#endif + GlobalUnlock(ptr1); + EmptyClipboard(); + + if (!SetClipboardData(PDC_TEXT, ptr1)) + { + GlobalFree(ptr1); + return PDC_CLIP_ACCESS_ERROR; + } + + CloseClipboard(); + GlobalFree(ptr1); + + return PDC_CLIP_SUCCESS; +} + +int PDC_freeclipboard(char *contents) +{ + PDC_LOG(("PDC_freeclipboard() - called\n")); + + GlobalFree(contents); + return PDC_CLIP_SUCCESS; +} + +int PDC_clearclipboard(void) +{ + PDC_LOG(("PDC_clearclipboard() - called\n")); + + EmptyClipboard(); + + return PDC_CLIP_SUCCESS; +} diff --git a/vendor/pdcurses/wincon/pdcdisp.c b/vendor/pdcurses/wincon/pdcdisp.c new file mode 100644 index 0000000..fdaec76 --- /dev/null +++ b/vendor/pdcurses/wincon/pdcdisp.c @@ -0,0 +1,329 @@ +/* PDCurses */ + +#include "pdcwin.h" + +#include +#include + +#ifdef PDC_WIDE +# include "../common/acsuni.h" +#else +# include "../common/acs437.h" +#endif + +DWORD pdc_last_blink; +static bool blinked_off = FALSE; +static bool in_italic = FALSE; + +/* position hardware cursor at (y, x) */ + +void PDC_gotoyx(int row, int col) +{ + COORD coord; + + PDC_LOG(("PDC_gotoyx() - called: row %d col %d from row %d col %d\n", + row, col, SP->cursrow, SP->curscol)); + + coord.X = col; + coord.Y = row; + + SetConsoleCursorPosition(pdc_con_out, coord); +} + +void _set_ansi_color(short f, short b, attr_t attr) +{ + char esc[64], *p; + short tmp, underline; + bool italic; + + if (f < 16 && !pdc_color[f].mapped) + f = pdc_curstoansi[f]; + + if (b < 16 && !pdc_color[b].mapped) + b = pdc_curstoansi[b]; + + if (attr & A_REVERSE) + { + tmp = f; + f = b; + b = tmp; + } + attr &= SP->termattrs; + italic = !!(attr & A_ITALIC); + underline = !!(attr & A_UNDERLINE); + + p = esc + sprintf(esc, "\x1b["); + + if (f != pdc_oldf) + { + if (f < 8 && !pdc_color[f].mapped) + p += sprintf(p, "%d", f + 30); + else if (f < 16 && !pdc_color[f].mapped) + p += sprintf(p, "%d", f + 82); + else if (f < 256 && !pdc_color[f].mapped) + p += sprintf(p, "38;5;%d", f); + else + { + short red = DIVROUND(pdc_color[f].r * 255, 1000); + short green = DIVROUND(pdc_color[f].g * 255, 1000); + short blue = DIVROUND(pdc_color[f].b * 255, 1000); + + p += sprintf(p, "38;2;%d;%d;%d", red, green, blue); + } + + pdc_oldf = f; + } + + if (b != pdc_oldb) + { + if (strlen(esc) > 2) + p += sprintf(p, ";"); + + if (b < 8 && !pdc_color[b].mapped) + p += sprintf(p, "%d", b + 40); + else if (b < 16 && !pdc_color[b].mapped) + p += sprintf(p, "%d", b + 92); + else if (b < 256 && !pdc_color[b].mapped) + p += sprintf(p, "48;5;%d", b); + else + { + short red = DIVROUND(pdc_color[b].r * 255, 1000); + short green = DIVROUND(pdc_color[b].g * 255, 1000); + short blue = DIVROUND(pdc_color[b].b * 255, 1000); + + p += sprintf(p, "48;2;%d;%d;%d", red, green, blue); + } + + pdc_oldb = b; + } + + if (italic != in_italic) + { + if (strlen(esc) > 2) + p += sprintf(p, ";"); + + if (italic) + p += sprintf(p, "3"); + else + p += sprintf(p, "23"); + + in_italic = italic; + } + + if (underline != pdc_oldu) + { + if (strlen(esc) > 2) + p += sprintf(p, ";"); + + if (underline) + p += sprintf(p, "4"); + else + p += sprintf(p, "24"); + + pdc_oldu = underline; + } + + if (strlen(esc) > 2) + { + sprintf(p, "m"); + if (!pdc_conemu) + SetConsoleMode(pdc_con_out, 0x0015); + + WriteConsoleA(pdc_con_out, esc, strlen(esc), NULL, NULL); + + if (!pdc_conemu) + SetConsoleMode(pdc_con_out, 0x0010); + } +} + +void _new_packet(attr_t attr, int lineno, int x, int len, const chtype *srcp) +{ + int j; + short fore, back; + bool blink, ansi; + + if (pdc_ansi && (lineno == (SP->lines - 1)) && ((x + len) == SP->cols)) + { + len--; + if (len) + _new_packet(attr, lineno, x, len, srcp); + pdc_ansi = FALSE; + _new_packet(attr, lineno, x + len, 1, srcp + len); + pdc_ansi = TRUE; + return; + } + + pair_content(PAIR_NUMBER(attr), &fore, &back); + ansi = pdc_ansi || (fore >= 16 || back >= 16); + blink = (SP->termattrs & A_BLINK) && (attr & A_BLINK); + + if (blink) + { + attr &= ~A_BLINK; + if (blinked_off) + attr &= ~(A_UNDERLINE | A_RIGHT | A_LEFT); + } + + if (attr & A_BOLD) + fore |= 8; + if (attr & A_BLINK) + back |= 8; + + if (ansi) + { +#ifdef PDC_WIDE + WCHAR buffer[512]; +#else + char buffer[512]; +#endif + for (j = 0; j < len; j++) + { + chtype ch = srcp[j]; + + if (ch & A_ALTCHARSET && !(ch & 0xff80)) + { + ch = acs_map[ch & 0x7f]; + + if (pdc_wt && (ch & A_CHARTEXT) < ' ') + goto NONANSI; + } + + if (blink && blinked_off) + ch = ' '; + + buffer[j] = ch & A_CHARTEXT; + } + + PDC_gotoyx(lineno, x); + _set_ansi_color(fore, back, attr); +#ifdef PDC_WIDE + WriteConsoleW(pdc_con_out, buffer, len, NULL, NULL); +#else + WriteConsoleA(pdc_con_out, buffer, len, NULL, NULL); +#endif + } + else +NONANSI: + { + CHAR_INFO buffer[512]; + COORD bufSize, bufPos; + SMALL_RECT sr; + WORD mapped_attr; + + fore = pdc_curstoreal[fore]; + back = pdc_curstoreal[back]; + + if (attr & A_REVERSE) + mapped_attr = back | (fore << 4); + else + mapped_attr = fore | (back << 4); + + if (attr & A_UNDERLINE) + mapped_attr |= 0x8000; /* COMMON_LVB_UNDERSCORE */ + if (attr & A_LEFT) + mapped_attr |= 0x0800; /* COMMON_LVB_GRID_LVERTICAL */ + if (attr & A_RIGHT) + mapped_attr |= 0x1000; /* COMMON_LVB_GRID_RVERTICAL */ + + for (j = 0; j < len; j++) + { + chtype ch = srcp[j]; + + if (ch & A_ALTCHARSET && !(ch & 0xff80)) + ch = acs_map[ch & 0x7f]; + + if (blink && blinked_off) + ch = ' '; + + buffer[j].Attributes = mapped_attr; + buffer[j].Char.UnicodeChar = ch & A_CHARTEXT; + } + + bufPos.X = bufPos.Y = 0; + bufSize.X = len; + bufSize.Y = 1; + + sr.Top = sr.Bottom = lineno; + sr.Left = x; + sr.Right = x + len - 1; + + WriteConsoleOutput(pdc_con_out, buffer, bufSize, bufPos, &sr); + } +} + +/* update the given physical line to look like the corresponding line in + curscr */ + +void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) +{ + attr_t old_attr, attr; + int i, j; + + PDC_LOG(("PDC_transform_line() - called: lineno=%d\n", lineno)); + + old_attr = *srcp & (A_ATTRIBUTES ^ A_ALTCHARSET); + + for (i = 1, j = 1; j < len; i++, j++) + { + attr = srcp[i] & (A_ATTRIBUTES ^ A_ALTCHARSET); + + if (attr != old_attr) + { + _new_packet(old_attr, lineno, x, i, srcp); + old_attr = attr; + srcp += i; + x += i; + i = 0; + } + } + + _new_packet(old_attr, lineno, x, i, srcp); +} + +void PDC_blink_text(void) +{ + CONSOLE_CURSOR_INFO cci; + int i, j, k; + bool oldvis; + + GetConsoleCursorInfo(pdc_con_out, &cci); + oldvis = cci.bVisible; + if (oldvis) + { + cci.bVisible = FALSE; + SetConsoleCursorInfo(pdc_con_out, &cci); + } + + if (!(SP->termattrs & A_BLINK)) + blinked_off = FALSE; + else + blinked_off = !blinked_off; + + for (i = 0; i < SP->lines; i++) + { + const chtype *srcp = curscr->_y[i]; + + for (j = 0; j < SP->cols; j++) + if (srcp[j] & A_BLINK) + { + k = j; + while (k < SP->cols && (srcp[k] & A_BLINK)) + k++; + PDC_transform_line(i, j, k - j, srcp + j); + j = k; + } + } + + PDC_gotoyx(SP->cursrow, SP->curscol); + if (oldvis) + { + cci.bVisible = TRUE; + SetConsoleCursorInfo(pdc_con_out, &cci); + } + + pdc_last_blink = GetTickCount(); +} + +void PDC_doupdate(void) +{ +} diff --git a/vendor/pdcurses/wincon/pdcgetsc.c b/vendor/pdcurses/wincon/pdcgetsc.c new file mode 100644 index 0000000..a8323eb --- /dev/null +++ b/vendor/pdcurses/wincon/pdcgetsc.c @@ -0,0 +1,42 @@ +/* PDCurses */ + +#include "pdcwin.h" + +/* get the cursor size/shape */ + +int PDC_get_cursor_mode(void) +{ + CONSOLE_CURSOR_INFO ci; + + PDC_LOG(("PDC_get_cursor_mode() - called\n")); + + GetConsoleCursorInfo(pdc_con_out, &ci); + + return ci.dwSize; +} + +/* return number of screen rows */ + +int PDC_get_rows(void) +{ + CONSOLE_SCREEN_BUFFER_INFO scr; + + PDC_LOG(("PDC_get_rows() - called\n")); + + GetConsoleScreenBufferInfo(pdc_con_out, &scr); + + return scr.srWindow.Bottom - scr.srWindow.Top + 1; +} + +/* return width of screen/viewport */ + +int PDC_get_columns(void) +{ + CONSOLE_SCREEN_BUFFER_INFO scr; + + PDC_LOG(("PDC_get_columns() - called\n")); + + GetConsoleScreenBufferInfo(pdc_con_out, &scr); + + return scr.srWindow.Right - scr.srWindow.Left + 1; +} diff --git a/vendor/pdcurses/wincon/pdckbd.c b/vendor/pdcurses/wincon/pdckbd.c new file mode 100644 index 0000000..cbab60d --- /dev/null +++ b/vendor/pdcurses/wincon/pdckbd.c @@ -0,0 +1,693 @@ +/* PDCurses */ + +#include "pdcwin.h" + +/* These variables are used to store information about the next + Input Event. */ + +static INPUT_RECORD save_ip; +static MOUSE_STATUS old_mouse_status; +static DWORD event_count = 0; +static SHORT left_key; +static int key_count = 0; +static int save_press = 0; + +#define KEV save_ip.Event.KeyEvent +#define MEV save_ip.Event.MouseEvent +#define REV save_ip.Event.WindowBufferSizeEvent + +/************************************************************************ + * Table for key code translation of function keys in keypad mode * + * These values are for strict IBM keyboard compatibles only * + ************************************************************************/ + +typedef struct +{ + unsigned short normal; + unsigned short shift; + unsigned short control; + unsigned short alt; + unsigned short extended; +} KPTAB; + +static KPTAB kptab[] = +{ + {0, 0, 0, 0, 0 }, /* 0 */ + {0, 0, 0, 0, 0 }, /* 1 VK_LBUTTON */ + {0, 0, 0, 0, 0 }, /* 2 VK_RBUTTON */ + {0, 0, 0, 0, 0 }, /* 3 VK_CANCEL */ + {0, 0, 0, 0, 0 }, /* 4 VK_MBUTTON */ + {0, 0, 0, 0, 0 }, /* 5 */ + {0, 0, 0, 0, 0 }, /* 6 */ + {0, 0, 0, 0, 0 }, /* 7 */ + {0x08, 0x08, 0x7F, ALT_BKSP, 0 }, /* 8 VK_BACK */ + {0x09, KEY_BTAB, CTL_TAB, ALT_TAB, 999 }, /* 9 VK_TAB */ + {0, 0, 0, 0, 0 }, /* 10 */ + {0, 0, 0, 0, 0 }, /* 11 */ + {KEY_B2, 0x35, CTL_PAD5, ALT_PAD5, 0 }, /* 12 VK_CLEAR */ + {0x0D, 0x0D, CTL_ENTER, ALT_ENTER, 1 }, /* 13 VK_RETURN */ + {0, 0, 0, 0, 0 }, /* 14 */ + {0, 0, 0, 0, 0 }, /* 15 */ + {0, 0, 0, 0, 0 }, /* 16 VK_SHIFT HANDLED SEPARATELY */ + {0, 0, 0, 0, 0 }, /* 17 VK_CONTROL HANDLED SEPARATELY */ + {0, 0, 0, 0, 0 }, /* 18 VK_MENU HANDLED SEPARATELY */ + {0, 0, 0, 0, 0 }, /* 19 VK_PAUSE */ + {0, 0, 0, 0, 0 }, /* 20 VK_CAPITAL HANDLED SEPARATELY */ + {0, 0, 0, 0, 0 }, /* 21 VK_HANGUL */ + {0, 0, 0, 0, 0 }, /* 22 */ + {0, 0, 0, 0, 0 }, /* 23 VK_JUNJA */ + {0, 0, 0, 0, 0 }, /* 24 VK_FINAL */ + {0, 0, 0, 0, 0 }, /* 25 VK_HANJA */ + {0, 0, 0, 0, 0 }, /* 26 */ + {0x1B, 0x1B, 0x1B, ALT_ESC, 0 }, /* 27 VK_ESCAPE */ + {0, 0, 0, 0, 0 }, /* 28 VK_CONVERT */ + {0, 0, 0, 0, 0 }, /* 29 VK_NONCONVERT */ + {0, 0, 0, 0, 0 }, /* 30 VK_ACCEPT */ + {0, 0, 0, 0, 0 }, /* 31 VK_MODECHANGE */ + {0x20, 0x20, 0x20, 0x20, 0 }, /* 32 VK_SPACE */ + {KEY_A3, 0x39, CTL_PAD9, ALT_PAD9, 3 }, /* 33 VK_PRIOR */ + {KEY_C3, 0x33, CTL_PAD3, ALT_PAD3, 4 }, /* 34 VK_NEXT */ + {KEY_C1, 0x31, CTL_PAD1, ALT_PAD1, 5 }, /* 35 VK_END */ + {KEY_A1, 0x37, CTL_PAD7, ALT_PAD7, 6 }, /* 36 VK_HOME */ + {KEY_B1, 0x34, CTL_PAD4, ALT_PAD4, 7 }, /* 37 VK_LEFT */ + {KEY_A2, 0x38, CTL_PAD8, ALT_PAD8, 8 }, /* 38 VK_UP */ + {KEY_B3, 0x36, CTL_PAD6, ALT_PAD6, 9 }, /* 39 VK_RIGHT */ + {KEY_C2, 0x32, CTL_PAD2, ALT_PAD2, 10 }, /* 40 VK_DOWN */ + {0, 0, 0, 0, 0 }, /* 41 VK_SELECT */ + {0, 0, 0, 0, 0 }, /* 42 VK_PRINT */ + {0, 0, 0, 0, 0 }, /* 43 VK_EXECUTE */ + {0, 0, 0, 0, 0 }, /* 44 VK_SNAPSHOT*/ + {PAD0, 0x30, CTL_PAD0, ALT_PAD0, 11 }, /* 45 VK_INSERT */ + {PADSTOP, 0x2E, CTL_PADSTOP, ALT_PADSTOP,12 }, /* 46 VK_DELETE */ + {0, 0, 0, 0, 0 }, /* 47 VK_HELP */ + {0x30, 0x29, 0, ALT_0, 0 }, /* 48 */ + {0x31, 0x21, 0, ALT_1, 0 }, /* 49 */ + {0x32, 0x40, 0, ALT_2, 0 }, /* 50 */ + {0x33, 0x23, 0, ALT_3, 0 }, /* 51 */ + {0x34, 0x24, 0, ALT_4, 0 }, /* 52 */ + {0x35, 0x25, 0, ALT_5, 0 }, /* 53 */ + {0x36, 0x5E, 0, ALT_6, 0 }, /* 54 */ + {0x37, 0x26, 0, ALT_7, 0 }, /* 55 */ + {0x38, 0x2A, 0, ALT_8, 0 }, /* 56 */ + {0x39, 0x28, 0, ALT_9, 0 }, /* 57 */ + {0, 0, 0, 0, 0 }, /* 58 */ + {0, 0, 0, 0, 0 }, /* 59 */ + {0, 0, 0, 0, 0 }, /* 60 */ + {0, 0, 0, 0, 0 }, /* 61 */ + {0, 0, 0, 0, 0 }, /* 62 */ + {0, 0, 0, 0, 0 }, /* 63 */ + {0, 0, 0, 0, 0 }, /* 64 */ + {0x61, 0x41, 0x01, ALT_A, 0 }, /* 65 */ + {0x62, 0x42, 0x02, ALT_B, 0 }, /* 66 */ + {0x63, 0x43, 0x03, ALT_C, 0 }, /* 67 */ + {0x64, 0x44, 0x04, ALT_D, 0 }, /* 68 */ + {0x65, 0x45, 0x05, ALT_E, 0 }, /* 69 */ + {0x66, 0x46, 0x06, ALT_F, 0 }, /* 70 */ + {0x67, 0x47, 0x07, ALT_G, 0 }, /* 71 */ + {0x68, 0x48, 0x08, ALT_H, 0 }, /* 72 */ + {0x69, 0x49, 0x09, ALT_I, 0 }, /* 73 */ + {0x6A, 0x4A, 0x0A, ALT_J, 0 }, /* 74 */ + {0x6B, 0x4B, 0x0B, ALT_K, 0 }, /* 75 */ + {0x6C, 0x4C, 0x0C, ALT_L, 0 }, /* 76 */ + {0x6D, 0x4D, 0x0D, ALT_M, 0 }, /* 77 */ + {0x6E, 0x4E, 0x0E, ALT_N, 0 }, /* 78 */ + {0x6F, 0x4F, 0x0F, ALT_O, 0 }, /* 79 */ + {0x70, 0x50, 0x10, ALT_P, 0 }, /* 80 */ + {0x71, 0x51, 0x11, ALT_Q, 0 }, /* 81 */ + {0x72, 0x52, 0x12, ALT_R, 0 }, /* 82 */ + {0x73, 0x53, 0x13, ALT_S, 0 }, /* 83 */ + {0x74, 0x54, 0x14, ALT_T, 0 }, /* 84 */ + {0x75, 0x55, 0x15, ALT_U, 0 }, /* 85 */ + {0x76, 0x56, 0x16, ALT_V, 0 }, /* 86 */ + {0x77, 0x57, 0x17, ALT_W, 0 }, /* 87 */ + {0x78, 0x58, 0x18, ALT_X, 0 }, /* 88 */ + {0x79, 0x59, 0x19, ALT_Y, 0 }, /* 89 */ + {0x7A, 0x5A, 0x1A, ALT_Z, 0 }, /* 90 */ + {0, 0, 0, 0, 0 }, /* 91 VK_LWIN */ + {0, 0, 0, 0, 0 }, /* 92 VK_RWIN */ + {0, 0, 0, 0, 0 }, /* 93 VK_APPS */ + {0, 0, 0, 0, 0 }, /* 94 */ + {0, 0, 0, 0, 0 }, /* 95 */ + {0x30, 0, CTL_PAD0, ALT_PAD0, 0 }, /* 96 VK_NUMPAD0 */ + {0x31, 0, CTL_PAD1, ALT_PAD1, 0 }, /* 97 VK_NUMPAD1 */ + {0x32, 0, CTL_PAD2, ALT_PAD2, 0 }, /* 98 VK_NUMPAD2 */ + {0x33, 0, CTL_PAD3, ALT_PAD3, 0 }, /* 99 VK_NUMPAD3 */ + {0x34, 0, CTL_PAD4, ALT_PAD4, 0 }, /* 100 VK_NUMPAD4 */ + {0x35, 0, CTL_PAD5, ALT_PAD5, 0 }, /* 101 VK_NUMPAD5 */ + {0x36, 0, CTL_PAD6, ALT_PAD6, 0 }, /* 102 VK_NUMPAD6 */ + {0x37, 0, CTL_PAD7, ALT_PAD7, 0 }, /* 103 VK_NUMPAD7 */ + {0x38, 0, CTL_PAD8, ALT_PAD8, 0 }, /* 104 VK_NUMPAD8 */ + {0x39, 0, CTL_PAD9, ALT_PAD9, 0 }, /* 105 VK_NUMPAD9 */ + {PADSTAR, SHF_PADSTAR,CTL_PADSTAR, ALT_PADSTAR,999 }, /* 106 VK_MULTIPLY*/ + {PADPLUS, SHF_PADPLUS,CTL_PADPLUS, ALT_PADPLUS,999 }, /* 107 VK_ADD */ + {0, 0, 0, 0, 0 }, /* 108 VK_SEPARATOR */ + {PADMINUS, SHF_PADMINUS,CTL_PADMINUS,ALT_PADMINUS,999}, /* 109 VK_SUBTRACT*/ + {0x2E, 0, CTL_PADSTOP, ALT_PADSTOP,0 }, /* 110 VK_DECIMAL */ + {PADSLASH, SHF_PADSLASH,CTL_PADSLASH,ALT_PADSLASH,2 }, /* 111 VK_DIVIDE */ + {KEY_F(1), KEY_F(13), KEY_F(25), KEY_F(37), 0 }, /* 112 VK_F1 */ + {KEY_F(2), KEY_F(14), KEY_F(26), KEY_F(38), 0 }, /* 113 VK_F2 */ + {KEY_F(3), KEY_F(15), KEY_F(27), KEY_F(39), 0 }, /* 114 VK_F3 */ + {KEY_F(4), KEY_F(16), KEY_F(28), KEY_F(40), 0 }, /* 115 VK_F4 */ + {KEY_F(5), KEY_F(17), KEY_F(29), KEY_F(41), 0 }, /* 116 VK_F5 */ + {KEY_F(6), KEY_F(18), KEY_F(30), KEY_F(42), 0 }, /* 117 VK_F6 */ + {KEY_F(7), KEY_F(19), KEY_F(31), KEY_F(43), 0 }, /* 118 VK_F7 */ + {KEY_F(8), KEY_F(20), KEY_F(32), KEY_F(44), 0 }, /* 119 VK_F8 */ + {KEY_F(9), KEY_F(21), KEY_F(33), KEY_F(45), 0 }, /* 120 VK_F9 */ + {KEY_F(10), KEY_F(22), KEY_F(34), KEY_F(46), 0 }, /* 121 VK_F10 */ + {KEY_F(11), KEY_F(23), KEY_F(35), KEY_F(47), 0 }, /* 122 VK_F11 */ + {KEY_F(12), KEY_F(24), KEY_F(36), KEY_F(48), 0 }, /* 123 VK_F12 */ + + /* 124 through 218 */ + + {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0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}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, + + {0x5B, 0x7B, 0x1B, ALT_LBRACKET,0 }, /* 219 */ + {0x5C, 0x7C, 0x1C, ALT_BSLASH, 0 }, /* 220 */ + {0x5D, 0x7D, 0x1D, ALT_RBRACKET,0 }, /* 221 */ + {0, 0, 0x27, ALT_FQUOTE, 0 }, /* 222 */ + {0, 0, 0, 0, 0 }, /* 223 */ + {0, 0, 0, 0, 0 }, /* 224 */ + {0, 0, 0, 0, 0 }, /* 225 */ + {0, 0, 0, 0, 0 }, /* 226 */ + {0, 0, 0, 0, 0 }, /* 227 */ + {0, 0, 0, 0, 0 }, /* 228 */ + {0, 0, 0, 0, 0 }, /* 229 */ + {0, 0, 0, 0, 0 }, /* 230 */ + {0, 0, 0, 0, 0 }, /* 231 */ + {0, 0, 0, 0, 0 }, /* 232 */ + {0, 0, 0, 0, 0 }, /* 233 */ + {0, 0, 0, 0, 0 }, /* 234 */ + {0, 0, 0, 0, 0 }, /* 235 */ + {0, 0, 0, 0, 0 }, /* 236 */ + {0, 0, 0, 0, 0 }, /* 237 */ + {0, 0, 0, 0, 0 }, /* 238 */ + {0, 0, 0, 0, 0 }, /* 239 */ + {0, 0, 0, 0, 0 }, /* 240 */ + {0, 0, 0, 0, 0 }, /* 241 */ + {0, 0, 0, 0, 0 }, /* 242 */ + {0, 0, 0, 0, 0 }, /* 243 */ + {0, 0, 0, 0, 0 }, /* 244 */ + {0, 0, 0, 0, 0 }, /* 245 */ + {0, 0, 0, 0, 0 }, /* 246 */ + {0, 0, 0, 0, 0 }, /* 247 */ + {0, 0, 0, 0, 0 }, /* 248 */ + {0, 0, 0, 0, 0 }, /* 249 */ + {0, 0, 0, 0, 0 }, /* 250 */ + {0, 0, 0, 0, 0 }, /* 251 */ + {0, 0, 0, 0, 0 }, /* 252 */ + {0, 0, 0, 0, 0 }, /* 253 */ + {0, 0, 0, 0, 0 }, /* 254 */ + {0, 0, 0, 0, 0 } /* 255 */ +}; + +static KPTAB ext_kptab[] = +{ + {0, 0, 0, 0, }, /* MUST BE EMPTY */ + {PADENTER, SHF_PADENTER, CTL_PADENTER, ALT_PADENTER}, /* 13 */ + {PADSLASH, SHF_PADSLASH, CTL_PADSLASH, ALT_PADSLASH}, /* 111 */ + {KEY_PPAGE, KEY_SPREVIOUS, CTL_PGUP, ALT_PGUP }, /* 33 */ + {KEY_NPAGE, KEY_SNEXT, CTL_PGDN, ALT_PGDN }, /* 34 */ + {KEY_END, KEY_SEND, CTL_END, ALT_END }, /* 35 */ + {KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME }, /* 36 */ + {KEY_LEFT, KEY_SLEFT, CTL_LEFT, ALT_LEFT }, /* 37 */ + {KEY_UP, KEY_SUP, CTL_UP, ALT_UP }, /* 38 */ + {KEY_RIGHT, KEY_SRIGHT, CTL_RIGHT, ALT_RIGHT }, /* 39 */ + {KEY_DOWN, KEY_SDOWN, CTL_DOWN, ALT_DOWN }, /* 40 */ + {KEY_IC, KEY_SIC, CTL_INS, ALT_INS }, /* 45 */ + {KEY_DC, KEY_SDC, CTL_DEL, ALT_DEL }, /* 46 */ + {PADSLASH, SHF_PADSLASH, CTL_PADSLASH, ALT_PADSLASH}, /* 191 */ +}; + +/* End of kptab[] */ + +void PDC_set_keyboard_binary(bool on) +{ + DWORD mode; + + PDC_LOG(("PDC_set_keyboard_binary() - called\n")); + + GetConsoleMode(pdc_con_in, &mode); + SetConsoleMode(pdc_con_in, !on ? (mode | ENABLE_PROCESSED_INPUT) : + (mode & ~ENABLE_PROCESSED_INPUT)); +} + +/* check if a key or mouse event is waiting */ + +bool PDC_check_key(void) +{ + if (key_count > 0) + return TRUE; + + GetNumberOfConsoleInputEvents(pdc_con_in, &event_count); + + return (event_count != 0); +} + +/* _get_key_count returns 0 if save_ip doesn't contain an event which + should be passed back to the user. This function filters "useless" + events. + + The function returns the number of keys waiting. This may be > 1 + if the repetition of real keys pressed so far are > 1. + + Returns 0 on NUMLOCK, CAPSLOCK, SCROLLLOCK. + + Returns 1 for SHIFT, ALT, CTRL only if no other key has been pressed + in between, and SP->return_key_modifiers is set; these are returned + on keyup. + + Normal keys are returned on keydown only. The number of repetitions + are returned. Dead keys (diacritics) are omitted. See below for a + description. +*/ + +static int _get_key_count(void) +{ + int num_keys = 0, vk; + + PDC_LOG(("_get_key_count() - called\n")); + + vk = KEV.wVirtualKeyCode; + + if (KEV.bKeyDown) + { + /* key down */ + + save_press = 0; + + if (vk == VK_CAPITAL || vk == VK_NUMLOCK || vk == VK_SCROLL) + { + /* throw away these modifiers */ + } + else if (vk == VK_SHIFT || vk == VK_CONTROL || vk == VK_MENU) + { + /* These keys are returned on keyup only. */ + + save_press = vk; + switch (vk) + { + case VK_SHIFT: + left_key = GetKeyState(VK_LSHIFT); + break; + case VK_CONTROL: + left_key = GetKeyState(VK_LCONTROL); + break; + case VK_MENU: + left_key = GetKeyState(VK_LMENU); + } + } + else + { + /* Check for diacritics. These are dead keys. Some locales + have modified characters like umlaut-a, which is an "a" + with two dots on it. In some locales you have to press a + special key (the dead key) immediately followed by the + "a" to get a composed umlaut-a. The special key may have + a normal meaning with different modifiers. */ + + if (KEV.uChar.UnicodeChar || !(MapVirtualKey(vk, 2) & 0x80000000)) + num_keys = KEV.wRepeatCount; + } + } + else + { + /* key up */ + + /* Only modifier keys or the results of ALT-numpad entry are + returned on keyup */ + + if ((vk == VK_MENU && KEV.uChar.UnicodeChar) || + ((vk == VK_SHIFT || vk == VK_CONTROL || vk == VK_MENU) && + vk == save_press)) + { + save_press = 0; + num_keys = 1; + } + } + + PDC_LOG(("_get_key_count() - returning: num_keys %d\n", num_keys)); + + return num_keys; +} + +/* _process_key_event returns -1 if the key in save_ip should be + ignored. Otherwise it returns the keycode which should be returned + by PDC_get_key(). save_ip must be a key event. + + CTRL-ALT support has been disabled, when is it emitted plainly? */ + +static int _process_key_event(void) +{ + int key = +#ifdef PDC_WIDE + KEV.uChar.UnicodeChar; +#else + KEV.uChar.AsciiChar; +#endif + WORD vk = KEV.wVirtualKeyCode; + DWORD state = KEV.dwControlKeyState; + + int idx; + BOOL enhanced; + + SP->key_code = TRUE; + + /* Save the key modifiers. Do this first to allow to detect e.g. a + pressed CTRL key after a hit of NUMLOCK. */ + + if (state & (LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED)) + SP->key_modifiers |= PDC_KEY_MODIFIER_ALT; + + if (state & SHIFT_PRESSED) + SP->key_modifiers |= PDC_KEY_MODIFIER_SHIFT; + + if (state & (LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED)) + SP->key_modifiers |= PDC_KEY_MODIFIER_CONTROL; + + if (state & NUMLOCK_ON) + SP->key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; + + /* Handle modifier keys hit by themselves */ + + switch (vk) + { + case VK_SHIFT: /* shift */ + if (!SP->return_key_modifiers) + return -1; + + return (left_key & 0x8000) ? KEY_SHIFT_L : KEY_SHIFT_R; + + case VK_CONTROL: /* control */ + if (!SP->return_key_modifiers) + return -1; + + return (left_key & 0x8000) ? KEY_CONTROL_L : KEY_CONTROL_R; + + case VK_MENU: /* alt */ + if (!key) + { + if (!SP->return_key_modifiers) + return -1; + + return (left_key & 0x8000) ? KEY_ALT_L : KEY_ALT_R; + } + } + + /* The system may emit Ascii or Unicode characters depending on + whether ReadConsoleInputA or ReadConsoleInputW is used. + + Normally, if key != 0 then the system did the translation + successfully. But this is not true for LEFT_ALT (different to + RIGHT_ALT). In case of LEFT_ALT we can get key != 0. So + check for this first. */ + + if (key && ( !(state & LEFT_ALT_PRESSED) || + (state & RIGHT_ALT_PRESSED) )) + { + /* This code should catch all keys returning a printable + character. Characters above 0x7F should be returned as + positive codes. */ + + if (kptab[vk].extended == 0) + { + SP->key_code = FALSE; + return key; + } + } + + /* This case happens if a functional key has been entered. */ + + if ((state & ENHANCED_KEY) && (kptab[vk].extended != 999)) + { + enhanced = TRUE; + idx = kptab[vk].extended; + } + else + { + enhanced = FALSE; + idx = vk; + } + + if (state & SHIFT_PRESSED) + key = enhanced ? ext_kptab[idx].shift : kptab[idx].shift; + + else if (state & (LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED)) + key = enhanced ? ext_kptab[idx].control : kptab[idx].control; + + else if (state & (LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED)) + key = enhanced ? ext_kptab[idx].alt : kptab[idx].alt; + + else + key = enhanced ? ext_kptab[idx].normal : kptab[idx].normal; + + if (key < KEY_CODE_YES) + SP->key_code = FALSE; + + return key; +} + +static int _process_mouse_event(void) +{ + static const DWORD button_mask[] = {1, 4, 2}; + short action, shift_flags = 0; + int i; + + save_press = 0; + SP->key_code = TRUE; + + memset(&SP->mouse_status, 0, sizeof(MOUSE_STATUS)); + + SP->mouse_status.x = MEV.dwMousePosition.X; + SP->mouse_status.y = MEV.dwMousePosition.Y; + + /* Handle scroll wheel */ + + if (MEV.dwEventFlags == 4) + { + SP->mouse_status.changes = (MEV.dwButtonState & 0xFF000000) ? + PDC_MOUSE_WHEEL_DOWN : PDC_MOUSE_WHEEL_UP; + + memset(&old_mouse_status, 0, sizeof(old_mouse_status)); + + return KEY_MOUSE; + } + + if (MEV.dwEventFlags == 8) + { + SP->mouse_status.changes = (MEV.dwButtonState & 0xFF000000) ? + PDC_MOUSE_WHEEL_RIGHT : PDC_MOUSE_WHEEL_LEFT; + + memset(&old_mouse_status, 0, sizeof(old_mouse_status)); + + return KEY_MOUSE; + } + + action = (MEV.dwEventFlags == 2) ? BUTTON_DOUBLE_CLICKED : + ((MEV.dwEventFlags == 1) ? BUTTON_MOVED : BUTTON_PRESSED); + + for (i = 0; i < 3; i++) + SP->mouse_status.button[i] = + (MEV.dwButtonState & button_mask[i]) ? action : 0; + + if (action == BUTTON_PRESSED && MEV.dwButtonState & 7 && SP->mouse_wait) + { + /* Check for a click -- a PRESS followed immediately by a release */ + + if (!event_count) + { + napms(SP->mouse_wait); + + GetNumberOfConsoleInputEvents(pdc_con_in, &event_count); + } + + if (event_count) + { + INPUT_RECORD ip; + DWORD count; + bool have_click = FALSE; + + PeekConsoleInput(pdc_con_in, &ip, 1, &count); + + for (i = 0; i < 3; i++) + { + if (SP->mouse_status.button[i] == BUTTON_PRESSED && + !(ip.Event.MouseEvent.dwButtonState & button_mask[i])) + { + SP->mouse_status.button[i] = BUTTON_CLICKED; + have_click = TRUE; + } + } + + /* If a click was found, throw out the event */ + + if (have_click) + ReadConsoleInput(pdc_con_in, &ip, 1, &count); + } + } + + SP->mouse_status.changes = 0; + + for (i = 0; i < 3; i++) + { + if (old_mouse_status.button[i] != SP->mouse_status.button[i]) + SP->mouse_status.changes |= (1 << i); + + if (SP->mouse_status.button[i] == BUTTON_MOVED) + { + /* Discard non-moved "moves" */ + + if (SP->mouse_status.x == old_mouse_status.x && + SP->mouse_status.y == old_mouse_status.y) + return -1; + + /* Motion events always flag the button as changed */ + + SP->mouse_status.changes |= (1 << i); + SP->mouse_status.changes |= PDC_MOUSE_MOVED; + break; + } + } + + old_mouse_status = SP->mouse_status; + + /* Treat click events as release events for comparison purposes */ + + for (i = 0; i < 3; i++) + { + if (old_mouse_status.button[i] == BUTTON_CLICKED || + old_mouse_status.button[i] == BUTTON_DOUBLE_CLICKED) + old_mouse_status.button[i] = BUTTON_RELEASED; + } + + /* Check for SHIFT/CONTROL/ALT */ + + if (MEV.dwControlKeyState & (LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED)) + shift_flags |= BUTTON_ALT; + + if (MEV.dwControlKeyState & (LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED)) + shift_flags |= BUTTON_CONTROL; + + if (MEV.dwControlKeyState & SHIFT_PRESSED) + shift_flags |= BUTTON_SHIFT; + + if (shift_flags) + { + for (i = 0; i < 3; i++) + { + if (SP->mouse_status.changes & (1 << i)) + SP->mouse_status.button[i] |= shift_flags; + } + } + + return KEY_MOUSE; +} + +/* return the next available key or mouse event */ + +int PDC_get_key(void) +{ + SP->key_modifiers = 0L; + + if (!key_count) + { + DWORD count; + + ReadConsoleInput(pdc_con_in, &save_ip, 1, &count); + event_count--; + + if (save_ip.EventType == MOUSE_EVENT || + save_ip.EventType == WINDOW_BUFFER_SIZE_EVENT) + key_count = 1; + else if (save_ip.EventType == KEY_EVENT) + key_count = _get_key_count(); + } + + if (key_count) + { + key_count--; + + switch (save_ip.EventType) + { + case KEY_EVENT: + return _process_key_event(); + + case MOUSE_EVENT: + return _process_mouse_event(); + + case WINDOW_BUFFER_SIZE_EVENT: + if (REV.dwSize.Y != LINES || REV.dwSize.X != COLS) + { + if (!SP->resized) + { + SP->resized = TRUE; + SP->key_code = TRUE; + return KEY_RESIZE; + } + } + } + } + + return -1; +} + +/* discard any pending keyboard or mouse input -- this is the core + routine for flushinp() */ + +void PDC_flushinp(void) +{ + PDC_LOG(("PDC_flushinp() - called\n")); + + FlushConsoleInputBuffer(pdc_con_in); +} + +bool PDC_has_mouse(void) +{ + return TRUE; +} + +int PDC_mouse_set(void) +{ + DWORD mode; + + /* If turning on mouse input: Set ENABLE_MOUSE_INPUT, and clear + all other flags, except processed input mode; + If turning off the mouse: Set QuickEdit Mode to the status it + had on startup, and clear all other flags, except etc. */ + + GetConsoleMode(pdc_con_in, &mode); + mode = (mode & 1) | 0x0088; + SetConsoleMode(pdc_con_in, mode | (SP->_trap_mbe ? + ENABLE_MOUSE_INPUT : pdc_quick_edit)); + + memset(&old_mouse_status, 0, sizeof(old_mouse_status)); + + return OK; +} + +int PDC_modifiers_set(void) +{ + return OK; +} diff --git a/vendor/pdcurses/wincon/pdcscrn.c b/vendor/pdcurses/wincon/pdcscrn.c new file mode 100644 index 0000000..e2f4ddd --- /dev/null +++ b/vendor/pdcurses/wincon/pdcscrn.c @@ -0,0 +1,686 @@ +/* PDCurses */ + +#include "pdcwin.h" + +#include + +/* Color component table */ + +PDCCOLOR pdc_color[PDC_MAXCOL]; + +HANDLE std_con_out = INVALID_HANDLE_VALUE; +HANDLE pdc_con_out = INVALID_HANDLE_VALUE; +HANDLE pdc_con_in = INVALID_HANDLE_VALUE; + +DWORD pdc_quick_edit; + +static short realtocurs[16] = +{ + COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN, COLOR_RED, + COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE, COLOR_BLACK + 8, + COLOR_BLUE + 8, COLOR_GREEN + 8, COLOR_CYAN + 8, COLOR_RED + 8, + COLOR_MAGENTA + 8, COLOR_YELLOW + 8, COLOR_WHITE + 8 +}; + +static short ansitocurs[16] = +{ + COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE, + COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE, COLOR_BLACK + 8, + COLOR_RED + 8, COLOR_GREEN + 8, COLOR_YELLOW + 8, COLOR_BLUE + 8, + COLOR_MAGENTA + 8, COLOR_CYAN + 8, COLOR_WHITE + 8 +}; + +short pdc_curstoreal[16], pdc_curstoansi[16]; +short pdc_oldf, pdc_oldb, pdc_oldu; +bool pdc_conemu, pdc_wt, pdc_ansi; + +enum { PDC_RESTORE_NONE, PDC_RESTORE_BUFFER }; + +/* Struct for storing console registry keys, and for use with the + undocumented WM_SETCONSOLEINFO message. Originally by James Brown, + www.catch22.net. */ + +static struct +{ + ULONG Length; + COORD ScreenBufferSize; + COORD WindowSize; + ULONG WindowPosX; + ULONG WindowPosY; + + COORD FontSize; + ULONG FontFamily; + ULONG FontWeight; + WCHAR FaceName[32]; + + ULONG CursorSize; + ULONG FullScreen; + ULONG QuickEdit; + ULONG AutoPosition; + ULONG InsertMode; + + USHORT ScreenColors; + USHORT PopupColors; + ULONG HistoryNoDup; + ULONG HistoryBufferSize; + ULONG NumberOfHistoryBuffers; + + COLORREF ColorTable[16]; + + ULONG CodePage; + HWND Hwnd; + + WCHAR ConsoleTitle[0x100]; +} console_info; + +#ifdef HAVE_NO_INFOEX +/* Console screen buffer information (extended version) */ +typedef struct _CONSOLE_SCREEN_BUFFER_INFOEX { + ULONG cbSize; + COORD dwSize; + COORD dwCursorPosition; + WORD wAttributes; + SMALL_RECT srWindow; + COORD dwMaximumWindowSize; + WORD wPopupAttributes; + BOOL bFullscreenSupported; + COLORREF ColorTable[16]; +} CONSOLE_SCREEN_BUFFER_INFOEX; +typedef CONSOLE_SCREEN_BUFFER_INFOEX *PCONSOLE_SCREEN_BUFFER_INFOEX; +#endif + +typedef BOOL (WINAPI *SetConsoleScreenBufferInfoExFn)(HANDLE hConsoleOutput, + PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx); +typedef BOOL (WINAPI *GetConsoleScreenBufferInfoExFn)(HANDLE hConsoleOutput, + PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx); + +static SetConsoleScreenBufferInfoExFn pSetConsoleScreenBufferInfoEx = NULL; +static GetConsoleScreenBufferInfoExFn pGetConsoleScreenBufferInfoEx = NULL; + +static CONSOLE_SCREEN_BUFFER_INFO orig_scr; +static CONSOLE_SCREEN_BUFFER_INFOEX console_infoex; + +static LPTOP_LEVEL_EXCEPTION_FILTER xcpt_filter; + +static DWORD old_console_mode = 0; + +static bool is_nt; + +static void _reset_old_colors(void) +{ + pdc_oldf = -1; + pdc_oldb = -1; + pdc_oldu = 0; +} + +static HWND _find_console_handle(void) +{ + TCHAR orgtitle[1024], temptitle[1024]; + HWND wnd; + + GetConsoleTitle(orgtitle, 1024); + + wsprintf(temptitle, TEXT("%d/%d"), GetTickCount(), GetCurrentProcessId()); + SetConsoleTitle(temptitle); + + Sleep(40); + + wnd = FindWindow(NULL, temptitle); + + SetConsoleTitle(orgtitle); + + return wnd; +} + +/* Undocumented console message */ + +#define WM_SETCONSOLEINFO (WM_USER + 201) + +/* Wrapper around WM_SETCONSOLEINFO. We need to create the necessary + section (file-mapping) object in the context of the process which + owns the console, before posting the message. Originally by JB. */ + +static void _set_console_info(void) +{ + CONSOLE_SCREEN_BUFFER_INFO csbi; + CONSOLE_CURSOR_INFO cci; + DWORD dwConsoleOwnerPid; + HANDLE hProcess; + HANDLE hSection, hDupSection; + PVOID ptrView; + + /* Each-time initialization for console_info */ + + GetConsoleCursorInfo(pdc_con_out, &cci); + console_info.CursorSize = cci.dwSize; + + GetConsoleScreenBufferInfo(pdc_con_out, &csbi); + console_info.ScreenBufferSize = csbi.dwSize; + + console_info.WindowSize.X = csbi.srWindow.Right - csbi.srWindow.Left + 1; + console_info.WindowSize.Y = csbi.srWindow.Bottom - csbi.srWindow.Top + 1; + + console_info.WindowPosX = csbi.srWindow.Left; + console_info.WindowPosY = csbi.srWindow.Top; + + /* Open the process which "owns" the console */ + + GetWindowThreadProcessId(console_info.Hwnd, &dwConsoleOwnerPid); + + hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwConsoleOwnerPid); + + /* Create a SECTION object backed by page-file, then map a view of + this section into the owner process so we can write the contents + of the CONSOLE_INFO buffer into it */ + + hSection = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, + 0, sizeof(console_info), 0); + + /* Copy our console structure into the section-object */ + + ptrView = MapViewOfFile(hSection, FILE_MAP_WRITE|FILE_MAP_READ, + 0, 0, sizeof(console_info)); + + memcpy(ptrView, &console_info, sizeof(console_info)); + + UnmapViewOfFile(ptrView); + + /* Map the memory into owner process */ + + DuplicateHandle(GetCurrentProcess(), hSection, hProcess, &hDupSection, + 0, FALSE, DUPLICATE_SAME_ACCESS); + + /* Send console window the "update" message */ + + SendMessage(console_info.Hwnd, WM_SETCONSOLEINFO, (WPARAM)hDupSection, 0); + + CloseHandle(hSection); + CloseHandle(hProcess); +} + +static int _set_console_infoex(void) +{ + if (!pSetConsoleScreenBufferInfoEx(pdc_con_out, &console_infoex)) + return ERR; + + return OK; +} + +static int _set_colors(void) +{ + SetConsoleTextAttribute(pdc_con_out, 7); + _reset_old_colors(); + + if (pSetConsoleScreenBufferInfoEx) + return _set_console_infoex(); + else + { + _set_console_info(); + return OK; + } +} + +/* One-time initialization for console_info -- color table and font info + from the registry; other values from functions. */ + +static void _init_console_info(void) +{ + DWORD scrnmode, len; + HKEY reghnd; + int i; + + console_info.Hwnd = _find_console_handle(); + console_info.Length = sizeof(console_info); + + GetConsoleMode(pdc_con_in, &scrnmode); + console_info.QuickEdit = !!(scrnmode & 0x0040); + console_info.InsertMode = !!(scrnmode & 0x0020); + + console_info.FullScreen = FALSE; + console_info.AutoPosition = 0x10000; + console_info.ScreenColors = SP->orig_back << 4 | SP->orig_fore; + console_info.PopupColors = 0xf5; + + console_info.HistoryNoDup = FALSE; + console_info.HistoryBufferSize = 50; + console_info.NumberOfHistoryBuffers = 4; + + console_info.CodePage = GetConsoleOutputCP(); + + RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Console"), 0, + KEY_QUERY_VALUE, ®hnd); + + len = sizeof(DWORD); + + /* Default color table */ + + for (i = 0; i < 16; i++) + { + char tname[13]; + + sprintf(tname, "ColorTable%02d", i); + RegQueryValueExA(reghnd, tname, NULL, NULL, + (LPBYTE)(&(console_info.ColorTable[i])), &len); + } + + /* Font info */ + + RegQueryValueEx(reghnd, TEXT("FontSize"), NULL, NULL, + (LPBYTE)(&console_info.FontSize), &len); + RegQueryValueEx(reghnd, TEXT("FontFamily"), NULL, NULL, + (LPBYTE)(&console_info.FontFamily), &len); + RegQueryValueEx(reghnd, TEXT("FontWeight"), NULL, NULL, + (LPBYTE)(&console_info.FontWeight), &len); + + len = sizeof(WCHAR) * 32; + RegQueryValueExW(reghnd, L"FaceName", NULL, NULL, + (LPBYTE)(console_info.FaceName), &len); + + RegCloseKey(reghnd); +} + +static int _init_console_infoex(void) +{ + console_infoex.cbSize = sizeof(console_infoex); + + if (!pGetConsoleScreenBufferInfoEx(pdc_con_out, &console_infoex)) + return ERR; + + console_infoex.srWindow.Right++; + console_infoex.srWindow.Bottom++; + + return OK; +} + +static COLORREF *_get_colors(void) +{ + if (pGetConsoleScreenBufferInfoEx) + { + int status = OK; + if (!console_infoex.cbSize) + status = _init_console_infoex(); + return (status == ERR) ? NULL : + (COLORREF *)(&(console_infoex.ColorTable)); + } + else + { + if (!console_info.Hwnd) + _init_console_info(); + return (COLORREF *)(&(console_info.ColorTable)); + } +} + +/* restore the original console buffer in the event of a crash */ + +static LONG WINAPI _restore_console(LPEXCEPTION_POINTERS ep) +{ + PDC_scr_close(); + + return EXCEPTION_CONTINUE_SEARCH; +} + +/* restore the original console buffer on Ctrl+Break (or Ctrl+C, + if it gets re-enabled) */ + +static BOOL WINAPI _ctrl_break(DWORD dwCtrlType) +{ + if (dwCtrlType == CTRL_BREAK_EVENT || dwCtrlType == CTRL_C_EVENT) + PDC_scr_close(); + + return FALSE; +} + +/* close the physical screen -- may restore the screen to its state + before PDC_scr_open(); miscellaneous cleanup */ + +void PDC_scr_close(void) +{ + PDC_LOG(("PDC_scr_close() - called\n")); + + if (SP->visibility != 1) + curs_set(1); + + PDC_reset_shell_mode(); + + /* Position cursor to the bottom left of the screen. */ + + if (SP->_restore == PDC_RESTORE_NONE) + { + SMALL_RECT win; + + win.Left = orig_scr.srWindow.Left; + win.Right = orig_scr.srWindow.Right; + win.Top = 0; + win.Bottom = orig_scr.srWindow.Bottom - orig_scr.srWindow.Top; + SetConsoleWindowInfo(pdc_con_out, TRUE, &win); + PDC_gotoyx(win.Bottom, 0); + } +} + +void PDC_scr_free(void) +{ + if (pdc_con_out != std_con_out) + { + CloseHandle(pdc_con_out); + pdc_con_out = std_con_out; + } + + SetUnhandledExceptionFilter(xcpt_filter); + SetConsoleCtrlHandler(_ctrl_break, FALSE); +} + +/* open the physical screen -- miscellaneous initialization, may save + the existing screen for later restoration */ + +int PDC_scr_open(void) +{ + const char *str; + CONSOLE_SCREEN_BUFFER_INFO csbi; + HMODULE h_kernel; + BOOL result; + int i; + + PDC_LOG(("PDC_scr_open() - called\n")); + + for (i = 0; i < 16; i++) + { + pdc_curstoreal[realtocurs[i]] = i; + pdc_curstoansi[ansitocurs[i]] = i; + } + _reset_old_colors(); + + std_con_out = + pdc_con_out = GetStdHandle(STD_OUTPUT_HANDLE); + pdc_con_in = GetStdHandle(STD_INPUT_HANDLE); + + if (GetFileType(pdc_con_in) != FILE_TYPE_CHAR) + { + fprintf(stderr, "\nRedirection is not supported.\n"); + exit(1); + } + + is_nt = !(GetVersion() & 0x80000000); + + pdc_wt = !!getenv("WT_SESSION"); + str = pdc_wt ? NULL : getenv("ConEmuANSI"); + pdc_conemu = !!str; + pdc_ansi = pdc_wt ? TRUE : pdc_conemu ? !strcmp(str, "ON") : FALSE; + + GetConsoleScreenBufferInfo(pdc_con_out, &csbi); + GetConsoleScreenBufferInfo(pdc_con_out, &orig_scr); + GetConsoleMode(pdc_con_in, &old_console_mode); + + /* preserve QuickEdit Mode setting for use in PDC_mouse_set() when + the mouse is not enabled -- other console input settings are + cleared */ + + pdc_quick_edit = old_console_mode & 0x0040; + + SP->mouse_wait = PDC_CLICK_PERIOD; + SP->audible = TRUE; + + SP->termattrs = A_COLOR | A_REVERSE; + if (pdc_ansi) + SP->termattrs |= A_UNDERLINE | A_ITALIC; + + SP->orig_fore = csbi.wAttributes & 0x0f; + SP->orig_back = (csbi.wAttributes & 0xf0) >> 4; + + SP->orig_attr = TRUE; + + SP->_restore = PDC_RESTORE_NONE; + + if ((str = getenv("PDC_RESTORE_SCREEN")) == NULL || *str != '0') + { + /* Create a new console buffer */ + + pdc_con_out = + CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, CONSOLE_TEXTMODE_BUFFER, NULL); + + if (pdc_con_out == INVALID_HANDLE_VALUE) + { + PDC_LOG(("PDC_scr_open() - screen buffer failure\n")); + + pdc_con_out = std_con_out; + } + else + SP->_restore = PDC_RESTORE_BUFFER; + } + + xcpt_filter = SetUnhandledExceptionFilter(_restore_console); + SetConsoleCtrlHandler(_ctrl_break, TRUE); + + SP->_preserve = (getenv("PDC_PRESERVE_SCREEN") != NULL); + + /* ENABLE_LVB_GRID_WORLDWIDE */ + result = SetConsoleMode(pdc_con_out, 0x0010); + if (result) + SP->termattrs |= A_UNDERLINE | A_LEFT | A_RIGHT; + + PDC_reset_prog_mode(); + + SP->mono = FALSE; + + h_kernel = GetModuleHandleA("kernel32.dll"); + pGetConsoleScreenBufferInfoEx = + (GetConsoleScreenBufferInfoExFn)GetProcAddress(h_kernel, + "GetConsoleScreenBufferInfoEx"); + pSetConsoleScreenBufferInfoEx = + (SetConsoleScreenBufferInfoExFn)GetProcAddress(h_kernel, + "SetConsoleScreenBufferInfoEx"); + + return OK; +} + + /* Calls SetConsoleWindowInfo with the given parameters, but fits them + if a scoll bar shrinks the maximum possible value. The rectangle + must at least fit in a half-sized window. */ + +static BOOL _fit_console_window(HANDLE con_out, CONST SMALL_RECT *rect) +{ + SMALL_RECT run; + SHORT mx, my; + + if (SetConsoleWindowInfo(con_out, TRUE, rect)) + return TRUE; + + run = *rect; + run.Right /= 2; + run.Bottom /= 2; + + mx = run.Right; + my = run.Bottom; + + if (!SetConsoleWindowInfo(con_out, TRUE, &run)) + return FALSE; + + for (run.Right = rect->Right; run.Right >= mx; run.Right--) + if (SetConsoleWindowInfo(con_out, TRUE, &run)) + break; + + if (run.Right < mx) + return FALSE; + + for (run.Bottom = rect->Bottom; run.Bottom >= my; run.Bottom--) + if (SetConsoleWindowInfo(con_out, TRUE, &run)) + return TRUE; + + return FALSE; +} + +/* the core of resize_term() */ + +int PDC_resize_screen(int nlines, int ncols) +{ + SMALL_RECT rect; + COORD size, max; + + bool prog_resize = nlines || ncols; + + if (!prog_resize) + { + nlines = PDC_get_rows(); + ncols = PDC_get_columns(); + } + + if (nlines < 2 || ncols < 2) + return ERR; + + max = GetLargestConsoleWindowSize(pdc_con_out); + + rect.Left = rect.Top = 0; + rect.Right = ncols - 1; + + if (rect.Right > max.X) + rect.Right = max.X; + + rect.Bottom = nlines - 1; + + if (rect.Bottom > max.Y) + rect.Bottom = max.Y; + + size.X = rect.Right + 1; + size.Y = rect.Bottom + 1; + + _fit_console_window(pdc_con_out, &rect); + SetConsoleScreenBufferSize(pdc_con_out, size); + + if (prog_resize) + { + _fit_console_window(pdc_con_out, &rect); + SetConsoleScreenBufferSize(pdc_con_out, size); + } + SetConsoleActiveScreenBuffer(pdc_con_out); + + PDC_flushinp(); + + return OK; +} + +void PDC_reset_prog_mode(void) +{ + PDC_LOG(("PDC_reset_prog_mode() - called.\n")); + + if (pdc_con_out != std_con_out) + SetConsoleActiveScreenBuffer(pdc_con_out); + else if (is_nt) + { + COORD bufsize; + SMALL_RECT rect; + + bufsize.X = orig_scr.srWindow.Right - orig_scr.srWindow.Left + 1; + bufsize.Y = orig_scr.srWindow.Bottom - orig_scr.srWindow.Top + 1; + + rect.Top = rect.Left = 0; + rect.Bottom = bufsize.Y - 1; + rect.Right = bufsize.X - 1; + + SetConsoleScreenBufferSize(pdc_con_out, bufsize); + SetConsoleWindowInfo(pdc_con_out, TRUE, &rect); + SetConsoleScreenBufferSize(pdc_con_out, bufsize); + SetConsoleActiveScreenBuffer(pdc_con_out); + } + + PDC_mouse_set(); +} + +void PDC_reset_shell_mode(void) +{ + PDC_LOG(("PDC_reset_shell_mode() - called.\n")); + + if (pdc_con_out != std_con_out) + SetConsoleActiveScreenBuffer(std_con_out); + else if (is_nt) + { + SetConsoleScreenBufferSize(pdc_con_out, orig_scr.dwSize); + SetConsoleWindowInfo(pdc_con_out, TRUE, &orig_scr.srWindow); + SetConsoleScreenBufferSize(pdc_con_out, orig_scr.dwSize); + SetConsoleWindowInfo(pdc_con_out, TRUE, &orig_scr.srWindow); + SetConsoleActiveScreenBuffer(pdc_con_out); + } + + SetConsoleMode(pdc_con_in, old_console_mode | 0x0080); +} + +void PDC_restore_screen_mode(int i) +{ +} + +void PDC_save_screen_mode(int i) +{ +} + +bool PDC_can_change_color(void) +{ + return is_nt; +} + +int PDC_color_content(short color, short *red, short *green, short *blue) +{ + if (color < 16 && !(pdc_conemu || pdc_wt)) + { + COLORREF *color_table = _get_colors(); + + if (color_table) + { + DWORD col = color_table[pdc_curstoreal[color]]; + + *red = DIVROUND(GetRValue(col) * 1000, 255); + *green = DIVROUND(GetGValue(col) * 1000, 255); + *blue = DIVROUND(GetBValue(col) * 1000, 255); + } + else + return ERR; + } + else + { + if (!pdc_color[color].mapped) + { + *red = *green = *blue = -1; + return ERR; + } + + *red = pdc_color[color].r; + *green = pdc_color[color].g; + *blue = pdc_color[color].b; + } + + return OK; +} + +int PDC_init_color(short color, short red, short green, short blue) +{ + if (red == -1 && green == -1 && blue == -1) + { + pdc_color[color].mapped = FALSE; + return OK; + } + + if (color < 16 && !(pdc_conemu || pdc_wt)) + { + COLORREF *color_table = _get_colors(); + + if (color_table) + { + color_table[pdc_curstoreal[color]] = + RGB(DIVROUND(red * 255, 1000), + DIVROUND(green * 255, 1000), + DIVROUND(blue * 255, 1000)); + + return _set_colors(); + } + + return ERR; + } + else + { + pdc_color[color].r = red; + pdc_color[color].g = green; + pdc_color[color].b = blue; + pdc_color[color].mapped = TRUE; + } + + return OK; +} diff --git a/vendor/pdcurses/wincon/pdcsetsc.c b/vendor/pdcurses/wincon/pdcsetsc.c new file mode 100644 index 0000000..1e9fc9b --- /dev/null +++ b/vendor/pdcurses/wincon/pdcsetsc.c @@ -0,0 +1,133 @@ +/* PDCurses */ + +#include "pdcwin.h" + +/*man-start************************************************************** + +pdcsetsc +-------- + +### Synopsis + + int PDC_set_blink(bool blinkon); + int PDC_set_bold(bool boldon); + void PDC_set_title(const char *title); + +### Description + + PDC_set_blink() toggles whether the A_BLINK attribute sets an actual + blink mode (TRUE), or sets the background color to high intensity + (FALSE). The default is platform-dependent (FALSE in most cases). It + returns OK if it could set the state to match the given parameter, + ERR otherwise. + + PDC_set_bold() toggles whether the A_BOLD attribute selects an actual + bold font (TRUE), or sets the foreground color to high intensity + (FALSE). It returns OK if it could set the state to match the given + parameter, ERR otherwise. + + PDC_set_title() sets the title of the window in which the curses + program is running. This function may not do anything on some + platforms. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + PDC_set_blink | - | - | - + PDC_set_bold | - | - | - + PDC_set_title | - | - | - + +**man-end****************************************************************/ + +int PDC_curs_set(int visibility) +{ + CONSOLE_CURSOR_INFO cci; + int ret_vis; + + PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); + + ret_vis = SP->visibility; + + if (GetConsoleCursorInfo(pdc_con_out, &cci) == FALSE) + return ERR; + + switch(visibility) + { + case 0: /* invisible */ + cci.bVisible = FALSE; + break; + case 2: /* highly visible */ + cci.bVisible = TRUE; + cci.dwSize = 95; + break; + default: /* normal visibility */ + cci.bVisible = TRUE; + cci.dwSize = SP->orig_cursor; + break; + } + + if (SetConsoleCursorInfo(pdc_con_out, &cci) == FALSE) + return ERR; + + SP->visibility = visibility; + return ret_vis; +} + +void PDC_set_title(const char *title) +{ +#ifdef PDC_WIDE + wchar_t wtitle[512]; +#endif + PDC_LOG(("PDC_set_title() - called:<%s>\n", title)); + +#ifdef PDC_WIDE + PDC_mbstowcs(wtitle, title, 511); + SetConsoleTitleW(wtitle); +#else + SetConsoleTitleA(title); +#endif +} + +int PDC_set_blink(bool blinkon) +{ + if (!SP) + return ERR; + + if (SP->color_started) + { + COLORS = 16; + if (PDC_can_change_color()) /* is_nt */ + { + if (pdc_conemu || SetConsoleMode(pdc_con_out, 0x0004)) /* VT */ + COLORS = PDC_MAXCOL; + + if (!pdc_conemu) + SetConsoleMode(pdc_con_out, 0x0010); /* LVB */ + } + } + + if (blinkon) + { + if (!(SP->termattrs & A_BLINK)) + { + SP->termattrs |= A_BLINK; + pdc_last_blink = GetTickCount(); + } + } + else + { + if (SP->termattrs & A_BLINK) + { + SP->termattrs &= ~A_BLINK; + PDC_blink_text(); + } + } + + return OK; +} + +int PDC_set_bold(bool boldon) +{ + return boldon ? ERR : OK; +} diff --git a/vendor/pdcurses/wincon/pdcutil.c b/vendor/pdcurses/wincon/pdcutil.c new file mode 100644 index 0000000..a40cf45 --- /dev/null +++ b/vendor/pdcurses/wincon/pdcutil.c @@ -0,0 +1,26 @@ +/* PDCurses */ + +#include "pdcwin.h" + +void PDC_beep(void) +{ + PDC_LOG(("PDC_beep() - called\n")); + +/* MessageBeep(MB_OK); */ + MessageBeep(0XFFFFFFFF); +} + +void PDC_napms(int ms) +{ + PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); + + if ((SP->termattrs & A_BLINK) && (GetTickCount() >= pdc_last_blink + 500)) + PDC_blink_text(); + + Sleep(ms); +} + +const char *PDC_sysname(void) +{ + return "Windows"; +} diff --git a/vendor/pdcurses/wincon/pdcwin.h b/vendor/pdcurses/wincon/pdcwin.h new file mode 100644 index 0000000..08d3579 --- /dev/null +++ b/vendor/pdcurses/wincon/pdcwin.h @@ -0,0 +1,27 @@ +/* PDCurses */ + +#if defined(PDC_WIDE) && !defined(UNICODE) +# define UNICODE +#endif + +#define WIN32_LEAN_AND_MEAN +#include +#undef MOUSE_MOVED +#include + +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE 1 /* kill nonsense warnings */ +#endif + +typedef struct {short r, g, b; bool mapped;} PDCCOLOR; + +extern PDCCOLOR pdc_color[PDC_MAXCOL]; + +extern HANDLE pdc_con_out, pdc_con_in; +extern DWORD pdc_quick_edit; +extern DWORD pdc_last_blink; +extern short pdc_curstoreal[16], pdc_curstoansi[16]; +extern short pdc_oldf, pdc_oldb, pdc_oldu; +extern bool pdc_conemu, pdc_wt, pdc_ansi; + +extern void PDC_blink_text(void); diff --git a/vendor/pdcurses/x11/Makefile.in b/vendor/pdcurses/x11/Makefile.in new file mode 100644 index 0000000..7289613 --- /dev/null +++ b/vendor/pdcurses/x11/Makefile.in @@ -0,0 +1,562 @@ +# Makefile for PDCurses for X11 + +SHELL = @SHELL@ +THIS = Makefile + +@SET_MAKE@ + +PDCURSES_SRCDIR = .. + +osdir = . +srcdir = $(PDCURSES_SRCDIR)/pdcurses +demodir = $(PDCURSES_SRCDIR)/demos + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +bindir = @bindir@ +includedir = @includedir@ + +PDCURSES_CONFIG_H =$(osdir)/config.h +PDCURSES_CURSES_H =$(PDCURSES_SRCDIR)/curses.h +PDCURSES_CURSPRIV_H =$(PDCURSES_SRCDIR)/curspriv.h +PDCURSES_HEADERS =$(PDCURSES_CONFIG_H) $(PDCURSES_CURSES_H) \ +$(PDCURSES_CURSPRIV_H) +PDCURSES_X11_H =$(osdir)/pdcx11.h + +SHLPRE = @SHLPRE@ +SHLPST = @SHLPST@ +LD_RXLIB1 = @LD_RXLIB1@ +LD_RXLIB2 = @MH_XLIBS@ @MH_EXTRA_LIBS@ -lc + +CFLAGS = @CFLAGS@ + +CPPFLAGS = @DEFS@ -DXCURSES @SYS_DEFS@ -I$(PDCURSES_SRCDIR) + +BUILD = @CC@ -c $(CFLAGS) $(CPPFLAGS) @MH_XINC_DIR@ +DYN_BUILD = @O2SAVE@ $(BUILD) @DYN_COMP@ @CC2O@ + +LINK = @CC@ +LDFLAGS = $(LIBCURSES) @LDFLAGS@ @LIBS@ @MH_XLIBS@ @MH_EXTRA_LIBS@ + +INSTALL = $(osdir)/install-sh +RANLIB = @RANLIB@ + +LIBCURSES = libXCurses.a + +LIB_DEPS = -L$(PDCURSES_SRCDIR)/x11 -lXCurses + +PDCLIBS = $(LIBCURSES) @SHL_TARGETS@ + +DEMOS = firework ozdemo ptest rain testcurs tuidemo worm xmas +DEMOOBJS = firework.o ozdemo.o ptest.o rain.o testcurs.o tui.o \ +tuidemo.o worm.o xmas.o + +SHLFILE = XCurses + +all: $(PDCLIBS) + +install: + $(INSTALL) -d -m 755 $(DESTDIR)$(libdir) + $(INSTALL) -d -m 755 $(DESTDIR)$(bindir) + $(INSTALL) -d -m 755 $(DESTDIR)$(includedir) + $(INSTALL) -d -m 755 $(DESTDIR)$(includedir)/xcurses + $(INSTALL) -c -m 644 $(PDCURSES_CURSES_H) \ + $(DESTDIR)$(includedir)/xcurses/curses.h + $(INSTALL) -c -m 644 $(PDCURSES_SRCDIR)/panel.h \ + $(DESTDIR)$(includedir)/xcurses/panel.h + $(INSTALL) -c -m 644 $(osdir)/libXCurses.a $(DESTDIR)$(libdir)/libXCurses.a + -$(RANLIB) $(DESTDIR)$(libdir)/libXCurses.a + -$(INSTALL) -c -m 755 $(osdir)/$(SHLPRE)$(SHLFILE)$(SHLPST) \ + $(DESTDIR)$(libdir)/$(SHLPRE)$(SHLFILE)$(SHLPST) + $(INSTALL) -c -m 755 $(osdir)/xcurses-config $(DESTDIR)$(bindir)/xcurses-config + +clean: + -rm -rf *.o *.sho trace $(PDCLIBS) $(DEMOS) config.log \ + config.cache config.status + +demos: $(DEMOS) + +distclean: clean + -rm -f Makefile config.h xcurses-config + +mostlyclean: clean + +realclean: distclean + +LIBOBJS = addch.o addchstr.o addstr.o attr.o beep.o bkgd.o border.o \ +clear.o color.o delch.o deleteln.o getch.o getstr.o getyx.o \ +inch.o inchstr.o initscr.o inopts.o insch.o insstr.o instr.o kernel.o \ +keyname.o mouse.o move.o outopts.o overlay.o pad.o panel.o printw.o \ +refresh.o scanw.o scr_dump.o scroll.o slk.o termattr.o \ +touch.o util.o window.o debug.o + +PDCOBJS = pdcclip.o pdcdisp.o pdcgetsc.o pdckbd.o pdcscrn.o pdcsetsc.o \ +pdcutil.o sb.o scrlbox.o + +LIBSHOBJS = $(LIBOBJS:.o=.sho) +PDCSHOBJS = $(PDCOBJS:.o=.sho) + +SHOFILES = $(LIBSHOBJS) $(PDCSHOBJS) + +$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) + ar rv $@ $? + -$(RANLIB) $@ + +$(SHLPRE)$(SHLFILE)$(SHLPST) : $(SHOFILES) + $(LD_RXLIB1) -o $@ $(SHOFILES) $(LD_RXLIB2) + +$(LIBOBJS) $(PDCOBJS) $(SHOFILES) : $(PDCURSES_HEADERS) +$(PDCOBJS) $(PDCSHOBJS) : $(PDCURSES_X11_H) +$(DEMOOBJS) : $(PDCURSES_CURSES_H) +$(DEMOS) : $(LIBCURSES) + +addch.o: $(srcdir)/addch.c + $(BUILD) $(srcdir)/addch.c + +addchstr.o: $(srcdir)/addchstr.c + $(BUILD) $(srcdir)/addchstr.c + +addstr.o: $(srcdir)/addstr.c + $(BUILD) $(srcdir)/addstr.c + +attr.o: $(srcdir)/attr.c + $(BUILD) $(srcdir)/attr.c + +beep.o: $(srcdir)/beep.c + $(BUILD) $(srcdir)/beep.c + +bkgd.o: $(srcdir)/bkgd.c + $(BUILD) $(srcdir)/bkgd.c + +border.o: $(srcdir)/border.c + $(BUILD) $(srcdir)/border.c + +clear.o: $(srcdir)/clear.c + $(BUILD) $(srcdir)/clear.c + +color.o: $(srcdir)/color.c + $(BUILD) $(srcdir)/color.c + +delch.o: $(srcdir)/delch.c + $(BUILD) $(srcdir)/delch.c + +deleteln.o: $(srcdir)/deleteln.c + $(BUILD) $(srcdir)/deleteln.c + +getch.o: $(srcdir)/getch.c + $(BUILD) $(srcdir)/getch.c + +getstr.o: $(srcdir)/getstr.c + $(BUILD) $(srcdir)/getstr.c + +getyx.o: $(srcdir)/getyx.c + $(BUILD) $(srcdir)/getyx.c + +inch.o: $(srcdir)/inch.c + $(BUILD) $(srcdir)/inch.c + +inchstr.o: $(srcdir)/inchstr.c + $(BUILD) $(srcdir)/inchstr.c + +initscr.o: $(srcdir)/initscr.c + $(BUILD) $(srcdir)/initscr.c + +inopts.o: $(srcdir)/inopts.c + $(BUILD) $(srcdir)/inopts.c + +insch.o: $(srcdir)/insch.c + $(BUILD) $(srcdir)/insch.c + +insstr.o: $(srcdir)/insstr.c + $(BUILD) $(srcdir)/insstr.c + +instr.o: $(srcdir)/instr.c + $(BUILD) $(srcdir)/instr.c + +kernel.o: $(srcdir)/kernel.c + $(BUILD) $(srcdir)/kernel.c + +keyname.o: $(srcdir)/keyname.c + $(BUILD) $(srcdir)/keyname.c + +mouse.o: $(srcdir)/mouse.c + $(BUILD) $(srcdir)/mouse.c + +move.o: $(srcdir)/move.c + $(BUILD) $(srcdir)/move.c + +outopts.o: $(srcdir)/outopts.c + $(BUILD) $(srcdir)/outopts.c + +overlay.o: $(srcdir)/overlay.c + $(BUILD) $(srcdir)/overlay.c + +pad.o: $(srcdir)/pad.c + $(BUILD) $(srcdir)/pad.c + +panel.o: $(srcdir)/panel.c $(PDCURSES_SRCDIR)/panel.h + $(BUILD) $(srcdir)/panel.c + +printw.o: $(srcdir)/printw.c + $(BUILD) $(srcdir)/printw.c + +refresh.o: $(srcdir)/refresh.c + $(BUILD) $(srcdir)/refresh.c + +scanw.o: $(srcdir)/scanw.c + $(BUILD) $(srcdir)/scanw.c + +scr_dump.o: $(srcdir)/scr_dump.c + $(BUILD) $(srcdir)/scr_dump.c + +scroll.o: $(srcdir)/scroll.c + $(BUILD) $(srcdir)/scroll.c + +slk.o: $(srcdir)/slk.c + $(BUILD) $(srcdir)/slk.c + +termattr.o: $(srcdir)/termattr.c + $(BUILD) $(srcdir)/termattr.c + +touch.o: $(srcdir)/touch.c + $(BUILD) $(srcdir)/touch.c + +util.o: $(srcdir)/util.c + $(BUILD) $(srcdir)/util.c + +window.o: $(srcdir)/window.c + $(BUILD) $(srcdir)/window.c + +debug.o: $(srcdir)/debug.c + $(BUILD) $(srcdir)/debug.c + +pdcclip.o: $(osdir)/pdcclip.c + $(BUILD) $(osdir)/pdcclip.c + +pdcdisp.o: $(osdir)/pdcdisp.c + $(BUILD) $(osdir)/pdcdisp.c + +pdcgetsc.o: $(osdir)/pdcgetsc.c + $(BUILD) $(osdir)/pdcgetsc.c + +pdckbd.o: $(osdir)/pdckbd.c + $(BUILD) $(osdir)/pdckbd.c + +pdcscrn.o: $(osdir)/pdcscrn.c + $(BUILD) $(osdir)/pdcscrn.c + +pdcsetsc.o: $(osdir)/pdcsetsc.c + $(BUILD) $(osdir)/pdcsetsc.c + +pdcutil.o: $(osdir)/pdcutil.c + $(BUILD) $(osdir)/pdcutil.c + +scrlbox.o: $(osdir)/scrlbox.c + $(BUILD) $(osdir)/scrlbox.c + +sb.o: $(osdir)/sb.c + $(BUILD) $(osdir)/sb.c + +addch.sho: $(srcdir)/addch.c + $(DYN_BUILD) $(srcdir)/addch.c + @SAVE2O@ + +addchstr.sho: $(srcdir)/addchstr.c + $(DYN_BUILD) $(srcdir)/addchstr.c + @SAVE2O@ + +addstr.sho: $(srcdir)/addstr.c + $(DYN_BUILD) $(srcdir)/addstr.c + @SAVE2O@ + +attr.sho: $(srcdir)/attr.c + $(DYN_BUILD) $(srcdir)/attr.c + @SAVE2O@ + +beep.sho: $(srcdir)/beep.c + $(DYN_BUILD) $(srcdir)/beep.c + @SAVE2O@ + +bkgd.sho: $(srcdir)/bkgd.c + $(DYN_BUILD) $(srcdir)/bkgd.c + @SAVE2O@ + +border.sho: $(srcdir)/border.c + $(DYN_BUILD) $(srcdir)/border.c + @SAVE2O@ + +clear.sho: $(srcdir)/clear.c + $(DYN_BUILD) $(srcdir)/clear.c + @SAVE2O@ + +color.sho: $(srcdir)/color.c + $(DYN_BUILD) $(srcdir)/color.c + @SAVE2O@ + +delch.sho: $(srcdir)/delch.c + $(DYN_BUILD) $(srcdir)/delch.c + @SAVE2O@ + +deleteln.sho: $(srcdir)/deleteln.c + $(DYN_BUILD) $(srcdir)/deleteln.c + @SAVE2O@ + +getch.sho: $(srcdir)/getch.c + $(DYN_BUILD) $(srcdir)/getch.c + @SAVE2O@ + +getstr.sho: $(srcdir)/getstr.c + $(DYN_BUILD) $(srcdir)/getstr.c + @SAVE2O@ + +getyx.sho: $(srcdir)/getyx.c + $(DYN_BUILD) $(srcdir)/getyx.c + @SAVE2O@ + +inch.sho: $(srcdir)/inch.c + $(DYN_BUILD) $(srcdir)/inch.c + @SAVE2O@ + +inchstr.sho: $(srcdir)/inchstr.c + $(DYN_BUILD) $(srcdir)/inchstr.c + @SAVE2O@ + +initscr.sho: $(srcdir)/initscr.c + $(DYN_BUILD) $(srcdir)/initscr.c + @SAVE2O@ + +inopts.sho: $(srcdir)/inopts.c + $(DYN_BUILD) $(srcdir)/inopts.c + @SAVE2O@ + +insch.sho: $(srcdir)/insch.c + $(DYN_BUILD) $(srcdir)/insch.c + @SAVE2O@ + +insstr.sho: $(srcdir)/insstr.c + $(DYN_BUILD) $(srcdir)/insstr.c + @SAVE2O@ + +instr.sho: $(srcdir)/instr.c + $(DYN_BUILD) $(srcdir)/instr.c + @SAVE2O@ + +kernel.sho: $(srcdir)/kernel.c + $(DYN_BUILD) $(srcdir)/kernel.c + @SAVE2O@ + +keyname.sho: $(srcdir)/keyname.c + $(DYN_BUILD) $(srcdir)/keyname.c + @SAVE2O@ + +mouse.sho: $(srcdir)/mouse.c + $(DYN_BUILD) $(srcdir)/mouse.c + @SAVE2O@ + +move.sho: $(srcdir)/move.c + $(DYN_BUILD) $(srcdir)/move.c + @SAVE2O@ + +outopts.sho: $(srcdir)/outopts.c + $(DYN_BUILD) $(srcdir)/outopts.c + @SAVE2O@ + +overlay.sho: $(srcdir)/overlay.c + $(DYN_BUILD) $(srcdir)/overlay.c + @SAVE2O@ + +pad.sho: $(srcdir)/pad.c + $(DYN_BUILD) $(srcdir)/pad.c + @SAVE2O@ + +panel.sho: $(srcdir)/panel.c $(PDCURSES_SRCDIR)/panel.h + $(DYN_BUILD) $(srcdir)/panel.c + @SAVE2O@ + +printw.sho: $(srcdir)/printw.c + $(DYN_BUILD) $(srcdir)/printw.c + @SAVE2O@ + +refresh.sho: $(srcdir)/refresh.c + $(DYN_BUILD) $(srcdir)/refresh.c + @SAVE2O@ + +scanw.sho: $(srcdir)/scanw.c + $(DYN_BUILD) $(srcdir)/scanw.c + @SAVE2O@ + +scr_dump.sho: $(srcdir)/scr_dump.c + $(DYN_BUILD) $(srcdir)/scr_dump.c + @SAVE2O@ + +scroll.sho: $(srcdir)/scroll.c + $(DYN_BUILD) $(srcdir)/scroll.c + @SAVE2O@ + +slk.sho: $(srcdir)/slk.c + $(DYN_BUILD) $(srcdir)/slk.c + @SAVE2O@ + +termattr.sho: $(srcdir)/termattr.c + $(DYN_BUILD) $(srcdir)/termattr.c + @SAVE2O@ + +touch.sho: $(srcdir)/touch.c + $(DYN_BUILD) $(srcdir)/touch.c + @SAVE2O@ + +util.sho: $(srcdir)/util.c + $(DYN_BUILD) $(srcdir)/util.c + @SAVE2O@ + +window.sho: $(srcdir)/window.c + $(DYN_BUILD) $(srcdir)/window.c + @SAVE2O@ + +debug.sho: $(srcdir)/debug.c + $(DYN_BUILD) $(srcdir)/debug.c + @SAVE2O@ + +pdcclip.sho: $(osdir)/pdcclip.c + $(DYN_BUILD) $(osdir)/pdcclip.c + @SAVE2O@ + +pdcdisp.sho: $(osdir)/pdcdisp.c + $(DYN_BUILD) $(osdir)/pdcdisp.c + @SAVE2O@ + +pdcgetsc.sho: $(osdir)/pdcgetsc.c + $(DYN_BUILD) $(osdir)/pdcgetsc.c + @SAVE2O@ + +pdckbd.sho: $(osdir)/pdckbd.c + $(DYN_BUILD) $(osdir)/pdckbd.c + @SAVE2O@ + +pdcscrn.sho: $(osdir)/pdcscrn.c + $(DYN_BUILD) $(osdir)/pdcscrn.c + @SAVE2O@ + +pdcsetsc.sho: $(osdir)/pdcsetsc.c + $(DYN_BUILD) $(osdir)/pdcsetsc.c + @SAVE2O@ + +pdcutil.sho: $(osdir)/pdcutil.c + $(DYN_BUILD) $(osdir)/pdcutil.c + @SAVE2O@ + +scrlbox.sho: $(osdir)/scrlbox.c + $(DYN_BUILD) $(osdir)/scrlbox.c + @SAVE2O@ + +sb.sho: $(osdir)/sb.c + $(DYN_BUILD) $(osdir)/sb.c + @SAVE2O@ + +firework: firework.o + $(LINK) firework.o -o $@ $(LDFLAGS) + +ozdemo: ozdemo.o + $(LINK) ozdemo.o -o $@ $(LDFLAGS) + +ptest: ptest.o + $(LINK) ptest.o -o $@ $(LDFLAGS) + +rain: rain.o + $(LINK) rain.o -o $@ $(LDFLAGS) + +testcurs: testcurs.o + $(LINK) testcurs.o -o $@ $(LDFLAGS) + +tuidemo: tuidemo.o tui.o + $(LINK) tui.o tuidemo.o -o $@ $(LDFLAGS) + +worm: worm.o + $(LINK) worm.o -o $@ $(LDFLAGS) + +xmas: xmas.o + $(LINK) xmas.o -o $@ $(LDFLAGS) + +firework.o: $(demodir)/firework.c + $(BUILD) $(demodir)/firework.c + +ozdemo.o: $(demodir)/ozdemo.c + $(BUILD) $(demodir)/ozdemo.c + +ptest.o: $(demodir)/ptest.c $(PDCURSES_SRCDIR)/panel.h + $(BUILD) $(demodir)/ptest.c + +rain.o: $(demodir)/rain.c + $(BUILD) $(demodir)/rain.c + +testcurs.o: $(demodir)/testcurs.c + $(BUILD) $(demodir)/testcurs.c + +tui.o: $(demodir)/tui.c $(demodir)/tui.h + $(BUILD) $(demodir)/tui.c + +tuidemo.o: $(demodir)/tuidemo.c + $(BUILD) $(demodir)/tuidemo.c + +worm.o: $(demodir)/worm.c + $(BUILD) $(demodir)/worm.c + +xmas.o: $(demodir)/xmas.c + $(BUILD) $(demodir)/xmas.c + +# This section provides for compiling and linking the +# ncurses test programs. + +ncurses_testdir = $(HOME)/ncurses-6.4/test + +NCURSES_TESTS = bs gdc hanoi knight tclock lrtest ncurses + +ncurses_tests: $(NCURSES_TESTS) + +ncurses_clean: + -rm -f *.o trace $(NCURSES_TESTS) + +NCFLAGS = -I$(demodir) -I$(ncurses_testdir) + +bs: bs.o $(LIBCURSES) + $(LINK) bs.o -o $@ $(LDFLAGS) + +gdc: gdc.o $(LIBCURSES) + $(LINK) gdc.o -o $@ $(LDFLAGS) + +hanoi: hanoi.o $(LIBCURSES) + $(LINK) hanoi.o -o $@ $(LDFLAGS) -lm + +knight: knight.o $(LIBCURSES) + $(LINK) knight.o -o $@ $(LDFLAGS) + +tclock: tclock.o $(LIBCURSES) + $(LINK) tclock.o -o $@ $(LDFLAGS) -lm + +lrtest: lrtest.o $(LIBCURSES) + $(LINK) lrtest.o -o $@ $(LDFLAGS) + +ncurses: ncurses.o $(LIBCURSES) + $(LINK) ncurses.o -o $@ $(LDFLAGS) + +bs.o: $(ncurses_testdir)/bs.c $(PDCURSES_CURSES_H) + $(BUILD) $(NCFLAGS) $(ncurses_testdir)/bs.c + +gdc.o: $(ncurses_testdir)/gdc.c $(PDCURSES_CURSES_H) + $(BUILD) $(NCFLAGS) $(ncurses_testdir)/gdc.c + +hanoi.o: $(ncurses_testdir)/hanoi.c $(PDCURSES_CURSES_H) + $(BUILD) $(NCFLAGS) $(ncurses_testdir)/hanoi.c + +knight.o: $(ncurses_testdir)/knight.c $(PDCURSES_CURSES_H) + $(BUILD) $(NCFLAGS) $(ncurses_testdir)/knight.c + +tclock.o: $(ncurses_testdir)/tclock.c $(PDCURSES_CURSES_H) + $(BUILD) $(NCFLAGS) $(ncurses_testdir)/tclock.c + +lrtest.o: $(ncurses_testdir)/lrtest.c $(PDCURSES_CURSES_H) + $(BUILD) $(NCFLAGS) $(ncurses_testdir)/lrtest.c + +ncurses.o: $(ncurses_testdir)/ncurses.c $(PDCURSES_CURSES_H) + $(BUILD) $(NCFLAGS) $(ncurses_testdir)/ncurses.c diff --git a/vendor/pdcurses/x11/README.md b/vendor/pdcurses/x11/README.md new file mode 100644 index 0000000..51d5c6d --- /dev/null +++ b/vendor/pdcurses/x11/README.md @@ -0,0 +1,227 @@ +PDCurses for X11 +================ + +This is a port of PDCurses for X11, aka XCurses. It is designed to +allow existing curses programs to be re-compiled with PDCurses, +resulting in native X11 programs. + + +Building +-------- + +- Run "./configure". To build the narrow-character version of the + library, specify "--disable-widec" as a parameter. + + If your system is lacking in UTF-8 support, you can force the use of + UTF-8 instead of the system locale via "--enable-force-utf8". + + If configure can't find your X include files or X libraries, you can + specify the paths with the arguments "--x-includes=inc_path" and/or + "--x-libraries=lib_path". + + By default, the library and demo programs are built with the optimizer + switch -O2. You can turn this off, and turn on debugging (-g), by + adding "--enable-debug" to the configure command. + +- Run "make". This should build libXCurses. Add the target "demos" to + build the sample programs. + +- Optionally, run "make install". To avoid conflicts with any existing + curses installations, copies of curses.h and panel.h are installed in + (by default) /usr/local/include/xcurses. + + +Usage +----- + +When compiling your application, you need to include the \ +that comes with PDCurses. You also need to link your code with +libXCurses. You may need to link with the following libraries: + + Xaw Xmu Xt X11 SM ICE Xext Xpm + +You can run "xcurses-config --libs" to show the link parameters for your +system. If using dynamic linking, on some systems, "-lXCurses" suffices. + +By calling Xinitscr() rather than initscr(), you can pass your program +name and resource overrides to PDCurses. The program name is used as the +title of the X window, and for defining X resources specific to your +program. You can also set the width and height via PDC_COLS and +PDC_LINES (command-line options and resources will take precedence), and +as always, you can set the title via PDC_set_title(). + + +Interaction with stdio +---------------------- + +Be aware that curses programs that expect to have a normal tty +underneath them will be very disappointed! Output directed to stdout +will go to the xterm that invoked the PDCurses application, or to the +console if not invoked directly from an xterm. Similarly, stdin will +expect its input from the same place as stdout. + + +X Resources +----------- + +PDCurses for X11 recognizes the following resources: + +### lines, cols + +Specify the number of lines and columns the "screen" will have. Directly +equate to LINES and COLS. There is no theoretical maximum. The minimum +values must each be 2. Defaults: 24, 80 + +### normalFont, italicFont, boldFont + +Names of fonts to use. These should be fixed-width. italicFont and +boldFont are used for characters with the A_ITALIC and A_BOLD +atttributes, respectively (if PDC_set_bold(), in the case of boldFont), +and must have the same cell size as normalFont. + +Defaults -- wide: +- -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1 +- -misc-fixed-medium-o-normal--20-200-75-75-c-100-iso10646-1 +- -misc-fixed-bold-r-normal--20-200-75-75-c-100-iso10646-1 + +Narrow: +- -misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1 +- -misc-fixed-medium-o-normal--13-120-75-75-c-70-iso8859-1 +- -misc-fixed-bold-r-normal--13-120-75-75-c-70-iso8859-1 + +### pointer + +The name of a valid pointer cursor. Default: xterm + +### pointerForeColor, pointerBackColor + +Foreground and background colors for the pointer. Defaults: black, white + +### textCursor + +The alignment of the text cursor; horizontal or vertical. Default: +horizontal + +### colorBlack through colorWhite + +The initial values for the first eight colors, as represented by the +curses macros COLOR_BLACK through COLOR_WHITE. Note that these can all +be changed via init_color(). + +The defaults are Black, red3, green3, yellow3, blue3, magenta3, cyan3 +and Grey. + +### colorBoldBlack through colorBoldWhite + +The initial values for the next eight colors (8 through 15). When COLORS +was limited to 8, these colors could only be accessed by combining the +appropriate COLOR_# with the A_BOLD attribute, in the case of foreground +colors, or A_BLINK for background colors. They can now be used directly +by their numbers (or COLOR_# + 8). (Note that some terminals still use +COLORS = 8.) See also PDC_set_bold() and PDC_set_blink(). + +The defaults are grey40, red1, green1, yellow1, blue1, magenta1, cyan1 +and White. + +### bitmap + +The name of a valid bitmap file of depth 1 (black and white) used for +the application's icon. The file is an X bitmap. Default: none + +### pixmap + +The name of a valid pixmap file of any depth supported by the window +manager (color) for the application's icon, The file is an X11 pixmap. +This resource overrides the "bitmap" resource. Default: a 32x32 or 64x64 +pixmap depending on the window manager + +### clickPeriod + +The period (in milliseconds) between a button press and a button release +that determines if a click of a button has occurred. Default: 100 + +### doubleClickPeriod + +The period (in milliseconds) between two button press events that +determines if a double click of a button has occurred. Default: 200 + + +Using Resources +--------------- + +All applications have a top-level class name of "XCurses". If Xinitscr() +is used, it sets an application's top-level widget name. (Otherwise the +name defaults to "PDCurses".) + +Examples for app-defaults or .Xdefaults: + + ! + ! resources for XCurses class of programs + ! + XCurses*lines: 30 + XCurses*cols: 80 + XCurses*normalFont: 9x13 + XCurses*bitmap: /tmp/xcurses.xbm + XCurses*pointer: top_left_arrow + ! + ! resources for testcurs - XCurses + ! + testcurs.colorRed: orange + testcurs.colorBlack: midnightblue + testcurs.lines: 25 + *testcurs.Translations: #override \n \ + F12: string(0x1b) string("[11~") \n + ! + ! resources for THE - XCurses + ! + ! resources with the * wildcard can be overridden by a parameter passed + ! to initscr() + ! + the*normalFont: 9x15 + the*lines: 40 + the*cols: 86 + the*pointer: xterm + the*pointerForeColor: white + the*pointerBackColor: black + ! + ! resources with the . format can not be overridden by a parameter passed + ! to Xinitscr() + ! + the.bitmap: /home/mark/the/the64.xbm + the.pixmap: /home/mark/the/the64.xpm + +Resources may also be passed as parameters to the Xinitscr() function. +Parameters are strings in the form of switches; e.g., to set the color +"red" to "indianred", and the number of lines to 30, the string passed +to Xinitscr would be: "-colorRed indianred -lines 30" + + +Deprecated +---------- + +XCursesProgramName is no longer used. To set the program name, you must +use Xinitscr(), or PDC_set_title() to set just the window title. + +The XCursesExit() function is now called automatically via atexit(). +(Multiple calls to it are OK, so you don't need to remove it if you've +already added it for previous versions of PDCurses.) + +XCURSES is no longer defined automatically, but need not be defined, +unless you want the X11-specific prototypes. (Normal curses programs +won't need it.) + + +Distribution Status +------------------- + +As of April 13, 2006, the files in this directory are released to the +public domain, except for ScrollBox*, which are under essentially the +MIT X License; config.guess and config.sub, which are under the GPL; and +configure, which is under a free license described within it. + + +Acknowledgements +---------------- + +X11 port was provided by Mark Hessling +Single-process modifications by William McBrine diff --git a/vendor/pdcurses/x11/aclocal.m4 b/vendor/pdcurses/x11/aclocal.m4 new file mode 100644 index 0000000..bbb3c19 --- /dev/null +++ b/vendor/pdcurses/x11/aclocal.m4 @@ -0,0 +1,553 @@ +dnl --------------------------------------------------------------------------- +dnl This file offers the following macros... +dnl --------------------------------------------------------------------------- +dnl MH_CHECK_X_INC +dnl MH_CHECK_X_LIB +dnl MH_CHECK_X_HEADERS +dnl MH_CHECK_X_TYPEDEF +dnl MH_CHECK_LIB +dnl MH_SHARED_LIBRARY +dnl MH_HOWTO_DYN_LINK +dnl MH_CHECK_CC_O +dnl MH_SHLPST + +dnl --------------------------------------------------------------------------- +dnl Set up the correct X header file location +dnl --------------------------------------------------------------------------- +AC_DEFUN([MH_CHECK_X_INC], +[ +mh_x11_dir="" +mh_x11_xaw_dir="" + +mh_inc_dirs="$ac_x_header_dirs" + +dnl Provide for user supplying directory + +if test "x$x_includes" != xNONE ; then + mh_inc_dirs="$x_includes $mh_inc_dirs" +fi + +dnl Try to determine the directory containing X headers +dnl We will append X11 to all the paths above as an extra check + +for ac_dir in $mh_inc_dirs ; do + if test -r $ac_dir/Intrinsic.h; then + mh_x11_dir=$ac_dir + break + fi + if test -r $ac_dir/X11/Intrinsic.h; then + mh_x11_dir="$ac_dir/X11" + break + fi +done + +dnl Try to determine the directory containing Xaw headers +dnl We will append X11 to all the paths above as an extra check + +if test "$with_xaw3d" = yes; then + mh_xaw_dir="Xaw3d" +else + if test "$with_nextaw" = yes; then + mh_xaw_dir="neXtaw" + else + mh_xaw_dir="Xaw" + fi +fi +for ac_dir in $mh_inc_dirs ; do + if test -r $ac_dir/$mh_xaw_dir/Box.h; then + mh_x11_xaw_dir=$ac_dir + break + fi + if test -r $ac_dir/X11/$mh_xaw_dir/Box.h; then + mh_x11_xaw_dir="$ac_dir/X11" + break + fi +done + +if test "x$mh_x11_dir" != "x" ; then + mh_x11_dir_no_x11=`echo $mh_x11_dir | sed 's/\/X11$//'` + + if test "$mh_x11_dir_no_x11" != "$mh_x11_dir" ; then + MH_XINC_DIR="-I$mh_x11_dir -I$mh_x11_dir_no_x11" + else + MH_XINC_DIR="-I$mh_x11_dir" + fi +else + AC_MSG_ERROR(Cannot find required header file Intrinsic.h; PDCurses cannot be configured) +fi + +if test "x$mh_x11_xaw_dir" != "x"; then + if test "$mh_x11_xaw_dir" != "$mh_x11_dir" ; then + MH_XINC_DIR="-I$mh_x11_xaw_dir $MH_XINC_DIR" + fi +else + AC_MSG_ERROR(Cannot find required Xaw header file Box.h; PDCurses cannot be configured) +fi + +AC_SUBST(MH_XINC_DIR) + +])dnl + +dnl --------------------------------------------------------------------------- +dnl Set up the correct X library file location +dnl --------------------------------------------------------------------------- +AC_DEFUN([MH_CHECK_X_LIB], +[ +dnl Some systems require extra libraries... + +mh_solaris_flag=no +mh_hpux9_flag=no +AC_REQUIRE([AC_CANONICAL_SYSTEM]) +case "$target" in + *solaris*) + mh_solaris_flag=yes + ;; + *pc-sco*) + extra_x_libs="Xext" + ;; + sparc*sunos*) + extra_x_libs="Xext" + if test "$ac_cv_prog_CC" = "gcc" ; then + extra_ld_flags="-Wl,-Bstatic" + extra_ld_flags2="-Wl,-Bdynamic" + else + extra_ld_flags="-Bstatic" + extra_ld_flags2="-Bdynamic" + fi + ;; + *hpux9*) + mh_hpux9_flag=yes + ;; +esac + +if test "$with_xaw3d" = yes; then + MH_X11_LIBS="Xaw3d Xmu Xt X11 Xpm" +else + if test "$with_nextaw" = yes; then + MH_X11_LIBS="neXtaw Xmu Xt X11 Xpm" + else + MH_X11_LIBS="Xaw Xmu Xt X11 Xpm" + fi +fi +MH_X11R6_LIBS="SM ICE Xext" +mh_x11r6=no + +which dpkg-architecture > /dev/null +if test $? -eq 0; then + multiarch_libdir="/usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`" +else + multiarch_libdir="" +fi + +mh_lib_dirs="$multiarch_libdir /usr/lib64 /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu $x_libraries `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`" + +dnl try to find libSM.[a,sl,so,dylib]. If we find it we are using X11R6 +for ac_dir in $mh_lib_dirs ; do + for mh_xsm in libSM.a libSM.so libSM.sl libSM.dylib; do + if test -r $ac_dir/$mh_xsm; then + mh_x11r6=yes + break 2 + fi + done +done + +if test "$mh_x11r6" = yes ; then + mh_libs="$MH_X11_LIBS $MH_X11R6_LIBS" +else + mh_libs="$MH_X11_LIBS $extra_x_libs" +fi + + +dnl Ensure that all required X libraries are found + +mh_prev_dir="" +mh_where_found="" +mh_where_found_dirs="" +mh_solaris_path="" +for mh_lib in $mh_libs; do + mh_lib_found=no + for ac_dir in $mh_lib_dirs ; do + for mh_ext in a so sl dll.a dylib; do + if test -r $ac_dir/lib$mh_lib.$mh_ext; then + if test "x$mh_prev_dir" != "x$ac_dir" ; then + if test "x$mh_prev_dir" = "x" ; then + mh_where_found="$mh_where_found found in $ac_dir" + else + mh_where_found="$mh_where_found and in $ac_dir" + fi + mh_prev_dir=$ac_dir + mh_where_found_dirs="$mh_where_found_dirs $ac_dir" + MH_XLIBS="$MH_XLIBS -L$ac_dir" + mh_solaris_path="${mh_solaris_path}:$ac_dir" + fi + MH_XLIBS="$MH_XLIBS -l$mh_lib" + mh_lib_found=yes + break 2 + fi + done + done + if test "$mh_lib_found" = no; then + AC_MSG_ERROR(Cannot find required X library; lib$mh_lib. PDCurses cannot be configured) + fi +done + +mh_solaris_path=`echo $mh_solaris_path | sed 's/^://'` +if test "$mh_solaris_flag" = yes ; then + MH_XLIBS="-R$mh_solaris_path $extra_ld_flags $MH_XLIBS $extra_libs $extra_ld_flags2" +else + MH_XLIBS="$extra_ld_flags $MH_XLIBS $extra_libs $extra_ld_flags2" +fi +if test "$mh_hpux9_flag" = yes ; then + grep -q XtSetLanguageProc $mh_x11_dir/Intrinsic.h + if test $? -eq 0 ; then + mh_found_xtshellstrings=no + for mh_acdir in $mh_where_found_dirs ; do + for mh_xaw in `ls $mh_acdir/libXaw.*` ; do + nm $mh_xaw | grep XtShellStrings | grep -qv extern + if test $? -eq 0 ; then + mh_found_xtshellstrings=yes + fi + done + done + if test "$mh_found_xtshellstrings" = no ; then + AC_MSG_WARN(The X11 development environment has not been installed correctly.) + AC_MSG_WARN(The header file; Intrinsic.h, is for X11R5 while the Athena Widget) + AC_MSG_WARN(Set library; libXaw is for X11R4. This is a common problem with) + AC_MSG_WARN(HP-UX 9.x.) + AC_MSG_ERROR(X11 installation incomplete; cannot continue) + fi + fi +fi + +AC_SUBST(MH_XLIBS) + +])dnl + +dnl --------------------------------------------------------------------------- +dnl Determine if the supplied X headers exist. +dnl --------------------------------------------------------------------------- +AC_DEFUN([MH_CHECK_X_HEADERS], +[ +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $MH_XINC_DIR" +for mh_header in $1; do + AC_CHECK_HEADERS($mh_header) +done +CPPFLAGS="$save_CPPFLAGS" +])dnl + +dnl --------------------------------------------------------------------------- +dnl Determine if supplied types have been typedefed +dnl --------------------------------------------------------------------------- +AC_DEFUN([MH_CHECK_X_TYPEDEF], +[ +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $SYS_DEFS $MH_XINC_DIR" +for td in $1 ; do +AC_MSG_CHECKING(if $td is typedefed:) +AC_TRY_COMPILE( +[#include "X11/Xlib.h"], +[$td fred], + [mh_td=yes], + [mh_td=no] +) +if test "$mh_td" = yes ; then + TD_upper=`echo $td | tr a-z A-Z` + AC_DEFINE_UNQUOTED(${TD_upper}_TYPEDEFED, 1) +fi +AC_MSG_RESULT($mh_td) +done +CPPFLAGS="$save_CPPFLAGS" +])dnl + +dnl --------------------------------------------------------------------------- +dnl Check for presence of various libraries +dnl --------------------------------------------------------------------------- +AC_DEFUN([MH_CHECK_LIB], +[ +MH_EXTRA_LIBS='' +for mh_lib in $1; do + if test "$on_qnx" = yes; then + AC_MSG_CHECKING(for library -l${mh_lib}) + if test -r /usr/lib/${mh_lib}3r.lib; then + AC_MSG_RESULT(found) + MH_EXTRA_LIBS="${MH_EXTRA_LIBS} -l${mh_lib}" + else + AC_MSG_RESULT(not found) + fi + else + AC_CHECK_LIB($mh_lib,main,mh_lib_found=yes,mh_lib_found=no) + if test "$mh_lib_found" = yes; then + MH_EXTRA_LIBS="${MH_EXTRA_LIBS} -l${mh_lib}" + fi + fi +done +])dnl + +dnl --------------------------------------------------------------------------- +dnl Work out how to create a dynamically loaded module +dnl --------------------------------------------------------------------------- +AC_DEFUN([MH_HOWTO_DYN_LINK], +[ +mh_compile='${CC-cc} -c $DYN_COMP conftest.$ac_ext 1>&AC_FD_CC' +cat > conftest.$ac_ext < conftest.$ac_ext < $aix_exports +fi + +if test "$ac_cv_header_dl_h" = "yes" -o "$ac_cv_header_dlfcn_h" = "yes" -o "$AIX_DYN" = "yes" -o "$BEOS_DYN" = "yes" -o "$DLFCNINCDIR" != "" -o "$DLFCNLIBDIR" != ""; then + EXPS="1,2,3,4,5,6,7,8,9" + for a in $SHLFILES + do + SHL_TARGETS="${SHL_TARGETS} ${SHLPRE}${a}${SHLPST}" + this=`echo $EXPS | cut -d, -f1` + EXPS=`echo $EXPS | cut -d, -f2-` + if test "$AIX_DYN" = "yes"; then + echo "RXPACKEXP$this=$a.exp" >> $aix_exports + echo "RXPACKEXPORTS$this=-bE:$a.exp" >> $aix_exports + fi + done +fi + +AC_SUBST(DYN_COMP) +AC_SUBST(LIBS) +AC_SUBST(LD_RXLIB1) +AC_SUBST(SHLPRE) +AC_SUBST(SHLPST) +AC_SUBST(SHL_TARGETS) +AC_SUBST(O2SAVE) +AC_SUBST(CC2O) +AC_SUBST(SAVE2O) +AC_SUBST(RXPACKEXPORTS) +])dnl + +dnl --------------------------------------------------------------------------- +dnl Check if C compiler supports -c -o file.ooo +dnl --------------------------------------------------------------------------- +AC_DEFUN([MH_CHECK_CC_O], +[ +AC_MSG_CHECKING(whether $CC understand -c and -o together) +set dummy $CC; ac_cc="`echo [$]2 | +changequote(, )dnl + sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" +changequote([, ])dnl +AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o, +[echo 'foo(){}' > conftest.c +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +eval ac_cv_prog_cc_${ac_cc}_c_o=no +ac_try='${CC-cc} -c conftest.c -o conftest.ooo 1>&AC_FD_CC' +if AC_TRY_EVAL(ac_try) && test -f conftest.ooo && AC_TRY_EVAL(ac_try); +then + ac_try='${CC-cc} -c conftest.c -o conftest.ooo 1>&AC_FD_CC' + if AC_TRY_EVAL(ac_try) && test -f conftest.ooo && AC_TRY_EVAL(ac_try); + then + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + fi +fi +rm -f conftest* +])dnl +if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then + O2SAVE="" + SAVE2O="" + CC2O="-o $"'@' + AC_MSG_RESULT(yes) +else + O2SAVE="-mv \`basename "$'@'" .sho\`.o \`basename "$'@'" .sho\`.o.save;" + SAVE2O="-mv \`basename "$'@'" .sho\`.o "$'@'"; mv \`basename "$'@'" .sho\`.o.save \`basename "$'@'" .sho\`.o" + CC2O="" + AC_MSG_RESULT(no) +fi +]) + +dnl --------------------------------------------------------------------------- +dnl Determines the file extension for shared libraries +dnl --------------------------------------------------------------------------- +AC_DEFUN([MH_SHLPST], +[ +AC_MSG_CHECKING(shared library extension) +SHLPST=".so" +AC_REQUIRE([AC_CANONICAL_SYSTEM]) +case "$target" in + *hp-hpux*) + SHLPST=".sl" + ;; + *ibm-aix*) + SHLPST=".a" + ;; + *qnx*) + SHLPST="" + ;; + *cygwin*) + SHLPST=".dll" + ;; + *darwin*) + SHLPST=".dylib" + ;; +esac +AC_SUBST(SHLPST) +AC_MSG_RESULT($SHLPST) +]) diff --git a/vendor/pdcurses/x11/config.guess b/vendor/pdcurses/x11/config.guess new file mode 100755 index 0000000..980b020 --- /dev/null +++ b/vendor/pdcurses/x11/config.guess @@ -0,0 +1,1774 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2022 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2022-09-17' + +# 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 3 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, see . +# +# 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. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess +# +# Please send patches to . + + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2022 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +# Just in case it came from the environment. +GUESS= + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039,SC3028 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD=$driver + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if test -f /.attbin/uname ; 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 + +case $UNAME_SYSTEM in +Linux|GNU|GNU/*) + LIBC=unknown + + set_cc_for_build + cat <<-EOF > "$dummy.c" + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #elif defined(__GLIBC__) + LIBC=gnu + #else + #include + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif + #endif + EOF + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" + + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu + fi + ;; +esac + +# Note: order is significant - the case branches are not exclusive. + +case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + echo unknown)` + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; + *) machine=$UNAME_MACHINE_ARCH-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently (or will in the future) and ABI. + case $UNAME_MACHINE_ARCH in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # Determine ABI tags. + case $UNAME_MACHINE_ARCH in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case $UNAME_VERSION in + Debian*) + release='-gnu' + ;; + *) + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + GUESS=$machine-${os}${release}${abi-} + ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; + *:MidnightBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; + *:ekkoBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; + *:SolidBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; + *:OS108:*:*) + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; + macppc:MirBSD:*:*) + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; + *:MirBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; + *:Sortix:*:*) + GUESS=$UNAME_MACHINE-unknown-sortix + ;; + *:Twizzler:*:*) + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; + *:Redox:*:*) + GUESS=$UNAME_MACHINE-unknown-redox + ;; + mips:OSF1:*.*) + GUESS=mips-dec-osf1 + ;; + alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case $ALPHA_CPU_TYPE in + "EV4 (21064)") + UNAME_MACHINE=alpha ;; + "EV4.5 (21064)") + UNAME_MACHINE=alpha ;; + "LCA4 (21066/21068)") + UNAME_MACHINE=alpha ;; + "EV5 (21164)") + UNAME_MACHINE=alphaev5 ;; + "EV5.6 (21164A)") + UNAME_MACHINE=alphaev56 ;; + "EV5.6 (21164PC)") + UNAME_MACHINE=alphapca56 ;; + "EV5.7 (21164PC)") + UNAME_MACHINE=alphapca57 ;; + "EV6 (21264)") + UNAME_MACHINE=alphaev6 ;; + "EV6.7 (21264A)") + UNAME_MACHINE=alphaev67 ;; + "EV6.8CB (21264C)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8AL (21264B)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8CX (21264D)") + UNAME_MACHINE=alphaev68 ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE=alphaev69 ;; + "EV7 (21364)") + UNAME_MACHINE=alphaev7 ;; + "EV7.9 (21364A)") + UNAME_MACHINE=alphaev79 ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; + Amiga*:UNIX_System_V:4.0:*) + GUESS=m68k-unknown-sysv4 + ;; + *:[Aa]miga[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; + *:[Mm]orph[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-morphos + ;; + *:OS/390:*:*) + GUESS=i370-ibm-openedition + ;; + *:z/VM:*:*) + GUESS=s390-ibm-zvmoe + ;; + *:OS400:*:*) + GUESS=powerpc-ibm-os400 + ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + GUESS=arm-unknown-riscos + ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + GUESS=hppa1.1-hitachi-hiuxmpp + ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; + NILE*:*:*:dcosx) + GUESS=pyramid-pyramid-svr4 + ;; + DRS?6000:unix:4.0:6*) + GUESS=sparc-icl-nx6 + ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; + s390x:SunOS:*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; + sun4H:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + set_cc_for_build + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; + 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. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; + 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'. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; + sun3*:SunOS:*:*) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 + case `/bin/arch` in + sun3) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + sun4) + GUESS=sparc-sun-sunos$UNAME_RELEASE + ;; + esac + ;; + aushp:SunOS:*:*) + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; + m68k:machten:*:*) + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; + powerpc:machten:*:*) + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; + RISC*:Mach:*:*) + GUESS=mips-dec-mach_bsd4.3 + ;; + RISC*:ULTRIX:*:*) + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; + VAX*:ULTRIX*:*:*) + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #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_FOR_BUILD -o "$dummy" "$dummy.c" && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; + Motorola:PowerMAX_OS:*:*) + GUESS=powerpc-motorola-powermax + ;; + Motorola:*:4.3:PL8-*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:Power_UNIX:*:*) + GUESS=powerpc-harris-powerunix + ;; + m88k:CX/UX:7*:*) + GUESS=m88k-harris-cxux7 + ;; + m88k:*:4*:R4*) + GUESS=m88k-motorola-sysv4 + ;; + m88k:*:3*:R3*) + GUESS=m88k-motorola-sysv3 + ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 + then + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x + then + GUESS=m88k-dg-dgux$UNAME_RELEASE + else + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE + fi + else + GUESS=i586-dg-dgux$UNAME_RELEASE + fi + ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + GUESS=m88k-dolphin-sysv3 + ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + GUESS=m88k-motorola-sysv3 + ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + GUESS=m88k-tektronix-sysv3 + ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + GUESS=m68k-tektronix-bsd + ;; + *:IRIX*:*:*) + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + GUESS=i386-ibm-aix + ;; + ia64:AIX:*:*) + if test -x /usr/bin/oslevel ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` + then + GUESS=$SYSTEM_NAME + else + GUESS=rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + GUESS=rs6000-ibm-aix3.2.4 + else + GUESS=rs6000-ibm-aix3.2 + fi + ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if test -x /usr/bin/lslpp ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; + *:AIX:*:*) + GUESS=rs6000-ibm-aix + ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + GUESS=romp-ibm-bsd4.4 + ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + GUESS=rs6000-bull-bosx + ;; + DPX/2?00:B.O.S.:*:*) + GUESS=m68k-bull-sysv3 + ;; + 9000/[34]??:4.3bsd:1.*:*) + GUESS=m68k-hp-bsd + ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + GUESS=m68k-hp-bsd4.4 + ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + case $UNAME_MACHINE in + 9000/31?) HP_ARCH=m68000 ;; + 9000/[34]??) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if test -x /usr/bin/getconf; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case $sc_cpu_version in + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case $sc_kernel_bits in + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 + esac ;; + esac + fi + if test "$HP_ARCH" = ""; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if test "$HP_ARCH" = hppa2.0w + then + set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH=hppa2.0w + else + HP_ARCH=hppa64 + fi + fi + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; + 3050*:HI-UX:*:*) + set_cc_for_build + 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_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=unknown-hitachi-hiuxwe2 + ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + GUESS=hppa1.1-hp-bsd + ;; + 9000/8??:4.3bsd:*:*) + GUESS=hppa1.0-hp-bsd + ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + GUESS=hppa1.0-hp-mpeix + ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + GUESS=hppa1.1-hp-osf + ;; + hp8??:OSF1:*:*) + GUESS=hppa1.0-hp-osf + ;; + i*86:OSF1:*:*) + if test -x /usr/sbin/sysversion ; then + GUESS=$UNAME_MACHINE-unknown-osf1mk + else + GUESS=$UNAME_MACHINE-unknown-osf1 + fi + ;; + parisc*:Lites*:*:*) + GUESS=hppa1.1-hp-lites + ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + GUESS=c1-convex-bsd + ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + GUESS=c34-convex-bsd + ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + GUESS=c38-convex-bsd + ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + GUESS=c4-convex-bsd + ;; + CRAY*Y-MP:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; + CRAY*[A-Z]90:*:*:*) + echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; + CRAY*T3E:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; + CRAY*SV1:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; + *:UNICOS/mp:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; + sparc*:BSD/OS:*:*) + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; + *:BSD/OS:*:*) + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi + else + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf + fi + ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case $UNAME_PROCESSOR in + amd64) + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; + esac + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; + i*:CYGWIN*:*) + GUESS=$UNAME_MACHINE-pc-cygwin + ;; + *:MINGW64*:*) + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; + *:MINGW*:*) + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; + *:MSYS*:*) + GUESS=$UNAME_MACHINE-pc-msys + ;; + i*:PW*:*) + GUESS=$UNAME_MACHINE-pc-pw32 + ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; + *:Interix*:*) + case $UNAME_MACHINE in + x86) + GUESS=i586-pc-interix$UNAME_RELEASE + ;; + authenticamd | genuineintel | EM64T) + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; + IA64) + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; + esac ;; + i*:UWIN*:*) + GUESS=$UNAME_MACHINE-pc-uwin + ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + GUESS=x86_64-pc-cygwin + ;; + prep*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; + *:GNU:*:*) + # the GNU system + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; + x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-pc-managarm-mlibc" + ;; + *:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" + ;; + *:Minix:*:*) + GUESS=$UNAME_MACHINE-unknown-minix + ;; + aarch64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arm*:Linux:*:*) + set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi + else + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf + fi + fi + ;; + avr32*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + cris:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + crisv32:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + e2k:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + frv:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + hexagon:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + i*86:Linux:*:*) + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; + ia64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + k1om:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m32r*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m68*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + mips:Linux:*:* | mips64:Linux:*:*) + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 + sed 's/^ //' << EOF > "$dummy.c" + #undef CPU + #undef mips + #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + MIPS_ENDIAN=el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + MIPS_ENDIAN= + #else + MIPS_ENDIAN= + #endif + #endif +EOF + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } + ;; + mips64el:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + openrisc*:Linux:*:*) + GUESS=or1k-unknown-linux-$LIBC + ;; + or32:Linux:*:* | or1k*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + padre:Linux:*:*) + GUESS=sparc-unknown-linux-$LIBC + ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + GUESS=hppa64-unknown-linux-$LIBC + ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; + esac + ;; + ppc64:Linux:*:*) + GUESS=powerpc64-unknown-linux-$LIBC + ;; + ppc:Linux:*:*) + GUESS=powerpc-unknown-linux-$LIBC + ;; + ppc64le:Linux:*:*) + GUESS=powerpc64le-unknown-linux-$LIBC + ;; + ppcle:Linux:*:*) + GUESS=powerpcle-unknown-linux-$LIBC + ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + s390:Linux:*:* | s390x:Linux:*:*) + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; + sh64*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sh*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + tile*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + vax:Linux:*:*) + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; + x86_64:Linux:*:*) + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __i386__ + ABI=x86 + #else + #ifdef __ILP32__ + ABI=x32 + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + x86) CPU=i686 ;; + x32) LIBCABI=${LIBC}x32 ;; + esac + fi + GUESS=$CPU-pc-linux-$LIBCABI + ;; + xtensa*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + GUESS=i386-sequent-sysv4 + ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; + i*86:XTS-300:*:STOP) + GUESS=$UNAME_MACHINE-unknown-stop + ;; + i*86:atheos:*:*) + GUESS=$UNAME_MACHINE-unknown-atheos + ;; + i*86:syllable:*:*) + GUESS=$UNAME_MACHINE-pc-syllable + ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; + i*86:*DOS:*:*) + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; + i*86:*:4.*:*) + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL + fi + ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; + 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|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv32 + fi + ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configure will decide that + # this is a cross-build. + GUESS=i586-pc-msdosdjgpp + ;; + Intel:Mach:3*:*) + GUESS=i386-pc-mach3 + ;; + paragon:*:*:*) + GUESS=i860-intel-osf1 + ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 + fi + ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + GUESS=m68010-convergent-sysv + ;; + mc68k:UNIX:SYSTEM5:3.51m) + GUESS=m68k-convergent-sysv + ;; + M680?0:D-NIX:5.3:*) + GUESS=m68k-diab-dnix + ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + 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; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; + mc68030:UNIX_System_V:4.*:*) + GUESS=m68k-atari-sysv4 + ;; + TSUNAMI:LynxOS:2.*:*) + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; + rs6000:LynxOS:2.*:*) + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; + SM[BE]S:UNIX_SV:*:*) + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; + RM*:ReliantUNIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + RM*:SINIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + GUESS=$UNAME_MACHINE-sni-sysv4 + else + GUESS=ns32k-sni-sysv + fi + ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + GUESS=i586-unisys-sysv4 + ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + GUESS=hppa1.1-stratus-sysv4 + ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + GUESS=i860-stratus-sysv4 + ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=$UNAME_MACHINE-stratus-vos + ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=hppa1.1-stratus-vos + ;; + mc68*:A/UX:*:*) + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; + news*:NEWS-OS:6*:*) + GUESS=mips-sony-newsos6 + ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if test -d /usr/nec; then + GUESS=mips-nec-sysv$UNAME_RELEASE + else + GUESS=mips-unknown-sysv$UNAME_RELEASE + fi + ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + GUESS=powerpc-be-beos + ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + GUESS=powerpc-apple-beos + ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + GUESS=i586-pc-beos + ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + GUESS=i586-pc-haiku + ;; + ppc:Haiku:*:*) # Haiku running on Apple PowerPC + GUESS=powerpc-apple-haiku + ;; + *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) + GUESS=$UNAME_MACHINE-unknown-haiku + ;; + SX-4:SUPER-UX:*:*) + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; + SX-5:SUPER-UX:*:*) + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; + SX-6:SUPER-UX:*:*) + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; + SX-7:SUPER-UX:*:*) + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; + SX-8:SUPER-UX:*:*) + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; + SX-8R:SUPER-UX:*:*) + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; + SX-ACE:SUPER-UX:*:*) + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; + Power*:Rhapsody:*:*) + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; + *:Rhapsody:*:*) + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; + arm64:Darwin:*:*) + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build + fi + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE + fi + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = x86; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; + *:QNX:*:4*) + GUESS=i386-pc-qnx + ;; + NEO-*:NONSTOP_KERNEL:*:*) + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; + NSE-*:NONSTOP_KERNEL:*:*) + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; + NSR-*:NONSTOP_KERNEL:*:*) + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; + NSV-*:NONSTOP_KERNEL:*:*) + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; + NSX-*:NONSTOP_KERNEL:*:*) + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; + *:NonStop-UX:*:*) + GUESS=mips-compaq-nonstopux + ;; + BS2000:POSIX*:*:*) + GUESS=bs2000-siemens-sysv + ;; + DS/*:UNIX_System_V:*:*) + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "${cputype-}" = 386; then + UNAME_MACHINE=i386 + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype + fi + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; + *:TOPS-10:*:*) + GUESS=pdp10-unknown-tops10 + ;; + *:TENEX:*:*) + GUESS=pdp10-unknown-tenex + ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + GUESS=pdp10-dec-tops20 + ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + GUESS=pdp10-xkl-tops20 + ;; + *:TOPS-20:*:*) + GUESS=pdp10-unknown-tops20 + ;; + *:ITS:*:*) + GUESS=pdp10-unknown-its + ;; + SEI:*:*:SEIUX) + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; + *:DragonFly:*:*) + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; + esac ;; + *:XENIX:*:SysV) + GUESS=i386-pc-xenix + ;; + i*86:skyos:*:*) + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; + i*86:rdos:*:*) + GUESS=$UNAME_MACHINE-pc-rdos + ;; + i*86:Fiwix:*:*) + GUESS=$UNAME_MACHINE-pc-fiwix + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; + x86_64:VMkernel:*:*) + GUESS=$UNAME_MACHINE-unknown-esx + ;; + amd64:Isilon\ OneFS:*:*) + GUESS=x86_64-unknown-onefs + ;; + *:Unleashed:*:*) + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; +esac + +# Do we have a guess based on uname results? +if test "x$GUESS" != x; then + echo "$GUESS" + exit +fi + +# No uname command or uname output not recognized. +set_cc_for_build +cat > "$dummy.c" < +#include +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include +#if defined(_SIZE_T_) || defined(SIGLOST) +#include +#endif +#endif +#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 (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%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) +#include +#if defined (BSD) +#if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +#else +#if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#endif +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#else +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } + +echo "$0: unable to guess system type" >&2 + +case $UNAME_MACHINE:$UNAME_SYSTEM in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <&2 <&2 </dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = "$UNAME_MACHINE" +UNAME_RELEASE = "$UNAME_RELEASE" +UNAME_SYSTEM = "$UNAME_SYSTEM" +UNAME_VERSION = "$UNAME_VERSION" +EOF +fi + +exit 1 + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/vendor/pdcurses/x11/config.h.in b/vendor/pdcurses/x11/config.h.in new file mode 100644 index 0000000..97ee54f --- /dev/null +++ b/vendor/pdcurses/x11/config.h.in @@ -0,0 +1,34 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if you have the header file */ +#undef HAVE_DECKEYSYM_H + +/* Define to 1 if you have the `poll' function. */ +#undef HAVE_POLL + +/* Define if you have the header file */ +#undef HAVE_SUNKEYSYM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `usleep' function. */ +#undef HAVE_USLEEP + +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* Define to 1 if you have the `vsscanf' function. */ +#undef HAVE_VSSCANF + +/* Define if you have the header file */ +#undef HAVE_XPM_H + +/* Define if you want to use neXtaw library */ +#undef USE_NEXTAW + +/* Define if you want to use Xaw3d library */ +#undef USE_XAW3D + +/* Define XPointer is typedefed in X11/Xlib.h */ +#undef XPOINTER_TYPEDEFED diff --git a/vendor/pdcurses/x11/config.sub b/vendor/pdcurses/x11/config.sub new file mode 100755 index 0000000..baf1512 --- /dev/null +++ b/vendor/pdcurses/x11/config.sub @@ -0,0 +1,1907 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2022 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2022-09-17' + +# 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 3 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, see . +# +# 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. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to . +# +# 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. + +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub + +# 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. + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS + +Canonicalize a configuration name. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2022 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo "$1" + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Split fields of configuration type +# shellcheck disable=SC2162 +saved_IFS=$IFS +IFS="-" read field1 field2 field3 field4 <&2 + exit 1 + ;; + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 + ;; + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3 + case $maybe_os in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ + | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*) + basic_machine=$field1 + basic_os=$maybe_os + ;; + android-linux) + basic_machine=$field1-unknown + basic_os=linux-android + ;; + *) + basic_machine=$field1-$field2 + basic_os=$field3 + ;; + esac + ;; + *-*) + # A lone config we happen to match not fitting any pattern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + basic_os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + basic_os=$field2 + ;; + zephyr*) + basic_machine=$field1-unknown + basic_os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | 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 | axis | knuth | cray \ + | microblaze* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + basic_os= + ;; + *) + basic_machine=$field1 + basic_os=$field2 + ;; + esac + ;; + esac + ;; + *) + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + basic_os=bsd + ;; + a29khif) + basic_machine=a29k-amd + basic_os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + basic_os=scout + ;; + alliant) + basic_machine=fx80-alliant + basic_os= + ;; + altos | altos3068) + basic_machine=m68k-altos + basic_os= + ;; + am29k) + basic_machine=a29k-none + basic_os=bsd + ;; + amdahl) + basic_machine=580-amdahl + basic_os=sysv + ;; + amiga) + basic_machine=m68k-unknown + basic_os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + basic_os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + basic_os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + basic_os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + basic_os=bsd + ;; + aros) + basic_machine=i386-pc + basic_os=aros + ;; + aux) + basic_machine=m68k-apple + basic_os=aux + ;; + balance) + basic_machine=ns32k-sequent + basic_os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + basic_os=linux + ;; + cegcc) + basic_machine=arm-unknown + basic_os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + basic_os=bsd + ;; + convex-c2) + basic_machine=c2-convex + basic_os=bsd + ;; + convex-c32) + basic_machine=c32-convex + basic_os=bsd + ;; + convex-c34) + basic_machine=c34-convex + basic_os=bsd + ;; + convex-c38) + basic_machine=c38-convex + basic_os=bsd + ;; + cray) + basic_machine=j90-cray + basic_os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + basic_os= + ;; + da30) + basic_machine=m68k-da30 + basic_os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + basic_os= + ;; + delta88) + basic_machine=m88k-motorola + basic_os=sysv3 + ;; + dicos) + basic_machine=i686-pc + basic_os=dicos + ;; + djgpp) + basic_machine=i586-pc + basic_os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + basic_os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + basic_os=ose + ;; + gmicro) + basic_machine=tron-gmicro + basic_os=sysv + ;; + go32) + basic_machine=i386-pc + basic_os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + basic_os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + basic_os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + basic_os=hms + ;; + harris) + basic_machine=m88k-harris + basic_os=sysv3 + ;; + hp300 | hp300hpux) + basic_machine=m68k-hp + basic_os=hpux + ;; + hp300bsd) + basic_machine=m68k-hp + basic_os=bsd + ;; + hppaosf) + basic_machine=hppa1.1-hp + basic_os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + basic_os=proelf + ;; + i386mach) + basic_machine=i386-mach + basic_os=mach + ;; + isi68 | isi) + basic_machine=m68k-isi + basic_os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + basic_os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + basic_os=sysv + ;; + merlin) + basic_machine=ns32k-utek + basic_os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + basic_os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + basic_os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + basic_os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + basic_os=coff + ;; + morphos) + basic_machine=powerpc-unknown + basic_os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + basic_os=moxiebox + ;; + msdos) + basic_machine=i386-pc + basic_os=msdos + ;; + msys) + basic_machine=i686-pc + basic_os=msys + ;; + mvs) + basic_machine=i370-ibm + basic_os=mvs + ;; + nacl) + basic_machine=le32-unknown + basic_os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + basic_os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + basic_os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + basic_os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + basic_os=newsos + ;; + news1000) + basic_machine=m68030-sony + basic_os=newsos + ;; + necv70) + basic_machine=v70-nec + basic_os=sysv + ;; + nh3000) + basic_machine=m68k-harris + basic_os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + basic_os=cxux + ;; + nindy960) + basic_machine=i960-intel + basic_os=nindy + ;; + mon960) + basic_machine=i960-intel + basic_os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + basic_os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + basic_os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + basic_os=ose + ;; + os68k) + basic_machine=m68k-none + basic_os=os68k + ;; + paragon) + basic_machine=i860-intel + basic_os=osf + ;; + parisc) + basic_machine=hppa-unknown + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp + ;; + pw32) + basic_machine=i586-unknown + basic_os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + basic_os=rdos + ;; + rdos32) + basic_machine=i386-pc + basic_os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + basic_os=coff + ;; + sa29200) + basic_machine=a29k-amd + basic_os=udi + ;; + sei) + basic_machine=mips-sei + basic_os=seiux + ;; + sequent) + basic_machine=i386-sequent + basic_os= + ;; + sps7) + basic_machine=m68k-bull + basic_os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + basic_os= + ;; + stratus) + basic_machine=i860-stratus + basic_os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + basic_os= + ;; + sun2os3) + basic_machine=m68000-sun + basic_os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + basic_os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + basic_os= + ;; + sun3os3) + basic_machine=m68k-sun + basic_os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + basic_os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + basic_os= + ;; + sun4os3) + basic_machine=sparc-sun + basic_os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + basic_os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + basic_os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + basic_os= + ;; + sv1) + basic_machine=sv1-cray + basic_os=unicos + ;; + symmetry) + basic_machine=i386-sequent + basic_os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + basic_os=unicos + ;; + t90) + basic_machine=t90-cray + basic_os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + basic_os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + basic_os=tpf + ;; + udi29k) + basic_machine=a29k-amd + basic_os=udi + ;; + ultra3) + basic_machine=a29k-nyu + basic_os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + basic_os=none + ;; + vaxv) + basic_machine=vax-dec + basic_os=sysv + ;; + vms) + basic_machine=vax-dec + basic_os=vms + ;; + vsta) + basic_machine=i386-pc + basic_os=vsta + ;; + vxworks960) + basic_machine=i960-wrs + basic_os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + basic_os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + basic_os=vxworks + ;; + xbox) + basic_machine=i686-pc + basic_os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + basic_os=unicos + ;; + *) + basic_machine=$1 + basic_os= + ;; + esac + ;; +esac + +# Decode 1-component or ad-hoc basic machines +case $basic_machine in + # 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. + w89k) + cpu=hppa1.1 + vendor=winbond + ;; + op50n) + cpu=hppa1.1 + vendor=oki + ;; + op60c) + cpu=hppa1.1 + vendor=oki + ;; + ibm*) + cpu=i370 + vendor=ibm + ;; + orion105) + cpu=clipper + vendor=highlevel + ;; + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple + ;; + pmac | pmac-mpw) + cpu=powerpc + vendor=apple + ;; + + # 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) + cpu=m68000 + vendor=att + ;; + 3b*) + cpu=we32k + vendor=att + ;; + bluegene*) + cpu=powerpc + vendor=ibm + basic_os=cnk + ;; + decsystem10* | dec10*) + cpu=pdp10 + vendor=dec + basic_os=tops10 + ;; + decsystem20* | dec20*) + cpu=pdp10 + vendor=dec + basic_os=tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + cpu=m68k + vendor=motorola + ;; + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 + ;; + encore | umax | mmax) + cpu=ns32k + vendor=encore + ;; + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} + ;; + fx2800) + cpu=i860 + vendor=alliant + ;; + genix) + cpu=ns32k + vendor=ns + ;; + h3050r* | hiux*) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + cpu=m68000 + vendor=hp + ;; + hp9k3[2-9][0-9]) + cpu=m68k + vendor=hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + i*86v32) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv32 + ;; + i*86v4*) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv4 + ;; + i*86v) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv + ;; + i*86sol2) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=solaris2 + ;; + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} + ;; + iris | iris4d) + cpu=mips + vendor=sgi + case $basic_os in + irix*) + ;; + *) + basic_os=irix4 + ;; + esac + ;; + miniframe) + cpu=m68000 + vendor=convergent + ;; + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint + ;; + news-3600 | risc-news) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) + ;; + ns2*) + basic_os=nextstep2 + ;; + *) + basic_os=nextstep3 + ;; + esac + ;; + np1) + cpu=np1 + vendor=gould + ;; + op50n-* | op60c-*) + cpu=hppa1.1 + vendor=oki + basic_os=proelf + ;; + pa-hitachi) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + pbd) + cpu=sparc + vendor=tti + ;; + pbb) + cpu=m68k + vendor=tti + ;; + pc532) + cpu=ns32k + vendor=pc532 + ;; + pn) + cpu=pn + vendor=gould + ;; + power) + cpu=power + vendor=ibm + ;; + ps2) + cpu=i386 + vendor=ibm + ;; + rm[46]00) + cpu=mips + vendor=siemens + ;; + rtpc | rtpc-*) + cpu=romp + vendor=ibm + ;; + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} + ;; + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks + ;; + tower | tower-32) + cpu=m68k + vendor=ncr + ;; + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu + ;; + w65) + cpu=w65 + vendor=wdc + ;; + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf + ;; + none) + cpu=none + vendor=none + ;; + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine + ;; + leon-*|leon[3-9]-*) + cpu=sparc + vendor=`echo "$basic_machine" | sed 's/-.*//'` + ;; + + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read cpu vendor <&2 + exit 1 + ;; + esac + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $vendor in + digital*) + vendor=dec + ;; + commodore*) + vendor=cbm + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if test x$basic_os != x +then + +# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just +# set os. +case $basic_os in + gnu/linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` + ;; + os2-emx) + kernel=os2 + os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` + ;; + nto-qnx*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` + ;; + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read kernel os <&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os in + linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ + | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* ) + ;; + uclinux-uclibc* ) + ;; + managarm-mlibc* | managarm-kernel* ) + ;; + -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + -kernel* ) + echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + *-kernel* ) + echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2 + exit 1 + ;; + kfreebsd*-gnu* | kopensolaris*-gnu*) + ;; + vxworks-simlinux | vxworks-simwindows | vxworks-spe) + ;; + nto-qnx*) + ;; + os2-emx) + ;; + *-eabi* | *-gnueabi*) + ;; + -*) + # Blank kernel with real OS is always fine. + ;; + *-*) + echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + exit 1 + ;; +esac + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) + vendor=acorn + ;; + *-sunos*) + vendor=sun + ;; + *-cnk* | *-aix*) + vendor=ibm + ;; + *-beos*) + vendor=be + ;; + *-hpux*) + vendor=hp + ;; + *-mpeix*) + vendor=hp + ;; + *-hiux*) + vendor=hitachi + ;; + *-unos*) + vendor=crds + ;; + *-dgux*) + vendor=dg + ;; + *-luna*) + vendor=omron + ;; + *-genix*) + vendor=ns + ;; + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) + vendor=ibm + ;; + s390-* | s390x-*) + vendor=ibm + ;; + *-ptx*) + vendor=sequent + ;; + *-tpf*) + vendor=ibm + ;; + *-vxsim* | *-vxworks* | *-windiss*) + vendor=wrs + ;; + *-aux*) + vendor=apple + ;; + *-hms*) + vendor=hitachi + ;; + *-mpw* | *-macos*) + vendor=apple + ;; + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) + vendor=atari + ;; + *-vos*) + vendor=stratus + ;; + esac + ;; +esac + +echo "$cpu-$vendor-${kernel:+$kernel-}$os" +exit + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/vendor/pdcurses/x11/configure b/vendor/pdcurses/x11/configure new file mode 100755 index 0000000..80e8757 --- /dev/null +++ b/vendor/pdcurses/x11/configure @@ -0,0 +1,5940 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.69 for PDCurses 3.9. +# +# Report bugs to . +# +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and wmcbrine@gmail.com +$0: about your system, including any error possibly output +$0: before this message. Then install a modern shell, or +$0: manually run the script under such a shell if you do +$0: have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='PDCurses' +PACKAGE_TARNAME='PDCurses' +PACKAGE_VERSION='3.9' +PACKAGE_STRING='PDCurses 3.9' +PACKAGE_BUGREPORT='wmcbrine@gmail.com' +PACKAGE_URL='' + +ac_unique_file="pdcx11.h" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='LTLIBOBJS +LIBOBJS +RXPACKEXPORTS +SAVE2O +CC2O +O2SAVE +SHL_TARGETS +SHLPRE +LD_RXLIB1 +DYN_COMP +SHLPST +PDC_WIDE +MH_XLIBS +MH_XINC_DIR +XMKMF +MH_EXTRA_LIBS +EGREP +GREP +CPP +SET_MAKE +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +RANLIB +SYS_DEFS +target_os +target_vendor +target_cpu +target +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +with_x +enable_debug +enable_widec +enable_force_utf8 +with_xaw3d +with_nextaw +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +XMKMF' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures PDCurses 3.9 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/PDCurses] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +X features: + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of PDCurses 3.9:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-debug turn on debugging + --disable-widec omit support for wide characters + --enable-force-utf8 override locale settings; use UTF-8 + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-x use the X Window System + --with-xaw3d link with Xaw3d + --with-nextaw link with neXtaw + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + XMKMF Path to xmkmf, Makefile generator for X Window System + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +PDCurses configure 3.9 +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## --------------------------------- ## +## Report this to wmcbrine@gmail.com ## +## --------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* 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_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by PDCurses $as_me 3.9, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_config_headers="$ac_config_headers config.h" + +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 + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +$as_echo_n "checking target system type... " >&6; } +if ${ac_cv_target+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +$as_echo "$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + + +on_qnx=no +case "$target" in + *hp-hpux*) + SYS_DEFS="-D_HPUX_SOURCE" + ;; + *dec-osf*) + SYS_DEFS="-D_XOPEN_SOURCE_EXTENDED" + ;; + *pc-sco*) + SYS_DEFS="-UM_XENIX -b elf" + ;; + *qnx*) + on_qnx=yes + SYS_DEFS="-Q" + ;; + *) + ;; +esac + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +# 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: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in dlfcn.h \ + dl.h + +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +MH_EXTRA_LIBS='' +for mh_lib in nls; do + if test "$on_qnx" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library -l${mh_lib}" >&5 +$as_echo_n "checking for library -l${mh_lib}... " >&6; } + if test -r /usr/lib/${mh_lib}3r.lib; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 +$as_echo "found" >&6; } + MH_EXTRA_LIBS="${MH_EXTRA_LIBS} -l${mh_lib}" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + fi + else + as_ac_Lib=`$as_echo "ac_cv_lib_$mh_lib''_main" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -l$mh_lib" >&5 +$as_echo_n "checking for main in -l$mh_lib... " >&6; } +if eval \${$as_ac_Lib+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$mh_lib $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main () +{ +return main (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + mh_lib_found=yes +else + mh_lib_found=no +fi + + if test "$mh_lib_found" = yes; then + MH_EXTRA_LIBS="${MH_EXTRA_LIBS} -l${mh_lib}" + fi + fi +done + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understand -c and -o together" >&5 +$as_echo_n "checking whether $CC understand -c and -o together... " >&6; } +set dummy $CC; ac_cc="`echo $2 | + sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" +if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + echo 'foo(){}' > conftest.c +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +eval ac_cv_prog_cc_${ac_cc}_c_o=no +ac_try='${CC-cc} -c conftest.c -o conftest.ooo 1>&5' +if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -f conftest.ooo && { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; +then + ac_try='${CC-cc} -c conftest.c -o conftest.ooo 1>&5' + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -f conftest.ooo && { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; + then + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + fi +fi +rm -f conftest* + +fi +if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then + O2SAVE="" + SAVE2O="" + CC2O="-o $"'@' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + O2SAVE="-mv \`basename "$'@'" .sho\`.o \`basename "$'@'" .sho\`.o.save;" + SAVE2O="-mv \`basename "$'@'" .sho\`.o "$'@'"; mv \`basename "$'@'" .sho\`.o.save \`basename "$'@'" .sho\`.o" + CC2O="" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +for ac_func in vsscanf usleep poll vsnprintf +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 +$as_echo_n "checking for X... " >&6; } + + +# Check whether --with-x was given. +if test "${with_x+set}" = set; then : + withval=$with_x; +fi + +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +if test "x$with_x" = xno; then + # The user explicitly disabled X. + have_x=disabled +else + case $x_includes,$x_libraries in #( + *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( + *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then : + $as_echo_n "(cached) " >&6 +else + # One or both of the vars are not set, and there is no cached value. +ac_x_includes=no ac_x_libraries=no +rm -f -r conftest.dir +if mkdir conftest.dir; then + cd conftest.dir + cat >Imakefile <<'_ACEOF' +incroot: + @echo incroot='${INCROOT}' +usrlibdir: + @echo usrlibdir='${USRLIBDIR}' +libdir: + @echo libdir='${LIBDIR}' +_ACEOF + if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then + # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. + for ac_var in incroot usrlibdir libdir; do + eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" + done + # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. + for ac_extension in a so sl dylib la dll; do + if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && + test -f "$ac_im_libdir/libX11.$ac_extension"; then + ac_im_usrlibdir=$ac_im_libdir; break + fi + done + # Screen out bogus values from the imake configuration. They are + # bogus both because they are the default anyway, and because + # using them would break gcc on systems where it needs fixed includes. + case $ac_im_incroot in + /usr/include) ac_x_includes= ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; + esac + case $ac_im_usrlibdir in + /usr/lib | /usr/lib64 | /lib | /lib64) ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; + esac + fi + cd .. + rm -f -r conftest.dir +fi + +# Standard set of common directories for X headers. +# Check X11 before X11Rn because it is often a symlink to the current release. +ac_x_header_dirs=' +/usr/X11/include +/usr/X11R7/include +/usr/X11R6/include +/usr/X11R5/include +/usr/X11R4/include + +/usr/include/X11 +/usr/include/X11R7 +/usr/include/X11R6 +/usr/include/X11R5 +/usr/include/X11R4 + +/usr/local/X11/include +/usr/local/X11R7/include +/usr/local/X11R6/include +/usr/local/X11R5/include +/usr/local/X11R4/include + +/usr/local/include/X11 +/usr/local/include/X11R7 +/usr/local/include/X11R6 +/usr/local/include/X11R5 +/usr/local/include/X11R4 + +/usr/X386/include +/usr/x386/include +/usr/XFree86/include/X11 + +/usr/include +/usr/local/include +/usr/unsupported/include +/usr/athena/include +/usr/local/x11r5/include +/usr/lpp/Xamples/include + +/usr/openwin/include +/usr/openwin/share/include' + +if test "$ac_x_includes" = no; then + # Guess where to find include files, by looking for Xlib.h. + # First, try using that file with no special directory specified. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # We can compile using X headers with no special include directory. +ac_x_includes= +else + for ac_dir in $ac_x_header_dirs; do + if test -r "$ac_dir/X11/Xlib.h"; then + ac_x_includes=$ac_dir + break + fi +done +fi +rm -f conftest.err conftest.i conftest.$ac_ext +fi # $ac_x_includes = no + +if test "$ac_x_libraries" = no; then + # Check for the libraries. + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS=$LIBS + LIBS="-lX11 $LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +XrmInitialize () + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + LIBS=$ac_save_LIBS +# We can link X programs with no special library path. +ac_x_libraries= +else + LIBS=$ac_save_LIBS +for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` +do + # Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl dylib la dll; do + if test -r "$ac_dir/libX11.$ac_extension"; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi # $ac_x_libraries = no + +case $ac_x_includes,$ac_x_libraries in #( + no,* | *,no | *\'*) + # Didn't find X, or a directory has "'" in its name. + ac_cv_have_x="have_x=no";; #( + *) + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes\ + ac_x_includes='$ac_x_includes'\ + ac_x_libraries='$ac_x_libraries'" +esac +fi +;; #( + *) have_x=yes;; + esac + eval "$ac_cv_have_x" +fi # $with_x != no + +if test "$have_x" != yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 +$as_echo "$have_x" >&6; } + no_x=yes +else + # If each of the values was on the command line, it overrides each guess. + test "x$x_includes" = xNONE && x_includes=$ac_x_includes + test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries + # Update the cache value to reflect the command line values. + ac_cv_have_x="have_x=yes\ + ac_x_includes='$x_includes'\ + ac_x_libraries='$x_libraries'" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 +$as_echo "libraries $x_libraries, headers $x_includes" >&6; } +fi + + +mh_x11_dir="" +mh_x11_xaw_dir="" + +mh_inc_dirs="$ac_x_header_dirs" + + +if test "x$x_includes" != xNONE ; then + mh_inc_dirs="$x_includes $mh_inc_dirs" +fi + + +for ac_dir in $mh_inc_dirs ; do + if test -r $ac_dir/Intrinsic.h; then + mh_x11_dir=$ac_dir + break + fi + if test -r $ac_dir/X11/Intrinsic.h; then + mh_x11_dir="$ac_dir/X11" + break + fi +done + + +if test "$with_xaw3d" = yes; then + mh_xaw_dir="Xaw3d" +else + if test "$with_nextaw" = yes; then + mh_xaw_dir="neXtaw" + else + mh_xaw_dir="Xaw" + fi +fi +for ac_dir in $mh_inc_dirs ; do + if test -r $ac_dir/$mh_xaw_dir/Box.h; then + mh_x11_xaw_dir=$ac_dir + break + fi + if test -r $ac_dir/X11/$mh_xaw_dir/Box.h; then + mh_x11_xaw_dir="$ac_dir/X11" + break + fi +done + +if test "x$mh_x11_dir" != "x" ; then + mh_x11_dir_no_x11=`echo $mh_x11_dir | sed 's/\/X11$//'` + + if test "$mh_x11_dir_no_x11" != "$mh_x11_dir" ; then + MH_XINC_DIR="-I$mh_x11_dir -I$mh_x11_dir_no_x11" + else + MH_XINC_DIR="-I$mh_x11_dir" + fi +else + as_fn_error $? "Cannot find required header file Intrinsic.h; PDCurses cannot be configured" "$LINENO" 5 +fi + +if test "x$mh_x11_xaw_dir" != "x"; then + if test "$mh_x11_xaw_dir" != "$mh_x11_dir" ; then + MH_XINC_DIR="-I$mh_x11_xaw_dir $MH_XINC_DIR" + fi +else + as_fn_error $? "Cannot find required Xaw header file Box.h; PDCurses cannot be configured" "$LINENO" 5 +fi + + + + + + +mh_solaris_flag=no +mh_hpux9_flag=no + +case "$target" in + *solaris*) + mh_solaris_flag=yes + ;; + *pc-sco*) + extra_x_libs="Xext" + ;; + sparc*sunos*) + extra_x_libs="Xext" + if test "$ac_cv_prog_CC" = "gcc" ; then + extra_ld_flags="-Wl,-Bstatic" + extra_ld_flags2="-Wl,-Bdynamic" + else + extra_ld_flags="-Bstatic" + extra_ld_flags2="-Bdynamic" + fi + ;; + *hpux9*) + mh_hpux9_flag=yes + ;; +esac + +if test "$with_xaw3d" = yes; then + MH_X11_LIBS="Xaw3d Xmu Xt X11 Xpm" +else + if test "$with_nextaw" = yes; then + MH_X11_LIBS="neXtaw Xmu Xt X11 Xpm" + else + MH_X11_LIBS="Xaw Xmu Xt X11 Xpm" + fi +fi +MH_X11R6_LIBS="SM ICE Xext" +mh_x11r6=no + +which dpkg-architecture > /dev/null +if test $? -eq 0; then + multiarch_libdir="/usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`" +else + multiarch_libdir="" +fi + +mh_lib_dirs="$multiarch_libdir /usr/lib64 /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu $x_libraries `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`" + +for ac_dir in $mh_lib_dirs ; do + for mh_xsm in libSM.a libSM.so libSM.sl libSM.dylib; do + if test -r $ac_dir/$mh_xsm; then + mh_x11r6=yes + break 2 + fi + done +done + +if test "$mh_x11r6" = yes ; then + mh_libs="$MH_X11_LIBS $MH_X11R6_LIBS" +else + mh_libs="$MH_X11_LIBS $extra_x_libs" +fi + + + +mh_prev_dir="" +mh_where_found="" +mh_where_found_dirs="" +mh_solaris_path="" +for mh_lib in $mh_libs; do + mh_lib_found=no + for ac_dir in $mh_lib_dirs ; do + for mh_ext in a so sl dll.a dylib; do + if test -r $ac_dir/lib$mh_lib.$mh_ext; then + if test "x$mh_prev_dir" != "x$ac_dir" ; then + if test "x$mh_prev_dir" = "x" ; then + mh_where_found="$mh_where_found found in $ac_dir" + else + mh_where_found="$mh_where_found and in $ac_dir" + fi + mh_prev_dir=$ac_dir + mh_where_found_dirs="$mh_where_found_dirs $ac_dir" + MH_XLIBS="$MH_XLIBS -L$ac_dir" + mh_solaris_path="${mh_solaris_path}:$ac_dir" + fi + MH_XLIBS="$MH_XLIBS -l$mh_lib" + mh_lib_found=yes + break 2 + fi + done + done + if test "$mh_lib_found" = no; then + as_fn_error $? "Cannot find required X library; lib$mh_lib. PDCurses cannot be configured" "$LINENO" 5 + fi +done + +mh_solaris_path=`echo $mh_solaris_path | sed 's/^://'` +if test "$mh_solaris_flag" = yes ; then + MH_XLIBS="-R$mh_solaris_path $extra_ld_flags $MH_XLIBS $extra_libs $extra_ld_flags2" +else + MH_XLIBS="$extra_ld_flags $MH_XLIBS $extra_libs $extra_ld_flags2" +fi +if test "$mh_hpux9_flag" = yes ; then + grep -q XtSetLanguageProc $mh_x11_dir/Intrinsic.h + if test $? -eq 0 ; then + mh_found_xtshellstrings=no + for mh_acdir in $mh_where_found_dirs ; do + for mh_xaw in `ls $mh_acdir/libXaw.*` ; do + nm $mh_xaw | grep XtShellStrings | grep -qv extern + if test $? -eq 0 ; then + mh_found_xtshellstrings=yes + fi + done + done + if test "$mh_found_xtshellstrings" = no ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The X11 development environment has not been installed correctly." >&5 +$as_echo "$as_me: WARNING: The X11 development environment has not been installed correctly." >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The header file; Intrinsic.h" >&5 +$as_echo "$as_me: WARNING: The header file; Intrinsic.h" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Set library; libXaw is for X11R4. This is a common problem with" >&5 +$as_echo "$as_me: WARNING: Set library; libXaw is for X11R4. This is a common problem with" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: HP-UX 9.x." >&5 +$as_echo "$as_me: WARNING: HP-UX 9.x." >&2;} + as_fn_error $? "X11 installation incomplete; cannot continue" "$LINENO" 5 + fi + fi +fi + + + + + +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $MH_XINC_DIR" +for mh_header in DECkeysym.h Sunkeysym.h xpm.h; do + for ac_header in $mh_header +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +done +CPPFLAGS="$save_CPPFLAGS" + + +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $SYS_DEFS $MH_XINC_DIR" +for td in XPointer ; do +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $td is typedefed:" >&5 +$as_echo_n "checking if $td is typedefed:... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include "X11/Xlib.h" +int +main () +{ +$td fred + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mh_td=yes +else + mh_td=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +if test "$mh_td" = yes ; then + TD_upper=`echo $td | tr a-z A-Z` + cat >>confdefs.h <<_ACEOF +#define ${TD_upper}_TYPEDEFED 1 +_ACEOF + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mh_td" >&5 +$as_echo "$mh_td" >&6; } +done +CPPFLAGS="$save_CPPFLAGS" + + +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then : + enableval=$enable_debug; +fi + +cflags_g="`echo $CFLAGS | grep -c '\-g'`" +cflags_O="`echo $CFLAGS | grep -c '\-O'`" + +if test "$enable_debug" = "yes"; then + if test "$cflags_g" = "0"; then + CFLAGS="${CFLAGS} -g" + fi + if test "$cflags_O" != "0"; then + CFLAGS="`echo ${CFLAGS} | sed -e s/-O.//`" + fi + CFLAGS="${CFLAGS} -DPDCDEBUG" +else + if test "$cflags_O" = "0"; then + CFLAGS="${CFLAGS} -O" + fi + if test "$cflags_g" != "0"; then + CFLAGS="`echo ${CFLAGS} | sed -e s/-g//`" + fi +fi +if test "$ac_cv_prog_CC" = "gcc"; then + if test "$enable_debug" = "yes"; then + CFLAGS="${CFLAGS} -Wall" + else + CFLAGS="-O2 -Wall -fomit-frame-pointer" + fi +fi +if test "$on_qnx" = yes; then + if test "$enable_debug" = "yes"; then + CFLAGS="-g" + else + CFLAGS="-Otax" + fi +fi + +# Check whether --enable-widec was given. +if test "${enable_widec+set}" = set; then : + enableval=$enable_widec; +fi + +PDC_WIDE="" +if test "$enable_widec" != "no"; then + PDC_WIDE="-DPDC_WIDE" + SYS_DEFS="$SYS_DEFS $PDC_WIDE" +fi + + +# Check whether --enable-force-utf8 was given. +if test "${enable_force_utf8+set}" = set; then : + enableval=$enable_force_utf8; +fi + +if test "$enable_force_utf8" = "yes"; then + SYS_DEFS="$SYS_DEFS -DPDC_FORCE_UTF8" +fi + + +# Check whether --with-xaw3d was given. +if test "${with_xaw3d+set}" = set; then : + withval=$with_xaw3d; +fi + +if test "$with_xaw3d" = "yes"; then + +$as_echo "#define USE_XAW3D 1" >>confdefs.h + +fi + + +# Check whether --with-nextaw was given. +if test "${with_nextaw+set}" = set; then : + withval=$with_nextaw; +fi + +if test "$with_nextaw" = "yes"; then + +$as_echo "#define USE_NEXTAW 1" >>confdefs.h + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking shared library extension" >&5 +$as_echo_n "checking shared library extension... " >&6; } +SHLPST=".so" + +case "$target" in + *hp-hpux*) + SHLPST=".sl" + ;; + *ibm-aix*) + SHLPST=".a" + ;; + *qnx*) + SHLPST="" + ;; + *cygwin*) + SHLPST=".dll" + ;; + *darwin*) + SHLPST=".dylib" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHLPST" >&5 +$as_echo "$SHLPST" >&6; } + + + +AIX_DYN="no" +BEOS_DYN="no" +SHLFILE="XCurses" +SHLFILES="XCurses" +RXPACKEXPORTS="" +SHLPRE="lib" +LD_RXLIB1="" + + +case "$target" in + *hp-hpux*) + SYS_DEFS="-D_HPUX_SOURCE" + LD_RXLIB1="ld -b -q -n" + ;; + *ibm-aix*) + SYS_DEFS="-D_ALL_SOURCE -DAIX" + AIX_DYN="yes" + DYN_COMP="-DDYNAMIC" + LD_RXLIB1="ld -bnoentry -bM:SRE" + RXPACKEXPORTS="-bE:$SHLFILE.exp" + RXPACKEXP="$SHLFILE.exp" + ;; + *dec-osf*) + if test "$ac_cv_prog_CC" = "gcc"; then + SYS_DEFS="-D_POSIX_SOURCE -D_XOPEN_SOURCE" + else + SYS_DEFS="-D_POSIX_SOURCE -D_XOPEN_SOURCE -Olimit 800" + fi + LD_RXLIB1="ld -shared" + ;; + *sequent-dynix*|*esix*|*dgux*) + LD_RXLIB1="ld -G" + ;; + *solaris*) + if test "$ac_cv_prog_CC" = "gcc"; then + LD_RXLIB1="gcc -shared" + else + LD_RXLIB1="ld -G" + fi + ;; + sparc*sunos*) + SYS_DEFS="-DSUNOS -DSUNOS_STRTOD_BUG" + LD_RXLIB1="ld" + ;; + *linux*|*atheos*|*nto-qnx*|*openbsd*) + LD_RXLIB1="${CC} -shared" + ;; + *freebsd*) + LD_RXLIB1="ld -Bdynamic -Bshareable" + ;; + *pc-sco*) + LD_RXLIB1="ld -dy -G" + ;; + *beos*) + LD_RXLIB1="${CC} -Wl,-shared -nostart -Xlinker -soname=\$(@)" + BEOS_DYN="yes" + ;; + *qnx*) + SHLPRE="" + DYN_COMP="-Q" # force no check for dynamic loading + SHLFILE="" + ;; + *darwin*) + DYN_COMP="-fno-common" + LD_RXLIB1="${CC} -flat_namespace -undefined suppress -dynamiclib" + ;; + *) + ;; +esac + + +if test "$DYN_COMP" = ""; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler flags for a dynamic object" >&5 +$as_echo_n "checking compiler flags for a dynamic object... " >&6; } + +cat > conftest.$ac_ext <&5 + (eval $mh_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + DYN_COMP="" + else + slash="\\" + mh_dyncomp="`egrep -c $slash$a conftest.tmp`" + if test "$mh_dyncomp" = "0"; then + DYN_COMP="$a -DDYNAMIC" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $a" >&5 +$as_echo "$a" >&6; } + break + else + DYN_COMP="" + fi + fi + done + if test "$DYN_COMP" = ""; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none of $mh_cv_flags supported" >&5 +$as_echo "none of $mh_cv_flags supported" >&6; } + fi + if test "$LD_RXLIB1" = ""; then + +mh_compile='${CC-cc} -c $DYN_COMP conftest.$ac_ext 1>&5' +cat > conftest.$ac_ext <&5 + (eval $mh_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest.o; then + mh_dyn_link='ld -shared -o conftest.rxlib conftest.o -lc 1>&5' +# mh_dyn_link='${CC} -Wl,-shared -o conftest.rxlib conftest.o -lc 1>&AC_FD_CC' + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$mh_dyn_link\""; } >&5 + (eval $mh_dyn_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest.rxlib; then + LD_RXLIB1="ld -shared" +# LD_RXLIB1="${CC} -Wl,-shared" + SHLPRE="lib" + SHLPST=".so" + else + mh_dyn_link='ld -G -o conftest.rxlib conftest.o 1>&5' +# mh_dyn_link='${CC} -Wl,-G -o conftest.rxlib conftest.o 1>&AC_FD_CC' + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$mh_dyn_link\""; } >&5 + (eval $mh_dyn_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest.rxlib; then + LD_RXLIB1="ld -G" +# LD_RXLIB1="${CC} -Wl,-G" + SHLPRE="lib" + SHLPST=".so" + else + LD_RXLIB1="" + SHLPRE="" + SHLPST="" + fi + fi +fi +rm -f conftest* + + fi + CFLAGS=$save_cflags + rm -f conftest.* +fi + + +SHL_TARGETS="" + +if test "$AIX_DYN" = "yes"; then + aix_exports="config.exports.aix" + echo "" > $aix_exports +fi + +if test "$ac_cv_header_dl_h" = "yes" -o "$ac_cv_header_dlfcn_h" = "yes" -o "$AIX_DYN" = "yes" -o "$BEOS_DYN" = "yes" -o "$DLFCNINCDIR" != "" -o "$DLFCNLIBDIR" != ""; then + EXPS="1,2,3,4,5,6,7,8,9" + for a in $SHLFILES + do + SHL_TARGETS="${SHL_TARGETS} ${SHLPRE}${a}${SHLPST}" + this=`echo $EXPS | cut -d, -f1` + EXPS=`echo $EXPS | cut -d, -f2-` + if test "$AIX_DYN" = "yes"; then + echo "RXPACKEXP$this=$a.exp" >> $aix_exports + echo "RXPACKEXPORTS$this=-bE:$a.exp" >> $aix_exports + fi + done +fi + + + + + + + + + + + + + +ac_config_files="$ac_config_files Makefile xcurses-config" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by PDCurses $as_me 3.9, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +PDCurses config.status 3.9 +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "xcurses-config") CONFIG_FILES="$CONFIG_FILES xcurses-config" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi + ;; + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + + +$as_echo "#define HAVE_DECKEYSYM_H /**/" >>confdefs.h + + + +$as_echo "#define HAVE_SUNKEYSYM_H /**/" >>confdefs.h + + + +$as_echo "#define HAVE_XPM_H /**/" >>confdefs.h + + + +$as_echo "#define USE_XAW3D /**/" >>confdefs.h + + + +$as_echo "#define USE_NEXTAW /**/" >>confdefs.h + + + +$as_echo "#define XPOINTER_TYPEDEFED /**/" >>confdefs.h + diff --git a/vendor/pdcurses/x11/configure.ac b/vendor/pdcurses/x11/configure.ac new file mode 100644 index 0000000..1699a20 --- /dev/null +++ b/vendor/pdcurses/x11/configure.ac @@ -0,0 +1,171 @@ +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(PDCurses, 3.9, wmcbrine@gmail.com, PDCurses) +AC_CONFIG_SRCDIR(pdcx11.h) + +AC_SUBST(prefix) + +AC_PROG_CC + +AC_CONFIG_HEADER(config.h) +dnl Checks for system first +AC_CANONICAL_SYSTEM([]) + +on_qnx=no +case "$target" in + *hp-hpux*) + SYS_DEFS="-D_HPUX_SOURCE" + ;; + *dec-osf*) + SYS_DEFS="-D_XOPEN_SOURCE_EXTENDED" + ;; + *pc-sco*) + SYS_DEFS="-UM_XENIX -b elf" + ;; + *qnx*) + on_qnx=yes + SYS_DEFS="-Q" + ;; + *) + ;; +esac +AC_SUBST(SYS_DEFS) + +dnl Check for other programs. +AC_PROG_RANLIB +AC_PROG_INSTALL +AC_PROG_MAKE_SET + +dnl Checks for libraries. + +dnl we check for dlfcn.h or dl.h so we know if we can build shared objects +AC_CHECK_HEADERS(dlfcn.h \ + dl.h +) + +dnl Checks for typedefs, structures, and compiler characteristics. +MH_CHECK_LIB(nls) +AC_SUBST(MH_EXTRA_LIBS) +MH_CHECK_CC_O + +dnl Checks for library functions. +AC_CHECK_FUNCS(vsscanf usleep poll vsnprintf) + +dnl Check for X includes and X libraries +AC_PATH_X +MH_CHECK_X_INC +MH_CHECK_X_LIB +MH_CHECK_X_HEADERS(DECkeysym.h Sunkeysym.h xpm.h) +MH_CHECK_X_TYPEDEF(XPointer) + +dnl ---------- allow --enable-debug to compile in debug mode --------- +AC_ARG_ENABLE(debug, + [ --enable-debug turn on debugging], +) +cflags_g="`echo $CFLAGS | grep -c '\-g'`" +cflags_O="`echo $CFLAGS | grep -c '\-O'`" + +if test "$enable_debug" = "yes"; then + if test "$cflags_g" = "0"; then + CFLAGS="${CFLAGS} -g" + fi + if test "$cflags_O" != "0"; then + CFLAGS="`echo ${CFLAGS} | sed -e s/-O.//`" + fi + CFLAGS="${CFLAGS} -DPDCDEBUG" +else + if test "$cflags_O" = "0"; then + CFLAGS="${CFLAGS} -O" + fi + if test "$cflags_g" != "0"; then + CFLAGS="`echo ${CFLAGS} | sed -e s/-g//`" + fi +fi +if test "$ac_cv_prog_CC" = "gcc"; then + if test "$enable_debug" = "yes"; then + CFLAGS="${CFLAGS} -Wall" + else + CFLAGS="-O2 -Wall -fomit-frame-pointer" + fi +fi +if test "$on_qnx" = yes; then + if test "$enable_debug" = "yes"; then + CFLAGS="-g" + else + CFLAGS="-Otax" + fi +fi + +dnl --------------- check for wide character support ----------------- +dnl allow --enable-widec to include wide character support +AC_ARG_ENABLE(widec, + [ --disable-widec omit support for wide characters], +) +PDC_WIDE="" +if test "$enable_widec" != "no"; then + PDC_WIDE="-DPDC_WIDE" + SYS_DEFS="$SYS_DEFS $PDC_WIDE" +fi +AC_SUBST(PDC_WIDE) + +dnl ------------------------ force UTF-8? ---------------------------- +dnl allow --enable-force-utf8 to override locale settings +AC_ARG_ENABLE(force-utf8, + [ --enable-force-utf8 override locale settings; use UTF-8], +) +if test "$enable_force_utf8" = "yes"; then + SYS_DEFS="$SYS_DEFS -DPDC_FORCE_UTF8" +fi + +dnl --------------------- check for Xaw3d library -------------------- +dnl allow --with-xaw3d to link with PDCurses +AC_ARG_WITH(xaw3d, + [ --with-xaw3d link with Xaw3d], +) +if test "$with_xaw3d" = "yes"; then + AC_DEFINE([USE_XAW3D], [1], + [Define if you want to use Xaw3d library] + ) +fi + +dnl --------------------- check for neXtaw library ------------------- +dnl allow --with-nextaw to link with PDCurses +AC_ARG_WITH(nextaw, + [ --with-nextaw link with neXtaw], +) +if test "$with_nextaw" = "yes"; then + AC_DEFINE([USE_NEXTAW], [1], + [Define if you want to use neXtaw library] + ) +fi + +dnl -------------- check how to make shared libraries ---------------- +dnl Force the ability of shared library usage +MH_SHARED_LIBRARY(XCurses) + +AC_CONFIG_FILES([Makefile xcurses-config]) +AC_OUTPUT + +AC_DEFINE([HAVE_DECKEYSYM_H], [], + [Define if you have the header file] +) + +AC_DEFINE([HAVE_SUNKEYSYM_H], [], + [Define if you have the header file] +) + +AC_DEFINE([HAVE_XPM_H], [], + [Define if you have the header file] +) + +AC_DEFINE([USE_XAW3D], [], + [Define if you want to use Xaw3d library] +) + +AC_DEFINE([USE_NEXTAW], [], + [Define if you want to use neXtaw library] +) + +AC_DEFINE([XPOINTER_TYPEDEFED], [], + [Define XPointer is typedefed in X11/Xlib.h] +) diff --git a/vendor/pdcurses/x11/install-sh b/vendor/pdcurses/x11/install-sh new file mode 100755 index 0000000..fb9e848 --- /dev/null +++ b/vendor/pdcurses/x11/install-sh @@ -0,0 +1,253 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, 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 M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +# +# Modified 1 Feb 2000 MHES to cater for mkdir -p +# +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +mkdircmd="$mkdirprog -p" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdircmd "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + +exit 0 diff --git a/vendor/pdcurses/x11/pdcclip.c b/vendor/pdcurses/x11/pdcclip.c new file mode 100644 index 0000000..16953f9 --- /dev/null +++ b/vendor/pdcurses/x11/pdcclip.c @@ -0,0 +1,247 @@ +/* PDCurses */ + +#include "pdcx11.h" + +#include + +/*man-start************************************************************** + +clipboard +--------- + +### Synopsis + + int PDC_getclipboard(char **contents, long *length); + int PDC_setclipboard(const char *contents, long length); + int PDC_freeclipboard(char *contents); + int PDC_clearclipboard(void); + +### Description + + PDC_getclipboard() gets the textual contents of the system's + clipboard. This function returns the contents of the clipboard in the + contents argument. It is the responsibility of the caller to free the + memory returned, via PDC_freeclipboard(). The length of the clipboard + contents is returned in the length argument. + + PDC_setclipboard copies the supplied text into the system's + clipboard, emptying the clipboard prior to the copy. + + PDC_clearclipboard() clears the internal clipboard. + +### Return Values + + PDC_CLIP_SUCCESS the call was successful + PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for + the clipboard contents + PDC_CLIP_EMPTY the clipboard contains no text + PDC_CLIP_ACCESS_ERROR no clipboard support + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + PDC_getclipboard | - | - | - + PDC_setclipboard | - | - | - + PDC_freeclipboard | - | - | - + PDC_clearclipboard | - | - | - + +**man-end****************************************************************/ + +#include "Xmu/StdSel.h" +#include "Xmu/Atoms.h" + +static char *tmpsel = NULL; +static unsigned long tmpsel_length = 0; + +static char *xc_selection = NULL; +static long xc_selection_len = 0; + +#ifndef X_HAVE_UTF8_STRING +static Atom XA_UTF8_STRING(Display *dpy) +{ + static AtomPtr p = NULL; + + if (!p) + p = XmuMakeAtom("UTF8_STRING"); + + return XmuInternAtom(dpy, p); +} +#endif + +static Boolean _convert_proc(Widget w, Atom *selection, Atom *target, + Atom *type_return, XtPointer *value_return, + unsigned long *length_return, int *format_return) +{ + PDC_LOG(("_convert_proc() - called\n")); + + if (*target == XA_TARGETS(XtDisplay(pdc_toplevel))) + { + XSelectionRequestEvent *req = XtGetSelectionRequest(w, + *selection, (XtRequestId)NULL); + + Atom *targetP; + XPointer std_targets; + unsigned long std_length; + + XmuConvertStandardSelection(pdc_toplevel, req->time, selection, + target, type_return, &std_targets, + &std_length, format_return); + + *length_return = std_length + 2; + *value_return = XtMalloc(sizeof(Atom) * (*length_return)); + + targetP = *(Atom**)value_return; + *targetP++ = XA_STRING; + *targetP++ = XA_UTF8_STRING(XtDisplay(pdc_toplevel)); + + memmove((void *)targetP, (const void *)std_targets, + sizeof(Atom) * std_length); + + XtFree((char *)std_targets); + *type_return = XA_ATOM; + *format_return = 8; + + return True; + } + else if (*target == XA_UTF8_STRING(XtDisplay(pdc_toplevel)) || + *target == XA_STRING) + { + char *data = XtMalloc(tmpsel_length + 1); + char *tmp = tmpsel; + int ret_length = 0; + + while (*tmp) + data[ret_length++] = *tmp++; + + data[ret_length] = '\0'; + + *value_return = data; + *length_return = ret_length; + *format_return = 8; + *type_return = *target; + + return True; + } + else + return XmuConvertStandardSelection(pdc_toplevel, CurrentTime, + selection, target, type_return, (XPointer*)value_return, + length_return, format_return); +} + +static void _lose_ownership(Widget w, Atom *type) +{ + PDC_LOG(("_lose_ownership() - called\n")); + + if (tmpsel) + free(tmpsel); + + tmpsel = NULL; + tmpsel_length = 0; +} + +static void _get_selection(Widget w, XtPointer data, Atom *selection, + Atom *type, XtPointer value, + unsigned long *length, int *format) +{ + PDC_LOG(("_get_selection() - called\n")); + + if (value) + { + xc_selection = value; + xc_selection_len = (long)(*length); + } + else + xc_selection_len = 0; +} + +int PDC_getclipboard(char **contents, long *length) +{ + XEvent event; + + PDC_LOG(("PDC_getclipboard() - called\n")); + + xc_selection = NULL; + xc_selection_len = -1; + + XtGetSelectionValue(pdc_toplevel, XA_PRIMARY, +#ifdef PDC_WIDE + XA_UTF8_STRING(XtDisplay(pdc_toplevel)), +#else + XA_STRING, +#endif + _get_selection, (XtPointer)NULL, 0); + + while (-1 == xc_selection_len) + { + XtAppNextEvent(pdc_app_context, &event); + XtDispatchEvent(&event); + } + + if (xc_selection && xc_selection_len) + { + *contents = malloc(xc_selection_len + 1); + + if (!*contents) + return PDC_CLIP_MEMORY_ERROR; + + memcpy(*contents, xc_selection, xc_selection_len); + + (*contents)[xc_selection_len] = '\0'; + *length = xc_selection_len; + + return PDC_CLIP_SUCCESS; + } + + return PDC_CLIP_EMPTY; +} + +int PDC_setclipboard(const char *contents, long length) +{ + long pos; + int status; + + PDC_LOG(("PDC_setclipboard() - called\n")); + + if (length > (long)tmpsel_length) + { + if (!tmpsel_length) + tmpsel = malloc(length + 1); + else + tmpsel = realloc(tmpsel, length + 1); + } + + for (pos = 0; pos < length; pos++) + tmpsel[pos] = contents[pos]; + + tmpsel_length = length; + tmpsel[length] = 0; + + if (XtOwnSelection(pdc_toplevel, XA_PRIMARY, CurrentTime, + _convert_proc, _lose_ownership, NULL) == False) + { + status = PDC_CLIP_ACCESS_ERROR; + free(tmpsel); + tmpsel = NULL; + tmpsel_length = 0; + } + else + status = PDC_CLIP_SUCCESS; + + return status; +} + +int PDC_freeclipboard(char *contents) +{ + PDC_LOG(("PDC_freeclipboard() - called\n")); + + free(contents); + return PDC_CLIP_SUCCESS; +} + +int PDC_clearclipboard(void) +{ + PDC_LOG(("PDC_clearclipboard() - called\n")); + + return PDC_CLIP_SUCCESS; +} diff --git a/vendor/pdcurses/x11/pdcdisp.c b/vendor/pdcurses/x11/pdcdisp.c new file mode 100644 index 0000000..79e7543 --- /dev/null +++ b/vendor/pdcurses/x11/pdcdisp.c @@ -0,0 +1,437 @@ +/* PDCurses */ + +#include "pdcx11.h" + +#include + +#ifdef PDC_WIDE +# include "../common/acsuni.h" +#else + +chtype acs_map[128] = +{ + PDC_ACS(0), PDC_ACS(1), PDC_ACS(2), PDC_ACS(3), PDC_ACS(4), + PDC_ACS(5), PDC_ACS(6), PDC_ACS(7), PDC_ACS(8), PDC_ACS(9), + PDC_ACS(10), PDC_ACS(11), PDC_ACS(12), PDC_ACS(13), PDC_ACS(14), + PDC_ACS(15), PDC_ACS(16), PDC_ACS(17), PDC_ACS(18), PDC_ACS(19), + PDC_ACS(20), PDC_ACS(21), PDC_ACS(22), PDC_ACS(23), PDC_ACS(24), + PDC_ACS(25), PDC_ACS(26), PDC_ACS(27), PDC_ACS(28), PDC_ACS(29), + PDC_ACS(30), PDC_ACS(31), ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', + + '>', '<', '^', 'v', + + '/', + + PDC_ACS(0), + + '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', + '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', + 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + + PDC_ACS(1), PDC_ACS(2), + + 'b', 'c', 'd', 'e', + + PDC_ACS(7), PDC_ACS(8), '#', 0xa4, PDC_ACS(11), PDC_ACS(12), + PDC_ACS(13), PDC_ACS(14), PDC_ACS(15), PDC_ACS(16), PDC_ACS(17), + PDC_ACS(18), PDC_ACS(19), PDC_ACS(20), PDC_ACS(21), PDC_ACS(22), + PDC_ACS(23), PDC_ACS(24), PDC_ACS(25), PDC_ACS(26), PDC_ACS(27), + PDC_ACS(28), PDC_ACS(29), PDC_ACS(30), 0xb7, + + PDC_ACS(127) +}; + +#endif + +bool pdc_blinked_off; +bool pdc_visible_cursor = FALSE; +bool pdc_vertical_cursor = FALSE; + +/* Convert character positions x and y to pixel positions, stored in + xpos and ypos */ + +static void _make_xy(int x, int y, int *xpos, int *ypos) +{ + *xpos = x * pdc_fwidth; + *ypos = pdc_app_data.normalFont->ascent + (y * pdc_fheight); +} + +static void _set_cursor_color(chtype *ch, short *fore, short *back) +{ + int attr; + short f, b; + + attr = PAIR_NUMBER(*ch); + + if (attr) + { + pair_content(attr, &f, &b); + *fore = 7 - (f % 8); + *back = 7 - (b % 8); + } + else + { + if (*ch & A_REVERSE) + { + *back = COLOR_BLACK; + *fore = COLOR_WHITE; + } + else + { + *back = COLOR_WHITE; + *fore = COLOR_BLACK; + } + } +} + +static void _display_cursor(int old_row, int old_x, int new_row, int new_x) +{ + int xpos, ypos, i; + chtype *ch; + short fore = 0, back = 0; + + PDC_LOG(("_display_cursor() - draw char at row: %d col %d\n", + old_row, old_x)); + + /* if the cursor position is outside the boundary of the screen, + ignore the request */ + + if (old_row >= SP->lines || old_x >= COLS || + new_row >= SP->lines || new_x >= COLS) + return; + + /* display the character at the current cursor position */ + + PDC_LOG(("_display_cursor() - draw char at row: %d col %d\n", + old_row, old_x)); + + PDC_transform_line(old_row, old_x, 1, curscr->_y[old_row] + old_x); + + /* display the cursor at the new cursor position */ + + if (!SP->visibility) + return; /* cursor not displayed, no more to do */ + + _make_xy(new_x, new_row, &xpos, &ypos); + + ch = curscr->_y[new_row] + new_x; + _set_cursor_color(ch, &fore, &back); + + if (pdc_vertical_cursor) + { + XSetForeground(XCURSESDISPLAY, pdc_cursor_gc, pdc_color[back]); + + for (i = 1; i <= SP->visibility; i++) + XDrawLine(XCURSESDISPLAY, XCURSESWIN, pdc_cursor_gc, + xpos + i, ypos - pdc_app_data.normalFont->ascent, + xpos + i, ypos - pdc_app_data.normalFont->ascent + + pdc_fheight - 1); + } + else + { + /* For block cursors, paint the block with invert. */ + + int yp, yh; + + if (SP->visibility == 2) + { + yp = ypos - pdc_fheight + pdc_fdescent; + yh = pdc_fheight; + } + else + { + yp = ypos - pdc_fheight / 4 + pdc_fdescent; + yh = pdc_fheight / 4; + } + + XSetFunction(XCURSESDISPLAY, pdc_cursor_gc, GXinvert); + XFillRectangle(XCURSESDISPLAY, XCURSESWIN, pdc_cursor_gc, + xpos, yp, pdc_fwidth, yh); + } + + PDC_LOG(("_display_cursor() - draw cursor at row %d col %d\n", + new_row, new_x)); +} + +void PDC_redraw_cursor(void) +{ + _display_cursor(SP->cursrow, SP->curscol, SP->cursrow, SP->curscol); +} + +void PDC_blink_text(XtPointer unused, XtIntervalId *id) +{ + int row; + int j, k; + chtype *ch; + + PDC_LOG(("PDC_blink_text() - called:\n")); + + pdc_blinked_off = !pdc_blinked_off; + + /* Redraw changed lines on the screen to match the blink state */ + + for (row = 0; row < SP->lines; row++) + { + ch = curscr->_y[row]; + + for (j = 0; j < COLS; j++) + if (ch[j] & A_BLINK) + { + k = j; + while (ch[k] & A_BLINK && k < COLS) + k++; + + PDC_transform_line(row, j, k - j, ch + j); + + j = k; + } + } + + PDC_redraw_cursor(); + + if ((SP->termattrs & A_BLINK) || !pdc_blinked_off) + XtAppAddTimeOut(pdc_app_context, pdc_app_data.textBlinkRate, + PDC_blink_text, NULL); +} + +static void _toggle_cursor(void) +{ + PDC_LOG(("_toggle_cursor - called. Vis now: ")); + PDC_LOG((pdc_visible_cursor ? "1\n" : "0\n")); + + /* If the window is not active, ignore this command. The + cursor will stay solid. */ + + if (pdc_window_entered) + { + if (pdc_visible_cursor) + { + /* Cursor currently ON, turn it off */ + + int save_visibility = SP->visibility; + SP->visibility = 0; + PDC_redraw_cursor(); + SP->visibility = save_visibility; + pdc_visible_cursor = FALSE; + } + else + { + /* Cursor currently OFF, turn it on */ + + PDC_redraw_cursor(); + pdc_visible_cursor = TRUE; + } + } +} + +int PDC_display_cursor(int oldrow, int oldcol, int newrow, int newcol, + int visibility) +{ + PDC_LOG(("PDC_display_cursor() - called: NEW row %d col %d, vis %d\n", + newrow, newcol, visibility)); + + if (visibility == -1) + _toggle_cursor(); + else + { + pdc_visible_cursor = TRUE; + _display_cursor(oldrow, oldcol, newrow, newcol); + } + + return OK; +} + +void PDC_blink_cursor(XtPointer unused, XtIntervalId *id) +{ + PDC_LOG(("PDC_blink_cursor() - called:\n")); + + _toggle_cursor(); + XtAppAddTimeOut(pdc_app_context, pdc_app_data.cursorBlinkRate, + PDC_blink_cursor, NULL); +} + +/* position hardware cursor at (y, x) */ + +void PDC_gotoyx(int row, int col) +{ + PDC_LOG(("PDC_gotoyx() - called: row %d col %d\n", row, col)); + + PDC_display_cursor(SP->cursrow, SP->curscol, row, col, SP->visibility); +} + +/* update the given physical line to look like the corresponding line in + curscr */ + +/* Output a block of characters with common attributes */ + +static int _new_packet(chtype attr, int len, int col, int row, +#ifdef PDC_WIDE + XChar2b *text) +#else + char *text) +#endif +{ + XRectangle bounds; + GC gc; + int xpos, ypos; + short fore, back; + attr_t sysattrs; + bool rev; + + pair_content(PAIR_NUMBER(attr), &fore, &back); + + /* Specify the color table offsets */ + + sysattrs = SP->termattrs; + + if ((attr & A_BOLD) && !(sysattrs & A_BOLD)) + fore |= 8; + if ((attr & A_BLINK) && !(sysattrs & A_BLINK)) + back |= 8; + + rev = !!(attr & A_REVERSE); + + /* Determine which GC to use - normal, italic or bold */ + + if ((attr & A_ITALIC) && (sysattrs & A_ITALIC)) + gc = pdc_italic_gc; + else if ((attr & A_BOLD) && (sysattrs & A_BOLD)) + gc = pdc_bold_gc; + else + gc = pdc_normal_gc; + + _make_xy(col, row, &xpos, &ypos); + + bounds.x = xpos; + bounds.y = ypos - pdc_fascent; + bounds.width = pdc_fwidth * len; + bounds.height = pdc_fheight; + + XSetClipRectangles(XCURSESDISPLAY, gc, 0, 0, &bounds, 1, Unsorted); + + if (pdc_blinked_off && (sysattrs & A_BLINK) && (attr & A_BLINK)) + { + XSetForeground(XCURSESDISPLAY, gc, pdc_color[rev ? fore : back]); + XFillRectangle(XCURSESDISPLAY, XCURSESWIN, gc, xpos, bounds.y, + bounds.width, pdc_fheight); + } + else + { + /* Draw it */ + + XSetForeground(XCURSESDISPLAY, gc, pdc_color[rev ? back : fore]); + XSetBackground(XCURSESDISPLAY, gc, pdc_color[rev ? fore : back]); + +#ifdef PDC_WIDE + XDrawImageString16( +#else + XDrawImageString( +#endif + XCURSESDISPLAY, XCURSESWIN, gc, xpos, ypos, text, len); + + /* Underline, etc. */ + + if (attr & (A_LEFT | A_RIGHT | A_UNDERLINE)) + { + int k; + + if (SP->line_color != -1) + XSetForeground(XCURSESDISPLAY, gc, pdc_color[SP->line_color]); + + if (attr & A_UNDERLINE) + XDrawLine(XCURSESDISPLAY, XCURSESWIN, gc, + xpos, ypos + 1, xpos + pdc_fwidth * len, ypos + 1); + + if (attr & A_LEFT) + for (k = 0; k < len; k++) + { + int x = xpos + pdc_fwidth * k; + XDrawLine(XCURSESDISPLAY, XCURSESWIN, gc, + x, ypos - pdc_fascent, x, ypos + pdc_fdescent); + } + + if (attr & A_RIGHT) + for (k = 0; k < len; k++) + { + int x = xpos + pdc_fwidth * (k + 1) - 1; + XDrawLine(XCURSESDISPLAY, XCURSESWIN, gc, + x, ypos - pdc_fascent, x, ypos + pdc_fdescent); + } + } + } + + PDC_LOG(("_new_packet() - row: %d col: %d " + "num_cols: %d fore: %d back: %d text:<%s>\n", + row, col, len, fore, back, text)); + + return OK; +} + +/* The core display routine -- update one line of text */ + +void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) +{ +#ifdef PDC_WIDE + XChar2b text[513]; +#else + char text[513]; +#endif + chtype old_attr, attr; + int i, j; + + PDC_LOG(("PDC_transform_line() - called: lineno: %d x: %d " + "len: %d\n", lineno, x, len)); + + if (!len) + return; + + old_attr = *srcp & A_ATTRIBUTES; + + for (i = 0, j = 0; j < len; j++) + { + chtype curr = srcp[j]; + + attr = curr & A_ATTRIBUTES; + + if (attr & A_ALTCHARSET && !(curr & 0xff80)) + { + attr ^= A_ALTCHARSET; + curr = acs_map[curr & 0x7f]; + } + +#ifndef PDC_WIDE + /* Special handling for ACS_BLOCK */ + + if (!(curr & A_CHARTEXT)) + { + curr |= ' '; + attr ^= A_REVERSE; + } +#endif + if (attr != old_attr) + { + if (_new_packet(old_attr, i, x, lineno, text) == ERR) + return; + + old_attr = attr; + x += i; + i = 0; + } + +#ifdef PDC_WIDE + text[i].byte1 = (curr & 0xff00) >> 8; + text[i++].byte2 = curr & 0x00ff; +#else + text[i++] = curr & 0xff; +#endif + } + + _new_packet(old_attr, i, x, lineno, text); +} + +void PDC_doupdate(void) +{ + XSync(XtDisplay(pdc_toplevel), False); +} diff --git a/vendor/pdcurses/x11/pdcgetsc.c b/vendor/pdcurses/x11/pdcgetsc.c new file mode 100644 index 0000000..89799d5 --- /dev/null +++ b/vendor/pdcurses/x11/pdcgetsc.c @@ -0,0 +1,28 @@ +/* PDCurses */ + +#include "pdcx11.h" + +/* return width of screen/viewport */ + +int PDC_get_columns(void) +{ + PDC_LOG(("PDC_get_columns() - called\n")); + + return pdc_wwidth / pdc_fwidth; +} + +/* get the cursor size/shape */ + +int PDC_get_cursor_mode(void) +{ + return 0; +} + +/* return number of screen rows */ + +int PDC_get_rows(void) +{ + PDC_LOG(("PDC_get_rows() - called\n")); + + return pdc_wheight / pdc_fheight; +} diff --git a/vendor/pdcurses/x11/pdckbd.c b/vendor/pdcurses/x11/pdckbd.c new file mode 100644 index 0000000..f8236e5 --- /dev/null +++ b/vendor/pdcurses/x11/pdckbd.c @@ -0,0 +1,583 @@ +/* PDCurses */ + +#include "pdcx11.h" + +#include + +#ifdef HAVE_DECKEYSYM_H +# include +#endif + +#ifdef HAVE_SUNKEYSYM_H +# include +#endif + +static struct +{ + KeySym keycode; + bool numkeypad; + unsigned short normal; + unsigned short shifted; + unsigned short control; + unsigned short alt; +} key_table[] = +{ +/* keycode keypad normal shifted control alt*/ + {XK_Left, FALSE, KEY_LEFT, KEY_SLEFT, CTL_LEFT, ALT_LEFT}, + {XK_Right, FALSE, KEY_RIGHT, KEY_SRIGHT, CTL_RIGHT, ALT_RIGHT}, + {XK_Up, FALSE, KEY_UP, KEY_SUP, CTL_UP, ALT_UP}, + {XK_Down, FALSE, KEY_DOWN, KEY_SDOWN, CTL_DOWN, ALT_DOWN}, + {XK_Home, FALSE, KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME}, +/* Sun Type 4 keyboard */ + {XK_R7, FALSE, KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME}, + {XK_End, FALSE, KEY_END, KEY_SEND, CTL_END, ALT_END}, +/* Sun Type 4 keyboard */ + {XK_R13, FALSE, KEY_END, KEY_SEND, CTL_END, ALT_END}, + {XK_Prior, FALSE, KEY_PPAGE, KEY_SPREVIOUS,CTL_PGUP, ALT_PGUP}, +/* Sun Type 4 keyboard */ + {XK_R9, FALSE, KEY_PPAGE, KEY_SPREVIOUS,CTL_PGUP, ALT_PGUP}, + {XK_Next, FALSE, KEY_NPAGE, KEY_SNEXT, CTL_PGDN, ALT_PGDN}, +/* Sun Type 4 keyboard */ + {XK_R15, FALSE, KEY_NPAGE, KEY_SNEXT, CTL_PGDN, ALT_PGDN}, + {XK_Insert, FALSE, KEY_IC, KEY_SIC, CTL_INS, ALT_INS}, + {XK_Delete, FALSE, KEY_DC, KEY_SDC, CTL_DEL, ALT_DEL}, + {XK_F1, FALSE, KEY_F(1), KEY_F(13), KEY_F(25), KEY_F(37)}, + {XK_F2, FALSE, KEY_F(2), KEY_F(14), KEY_F(26), KEY_F(38)}, + {XK_F3, FALSE, KEY_F(3), KEY_F(15), KEY_F(27), KEY_F(39)}, + {XK_F4, FALSE, KEY_F(4), KEY_F(16), KEY_F(28), KEY_F(40)}, + {XK_F5, FALSE, KEY_F(5), KEY_F(17), KEY_F(29), KEY_F(41)}, + {XK_F6, FALSE, KEY_F(6), KEY_F(18), KEY_F(30), KEY_F(42)}, + {XK_F7, FALSE, KEY_F(7), KEY_F(19), KEY_F(31), KEY_F(43)}, + {XK_F8, FALSE, KEY_F(8), KEY_F(20), KEY_F(32), KEY_F(44)}, + {XK_F9, FALSE, KEY_F(9), KEY_F(21), KEY_F(33), KEY_F(45)}, + {XK_F10, FALSE, KEY_F(10), KEY_F(22), KEY_F(34), KEY_F(46)}, + {XK_F11, FALSE, KEY_F(11), KEY_F(23), KEY_F(35), KEY_F(47)}, + {XK_F12, FALSE, KEY_F(12), KEY_F(24), KEY_F(36), KEY_F(48)}, + {XK_F13, FALSE, KEY_F(13), KEY_F(25), KEY_F(37), KEY_F(49)}, + {XK_F14, FALSE, KEY_F(14), KEY_F(26), KEY_F(38), KEY_F(50)}, + {XK_F15, FALSE, KEY_F(15), KEY_F(27), KEY_F(39), KEY_F(51)}, + {XK_F16, FALSE, KEY_F(16), KEY_F(28), KEY_F(40), KEY_F(52)}, + {XK_F17, FALSE, KEY_F(17), KEY_F(29), KEY_F(41), KEY_F(53)}, + {XK_F18, FALSE, KEY_F(18), KEY_F(30), KEY_F(42), KEY_F(54)}, + {XK_F19, FALSE, KEY_F(19), KEY_F(31), KEY_F(43), KEY_F(55)}, + {XK_F20, FALSE, KEY_F(20), KEY_F(32), KEY_F(44), KEY_F(56)}, + {XK_BackSpace, FALSE, 0x08, 0x08, CTL_BKSP, ALT_BKSP}, + {XK_Tab, FALSE, 0x09, KEY_BTAB, CTL_TAB, ALT_TAB}, +#if defined(XK_ISO_Left_Tab) + {XK_ISO_Left_Tab, FALSE, 0x09, KEY_BTAB, CTL_TAB, ALT_TAB}, +#endif + {XK_Select, FALSE, KEY_SELECT, KEY_SELECT, KEY_SELECT, KEY_SELECT}, + {XK_Print, FALSE, KEY_PRINT, KEY_SPRINT, KEY_PRINT, KEY_PRINT}, + {XK_Find, FALSE, KEY_FIND, KEY_SFIND, KEY_FIND, KEY_FIND}, + {XK_Pause, FALSE, KEY_SUSPEND, KEY_SSUSPEND, KEY_SUSPEND, KEY_SUSPEND}, + {XK_Clear, FALSE, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR}, + {XK_Cancel, FALSE, KEY_CANCEL, KEY_SCANCEL, KEY_CANCEL, KEY_CANCEL}, + {XK_Break, FALSE, KEY_BREAK, KEY_BREAK, KEY_BREAK, KEY_BREAK}, + {XK_Help, FALSE, KEY_HELP, KEY_SHELP, KEY_LHELP, KEY_HELP}, + {XK_L4, FALSE, KEY_UNDO, KEY_SUNDO, KEY_UNDO, KEY_UNDO}, + {XK_L6, FALSE, KEY_COPY, KEY_SCOPY, KEY_COPY, KEY_COPY}, + {XK_L9, FALSE, KEY_FIND, KEY_SFIND, KEY_FIND, KEY_FIND}, + {XK_Menu, FALSE, KEY_OPTIONS, KEY_SOPTIONS, KEY_OPTIONS, KEY_OPTIONS}, + {XK_Super_R, FALSE, KEY_COMMAND, KEY_SCOMMAND, KEY_COMMAND, KEY_COMMAND}, + {XK_Super_L, FALSE, KEY_COMMAND, KEY_SCOMMAND, KEY_COMMAND, KEY_COMMAND}, +#ifdef HAVE_SUNKEYSYM_H + {SunXK_F36, FALSE, KEY_F(41), KEY_F(43), KEY_F(45), KEY_F(47)}, + {SunXK_F37, FALSE, KEY_F(42), KEY_F(44), KEY_F(46), KEY_F(48)}, +#endif +#ifdef HAVE_DECKEYSYM_H + {DXK_Remove, FALSE, KEY_DC, KEY_SDC, CTL_DEL, ALT_DEL}, +#endif + {XK_Escape, FALSE, 0x1B, 0x1B, 0x1B, ALT_ESC}, + {XK_KP_Enter, TRUE, PADENTER, PADENTER, CTL_PADENTER,ALT_PADENTER}, + {XK_KP_Add, TRUE, PADPLUS, '+', CTL_PADPLUS, ALT_PADPLUS}, + {XK_KP_Subtract,TRUE, PADMINUS, '-', CTL_PADMINUS,ALT_PADMINUS}, + {XK_KP_Multiply,TRUE, PADSTAR, '*', CTL_PADSTAR, ALT_PADSTAR}, +/* Sun Type 4 keyboard */ + {XK_R6, TRUE, PADSTAR, '*', CTL_PADSTAR, ALT_PADSTAR}, + {XK_KP_Divide, TRUE, PADSLASH, '/', CTL_PADSLASH,ALT_PADSLASH}, +/* Sun Type 4 keyboard */ + {XK_R5, TRUE, PADSLASH, '/', CTL_PADSLASH,ALT_PADSLASH}, + {XK_KP_Decimal,TRUE, PADSTOP, '.', CTL_PADSTOP, ALT_PADSTOP}, + {XK_KP_0, TRUE, PAD0, '0', CTL_PAD0, ALT_PAD0}, + {XK_KP_1, TRUE, KEY_C1, '1', CTL_PAD1, ALT_PAD1}, + {XK_KP_2, TRUE, KEY_C2, '2', CTL_PAD2, ALT_PAD2}, + {XK_KP_3, TRUE, KEY_C3, '3', CTL_PAD3, ALT_PAD3}, + {XK_KP_4, TRUE, KEY_B1, '4', CTL_PAD4, ALT_PAD4}, + {XK_KP_5, TRUE, KEY_B2, '5', CTL_PAD5, ALT_PAD5}, +/* Sun Type 4 keyboard */ + {XK_R11, TRUE, KEY_B2, '5', CTL_PAD5, ALT_PAD5}, + {XK_KP_6, TRUE, KEY_B3, '6', CTL_PAD6, ALT_PAD6}, + {XK_KP_7, TRUE, KEY_A1, '7', CTL_PAD7, ALT_PAD7}, + {XK_KP_8, TRUE, KEY_A2, '8', CTL_PAD8, ALT_PAD8}, + {XK_KP_9, TRUE, KEY_A3, '9', CTL_PAD9, ALT_PAD9}, +/* the following added to support Sun Type 5 keyboards */ + {XK_F21, FALSE, KEY_SUSPEND, KEY_SSUSPEND, KEY_SUSPEND, KEY_SUSPEND}, + {XK_F22, FALSE, KEY_PRINT, KEY_SPRINT, KEY_PRINT, KEY_PRINT}, + {XK_F24, TRUE, PADMINUS, '-', CTL_PADMINUS,ALT_PADMINUS}, +/* Sun Type 4 keyboard */ + {XK_F25, TRUE, PADSLASH, '/', CTL_PADSLASH,ALT_PADSLASH}, +/* Sun Type 4 keyboard */ + {XK_F26, TRUE, PADSTAR, '*', CTL_PADSTAR, ALT_PADSTAR}, + {XK_F27, TRUE, KEY_A1, '7', CTL_PAD7, ALT_PAD7}, + {XK_F29, TRUE, KEY_A3, '9', CTL_PAD9, ALT_PAD9}, + {XK_F31, TRUE, KEY_B2, '5', CTL_PAD5, ALT_PAD5}, + {XK_F35, TRUE, KEY_C3, '3', CTL_PAD3, ALT_PAD3}, +#ifdef XK_KP_Delete + {XK_KP_Delete, TRUE, PADSTOP, '.', CTL_PADSTOP, ALT_PADSTOP}, +#endif +#ifdef XK_KP_Insert + {XK_KP_Insert, TRUE, PAD0, '0', CTL_PAD0, ALT_PAD0}, +#endif +#ifdef XK_KP_End + {XK_KP_End, TRUE, KEY_C1, '1', CTL_PAD1, ALT_PAD1}, +#endif +#ifdef XK_KP_Down + {XK_KP_Down, TRUE, KEY_C2, '2', CTL_PAD2, ALT_PAD2}, +#endif +#ifdef XK_KP_Next + {XK_KP_Next, TRUE, KEY_C3, '3', CTL_PAD3, ALT_PAD3}, +#endif +#ifdef XK_KP_Left + {XK_KP_Left, TRUE, KEY_B1, '4', CTL_PAD4, ALT_PAD4}, +#endif +#ifdef XK_KP_Begin + {XK_KP_Begin, TRUE, KEY_B2, '5', CTL_PAD5, ALT_PAD5}, +#endif +#ifdef XK_KP_Right + {XK_KP_Right, TRUE, KEY_B3, '6', CTL_PAD6, ALT_PAD6}, +#endif +#ifdef XK_KP_Home + {XK_KP_Home, TRUE, KEY_A1, '7', CTL_PAD7, ALT_PAD7}, +#endif +#ifdef XK_KP_Up + {XK_KP_Up, TRUE, KEY_A2, '8', CTL_PAD8, ALT_PAD8}, +#endif +#ifdef XK_KP_Prior + {XK_KP_Prior, TRUE, KEY_A3, '9', CTL_PAD9, ALT_PAD9}, +#endif + {0, 0, 0, 0, 0, 0} +}; + +static KeySym keysym = 0; +static XIM Xim = NULL; + +XIC pdc_xic = NULL; + +#ifdef MOUSE_DEBUG +# define MOUSE_LOG(x) printf x +#else +# define MOUSE_LOG(x) +#endif + +static unsigned long _process_key_event(XEvent *event) +{ + Status status; + wchar_t buffer[120]; + unsigned long key = 0; + int buflen = 40; + int i, count; + unsigned long modifier = 0; + bool key_code = FALSE; + + PDC_LOG(("_process_key_event() - called\n")); + + /* In compose -- ignore elements */ + + if (XFilterEvent(event, XCURSESWIN)) + return -1; + + /* Handle modifier keys first; ignore other KeyReleases */ + + if (event->type == KeyRelease) + { + /* The keysym value was set by a previous call to this function + with a KeyPress event (or reset by the mouse event handler) */ + + if (SP->return_key_modifiers && + IsModifierKey(keysym)) + { + switch (keysym) { + case XK_Shift_L: + key = KEY_SHIFT_L; + break; + case XK_Shift_R: + key = KEY_SHIFT_R; + break; + case XK_Control_L: + key = KEY_CONTROL_L; + break; + case XK_Control_R: + key = KEY_CONTROL_R; + break; + case XK_Alt_L: + key = KEY_ALT_L; + break; + case XK_Alt_R: + key = KEY_ALT_R; + } + + if (key) + { + SP->key_code = TRUE; + return key; + } + } + + return -1; + } + + buffer[0] = '\0'; + + count = XwcLookupString(pdc_xic, &(event->xkey), buffer, buflen, + &keysym, &status); + + /* translate keysym into curses key code */ + + PDC_LOG(("Key mask: %x\n", event->xkey.state)); + + /* 0x10: usually, numlock modifier */ + + if (event->xkey.state & Mod2Mask) + modifier |= PDC_KEY_MODIFIER_NUMLOCK; + + /* 0x01: shift modifier */ + + if (event->xkey.state & ShiftMask) + modifier |= PDC_KEY_MODIFIER_SHIFT; + + /* 0x04: control modifier */ + + if (event->xkey.state & ControlMask) + modifier |= PDC_KEY_MODIFIER_CONTROL; + + /* 0x08: usually, alt modifier */ + + if (event->xkey.state & Mod1Mask) + modifier |= PDC_KEY_MODIFIER_ALT; + + for (i = 0; key_table[i].keycode; i++) + { + if (key_table[i].keycode == keysym) + { + PDC_LOG(("State %x\n", event->xkey.state)); + + /* ControlMask: 0x04: control modifier + Mod1Mask: 0x08: usually, alt modifier + Mod2Mask: 0x10: usually, numlock modifier + ShiftMask: 0x01: shift modifier */ + + if ((event->xkey.state & ShiftMask) || + (key_table[i].numkeypad && + (event->xkey.state & Mod2Mask))) + { + key = key_table[i].shifted; + } + else if (event->xkey.state & ControlMask) + { + key = key_table[i].control; + } + else if (event->xkey.state & Mod1Mask) + { + key = key_table[i].alt; + } + + /* To get here, we ignore all other modifiers */ + + else + key = key_table[i].normal; + + key_code = (key > 0x100); + break; + } + } + + if (!key && buffer[0] && count == 1) + key = buffer[0]; + + PDC_LOG(("Key: %s pressed - %x Mod: %x\n", + XKeysymToString(keysym), key, event->xkey.state)); + + /* Handle ALT letters and numbers */ + + if (event->xkey.state & Mod1Mask) + { + if (key >= 'A' && key <= 'Z') + { + key += ALT_A - 'A'; + key_code = TRUE; + } + + if (key >= 'a' && key <= 'z') + { + key += ALT_A - 'a'; + key_code = TRUE; + } + + if (key >= '0' && key <= '9') + { + key += ALT_0 - '0'; + key_code = TRUE; + } + } + + /* After all that, send the key back to the application if is + NOT zero. */ + + if (key) + { + SP->key_modifiers = modifier; + + SP->key_code = key_code; + return key; + } + + return -1; +} + +static unsigned long _process_mouse_event(XEvent *event) +{ + int button_no; + static int last_button_no = 0; + + PDC_LOG(("_process_mouse_event() - called\n")); + + keysym = 0; /* suppress any modifier key return */ + + button_no = event->xbutton.button; + + /* It appears that under X11R6 (at least on Linux), that an + event_type of ButtonMotion does not include the mouse button in + the event. The following code is designed to cater for this + situation. */ + + memset(&SP->mouse_status, 0, sizeof(SP->mouse_status)); + + SP->mouse_status.x = event->xbutton.x / pdc_fwidth; + SP->mouse_status.y = event->xbutton.y / pdc_fheight; + + switch(event->type) + { + case ButtonPress: + /* Handle button 4 and 5, which are normally mapped to the wheel + mouse scroll up and down, and button 6 and 7, which are + normally mapped to the wheel mouse scroll left and right */ + + last_button_no = button_no; + + if (button_no >= 4 && button_no <= 7) + { + /* Send the KEY_MOUSE to curses program */ + + switch(button_no) + { + case 4: + SP->mouse_status.changes = PDC_MOUSE_WHEEL_UP; + break; + case 5: + SP->mouse_status.changes = PDC_MOUSE_WHEEL_DOWN; + break; + case 6: + SP->mouse_status.changes = PDC_MOUSE_WHEEL_LEFT; + break; + case 7: + SP->mouse_status.changes = PDC_MOUSE_WHEEL_RIGHT; + } + + SP->key_code = TRUE; + return KEY_MOUSE; + } + + MOUSE_LOG(("\nButtonPress\n")); + + SP->mouse_status.button[button_no - 1] = BUTTON_PRESSED; + + napms(SP->mouse_wait); + while (XtAppPending(pdc_app_context)) + { + XEvent rel; + XtAppNextEvent(pdc_app_context, &rel); + + if (rel.type == ButtonRelease && rel.xbutton.button == button_no) + SP->mouse_status.button[button_no - 1] = BUTTON_CLICKED; + else + XSendEvent(XtDisplay(pdc_toplevel), + RootWindowOfScreen(XtScreen(pdc_toplevel)), + True, 0, &rel); + } + + break; + + case MotionNotify: + MOUSE_LOG(("\nMotionNotify: y: %d x: %d Width: %d " + "Height: %d\n", event->xbutton.y, event->xbutton.x, + pdc_fwidth, pdc_fheight)); + + button_no = last_button_no; + + SP->mouse_status.changes |= PDC_MOUSE_MOVED; + break; + + case ButtonRelease: + MOUSE_LOG(("\nButtonRelease\n")); + + /* ignore "releases" of scroll buttons */ + + if (button_no >= 4 && button_no <= 7) + return -1; + + SP->mouse_status.button[button_no - 1] = BUTTON_RELEASED; + } + + /* Set up the mouse status fields in preparation for sending */ + + SP->mouse_status.changes |= 1 << (button_no - 1); + + if (SP->mouse_status.changes & PDC_MOUSE_MOVED && + (SP->mouse_status.button[button_no - 1] & + BUTTON_ACTION_MASK) == BUTTON_PRESSED) + SP->mouse_status.button[button_no - 1] = BUTTON_MOVED; + + if (event->xbutton.state & ShiftMask) + SP->mouse_status.button[button_no - 1] |= BUTTON_SHIFT; + if (event->xbutton.state & ControlMask) + SP->mouse_status.button[button_no - 1] |= BUTTON_CONTROL; + if (event->xbutton.state & Mod1Mask) + SP->mouse_status.button[button_no - 1] |= BUTTON_ALT; + + /* If we are ignoring the event, or the mouse position is outside + the bounds of the screen, return here */ + + if (SP->mouse_status.x < 0 || SP->mouse_status.x >= SP->cols || + SP->mouse_status.y < 0 || SP->mouse_status.y >= SP->lines) + return -1; + + /* Send the KEY_MOUSE to curses program */ + + SP->key_code = TRUE; + return KEY_MOUSE; +} + +/* check if a key or mouse event is waiting */ + +bool PDC_check_key(void) +{ + XtInputMask s = XtAppPending(pdc_app_context); + + PDC_LOG(("PDC_check_key() - returning %s\n", s ? "TRUE" : "FALSE")); + + return pdc_resize_now || !!s; +} + +/* return the next available key or mouse event */ + +int PDC_get_key(void) +{ + XEvent event; + unsigned long newkey = 0; + int key = 0; + + if (pdc_resize_now) + { + pdc_resize_now = FALSE; + SP->key_code = TRUE; + return KEY_RESIZE; + } + + XtAppNextEvent(pdc_app_context, &event); + + switch (event.type) + { + case KeyPress: + case KeyRelease: + newkey = _process_key_event(&event); + break; + case ButtonPress: + case ButtonRelease: + case MotionNotify: + newkey = _process_mouse_event(&event); + break; + default: + XtDispatchEvent(&event); + return -1; + } + + if ((unsigned long)(-1) == newkey) + return -1; + + key = (int)newkey; + + PDC_LOG(("PDC_get_key() - key %d returned\n", key)); + + return key; +} + +void PDC_set_keyboard_binary(bool on) +{ + PDC_LOG(("PDC_set_keyboard_binary() - called\n")); +} + +/* discard any pending keyboard or mouse input -- this is the core + routine for flushinp() */ + +void PDC_flushinp(void) +{ + PDC_LOG(("PDC_flushinp() - called\n")); + + while (PDC_check_key()) + PDC_get_key(); +} + +bool PDC_has_mouse(void) +{ + return TRUE; +} + +int PDC_mouse_set(void) +{ + return OK; +} + +int PDC_modifiers_set(void) +{ + return OK; +} + +static void _dummy_handler(Widget w, XtPointer client_data, + XEvent *event, Boolean *unused) +{ +} + +int PDC_kb_setup(void) +{ + Xim = XOpenIM(XCURSESDISPLAY, NULL, NULL, NULL); + + if (Xim) + { + pdc_xic = XCreateIC(Xim, XNInputStyle, + XIMPreeditNothing | XIMStatusNothing, + XNClientWindow, XCURSESWIN, NULL); + } + + if (pdc_xic) + { + long im_event_mask; + + XGetICValues(pdc_xic, XNFilterEvents, &im_event_mask, NULL); + + /* Add in the mouse events */ + + im_event_mask |= ButtonPressMask | ButtonReleaseMask | + ButtonMotionMask; + + XtAddEventHandler(pdc_drawing, im_event_mask, False, + _dummy_handler, NULL); + XSetICFocus(pdc_xic); + } + else + { + perror("ERROR: Cannot create input context"); + return ERR; + } + + return OK; +} diff --git a/vendor/pdcurses/x11/pdcscrn.c b/vendor/pdcurses/x11/pdcscrn.c new file mode 100644 index 0000000..6cd0a49 --- /dev/null +++ b/vendor/pdcurses/x11/pdcscrn.c @@ -0,0 +1,746 @@ +/* PDCurses */ + +#include "pdcx11.h" + +#include + +#include +#include + +/* Default icons for XCurses applications. */ + +#include "../common/icon64.xpm" +#include "../common/icon32.xpm" + +#ifdef PDC_WIDE +# define DEFNFONT "-misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1" +# define DEFIFONT "-misc-fixed-medium-o-normal--20-200-75-75-c-100-iso10646-1" +# define DEFBFONT "-misc-fixed-bold-r-normal--20-200-75-75-c-100-iso10646-1" +#else +# define DEFNFONT "-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1" +# define DEFIFONT "-misc-fixed-medium-o-normal--13-120-75-75-c-70-iso8859-1" +# define DEFBFONT "-misc-fixed-bold-r-normal--13-120-75-75-c-70-iso8859-1" +#endif + +#ifndef MAX_PATH +# define MAX_PATH 256 +#endif + +/* Macros just for app_resources */ + +#define APPDATAOFF(n) XtOffsetOf(XCursesAppData, n) + +#define RINT(name1, name2, value) { \ + #name1, #name2, XtRInt, \ + sizeof(int), APPDATAOFF(name1), XtRImmediate, \ + (XtPointer)value \ + } + +#define RPIXEL(name1, name2, value) { \ + #name1, #name2, XtRPixel, \ + sizeof(Pixel), APPDATAOFF(name1), XtRString, \ + (XtPointer)#value \ + } + +#define RCOLOR(name, value) RPIXEL(color##name, Color##name, value) + + +#define RSTRINGP(name1, name2, param) { \ + #name1, #name2, XtRString, \ + MAX_PATH, APPDATAOFF(name1), XtRString, (XtPointer)param \ + } + +#define RSTRING(name1, name2) RSTRINGP(name1, name2, "") + +#define RFONT(name1, name2, value) { \ + #name1, #name2, XtRFontStruct, \ + sizeof(XFontStruct), APPDATAOFF(name1), XtRString, \ + (XtPointer)value \ + } + +#define RCURSOR(name1, name2, value) { \ + #name1, #name2, XtRCursor, \ + sizeof(Cursor), APPDATAOFF(name1), XtRString, \ + (XtPointer)#value \ + } + +static XtResource app_resources[] = +{ + RINT(lines, Lines, -1), + RINT(cols, Cols, -1), + + RCOLOR(Black, Black), + RCOLOR(Red, red3), + RCOLOR(Green, green3), + RCOLOR(Yellow, yellow3), + RCOLOR(Blue, blue3), + RCOLOR(Magenta, magenta3), + RCOLOR(Cyan, cyan3), + RCOLOR(White, Grey), + + RCOLOR(BoldBlack, grey40), + RCOLOR(BoldRed, red1), + RCOLOR(BoldGreen, green1), + RCOLOR(BoldYellow, yellow1), + RCOLOR(BoldBlue, blue1), + RCOLOR(BoldMagenta, magenta1), + RCOLOR(BoldCyan, cyan1), + RCOLOR(BoldWhite, White), + + RFONT(normalFont, NormalFont, DEFNFONT), + RFONT(italicFont, ItalicFont, DEFIFONT), + RFONT(boldFont, BoldFont, DEFBFONT), + + RSTRING(bitmap, Bitmap), + RSTRING(pixmap, Pixmap), + RCURSOR(pointer, Pointer, xterm), + + RPIXEL(pointerForeColor, PointerForeColor, Black), + RPIXEL(pointerBackColor, PointerBackColor, White), + + RINT(doubleClickPeriod, DoubleClickPeriod, (PDC_CLICK_PERIOD * 2)), + RINT(clickPeriod, ClickPeriod, PDC_CLICK_PERIOD), + RINT(scrollbarWidth, ScrollbarWidth, 15), + RINT(cursorBlinkRate, CursorBlinkRate, 0), + + RSTRING(textCursor, TextCursor), + RINT(textBlinkRate, TextBlinkRate, 500) +}; + +#undef RCURSOR +#undef RFONT +#undef RSTRING +#undef RCOLOR +#undef RPIXEL +#undef RINT +#undef APPDATAOFF +#undef DEFBFONT +#undef DEFIFONT +#undef DEFNFONT + +/* Macros for options */ + +#define COPT(name) {"-" #name, "*" #name, XrmoptionSepArg, NULL} +#define CCOLOR(name) COPT(color##name) + +static XrmOptionDescRec options[] = +{ + COPT(lines), COPT(cols), COPT(normalFont), COPT(italicFont), + COPT(boldFont), COPT(bitmap), COPT(pixmap), COPT(pointer), + COPT(clickPeriod), COPT(doubleClickPeriod), COPT(scrollbarWidth), + COPT(pointerForeColor), COPT(pointerBackColor), + COPT(cursorBlinkRate), COPT(textCursor), COPT(textBlinkRate), + + CCOLOR(Black), CCOLOR(Red), CCOLOR(Green), CCOLOR(Yellow), + CCOLOR(Blue), CCOLOR(Magenta), CCOLOR(Cyan), CCOLOR(White), + + CCOLOR(BoldBlack), CCOLOR(BoldRed), CCOLOR(BoldGreen), + CCOLOR(BoldYellow), CCOLOR(BoldBlue), CCOLOR(BoldMagenta), + CCOLOR(BoldCyan), CCOLOR(BoldWhite) +}; + +#undef CCOLOR +#undef COPT + +Pixel pdc_color[PDC_MAXCOL]; + +XCursesAppData pdc_app_data; +XtAppContext pdc_app_context; +Widget pdc_toplevel, pdc_drawing; + +GC pdc_normal_gc, pdc_cursor_gc, pdc_italic_gc, pdc_bold_gc; +int pdc_fheight, pdc_fwidth, pdc_fascent, pdc_fdescent; +int pdc_wwidth, pdc_wheight; +bool pdc_window_entered = TRUE, pdc_resize_now = FALSE; + +static Atom wm_atom[2]; +static String class_name = "XCurses"; +static int resize_window_width = 0, resize_window_height = 0; +static int received_map_notify = 0; +static bool exposed = FALSE; + +static Pixmap icon_pixmap, icon_pixmap_mask; + +static char *prog_name[] = {"PDCurses", NULL}; +static char **argv = prog_name; +static int argc = 1; + +/* close the physical screen */ + +void PDC_scr_close(void) +{ + PDC_LOG(("PDC_scr_close() - called\n")); +} + +void PDC_scr_free(void) +{ + if (icon_pixmap) + XFreePixmap(XCURSESDISPLAY, icon_pixmap); + if (icon_pixmap_mask) + XFreePixmap(XCURSESDISPLAY, icon_pixmap_mask); + + XFreeGC(XCURSESDISPLAY, pdc_normal_gc); + XFreeGC(XCURSESDISPLAY, pdc_italic_gc); + XFreeGC(XCURSESDISPLAY, pdc_bold_gc); + XFreeGC(XCURSESDISPLAY, pdc_cursor_gc); + XDestroyIC(pdc_xic); +} + +void XCursesExit(void) +{ + PDC_scr_free(); +} + +static void _initialize_colors(void) +{ + int i, r, g, b; + + pdc_color[COLOR_BLACK] = pdc_app_data.colorBlack; + pdc_color[COLOR_RED] = pdc_app_data.colorRed; + pdc_color[COLOR_GREEN] = pdc_app_data.colorGreen; + pdc_color[COLOR_YELLOW] = pdc_app_data.colorYellow; + pdc_color[COLOR_BLUE] = pdc_app_data.colorBlue; + pdc_color[COLOR_MAGENTA] = pdc_app_data.colorMagenta; + pdc_color[COLOR_CYAN] = pdc_app_data.colorCyan; + pdc_color[COLOR_WHITE] = pdc_app_data.colorWhite; + + pdc_color[COLOR_BLACK + 8] = pdc_app_data.colorBoldBlack; + pdc_color[COLOR_RED + 8] = pdc_app_data.colorBoldRed; + pdc_color[COLOR_GREEN + 8] = pdc_app_data.colorBoldGreen; + pdc_color[COLOR_YELLOW + 8] = pdc_app_data.colorBoldYellow; + pdc_color[COLOR_BLUE + 8] = pdc_app_data.colorBoldBlue; + pdc_color[COLOR_MAGENTA + 8] = pdc_app_data.colorBoldMagenta; + pdc_color[COLOR_CYAN + 8] = pdc_app_data.colorBoldCyan; + pdc_color[COLOR_WHITE + 8] = pdc_app_data.colorBoldWhite; + +#define RGB(R, G, B) ( ((unsigned long)(R) << 16) | \ + ((unsigned long)(G) << 8) | \ + ((unsigned long)(B)) ) + + /* 256-color xterm extended palette: 216 colors in a 6x6x6 color + cube, plus 24 shades of gray */ + + for (i = 16, r = 0; r < 6; r++) + for (g = 0; g < 6; g++) + for (b = 0; b < 6; b++) + pdc_color[i++] = RGB(r ? r * 40 + 55 : 0, + g ? g * 40 + 55 : 0, + b ? b * 40 + 55 : 0); + for (i = 0; i < 24; i++) + pdc_color[i + 232] = RGB(i * 10 + 8, i * 10 + 8, i * 10 + 8); + +#undef RGB +} + +static void _get_icon(void) +{ + Status rc; + + PDC_LOG(("_get_icon() - called\n")); + + if (pdc_app_data.pixmap && pdc_app_data.pixmap[0]) /* supplied pixmap */ + { + XpmReadFileToPixmap(XtDisplay(pdc_toplevel), + RootWindowOfScreen(XtScreen(pdc_toplevel)), + (char *)pdc_app_data.pixmap, + &icon_pixmap, &icon_pixmap_mask, NULL); + } + else if (pdc_app_data.bitmap && pdc_app_data.bitmap[0]) /* bitmap */ + { + unsigned file_bitmap_width = 0, file_bitmap_height = 0; + int x_hot = 0, y_hot = 0; + + rc = XReadBitmapFile(XtDisplay(pdc_toplevel), + RootWindowOfScreen(XtScreen(pdc_toplevel)), + (char *)pdc_app_data.bitmap, + &file_bitmap_width, &file_bitmap_height, + &icon_pixmap, &x_hot, &y_hot); + + if (BitmapOpenFailed == rc) + fprintf(stderr, "bitmap file %s: not found\n", + pdc_app_data.bitmap); + else if (BitmapFileInvalid == rc) + fprintf(stderr, "bitmap file %s: contents invalid\n", + pdc_app_data.bitmap); + } + else + { + XIconSize *icon_size; + int size_count = 0, max_height = 0, max_width = 0; + + icon_size = XAllocIconSize(); + + rc = XGetIconSizes(XtDisplay(pdc_toplevel), + RootWindowOfScreen(XtScreen(pdc_toplevel)), + &icon_size, &size_count); + + /* if the WM can advise on icon sizes... */ + + if (rc && size_count) + { + int i; + + PDC_LOG(("size_count: %d rc: %d\n", size_count, rc)); + + for (i = 0; i < size_count; i++) + { + if (icon_size[i].max_width > max_width) + max_width = icon_size[i].max_width; + if (icon_size[i].max_height > max_height) + max_height = icon_size[i].max_height; + + PDC_LOG(("min: %d %d\n", + icon_size[i].min_width, icon_size[i].min_height)); + + PDC_LOG(("max: %d %d\n", + icon_size[i].max_width, icon_size[i].max_height)); + + PDC_LOG(("inc: %d %d\n", + icon_size[i].width_inc, icon_size[i].height_inc)); + } + } + + XFree(icon_size); + + XpmCreatePixmapFromData(XtDisplay(pdc_toplevel), + RootWindowOfScreen(XtScreen(pdc_toplevel)), + (max_width >= 64 && max_height >= 64) ? icon64 : icon32, + &icon_pixmap, &icon_pixmap_mask, NULL); + } +} + +/* Redraw the entire screen */ + +static void _display_screen(void) +{ + int row; + + PDC_LOG(("_display_screen() - called\n")); + + if (!curscr) + return; + + for (row = 0; row < SP->lines; row++) + PDC_transform_line(row, 0, COLS, curscr->_y[row]); + + PDC_redraw_cursor(); +} + +static void _handle_expose(Widget w, XtPointer client_data, XEvent *event, + Boolean *unused) +{ + PDC_LOG(("_handle_expose() - called\n")); + + /* ignore all Exposes except last */ + + if (event->xexpose.count) + return; + + exposed = TRUE; + + if (received_map_notify) + _display_screen(); +} + +static void _handle_nonmaskable(Widget w, XtPointer client_data, XEvent *event, + Boolean *unused) +{ + XClientMessageEvent *client_event = (XClientMessageEvent *)event; + + PDC_LOG(("_handle_nonmaskable called: event %d\n", event->type)); + + if (event->type == ClientMessage) + { + PDC_LOG(("ClientMessage received\n")); + + /* This code used to include handling of WM_SAVE_YOURSELF, but + it resulted in continual failure of THE on my Toshiba laptop. + Removed on 3-3-2001. Now only exits on WM_DELETE_WINDOW. */ + + if ((Atom)client_event->data.s[0] == wm_atom[0]) + exit(0); + } +} + +static void _handle_enter_leave(Widget w, XtPointer client_data, + XEvent *event, Boolean *unused) +{ + PDC_LOG(("_handle_enter_leave called\n")); + + switch(event->type) + { + case EnterNotify: + PDC_LOG(("EnterNotify received\n")); + + pdc_window_entered = TRUE; + break; + + case LeaveNotify: + PDC_LOG(("LeaveNotify received\n")); + + pdc_window_entered = FALSE; + + /* Display the cursor so it stays on while the window is + not current */ + + PDC_redraw_cursor(); + break; + + default: + PDC_LOG(("_handle_enter_leave - unknown event %d\n", event->type)); + } +} + +static void _handle_structure_notify(Widget w, XtPointer client_data, + XEvent *event, Boolean *unused) +{ + PDC_LOG(("_handle_structure_notify() - called\n")); + + switch(event->type) + { + case ConfigureNotify: + PDC_LOG(("ConfigureNotify received\n")); + + /* Window has been resized, change width and height to send to + place_text and place_graphics in next Expose. */ + { + int new_w = event->xconfigure.width; + int new_h = event->xconfigure.height; + + if (new_w != resize_window_width || + new_h != resize_window_height) + { + resize_window_width = new_w; + resize_window_height = new_h; + + SP->resized = TRUE; + pdc_resize_now = TRUE; + } + } + break; + + case MapNotify: + PDC_LOG(("MapNotify received\n")); + + received_map_notify = 1; + + break; + + default: + PDC_LOG(("_handle_structure_notify - unknown event %d\n", + event->type)); + } +} + +static void _get_gc(GC *gc, XFontStruct *font_info, int fore, int back) +{ + XGCValues values; + + /* Create default Graphics Context */ + + *gc = XCreateGC(XCURSESDISPLAY, XCURSESWIN, 0L, &values); + + /* specify font */ + + XSetFont(XCURSESDISPLAY, *gc, font_info->fid); + + XSetForeground(XCURSESDISPLAY, *gc, pdc_color[fore]); + XSetBackground(XCURSESDISPLAY, *gc, pdc_color[back]); +} + +static void _pointer_setup(void) +{ + XColor pointerforecolor, pointerbackcolor; + XrmValue rmfrom, rmto; + + XDefineCursor(XCURSESDISPLAY, XCURSESWIN, pdc_app_data.pointer); + rmfrom.size = sizeof(Pixel); + rmto.size = sizeof(XColor); + + rmto.addr = (XPointer)&pointerforecolor; + rmfrom.addr = (XPointer)&(pdc_app_data.pointerForeColor); + XtConvertAndStore(pdc_drawing, XtRPixel, &rmfrom, XtRColor, &rmto); + + rmfrom.size = sizeof(Pixel); + rmto.size = sizeof(XColor); + + rmfrom.addr = (XPointer)&(pdc_app_data.pointerBackColor); + rmto.addr = (XPointer)&pointerbackcolor; + XtConvertAndStore(pdc_drawing, XtRPixel, &rmfrom, XtRColor, &rmto); + + XRecolorCursor(XCURSESDISPLAY, pdc_app_data.pointer, + &pointerforecolor, &pointerbackcolor); +} + +void PDC_set_args(int c, char **v) +{ + argc = c; + argv = v; +} + +/* open the physical screen -- miscellaneous initialization */ + +int PDC_scr_open(void) +{ + bool italic_font_valid, bold_font_valid; + int minwidth, minheight; + + PDC_LOG(("PDC_scr_open() - called\n")); + + /* Start defining X Toolkit things */ + +#if XtSpecificationRelease > 4 + XtSetLanguageProc(NULL, (XtLanguageProc)NULL, NULL); +#endif + + /* Exit if no DISPLAY variable set */ + + if (!getenv("DISPLAY")) + { + fprintf(stderr, "Error: no DISPLAY variable set\n"); + return ERR; + } + + /* Initialise the top level widget */ + + pdc_toplevel = XtVaAppInitialize(&pdc_app_context, class_name, options, + XtNumber(options), &argc, argv, NULL, NULL); + + XtVaGetApplicationResources(pdc_toplevel, &pdc_app_data, app_resources, + XtNumber(app_resources), NULL); + + /* Check application resource values here */ + + pdc_fwidth = pdc_app_data.normalFont->max_bounds.width; + + pdc_fascent = pdc_app_data.normalFont->ascent; + pdc_fdescent = pdc_app_data.normalFont->descent; + pdc_fheight = pdc_fascent + pdc_fdescent; + + /* Check that the italic font and normal fonts are the same size */ + + italic_font_valid = + pdc_fwidth == pdc_app_data.italicFont->max_bounds.width; + + bold_font_valid = + pdc_fwidth == pdc_app_data.boldFont->max_bounds.width; + + /* Calculate size of display window */ + + COLS = pdc_app_data.cols; + LINES = pdc_app_data.lines; + + if (-1 == COLS) + { + const char *env = getenv("PDC_COLS"); + if (env) + COLS = atoi(env); + + if (COLS <= 0) + COLS = 80; + } + + if (-1 == LINES) + { + const char *env = getenv("PDC_LINES"); + if (env) + LINES = atoi(env); + + if (LINES <= 0) + LINES = 24; + } + + pdc_wwidth = pdc_fwidth * COLS; + pdc_wheight = pdc_fheight * LINES; + + minwidth = pdc_fwidth * 2; + minheight = pdc_fheight * 2; + + /* Set up the icon for the application; the default is an internal + one for PDCurses. Then set various application level resources. */ + + _get_icon(); + + XtVaSetValues(pdc_toplevel, XtNminWidth, minwidth, XtNminHeight, + minheight, XtNbaseWidth, 0, XtNbaseHeight, 0, + XtNbackground, 0, XtNiconPixmap, icon_pixmap, + XtNiconMask, icon_pixmap_mask, NULL); + + /* Create a widget in which to draw */ + + if (!PDC_scrollbar_init(argv[0])) + { + pdc_drawing = pdc_toplevel; + + XtVaSetValues(pdc_toplevel, XtNwidth, pdc_wwidth, XtNheight, + pdc_wheight, XtNwidthInc, pdc_fwidth, XtNheightInc, + pdc_fheight, NULL); + } + + /* Determine text cursor alignment from resources */ + + if (!strcmp(pdc_app_data.textCursor, "vertical")) + pdc_vertical_cursor = TRUE; + + SP->lines = LINES; + SP->cols = COLS; + + SP->mouse_wait = pdc_app_data.clickPeriod; + SP->audible = TRUE; + + SP->termattrs = A_COLOR | A_ITALIC | A_UNDERLINE | A_LEFT | A_RIGHT | + A_REVERSE; + + /* Add Event handlers to the drawing widget */ + + XtAddEventHandler(pdc_drawing, ExposureMask, False, _handle_expose, NULL); + XtAddEventHandler(pdc_drawing, StructureNotifyMask, False, + _handle_structure_notify, NULL); + XtAddEventHandler(pdc_drawing, EnterWindowMask | LeaveWindowMask, False, + _handle_enter_leave, NULL); + XtAddEventHandler(pdc_toplevel, 0, True, _handle_nonmaskable, NULL); + + /* If there is a cursorBlink resource, start the Timeout event */ + + if (pdc_app_data.cursorBlinkRate) + XtAppAddTimeOut(pdc_app_context, pdc_app_data.cursorBlinkRate, + PDC_blink_cursor, NULL); + + XtRealizeWidget(pdc_toplevel); + + /* Handle trapping of the WM_DELETE_WINDOW property */ + + wm_atom[0] = XInternAtom(XtDisplay(pdc_toplevel), "WM_DELETE_WINDOW", + False); + + /* Make sure we tell X that we'd like to take focus */ + wm_atom[1] = XInternAtom(XtDisplay(pdc_toplevel), "WM_TAKE_FOCUS", + False); + XSetWMProtocols(XtDisplay(pdc_toplevel), XtWindow(pdc_toplevel), + wm_atom, 2); + + /* Create the Graphics Context for drawing. This MUST be done AFTER + the associated widget has been realized. */ + + PDC_LOG(("before _get_gc\n")); + + _get_gc(&pdc_normal_gc, pdc_app_data.normalFont, COLOR_WHITE, COLOR_BLACK); + + _get_gc(&pdc_italic_gc, italic_font_valid ? pdc_app_data.italicFont : + pdc_app_data.normalFont, COLOR_WHITE, COLOR_BLACK); + + _get_gc(&pdc_bold_gc, bold_font_valid ? pdc_app_data.boldFont : + pdc_app_data.normalFont, COLOR_WHITE, COLOR_BLACK); + + _get_gc(&pdc_cursor_gc, pdc_app_data.normalFont, + COLOR_WHITE, COLOR_BLACK); + + XSetLineAttributes(XCURSESDISPLAY, pdc_cursor_gc, 2, + LineSolid, CapButt, JoinMiter); + + /* Set the pointer for the application */ + + _pointer_setup(); + + if (ERR == PDC_kb_setup()) + return ERR; + + while (!exposed) + { + XEvent event; + + XtAppNextEvent(pdc_app_context, &event); + XtDispatchEvent(&event); + } + + _initialize_colors(); + + SP->orig_attr = FALSE; + + atexit(PDC_scr_free); + + XSync(XtDisplay(pdc_toplevel), True); + SP->resized = pdc_resize_now = FALSE; + + /* Make sure that we say that we're allowed to have input focus. + Otherwise some window managers will refuse to focus the window. */ + XWMHints* hints = XGetWMHints(XtDisplay(pdc_toplevel), XtWindow(pdc_toplevel)); + hints->input=true; + XSetWMHints(XtDisplay(pdc_toplevel), XtWindow(pdc_toplevel), hints); + XFree(hints); + + return OK; +} + +/* the core of resize_term() */ + +int PDC_resize_screen(int nlines, int ncols) +{ + PDC_LOG(("PDC_resize_screen() - called. Lines: %d Cols: %d\n", + nlines, ncols)); + + if (nlines || ncols || !SP->resized) + return ERR; + + pdc_wwidth = resize_window_width; + pdc_wheight = resize_window_height; + pdc_visible_cursor = TRUE; + + return OK; +} + +void PDC_reset_prog_mode(void) +{ + PDC_LOG(("PDC_reset_prog_mode() - called.\n")); +} + +void PDC_reset_shell_mode(void) +{ + PDC_LOG(("PDC_reset_shell_mode() - called.\n")); +} + +void PDC_restore_screen_mode(int i) +{ +} + +void PDC_save_screen_mode(int i) +{ +} + +bool PDC_can_change_color(void) +{ + return TRUE; +} + +int PDC_color_content(short color, short *red, short *green, short *blue) +{ + XColor tmp; + Colormap cmap = DefaultColormap(XCURSESDISPLAY, + DefaultScreen(XCURSESDISPLAY)); + + tmp.pixel = pdc_color[color]; + XQueryColor(XCURSESDISPLAY, cmap, &tmp); + + *red = ((double)(tmp.red) * 1000 / 65535) + 0.5; + *green = ((double)(tmp.green) * 1000 / 65535) + 0.5; + *blue = ((double)(tmp.blue) * 1000 / 65535) + 0.5; + + return OK; +} + +int PDC_init_color(short color, short red, short green, short blue) +{ + XColor tmp; + + tmp.red = ((double)red * 65535 / 1000) + 0.5; + tmp.green = ((double)green * 65535 / 1000) + 0.5; + tmp.blue = ((double)blue * 65535 / 1000) + 0.5; + + Colormap cmap = DefaultColormap(XCURSESDISPLAY, + DefaultScreen(XCURSESDISPLAY)); + + if (XAllocColor(XCURSESDISPLAY, cmap, &tmp)) + pdc_color[color] = tmp.pixel; + + return OK; +} diff --git a/vendor/pdcurses/x11/pdcsetsc.c b/vendor/pdcurses/x11/pdcsetsc.c new file mode 100644 index 0000000..1b7a521 --- /dev/null +++ b/vendor/pdcurses/x11/pdcsetsc.c @@ -0,0 +1,102 @@ +/* PDCurses */ + +#include "pdcx11.h" + +#include + +/*man-start************************************************************** + +pdcsetsc +-------- + +### Synopsis + + int PDC_set_blink(bool blinkon); + int PDC_set_bold(bool boldon); + void PDC_set_title(const char *title); + +### Description + + PDC_set_blink() toggles whether the A_BLINK attribute sets an actual + blink mode (TRUE), or sets the background color to high intensity + (FALSE). The default is platform-dependent (FALSE in most cases). It + returns OK if it could set the state to match the given parameter, + ERR otherwise. + + PDC_set_bold() toggles whether the A_BOLD attribute selects an actual + bold font (TRUE), or sets the foreground color to high intensity + (FALSE). It returns OK if it could set the state to match the given + parameter, ERR otherwise. + + PDC_set_title() sets the title of the window in which the curses + program is running. This function may not do anything on some + platforms. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + PDC_set_blink | - | - | - + PDC_set_bold | - | - | - + PDC_set_title | - | - | - + +**man-end****************************************************************/ + +int PDC_curs_set(int visibility) +{ + int ret_vis = SP->visibility; + + PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); + + if (visibility != -1) + SP->visibility = visibility; + + PDC_display_cursor(SP->cursrow, SP->curscol, SP->cursrow, + SP->curscol, visibility); + + return ret_vis; +} + +void PDC_set_title(const char *title) +{ + PDC_LOG(("PDC_set_title() - called:<%s>\n", title)); + + XtVaSetValues(pdc_toplevel, XtNtitle, title, NULL); +} + +int PDC_set_blink(bool blinkon) +{ + if (!SP) + return ERR; + + if (SP->color_started) + COLORS = PDC_MAXCOL; + + if (blinkon) + { + if (!(SP->termattrs & A_BLINK)) + { + SP->termattrs |= A_BLINK; + pdc_blinked_off = FALSE; + XtAppAddTimeOut(pdc_app_context, pdc_app_data.textBlinkRate, + PDC_blink_text, NULL); + } + } + else + SP->termattrs &= ~A_BLINK; + + return OK; +} + +int PDC_set_bold(bool boldon) +{ + if (!SP) + return ERR; + + if (boldon) + SP->termattrs |= A_BOLD; + else + SP->termattrs &= ~A_BOLD; + + return OK; +} diff --git a/vendor/pdcurses/x11/pdcutil.c b/vendor/pdcurses/x11/pdcutil.c new file mode 100644 index 0000000..51762c7 --- /dev/null +++ b/vendor/pdcurses/x11/pdcutil.c @@ -0,0 +1,39 @@ +/* PDCurses */ + +#include "pdcx11.h" + +#if defined(HAVE_POLL) && !defined(HAVE_USLEEP) +# include +#endif + +void PDC_beep(void) +{ + PDC_LOG(("PDC_beep() - called\n")); + + XBell(XtDisplay(pdc_toplevel), 50); +} + +void PDC_napms(int ms) +{ + PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); + + XSync(XtDisplay(pdc_toplevel), False); + +#if defined(HAVE_USLEEP) + + usleep(1000 * ms); + +#elif defined(HAVE_POLL) + { + struct pollfd fd; + fd.fd = -1; + fd.events = 0; + poll(&fd, 1, ms); + } +#endif +} + +const char *PDC_sysname(void) +{ + return "X11"; +} diff --git a/vendor/pdcurses/x11/pdcx11.h b/vendor/pdcurses/x11/pdcx11.h new file mode 100644 index 0000000..21d9d30 --- /dev/null +++ b/vendor/pdcurses/x11/pdcx11.h @@ -0,0 +1,82 @@ +/* PDCurses */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#ifdef HAVE_UNISTD_H +# include +#endif + +#include + +#include + +#include +#include +#include + +#include + +#define XCURSESDISPLAY (XtDisplay(pdc_drawing)) +#define XCURSESWIN (XtWindow(pdc_drawing)) + +typedef struct +{ + int lines; + int cols; + Pixel colorBlack; + Pixel colorRed; + Pixel colorGreen; + Pixel colorYellow; + Pixel colorBlue; + Pixel colorMagenta; + Pixel colorCyan; + Pixel colorWhite; + Pixel colorBoldBlack; + Pixel colorBoldRed; + Pixel colorBoldGreen; + Pixel colorBoldYellow; + Pixel colorBoldBlue; + Pixel colorBoldMagenta; + Pixel colorBoldCyan; + Pixel colorBoldWhite; + Pixel pointerForeColor; + Pixel pointerBackColor; + XFontStruct *normalFont; + XFontStruct *italicFont; + XFontStruct *boldFont; + char *bitmap; + char *pixmap; + Cursor pointer; + int clickPeriod; + int doubleClickPeriod; + int scrollbarWidth; + int cursorBlinkRate; + char *textCursor; + int textBlinkRate; +} XCursesAppData; + +extern Pixel pdc_color[PDC_MAXCOL]; +extern XIC pdc_xic; + +extern XCursesAppData pdc_app_data; +extern XtAppContext pdc_app_context; +extern Widget pdc_toplevel, pdc_drawing; + +extern GC pdc_normal_gc, pdc_cursor_gc, pdc_italic_gc, pdc_bold_gc; +extern int pdc_fheight, pdc_fwidth, pdc_fascent, pdc_fdescent; +extern int pdc_wwidth, pdc_wheight; + +extern bool pdc_blinked_off, pdc_window_entered, pdc_resize_now; +extern bool pdc_vertical_cursor, pdc_visible_cursor; + +int PDC_display_cursor(int, int, int, int, int); + +void PDC_blink_cursor(XtPointer, XtIntervalId *); +void PDC_blink_text(XtPointer, XtIntervalId *); +int PDC_kb_setup(void); +void PDC_redraw_cursor(void); +bool PDC_scrollbar_init(const char *); diff --git a/vendor/pdcurses/x11/sb.c b/vendor/pdcurses/x11/sb.c new file mode 100644 index 0000000..9fc969b --- /dev/null +++ b/vendor/pdcurses/x11/sb.c @@ -0,0 +1,328 @@ +/* PDCurses */ + +#include "pdcx11.h" + +/*man-start************************************************************** + +sb +-- + +### Synopsis + + int sb_init(void) + int sb_set_horz(int total, int viewport, int cur) + int sb_set_vert(int total, int viewport, int cur) + int sb_get_horz(int *total, int *viewport, int *cur) + int sb_get_vert(int *total, int *viewport, int *cur) + int sb_refresh(void); + +### Description + + These functions manipulate the scrollbar (X11 only). + +### Return Value + + All functions return OK on success and ERR on error. + +### Portability + + Function | X/Open | ncurses | NetBSD + :---------------------|:------:|:-------:|:------: + sb_init | - | - | - + sb_set_horz | - | - | - + sb_set_vert | - | - | - + sb_get_horz | - | - | - + sb_get_vert | - | - | - + sb_refresh | - | - | - + +**man-end****************************************************************/ + +#ifdef USE_XAW3D +# include +# include +#elif defined(USE_NEXTAW) +# include +# include +#else +# include +# include +#endif + +#include "scrlbox.h" + +bool sb_started = FALSE; + +#if NeedWidePrototypes +# define PDC_SCROLLBAR_TYPE double +#else +# define PDC_SCROLLBAR_TYPE float +#endif + +static Widget scrollBox, scrollVert, scrollHoriz; +static int sb_viewport_y, sb_viewport_x; +static int sb_total_y, sb_total_x, sb_cur_y, sb_cur_x; + +static void _scroll_up_down(Widget w, XtPointer client_data, + XtPointer call_data) +{ + int pixels = (long) call_data; + int total_y = sb_total_y * pdc_fheight; + int viewport_y = sb_viewport_y * pdc_fheight; + int cur_y = sb_cur_y * pdc_fheight; + + /* When pixels is negative, right button pressed, move data down, + thumb moves up. Otherwise, left button pressed, pixels positive, + move data up, thumb down. */ + + cur_y += pixels; + + /* limit panning to size of overall */ + + if (cur_y < 0) + cur_y = 0; + else + if (cur_y > (total_y - viewport_y)) + cur_y = total_y - viewport_y; + + sb_cur_y = cur_y / pdc_fheight; + + XawScrollbarSetThumb(w, (double)((double)cur_y / (double)total_y), + (double)((double)viewport_y / (double)total_y)); +} + +static void _scroll_left_right(Widget w, XtPointer client_data, + XtPointer call_data) +{ + int pixels = (long) call_data; + int total_x = sb_total_x * pdc_fwidth; + int viewport_x = sb_viewport_x * pdc_fwidth; + int cur_x = sb_cur_x * pdc_fwidth; + + cur_x += pixels; + + /* limit panning to size of overall */ + + if (cur_x < 0) + cur_x = 0; + else + if (cur_x > (total_x - viewport_x)) + cur_x = total_x - viewport_x; + + sb_cur_x = cur_x / pdc_fwidth; + + XawScrollbarSetThumb(w, (double)((double)cur_x / (double)total_x), + (double)((double)viewport_x / (double)total_x)); +} + +static void _thumb_up_down(Widget w, XtPointer client_data, + XtPointer call_data) +{ + double percent = *(double *) call_data; + double total_y = (double) sb_total_y; + double viewport_y = (double) sb_viewport_y; + int cur_y = sb_cur_y; + + /* If the size of the viewport is > overall area simply return, + as no scrolling is permitted. */ + + if (sb_viewport_y >= sb_total_y) + return; + + if ((sb_cur_y = (int)((double)total_y * percent)) >= + (total_y - viewport_y)) + sb_cur_y = total_y - viewport_y; + + XawScrollbarSetThumb(w, (double)(cur_y / total_y), + (double)(viewport_y / total_y)); +} + +static void _thumb_left_right(Widget w, XtPointer client_data, + XtPointer call_data) +{ + double percent = *(double *) call_data; + double total_x = (double) sb_total_x; + double viewport_x = (double) sb_viewport_x; + int cur_x = sb_cur_x; + + if (sb_viewport_x >= sb_total_x) + return; + + if ((sb_cur_x = (int)((float)total_x * percent)) >= + (total_x - viewport_x)) + sb_cur_x = total_x - viewport_x; + + XawScrollbarSetThumb(w, (double)(cur_x / total_x), + (double)(viewport_x / total_x)); +} + +bool PDC_scrollbar_init(const char *program_name) +{ + if (pdc_app_data.scrollbarWidth && sb_started) + { + scrollBox = XtVaCreateManagedWidget(program_name, + scrollBoxWidgetClass, pdc_toplevel, XtNwidth, + pdc_wwidth + pdc_app_data.scrollbarWidth, + XtNheight, pdc_wheight + pdc_app_data.scrollbarWidth, + XtNwidthInc, pdc_fwidth, XtNheightInc, pdc_fheight, NULL); + + pdc_drawing = XtVaCreateManagedWidget(program_name, + boxWidgetClass, scrollBox, XtNwidth, + pdc_wwidth, XtNheight, pdc_wheight, XtNwidthInc, + pdc_fwidth, XtNheightInc, pdc_fheight, NULL); + + scrollVert = XtVaCreateManagedWidget("scrollVert", + scrollbarWidgetClass, scrollBox, XtNorientation, + XtorientVertical, XtNheight, pdc_wheight, XtNwidth, + pdc_app_data.scrollbarWidth, NULL); + + XtAddCallback(scrollVert, XtNscrollProc, _scroll_up_down, pdc_drawing); + XtAddCallback(scrollVert, XtNjumpProc, _thumb_up_down, pdc_drawing); + + scrollHoriz = XtVaCreateManagedWidget("scrollHoriz", + scrollbarWidgetClass, scrollBox, XtNorientation, + XtorientHorizontal, XtNwidth, pdc_wwidth, XtNheight, + pdc_app_data.scrollbarWidth, NULL); + + XtAddCallback(scrollHoriz, XtNscrollProc, _scroll_left_right, + pdc_drawing); + XtAddCallback(scrollHoriz, XtNjumpProc, _thumb_left_right, + pdc_drawing); + + return TRUE; + } + + return FALSE; +} + +/* sb_init() is the sb initialization routine. + This must be called before initscr(). */ + +int sb_init(void) +{ + PDC_LOG(("sb_init() - called\n")); + + if (SP) + return ERR; + + sb_started = TRUE; + sb_viewport_y = sb_viewport_x = 0; + sb_total_y = sb_total_x = sb_cur_y = sb_cur_x = 0; + + return OK; +} + +/* sb_set_horz() - Used to set horizontal scrollbar. + + total = total number of columns + viewport = size of viewport in columns + cur = current column in total */ + +int sb_set_horz(int total, int viewport, int cur) +{ + PDC_LOG(("sb_set_horz() - called: total %d viewport %d cur %d\n", + total, viewport, cur)); + + if (!SP) + return ERR; + + sb_total_x = total; + sb_viewport_x = viewport; + sb_cur_x = cur; + + return OK; +} + +/* sb_set_vert() - Used to set vertical scrollbar. + + total = total number of columns on line + viewport = size of viewport in columns + cur = current column in total */ + +int sb_set_vert(int total, int viewport, int cur) +{ + PDC_LOG(("sb_set_vert() - called: total %d viewport %d cur %d\n", + total, viewport, cur)); + + if (!SP) + return ERR; + + sb_total_y = total; + sb_viewport_y = viewport; + sb_cur_y = cur; + + return OK; +} + +/* sb_get_horz() - Used to get horizontal scrollbar. + + total = total number of lines + viewport = size of viewport in lines + cur = current line in total */ + +int sb_get_horz(int *total, int *viewport, int *cur) +{ + PDC_LOG(("sb_get_horz() - called\n")); + + if (!SP) + return ERR; + + if (total) + *total = sb_total_x; + if (viewport) + *viewport = sb_viewport_x; + if (cur) + *cur = sb_cur_x; + + return OK; +} + +/* sb_get_vert() - Used to get vertical scrollbar. + + total = total number of lines + viewport = size of viewport in lines + cur = current line in total */ + +int sb_get_vert(int *total, int *viewport, int *cur) +{ + PDC_LOG(("sb_get_vert() - called\n")); + + if (!SP) + return ERR; + + if (total) + *total = sb_total_y; + if (viewport) + *viewport = sb_viewport_y; + if (cur) + *cur = sb_cur_y; + + return OK; +} + +/* sb_refresh() - Used to draw the scrollbars. */ + +int sb_refresh(void) +{ + PDC_LOG(("sb_refresh() - called\n")); + + if (!SP) + return ERR; + + if (sb_started) + { + PDC_SCROLLBAR_TYPE total_y = sb_total_y; + PDC_SCROLLBAR_TYPE total_x = sb_total_x; + + if (total_y) + XawScrollbarSetThumb(scrollVert, + (PDC_SCROLLBAR_TYPE)(sb_cur_y) / total_y, + (PDC_SCROLLBAR_TYPE)(sb_viewport_y) / total_y); + + if (total_x) + XawScrollbarSetThumb(scrollHoriz, + (PDC_SCROLLBAR_TYPE)(sb_cur_x) / total_x, + (PDC_SCROLLBAR_TYPE)(sb_viewport_x) / total_x); + } + + return OK; +} diff --git a/vendor/pdcurses/x11/scrlbox.c b/vendor/pdcurses/x11/scrlbox.c new file mode 100644 index 0000000..e492a06 --- /dev/null +++ b/vendor/pdcurses/x11/scrlbox.c @@ -0,0 +1,337 @@ +/* + * Copyright 1989 O'Reilly and Associates, Inc. + + The X Consortium, and any party obtaining a copy of these files from + the X Consortium, directly or indirectly, is granted, free of charge, a + full and unrestricted irrevocable, world-wide, paid up, royalty-free, + nonexclusive right and license to deal in this software and + documentation files (the "Software"), including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons who receive + copies from any such party to do so. This license includes without + limitation a license to do the foregoing actions under any patents of + the party supplying this software to the X Consortium. + */ + +/* ScrollBox.c - scrollBox composite widget */ + +#include +#include +#include +#include +#include + +#include "scrlbox.h" + +#define INITIAL_WIDTH 300 +#define INITIAL_HEIGHT 300 + +/* New fields for the scrollBox widget class record */ +typedef struct _ScrollBoxClass { + int empty; +} ScrollBoxClassPart; + +/* Full class record declaration */ +typedef struct _ScrollBoxClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ScrollBoxClassPart scrollBox_class; +} ScrollBoxClassRec; + +extern ScrollBoxClassRec scrollBoxClassRec; + +/* New fields for the scrollBox widget record */ +typedef struct { + Dimension h_space, v_space; + Dimension preferred_width, preferred_height; + Dimension last_query_width, last_query_height; + Dimension increment_width, increment_height; + XtGeometryMask last_query_mode; +} ScrollBoxPart; + +/* Full instance record declaration */ + +typedef struct _ScrollBoxRec { + CorePart core; + CompositePart composite; + ScrollBoxPart scrollBox; +} ScrollBoxRec; + +/* scrollBox Resources */ + +static XtResource resources[] = +{ + { XtNhSpace, XtCHSpace, XtRDimension, sizeof(Dimension), + XtOffset(ScrollBoxWidget, scrollBox.h_space), + XtRImmediate, (XtPointer)4 }, + { XtNvSpace, XtCVSpace, XtRDimension, sizeof(Dimension), + XtOffset(ScrollBoxWidget, scrollBox.v_space), + XtRImmediate, (XtPointer)4 }, + { XtNheightInc, XtCHeightInc, XtRDimension, sizeof(Dimension), + XtOffset(ScrollBoxWidget, scrollBox.increment_height), + XtRImmediate, (XtPointer)13 }, + { XtNwidthInc, XtCWidthInc, XtRDimension, sizeof(Dimension), + XtOffset(ScrollBoxWidget, scrollBox.increment_width), + XtRImmediate, (XtPointer)7 }, +}; + +/* Full class record constant */ + +static void Initialize(Widget, Widget, ArgList, Cardinal *); +static void Resize(Widget); +static Boolean SetValues(Widget, Widget, Widget, ArgList, Cardinal *); +static void ChangeManaged(Widget); +static XtGeometryResult QueryGeometry(Widget, XtWidgetGeometry *, + XtWidgetGeometry *); +static XtGeometryResult GeometryManager(Widget, XtWidgetGeometry *, + XtWidgetGeometry *); +static void RefigureLocations(Widget); + +ScrollBoxClassRec scrollBoxClassRec = { + { + /* core_class fields */ + /* superclass */ (WidgetClass) &compositeClassRec, + /* class_name */ "scrollBox", + /* widget_size */ sizeof(ScrollBoxRec), + /* class_initialize */ NULL, + /* class_part_init */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ Resize, + /* expose */ NULL, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ QueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + },{ + /* composite_class fields */ + /* geometry_manager */ GeometryManager, + /* change_managed */ ChangeManaged, + /* insert_child */ XtInheritInsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL + },{ + /* scrollBox class fields */ + /* empty */ 0, + } +}; + +WidgetClass scrollBoxWidgetClass = (WidgetClass)&scrollBoxClassRec; + +/* Private Routines */ + +/* Do a layout, either actually assigning positions, or just + calculating size. */ + +static void DoLayout(Widget w, Boolean doit) +{ + ScrollBoxWidget sbw = (ScrollBoxWidget)w; + Widget wmain, vscroll, hscroll, child; + Dimension mw, mh; /* main window */ + Dimension vh; /* vertical scrollbar length (height) */ + Dimension hw; /* horizontal scrollbar length (width) */ + Position vx; + Position hy; + Cardinal i; + + if (sbw->composite.num_children != 3) + XtAppError(XtWidgetToApplicationContext(w), + "ScrollBox: must manage exactly three widgets."); + + for (i = 0; i < sbw->composite.num_children; i++) + { + child = sbw->composite.children[i]; + + if (!XtIsManaged(child)) + XtAppError(XtWidgetToApplicationContext(w), + "ScrollBox: all three widgets must be managed."); + } + + /* Child one is the main window, two is the vertical scrollbar, + and three is the horizontal scrollbar. */ + + wmain = sbw->composite.children[0]; + vscroll = sbw->composite.children[1]; + hscroll = sbw->composite.children[2]; + + /* Size all three widgets so that space is fully utilized. */ + + mw = sbw->core.width - (2 * sbw->scrollBox.h_space) - + vscroll->core.width - (2 * vscroll->core.border_width) - + (2 * wmain->core.border_width); + + mh = sbw->core.height - (2 * sbw->scrollBox.v_space) - + hscroll->core.height - (2 * hscroll->core.border_width) - + (2 * wmain->core.border_width); + + /* Force the main window to be sized to the appropriate increment. */ + + mw = (mw / sbw->scrollBox.increment_width) * + sbw->scrollBox.increment_width; + + mh = ((mh / sbw->scrollBox.increment_height) * + sbw->scrollBox.increment_height) + + sbw->scrollBox.increment_height; + + vx = wmain->core.x + mw + sbw->scrollBox.h_space + + wmain->core.border_width + vscroll->core.border_width; + + hy = wmain->core.y + mh + sbw->scrollBox.v_space + + wmain->core.border_width + hscroll->core.border_width; + + vh = mh; /* scrollbars are always same length as main window */ + hw = mw; + + if (doit) + { + XtResizeWidget(wmain, mw, mh, 1); + + XtResizeWidget(vscroll, vscroll->core.width, vh, 1); + XtMoveWidget(vscroll, vx, vscroll->core.y); + + XtResizeWidget(hscroll, hw, hscroll->core.height, 1); + XtMoveWidget(hscroll, hscroll->core.x, hy); + } +} + +static XtGeometryResult GeometryManager(Widget w, XtWidgetGeometry *request, + XtWidgetGeometry *reply) +{ + XtWidgetGeometry allowed; + + if (request->request_mode & ~(XtCWQueryOnly | CWWidth | CWHeight)) + return XtGeometryNo; + + if (request->request_mode & CWWidth) + allowed.width = request->width; + else + allowed.width = w->core.width; + + if (request->request_mode & CWHeight) + allowed.height = request->height; + else + allowed.height = w->core.height; + + if (allowed.width == w->core.width && allowed.height == w->core.height) + return XtGeometryNo; + + if (!(request->request_mode & XtCWQueryOnly)) + RefigureLocations(w); + + return XtGeometryYes; +} + +static void RefigureLocations(Widget w) +{ + DoLayout(w, False); +} + +/* Calculate preferred size. We can't just use the current sizes + of the children, because that calculation would always end up with + our current size. Could query each child, and use that size to + recalculate a size for us, then if it ends up being larger than width + and height passed in, accept bounding box. However, we know our + children and they don't have any particular preferred geometry, + except the bigger the better. Therefore, if the parent suggested a + size, we'll take it. */ + +static XtGeometryResult QueryGeometry(Widget w, XtWidgetGeometry *request, + XtWidgetGeometry *reply_return) +{ + XtGeometryResult result=XtGeometryNo; + + request->request_mode &= CWWidth | CWHeight; + + /* parent isn't going to change w or h, so nothing to re-compute */ + + if (request->request_mode == 0) + return XtGeometryYes; + + /* if proposed size is large enough, accept it. Otherwise, suggest + our arbitrary initial size. */ + + if (request->request_mode & CWHeight) + { + if (request->height < INITIAL_HEIGHT) + { + result = XtGeometryAlmost; + reply_return->height = INITIAL_HEIGHT; + reply_return->request_mode &= CWHeight; + } + else + result = XtGeometryYes; + } + + if (request->request_mode & CWWidth) + { + if (request->width < INITIAL_WIDTH) + { + result = XtGeometryAlmost; + reply_return->width = INITIAL_WIDTH; + reply_return->request_mode &= CWWidth; + } + else + result = XtGeometryYes; + } + + return result; +} + +/* Actually layout the scrollBox */ + +static void Resize(Widget w) +{ + DoLayout(w, True); +} + +static void ChangeManaged(Widget w) +{ + DoLayout(w, True); +} + +static void Initialize(Widget request, Widget new, + ArgList args, Cardinal *num_args) +{ + ScrollBoxWidget newsbw = (ScrollBoxWidget)new; + + if (newsbw->core.width == 0) + newsbw->core.width = INITIAL_WIDTH; + + if (newsbw->core.height == 0) + newsbw->core.height = INITIAL_HEIGHT; + +} + +static Boolean SetValues(Widget current, Widget request, Widget new, + ArgList args, Cardinal *num_args) +{ + ScrollBoxWidget sbwcurrent = (ScrollBoxWidget)current; + ScrollBoxWidget sbwnew = (ScrollBoxWidget)new; + + /* need to relayout if h_space or v_space change */ + + if ((sbwnew->scrollBox.h_space != sbwcurrent->scrollBox.h_space) || + (sbwnew->scrollBox.v_space != sbwcurrent->scrollBox.v_space)) + DoLayout(new, True); + + return False; +} diff --git a/vendor/pdcurses/x11/scrlbox.h b/vendor/pdcurses/x11/scrlbox.h new file mode 100644 index 0000000..9af04d0 --- /dev/null +++ b/vendor/pdcurses/x11/scrlbox.h @@ -0,0 +1,47 @@ +/* + * Copyright 1989 O'Reilly and Associates, Inc. + + The X Consortium, and any party obtaining a copy of these files from + the X Consortium, directly or indirectly, is granted, free of charge, a + full and unrestricted irrevocable, world-wide, paid up, royalty-free, + nonexclusive right and license to deal in this software and + documentation files (the "Software"), including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons who receive + copies from any such party to do so. This license includes without + limitation a license to do the foregoing actions under any patents of + the party supplying this software to the X Consortium. + */ + +#ifndef _XORAscrollBox_h +#define _XORAscrollBox_h + +/* scrollBox Widget (subclass of CompositeClass) */ + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + hSpace HSpace Dimension 4 + height Height Dimension 0 + mappedWhenManaged MappedWhenManaged Boolean True + vSpace VSpace Dimension 4 + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +*/ + + +/* Class record constants */ + +extern WidgetClass scrollBoxWidgetClass; + +typedef struct _ScrollBoxClassRec *ScrollBoxWidgetClass; +typedef struct _ScrollBoxRec *ScrollBoxWidget; + +#endif /* _XORAscrollBox_h */ diff --git a/vendor/pdcurses/x11/xcurses-config.in b/vendor/pdcurses/x11/xcurses-config.in new file mode 100644 index 0000000..3a230a5 --- /dev/null +++ b/vendor/pdcurses/x11/xcurses-config.in @@ -0,0 +1,81 @@ +#! /bin/sh +# +# The idea to this kind of setup info script was stolen from numerous +# other packages, such as neon, libxml and gnome. +# + +verdot=@PACKAGE_VERSION@ + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@/xcurses + +usage() +{ + echo "Usage: xcurses-config [OPTION]" + echo "" + echo "Available values for OPTION include:" + echo "" + echo " --help display this help and exit" + echo " --cflags pre-processor and compiler flags" + echo " [-I$includedir @PDC_WIDE@]" + echo " --libs library linking information" + echo " [-L$libdir -lXCurses @LDFLAGS@ @MH_EXTRA_LIBS@" + echo " --libs-static static library linking information (libXCurses only)" + echo " [$libdir/libXCurses.a @LDFLAGS@ @MH_XLIBS@ @MH_EXTRA_LIBS@" + echo " --prefix PDCurses install prefix" + echo " [$prefix]" + echo " --version output version information" + echo " [$verdot]" + exit $1 +} + +if test $# -eq 0; then + usage 1 +fi + +while test $# -gt 0; do + case "$1" in + # this deals with options in the style + # --option=value and extracts the value part + # [not currently used] + -*=*) value=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) value= ;; + esac + + case "$1" in + --prefix) + echo $prefix + ;; + + --version) + echo $verdot + exit 0 + ;; + + --help) + usage 0 + ;; + + --cflags) + echo -I$includedir @PDC_WIDE@ + ;; + + --libs) + echo -L$libdir -lXCurses @LDFLAGS@ @MH_EXTRA_LIBS@ + ;; + + --libs-static) + echo $libdir/libXCurses.a @LDFLAGS@ @MH_XLIBS@ @MH_EXTRA_LIBS@ + ;; + + *) + usage + exit 1 + ;; + esac + shift +done + +exit 0