diff --git a/contrib/sdk/sources/PDCurses/README.md b/contrib/sdk/sources/PDCurses/README.md new file mode 100644 index 0000000000..35d3f63bba --- /dev/null +++ b/contrib/sdk/sources/PDCurses/README.md @@ -0,0 +1,65 @@ +Welcome to PDCurses! +==================== + +PDCurses is an implementation of X/Open curses for multiple platforms. +The latest version can be found at: + + https://pdcurses.org/ + +For changes, see the [History] file. The main documentation is now in +the [docs] directory. + + +Legal Stuff +----------- + +The core package is in the public domain, but small portions of PDCurses +are subject to copyright under various licenses. Each directory +contains a README.md file, with a section titled "Distribution Status" +which describes the status of the files in that directory. + +If you use PDCurses in an application, an acknowledgement would be +appreciated, but is not mandatory. If you make corrections or +enhancements to PDCurses, please forward them to the current maintainer +for the benefit of other users. + +This software is provided AS IS with NO WARRANTY whatsoever. + + +Ports +----- + +PDCurses has been ported to DOS, OS/2, Windows, X11 and SDL. A directory +containing the port-specific source files exists for each of these +platforms. + +Build instructions are in the README.md file for each platform: + +- [DOS] +- [OS/2] +- [SDL 1.x] +- [SDL 2.x] +- [Windows] +- [X11] + + +Distribution Status +------------------- + +All files in this directory (not including subdirectories) are released +to the public domain. + + +Maintainer +---------- + +William McBrine + +[History]: docs/HISTORY.md +[docs]: docs/README.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/contrib/sdk/sources/PDCurses/Tupfile.lua b/contrib/sdk/sources/PDCurses/Tupfile.lua new file mode 100755 index 0000000000..0937a71809 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/Tupfile.lua @@ -0,0 +1,60 @@ +if tup.getconfig("NO_GCC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../../../programs" or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_gcc.lua") +tup.include(HELPERDIR .. "/use_newlib.lua") + +CFLAGS = " -c -fno-ident -O2 -fomit-frame-pointer -fno-ident -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -D_KOLIBRI -DSDL_strlcpy=strncpy " +INCLUDES = INCLUDES .. " -I. " .. "-I ../SDL-1.2.2_newlib/include " + +compile_gcc { + "sdl1/pdcclip.c", + "sdl1/pdcgetsc.c", + "sdl1/pdcscrn.c", + "sdl1/pdcsetsc.c", + "sdl1/pdcdisp.c", + "sdl1/pdckbd.c", + "sdl1/pdcutil.c", + "pdcurses/addstr.c", + "pdcurses/move.c", + "pdcurses/attr.c", + "pdcurses/panel.c", + "pdcurses/initscr.c", + "pdcurses/slk.c", + "pdcurses/inopts.c", + "pdcurses/keyname.c", + "pdcurses/clear.c", + "pdcurses/touch.c", + "pdcurses/refresh.c", + "pdcurses/window.c", + "pdcurses/delch.c", + "pdcurses/beep.c", + "pdcurses/mouse.c", + "pdcurses/inchstr.c", + "pdcurses/overlay.c", + "pdcurses/deleteln.c", + "pdcurses/termattr.c", + "pdcurses/kernel.c", + "pdcurses/inch.c", + "pdcurses/getstr.c", + "pdcurses/getch.c", + "pdcurses/scroll.c", + "pdcurses/border.c", + "pdcurses/scr_dump.c", + "pdcurses/pad.c", + "pdcurses/addch.c", + "pdcurses/insstr.c", + "pdcurses/scanw.c", + "pdcurses/outopts.c", + "pdcurses/insch.c", + "pdcurses/color.c", + "pdcurses/printw.c", + "pdcurses/instr.c", + "pdcurses/bkgd.c", + "pdcurses/getyx.c", + "pdcurses/util.c", + "pdcurses/addchstr.c", + "pdcurses/debug.c", +} + +tup.rule(OBJS, "kos32-ar -rcs %o %f", "../../lib/libcurses.a", OBJS) + diff --git a/contrib/sdk/sources/PDCurses/common/README.md b/contrib/sdk/sources/PDCurses/common/README.md new file mode 100644 index 0000000000..31b542975a --- /dev/null +++ b/contrib/sdk/sources/PDCurses/common/README.md @@ -0,0 +1,11 @@ +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. + + +Distribution Status +------------------- + +The files in this directory are released to the public domain. diff --git a/contrib/sdk/sources/PDCurses/common/acs437.h b/contrib/sdk/sources/PDCurses/common/acs437.h new file mode 100644 index 0000000000..24cbd78549 --- /dev/null +++ b/contrib/sdk/sources/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/contrib/sdk/sources/PDCurses/common/acsgr.h b/contrib/sdk/sources/PDCurses/common/acsgr.h new file mode 100644 index 0000000000..674ddc552f --- /dev/null +++ b/contrib/sdk/sources/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/contrib/sdk/sources/PDCurses/common/acsuni.h b/contrib/sdk/sources/PDCurses/common/acsuni.h new file mode 100644 index 0000000000..2fdad8a1ce --- /dev/null +++ b/contrib/sdk/sources/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/contrib/sdk/sources/PDCurses/common/borland.lrf b/contrib/sdk/sources/PDCurses/common/borland.lrf new file mode 100644 index 0000000000..4d1793d674 --- /dev/null +++ b/contrib/sdk/sources/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/contrib/sdk/sources/PDCurses/common/font437.h b/contrib/sdk/sources/PDCurses/common/font437.h new file mode 100644 index 0000000000..1157953beb --- /dev/null +++ b/contrib/sdk/sources/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, 0xc6, 0xc6, 0xcc, 0xcc, 0xc6, 0xc6, + 0xc6, 0xc6, 0x60, 0x7e, 0xcc, 0x18, 0xc0, 0xcc, 0xfe, 0x7c, 0x7c, + 0x7c, 0x7c, 0xc0, 0xfe, 0xfe, 0xfe, 0x18, 0x18, 0x18, 0xc6, 0xfe, + 0xf0, 0x36, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6, + 0xc0, 0x60, 0x18, 0xde, 0x18, 0xc0, 0xcc, 0xc6, 0x0c, 0x0c, 0x0c, + 0x0c, 0xc6, 0xc6, 0xc6, 0xc6, 0x18, 0x18, 0x18, 0xc6, 0xc6, 0xc0, + 0x36, 0xfe, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6, 0xc0, + 0xf8, 0x3c, 0xcc, 0x7e, 0xc0, 0xcc, 0x7c, 0x78, 0x78, 0x78, 0x78, + 0x7c, 0x7c, 0x7c, 0x7c, 0x38, 0x38, 0x38, 0x6c, 0x6c, 0xc0, 0xec, + 0xcc, 0x7c, 0x7c, 0x7c, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6, 0xc0, 0x60, + 0x66, 0xc4, 0x18, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0xc0, 0x00, 0xcc, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x60, 0x66, + 0xf8, 0x18, 0x3c, 0xcc, 0x30, 0x6c, 0x00, 0x18, 0x38, 0x00, 0x6c, + 0x00, 0x18, 0x00, 0x66, 0x18, 0x10, 0x10, 0xfc, 0x00, 0x6c, 0x6c, + 0x00, 0x18, 0xcc, 0x18, 0x00, 0x7c, 0xc6, 0x7c, 0x62, 0x66, 0xcc, + 0x18, 0x00, 0xcc, 0x18, 0x38, 0xcc, 0x30, 0x6c, 0x00, 0x38, 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, 0x00, 0x00, 0x00, + 0xc0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xf8, 0x78, 0x7c, 0x7c, + 0x30, 0x7c, 0xcc, 0x18, 0x0c, 0xcc, 0x18, 0xc6, 0xcc, 0x78, 0xf8, + 0x7c, 0xc0, 0x7c, 0x30, 0x78, 0x10, 0x6c, 0xc6, 0x76, 0xfe, 0x0e, + 0x18, 0x70, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xc4, 0xcc, 0xc2, 0x30, + 0xcc, 0xcc, 0x18, 0x0c, 0xcc, 0x18, 0xd6, 0xcc, 0xcc, 0xcc, 0xcc, + 0xc0, 0x86, 0x30, 0xcc, 0x6c, 0xfe, 0x6c, 0xce, 0xc0, 0x18, 0x18, + 0x18, 0x00, 0xfe, 0x00, 0xcc, 0xcc, 0xc0, 0xcc, 0xc0, 0x30, 0xcc, + 0xcc, 0x18, 0x0c, 0xd8, 0x18, 0xd6, 0xcc, 0xcc, 0xcc, 0xcc, 0xc0, + 0x06, 0x30, 0xcc, 0xc6, 0xd6, 0x38, 0xc6, 0x60, 0x18, 0x18, 0x18, + 0x00, 0xc6, 0x00, 0xcc, 0xcc, 0xc0, 0xcc, 0xc0, 0x30, 0xcc, 0xcc, + 0x18, 0x0c, 0xf0, 0x18, 0xd6, 0xcc, 0xcc, 0xcc, 0xcc, 0xc0, 0x1c, + 0x30, 0xcc, 0xc6, 0xd6, 0x38, 0xc6, 0x30, 0x18, 0x18, 0x18, 0x00, + 0xc6, 0x00, 0x7c, 0xcc, 0xc0, 0xcc, 0xfe, 0x30, 0xcc, 0xcc, 0x18, + 0x0c, 0xf0, 0x18, 0xd6, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x70, 0x30, + 0xcc, 0xc6, 0xd6, 0x38, 0xc6, 0x18, 0x18, 0x18, 0x18, 0x00, 0xc6, + 0x00, 0x0c, 0xcc, 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, 0xdc, 0xc0, 0xc0, 0x66, 0xc6, 0x18, 0xcc, 0xc6, + 0xc0, 0xc6, 0xc6, 0xc6, 0xc0, 0xde, 0xc6, 0x86, 0x18, 0xc6, 0x38, + 0xee, 0xc6, 0x18, 0xc0, 0x30, 0x06, 0x0c, 0x00, 0x00, 0xdc, 0xc6, + 0xc6, 0xc2, 0xce, 0xc0, 0xc0, 0xc6, 0xc6, 0x18, 0xcc, 0xcc, 0xc0, + 0xc6, 0xc6, 0xc6, 0xc0, 0xd6, 0xcc, 0x06, 0x18, 0xc6, 0x6c, 0xfe, + 0x6c, 0x18, 0xc0, 0x30, 0x0e, 0x0c, 0x00, 0x00, 0xde, 0xc6, 0xc6, + 0xc0, 0xc6, 0xc0, 0xc0, 0xc6, 0xc6, 0x18, 0xcc, 0xd8, 0xc0, 0xc6, + 0xc6, 0xc6, 0xc0, 0xc6, 0xcc, 0x06, 0x18, 0xc6, 0xc6, 0xd6, 0x7c, + 0x18, 0x60, 0x30, 0x1c, 0x0c, 0x00, 0x00, 0xde, 0xfe, 0xc6, 0xc0, + 0xc6, 0xc0, 0xc0, 0xde, 0xc6, 0x18, 0x0c, 0xf0, 0xc0, 0xc6, 0xce, + 0xc6, 0xc0, 0xc6, 0xd8, 0x0c, 0x18, 0xc6, 0xc6, 0xd6, 0x38, 0x18, + 0x30, 0x30, 0x38, 0x0c, 0x00, 0x00, 0xde, 0xc6, 0xfc, 0xc0, 0xc6, + 0xf8, 0xf8, 0xc0, 0xfe, 0x18, 0x0c, 0xf0, 0xc0, 0xd6, 0xde, 0xc6, + 0xfc, 0xc6, 0xfc, 0x38, 0x18, 0xc6, 0xc6, 0xd6, 0x38, 0x3c, 0x18, + 0x30, 0x70, 0x0c, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc0, 0xc6, 0xc0, + 0xc0, 0xc0, 0xc6, 0x18, 0x0c, 0xd8, 0xc0, 0xfe, 0xfe, 0xc6, 0xc6, + 0xc6, 0xc6, 0x60, 0x18, 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/contrib/sdk/sources/PDCurses/common/icon32.xpm b/contrib/sdk/sources/PDCurses/common/icon32.xpm new file mode 100644 index 0000000000..24f64e427c --- /dev/null +++ b/contrib/sdk/sources/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/contrib/sdk/sources/PDCurses/common/icon64.xpm b/contrib/sdk/sources/PDCurses/common/icon64.xpm new file mode 100644 index 0000000000..55e8b59030 --- /dev/null +++ b/contrib/sdk/sources/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/contrib/sdk/sources/PDCurses/common/iconbmp.h b/contrib/sdk/sources/PDCurses/common/iconbmp.h new file mode 100644 index 0000000000..51f6cb11cf --- /dev/null +++ b/contrib/sdk/sources/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/contrib/sdk/sources/PDCurses/common/libobjs.mif b/contrib/sdk/sources/PDCurses/common/libobjs.mif new file mode 100644 index 0000000000..a8f9dc6dfb --- /dev/null +++ b/contrib/sdk/sources/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/contrib/sdk/sources/PDCurses/common/pdcurses.rc b/contrib/sdk/sources/PDCurses/common/pdcurses.rc new file mode 100644 index 0000000000..53d4754de4 --- /dev/null +++ b/contrib/sdk/sources/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/contrib/sdk/sources/PDCurses/common/watcom.mif b/contrib/sdk/sources/PDCurses/common/watcom.mif new file mode 100644 index 0000000000..08f44f3bb3 --- /dev/null +++ b/contrib/sdk/sources/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 +LDFLAGS = op q sys $(TARGET) +!endif + +RM = del +LIBEXE = wlib -q -n -b -c -t + +srcdir = $(PDCURSES_SRCDIR)/pdcurses +demodir = $(PDCURSES_SRCDIR)/demos + +LIBOBJS = 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 + +PDCOBJS = pdcclip.obj pdcdisp.obj pdcgetsc.obj pdckbd.obj pdcscrn.obj & +pdcsetsc.obj pdcutil.obj + +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) *.obj + -$(RM) *.lib + -$(RM) *.exe + -$(RM) *.err + +demos: $(DEMOS) + +.c: $(srcdir);$(osdir);$(demodir) +.c.obj: .autodepend + $(CC) $(CFLAGS) $< + +.obj.exe: + $(LINK) $(LDFLAGS) n $@ f $*.obj l $(LIBCURSES) + +testcurs.exe: testcurs.obj $(LIBCURSES) +ozdemo.exe: ozdemo.obj $(LIBCURSES) +xmas.exe: xmas.obj $(LIBCURSES) +firework.exe: firework.obj $(LIBCURSES) +rain.exe: rain.obj $(LIBCURSES) +worm.exe: worm.obj $(LIBCURSES) +ptest.exe: ptest.obj $(LIBCURSES) + +tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES) + $(LINK) $(LDFLAGS) n $@ f tuidemo.obj f tui.obj l $(LIBCURSES) + +dist: .symbolic diff --git a/contrib/sdk/sources/PDCurses/curses.h b/contrib/sdk/sources/PDCurses/curses.h new file mode 100644 index 0000000000..7a148d4816 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/curses.h @@ -0,0 +1,1417 @@ +/*----------------------------------------------------------------------* + * PDCurses * + *----------------------------------------------------------------------*/ + +#ifndef __PDCURSES__ +#define __PDCURSES__ 1 + +/*man-start************************************************************** + +Define before inclusion (only those needed): + + XCURSES if building / built for X11 + PDC_RGB if you want to use RGB color definitions + (Red = 1, Green = 2, Blue = 4) instead of BGR + PDC_WIDE if building / built with wide-character support + PDC_DLL_BUILD if building / built as a Windows DLL + PDC_NCMOUSE to use the ncurses mouse API instead + of PDCurses' traditional mouse API + +Defined by this header: + + 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 3906 +#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 */ +} 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: + + +--------------------------------------------------------------------+ + |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|..| 2| 1| 0| + +--------------------------------------------------------------------+ + color pair | modifiers | character eg 'a' + +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_keypad(const WINDOW *); +PDCEX bool is_leaveok(const WINDOW *); +PDCEX bool is_pad(const WINDOW *); +PDCEX int set_tabsize(int); +PDCEX int use_default_colors(void); +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/contrib/sdk/sources/PDCurses/curspriv.h b/contrib/sdk/sources/PDCurses/curspriv.h new file mode 100644 index 0000000000..a5d1ac4481 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/curspriv.h @@ -0,0 +1,122 @@ +/* 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 + +#if defined(__TURBOC__) || defined(__EMX__) || defined(__DJGPP__) || \ + defined(PDC_99) || defined(__WATCOMC__) +# ifndef HAVE_VSSCANF +# define HAVE_VSSCANF /* have vsscanf() */ +# endif +#endif + +#if defined(PDC_99) || defined(__WATCOMC__) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF /* 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() */ + +#endif /* __CURSES_INTERNALS__ */ diff --git a/contrib/sdk/sources/PDCurses/demos/Makefile b/contrib/sdk/sources/PDCurses/demos/Makefile new file mode 100755 index 0000000000..cdb4c0e148 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/demos/Makefile @@ -0,0 +1,32 @@ +CC = kos32-gcc +LD = kos32-ld +OBJCOPY = kos32-objcopy +KPACK = kpack + +BIN = xmas + +SDK_DIR = $(abspath ../../../../sdk) + +CFLAGS = -c -fno-ident -O2 -fomit-frame-pointer -fno-ident \ + -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -D_KOLIBRI \ + -DSDL_strlcpy=strncpy -D_GNU_SOURCE=1 -D_REENTRANT -DNDEBUG -Wno-missing-field-initializers \ + +LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds -Map=output.map --image-base 0 --subsystem native + +INCLUDES = -I$(SDK_DIR)/sources/newlib/libc/include -I$(SDK_DIR)/sources/SDL-1.2.2_newlib/include -I.. +LIBPATH = -L$(SDK_DIR)/lib + +OBJS = xmas.o + +LIBS = -lgcc -lcurses -lSDLn -lsound -lc.dll + +$(BIN): $(OBJS) + $(LD) $(LDFLAGS) $(LIBPATH) $(OBJS) -o $(BIN) $(LIBS) + $(OBJCOPY) $(BIN) -O binary + $(KPACK) --nologo $(BIN) + +%.o : %.c + $(CC) $(CFLAGS) $(INCLUDES) -o $@ $< + +clean: + rm src/*.o diff --git a/contrib/sdk/sources/PDCurses/demos/output.map b/contrib/sdk/sources/PDCurses/demos/output.map new file mode 100644 index 0000000000..6cae67e4b4 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/demos/output.map @@ -0,0 +1,1707 @@ +Archive member included to satisfy reference by file (symbol) + +/home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(_start.o) + (_start) +/home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(__main.o) + xmas.o (__main) +/home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(_ctors.o) + /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(__main.o) (__DTOR_LIST__) +/home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(kos32-app.o) + /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(_start.o) (__crt_startup) +/home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(libc-loader.o) + /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(kos32-app.o) (get_entry_point) +/home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(unwind-dw2-fde.o) + /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(__main.o) (__register_frame_info) +/home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(gthr-kos32.o) + /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(unwind-dw2-fde.o) (__gthr_kos32_once) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(addstr.o) + xmas.o (waddstr) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(move.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(addstr.o) (move) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(attr.o) + xmas.o (wattrset) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) + xmas.o (initscr) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(slk.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) (slk_noutrefresh) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(inopts.o) + xmas.o (noecho) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(clear.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) (wclrtobot) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(touch.o) + xmas.o (touchwin) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(refresh.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) (wnoutrefresh) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(window.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(attr.o) (PDC_sync) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(overlay.o) + xmas.o (overlay) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(kernel.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) (def_shell_mode) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(border.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(slk.o) (whline) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pad.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(window.o) (subpad) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(addch.o) + xmas.o (waddch) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(outopts.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(kernel.o) (leaveok) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(color.o) + xmas.o (init_pair) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(printw.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(slk.o) (mvwprintw) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcgetsc.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) (PDC_get_cursor_mode) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) (PDC_scr_close) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcsetsc.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(kernel.o) (PDC_curs_set) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcdisp.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(refresh.o) (PDC_transform_line) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdckbd.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(inopts.o) (PDC_set_keyboard_binary) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcutil.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(kernel.o) (PDC_napms) +/home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(scroll.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(addch.o) (wscrl) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) (SDL_Init) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_error.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) (SDL_GetError) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_fatal.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL.o) (SDL_InstallParachute) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_getenv.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL.o) (SDL_getenv) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_kolibri_audio.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL.o) (SDL_AudioInit) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_events.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcutil.o) (SDL_PumpEvents) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_keyboard.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) (SDL_EnableUNICODE) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_mouse.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_events.o) (SDL_MouseInit) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_quit.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_events.o) (SDL_QuitInit) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_rwops.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) (SDL_RWFromFile) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_sysmutex.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_events.o) (SDL_CreateMutex) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_syssem.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_sysmutex.o) (SDL_CreateSemaphore) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_systhread.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_events.o) (SDL_ThreadID) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_thread.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_events.o) (SDL_CreateThread) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_timer.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_events.o) (SDL_SetTimerThreaded) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_systimer.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL.o) (SDL_StartTicks) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_bmp.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) (SDL_LoadBMP_RW) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_cursor.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdckbd.o) (SDL_ShowCursor) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_pixels.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) (SDL_MapRGB) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_surface.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcdisp.o) (SDL_SetColorKey) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_video.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) (SDL_GetVideoInfo) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_menuetvideo.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_video.o) (mosvideo_bootstrab) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_endian.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_bmp.o) (SDL_ReadLE16) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_active.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_events.o) (SDL_AppActiveInit) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_resize.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_video.o) (SDL_PrivateResize) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_RLEaccel.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_pixels.o) (SDL_UnRLESurface) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_pixels.o) (SDL_CalculateBlit) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_0.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit.o) (SDL_CalculateBlit0) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_1.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit.o) (SDL_CalculateBlit1) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_N.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit.o) (SDL_CalculateBlitN) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_menuetevents.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_menuetvideo.o) (MenuetOS_InitOSKeymap) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(mmx_main.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_N.o) (ConvertMMX) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(mmxp2_32.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_N.o) (ConvertMMXpII32_16RGB565) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(x86_main.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_N.o) (ConvertX86) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(x86p_16.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_N.o) (ConvertX86p16_16BGR565) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(x86p_32.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_N.o) (ConvertX86p32_32BGR888) +/home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_A.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_N.o) (SDL_CalculateAlphaBlit) +/home/max/kolibri-svn/contrib/sdk/lib/libsound.a(init.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_kolibri_audio.o) (InitSound@4) +/home/max/kolibri-svn/contrib/sdk/lib/libsound.a(setbuf.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_kolibri_audio.o) (SetBuffer@16) +/home/max/kolibri-svn/contrib/sdk/lib/libsound.a(sndgetsize.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_kolibri_audio.o) (GetBufferSize@8) +/home/max/kolibri-svn/contrib/sdk/lib/libsound.a(stopbuf.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_kolibri_audio.o) (StopBuffer@4) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000840.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_error.o) (vsprintf) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000839.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(printw.o) (vsnprintf) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000834.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_fatal.o) (vprintf) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000799.o) + /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(gthr-kos32.o) (tls_free) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000798.o) + /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(gthr-kos32.o) (tls_alloc) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000765.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_error.o) (strncpy) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000764.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_getenv.o) (strncmp) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000760.o) + /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(unwind-dw2-fde.o) (strlen) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000752.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_getenv.o) (strcpy) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000735.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) (sprintf) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000687.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_getenv.o) (realloc) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000635.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(refresh.o) (memcpy) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000634.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_pixels.o) (memcmp) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000621.o) + /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(unwind-dw2-fde.o) (malloc) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000519.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(color.o) (getenv) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000502.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) (fwrite) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000497.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_rwops.o) (ftell) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000493.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_rwops.o) (fseek) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000488.o) + /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(unwind-dw2-fde.o) (free) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000486.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_rwops.o) (fread) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000476.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) (fprintf) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000474.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_rwops.o) (fopen) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000431.o) + /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_rwops.o) (fclose) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000419.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) (exit) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000368.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) (calloc) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000360.o) + /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) (atoi) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000358.o) + /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(__main.o) (atexit) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000334.o) + /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(unwind-dw2-fde.o) (abort) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000000.o) + /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000840.o) (_head_libc_dll) +/home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000903.o) + /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000000.o) (libc_dll_iname) + +Allocating common symbols +Common symbol size file + +__DTOR_LIST__ 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(_ctors.o) +lookdeer3 0x4 xmas.o +bigdeer0 0x4 xmas.o +ttytype 0x80 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) +SDL_ProcessEvents 0x20 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_events.o) +bigdeer2 0x4 xmas.o +w_holiday 0x4 xmas.o +middeer0 0x4 xmas.o +pdc_own_screen 0x1 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) +treescrn4 0x4 xmas.o +pdc_fwidth 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) +middeer2 0x4 xmas.o +lildeer1 0x4 xmas.o +treescrn8 0x4 xmas.o +bigdeer3 0x4 xmas.o +linesripped 0x28 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(kernel.o) +x_pos 0x4 xmas.o +pdc_color 0xc00 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) +lildeer2 0x4 xmas.o +lookdeer4 0x4 xmas.o +bigdeer4 0x4 xmas.o +middeer3 0x4 xmas.o +__CTOR_LIST__ 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(_ctors.o) +pdc_flastc 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) +lildeer3 0x4 xmas.o +lildeer0 0x4 xmas.o +treescrn5 0x4 xmas.o +y_pos 0x4 xmas.o +treescrn2 0x4 xmas.o +treescrn3 0x4 xmas.o +pdc_mapped 0xc00 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) +lookdeer2 0x4 xmas.o +pdc_fthick 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) +treescrn 0x4 xmas.o +SDL_alarm_callback 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_timer.o) +bigdeer1 0x4 xmas.o +dotdeer0 0x4 xmas.o +treescrn7 0x4 xmas.o +middeer1 0x4 xmas.o +SDL_KeyRepeat 0x24 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_keyboard.o) +w_del_msg 0x4 xmas.o +lookdeer0 0x4 xmas.o +stardeer0 0x4 xmas.o +pdc_fheight 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) +treescrn6 0x4 xmas.o +lookdeer1 0x4 xmas.o +Mouse_status 0x14 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) + +Discarded input sections + + .drectve 0x0000000000000000 0x32c xmas.o + .drectve 0x0000000000000000 0x3c /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(_ctors.o) + .drectve 0x0000000000000000 0x38 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) + .drectve 0x0000000000000000 0x1c /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(kernel.o) + .drectve 0x0000000000000000 0xa4 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) + .drectve 0x0000000000000000 0x24 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_events.o) + .drectve 0x0000000000000000 0x20 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_keyboard.o) + .drectve 0x0000000000000000 0x24 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_timer.o) + +Memory Configuration + +Name Origin Length Attributes +*default* 0x0000000000000000 0xffffffffffffffff + +Linker script and memory map + + 0x0000000000000000 __image_base__ = 0x0 + 0x0000000000000000 __dll__ = 0x0 + 0x0000000000000000 ___ImageBase = 0x0 + 0x0000000000001000 __section_alignment__ = 0x1000 + 0x0000000000000200 __file_alignment__ = 0x200 + 0x0000000000000004 __major_os_version__ = 0x4 + 0x0000000000000000 __minor_os_version__ = 0x0 + 0x0000000000000001 __major_image_version__ = 0x1 + 0x0000000000000000 __minor_image_version__ = 0x0 + 0x0000000000000004 __major_subsystem_version__ = 0x4 + 0x0000000000000000 __minor_subsystem_version__ = 0x0 + 0x0000000000000001 __subsystem__ = 0x1 + 0x0000000000200000 __size_of_stack_reserve__ = 0x200000 + 0x0000000000001000 __size_of_stack_commit__ = 0x1000 + 0x0000000000100000 __size_of_heap_reserve__ = 0x100000 + 0x0000000000001000 __size_of_heap_commit__ = 0x1000 + 0x0000000000000000 __loader_flags__ = 0x0 + 0x0000000000000000 __dll_characteristics__ = 0x0 + +.text 0x0000000000000000 0x25200 + 0x0000000000000000 0x4 LONG 0x554e454d + 0x0000000000000004 0x4 LONG 0x32305445 + 0x0000000000000008 0x4 LONG 0x1 + 0x000000000000000c 0x4 LONG 0x34 __start + 0x0000000000000010 0x4 LONG 0x2a6ab ___iend + 0x0000000000000014 0x4 LONG 0x3dd40 ___memsize + 0x0000000000000018 0x4 LONG 0x3dd40 ___stacktop + 0x000000000000001c 0x4 LONG 0x3d830 ___cmdline + 0x0000000000000020 0x4 LONG 0x3d930 ___pgmname + 0x0000000000000024 0x4 LONG 0x1 __subsystem__ + 0x0000000000000028 0x4 LONG 0x2e960 __idata_start + 0x000000000000002c 0x4 LONG 0x2ec1c __idata_end + 0x0000000000000030 0x4 LONG 0x24180 _main + *(.init) + .init 0x0000000000000034 0x84 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(_start.o) + 0x0000000000000034 _start + *(.text) + *fill* 0x00000000000000b8 0x8 + .text 0x00000000000000c0 0x2880 xmas.o + 0x00000000000000c0 lil + 0x0000000000000130 midtop + 0x0000000000000180 bigtop + 0x00000000000002b0 bigface + 0x00000000000003b0 legs1 + 0x0000000000000440 legs2 + 0x00000000000004d0 legs3 + 0x0000000000000560 legs4 + 0x00000000000005d0 initdeer + 0x0000000000000b50 boxit + 0x0000000000000bd0 seas + 0x0000000000000cc0 greet + 0x0000000000000dd0 fromwho + 0x0000000000000e00 del_msg + 0x0000000000000e10 tree + 0x0000000000001330 balls + 0x0000000000001710 star + 0x0000000000001760 strng1 + 0x00000000000017e0 strng2 + 0x0000000000001890 strng3 + 0x0000000000001940 strng4 + 0x0000000000001a30 strng5 + 0x0000000000001af0 blinkit + 0x0000000000001c30 reindeer + .text 0x0000000000002940 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(_start.o) + .text 0x0000000000002940 0xe0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(__main.o) + 0x0000000000002940 __do_global_dtors + 0x0000000000002990 __do_global_ctors + 0x0000000000002a00 __main + .text 0x0000000000002a20 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(_ctors.o) + .text 0x0000000000002a20 0x30 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(kos32-app.o) + 0x0000000000002a20 __crt_startup + .text 0x0000000000002a50 0x240 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(libc-loader.o) + 0x0000000000002a50 get_entry_point + 0x0000000000002a60 load_libc + .text 0x0000000000002c90 0x13e0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(unwind-dw2-fde.o) + 0x0000000000003c60 __register_frame_info_bases + 0x0000000000003c90 __register_frame_info + 0x0000000000003cc0 __register_frame + 0x0000000000003d00 __register_frame_info_table_bases + 0x0000000000003d80 __register_frame_info_table + 0x0000000000003db0 __register_frame_table + 0x0000000000003df0 __deregister_frame_info_bases + 0x0000000000003ee0 __deregister_frame_info + 0x0000000000003ef0 __deregister_frame + 0x0000000000003f20 _Unwind_Find_FDE + .text 0x0000000000004070 0x350 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(gthr-kos32.o) + 0x0000000000004070 __gthr_kos32_once + 0x00000000000040e0 __gthr_kos32_key_create + 0x0000000000004110 __gthr_kos32_key_delete + 0x0000000000004120 __gthr_kos32_getspecific + 0x0000000000004140 __gthr_kos32_setspecific + 0x0000000000004160 __gthr_kos32_mutex_init_function + 0x0000000000004180 __gthr_kos32_mutex_destroy + 0x00000000000041a0 __gthr_kos32_mutex_lock + 0x00000000000041e0 __gthr_kos32_mutex_trylock + 0x0000000000004210 __gthr_kos32_mutex_unlock + 0x0000000000004240 __gthr_kos32_recursive_mutex_init_function + 0x0000000000004270 __gthr_kos32_recursive_mutex_lock + 0x00000000000042f0 __gthr_kos32_recursive_mutex_trylock + 0x0000000000004350 __gthr_kos32_recursive_mutex_unlock + 0x00000000000043a0 __gthr_kos32_recursive_mutex_destroy + .text 0x00000000000043c0 0x250 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(addstr.o) + 0x00000000000043c0 waddnstr + 0x0000000000004430 addstr + 0x0000000000004460 addnstr + 0x0000000000004490 waddstr + 0x00000000000044c0 mvaddstr + 0x0000000000004510 mvaddnstr + 0x0000000000004560 mvwaddstr + 0x00000000000045b0 mvwaddnstr + .text 0x0000000000004610 0x110 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(move.o) + 0x0000000000004610 move + 0x0000000000004660 mvcur + 0x00000000000046d0 wmove + .text 0x0000000000004720 0x6b0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(attr.o) + 0x0000000000004720 wattroff + 0x0000000000004750 attroff + 0x0000000000004780 wattron + 0x00000000000047e0 attron + 0x0000000000004840 wattrset + 0x0000000000004860 attrset + 0x0000000000004880 standend + 0x00000000000048a0 standout + 0x00000000000048c0 wstandend + 0x00000000000048e0 wstandout + 0x0000000000004900 getattrs + 0x0000000000004920 wcolor_set + 0x0000000000004940 color_set + 0x0000000000004960 wattr_get + 0x00000000000049a0 attr_get + 0x00000000000049e0 wattr_off + 0x0000000000004a10 attr_off + 0x0000000000004a40 wattr_on + 0x0000000000004aa0 attr_on + 0x0000000000004b00 wattr_set + 0x0000000000004b30 attr_set + 0x0000000000004b60 wchgat + 0x0000000000004c30 chgat + 0x0000000000004c70 mvchgat + 0x0000000000004ce0 mvwchgat + 0x0000000000004d50 underend + 0x0000000000004d70 wunderend + 0x0000000000004d90 underscore + 0x0000000000004db0 wunderscore + .text 0x0000000000004dd0 0x860 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) + 0x0000000000004dd0 initscr + 0x00000000000052b0 endwin + 0x00000000000052d0 isendwin + 0x00000000000052f0 newterm + 0x0000000000005310 set_term + 0x0000000000005330 delscreen + 0x0000000000005400 resize_term + 0x00000000000055c0 is_termresized + 0x00000000000055d0 curses_version + 0x00000000000055e0 PDC_get_version + 0x0000000000005610 set_tabsize + .text 0x0000000000005630 0xa70 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(slk.o) + 0x0000000000005750 slk_init + 0x0000000000005810 slk_set + 0x0000000000005990 slk_refresh + 0x00000000000059d0 slk_noutrefresh + 0x0000000000005a00 slk_label + 0x0000000000005a50 slk_clear + 0x0000000000005a90 slk_restore + 0x0000000000005ad0 slk_touch + 0x0000000000005b00 slk_attron + 0x0000000000005b40 slk_attr_on + 0x0000000000005b50 slk_attroff + 0x0000000000005b90 slk_attr_off + 0x0000000000005ba0 slk_attrset + 0x0000000000005be0 slk_color + 0x0000000000005c30 slk_attr_set + 0x0000000000005c50 PDC_slk_initialize + 0x0000000000005fb0 PDC_slk_free + 0x0000000000006030 PDC_mouse_in_slk + .text 0x00000000000060a0 0x2e0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(inopts.o) + 0x00000000000060a0 echo + 0x00000000000060c0 noecho + 0x00000000000060e0 halfdelay + 0x0000000000006110 intrflush + 0x0000000000006120 keypad + 0x0000000000006140 meta + 0x0000000000006160 nl + 0x0000000000006180 nonl + 0x00000000000061a0 nodelay + 0x00000000000061c0 notimeout + 0x00000000000061d0 raw + 0x0000000000006210 noraw + 0x0000000000006250 noqiflush + 0x0000000000006260 qiflush + 0x0000000000006270 typeahead + 0x0000000000006280 wtimeout + 0x00000000000062c0 timeout + 0x0000000000006300 crmode + 0x0000000000006320 cbreak + 0x0000000000006330 nocrmode + 0x0000000000006350 nocbreak + 0x0000000000006360 is_keypad + .text 0x0000000000006380 0x1f0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(clear.o) + 0x0000000000006380 wclrtoeol + 0x0000000000006420 clrtoeol + 0x0000000000006440 wclrtobot + 0x00000000000064a0 clrtobot + 0x00000000000064c0 werase + 0x0000000000006500 erase + 0x0000000000006520 wclear + 0x0000000000006540 clear + .text 0x0000000000006570 0x2a0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(touch.o) + 0x0000000000006570 touchwin + 0x00000000000065c0 touchline + 0x0000000000006620 untouchwin + 0x0000000000006670 wtouchln + 0x0000000000006700 is_linetouched + 0x0000000000006730 is_wintouched + 0x0000000000006770 touchoverlap + .text 0x0000000000006810 0x630 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(refresh.o) + 0x0000000000006810 wnoutrefresh + 0x0000000000006a80 doupdate + 0x0000000000006d00 wrefresh + 0x0000000000006d70 refresh + 0x0000000000006d90 wredrawln + 0x0000000000006df0 redrawwin + .text 0x0000000000006e40 0xae0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(window.o) + 0x0000000000006e40 PDC_makenew + 0x0000000000006f50 PDC_makelines + 0x0000000000007010 PDC_sync + 0x0000000000007050 newwin + 0x00000000000070e0 delwin + 0x0000000000007170 mvwin + 0x00000000000071d0 subwin + 0x0000000000007320 derwin + 0x0000000000007340 mvderwin + 0x0000000000007410 dupwin + 0x0000000000007590 resize_window + 0x0000000000007820 wresize + 0x0000000000007850 wsyncup + 0x0000000000007880 syncok + 0x00000000000078a0 wcursyncup + 0x00000000000078e0 wsyncdown + .text 0x0000000000007920 0x3e0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(overlay.o) + 0x0000000000007ab0 _copy_overlap + 0x0000000000007bc0 overlay + 0x0000000000007bf0 overwrite + 0x0000000000007c20 copywin + .text 0x0000000000007d00 0x3f0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(kernel.o) + 0x0000000000007e40 def_shell_mode + 0x0000000000007e70 resetty + 0x0000000000007e90 savetty + 0x0000000000007ec0 curs_set + 0x0000000000007f30 napms + 0x0000000000007fd0 ripoffline + 0x0000000000008020 draino + 0x0000000000008030 resetterm + 0x0000000000008060 reset_shell_mode + 0x0000000000008070 fixterm + 0x00000000000080a0 reset_prog_mode + 0x00000000000080b0 saveterm + 0x00000000000080e0 def_prog_mode + .text 0x00000000000080f0 0x980 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(border.o) + 0x00000000000080f0 wborder + 0x00000000000085b0 border + 0x0000000000008610 box + 0x0000000000008660 whline + 0x0000000000008760 hline + 0x0000000000008790 mvhline + 0x00000000000087e0 mvwhline + 0x0000000000008840 wvline + 0x0000000000008990 vline + 0x00000000000089c0 mvvline + 0x0000000000008a10 mvwvline + .text 0x0000000000008a70 0x530 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pad.o) + 0x0000000000008a70 newpad + 0x0000000000008b20 subpad + 0x0000000000008c90 pnoutrefresh + 0x0000000000008eb0 prefresh + 0x0000000000008f00 pechochar + 0x0000000000008f80 is_pad + .text 0x0000000000008fa0 0x560 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(addch.o) + 0x0000000000008fa0 waddch + 0x0000000000009280 addch + 0x00000000000092a0 mvaddch + 0x00000000000092f0 mvwaddch + 0x0000000000009340 wechochar + 0x0000000000009380 echochar + 0x00000000000093a0 waddrawch + 0x00000000000093e0 addrawch + 0x0000000000009430 mvaddrawch + 0x0000000000009490 mvwaddrawch + .text 0x0000000000009500 0x180 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(outopts.o) + 0x0000000000009500 clearok + 0x0000000000009520 idlok + 0x0000000000009530 idcok + 0x0000000000009540 immedok + 0x0000000000009560 leaveok + 0x00000000000095a0 setscrreg + 0x00000000000095e0 wsetscrreg + 0x0000000000009620 scrollok + 0x0000000000009640 raw_output + 0x0000000000009660 is_leaveok + .text 0x0000000000009680 0x620 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(color.o) + 0x0000000000009750 init_pair + 0x00000000000097c0 has_colors + 0x00000000000097e0 init_color + 0x0000000000009880 color_content + 0x0000000000009940 can_change_color + 0x0000000000009950 pair_content + 0x00000000000099a0 assume_default_colors + 0x0000000000009a00 use_default_colors + 0x0000000000009a30 PDC_set_line_color + 0x0000000000009a70 PDC_init_atrtab + 0x0000000000009af0 start_color + 0x0000000000009b60 free_pair + 0x0000000000009ba0 find_pair + 0x0000000000009bf0 alloc_pair + .text 0x0000000000009ca0 0x160 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(printw.o) + 0x0000000000009ca0 vwprintw + 0x0000000000009d00 printw + 0x0000000000009d30 wprintw + 0x0000000000009d60 mvprintw + 0x0000000000009da0 mvwprintw + 0x0000000000009df0 vw_printw + .text 0x0000000000009e00 0x30 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcgetsc.o) + 0x0000000000009e00 PDC_get_cursor_mode + 0x0000000000009e10 PDC_get_rows + 0x0000000000009e20 PDC_get_columns + .text 0x0000000000009e30 0xa40 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) + 0x0000000000009e70 PDC_retile + 0x0000000000009f50 PDC_scr_close + 0x0000000000009f60 PDC_scr_free + 0x0000000000009f70 PDC_scr_open + 0x000000000000a5f0 PDC_resize_screen + 0x000000000000a6c0 PDC_reset_prog_mode + 0x000000000000a6e0 PDC_reset_shell_mode + 0x000000000000a700 PDC_restore_screen_mode + 0x000000000000a710 PDC_save_screen_mode + 0x000000000000a720 PDC_can_change_color + 0x000000000000a730 PDC_color_content + 0x000000000000a7b0 PDC_init_color + .text 0x000000000000a870 0x100 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcsetsc.o) + 0x000000000000a870 PDC_curs_set + 0x000000000000a8a0 PDC_set_title + 0x000000000000a8c0 PDC_set_blink + 0x000000000000a950 PDC_set_bold + .text 0x000000000000a970 0x9b0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcdisp.o) + 0x000000000000ab30 PDC_update_rects + 0x000000000000ab80 _new_packet + 0x000000000000af70 PDC_transform_line + 0x000000000000b030 PDC_gotoyx + 0x000000000000b1e0 PDC_blink_text + 0x000000000000b300 PDC_doupdate + .text 0x000000000000b320 0x670 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdckbd.o) + 0x000000000000b320 PDC_set_keyboard_binary + 0x000000000000b330 PDC_check_key + 0x000000000000b350 PDC_get_key + 0x000000000000b920 PDC_flushinp + 0x000000000000b940 PDC_has_mouse + 0x000000000000b950 PDC_mouse_set + 0x000000000000b980 PDC_modifiers_set + .text 0x000000000000b990 0x60 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcutil.o) + 0x000000000000b990 PDC_beep + 0x000000000000b9a0 PDC_napms + 0x000000000000b9e0 PDC_sysname + .text 0x000000000000b9f0 0x1b0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(scroll.o) + 0x000000000000b9f0 wscrl + 0x000000000000bb60 scrl + 0x000000000000bb80 scroll + .text 0x000000000000bba0 0x168 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL.o) + 0x000000000000bba0 SDL_InitSubSystem + 0x000000000000bc62 SDL_Init + 0x000000000000bc8f SDL_QuitSubSystem + 0x000000000000bcdb SDL_WasInit + 0x000000000000bcef SDL_Quit + 0x000000000000bcff SDL_Linked_Version + .text 0x000000000000bd08 0x4bc /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_error.o) + 0x000000000000bd08 SDL_printf + 0x000000000000bd52 SDL_GetErrorMsgUNICODE + 0x000000000000bfe7 SDL_GetErrorMsg + 0x000000000000c03e SDL_GetError + 0x000000000000c050 SDL_SetError + 0x000000000000c16f SDL_ClearError + 0x000000000000c17a SDL_Error + .text 0x000000000000c1c4 0x18 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_fatal.o) + 0x000000000000c1c4 SDL_printf_error + 0x000000000000c1d9 SDL_InstallParachute + 0x000000000000c1da SDL_UninstallParachute + .text 0x000000000000c1dc 0x13c /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_getenv.o) + 0x000000000000c1dc SDL_putenv + 0x000000000000c2b8 SDL_getenv + .text 0x000000000000c318 0xa84 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_kolibri_audio.o) + 0x000000000000c531 SDL_AudioInit + 0x000000000000c570 SDL_AudioQuit + 0x000000000000c571 SDL_AudioDriverName + 0x000000000000c597 SDL_OpenAudio + 0x000000000000ccd5 SDL_CloseAudio + 0x000000000000cd23 SDL_PauseAudio + 0x000000000000cd62 SDL_LockAudio + 0x000000000000cd90 SDL_UnlockAudio + .text 0x000000000000cd9c 0x5f0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_events.o) + 0x000000000000ce26 SDL_Lock_EventThread + 0x000000000000ce5b SDL_Unlock_EventThread + 0x000000000000ce7e SDL_EventThreadID + 0x000000000000ce84 SDL_StopEventLoop + 0x000000000000cee2 SDL_StartEventLoop + 0x000000000000cfcb SDL_PeepEvents + 0x000000000000d1fa SDL_PumpEvents + 0x000000000000d21a SDL_PollEvent + 0x000000000000d232 SDL_WaitEvent + 0x000000000000d263 SDL_PushEvent + 0x000000000000d276 SDL_SetEventFilter + 0x000000000000d291 SDL_GetEventFilter + 0x000000000000d297 SDL_EventState + 0x000000000000d339 SDL_PrivateSysWMEvent + .text 0x000000000000d38c 0xc0c /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_keyboard.o) + 0x000000000000d38c SDL_EnableUNICODE + 0x000000000000d3a0 SDL_GetKeyState + 0x000000000000d3b4 SDL_GetModState + 0x000000000000d3ba SDL_SetModState + 0x000000000000d3c4 SDL_GetKeyName + 0x000000000000d3e6 SDL_PrivateKeyboard + 0x000000000000d5b5 SDL_ResetKeyboard + 0x000000000000d5fb SDL_CheckKeyRepeat + 0x000000000000d5fc SDL_EnableKeyRepeat + 0x000000000000d643 SDL_KeyboardInit + .text 0x000000000000df98 0x3dc /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_mouse.o) + 0x000000000000dfdb SDL_MouseInit + 0x000000000000e009 SDL_GetMouseState + 0x000000000000e031 SDL_GetRelativeMouseState + 0x000000000000e06b SDL_PrivateMouseMotion + 0x000000000000e1fa SDL_PrivateMouseButton + .text 0x000000000000e374 0x3c /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_quit.o) + 0x000000000000e374 SDL_QuitInit + 0x000000000000e377 SDL_PrivateQuit + .text 0x000000000000e3b0 0x27c /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_rwops.o) + 0x000000000000e568 SDL_AllocRW + 0x000000000000e585 SDL_RWFromFP + 0x000000000000e5b8 SDL_RWFromFile + 0x000000000000e5ed SDL_RWFromMem + 0x000000000000e625 SDL_FreeRW + .text 0x000000000000e62c 0x6c /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_sysmutex.o) + 0x000000000000e62c SDL_CreateMutex + 0x000000000000e66e SDL_DestroyMutex + 0x000000000000e691 SDL_mutexP + 0x000000000000e694 SDL_mutexV + .text 0x000000000000e698 0x50 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_syssem.o) + 0x000000000000e698 SDL_CreateSemaphore + 0x000000000000e6a6 SDL_DestroySemaphore + 0x000000000000e6a7 SDL_SemTryWait + 0x000000000000e6b6 SDL_SemWaitTimeout + 0x000000000000e6c5 SDL_SemWait + 0x000000000000e6d4 SDL_SemValue + 0x000000000000e6d7 SDL_SemPost + .text 0x000000000000e6e8 0x18 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_systhread.o) + 0x000000000000e6e8 SDL_SYS_CreateThread + 0x000000000000e6f7 SDL_SYS_SetupThread + 0x000000000000e6f8 SDL_ThreadID + 0x000000000000e6fb SDL_SYS_WaitThread + 0x000000000000e6fc SDL_SYS_KillThread + .text 0x000000000000e700 0x300 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_thread.o) + 0x000000000000e73f SDL_ThreadsInit + 0x000000000000e768 SDL_ThreadsQuit + 0x000000000000e783 SDL_GetErrBuf + 0x000000000000e7dd SDL_RunThread + 0x000000000000e811 SDL_CreateThread + 0x000000000000e990 SDL_WaitThread + 0x000000000000e9d3 SDL_GetThreadID + 0x000000000000e9e3 SDL_KillThread + .text 0x000000000000ea00 0x368 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_timer.o) + 0x000000000000ea06 SDL_SetTimerThreaded + 0x000000000000ea2a SDL_ThreadedTimerCheck + 0x000000000000eb0f SDL_AddTimer + 0x000000000000ebc3 SDL_RemoveTimer + 0x000000000000ec2b SDL_SetTimer + 0x000000000000ecdc SDL_TimerInit + 0x000000000000ed25 SDL_TimerQuit + .text 0x000000000000ed68 0x5c /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_systimer.o) + 0x000000000000ed68 SDL_StartTicks + 0x000000000000ed7c SDL_GetTicks + 0x000000000000ed94 SDL_Delay + 0x000000000000edb9 SDL_SYS_TimerInit + 0x000000000000edbc SDL_SYS_TimerQuit + 0x000000000000edbd SDL_SYS_StartTimer + 0x000000000000edc0 SDL_SYS_StopTimer + .text 0x000000000000edc4 0x7ec /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_bmp.o) + 0x000000000000edc4 SDL_LoadBMP_RW + 0x000000000000f23d SDL_SaveBMP_RW + .text 0x000000000000f5b0 0xe5c /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_cursor.o) + 0x000000000000f5b0 SDL_GetCursor + 0x000000000000f5b6 SDL_WarpMouse + 0x000000000000f618 SDL_CursorPaletteChanged + 0x000000000000f623 SDL_MouseRect + 0x000000000000f6aa SDL_DrawCursorNoLock + 0x000000000000fcce SDL_DrawCursor + 0x000000000000fd44 SDL_EraseCursorNoLock + 0x000000000000fe86 SDL_EraseCursor + 0x000000000000fefc SDL_SetCursor + 0x000000000001004c SDL_FreeCursor + 0x00000000000100b7 SDL_CursorQuit + 0x000000000001011d SDL_CreateCursor + 0x000000000001028b SDL_CursorInit + 0x00000000000102d7 SDL_ShowCursor + 0x0000000000010351 SDL_MoveCursor + 0x00000000000103dc SDL_ResetCursor + .text 0x000000000001040c 0xb84 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_pixels.o) + 0x000000000001046f SDL_FreeFormat + 0x00000000000104a0 SDL_AllocFormat + 0x000000000001074c SDL_DitherColors + 0x000000000001075d SDL_CalculatePitch + 0x0000000000010791 SDL_FindColor + 0x00000000000108d7 SDL_MapRGB + 0x0000000000010931 SDL_MapRGBA + 0x00000000000109a4 SDL_GetRGBA + 0x0000000000010a8e SDL_GetRGB + 0x0000000000010b3e SDL_ApplyGamma + 0x0000000000010b91 SDL_InvalidateMap + 0x0000000000010bbe SDL_FormatChanged + 0x0000000000010bce SDL_ReallocFormat + 0x0000000000010c09 SDL_MapSurface + 0x0000000000010f0b SDL_FreeBlitMap + 0x0000000000010f35 SDL_AllocBlitMap + .text 0x0000000000010f90 0xbe0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_surface.o) + 0x0000000000011005 SDL_SetColorKey + 0x00000000000110c8 SDL_SetAlpha + 0x00000000000111d7 SDL_SetClipRect + 0x000000000001122f SDL_GetClipRect + 0x000000000001124b SDL_LowerBlit + 0x00000000000112ac SDL_UpperBlit + 0x000000000001144c SDL_LockSurface + 0x000000000001149a SDL_UnlockSurface + 0x00000000000114dc SDL_FillRect + 0x00000000000116dc SDL_FreeSurface + 0x0000000000011780 SDL_CreateRGBSurface + 0x0000000000011920 SDL_CreateRGBSurfaceFrom + 0x000000000001197a SDL_ConvertSurface + .text 0x0000000000011b70 0x16b8 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_video.o) + 0x0000000000011ba3 SDL_VideoDriverName + 0x0000000000011bd2 SDL_GetVideoSurface + 0x0000000000011be5 SDL_GetVideoInfo + 0x0000000000011bf5 SDL_ListModes + 0x0000000000011c21 SDL_VideoModeOK + 0x0000000000011cf1 SDL_DisplayFormat + 0x0000000000011d38 SDL_DisplayFormatAlpha + 0x0000000000011e23 SDL_UpdateRects + 0x0000000000011fdf SDL_UpdateRect + 0x000000000001218b SDL_Flip + 0x0000000000012254 SDL_SetPalette + 0x00000000000123a4 SDL_SetColors + 0x00000000000123bf SDL_GL_LoadLibrary + 0x00000000000123e8 SDL_GL_GetProcAddress + 0x000000000001241c SDL_GL_SetAttribute + 0x00000000000124a5 SDL_GL_GetAttribute + 0x00000000000124d7 SDL_GL_SwapBuffers + 0x00000000000124ed SDL_GL_UpdateRectsLock + 0x00000000000124ee SDL_GL_UpdateRects + 0x00000000000124ef SDL_GL_Lock + 0x00000000000124f0 SDL_GL_Unlock + 0x00000000000124f1 SDL_WM_SetCaption + 0x00000000000125aa SDL_WM_GetCaption + 0x00000000000125d6 SDL_WM_SetIcon + 0x00000000000127c9 SDL_WM_GrabInput + 0x000000000001280f SDL_SetVideoMode + 0x0000000000012de2 SDL_VideoQuit + 0x0000000000012f16 SDL_VideoInit + 0x000000000001315b SDL_WM_IconifyWindow + 0x0000000000013172 SDL_WM_ToggleFullScreen + 0x0000000000013205 SDL_GetWMInfo + .text 0x0000000000013228 0x638 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_menuetvideo.o) + 0x0000000000013230 MenuetOS_SetColors + 0x0000000000013233 MenuetOS_SetCaption + 0x00000000000132b6 KolibriOS_FreeWMCursor + 0x00000000000132df KolibriOS_ShowWMCursor + 0x00000000000134d8 MenuetOS_VideoQuit + 0x0000000000013573 KolibriOS_CheckMouseMode + 0x0000000000013586 KolibriOS_CreateWMCursor + 0x0000000000013689 MenuetOS_SDL_RepaintWnd + 0x000000000001371c MenuetOS_SetVideoMode + 0x000000000001385d MenuetOS_FinalQuit + .text 0x0000000000013860 0x184 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_endian.o) + 0x0000000000013863 SDL_ReadLE16 + 0x000000000001387e SDL_ReadBE16 + 0x000000000001389b SDL_ReadLE32 + 0x00000000000138b5 SDL_ReadBE32 + 0x00000000000138d0 SDL_ReadLE64 + 0x00000000000138f3 SDL_ReadBE64 + 0x0000000000013924 SDL_WriteLE16 + 0x0000000000013942 SDL_WriteBE16 + 0x0000000000013962 SDL_WriteLE32 + 0x0000000000013977 SDL_WriteBE32 + 0x0000000000013999 SDL_WriteLE64 + 0x00000000000139ae SDL_WriteBE64 + .text 0x00000000000139e4 0xb0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_active.o) + 0x00000000000139e4 SDL_AppActiveInit + 0x00000000000139ee SDL_GetAppState + 0x00000000000139f4 SDL_PrivateAppActive + .text 0x0000000000013a94 0xac /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_resize.o) + 0x0000000000013a94 SDL_PrivateResize + .text 0x0000000000013b40 0x3b38 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_RLEaccel.o) + 0x0000000000013ff0 SDL_RLEBlit + 0x00000000000162b2 SDL_RLEAlphaBlit + 0x0000000000016be0 SDL_UnRLESurface + 0x0000000000016dc1 SDL_RLESurface + .text 0x0000000000017678 0x4c4 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit.o) + 0x0000000000017981 SDL_CalculateBlit + .text 0x0000000000017b3c 0xb68 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_0.o) + 0x000000000001863b SDL_CalculateBlit0 + .text 0x00000000000186a4 0x20a0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_1.o) + 0x000000000001a6dc SDL_CalculateBlit1 + .text 0x000000000001a744 0x4474 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_N.o) + 0x000000000001ea3c SDL_CalculateBlitN + .text 0x000000000001ebb8 0x290 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_menuetevents.o) + 0x000000000001ebb8 MenuetOS_InitOSKeymap + 0x000000000001ebcc MenuetOS_PumpEvents + .text 0x000000000001ee48 0x2b /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(mmx_main.o) + 0x000000000001ee48 ConvertMMX + 0x000000000001ee48 ConvertMMX + *fill* 0x000000000001ee73 0x1 + .text 0x000000000001ee74 0x34c /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(mmxp2_32.o) + 0x000000000001ee74 ConvertMMXpII32_24RGB888 + 0x000000000001ee74 ConvertMMXpII32_24RGB888 + 0x000000000001eeff ConvertMMXpII32_16RGB565 + 0x000000000001eeff ConvertMMXpII32_16RGB565 + 0x000000000001efb6 ConvertMMXpII32_16BGR565 + 0x000000000001efb6 ConvertMMXpII32_16BGR565 + 0x000000000001f073 ConvertMMXpII32_16BGR555 + 0x000000000001f073 ConvertMMXpII32_16BGR555 + 0x000000000001f083 ConvertMMXpII32_16RGB555 + 0x000000000001f083 ConvertMMXpII32_16RGB555 + .text 0x000000000001f1c0 0x60 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(x86_main.o) + 0x000000000001f1c0 ConvertX86 + 0x000000000001f1c0 ConvertX86 + 0x000000000001f1e9 Hermes_X86_CPU + 0x000000000001f1e9 Hermes_X86_CPU + .text 0x000000000001f220 0x35d /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(x86p_16.o) + 0x000000000001f220 ConvertX86p16_16BGR565 + 0x000000000001f220 ConvertX86p16_16BGR565 + 0x000000000001f2e9 ConvertX86p16_16RGB555 + 0x000000000001f2e9 ConvertX86p16_16RGB555 + 0x000000000001f3a5 ConvertX86p16_16BGR555 + 0x000000000001f3a5 ConvertX86p16_16BGR555 + 0x000000000001f488 ConvertX86p16_8RGB332 + 0x000000000001f488 ConvertX86p16_8RGB332 + *fill* 0x000000000001f57d 0x3 + .text 0x000000000001f580 0x622 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(x86p_32.o) + 0x000000000001f580 ConvertX86p32_32BGR888 + 0x000000000001f580 ConvertX86p32_32BGR888 + 0x000000000001f5ec ConvertX86p32_32RGBA888 + 0x000000000001f5ec ConvertX86p32_32RGBA888 + 0x000000000001f64c ConvertX86p32_32BGRA888 + 0x000000000001f64c ConvertX86p32_32BGRA888 + 0x000000000001f6a6 ConvertX86p32_24RGB888 + 0x000000000001f6a6 ConvertX86p32_24RGB888 + 0x000000000001f741 ConvertX86p32_24BGR888 + 0x000000000001f741 ConvertX86p32_24BGR888 + 0x000000000001f7d9 ConvertX86p32_16RGB565 + 0x000000000001f7d9 ConvertX86p32_16RGB565 + 0x000000000001f89c ConvertX86p32_16BGR565 + 0x000000000001f89c ConvertX86p32_16BGR565 + 0x000000000001f967 ConvertX86p32_16RGB555 + 0x000000000001f967 ConvertX86p32_16RGB555 + 0x000000000001fa2a ConvertX86p32_16BGR555 + 0x000000000001fa2a ConvertX86p32_16BGR555 + 0x000000000001faf5 ConvertX86p32_8RGB332 + 0x000000000001faf5 ConvertX86p32_8RGB332 + *fill* 0x000000000001fba2 0x2 + .text 0x000000000001fba4 0x433c /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_A.o) + 0x0000000000023d2d SDL_CalculateAlphaBlit + .text 0x0000000000023ee0 0xbf /home/max/kolibri-svn/contrib/sdk/lib/libsound.a(init.o) + 0x0000000000023ee0 InitSound@4 + 0x0000000000023f44 CreateBuffer@12 + 0x0000000000023f74 DestroyBuffer@4 + *fill* 0x0000000000023f9f 0x1 + .text 0x0000000000023fa0 0x57 /home/max/kolibri-svn/contrib/sdk/lib/libsound.a(setbuf.o) + 0x0000000000023fa0 SetBuffer@16 + 0x0000000000023fcc PlayBuffer@8 + *fill* 0x0000000000023ff7 0x9 + .text 0x0000000000024000 0x64 /home/max/kolibri-svn/contrib/sdk/lib/libsound.a(sndgetsize.o) + 0x0000000000024000 GetBufferSize@8 + 0x0000000000024030 GetBufferFree@8 + *fill* 0x0000000000024064 0xc + .text 0x0000000000024070 0x2b /home/max/kolibri-svn/contrib/sdk/lib/libsound.a(stopbuf.o) + 0x0000000000024070 StopBuffer@4 + *fill* 0x000000000002409b 0x1 + .text 0x000000000002409c 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000840.o) + 0x000000000002409c vsprintf + .text 0x00000000000240a4 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000839.o) + 0x00000000000240a4 vsnprintf + .text 0x00000000000240ac 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000834.o) + 0x00000000000240ac vprintf + .text 0x00000000000240b4 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000799.o) + 0x00000000000240b4 tls_free + .text 0x00000000000240bc 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000798.o) + 0x00000000000240bc tls_alloc + .text 0x00000000000240c4 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000765.o) + 0x00000000000240c4 strncpy + .text 0x00000000000240cc 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000764.o) + 0x00000000000240cc strncmp + .text 0x00000000000240d4 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000760.o) + 0x00000000000240d4 strlen + .text 0x00000000000240dc 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000752.o) + 0x00000000000240dc strcpy + .text 0x00000000000240e4 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000735.o) + 0x00000000000240e4 sprintf + .text 0x00000000000240ec 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000687.o) + 0x00000000000240ec realloc + .text 0x00000000000240f4 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000635.o) + 0x00000000000240f4 memcpy + .text 0x00000000000240fc 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000634.o) + 0x00000000000240fc memcmp + .text 0x0000000000024104 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000621.o) + 0x0000000000024104 malloc + .text 0x000000000002410c 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000519.o) + 0x000000000002410c getenv + .text 0x0000000000024114 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000502.o) + 0x0000000000024114 fwrite + .text 0x000000000002411c 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000497.o) + 0x000000000002411c ftell + .text 0x0000000000024124 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000493.o) + 0x0000000000024124 fseek + .text 0x000000000002412c 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000488.o) + 0x000000000002412c free + .text 0x0000000000024134 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000486.o) + 0x0000000000024134 fread + .text 0x000000000002413c 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000476.o) + 0x000000000002413c fprintf + .text 0x0000000000024144 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000474.o) + 0x0000000000024144 fopen + .text 0x000000000002414c 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000431.o) + 0x000000000002414c fclose + .text 0x0000000000024154 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000419.o) + 0x0000000000024154 exit + .text 0x000000000002415c 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000368.o) + 0x000000000002415c calloc + .text 0x0000000000024164 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000360.o) + 0x0000000000024164 atoi + .text 0x000000000002416c 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000358.o) + 0x000000000002416c atexit + .text 0x0000000000024174 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000334.o) + 0x0000000000024174 abort + *(SORT(.text$*)) + *(.text.*) + .text.unlikely + 0x000000000002417c 0x0 xmas.o + *fill* 0x000000000002417c 0x4 + .text.startup 0x0000000000024180 0xe80 xmas.o + 0x0000000000024180 main + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(__main.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(kos32-app.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(libc-loader.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(unwind-dw2-fde.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(gthr-kos32.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(addstr.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(move.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(attr.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(slk.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(inopts.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(clear.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(touch.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(refresh.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(window.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(overlay.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(kernel.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(border.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pad.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(addch.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(outopts.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(color.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(printw.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcgetsc.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcsetsc.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcdisp.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdckbd.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcutil.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(scroll.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_error.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_fatal.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_getenv.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_kolibri_audio.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_events.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_keyboard.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_mouse.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_quit.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_rwops.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_sysmutex.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_syssem.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_systhread.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_thread.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_timer.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_systimer.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_bmp.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_cursor.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_pixels.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_surface.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_video.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_menuetvideo.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_endian.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_active.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_resize.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_RLEaccel.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_0.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_1.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_N.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_menuetevents.o) + .text.unlikely + 0x0000000000025000 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_A.o) + *(.glue_7t) + *(.glue_7) + 0x0000000000025000 ___CTOR_LIST__ = . + 0x0000000000025000 __CTOR_LIST__ = . + 0x0000000000025000 0x4 LONG 0xffffffffffffffff + *(.ctors) + *(.ctor) + *(SORT(.ctors.*)) + 0x0000000000025004 0x4 LONG 0x0 + 0x0000000000025008 ___DTOR_LIST__ = . + 0x0000000000025008 __DTOR_LIST__ = . + 0x0000000000025008 0x4 LONG 0xffffffffffffffff + *(.dtors) + *(.dtor) + *(SORT(.dtors.*)) + 0x000000000002500c 0x4 LONG 0x0 + *(.fini) + *(.gcc_exc) + [!provide] PROVIDE (etext, .) + *(.gcc_except_table) + +.rdata 0x0000000000025010 0x4410 + *(.rdata) + .rdata 0x0000000000025010 0x1b0 xmas.o + .rdata 0x00000000000251c0 0x18 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(libc-loader.o) + .rdata 0x00000000000251d8 0x34 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(unwind-dw2-fde.o) + .rdata 0x000000000002520c 0xfc /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) + .rdata 0x0000000000025308 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(slk.o) + .rdata 0x000000000002530c 0x14 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(color.o) + .rdata 0x0000000000025320 0xb4 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) + *fill* 0x00000000000253d4 0xc + .rdata 0x00000000000253e0 0x3c0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdckbd.o) + .rdata 0x00000000000257a0 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcutil.o) + .rdata 0x00000000000257a4 0x68 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL.o) + .rdata 0x000000000002580c 0x94 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_error.o) + .rdata 0x00000000000258a0 0x194 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_kolibri_audio.o) + .rdata 0x0000000000025a34 0x1c /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_events.o) + .rdata 0x0000000000025a50 0x624 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_keyboard.o) + .rdata 0x0000000000026074 0x2c /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_rwops.o) + .rdata 0x00000000000260a0 0x28 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_syssem.o) + .rdata 0x00000000000260c8 0x2c /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_systhread.o) + .rdata 0x00000000000260f4 0xa0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_timer.o) + .rdata 0x0000000000026194 0x9c /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_bmp.o) + .rdata 0x0000000000026230 0x2c /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_cursor.o) + .rdata 0x000000000002625c 0x68 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_surface.o) + .rdata 0x00000000000262c4 0x1d8 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_video.o) + .rdata 0x000000000002649c 0x50 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_menuetvideo.o) + .rdata 0x00000000000264ec 0x10 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_RLEaccel.o) + .rdata 0x00000000000264fc 0x20 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit.o) + .rdata 0x000000000002651c 0x28 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_0.o) + .rdata 0x0000000000026544 0x140 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_1.o) + *fill* 0x0000000000026684 0x1c + .rdata 0x00000000000266a0 0x25a0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_N.o) + .rdata 0x0000000000028c40 0x620 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_menuetevents.o) + .rdata 0x0000000000029260 0x1c /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_A.o) + *(SORT(.rdata$*)) + 0x000000000002927c ___RUNTIME_PSEUDO_RELOC_LIST__ = . + 0x000000000002927c __RUNTIME_PSEUDO_RELOC_LIST__ = . + *(.rdata_runtime_pseudo_reloc) + 0x000000000002927c ___RUNTIME_PSEUDO_RELOC_LIST_END__ = . + 0x000000000002927c __RUNTIME_PSEUDO_RELOC_LIST_END__ = . + +.CRT 0x0000000000029280 0x0 + 0x0000000000029280 ___crt_xc_start__ = . + *(SORT(.CRT$XC*)) + 0x0000000000029280 ___crt_xc_end__ = . + 0x0000000000029280 ___crt_xi_start__ = . + *(SORT(.CRT$XI*)) + 0x0000000000029280 ___crt_xi_end__ = . + 0x0000000000029280 ___crt_xl_start__ = . + *(SORT(.CRT$XL*)) + 0x0000000000029280 ___crt_xp_start__ = . + *(SORT(.CRT$XP*)) + 0x0000000000029280 ___crt_xp_end__ = . + 0x0000000000029280 ___crt_xt_start__ = . + *(SORT(.CRT$XT*)) + 0x0000000000029280 ___crt_xt_end__ = . + +.data 0x0000000000029280 0x1600 + [!provide] PROVIDE (__data_start__, .) + *(.data) + .data 0x0000000000029280 0x0 xmas.o + .data 0x0000000000029280 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(_start.o) + .data 0x0000000000029280 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(__main.o) + .data 0x0000000000029284 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(_ctors.o) + .data 0x0000000000029284 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(kos32-app.o) + .data 0x0000000000029284 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(libc-loader.o) + .data 0x0000000000029284 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(unwind-dw2-fde.o) + .data 0x000000000002928c 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(gthr-kos32.o) + .data 0x000000000002928c 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(addstr.o) + .data 0x000000000002928c 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(move.o) + .data 0x000000000002928c 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(attr.o) + .data 0x000000000002928c 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) + 0x000000000002928c TABSIZE + 0x0000000000029290 _curses_notice + .data 0x0000000000029294 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(slk.o) + .data 0x0000000000029294 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(inopts.o) + .data 0x0000000000029294 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(clear.o) + .data 0x0000000000029294 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(touch.o) + .data 0x0000000000029294 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(refresh.o) + .data 0x0000000000029294 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(window.o) + .data 0x0000000000029294 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(overlay.o) + .data 0x0000000000029294 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(kernel.o) + .data 0x0000000000029294 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(border.o) + .data 0x0000000000029294 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pad.o) + .data 0x0000000000029294 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(addch.o) + .data 0x0000000000029294 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(outopts.o) + .data 0x0000000000029294 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(color.o) + 0x0000000000029294 COLOR_PAIRS + .data 0x0000000000029298 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(printw.o) + .data 0x0000000000029298 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcgetsc.o) + *fill* 0x0000000000029298 0x8 + .data 0x00000000000292a0 0x1100 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) + 0x00000000000292a0 iconbmp + 0x0000000000029360 font437 + .data 0x000000000002a3a0 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcsetsc.o) + .data 0x000000000002a3a0 0x220 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcdisp.o) + 0x000000000002a3c0 acs_map + .data 0x000000000002a5c0 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdckbd.o) + .data 0x000000000002a5c0 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcutil.o) + .data 0x000000000002a5c0 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(scroll.o) + .data 0x000000000002a5c0 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL.o) + .data 0x000000000002a5c4 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_error.o) + .data 0x000000000002a5c4 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_fatal.o) + .data 0x000000000002a5c4 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_getenv.o) + .data 0x000000000002a5c4 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_kolibri_audio.o) + .data 0x000000000002a5c4 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_events.o) + .data 0x000000000002a5c4 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_keyboard.o) + .data 0x000000000002a5c4 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_mouse.o) + .data 0x000000000002a5c4 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_quit.o) + .data 0x000000000002a5c4 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_rwops.o) + .data 0x000000000002a5c4 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_sysmutex.o) + .data 0x000000000002a5c4 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_syssem.o) + .data 0x000000000002a5c4 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_systhread.o) + .data 0x000000000002a5c4 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_thread.o) + .data 0x000000000002a5c4 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_timer.o) + .data 0x000000000002a5c4 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_systimer.o) + .data 0x000000000002a5c4 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_bmp.o) + *fill* 0x000000000002a5c4 0x1c + .data 0x000000000002a5e0 0x60 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_cursor.o) + .data 0x000000000002a640 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_pixels.o) + .data 0x000000000002a640 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_surface.o) + .data 0x000000000002a640 0x20 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_video.o) + .data 0x000000000002a660 0x24 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_menuetvideo.o) + 0x000000000002a660 mosvideo_bootstrab + 0x000000000002a670 def_title + .data 0x000000000002a684 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_endian.o) + .data 0x000000000002a684 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_active.o) + .data 0x000000000002a684 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_resize.o) + .data 0x000000000002a684 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_RLEaccel.o) + .data 0x000000000002a684 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit.o) + .data 0x000000000002a684 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_0.o) + .data 0x000000000002a684 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_1.o) + .data 0x000000000002a684 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_N.o) + .data 0x000000000002a684 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_menuetevents.o) + .data 0x000000000002a684 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(x86_main.o) + .data 0x000000000002a688 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_A.o) + *fill* 0x000000000002a688 0x8 + .data 0x000000000002a690 0x17 /home/max/kolibri-svn/contrib/sdk/lib/libsound.a(init.o) + 0x000000000002a690 hSound + 0x000000000002a690 hSound + 0x000000000002a694 hrdwSound + 0x000000000002a694 hrdwSound + *(.data2) + *(SORT(.data$*)) + *(.jcr) + 0x000000000002a6a7 __CRT_MT = . + 0x000000000002a6a7 0x4 LONG 0x1 + [!provide] PROVIDE (__data_end__, .) + *(.data_cygwin_nocopy) + 0x000000000002a6ab ___iend = . + +.eh_frame 0x000000000002a6b0 0x4400 + 0x000000000002a6b0 PROVIDE (___EH_FRAME_BEGIN__, .) + *(.eh_frame*) + .eh_frame 0x000000000002a6b0 0x460 xmas.o + .eh_frame 0x000000000002ab10 0x68 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(__main.o) + .eh_frame 0x000000000002ab78 0x34 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(kos32-app.o) + .eh_frame 0x000000000002abac 0x6c /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(libc-loader.o) + .eh_frame 0x000000000002ac18 0x4f0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(unwind-dw2-fde.o) + .eh_frame 0x000000000002b108 0x230 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(gthr-kos32.o) + .eh_frame 0x000000000002b338 0x284 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(addstr.o) + .eh_frame 0x000000000002b5bc 0xf0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(move.o) + .eh_frame 0x000000000002b6ac 0x4b0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(attr.o) + .eh_frame 0x000000000002bb5c 0x1ac /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) + .eh_frame 0x000000000002bd08 0x404 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(slk.o) + .eh_frame 0x000000000002c10c 0x194 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(inopts.o) + .eh_frame 0x000000000002c2a0 0x1b0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(clear.o) + .eh_frame 0x000000000002c450 0x1b4 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(touch.o) + .eh_frame 0x000000000002c604 0x1ec /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(refresh.o) + .eh_frame 0x000000000002c7f0 0x564 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(window.o) + .eh_frame 0x000000000002cd54 0x1e8 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(overlay.o) + .eh_frame 0x000000000002cf3c 0x2cc /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(kernel.o) + .eh_frame 0x000000000002d208 0x388 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(border.o) + .eh_frame 0x000000000002d590 0x210 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pad.o) + .eh_frame 0x000000000002d7a0 0x2c0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(addch.o) + .eh_frame 0x000000000002da60 0x10c /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(outopts.o) + .eh_frame 0x000000000002db6c 0x434 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(color.o) + .eh_frame 0x000000000002dfa0 0xf8 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(printw.o) + .eh_frame 0x000000000002e098 0x44 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcgetsc.o) + .eh_frame 0x000000000002e0dc 0x240 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) + .eh_frame 0x000000000002e31c 0xb8 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcsetsc.o) + .eh_frame 0x000000000002e3d4 0x2f0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcdisp.o) + .eh_frame 0x000000000002e6c4 0x16c /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdckbd.o) + .eh_frame 0x000000000002e830 0x64 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcutil.o) + .eh_frame 0x000000000002e894 0xc0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(scroll.o) + 0x000000000002e954 ___FRAME_END__ = . + 0x000000000002e954 0x4 LONG 0x0 + +.idata 0x000000000002e960 0x400 + 0x000000000002e960 __idata_start = . + SORT(*)(.idata$2) + .idata$2 0x000000000002e960 0x14 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000000.o) + 0x000000000002e960 _head_libc_dll + SORT(*)(.idata$3) + 0x000000000002e974 0x4 LONG 0x0 + 0x000000000002e978 0x4 LONG 0x0 + 0x000000000002e97c 0x4 LONG 0x0 + 0x000000000002e980 0x4 LONG 0x0 + 0x000000000002e984 0x4 LONG 0x0 + SORT(*)(.idata$4) + .idata$4 0x000000000002e988 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000000.o) + .idata$4 0x000000000002e988 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000334.o) + .idata$4 0x000000000002e98c 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000358.o) + .idata$4 0x000000000002e990 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000360.o) + .idata$4 0x000000000002e994 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000368.o) + .idata$4 0x000000000002e998 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000419.o) + .idata$4 0x000000000002e99c 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000431.o) + .idata$4 0x000000000002e9a0 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000474.o) + .idata$4 0x000000000002e9a4 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000476.o) + .idata$4 0x000000000002e9a8 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000486.o) + .idata$4 0x000000000002e9ac 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000488.o) + .idata$4 0x000000000002e9b0 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000493.o) + .idata$4 0x000000000002e9b4 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000497.o) + .idata$4 0x000000000002e9b8 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000502.o) + .idata$4 0x000000000002e9bc 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000519.o) + .idata$4 0x000000000002e9c0 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000621.o) + .idata$4 0x000000000002e9c4 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000634.o) + .idata$4 0x000000000002e9c8 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000635.o) + .idata$4 0x000000000002e9cc 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000687.o) + .idata$4 0x000000000002e9d0 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000735.o) + .idata$4 0x000000000002e9d4 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000752.o) + .idata$4 0x000000000002e9d8 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000760.o) + .idata$4 0x000000000002e9dc 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000764.o) + .idata$4 0x000000000002e9e0 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000765.o) + .idata$4 0x000000000002e9e4 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000798.o) + .idata$4 0x000000000002e9e8 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000799.o) + .idata$4 0x000000000002e9ec 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000834.o) + .idata$4 0x000000000002e9f0 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000839.o) + .idata$4 0x000000000002e9f4 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000840.o) + .idata$4 0x000000000002e9f8 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000903.o) + SORT(*)(.idata$5) + .idata$5 0x000000000002e9fc 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000000.o) + .idata$5 0x000000000002e9fc 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000334.o) + 0x000000000002e9fc _imp__abort + .idata$5 0x000000000002ea00 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000358.o) + 0x000000000002ea00 _imp__atexit + .idata$5 0x000000000002ea04 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000360.o) + 0x000000000002ea04 _imp__atoi + .idata$5 0x000000000002ea08 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000368.o) + 0x000000000002ea08 _imp__calloc + .idata$5 0x000000000002ea0c 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000419.o) + 0x000000000002ea0c _imp__exit + .idata$5 0x000000000002ea10 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000431.o) + 0x000000000002ea10 _imp__fclose + .idata$5 0x000000000002ea14 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000474.o) + 0x000000000002ea14 _imp__fopen + .idata$5 0x000000000002ea18 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000476.o) + 0x000000000002ea18 _imp__fprintf + .idata$5 0x000000000002ea1c 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000486.o) + 0x000000000002ea1c _imp__fread + .idata$5 0x000000000002ea20 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000488.o) + 0x000000000002ea20 _imp__free + .idata$5 0x000000000002ea24 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000493.o) + 0x000000000002ea24 _imp__fseek + .idata$5 0x000000000002ea28 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000497.o) + 0x000000000002ea28 _imp__ftell + .idata$5 0x000000000002ea2c 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000502.o) + 0x000000000002ea2c _imp__fwrite + .idata$5 0x000000000002ea30 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000519.o) + 0x000000000002ea30 _imp__getenv + .idata$5 0x000000000002ea34 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000621.o) + 0x000000000002ea34 _imp__malloc + .idata$5 0x000000000002ea38 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000634.o) + 0x000000000002ea38 _imp__memcmp + .idata$5 0x000000000002ea3c 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000635.o) + 0x000000000002ea3c _imp__memcpy + .idata$5 0x000000000002ea40 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000687.o) + 0x000000000002ea40 _imp__realloc + .idata$5 0x000000000002ea44 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000735.o) + 0x000000000002ea44 _imp__sprintf + .idata$5 0x000000000002ea48 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000752.o) + 0x000000000002ea48 _imp__strcpy + .idata$5 0x000000000002ea4c 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000760.o) + 0x000000000002ea4c _imp__strlen + .idata$5 0x000000000002ea50 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000764.o) + 0x000000000002ea50 _imp__strncmp + .idata$5 0x000000000002ea54 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000765.o) + 0x000000000002ea54 _imp__strncpy + .idata$5 0x000000000002ea58 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000798.o) + 0x000000000002ea58 _imp__tls_alloc + .idata$5 0x000000000002ea5c 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000799.o) + 0x000000000002ea5c _imp__tls_free + .idata$5 0x000000000002ea60 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000834.o) + 0x000000000002ea60 _imp__vprintf + .idata$5 0x000000000002ea64 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000839.o) + 0x000000000002ea64 _imp__vsnprintf + .idata$5 0x000000000002ea68 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000840.o) + 0x000000000002ea68 _imp__vsprintf + .idata$5 0x000000000002ea6c 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000903.o) + SORT(*)(.idata$6) + .idata$6 0x000000000002ea70 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000334.o) + .idata$6 0x000000000002ea78 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000358.o) + .idata$6 0x000000000002ea84 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000360.o) + .idata$6 0x000000000002ea8c 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000368.o) + .idata$6 0x000000000002ea98 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000419.o) + .idata$6 0x000000000002eaa0 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000431.o) + .idata$6 0x000000000002eaac 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000474.o) + .idata$6 0x000000000002eab4 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000476.o) + .idata$6 0x000000000002eac0 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000486.o) + .idata$6 0x000000000002eac8 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000488.o) + .idata$6 0x000000000002ead0 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000493.o) + .idata$6 0x000000000002ead8 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000497.o) + .idata$6 0x000000000002eae0 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000502.o) + .idata$6 0x000000000002eaec 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000519.o) + .idata$6 0x000000000002eaf8 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000621.o) + .idata$6 0x000000000002eb04 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000634.o) + .idata$6 0x000000000002eb10 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000635.o) + .idata$6 0x000000000002eb1c 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000687.o) + .idata$6 0x000000000002eb28 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000735.o) + .idata$6 0x000000000002eb34 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000752.o) + .idata$6 0x000000000002eb40 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000760.o) + .idata$6 0x000000000002eb4c 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000764.o) + .idata$6 0x000000000002eb58 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000765.o) + .idata$6 0x000000000002eb64 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000798.o) + .idata$6 0x000000000002eb70 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000799.o) + .idata$6 0x000000000002eb7c 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000834.o) + .idata$6 0x000000000002eb88 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000839.o) + .idata$6 0x000000000002eb94 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000840.o) + SORT(*)(.idata$7) + .idata$7 0x000000000002eba0 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000334.o) + .idata$7 0x000000000002eba4 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000358.o) + .idata$7 0x000000000002eba8 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000360.o) + .idata$7 0x000000000002ebac 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000368.o) + .idata$7 0x000000000002ebb0 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000419.o) + .idata$7 0x000000000002ebb4 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000431.o) + .idata$7 0x000000000002ebb8 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000474.o) + .idata$7 0x000000000002ebbc 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000476.o) + .idata$7 0x000000000002ebc0 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000486.o) + .idata$7 0x000000000002ebc4 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000488.o) + .idata$7 0x000000000002ebc8 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000493.o) + .idata$7 0x000000000002ebcc 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000497.o) + .idata$7 0x000000000002ebd0 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000502.o) + .idata$7 0x000000000002ebd4 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000519.o) + .idata$7 0x000000000002ebd8 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000621.o) + .idata$7 0x000000000002ebdc 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000634.o) + .idata$7 0x000000000002ebe0 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000635.o) + .idata$7 0x000000000002ebe4 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000687.o) + .idata$7 0x000000000002ebe8 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000735.o) + .idata$7 0x000000000002ebec 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000752.o) + .idata$7 0x000000000002ebf0 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000760.o) + .idata$7 0x000000000002ebf4 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000764.o) + .idata$7 0x000000000002ebf8 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000765.o) + .idata$7 0x000000000002ebfc 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000798.o) + .idata$7 0x000000000002ec00 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000799.o) + .idata$7 0x000000000002ec04 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000834.o) + .idata$7 0x000000000002ec08 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000839.o) + .idata$7 0x000000000002ec0c 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000840.o) + .idata$7 0x000000000002ec10 0xc /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a(d000903.o) + 0x000000000002ec10 libc_dll_iname + 0x000000000002ec1c __idata_end = . + +bss 0x000000000002ec20 0xf120 + *(.bss) + .bss 0x000000000002ec20 0x4 xmas.o + .bss 0x000000000002ec24 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(_start.o) + .bss 0x000000000002ec24 0x20 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(__main.o) + .bss 0x000000000002ec44 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(_ctors.o) + .bss 0x000000000002ec44 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(kos32-app.o) + .bss 0x000000000002ec44 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(libc-loader.o) + .bss 0x000000000002ec44 0x1c /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(unwind-dw2-fde.o) + .bss 0x000000000002ec60 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(gthr-kos32.o) + .bss 0x000000000002ec60 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(addstr.o) + .bss 0x000000000002ec60 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(move.o) + .bss 0x000000000002ec60 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(attr.o) + .bss 0x000000000002ec60 0x14 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) + 0x000000000002ec60 COLS + 0x000000000002ec64 LINES + 0x000000000002ec68 stdscr + 0x000000000002ec6c curscr + 0x000000000002ec70 SP + *fill* 0x000000000002ec74 0xc + .bss 0x000000000002ec80 0x40 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(slk.o) + .bss 0x000000000002ecc0 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(inopts.o) + .bss 0x000000000002ecc0 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(clear.o) + .bss 0x000000000002ecc0 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(touch.o) + .bss 0x000000000002ecc0 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(refresh.o) + .bss 0x000000000002ecc0 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(window.o) + .bss 0x000000000002ecc0 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(overlay.o) + .bss 0x000000000002ecc0 0x220 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(kernel.o) + 0x000000000002ecc0 linesrippedoff + .bss 0x000000000002eee0 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(border.o) + .bss 0x000000000002eee0 0x18 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pad.o) + .bss 0x000000000002eef8 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(addch.o) + .bss 0x000000000002eef8 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(outopts.o) + .bss 0x000000000002eef8 0xc /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(color.o) + 0x000000000002eef8 COLORS + .bss 0x000000000002ef04 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(printw.o) + .bss 0x000000000002ef04 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcgetsc.o) + .bss 0x000000000002ef04 0x24 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) + 0x000000000002ef04 pdc_xoffset + 0x000000000002ef08 pdc_yoffset + 0x000000000002ef0c pdc_swidth + 0x000000000002ef10 pdc_sheight + 0x000000000002ef14 pdc_tileback + 0x000000000002ef18 pdc_back + 0x000000000002ef1c pdc_icon + 0x000000000002ef20 pdc_font + 0x000000000002ef24 pdc_screen + .bss 0x000000000002ef28 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcsetsc.o) + *fill* 0x000000000002ef28 0x18 + .bss 0x000000000002ef40 0x660 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcdisp.o) + .bss 0x000000000002f5a0 0x2c /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdckbd.o) + .bss 0x000000000002f5cc 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcutil.o) + .bss 0x000000000002f5cc 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(scroll.o) + .bss 0x000000000002f5cc 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL.o) + *fill* 0x000000000002f5d4 0xc + .bss 0x000000000002f5e0 0xb20 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_error.o) + .bss 0x0000000000030100 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_fatal.o) + .bss 0x0000000000030100 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_getenv.o) + *fill* 0x0000000000030104 0x1c + .bss 0x0000000000030120 0xa440 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_kolibri_audio.o) + .bss 0x000000000003a560 0xe40 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_events.o) + 0x000000000003a560 SDL_EventOK + .bss 0x000000000003b3a0 0x6a0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_keyboard.o) + 0x000000000003b3a0 SDL_TranslateUNICODE + .bss 0x000000000003ba40 0xc /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_mouse.o) + .bss 0x000000000003ba4c 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_quit.o) + .bss 0x000000000003ba4c 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_rwops.o) + .bss 0x000000000003ba4c 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_sysmutex.o) + .bss 0x000000000003ba4c 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_syssem.o) + .bss 0x000000000003ba4c 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_systhread.o) + *fill* 0x000000000003ba4c 0x14 + .bss 0x000000000003ba60 0x340 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_thread.o) + 0x000000000003ba60 _creating_thread_lock + .bss 0x000000000003bda0 0x20 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_timer.o) + 0x000000000003bda0 SDL_alarm_interval + 0x000000000003bda4 SDL_timer_running + 0x000000000003bda8 SDL_timer_started + .bss 0x000000000003bdc0 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_systimer.o) + .bss 0x000000000003bdc4 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_bmp.o) + .bss 0x000000000003bdc4 0x18 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_cursor.o) + 0x000000000003bdc4 SDL_cursorlock + 0x000000000003bdc8 SDL_cursor + 0x000000000003bdcc SDL_cursorstate + .bss 0x000000000003bddc 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_pixels.o) + .bss 0x000000000003bddc 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_surface.o) + .bss 0x000000000003bddc 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_video.o) + 0x000000000003bddc current_video + .bss 0x000000000003bde0 0x10 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_menuetvideo.o) + .bss 0x000000000003bdf0 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_endian.o) + .bss 0x000000000003bdf0 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_active.o) + .bss 0x000000000003bdf4 0x8 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_resize.o) + .bss 0x000000000003bdfc 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_RLEaccel.o) + .bss 0x000000000003bdfc 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit.o) + .bss 0x000000000003bdfc 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_0.o) + .bss 0x000000000003bdfc 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_1.o) + .bss 0x000000000003bdfc 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_N.o) + .bss 0x000000000003bdfc 0xc /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_menuetevents.o) + .bss 0x000000000003be08 0x0 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_blit_A.o) + *(COMMON) + COMMON 0x000000000003be08 0x80 xmas.o + 0x000000000003be08 lookdeer3 + 0x000000000003be0c bigdeer0 + 0x000000000003be10 bigdeer2 + 0x000000000003be14 w_holiday + 0x000000000003be18 middeer0 + 0x000000000003be1c treescrn4 + 0x000000000003be20 middeer2 + 0x000000000003be24 lildeer1 + 0x000000000003be28 treescrn8 + 0x000000000003be2c bigdeer3 + 0x000000000003be30 x_pos + 0x000000000003be34 lildeer2 + 0x000000000003be38 lookdeer4 + 0x000000000003be3c bigdeer4 + 0x000000000003be40 middeer3 + 0x000000000003be44 lildeer3 + 0x000000000003be48 lildeer0 + 0x000000000003be4c treescrn5 + 0x000000000003be50 y_pos + 0x000000000003be54 treescrn2 + 0x000000000003be58 treescrn3 + 0x000000000003be5c lookdeer2 + 0x000000000003be60 treescrn + 0x000000000003be64 bigdeer1 + 0x000000000003be68 dotdeer0 + 0x000000000003be6c treescrn7 + 0x000000000003be70 middeer1 + 0x000000000003be74 w_del_msg + 0x000000000003be78 lookdeer0 + 0x000000000003be7c stardeer0 + 0x000000000003be80 treescrn6 + 0x000000000003be84 lookdeer1 + COMMON 0x000000000003be88 0x10 /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a(_ctors.o) + *fill* 0x000000000003be98 0x8 + COMMON 0x000000000003bea0 0x94 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(initscr.o) + 0x000000000003bea0 ttytype + 0x000000000003bf20 Mouse_status + *fill* 0x000000000003bf34 0xc + COMMON 0x000000000003bf40 0x28 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(kernel.o) + 0x000000000003bf40 linesripped + *fill* 0x000000000003bf68 0x18 + COMMON 0x000000000003bf80 0x1848 /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a(pdcscrn.o) + 0x000000000003bf80 pdc_own_screen + 0x000000000003bf84 pdc_fwidth + 0x000000000003bfa0 pdc_color + 0x000000000003cba0 pdc_flastc + 0x000000000003cbc0 pdc_mapped + 0x000000000003d7c0 pdc_fthick + 0x000000000003d7c4 pdc_fheight + *fill* 0x000000000003d7c8 0x18 + COMMON 0x000000000003d7e0 0x20 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_events.o) + 0x000000000003d7e0 SDL_ProcessEvents + COMMON 0x000000000003d800 0x24 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_keyboard.o) + 0x000000000003d800 SDL_KeyRepeat + COMMON 0x000000000003d824 0x4 /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a(SDL_timer.o) + 0x000000000003d824 SDL_alarm_callback + 0x000000000003d830 . = ALIGN (0x10) + *fill* 0x000000000003d828 0x8 + 0x000000000003d830 ___cmdline = . + 0x000000000003d930 . = (. + 0x100) + *fill* 0x000000000003d830 0x100 + 0x000000000003d930 ___pgmname = . + 0x000000000003dd40 . = ((. + 0x400) + 0x10) + *fill* 0x000000000003d930 0x410 + 0x000000000003dd40 ___stacktop = . + 0x000000000003dd40 ___memsize = . + +/DISCARD/ + *(.debug$S) + *(.debug$T) + *(.debug$F) + *(.drectve) + *(.note.GNU-stack) + *(.comment) + *(.debug_abbrev) + *(.debug_info) + *(.debug_line) + *(.debug_frame) + *(.debug_loc) + *(.debug_pubnames) + *(.debug_aranges) + *(.debug_ranges) +LOAD xmas.o +LOAD /home/max/kolibri-svn/contrib/sdk/lib/libgcc.a +LOAD /home/max/kolibri-svn/contrib/sdk/lib/libcurses.a +LOAD /home/max/kolibri-svn/contrib/sdk/lib/libSDLn.a +LOAD /home/max/kolibri-svn/contrib/sdk/lib/libsound.a +LOAD /home/max/kolibri-svn/contrib/sdk/lib/libc.dll.a +OUTPUT(xmas pei-i386) diff --git a/contrib/sdk/sources/PDCurses/demos/xmas b/contrib/sdk/sources/PDCurses/demos/xmas new file mode 100755 index 0000000000..0f3d8dc76b Binary files /dev/null and b/contrib/sdk/sources/PDCurses/demos/xmas differ diff --git a/contrib/sdk/sources/PDCurses/demos/xmas.c b/contrib/sdk/sources/PDCurses/demos/xmas.c new file mode 100644 index 0000000000..e1c02c03d2 --- /dev/null +++ b/contrib/sdk/sources/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/contrib/sdk/sources/PDCurses/panel.h b/contrib/sdk/sources/PDCurses/panel.h new file mode 100644 index 0000000000..83d4f2c619 --- /dev/null +++ b/contrib/sdk/sources/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/contrib/sdk/sources/PDCurses/pdcurses/README.md b/contrib/sdk/sources/PDCurses/pdcurses/README.md new file mode 100644 index 0000000000..d7b7c65268 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/README.md @@ -0,0 +1,25 @@ +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. + + +Distribution Status +------------------- + +The files in this directory are released to the public domain. + + +Acknowledgements +---------------- + +The panel library was originally provided by +Warren Tucker diff --git a/contrib/sdk/sources/PDCurses/pdcurses/addch.c b/contrib/sdk/sources/PDCurses/pdcurses/addch.c new file mode 100644 index 0000000000..9931fd60b4 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/addch.c @@ -0,0 +1,408 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/addchstr.c b/contrib/sdk/sources/PDCurses/pdcurses/addchstr.c new file mode 100644 index 0000000000..10fc27941f --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/addchstr.c @@ -0,0 +1,244 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/addstr.c b/contrib/sdk/sources/PDCurses/pdcurses/addstr.c new file mode 100644 index 0000000000..a7d8539652 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/addstr.c @@ -0,0 +1,239 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/attr.c b/contrib/sdk/sources/PDCurses/pdcurses/attr.c new file mode 100644 index 0000000000..b5907da681 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/attr.c @@ -0,0 +1,409 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/beep.c b/contrib/sdk/sources/PDCurses/pdcurses/beep.c new file mode 100644 index 0000000000..690c794afa --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/beep.c @@ -0,0 +1,74 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/bkgd.c b/contrib/sdk/sources/PDCurses/pdcurses/bkgd.c new file mode 100644 index 0000000000..f576437317 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/bkgd.c @@ -0,0 +1,226 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/border.c b/contrib/sdk/sources/PDCurses/pdcurses/border.c new file mode 100644 index 0000000000..62458b683d --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/border.c @@ -0,0 +1,414 @@ +/* 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: + + 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/clear.c b/contrib/sdk/sources/PDCurses/pdcurses/clear.c new file mode 100644 index 0000000000..50ff7ad3fb --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/clear.c @@ -0,0 +1,159 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/color.c b/contrib/sdk/sources/PDCurses/pdcurses/color.c new file mode 100644 index 0000000000..7d4df24c37 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/color.c @@ -0,0 +1,362 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/debug.c b/contrib/sdk/sources/PDCurses/pdcurses/debug.c new file mode 100644 index 0000000000..6444886547 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/debug.c @@ -0,0 +1,106 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/delch.c b/contrib/sdk/sources/PDCurses/pdcurses/delch.c new file mode 100644 index 0000000000..970a5a81ce --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/delch.c @@ -0,0 +1,96 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/deleteln.c b/contrib/sdk/sources/PDCurses/pdcurses/deleteln.c new file mode 100644 index 0000000000..8e7563f383 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/deleteln.c @@ -0,0 +1,211 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/getch.c b/contrib/sdk/sources/PDCurses/pdcurses/getch.c new file mode 100644 index 0000000000..58a44c27ee --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/getch.c @@ -0,0 +1,589 @@ +/* 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 + 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 *= 3; +#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/contrib/sdk/sources/PDCurses/pdcurses/getstr.c b/contrib/sdk/sources/PDCurses/pdcurses/getstr.c new file mode 100644 index 0000000000..603769f1ea --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/getstr.c @@ -0,0 +1,473 @@ +/* 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 + 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]; + + if (n < 0 || n > MAXLINE) + n = MAXLINE; + + if (wgetn_wstr(win, (wint_t *)wstr, n) == ERR) + return ERR; + + 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/contrib/sdk/sources/PDCurses/pdcurses/getyx.c b/contrib/sdk/sources/PDCurses/pdcurses/getyx.c new file mode 100644 index 0000000000..9400076e05 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/getyx.c @@ -0,0 +1,142 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/inch.c b/contrib/sdk/sources/PDCurses/pdcurses/inch.c new file mode 100644 index 0000000000..e3275a8c95 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/inch.c @@ -0,0 +1,126 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/inchstr.c b/contrib/sdk/sources/PDCurses/pdcurses/inchstr.c new file mode 100644 index 0000000000..97a00831e7 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/inchstr.c @@ -0,0 +1,213 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/initscr.c b/contrib/sdk/sources/PDCurses/pdcurses/initscr.c new file mode 100644 index 0000000000..e9a62ac2e0 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/initscr.c @@ -0,0 +1,431 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/inopts.c b/contrib/sdk/sources/PDCurses/pdcurses/inopts.c new file mode 100644 index 0000000000..e38bb5379a --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/inopts.c @@ -0,0 +1,368 @@ +/* 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 typeahead(int fildes); + + int crmode(void); + int nocrmode(void); + + bool is_keypad(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. + + 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. + +### Return Value + + All functions except is_keypad() and the void functions return OK on + success and ERR on error. + +### Portability + 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 + typeahead Y Y Y + crmode Y Y Y + nocrmode Y Y Y + is_keypad - Y 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")); +} + +int typeahead(int fildes) +{ + PDC_LOG(("typeahead() - called\n")); + + return OK; +} + +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; + } +} + +void timeout(int delay) +{ + PDC_LOG(("timeout() - called\n")); + + wtimeout(stdscr, delay); +} + +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; +} diff --git a/contrib/sdk/sources/PDCurses/pdcurses/insch.c b/contrib/sdk/sources/PDCurses/pdcurses/insch.c new file mode 100644 index 0000000000..da6cb2d7c3 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/insch.c @@ -0,0 +1,270 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/insstr.c b/contrib/sdk/sources/PDCurses/pdcurses/insstr.c new file mode 100644 index 0000000000..2e2cfb7da8 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/insstr.c @@ -0,0 +1,263 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/instr.c b/contrib/sdk/sources/PDCurses/pdcurses/instr.c new file mode 100644 index 0000000000..bd8dbf9e12 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/instr.c @@ -0,0 +1,245 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/kernel.c b/contrib/sdk/sources/PDCurses/pdcurses/kernel.c new file mode 100644 index 0000000000..81915e738a --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/kernel.c @@ -0,0 +1,297 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/keyname.c b/contrib/sdk/sources/PDCurses/pdcurses/keyname.c new file mode 100644 index 0000000000..44e8dd4aa1 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/keyname.c @@ -0,0 +1,129 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/mouse.c b/contrib/sdk/sources/PDCurses/pdcurses/mouse.c new file mode 100644 index 0000000000..d2e8619fdf --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/mouse.c @@ -0,0 +1,421 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/move.c b/contrib/sdk/sources/PDCurses/pdcurses/move.c new file mode 100644 index 0000000000..05f4aaa794 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/move.c @@ -0,0 +1,77 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/outopts.c b/contrib/sdk/sources/PDCurses/pdcurses/outopts.c new file mode 100644 index 0000000000..f13715a947 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/outopts.c @@ -0,0 +1,175 @@ +/* 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 scrollok(WINDOW *win, bool bf); + + int raw_output(bool bf); + + bool is_leaveok(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. + + idlok() and idcok() do nothing in PDCurses, but are provided for + compatibility with other curses implementations. + + 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_leaveok() reports whether the specified window is in leaveok mode. + +### Return Value + + All functions except is_leaveok() return OK on success and ERR on + error. + +### Portability + 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 + scrollok Y Y Y + is_leaveok - Y 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 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_leaveok(const WINDOW *win) +{ + PDC_LOG(("is_leaveok() - called\n")); + + if (!win) + return FALSE; + + return win->_leaveit; +} diff --git a/contrib/sdk/sources/PDCurses/pdcurses/overlay.c b/contrib/sdk/sources/PDCurses/pdcurses/overlay.c new file mode 100644 index 0000000000..5bcc62745f --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/overlay.c @@ -0,0 +1,214 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/pad.c b/contrib/sdk/sources/PDCurses/pdcurses/pad.c new file mode 100644 index 0000000000..0b1d6147ce --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/pad.c @@ -0,0 +1,278 @@ +/* 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 + 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 + +/* save values for pechochar() */ + +static int save_pminrow, save_pmincol; +static int save_sminrow, save_smincol, save_smaxrow, save_smaxcol; + +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; + + /* save default values in case pechochar() is the first call to + prefresh(). */ + + save_pminrow = 0; + save_pmincol = 0; + save_sminrow = 0; + save_smincol = 0; + save_smaxrow = min(LINES, nlines) - 1; + save_smaxcol = 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; + + /* save default values in case pechochar() is the first call + to prefresh(). */ + + save_pminrow = 0; + save_pmincol = 0; + save_sminrow = 0; + save_smincol = 0; + save_smaxrow = min(LINES, nlines) - 1; + save_smaxcol = 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 = sy1; + int pline = py; + + PDC_LOG(("pnoutrefresh() - called\n")); + + if (!w || !(w->_flags & (_PAD|_SUBPAD)) || (sy2 >= LINES) || (sx2 >= COLS)) + return ERR; + + if (py < 0) + py = 0; + if (px < 0) + px = 0; + if (sy1 < 0) + sy1 = 0; + if (sx1 < 0) + sx1 = 0; + + if (sy2 < sy1 || sx2 < sx1) + return ERR; + + 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; + } + + return OK; +} + +int pechochar(WINDOW *pad, chtype ch) +{ + PDC_LOG(("pechochar() - called\n")); + + if (waddch(pad, ch) == ERR) + return ERR; + + return prefresh(pad, save_pminrow, save_pmincol, save_sminrow, + save_smincol, save_smaxrow, save_smaxcol); +} + +#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, save_pminrow, save_pmincol, save_sminrow, + save_smincol, save_smaxrow, save_smaxcol); +} +#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/contrib/sdk/sources/PDCurses/pdcurses/panel.c b/contrib/sdk/sources/PDCurses/pdcurses/panel.c new file mode 100644 index 0000000000..b3c48fcc1a --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/panel.c @@ -0,0 +1,633 @@ +/* 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 + 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 _override(PANEL *pan, int show) +{ + int y; + 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) + for (y = pan->wstarty; y < pan->wendy; y++) + if ((y >= pan2->wstarty) && (y < pan2->wendy) && + ((is_linetouched(pan->win, y - pan->wstarty)) || + (is_linetouched(stdscr, y)))) + Touchline(pan2, y - pan2->wstarty, 1); + + tobs = tobs->above; + } +} + +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/contrib/sdk/sources/PDCurses/pdcurses/printw.c b/contrib/sdk/sources/PDCurses/pdcurses/printw.c new file mode 100644 index 0000000000..7d19a9978e --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/printw.c @@ -0,0 +1,129 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/refresh.c b/contrib/sdk/sources/PDCurses/pdcurses/refresh.c new file mode 100644 index 0000000000..cc0a25d90b --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/refresh.c @@ -0,0 +1,279 @@ +/* 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 + 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 || (win->_flags & (_PAD|_SUBPAD)) ) + return ERR; + + 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/contrib/sdk/sources/PDCurses/pdcurses/scanw.c b/contrib/sdk/sources/PDCurses/pdcurses/scanw.c new file mode 100644 index 0000000000..23a2d412a3 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/scanw.c @@ -0,0 +1,581 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/scr_dump.c b/contrib/sdk/sources/PDCurses/pdcurses/scr_dump.c new file mode 100644 index 0000000000..d9105bda98 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/scr_dump.c @@ -0,0 +1,217 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/scroll.c b/contrib/sdk/sources/PDCurses/pdcurses/scroll.c new file mode 100644 index 0000000000..ffe8d0d94a --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/scroll.c @@ -0,0 +1,101 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/slk.c b/contrib/sdk/sources/PDCurses/pdcurses/slk.c new file mode 100644 index 0000000000..4fdfee14ef --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/slk.c @@ -0,0 +1,671 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/termattr.c b/contrib/sdk/sources/PDCurses/pdcurses/termattr.c new file mode 100644 index 0000000000..afb143de08 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/termattr.c @@ -0,0 +1,172 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/touch.c b/contrib/sdk/sources/PDCurses/pdcurses/touch.c new file mode 100644 index 0000000000..e1b7c60eff --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/touch.c @@ -0,0 +1,199 @@ +/* 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 + 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; + + PDC_LOG(("touchoverlap() - called: win1=%p win2=%p\n", win1, win2)); + + if (!win1 || !win2) + return ERR; + + starty = max(win1->_begy, win2->_begy); + startx = max(win1->_begx, win2->_begx); + endy = min(win1->_maxy + win1->_begy, win2->_maxy + win2->_begy); + endx = min(win1->_maxx + win1->_begx, win2->_maxx + win2->_begx); + + if (starty >= endy || startx >= endx) + return OK; + + starty -= win2->_begy; + startx -= win2->_begx; + endy -= win2->_begy; + endx -= win2->_begx; + endx -= 1; + + for (y = starty; y < endy; y++) + { + win2->_firstch[y] = startx; + win2->_lastch[y] = endx; + } + + return OK; +} diff --git a/contrib/sdk/sources/PDCurses/pdcurses/util.c b/contrib/sdk/sources/PDCurses/pdcurses/util.c new file mode 100644 index 0000000000..2d29306e88 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/util.c @@ -0,0 +1,308 @@ +/* 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 + 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/contrib/sdk/sources/PDCurses/pdcurses/window.c b/contrib/sdk/sources/PDCurses/pdcurses/window.c new file mode 100644 index 0000000000..094f0127e7 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/pdcurses/window.c @@ -0,0 +1,581 @@ +/* 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); + 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); + 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. + + wsyncup() causes a touchwin() of all of the window's parents. + + If wsyncok() is called with a second argument of TRUE, this causes a + wsyncup() to be called every time the window is changed. + + 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. + +### 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 + 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 + wsyncup Y Y Y + syncok Y Y 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; + + /* 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 - 1 - j; + if (!ncols) + ncols = orig->_maxx - 1 - 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 *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; + + 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; +} + +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/contrib/sdk/sources/PDCurses/sdl1/Makefile.linux b/contrib/sdk/sources/PDCurses/sdl1/Makefile.linux new file mode 100644 index 0000000000..cce17f1c60 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/sdl1/Makefile.linux @@ -0,0 +1,103 @@ +# 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 + + +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/contrib/sdk/sources/PDCurses/sdl1/README.md b/contrib/sdk/sources/PDCurses/sdl1/README.md new file mode 100644 index 0000000000..c46bd65e93 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/sdl1/README.md @@ -0,0 +1,185 @@ +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. + + +Distribution Status +------------------- + +The files in this directory are released to the public domain. + + +Acknowledgements +---------------- + +Original SDL port was provided by William McBrine +TTF support based on contributions by Laura Michaels diff --git a/contrib/sdk/sources/PDCurses/sdl1/pdcclip.c b/contrib/sdk/sources/PDCurses/sdl1/pdcclip.c new file mode 100644 index 0000000000..1cf64b7518 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/sdl1/pdcclip.c @@ -0,0 +1,131 @@ +/* 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 + + indicator of success/failure of call. + 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 + 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/contrib/sdk/sources/PDCurses/sdl1/pdcdisp.c b/contrib/sdk/sources/PDCurses/sdl1/pdcdisp.c new file mode 100644 index 0000000000..e25a6a6a1a --- /dev/null +++ b/contrib/sdk/sources/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/contrib/sdk/sources/PDCurses/sdl1/pdcgetsc.c b/contrib/sdk/sources/PDCurses/sdl1/pdcgetsc.c new file mode 100644 index 0000000000..3dd2e18029 --- /dev/null +++ b/contrib/sdk/sources/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/contrib/sdk/sources/PDCurses/sdl1/pdckbd.c b/contrib/sdk/sources/PDCurses/sdl1/pdckbd.c new file mode 100644 index 0000000000..ad40b6a55a --- /dev/null +++ b/contrib/sdk/sources/PDCurses/sdl1/pdckbd.c @@ -0,0 +1,375 @@ +/* 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; + + /* handle scroll wheel */ + + if ((btn >= 4 && btn <= 7) && action == BUTTON_RELEASED) + { + SP->mouse_status.x = SP->mouse_status.y = -1; + + 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); + } + } + + 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_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/contrib/sdk/sources/PDCurses/sdl1/pdcscrn.c b/contrib/sdk/sources/PDCurses/sdl1/pdcscrn.c new file mode 100644 index 0000000000..71873b2508 --- /dev/null +++ b/contrib/sdk/sources/PDCurses/sdl1/pdcscrn.c @@ -0,0 +1,364 @@ +/* PDCurses */ + +#include "pdcsdl.h" + +#include +#ifndef PDC_WIDE +#include "../common/font437.h" +#endif +#include "../common/iconbmp.h" + +#ifdef PDC_WIDE +# ifndef PDC_FONT_PATH +# define PDC_FONT_PATH "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf" +# 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/contrib/sdk/sources/PDCurses/sdl1/pdcsdl.h b/contrib/sdk/sources/PDCurses/sdl1/pdcsdl.h new file mode 100644 index 0000000000..e499efb1e6 --- /dev/null +++ b/contrib/sdk/sources/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/contrib/sdk/sources/PDCurses/sdl1/pdcsetsc.c b/contrib/sdk/sources/PDCurses/sdl1/pdcsetsc.c new file mode 100644 index 0000000000..8e3cc47bcc --- /dev/null +++ b/contrib/sdk/sources/PDCurses/sdl1/pdcsetsc.c @@ -0,0 +1,105 @@ +/* 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 + X/Open ncurses NetBSD + PDC_set_blink - - - + 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/contrib/sdk/sources/PDCurses/sdl1/pdcutil.c b/contrib/sdk/sources/PDCurses/sdl1/pdcutil.c new file mode 100644 index 0000000000..87674d4ccc --- /dev/null +++ b/contrib/sdk/sources/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/contrib/sdk/sources/PDCurses/sdl1/sdltest.c b/contrib/sdk/sources/PDCurses/sdl1/sdltest.c new file mode 100644 index 0000000000..ac8c9cb275 --- /dev/null +++ b/contrib/sdk/sources/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; +}