diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..04c16a8 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,55 @@ +name: test +on: [ push, pull_request ] + +jobs: + build: + strategy: + matrix: + os: [ ubuntu-20.04, macos-12 ] + arch: [ x86, x86_64 ] + dc: [ dmd-2.100.2, ldc-1.30.0 ] + exclude: + # No x86 on macOS + - os: macos-12 + arch: x86 + + runs-on: ${{ matrix.os }} + steps: + + - uses: actions/checkout@v2 + + - name: Install build dependencies (macOS) + if: ${{ matrix.os == 'macos-12' }} + run: brew install ncurses + + - name: Install build dependencies (Linux/x86) + if: ${{ matrix.os == 'ubuntu-20.04' && matrix.arch == 'x86' }} + run: | + sudo dpkg --add-architecture i386 + sudo apt-get update + sudo apt-get install -y binutils-i686-linux-gnu gcc-multilib libncurses-dev:i386 libz-dev:i386 libtinfo-dev:i386 + + - name: Install D compiler + uses: dlang-community/setup-dlang@43589c229861e1720e187a344c67dad1d9eefe4c + with: + compiler: ${{ matrix.dc }} + + - name: Build examples + run: | + for d in $(find examples -maxdepth 1 -mindepth 1 -type d) ; do + echo "=== $d ===" + dub --root="$d" build --arch=${{ matrix.arch }} + done + + syntax: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - name: Install D compiler + uses: dlang-community/setup-dlang@43589c229861e1720e187a344c67dad1d9eefe4c + with: + compiler: dmd-2.100.2 + + - name: Check syntax + run: dub lint --syntax-check diff --git a/.travis.yml b/.travis.yml deleted file mode 100755 index e76c224..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: d - -os: - - linux - - osx - -d: - - dmd - - ldc - - gdc - -matrix: - exclude: - - os: osx - d: gdc - -before_install: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ncurses; fi - -script: - - dub build - - dub build -c panels - - dub build -c full - - | - for E in examples/*/dub.json ; do - EXAMPLE="$(dirname ${E#*/})" - dub build "ncurses:$EXAMPLE" - done diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 01661ca..0000000 --- a/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -Jon "ylixir" Allen, ylixir@gmail.com -Dejan Lekic, dejan.lekic @ (gmail.com || kcl.ac.uk) -Jude "1100110" Young, 0b1100110@gmail.com diff --git a/C/curses.h b/C/curses.h index ab15e2b..8fd282c 100644 --- a/C/curses.h +++ b/C/curses.h @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,32 +33,76 @@ * and: Thomas E. Dickey 1996-on * ****************************************************************************/ -/* $Id: curses.h.in,v 1.215 2010/04/29 09:46:38 tom Exp $ */ +/* $Id: curses.h.in,v 1.277 2021/09/24 16:07:37 tom Exp $ */ #ifndef __NCURSES_H #define __NCURSES_H +/* + The symbols beginning NCURSES_ or USE_ are configuration choices. + A few of the former can be overridden by applications at compile-time. + Most of the others correspond to configure-script options (or checks + by the configure-script for features of the system on which it is built). + + These symbols can be overridden by applications at compile-time: + NCURSES_NOMACROS suppresses macro definitions in favor of functions + NCURSES_WATTR_MACROS suppresses wattr_* macro definitions + NCURSES_WIDECHAR is an alternative for declaring wide-character functions. + + These symbols are used only when building ncurses: + NCURSES_ATTR_T + NCURSES_FIELD_INTERNALS + NCURSES_INTERNALS + + These symbols are set by the configure script: + NCURSES_ENABLE_STDBOOL_H + NCURSES_EXPANDED + NCURSES_EXT_COLORS + NCURSES_EXT_FUNCS + NCURSES_EXT_PUTWIN + NCURSES_NO_PADDING + NCURSES_OSPEED_COMPAT + NCURSES_PATHSEP + NCURSES_REENTRANT + */ + #define CURSES 1 #define CURSES_H 1 /* These are defined only in curses.h, and are used for conditional compiles */ -#define NCURSES_VERSION_MAJOR 5 -#define NCURSES_VERSION_MINOR 7 -#define NCURSES_VERSION_PATCH 20101128 +#define NCURSES_VERSION_MAJOR 6 +#define NCURSES_VERSION_MINOR 3 +#define NCURSES_VERSION_PATCH 20211021 /* This is defined in more than one ncurses header, for identification */ #undef NCURSES_VERSION -#define NCURSES_VERSION "5.7" +#define NCURSES_VERSION "6.3" /* * Identify the mouse encoding version. */ -#define NCURSES_MOUSE_VERSION 1 +#define NCURSES_MOUSE_VERSION 2 /* * Definitions to facilitate DLL's. */ -#include +#include + +/* + * Extra headers. + */ +#if 1 +#include +#endif + +#ifdef __cplusplus +#else +#if 0 +#include +#undef GCC_NORETURN +#define GCC_NORETURN _Noreturn +#endif +#endif /* * User-definable tweak to disable the include of . @@ -70,12 +115,6 @@ * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses * configured using --disable-macros. */ -#ifdef NCURSES_NOMACROS -#ifndef NCURSES_ATTR_T -#define NCURSES_ATTR_T attr_t -#endif -#endif /* NCURSES_NOMACROS */ - #ifndef NCURSES_ATTR_T #define NCURSES_ATTR_T int #endif @@ -91,16 +130,37 @@ #define NCURSES_INLINE inline /* - * The internal type used for color values + * The standard type used for color values, and for color-pairs. The latter + * allows the curses library to enumerate the combinations of foreground and + * background colors used by an application, and is normally the product of the + * total foreground and background colors. + * + * X/Open uses "short" for both of these types, ultimately because they are + * numbers from the SVr4 terminal database, which uses 16-bit signed values. + */ +#undef NCURSES_COLOR_T +#define NCURSES_COLOR_T short + +#undef NCURSES_PAIRS_T +#define NCURSES_PAIRS_T short + +/* + * Definitions used to make WINDOW and similar structs opaque. */ -#undef NCURSES_COLOR_T -#define NCURSES_COLOR_T short +#ifndef NCURSES_INTERNALS +#define NCURSES_OPAQUE 0 +#define NCURSES_OPAQUE_FORM 0 +#define NCURSES_OPAQUE_MENU 0 +#define NCURSES_OPAQUE_PANEL 0 +#endif /* - * Definition used to make WINDOW and similar structs opaque. + * Definition used to optionally suppress wattr* macros to help with the + * transition from ncurses5 to ncurses6 by allowing the header files to + * be shared across development packages for ncursesw in both ABIs. */ -#ifndef NCURSES_OPAQUE -#define NCURSES_OPAQUE 0 +#ifndef NCURSES_WATTR_MACROS +#define NCURSES_WATTR_MACROS 0 #endif /* @@ -110,17 +170,25 @@ #define NCURSES_REENTRANT 0 #endif +/* + * In certain environments, we must work around linker problems for data + */ +#undef NCURSES_BROKEN_LINKER +#if 0 +#define NCURSES_BROKEN_LINKER 1 +#endif + /* * Control whether bindings for interop support are added. */ -#undef NCURSES_INTEROP_FUNCS -#define NCURSES_INTEROP_FUNCS 0 +#undef NCURSES_INTEROP_FUNCS +#define NCURSES_INTEROP_FUNCS 1 /* * The internal type used for window dimensions. */ -#undef NCURSES_SIZE_T -#define NCURSES_SIZE_T short +#undef NCURSES_SIZE_T +#define NCURSES_SIZE_T short /* * Control whether tparm() supports varargs or fixed-parameter list. @@ -128,20 +196,34 @@ #undef NCURSES_TPARM_VARARGS #define NCURSES_TPARM_VARARGS 1 +/* + * Control type used for tparm's arguments. While X/Open equates long and + * char* values, this is not always workable for 64-bit platforms. + */ +#undef NCURSES_TPARM_ARG +#define NCURSES_TPARM_ARG intptr_t + +/* + * Control whether ncurses uses wcwidth() for checking width of line-drawing + * characters. + */ +#undef NCURSES_WCWIDTH_GRAPHICS +#define NCURSES_WCWIDTH_GRAPHICS 1 + /* * NCURSES_CH_T is used in building the library, but not used otherwise in * this header file, since that would make the normal/wide-character versions * of the header incompatible. */ -#undef NCURSES_CH_T +#undef NCURSES_CH_T #define NCURSES_CH_T cchar_t -#if 0 && defined(_LP64) +#if 1 && defined(_LP64) typedef unsigned chtype; typedef unsigned mmask_t; #else -typedef unsigned long chtype; -typedef unsigned long mmask_t; +typedef uint32_t chtype; +typedef uint32_t mmask_t; #endif /* @@ -151,16 +233,22 @@ typedef unsigned long mmask_t; /* * With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or - * conflicting) when _XOPEN_SOURCE is 500 or greater. + * conflicting) when _XOPEN_SOURCE is 500 or greater. If NCURSES_WIDECHAR is + * not already defined, e.g., if the platform relies upon nonstandard feature + * test macros, define it at this point if the standard feature test macros + * indicate that it should be defined. */ -#undef NCURSES_WIDECHAR -#if defined(_XOPEN_SOURCE_EXTENDED) || defined(_XPG5) -#define NCURSES_WIDECHAR +#ifndef NCURSES_WIDECHAR +#if defined(_XOPEN_SOURCE_EXTENDED) || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500)) +#define NCURSES_WIDECHAR 1 +#else +#define NCURSES_WIDECHAR 0 #endif +#endif /* NCURSES_WIDECHAR */ -#include /* we need va_list */ -#ifdef NCURSES_WIDECHAR -#include /* we want wchar_t */ +#include /* we need va_list */ +#if NCURSES_WIDECHAR +#include /* we want wchar_t */ #endif /* X/Open and SVr4 specify that curses implements 'bool'. However, C++ may also @@ -183,12 +271,12 @@ typedef unsigned long mmask_t; typedef unsigned char NCURSES_BOOL; -#if defined(__cplusplus) /* __cplusplus, etc. */ +#if defined(__cplusplus) /* __cplusplus, etc. */ /* use the C++ compiler's bool type */ #define NCURSES_BOOL bool -#else /* c89, c99, etc. */ +#else /* c89, c99, etc. */ #if NCURSES_ENABLE_STDBOOL_H #include @@ -209,37 +297,43 @@ extern "C" { #define NCURSES_CAST(type,value) (type)(value) #endif +#define NCURSES_OK_ADDR(p) (0 != NCURSES_CAST(const void *, (p))) + /* * X/Open attributes. In the ncurses implementation, they are identical to the * A_ attributes. */ -#define WA_ATTRIBUTES A_ATTRIBUTES -#define WA_NORMAL A_NORMAL -#define WA_STANDOUT A_STANDOUT -#define WA_UNDERLINE A_UNDERLINE -#define WA_REVERSE A_REVERSE -#define WA_BLINK A_BLINK -#define WA_DIM A_DIM -#define WA_BOLD A_BOLD -#define WA_ALTCHARSET A_ALTCHARSET -#define WA_INVIS A_INVIS -#define WA_PROTECT A_PROTECT -#define WA_HORIZONTAL A_HORIZONTAL -#define WA_LEFT A_LEFT -#define WA_LOW A_LOW -#define WA_RIGHT A_RIGHT -#define WA_TOP A_TOP -#define WA_VERTICAL A_VERTICAL +#define WA_ATTRIBUTES A_ATTRIBUTES +#define WA_NORMAL A_NORMAL +#define WA_STANDOUT A_STANDOUT +#define WA_UNDERLINE A_UNDERLINE +#define WA_REVERSE A_REVERSE +#define WA_BLINK A_BLINK +#define WA_DIM A_DIM +#define WA_BOLD A_BOLD +#define WA_ALTCHARSET A_ALTCHARSET +#define WA_INVIS A_INVIS +#define WA_PROTECT A_PROTECT +#define WA_HORIZONTAL A_HORIZONTAL +#define WA_LEFT A_LEFT +#define WA_LOW A_LOW +#define WA_RIGHT A_RIGHT +#define WA_TOP A_TOP +#define WA_VERTICAL A_VERTICAL + +#if 1 +#define WA_ITALIC A_ITALIC /* ncurses extension */ +#endif /* colors */ -#define COLOR_BLACK 0 -#define COLOR_RED 1 -#define COLOR_GREEN 2 -#define COLOR_YELLOW 3 -#define COLOR_BLUE 4 -#define COLOR_MAGENTA 5 -#define COLOR_CYAN 6 -#define COLOR_WHITE 7 +#define COLOR_BLACK 0 +#define COLOR_RED 1 +#define COLOR_GREEN 2 +#define COLOR_YELLOW 3 +#define COLOR_BLUE 4 +#define COLOR_MAGENTA 5 +#define COLOR_CYAN 6 +#define COLOR_WHITE 7 /* line graphics */ @@ -250,47 +344,47 @@ NCURSES_WRAPPED_VAR(chtype*, acs_map); extern NCURSES_EXPORT_VAR(chtype) acs_map[]; #endif -#define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char,c)]) +#define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char,(c))]) /* VT100 symbols begin here */ -#define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */ -#define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */ -#define ACS_URCORNER NCURSES_ACS('k') /* upper right corner */ -#define ACS_LRCORNER NCURSES_ACS('j') /* lower right corner */ -#define ACS_LTEE NCURSES_ACS('t') /* tee pointing right */ -#define ACS_RTEE NCURSES_ACS('u') /* tee pointing left */ -#define ACS_BTEE NCURSES_ACS('v') /* tee pointing up */ -#define ACS_TTEE NCURSES_ACS('w') /* tee pointing down */ -#define ACS_HLINE NCURSES_ACS('q') /* horizontal line */ -#define ACS_VLINE NCURSES_ACS('x') /* vertical line */ -#define ACS_PLUS NCURSES_ACS('n') /* large plus or crossover */ -#define ACS_S1 NCURSES_ACS('o') /* scan line 1 */ -#define ACS_S9 NCURSES_ACS('s') /* scan line 9 */ -#define ACS_DIAMOND NCURSES_ACS('`') /* diamond */ -#define ACS_CKBOARD NCURSES_ACS('a') /* checker board (stipple) */ -#define ACS_DEGREE NCURSES_ACS('f') /* degree symbol */ -#define ACS_PLMINUS NCURSES_ACS('g') /* plus/minus */ -#define ACS_BULLET NCURSES_ACS('~') /* bullet */ +#define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */ +#define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */ +#define ACS_URCORNER NCURSES_ACS('k') /* upper right corner */ +#define ACS_LRCORNER NCURSES_ACS('j') /* lower right corner */ +#define ACS_LTEE NCURSES_ACS('t') /* tee pointing right */ +#define ACS_RTEE NCURSES_ACS('u') /* tee pointing left */ +#define ACS_BTEE NCURSES_ACS('v') /* tee pointing up */ +#define ACS_TTEE NCURSES_ACS('w') /* tee pointing down */ +#define ACS_HLINE NCURSES_ACS('q') /* horizontal line */ +#define ACS_VLINE NCURSES_ACS('x') /* vertical line */ +#define ACS_PLUS NCURSES_ACS('n') /* large plus or crossover */ +#define ACS_S1 NCURSES_ACS('o') /* scan line 1 */ +#define ACS_S9 NCURSES_ACS('s') /* scan line 9 */ +#define ACS_DIAMOND NCURSES_ACS('`') /* diamond */ +#define ACS_CKBOARD NCURSES_ACS('a') /* checker board (stipple) */ +#define ACS_DEGREE NCURSES_ACS('f') /* degree symbol */ +#define ACS_PLMINUS NCURSES_ACS('g') /* plus/minus */ +#define ACS_BULLET NCURSES_ACS('~') /* bullet */ /* Teletype 5410v1 symbols begin here */ -#define ACS_LARROW NCURSES_ACS(',') /* arrow pointing left */ -#define ACS_RARROW NCURSES_ACS('+') /* arrow pointing right */ -#define ACS_DARROW NCURSES_ACS('.') /* arrow pointing down */ -#define ACS_UARROW NCURSES_ACS('-') /* arrow pointing up */ -#define ACS_BOARD NCURSES_ACS('h') /* board of squares */ -#define ACS_LANTERN NCURSES_ACS('i') /* lantern symbol */ -#define ACS_BLOCK NCURSES_ACS('0') /* solid square block */ +#define ACS_LARROW NCURSES_ACS(',') /* arrow pointing left */ +#define ACS_RARROW NCURSES_ACS('+') /* arrow pointing right */ +#define ACS_DARROW NCURSES_ACS('.') /* arrow pointing down */ +#define ACS_UARROW NCURSES_ACS('-') /* arrow pointing up */ +#define ACS_BOARD NCURSES_ACS('h') /* board of squares */ +#define ACS_LANTERN NCURSES_ACS('i') /* lantern symbol */ +#define ACS_BLOCK NCURSES_ACS('0') /* solid square block */ /* * These aren't documented, but a lot of System Vs have them anyway * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings). * The ACS_names may not match AT&T's, our source didn't know them. */ -#define ACS_S3 NCURSES_ACS('p') /* scan line 3 */ -#define ACS_S7 NCURSES_ACS('r') /* scan line 7 */ -#define ACS_LEQUAL NCURSES_ACS('y') /* less/equal */ -#define ACS_GEQUAL NCURSES_ACS('z') /* greater/equal */ -#define ACS_PI NCURSES_ACS('{') /* Pi */ -#define ACS_NEQUAL NCURSES_ACS('|') /* not equal */ -#define ACS_STERLING NCURSES_ACS('}') /* UK pound sign */ +#define ACS_S3 NCURSES_ACS('p') /* scan line 3 */ +#define ACS_S7 NCURSES_ACS('r') /* scan line 7 */ +#define ACS_LEQUAL NCURSES_ACS('y') /* less/equal */ +#define ACS_GEQUAL NCURSES_ACS('z') /* greater/equal */ +#define ACS_PI NCURSES_ACS('{') /* Pi */ +#define ACS_NEQUAL NCURSES_ACS('|') /* not equal */ +#define ACS_STERLING NCURSES_ACS('}') /* UK pound sign */ /* * Line drawing ACS names are of the form ACS_trbl, where t is the top, r @@ -298,32 +392,32 @@ extern NCURSES_EXPORT_VAR(chtype) acs_map[]; * be B (blank), S (single), D (double), or T (thick). The subset defined * here only uses B and S. */ -#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 - -#undef ERR +#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 + +#undef ERR #define ERR (-1) -#undef OK +#undef OK #define OK (0) /* values for the _flags member */ -#define _SUBWIN 0x01 /* is this a sub-window? */ -#define _ENDLINE 0x02 /* is the window flush right? */ -#define _FULLWIN 0x04 /* is the window full-screen? */ -#define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */ -#define _ISPAD 0x10 /* is this window a pad? */ -#define _HASMOVED 0x20 /* has cursor moved since last refresh? */ -#define _WRAPPED 0x40 /* cursor was just wrappped */ +#define _SUBWIN 0x01 /* is this a sub-window? */ +#define _ENDLINE 0x02 /* is the window flush right? */ +#define _FULLWIN 0x04 /* is the window full-screen? */ +#define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */ +#define _ISPAD 0x10 /* is this window a pad? */ +#define _HASMOVED 0x20 /* has cursor moved since last refresh? */ +#define _WRAPPED 0x40 /* cursor was just wrappped */ /* * this value is used in the firstchar and lastchar fields to mark @@ -335,24 +429,31 @@ extern NCURSES_EXPORT_VAR(chtype) acs_map[]; * this value is used in the oldindex field to mark lines created by insertions * and scrolls. */ -#define _NEWINDEX -1 +#define _NEWINDEX -1 +#ifdef NCURSES_INTERNALS +#undef SCREEN +#define SCREEN struct screen +SCREEN; +#else typedef struct screen SCREEN; +#endif + typedef struct _win_st WINDOW; -typedef chtype attr_t; /* ...must be at least as wide as chtype */ +typedef chtype attr_t; /* ...must be at least as wide as chtype */ -#ifdef NCURSES_WIDECHAR +#if NCURSES_WIDECHAR #if 0 -#ifdef mblen /* libutf8.h defines it w/o undefining first */ +#ifdef mblen /* libutf8.h defines it w/o undefining first */ #undef mblen #endif #include #endif #if 1 -#include /* ...to get mbstate_t, etc. */ +#include /* ...to get mbstate_t, etc. */ #endif #if 0 @@ -369,15 +470,15 @@ typedef unsigned int wint_t1; * (spacing and nonspacing) do not fill the array, a null L'\0' follows. * Otherwise, a null is assumed to follow when extracting via getcchar(). */ -#define CCHARW_MAX 5 +#define CCHARW_MAX 5 typedef struct { - attr_t attr; - wchar_t chars[CCHARW_MAX]; -#if 0 + attr_t attr; + wchar_t chars[CCHARW_MAX]; +#if 1 #undef NCURSES_EXT_COLORS -#define NCURSES_EXT_COLORS 20101128 - int ext_color; /* color pair, must be more than 16-bits */ +#define NCURSES_EXT_COLORS 20211021 + int ext_color; /* color pair, must be more than 16-bits */ #endif } cchar_t; @@ -389,109 +490,60 @@ struct ldat; struct _win_st { - NCURSES_SIZE_T _cury, _curx; /* current cursor position */ - - /* window location and size */ - NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */ - NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */ - - short _flags; /* window state flags */ - - /* attribute tracking */ - attr_t _attrs; /* current attribute for non-space character */ - chtype _bkgd; /* current background char/attribute pair */ - - /* option values set by user */ - bool _notimeout; /* no time out on function-key entry? */ - bool _clear; /* consider all data in the window invalid? */ - bool _leaveok; /* OK to not reset cursor on exit? */ - bool _scroll; /* OK to scroll this window? */ - bool _idlok; /* OK to use insert/delete line? */ - bool _idcok; /* OK to use insert/delete char? */ - bool _immed; /* window in immed mode? (not yet used) */ - bool _sync; /* window in sync mode? */ - bool _use_keypad; /* process function keys into KEY_ symbols? */ - int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ - - struct ldat *_line; /* the actual line data */ - - /* global screen state */ - NCURSES_SIZE_T _regtop; /* top line of scrolling region */ - NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */ - - /* these are used only if this is a sub-window */ - int _parx; /* x coordinate of this window in parent */ - int _pary; /* y coordinate of this window in parent */ - WINDOW *_parent; /* pointer to parent if a sub-window */ - - /* these are used only if this is a pad */ - struct pdat - { - NCURSES_SIZE_T _pad_y, _pad_x; - NCURSES_SIZE_T _pad_top, _pad_left; - NCURSES_SIZE_T _pad_bottom, _pad_right; - } _pad; - - NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ - -#ifdef NCURSES_WIDECHAR - cchar_t _bkgrnd; /* current background char/attribute pair */ -#if 0 - int _color; /* current color-pair for non-space character */ + NCURSES_SIZE_T _cury, _curx; /* current cursor position */ + + /* window location and size */ + NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */ + NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */ + + short _flags; /* window state flags */ + + /* attribute tracking */ + attr_t _attrs; /* current attribute for non-space character */ + chtype _bkgd; /* current background char/attribute pair */ + + /* option values set by user */ + bool _notimeout; /* no time out on function-key entry? */ + bool _clear; /* consider all data in the window invalid? */ + bool _leaveok; /* OK to not reset cursor on exit? */ + bool _scroll; /* OK to scroll this window? */ + bool _idlok; /* OK to use insert/delete line? */ + bool _idcok; /* OK to use insert/delete char? */ + bool _immed; /* window in immed mode? (not yet used) */ + bool _sync; /* window in sync mode? */ + bool _use_keypad; /* process function keys into KEY_ symbols? */ + int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ + + struct ldat *_line; /* the actual line data */ + + /* global screen state */ + NCURSES_SIZE_T _regtop; /* top line of scrolling region */ + NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */ + + /* these are used only if this is a sub-window */ + int _parx; /* x coordinate of this window in parent */ + int _pary; /* y coordinate of this window in parent */ + WINDOW *_parent; /* pointer to parent if a sub-window */ + + /* these are used only if this is a pad */ + struct pdat + { + NCURSES_SIZE_T _pad_y, _pad_x; + NCURSES_SIZE_T _pad_top, _pad_left; + NCURSES_SIZE_T _pad_bottom, _pad_right; + } _pad; + + NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ + +#if NCURSES_WIDECHAR + cchar_t _bkgrnd; /* current background char/attribute pair */ +#if 1 + int _color; /* current color-pair for non-space character */ #endif #endif }; #endif /* NCURSES_OPAQUE */ -/* - * This is an extension to support events... - */ -#if 1 -#ifdef NCURSES_WGETCH_EVENTS -#if !defined(__BEOS__) || defined(__HAIKU__) - /* Fix _nc_timed_wait() on BEOS... */ -# define NCURSES_EVENT_VERSION 1 -#endif /* !defined(__BEOS__) */ - -/* - * Bits to set in _nc_event.data.flags - */ -# define _NC_EVENT_TIMEOUT_MSEC 1 -# define _NC_EVENT_FILE 2 -# define _NC_EVENT_FILE_READABLE 2 -# if 0 /* Not supported yet... */ -# define _NC_EVENT_FILE_WRITABLE 4 -# define _NC_EVENT_FILE_EXCEPTION 8 -# endif - -typedef struct -{ - int type; - union - { - long timeout_msec; /* _NC_EVENT_TIMEOUT_MSEC */ - struct - { - unsigned int flags; - int fd; - unsigned int result; - } fev; /* _NC_EVENT_FILE */ - } data; -} _nc_event; - -typedef struct -{ - int count; - int result_flags; /* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */ - _nc_event *events[1]; -} _nc_eventlist; - -extern NCURSES_EXPORT(int) wgetch_events (WINDOW *, _nc_eventlist *); /* experimental */ -extern NCURSES_EXPORT(int) wgetnstr_events (WINDOW *,char *,int,_nc_eventlist *);/* experimental */ - -#endif /* NCURSES_WGETCH_EVENTS */ -#endif /* NCURSES_EXT_FUNCS */ - /* * GCC (and some other compilers) define '__attribute__'; we're using this * macro to alert the compiler to flag inconsistencies in printf/scanf-like @@ -505,14 +557,10 @@ extern NCURSES_EXPORT(int) wgetnstr_events (WINDOW *,char *,int,_nc_eventlist *) /* * We cannot define these in ncurses_cfg.h, since they require parameters to be - * passed (that is non-portable). If you happen to be using gcc with warnings - * enabled, define - * GCC_PRINTF - * GCC_SCANF - * to improve checking of calls to printw(), etc. + * passed (that is non-portable). */ #ifndef GCC_PRINTFLIKE -#if defined(GCC_PRINTF) && !defined(printf) +#ifndef printf #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) #else #define GCC_PRINTFLIKE(fmt,var) /*nothing*/ @@ -520,19 +568,26 @@ extern NCURSES_EXPORT(int) wgetnstr_events (WINDOW *,char *,int,_nc_eventlist *) #endif #ifndef GCC_SCANFLIKE -#if defined(GCC_SCANF) && !defined(scanf) +#ifndef scanf #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) #else #define GCC_SCANFLIKE(fmt,var) /*nothing*/ #endif #endif -#ifndef GCC_NORETURN -#define GCC_NORETURN /* nothing */ +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ #endif -#ifndef GCC_UNUSED -#define GCC_UNUSED /* nothing */ +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif + +#undef GCC_DEPRECATED +#if (__GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 >= 2)) && !defined(NCURSES_INTERNALS) +#define GCC_DEPRECATED(msg) __attribute__((deprecated)) +#else +#define GCC_DEPRECATED(msg) /* nothing */ #endif /* @@ -548,316 +603,317 @@ typedef int (*NCURSES_OUTC)(int); * requirements. */ -extern NCURSES_EXPORT(int) addch (const chtype); /* generated */ -extern NCURSES_EXPORT(int) addchnstr (const chtype *, int); /* generated */ -extern NCURSES_EXPORT(int) addchstr (const chtype *); /* generated */ -extern NCURSES_EXPORT(int) addnstr (const char *, int); /* generated */ -extern NCURSES_EXPORT(int) addstr (const char *); /* generated */ -extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */ -extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */ -extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */ -extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *); /* generated */ -extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */ -extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */ -extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *); /* generated */ -extern NCURSES_EXPORT(int) baudrate (void); /* implemented */ -extern NCURSES_EXPORT(int) beep (void); /* implemented */ -extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */ -extern NCURSES_EXPORT(void) bkgdset (chtype); /* generated */ -extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */ -extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */ -extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */ -extern NCURSES_EXPORT(int) cbreak (void); /* implemented */ -extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *); /* generated */ -extern NCURSES_EXPORT(int) clear (void); /* generated */ -extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */ -extern NCURSES_EXPORT(int) clrtobot (void); /* generated */ -extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */ -extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*); /* implemented */ -extern NCURSES_EXPORT(int) color_set (short,void*); /* generated */ -extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */ -extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */ -extern NCURSES_EXPORT(int) curs_set (int); /* implemented */ -extern NCURSES_EXPORT(int) def_prog_mode (void); /* implemented */ -extern NCURSES_EXPORT(int) def_shell_mode (void); /* implemented */ -extern NCURSES_EXPORT(int) delay_output (int); /* implemented */ -extern NCURSES_EXPORT(int) delch (void); /* generated */ -extern NCURSES_EXPORT(void) delscreen (SCREEN *); /* implemented */ -extern NCURSES_EXPORT(int) delwin (WINDOW *); /* implemented */ -extern NCURSES_EXPORT(int) deleteln (void); /* generated */ -extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int); /* implemented */ -extern NCURSES_EXPORT(int) doupdate (void); /* implemented */ -extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *); /* implemented */ -extern NCURSES_EXPORT(int) echo (void); /* implemented */ -extern NCURSES_EXPORT(int) echochar (const chtype); /* generated */ -extern NCURSES_EXPORT(int) erase (void); /* generated */ -extern NCURSES_EXPORT(int) endwin (void); /* implemented */ -extern NCURSES_EXPORT(char) erasechar (void); /* implemented */ -extern NCURSES_EXPORT(void) filter (void); /* implemented */ -extern NCURSES_EXPORT(int) flash (void); /* implemented */ -extern NCURSES_EXPORT(int) flushinp (void); /* implemented */ -extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *); /* generated */ -extern NCURSES_EXPORT(int) getch (void); /* generated */ -extern NCURSES_EXPORT(int) getnstr (char *, int); /* generated */ -extern NCURSES_EXPORT(int) getstr (char *); /* generated */ -extern NCURSES_EXPORT(WINDOW *) getwin (FILE *); /* implemented */ -extern NCURSES_EXPORT(int) halfdelay (int); /* implemented */ -extern NCURSES_EXPORT(bool) has_colors (void); /* implemented */ -extern NCURSES_EXPORT(bool) has_ic (void); /* implemented */ -extern NCURSES_EXPORT(bool) has_il (void); /* implemented */ -extern NCURSES_EXPORT(int) hline (chtype, int); /* generated */ -extern NCURSES_EXPORT(void) idcok (WINDOW *, bool); /* implemented */ -extern NCURSES_EXPORT(int) idlok (WINDOW *, bool); /* implemented */ -extern NCURSES_EXPORT(void) immedok (WINDOW *, bool); /* implemented */ -extern NCURSES_EXPORT(chtype) inch (void); /* generated */ -extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */ -extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */ -extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */ -extern NCURSES_EXPORT(int) init_color (short,short,short,short); /* implemented */ -extern NCURSES_EXPORT(int) init_pair (short,short,short); /* implemented */ -extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */ -extern NCURSES_EXPORT(int) insch (chtype); /* generated */ -extern NCURSES_EXPORT(int) insdelln (int); /* generated */ -extern NCURSES_EXPORT(int) insertln (void); /* generated */ -extern NCURSES_EXPORT(int) insnstr (const char *, int); /* generated */ -extern NCURSES_EXPORT(int) insstr (const char *); /* generated */ -extern NCURSES_EXPORT(int) instr (char *); /* generated */ -extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool); /* implemented */ -extern NCURSES_EXPORT(bool) isendwin (void); /* implemented */ -extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int); /* implemented */ -extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *); /* implemented */ -extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int); /* implemented */ -extern NCURSES_EXPORT(int) keypad (WINDOW *,bool); /* implemented */ -extern NCURSES_EXPORT(char) killchar (void); /* implemented */ -extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool); /* implemented */ -extern NCURSES_EXPORT(char *) longname (void); /* implemented */ -extern NCURSES_EXPORT(int) meta (WINDOW *,bool); /* implemented */ -extern NCURSES_EXPORT(int) move (int, int); /* generated */ -extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype); /* generated */ -extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int); /* generated */ -extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */ -extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */ -extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */ -extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *); /* generated */ -extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */ -extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */ -extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */ -extern NCURSES_EXPORT(int) mvgetch (int, int); /* generated */ -extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int); /* generated */ -extern NCURSES_EXPORT(int) mvgetstr (int, int, char *); /* generated */ -extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int); /* generated */ -extern NCURSES_EXPORT(chtype) mvinch (int, int); /* generated */ -extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int); /* generated */ -extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *); /* generated */ -extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int); /* generated */ -extern NCURSES_EXPORT(int) mvinsch (int, int, chtype); /* generated */ -extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int); /* generated */ -extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *); /* generated */ -extern NCURSES_EXPORT(int) mvinstr (int, int, char *); /* generated */ -extern NCURSES_EXPORT(int) mvprintw (int,int, const char *,...) /* implemented */ - GCC_PRINTFLIKE(3,4); -extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...) /* implemented */ - GCC_SCANFLIKE(3,4); -extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int); /* generated */ -extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) addch (const chtype); /* generated */ +extern NCURSES_EXPORT(int) addchnstr (const chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) addchstr (const chtype *); /* generated */ +extern NCURSES_EXPORT(int) addnstr (const char *, int); /* generated */ +extern NCURSES_EXPORT(int) addstr (const char *); /* generated */ +extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attr_get (attr_t *, NCURSES_PAIRS_T *, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_set (attr_t, NCURSES_PAIRS_T, void *); /* generated */ +extern NCURSES_EXPORT(int) baudrate (void); /* implemented */ +extern NCURSES_EXPORT(int) beep (void); /* implemented */ +extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */ +extern NCURSES_EXPORT(void) bkgdset (chtype); /* generated */ +extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */ +extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */ +extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */ +extern NCURSES_EXPORT(int) cbreak (void); /* implemented */ +extern NCURSES_EXPORT(int) chgat (int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */ +extern NCURSES_EXPORT(int) clear (void); /* generated */ +extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) clrtobot (void); /* generated */ +extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */ +extern NCURSES_EXPORT(int) color_content (NCURSES_COLOR_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) color_set (NCURSES_PAIRS_T,void*); /* generated */ +extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */ +extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) curs_set (int); /* implemented */ +extern NCURSES_EXPORT(int) def_prog_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) def_shell_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) delay_output (int); /* implemented */ +extern NCURSES_EXPORT(int) delch (void); /* generated */ +extern NCURSES_EXPORT(void) delscreen (SCREEN *); /* implemented */ +extern NCURSES_EXPORT(int) delwin (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) deleteln (void); /* generated */ +extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) doupdate (void); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) echo (void); /* implemented */ +extern NCURSES_EXPORT(int) echochar (const chtype); /* generated */ +extern NCURSES_EXPORT(int) erase (void); /* generated */ +extern NCURSES_EXPORT(int) endwin (void); /* implemented */ +extern NCURSES_EXPORT(char) erasechar (void); /* implemented */ +extern NCURSES_EXPORT(void) filter (void); /* implemented */ +extern NCURSES_EXPORT(int) flash (void); /* implemented */ +extern NCURSES_EXPORT(int) flushinp (void); /* implemented */ +extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getch (void); /* generated */ +extern NCURSES_EXPORT(int) getnstr (char *, int); /* generated */ +extern NCURSES_EXPORT(int) getstr (char *); /* generated */ +extern NCURSES_EXPORT(WINDOW *) getwin (FILE *); /* implemented */ +extern NCURSES_EXPORT(int) halfdelay (int); /* implemented */ +extern NCURSES_EXPORT(bool) has_colors (void); /* implemented */ +extern NCURSES_EXPORT(bool) has_ic (void); /* implemented */ +extern NCURSES_EXPORT(bool) has_il (void); /* implemented */ +extern NCURSES_EXPORT(int) hline (chtype, int); /* generated */ +extern NCURSES_EXPORT(void) idcok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(int) idlok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(void) immedok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) inch (void); /* generated */ +extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */ +extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */ +extern NCURSES_EXPORT(int) init_color (NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) init_pair (NCURSES_PAIRS_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */ +extern NCURSES_EXPORT(int) insch (chtype); /* generated */ +extern NCURSES_EXPORT(int) insdelln (int); /* generated */ +extern NCURSES_EXPORT(int) insertln (void); /* generated */ +extern NCURSES_EXPORT(int) insnstr (const char *, int); /* generated */ +extern NCURSES_EXPORT(int) insstr (const char *); /* generated */ +extern NCURSES_EXPORT(int) instr (char *); /* generated */ +extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(bool) isendwin (void); /* implemented */ +extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int); /* implemented */ +extern NCURSES_EXPORT(int) keypad (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(char) killchar (void); /* implemented */ +extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(char *) longname (void); /* implemented */ +extern NCURSES_EXPORT(int) meta (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) move (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */ +extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvgetch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetstr (int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(chtype) mvinch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsch (int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvinstr (int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvprintw (int,int, const char *,...) /* implemented */ + GCC_PRINTFLIKE(3,4); +extern NCURSES_EXPORT(int) mvscanw (int,int, const char *,...) /* implemented */ + GCC_SCANFLIKE(3,4); +extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype); /* generated */ extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */ -extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */ -extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */ -extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */ -extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */ -extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */ -extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */ -extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */ -extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *); /* generated */ -extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int); /* generated */ -extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int); /* implemented */ -extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int); /* generated */ -extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int); /* generated */ -extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *); /* generated */ -extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int); /* generated */ -extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype); /* generated */ -extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int); /* generated */ -extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *); /* generated */ -extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *); /* generated */ -extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, const char *,...) /* implemented */ - GCC_PRINTFLIKE(4,5); -extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...) /* implemented */ - GCC_SCANFLIKE(4,5); -extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int); /* generated */ -extern NCURSES_EXPORT(int) napms (int); /* implemented */ -extern NCURSES_EXPORT(WINDOW *) newpad (int,int); /* implemented */ -extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *); /* implemented */ -extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int); /* implemented */ -extern NCURSES_EXPORT(int) nl (void); /* implemented */ -extern NCURSES_EXPORT(int) nocbreak (void); /* implemented */ -extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool); /* implemented */ -extern NCURSES_EXPORT(int) noecho (void); /* implemented */ -extern NCURSES_EXPORT(int) nonl (void); /* implemented */ -extern NCURSES_EXPORT(void) noqiflush (void); /* implemented */ -extern NCURSES_EXPORT(int) noraw (void); /* implemented */ -extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool); /* implemented */ -extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *); /* implemented */ -extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *); /* implemented */ -extern NCURSES_EXPORT(int) pair_content (short,short*,short*); /* implemented */ -extern NCURSES_EXPORT(int) PAIR_NUMBER (int); /* generated */ -extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, NCURSES_PAIRS_T, const void *);/* generated */ +extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, const char *,...) /* implemented */ + GCC_PRINTFLIKE(4,5); +extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, const char *,...) /* implemented */ + GCC_SCANFLIKE(4,5); +extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) napms (int); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) newpad (int,int); /* implemented */ +extern NCURSES_EXPORT(SCREEN *) newterm (const char *,FILE *,FILE *); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) nl (void); /* implemented */ +extern NCURSES_EXPORT(int) nocbreak (void); /* implemented */ +extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) noecho (void); /* implemented */ +extern NCURSES_EXPORT(int) nonl (void); /* implemented */ +extern NCURSES_EXPORT(void) noqiflush (void); /* implemented */ +extern NCURSES_EXPORT(int) noraw (void); /* implemented */ +extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) pair_content (NCURSES_PAIRS_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) PAIR_NUMBER (int); /* generated */ +extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype); /* implemented */ extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */ -extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int); /* implemented */ -extern NCURSES_EXPORT(int) printw (const char *,...) /* implemented */ - GCC_PRINTFLIKE(1,2); -extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *); /* implemented */ -extern NCURSES_EXPORT(void) qiflush (void); /* implemented */ -extern NCURSES_EXPORT(int) raw (void); /* implemented */ -extern NCURSES_EXPORT(int) redrawwin (WINDOW *); /* generated */ -extern NCURSES_EXPORT(int) refresh (void); /* generated */ -extern NCURSES_EXPORT(int) resetty (void); /* implemented */ -extern NCURSES_EXPORT(int) reset_prog_mode (void); /* implemented */ -extern NCURSES_EXPORT(int) reset_shell_mode (void); /* implemented */ -extern NCURSES_EXPORT(int) ripoffline (int, int (*)(WINDOW *, int)); /* implemented */ -extern NCURSES_EXPORT(int) savetty (void); /* implemented */ -extern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...) /* implemented */ - GCC_SCANFLIKE(1,2); -extern NCURSES_EXPORT(int) scr_dump (const char *); /* implemented */ -extern NCURSES_EXPORT(int) scr_init (const char *); /* implemented */ -extern NCURSES_EXPORT(int) scrl (int); /* generated */ -extern NCURSES_EXPORT(int) scroll (WINDOW *); /* generated */ -extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool); /* implemented */ -extern NCURSES_EXPORT(int) scr_restore (const char *); /* implemented */ -extern NCURSES_EXPORT(int) scr_set (const char *); /* implemented */ -extern NCURSES_EXPORT(int) setscrreg (int,int); /* generated */ -extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *); /* implemented */ -extern NCURSES_EXPORT(int) slk_attroff (const chtype); /* implemented */ -extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) slk_attron (const chtype); /* implemented */ -extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) slk_attrset (const chtype); /* implemented */ -extern NCURSES_EXPORT(attr_t) slk_attr (void); /* implemented */ -extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*); /* implemented */ -extern NCURSES_EXPORT(int) slk_clear (void); /* implemented */ -extern NCURSES_EXPORT(int) slk_color (short); /* implemented */ -extern NCURSES_EXPORT(int) slk_init (int); /* implemented */ -extern NCURSES_EXPORT(char *) slk_label (int); /* implemented */ -extern NCURSES_EXPORT(int) slk_noutrefresh (void); /* implemented */ -extern NCURSES_EXPORT(int) slk_refresh (void); /* implemented */ -extern NCURSES_EXPORT(int) slk_restore (void); /* implemented */ -extern NCURSES_EXPORT(int) slk_set (int,const char *,int); /* implemented */ -extern NCURSES_EXPORT(int) slk_touch (void); /* implemented */ -extern NCURSES_EXPORT(int) standout (void); /* generated */ -extern NCURSES_EXPORT(int) standend (void); /* generated */ -extern NCURSES_EXPORT(int) start_color (void); /* implemented */ -extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int); /* implemented */ -extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *, int, int, int, int); /* implemented */ -extern NCURSES_EXPORT(int) syncok (WINDOW *, bool); /* implemented */ -extern NCURSES_EXPORT(chtype) termattrs (void); /* implemented */ -extern NCURSES_EXPORT(char *) termname (void); /* implemented */ -extern NCURSES_EXPORT(void) timeout (int); /* generated */ -extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int); /* generated */ -extern NCURSES_EXPORT(int) touchwin (WINDOW *); /* generated */ -extern NCURSES_EXPORT(int) typeahead (int); /* implemented */ -extern NCURSES_EXPORT(int) ungetch (int); /* implemented */ -extern NCURSES_EXPORT(int) untouchwin (WINDOW *); /* generated */ -extern NCURSES_EXPORT(void) use_env (bool); /* implemented */ -extern NCURSES_EXPORT(int) vidattr (chtype); /* implemented */ -extern NCURSES_EXPORT(int) vidputs (chtype, NCURSES_OUTC); /* implemented */ - -extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */ -extern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *,va_list); /* implemented */ -extern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *,va_list); /* generated */ -extern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ -extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list); /* generated */ -extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype); /* implemented */ -extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *,int); /* implemented */ -extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *); /* generated */ -extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *,int); /* implemented */ -extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *); /* generated */ -extern NCURSES_EXPORT(int) wattron (WINDOW *, int); /* generated */ -extern NCURSES_EXPORT(int) wattroff (WINDOW *, int); /* generated */ -extern NCURSES_EXPORT(int) wattrset (WINDOW *, int); /* generated */ -extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *); /* generated */ -extern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *); /* implemented */ -extern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *); /* implemented */ -extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *); /* generated */ -extern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype); /* implemented */ -extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype); /* implemented */ -extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */ -extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */ -extern NCURSES_EXPORT(int) wclear (WINDOW *); /* implemented */ -extern NCURSES_EXPORT(int) wclrtobot (WINDOW *); /* implemented */ -extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *); /* implemented */ -extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*); /* implemented */ -extern NCURSES_EXPORT(void) wcursyncup (WINDOW *); /* implemented */ -extern NCURSES_EXPORT(int) wdelch (WINDOW *); /* implemented */ -extern NCURSES_EXPORT(int) wdeleteln (WINDOW *); /* generated */ -extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype); /* implemented */ -extern NCURSES_EXPORT(int) werase (WINDOW *); /* implemented */ -extern NCURSES_EXPORT(int) wgetch (WINDOW *); /* implemented */ -extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int); /* implemented */ -extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *); /* generated */ -extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int); /* implemented */ -extern NCURSES_EXPORT(chtype) winch (WINDOW *); /* implemented */ -extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int); /* implemented */ -extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *); /* generated */ -extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int); /* implemented */ -extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype); /* implemented */ -extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int); /* implemented */ -extern NCURSES_EXPORT(int) winsertln (WINDOW *); /* generated */ -extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int); /* implemented */ -extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *); /* generated */ -extern NCURSES_EXPORT(int) winstr (WINDOW *, char *); /* generated */ -extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int); /* implemented */ -extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *); /* implemented */ -extern NCURSES_EXPORT(int) wprintw (WINDOW *, const char *,...) /* implemented */ - GCC_PRINTFLIKE(2,3); -extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int); /* implemented */ -extern NCURSES_EXPORT(int) wrefresh (WINDOW *); /* implemented */ -extern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...) /* implemented */ - GCC_SCANFLIKE(2,3); -extern NCURSES_EXPORT(int) wscrl (WINDOW *,int); /* implemented */ -extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int); /* implemented */ -extern NCURSES_EXPORT(int) wstandout (WINDOW *); /* generated */ -extern NCURSES_EXPORT(int) wstandend (WINDOW *); /* generated */ -extern NCURSES_EXPORT(void) wsyncdown (WINDOW *); /* implemented */ -extern NCURSES_EXPORT(void) wsyncup (WINDOW *); /* implemented */ -extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int); /* implemented */ -extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int); /* implemented */ -extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ +extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) printw (const char *,...) /* implemented */ + GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *); /* implemented */ +extern NCURSES_EXPORT(void) qiflush (void); /* implemented */ +extern NCURSES_EXPORT(int) raw (void); /* implemented */ +extern NCURSES_EXPORT(int) redrawwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) refresh (void); /* generated */ +extern NCURSES_EXPORT(int) resetty (void); /* implemented */ +extern NCURSES_EXPORT(int) reset_prog_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) reset_shell_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) ripoffline (int, int (*)(WINDOW *, int)); /* implemented */ +extern NCURSES_EXPORT(int) savetty (void); /* implemented */ +extern NCURSES_EXPORT(int) scanw (const char *,...) /* implemented */ + GCC_SCANFLIKE(1,2); +extern NCURSES_EXPORT(int) scr_dump (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_init (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scrl (int); /* generated */ +extern NCURSES_EXPORT(int) scroll (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) scr_restore (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_set (const char *); /* implemented */ +extern NCURSES_EXPORT(int) setscrreg (int,int); /* generated */ +extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *); /* implemented */ +extern NCURSES_EXPORT(int) slk_attroff (const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attron (const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attrset (const chtype); /* implemented */ +extern NCURSES_EXPORT(attr_t) slk_attr (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,NCURSES_PAIRS_T,void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_clear (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_color (NCURSES_PAIRS_T); /* implemented */ +extern NCURSES_EXPORT(int) slk_init (int); /* implemented */ +extern NCURSES_EXPORT(char *) slk_label (int); /* implemented */ +extern NCURSES_EXPORT(int) slk_noutrefresh (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_refresh (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_restore (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_set (int,const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) slk_touch (void); /* implemented */ +extern NCURSES_EXPORT(int) standout (void); /* generated */ +extern NCURSES_EXPORT(int) standend (void); /* generated */ +extern NCURSES_EXPORT(int) start_color (void); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) syncok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) termattrs (void); /* implemented */ +extern NCURSES_EXPORT(char *) termname (void); /* implemented */ +extern NCURSES_EXPORT(void) timeout (int); /* generated */ +extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) touchwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) typeahead (int); /* implemented */ +extern NCURSES_EXPORT(int) ungetch (int); /* implemented */ +extern NCURSES_EXPORT(int) untouchwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(void) use_env (bool); /* implemented */ +extern NCURSES_EXPORT(void) use_tioctl (bool); /* implemented */ +extern NCURSES_EXPORT(int) vidattr (chtype); /* implemented */ +extern NCURSES_EXPORT(int) vidputs (chtype, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */ +extern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *, va_list) GCC_DEPRECATED(use vw_printw) /* implemented */ + GCC_PRINTFLIKE(2,0); +extern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *, va_list) /* implemented */ + GCC_PRINTFLIKE(2,0); +extern NCURSES_EXPORT(int) vwscanw (WINDOW *, const char *, va_list) GCC_DEPRECATED(use vw_scanw) /* implemented */ + GCC_SCANFLIKE(2,0); +extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, const char *, va_list) /* implemented */ + GCC_SCANFLIKE(2,0); +extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *,int); /* implemented */ +extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *); /* generated */ +extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *); /* generated */ +extern NCURSES_EXPORT(int) wattron (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattroff (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattrset (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, NCURSES_PAIRS_T *, void *); /* generated */ +extern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *); /* implemented */ +extern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *); /* implemented */ +extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, NCURSES_PAIRS_T, void *); /* generated */ +extern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype); /* implemented */ +extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype); /* implemented */ +extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */ +extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, NCURSES_PAIRS_T, const void *);/* implemented */ +extern NCURSES_EXPORT(int) wclear (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wclrtobot (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,NCURSES_PAIRS_T,void*); /* implemented */ +extern NCURSES_EXPORT(void) wcursyncup (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wdelch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wdeleteln (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) werase (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wgetch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int); /* implemented */ +extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *); /* generated */ +extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int); /* implemented */ +extern NCURSES_EXPORT(chtype) winch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int); /* implemented */ +extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *); /* generated */ +extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int); /* implemented */ +extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype); /* implemented */ +extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) winsertln (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *); /* generated */ +extern NCURSES_EXPORT(int) winstr (WINDOW *, char *); /* generated */ +extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wprintw (WINDOW *, const char *,...) /* implemented */ + GCC_PRINTFLIKE(2,3); +extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wrefresh (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wscanw (WINDOW *, const char *,...) /* implemented */ + GCC_SCANFLIKE(2,3); +extern NCURSES_EXPORT(int) wscrl (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wstandout (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wstandend (WINDOW *); /* generated */ +extern NCURSES_EXPORT(void) wsyncdown (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(void) wsyncup (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ /* - * These are also declared in : + * These are also declared in : */ - //TODO implement? till end. -extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); /* implemented */ -extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); /* implemented */ -extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *); /* implemented */ -extern NCURSES_EXPORT(int) putp (const char *); /* implemented */ +extern NCURSES_EXPORT(int) tigetflag (const char *); /* implemented */ +extern NCURSES_EXPORT(int) tigetnum (const char *); /* implemented */ +extern NCURSES_EXPORT(char *) tigetstr (const char *); /* implemented */ +extern NCURSES_EXPORT(int) putp (const char *); /* implemented */ #if NCURSES_TPARM_VARARGS -extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */ +extern NCURSES_EXPORT(char *) tparm (const char *, ...); /* special */ #else -extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */ -extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */ +extern NCURSES_EXPORT(char *) tparm (const char *, NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG); /* special */ #endif -extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */ +extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */ /* * These functions are not in X/Open, but we use them in macro definitions: */ -extern NCURSES_EXPORT(int) getattrs (const WINDOW *); /* generated */ -//end -extern NCURSES_EXPORT(int) getcurx (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(int) getcury (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(int) getbegx (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(int) getbegy (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(int) getmaxx (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(int) getmaxy (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(int) getparx (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(int) getpary (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getattrs (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getcurx (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getcury (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getbegx (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getbegy (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getmaxx (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getmaxy (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getparx (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getpary (const WINDOW *); /* generated */ /* * vid_attr() was implemented originally based on a draft of X/Open curses. */ -#ifndef NCURSES_WIDECHAR +#if !NCURSES_WIDECHAR #define vid_attr(a,pair,opts) vidattr(a) #endif @@ -866,30 +922,35 @@ extern NCURSES_EXPORT(int) getpary (const WINDOW *); /* generated */ */ #if 1 #undef NCURSES_EXT_FUNCS -#define NCURSES_EXT_FUNCS 20101128 +#define NCURSES_EXT_FUNCS 20211021 typedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *); typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *); extern NCURSES_EXPORT(bool) is_term_resized (int, int); extern NCURSES_EXPORT(char *) keybound (int, int); extern NCURSES_EXPORT(const char *) curses_version (void); +extern NCURSES_EXPORT(int) alloc_pair (int, int); extern NCURSES_EXPORT(int) assume_default_colors (int, int); extern NCURSES_EXPORT(int) define_key (const char *, int); -//TODO implement +extern NCURSES_EXPORT(int) extended_color_content(int, int *, int *, int *); +extern NCURSES_EXPORT(int) extended_pair_content(int, int *, int *); +extern NCURSES_EXPORT(int) extended_slk_color(int); +extern NCURSES_EXPORT(int) find_pair (int, int); +extern NCURSES_EXPORT(int) free_pair (int); extern NCURSES_EXPORT(int) get_escdelay (void); +extern NCURSES_EXPORT(int) init_extended_color(int, int, int, int); +extern NCURSES_EXPORT(int) init_extended_pair(int, int, int); extern NCURSES_EXPORT(int) key_defined (const char *); extern NCURSES_EXPORT(int) keyok (int, bool); +extern NCURSES_EXPORT(void) reset_color_pairs (void); extern NCURSES_EXPORT(int) resize_term (int, int); extern NCURSES_EXPORT(int) resizeterm (int, int); extern NCURSES_EXPORT(int) set_escdelay (int); extern NCURSES_EXPORT(int) set_tabsize (int); -//end extern NCURSES_EXPORT(int) use_default_colors (void); extern NCURSES_EXPORT(int) use_extended_names (bool); -//TODO implement extern NCURSES_EXPORT(int) use_legacy_coding (int); extern NCURSES_EXPORT(int) use_screen (SCREEN *, NCURSES_SCREEN_CB, void *); extern NCURSES_EXPORT(int) use_window (WINDOW *, NCURSES_WINDOW_CB, void *); -//end extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int); extern NCURSES_EXPORT(void) nofilter(void); @@ -897,22 +958,22 @@ extern NCURSES_EXPORT(void) nofilter(void); * These extensions provide access to information stored in the WINDOW even * when NCURSES_OPAQUE is set: */ - //TODO implement -extern NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(bool) is_cleared (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(bool) is_idcok (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(bool) is_idlok (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(bool) is_immedok (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(bool) is_keypad (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(bool) is_leaveok (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(bool) is_nodelay (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(bool) is_notimeout (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(bool) is_pad (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(bool) is_subwin (const WINDOW *); /* generated */ -extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_cleared (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_idcok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_idlok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_immedok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_keypad (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_leaveok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_nodelay (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_notimeout (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_pad (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_subwin (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wgetdelay (const WINDOW *); /* generated */ extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generated */ -//end + #else #define curses_version() NCURSES_VERSION #endif @@ -921,21 +982,23 @@ extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generat * Extra extension-functions, which pass a SCREEN pointer rather than using * a global variable SP. */ -#if 0 +#if 1 #undef NCURSES_SP_FUNCS -#define NCURSES_SP_FUNCS 20101128 +#define NCURSES_SP_FUNCS 20211021 #define NCURSES_SP_NAME(name) name##_sp /* Define the sp-funcs helper function */ #define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC) typedef int (*NCURSES_SP_OUTC)(SCREEN*, int); + extern NCURSES_EXPORT(SCREEN *) new_prescr (void); /* implemented:SP_FUNC */ + extern NCURSES_EXPORT(int) NCURSES_SP_NAME(baudrate) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(beep) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(can_change_color) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(cbreak) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(curs_set) (SCREEN*, int); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content) (SCREEN*, short, short*, short*, short*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_prog_mode) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_shell_mode) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(delay_output) (SCREEN*, int); /* implemented:SP_FUNC */ @@ -946,14 +1009,14 @@ extern NCURSES_EXPORT(char) NCURSES_SP_NAME(erasechar) (SCREEN*);/* implemented: extern NCURSES_EXPORT(void) NCURSES_SP_NAME(filter) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(flash) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(flushinp) (SCREEN*); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(getwin) (SCREEN*, FILE *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(getwin) (SCREEN*, FILE *); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(halfdelay) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_colors) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_ic) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_il) (SCREEN*); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color) (SCREEN*, short, short, short, short); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair) (SCREEN*, short, short, short); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(intrflush) (SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color) (SCREEN*, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(intrflush) (SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(isendwin) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(keyname) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(char) NCURSES_SP_NAME(killchar) (SCREEN*); /* implemented:SP_FUNC */ @@ -961,7 +1024,7 @@ extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(longname) (SCREEN*); /* implemente extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mvcur) (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(napms) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newpad) (SCREEN*, int, int); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(SCREEN *) NCURSES_SP_NAME(newterm) (SCREEN*, NCURSES_CONST char *, FILE *, FILE *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(SCREEN *) NCURSES_SP_NAME(newterm) (SCREEN*, const char *, FILE *, FILE *); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newwin) (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nl) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nocbreak) (SCREEN*); /* implemented:SP_FUNC */ @@ -969,13 +1032,13 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noecho) (SCREEN*); /* implemented:SP_ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nonl) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(void) NCURSES_SP_NAME(noqiflush) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noraw) (SCREEN*); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content) (SCREEN*, short, short*, short*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(void) NCURSES_SP_NAME(qiflush) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(raw) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_prog_mode) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_shell_mode) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resetty) (SCREEN*); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ripoffline) (SCREEN*, int, int (*)(WINDOW *, int)); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ripoffline) (SCREEN*, int, int (*)(WINDOW *, int)); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(savetty) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_init) (SCREEN*, const char *); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_restore) (SCREEN*, const char *); /* implemented:SP_FUNC */ @@ -984,9 +1047,9 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attroff) (SCREEN*, const chtype); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attron) (SCREEN*, const chtype); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attrset) (SCREEN*, const chtype); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(slk_attr) (SCREEN*); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set) (SCREEN*, const attr_t, short, void*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set) (SCREEN*, const attr_t, NCURSES_PAIRS_T, void*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_clear) (SCREEN*); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_color) (SCREEN*, short); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_color) (SCREEN*, NCURSES_PAIRS_T); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_init) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(slk_label) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_noutrefresh) (SCREEN*); /* implemented:SP_FUNC */ @@ -1000,23 +1063,33 @@ extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(termname) (SCREEN*); /* implemente extern NCURSES_EXPORT(int) NCURSES_SP_NAME(typeahead) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetch) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_env) (SCREEN*, bool); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidattr) (SCREEN*, chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_tioctl) (SCREEN*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidattr) (SCREEN*, chtype); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidputs) (SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ #if 1 -extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(keybound) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(assume_default_colors) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(define_key) (SCREEN*, const char *, int); /* implemented:EXT_SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(get_escdelay) (SCREEN*); /* implemented:EXT_SP_FUNC */ -extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(is_term_resized) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(key_defined) (SCREEN*, const char *); /* implemented:EXT_SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(keyok) (SCREEN*, int, bool); /* implemented:EXT_SP_FUNC */ -extern NCURSES_EXPORT(void) NCURSES_SP_NAME(nofilter) (SCREEN*); /* implemented */ /* implemented:EXT_SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resize_term) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resizeterm) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_escdelay) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_tabsize) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_default_colors) (SCREEN*); /* implemented:EXT_SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(keybound) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(alloc_pair) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(assume_default_colors) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(define_key) (SCREEN*, const char *, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_color_content) (SCREEN*, int, int *, int *, int *); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_pair_content) (SCREEN*, int, int *, int *); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_slk_color) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(get_escdelay) (SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(find_pair) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(free_pair) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_extended_color) (SCREEN*, int, int, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_extended_pair) (SCREEN*, int, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(is_term_resized) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(key_defined) (SCREEN*, const char *); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(keyok) (SCREEN*, int, bool); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(nofilter) (SCREEN*); /* implemented */ /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(reset_color_pairs) (SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resize_term) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resizeterm) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_escdelay) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_tabsize) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_default_colors) (SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ #endif #else #undef NCURSES_SP_FUNCS @@ -1028,27 +1101,31 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /* attributes */ #define NCURSES_ATTR_SHIFT 8 -#define NCURSES_BITS(mask,shift) ((mask) << ((shift) + NCURSES_ATTR_SHIFT)) - -#define A_NORMAL (1UL - 1UL) -#define A_ATTRIBUTES NCURSES_BITS(~(1UL - 1UL),0) -#define A_CHARTEXT (NCURSES_BITS(1UL,0) - 1UL) -#define A_COLOR NCURSES_BITS(((1UL) << 8) - 1UL,0) -#define A_STANDOUT NCURSES_BITS(1UL,8) -#define A_UNDERLINE NCURSES_BITS(1UL,9) -#define A_REVERSE NCURSES_BITS(1UL,10) -#define A_BLINK NCURSES_BITS(1UL,11) -#define A_DIM NCURSES_BITS(1UL,12) -#define A_BOLD NCURSES_BITS(1UL,13) -#define A_ALTCHARSET NCURSES_BITS(1UL,14) -#define A_INVIS NCURSES_BITS(1UL,15) -#define A_PROTECT NCURSES_BITS(1UL,16) -#define A_HORIZONTAL NCURSES_BITS(1UL,17) -#define A_LEFT NCURSES_BITS(1UL,18) -#define A_LOW NCURSES_BITS(1UL,19) -#define A_RIGHT NCURSES_BITS(1UL,20) -#define A_TOP NCURSES_BITS(1UL,21) -#define A_VERTICAL NCURSES_BITS(1UL,22) +#define NCURSES_BITS(mask,shift) (NCURSES_CAST(chtype,(mask)) << ((shift) + NCURSES_ATTR_SHIFT)) + +#define A_NORMAL (1U - 1U) +#define A_ATTRIBUTES NCURSES_BITS(~(1U - 1U),0) +#define A_CHARTEXT (NCURSES_BITS(1U,0) - 1U) +#define A_COLOR NCURSES_BITS(((1U) << 8) - 1U,0) +#define A_STANDOUT NCURSES_BITS(1U,8) +#define A_UNDERLINE NCURSES_BITS(1U,9) +#define A_REVERSE NCURSES_BITS(1U,10) +#define A_BLINK NCURSES_BITS(1U,11) +#define A_DIM NCURSES_BITS(1U,12) +#define A_BOLD NCURSES_BITS(1U,13) +#define A_ALTCHARSET NCURSES_BITS(1U,14) +#define A_INVIS NCURSES_BITS(1U,15) +#define A_PROTECT NCURSES_BITS(1U,16) +#define A_HORIZONTAL NCURSES_BITS(1U,17) +#define A_LEFT NCURSES_BITS(1U,18) +#define A_LOW NCURSES_BITS(1U,19) +#define A_RIGHT NCURSES_BITS(1U,20) +#define A_TOP NCURSES_BITS(1U,21) +#define A_VERTICAL NCURSES_BITS(1U,22) + +#if 1 +#define A_ITALIC NCURSES_BITS(1U,23) /* ncurses extension */ +#endif /* * Most of the pseudo functions are macros that either provide compatibility @@ -1060,28 +1137,28 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); * These pseudo functions are always implemented as macros: */ -#define getyx(win,y,x) (y = getcury(win), x = getcurx(win)) -#define getbegyx(win,y,x) (y = getbegy(win), x = getbegx(win)) -#define getmaxyx(win,y,x) (y = getmaxy(win), x = getmaxx(win)) -#define getparyx(win,y,x) (y = getpary(win), x = getparx(win)) +#define getyx(win,y,x) (y = getcury(win), x = getcurx(win)) +#define getbegyx(win,y,x) (y = getbegy(win), x = getbegx(win)) +#define getmaxyx(win,y,x) (y = getmaxy(win), x = getmaxx(win)) +#define getparyx(win,y,x) (y = getpary(win), x = getparx(win)) #define getsyx(y,x) do { if (newscr) { \ - if (is_leaveok(newscr)) \ - (y) = (x) = -1; \ - else \ - getyx(newscr,(y), (x)); \ - } \ - } while(0) + if (is_leaveok(newscr)) \ + (y) = (x) = -1; \ + else \ + getyx(newscr,(y), (x)); \ + } \ + } while(0) #define setsyx(y,x) do { if (newscr) { \ - if ((y) == -1 && (x) == -1) \ - leaveok(newscr, TRUE); \ - else { \ - leaveok(newscr, FALSE); \ - wmove(newscr, (y), (x)); \ - } \ - } \ - } while(0) + if ((y) == -1 && (x) == -1) \ + leaveok(newscr, TRUE); \ + else { \ + leaveok(newscr, FALSE); \ + wmove(newscr, (y), (x)); \ + } \ + } \ + } while(0) #ifndef NCURSES_NOMACROS @@ -1089,199 +1166,230 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); * These miscellaneous pseudo functions are provided for compatibility: */ -#define wgetstr(w, s) wgetnstr(w, s, -1) -#define getnstr(s, n) wgetnstr(stdscr, s, n) -//TODO -#define setterm(term) setupterm(term, 1, (int *)0) +#define wgetstr(w, s) wgetnstr(w, s, -1) +#define getnstr(s, n) wgetnstr(stdscr, s, (n)) + +#define setterm(term) setupterm(term, 1, (int *)0) -#define fixterm() reset_prog_mode() -#define resetterm() reset_shell_mode() -#define saveterm() def_prog_mode() -#define crmode() cbreak() -#define nocrmode() nocbreak() +#define fixterm() reset_prog_mode() +#define resetterm() reset_shell_mode() +#define saveterm() def_prog_mode() +#define crmode() cbreak() +#define nocrmode() nocbreak() #define gettmode() /* It seems older SYSV curses versions define these */ #if !NCURSES_OPAQUE -#define getattrs(win) ((win) ? (win)->_attrs : A_NORMAL) -#define getcurx(win) ((win) ? (win)->_curx : ERR) -#define getcury(win) ((win) ? (win)->_cury : ERR) -#define getbegx(win) ((win) ? (win)->_begx : ERR) -#define getbegy(win) ((win) ? (win)->_begy : ERR) -#define getmaxx(win) ((win) ? ((win)->_maxx + 1) : ERR) -#define getmaxy(win) ((win) ? ((win)->_maxy + 1) : ERR) -#define getparx(win) ((win) ? (win)->_parx : ERR) -#define getpary(win) ((win) ? (win)->_pary : ERR) +#define getattrs(win) NCURSES_CAST(int, NCURSES_OK_ADDR(win) ? (win)->_attrs : A_NORMAL) +#define getcurx(win) (NCURSES_OK_ADDR(win) ? (win)->_curx : ERR) +#define getcury(win) (NCURSES_OK_ADDR(win) ? (win)->_cury : ERR) +#define getbegx(win) (NCURSES_OK_ADDR(win) ? (win)->_begx : ERR) +#define getbegy(win) (NCURSES_OK_ADDR(win) ? (win)->_begy : ERR) +#define getmaxx(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxx + 1) : ERR) +#define getmaxy(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxy + 1) : ERR) +#define getparx(win) (NCURSES_OK_ADDR(win) ? (win)->_parx : ERR) +#define getpary(win) (NCURSES_OK_ADDR(win) ? (win)->_pary : ERR) #endif /* NCURSES_OPAQUE */ -#define wstandout(win) (wattrset(win,A_STANDOUT)) -#define wstandend(win) (wattrset(win,A_NORMAL)) +#define wstandout(win) (wattrset(win,A_STANDOUT)) +#define wstandend(win) (wattrset(win,A_NORMAL)) -#define wattron(win,at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL) -#define wattroff(win,at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL) +#define wattron(win,at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL) +#define wattroff(win,at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL) #if !NCURSES_OPAQUE -#if defined(NCURSES_WIDECHAR) && 0 -#define wattrset(win,at) ((win) \ - ? ((win)->_color = PAIR_NUMBER(at), \ - (win)->_attrs = (at), \ - OK) \ - : ERR) +#if NCURSES_WATTR_MACROS +#if NCURSES_WIDECHAR && 1 +#define wattrset(win,at) \ + (NCURSES_OK_ADDR(win) \ + ? ((win)->_color = NCURSES_CAST(int, PAIR_NUMBER(at)), \ + (win)->_attrs = NCURSES_CAST(attr_t, at), \ + OK) \ + : ERR) #else -#define wattrset(win,at) ((win) \ - ? ((win)->_attrs = (at), \ - OK) \ - : ERR) +#define wattrset(win,at) \ + (NCURSES_OK_ADDR(win) \ + ? ((win)->_attrs = NCURSES_CAST(attr_t, at), \ + OK) \ + : ERR) #endif +#endif /* NCURSES_WATTR_MACROS */ #endif /* NCURSES_OPAQUE */ -#define scroll(win) wscrl(win,1) +#define scroll(win) wscrl(win,1) -#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1) -#define touchline(win, s, c) wtouchln((win), s, c, 1) -#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0) +#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1) +#define touchline(win, s, c) wtouchln((win), s, c, 1) +#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0) -#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0) -#define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) -#define hline(ch, n) whline(stdscr, ch, n) -#define vline(ch, n) wvline(stdscr, ch, n) +#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0) +#define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) +#define hline(ch, n) whline(stdscr, ch, (n)) +#define vline(ch, n) wvline(stdscr, ch, (n)) -#define winstr(w, s) winnstr(w, s, -1) -#define winchstr(w, s) winchnstr(w, s, -1) -#define winsstr(w, s) winsnstr(w, s, -1) +#define winstr(w, s) winnstr(w, s, -1) +#define winchstr(w, s) winchnstr(w, s, -1) +#define winsstr(w, s) winsnstr(w, s, -1) #if !NCURSES_OPAQUE -#define redrawwin(win) wredrawln(win, 0, (win)->_maxy+1) +#define redrawwin(win) wredrawln(win, 0, (NCURSES_OK_ADDR(win) ? (win)->_maxy+1 : -1)) #endif /* NCURSES_OPAQUE */ -#define waddstr(win,str) waddnstr(win,str,-1) -#define waddchstr(win,str) waddchnstr(win,str,-1) +#define waddstr(win,str) waddnstr(win,str,-1) +#define waddchstr(win,str) waddchnstr(win,str,-1) /* * These apply to the first 256 color pairs. */ -#define COLOR_PAIR(n) NCURSES_BITS(n, 0) -#define PAIR_NUMBER(a) (NCURSES_CAST(int,(((a) & A_COLOR) >> NCURSES_ATTR_SHIFT))) +#define COLOR_PAIR(n) (NCURSES_BITS((n), 0) & A_COLOR) +#define PAIR_NUMBER(a) (NCURSES_CAST(int,((NCURSES_CAST(unsigned long,(a)) & A_COLOR) >> NCURSES_ATTR_SHIFT))) /* * pseudo functions for standard screen */ -#define addch(ch) waddch(stdscr,ch) -#define addchnstr(str,n) waddchnstr(stdscr,str,n) -#define addchstr(str) waddchstr(stdscr,str) -#define addnstr(str,n) waddnstr(stdscr,str,n) -#define addstr(str) waddnstr(stdscr,str,-1) -#define attroff(at) wattroff(stdscr,at) -#define attron(at) wattron(stdscr,at) -#define attrset(at) wattrset(stdscr,at) -#define attr_get(ap,cp,o) wattr_get(stdscr,ap,cp,o) -#define attr_off(a,o) wattr_off(stdscr,a,o) -#define attr_on(a,o) wattr_on(stdscr,a,o) -#define attr_set(a,c,o) wattr_set(stdscr,a,c,o) -#define bkgd(ch) wbkgd(stdscr,ch) -#define bkgdset(ch) wbkgdset(stdscr,ch) -#define chgat(n,a,c,o) wchgat(stdscr,n,a,c,o) -#define clear() wclear(stdscr) -#define clrtobot() wclrtobot(stdscr) -#define clrtoeol() wclrtoeol(stdscr) -#define color_set(c,o) wcolor_set(stdscr,c,o) -#define delch() wdelch(stdscr) -#define deleteln() winsdelln(stdscr,-1) -#define echochar(c) wechochar(stdscr,c) -#define erase() werase(stdscr) -#define getch() wgetch(stdscr) -#define getstr(str) wgetstr(stdscr,str) -#define inch() winch(stdscr) -#define inchnstr(s,n) winchnstr(stdscr,s,n) -#define inchstr(s) winchstr(stdscr,s) -#define innstr(s,n) winnstr(stdscr,s,n) -#define insch(c) winsch(stdscr,c) -#define insdelln(n) winsdelln(stdscr,n) -#define insertln() winsdelln(stdscr,1) -#define insnstr(s,n) winsnstr(stdscr,s,n) -#define insstr(s) winsstr(stdscr,s) -#define instr(s) winstr(stdscr,s) -#define move(y,x) wmove(stdscr,y,x) -#define refresh() wrefresh(stdscr) -#define scrl(n) wscrl(stdscr,n) -#define setscrreg(t,b) wsetscrreg(stdscr,t,b) -#define standend() wstandend(stdscr) -#define standout() wstandout(stdscr) -#define timeout(delay) wtimeout(stdscr,delay) -#define wdeleteln(win) winsdelln(win,-1) -#define winsertln(win) winsdelln(win,1) +#define addch(ch) waddch(stdscr,(ch)) +#define addchnstr(str,n) waddchnstr(stdscr,(str),(n)) +#define addchstr(str) waddchstr(stdscr,(str)) +#define addnstr(str,n) waddnstr(stdscr,(str),(n)) +#define addstr(str) waddnstr(stdscr,(str),-1) +#define attr_get(ap,cp,o) wattr_get(stdscr,(ap),(cp),(o)) +#define attr_off(a,o) wattr_off(stdscr,(a),(o)) +#define attr_on(a,o) wattr_on(stdscr,(a),(o)) +#define attr_set(a,c,o) wattr_set(stdscr,(a),(c),(o)) +#define attroff(at) wattroff(stdscr,(at)) +#define attron(at) wattron(stdscr,(at)) +#define attrset(at) wattrset(stdscr,(at)) +#define bkgd(ch) wbkgd(stdscr,(ch)) +#define bkgdset(ch) wbkgdset(stdscr,(ch)) +#define chgat(n,a,c,o) wchgat(stdscr,(n),(a),(c),(o)) +#define clear() wclear(stdscr) +#define clrtobot() wclrtobot(stdscr) +#define clrtoeol() wclrtoeol(stdscr) +#define color_set(c,o) wcolor_set(stdscr,(c),(o)) +#define delch() wdelch(stdscr) +#define deleteln() winsdelln(stdscr,-1) +#define echochar(c) wechochar(stdscr,(c)) +#define erase() werase(stdscr) +#define getch() wgetch(stdscr) +#define getstr(str) wgetstr(stdscr,(str)) +#define inch() winch(stdscr) +#define inchnstr(s,n) winchnstr(stdscr,(s),(n)) +#define inchstr(s) winchstr(stdscr,(s)) +#define innstr(s,n) winnstr(stdscr,(s),(n)) +#define insch(c) winsch(stdscr,(c)) +#define insdelln(n) winsdelln(stdscr,(n)) +#define insertln() winsdelln(stdscr,1) +#define insnstr(s,n) winsnstr(stdscr,(s),(n)) +#define insstr(s) winsstr(stdscr,(s)) +#define instr(s) winstr(stdscr,(s)) +#define move(y,x) wmove(stdscr,(y),(x)) +#define refresh() wrefresh(stdscr) +#define scrl(n) wscrl(stdscr,(n)) +#define setscrreg(t,b) wsetscrreg(stdscr,(t),(b)) +#define standend() wstandend(stdscr) +#define standout() wstandout(stdscr) +#define timeout(delay) wtimeout(stdscr,(delay)) +#define wdeleteln(win) winsdelln(win,-1) +#define winsertln(win) winsdelln(win,1) /* * mv functions */ -#define mvwaddch(win,y,x,ch) (wmove(win,y,x) == ERR ? ERR : waddch(win,ch)) -#define mvwaddchnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n)) -#define mvwaddchstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1)) -#define mvwaddnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n)) -#define mvwaddstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1)) -#define mvwdelch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wdelch(win)) -#define mvwchgat(win,y,x,n,a,c,o) (wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o)) -#define mvwgetch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wgetch(win)) -#define mvwgetnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n)) -#define mvwgetstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : wgetstr(win,str)) -#define mvwhline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : whline(win,c,n)) -#define mvwinch(win,y,x) (wmove(win,y,x) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win)) -#define mvwinchnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n)) -#define mvwinchstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winchstr(win,s)) -#define mvwinnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n)) -#define mvwinsch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winsch(win,c)) -#define mvwinsnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n)) -#define mvwinsstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winsstr(win,s)) -#define mvwinstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winstr(win,s)) -#define mvwvline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : wvline(win,c,n)) - -#define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch) -#define mvaddchnstr(y,x,str,n) mvwaddchnstr(stdscr,y,x,str,n) -#define mvaddchstr(y,x,str) mvwaddchstr(stdscr,y,x,str) -#define mvaddnstr(y,x,str,n) mvwaddnstr(stdscr,y,x,str,n) -#define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str) -#define mvchgat(y,x,n,a,c,o) mvwchgat(stdscr,y,x,n,a,c,o) -#define mvdelch(y,x) mvwdelch(stdscr,y,x) -#define mvgetch(y,x) mvwgetch(stdscr,y,x) -#define mvgetnstr(y,x,str,n) mvwgetnstr(stdscr,y,x,str,n) -#define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str) -#define mvhline(y,x,c,n) mvwhline(stdscr,y,x,c,n) -#define mvinch(y,x) mvwinch(stdscr,y,x) -#define mvinchnstr(y,x,s,n) mvwinchnstr(stdscr,y,x,s,n) -#define mvinchstr(y,x,s) mvwinchstr(stdscr,y,x,s) -#define mvinnstr(y,x,s,n) mvwinnstr(stdscr,y,x,s,n) -#define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c) -#define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,y,x,s,n) -#define mvinsstr(y,x,s) mvwinsstr(stdscr,y,x,s) -#define mvinstr(y,x,s) mvwinstr(stdscr,y,x,s) -#define mvvline(y,x,c,n) mvwvline(stdscr,y,x,c,n) +#define mvwaddch(win,y,x,ch) (wmove((win),(y),(x)) == ERR ? ERR : waddch((win),(ch))) +#define mvwaddchnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),(n))) +#define mvwaddchstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),-1)) +#define mvwaddnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),(n))) +#define mvwaddstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),-1)) +#define mvwchgat(win,y,x,n,a,c,o) (wmove((win),(y),(x)) == ERR ? ERR : wchgat((win),(n),(a),(c),(o))) +#define mvwdelch(win,y,x) (wmove((win),(y),(x)) == ERR ? ERR : wdelch(win)) +#define mvwgetch(win,y,x) (wmove((win),(y),(x)) == ERR ? ERR : wgetch(win)) +#define mvwgetnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : wgetnstr((win),(str),(n))) +#define mvwgetstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : wgetstr((win),(str))) +#define mvwhline(win,y,x,c,n) (wmove((win),(y),(x)) == ERR ? ERR : whline((win),(c),(n))) +#define mvwinch(win,y,x) (wmove((win),(y),(x)) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win)) +#define mvwinchnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winchnstr((win),(s),(n))) +#define mvwinchstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winchstr((win),(s))) +#define mvwinnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winnstr((win),(s),(n))) +#define mvwinsch(win,y,x,c) (wmove((win),(y),(x)) == ERR ? ERR : winsch((win),(c))) +#define mvwinsnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winsnstr((win),(s),(n))) +#define mvwinsstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winsstr((win),(s))) +#define mvwinstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winstr((win),(s))) +#define mvwvline(win,y,x,c,n) (wmove((win),(y),(x)) == ERR ? ERR : wvline((win),(c),(n))) + +#define mvaddch(y,x,ch) mvwaddch(stdscr,(y),(x),(ch)) +#define mvaddchnstr(y,x,str,n) mvwaddchnstr(stdscr,(y),(x),(str),(n)) +#define mvaddchstr(y,x,str) mvwaddchstr(stdscr,(y),(x),(str)) +#define mvaddnstr(y,x,str,n) mvwaddnstr(stdscr,(y),(x),(str),(n)) +#define mvaddstr(y,x,str) mvwaddstr(stdscr,(y),(x),(str)) +#define mvchgat(y,x,n,a,c,o) mvwchgat(stdscr,(y),(x),(n),(a),(c),(o)) +#define mvdelch(y,x) mvwdelch(stdscr,(y),(x)) +#define mvgetch(y,x) mvwgetch(stdscr,(y),(x)) +#define mvgetnstr(y,x,str,n) mvwgetnstr(stdscr,(y),(x),(str),(n)) +#define mvgetstr(y,x,str) mvwgetstr(stdscr,(y),(x),(str)) +#define mvhline(y,x,c,n) mvwhline(stdscr,(y),(x),(c),(n)) +#define mvinch(y,x) mvwinch(stdscr,(y),(x)) +#define mvinchnstr(y,x,s,n) mvwinchnstr(stdscr,(y),(x),(s),(n)) +#define mvinchstr(y,x,s) mvwinchstr(stdscr,(y),(x),(s)) +#define mvinnstr(y,x,s,n) mvwinnstr(stdscr,(y),(x),(s),(n)) +#define mvinsch(y,x,c) mvwinsch(stdscr,(y),(x),(c)) +#define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,(y),(x),(s),(n)) +#define mvinsstr(y,x,s) mvwinsstr(stdscr,(y),(x),(s)) +#define mvinstr(y,x,s) mvwinstr(stdscr,(y),(x),(s)) +#define mvvline(y,x,c,n) mvwvline(stdscr,(y),(x),(c),(n)) /* * Some wide-character functions can be implemented without the extensions. */ #if !NCURSES_OPAQUE -#define getbkgd(win) ((win)->_bkgd) +#define getbkgd(win) (NCURSES_OK_ADDR(win) ? ((win)->_bkgd) : 0) #endif /* NCURSES_OPAQUE */ -#define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a)) -#define slk_attr_on(a,v) ((v) ? ERR : slk_attron(a)) +#define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a)) +#define slk_attr_on(a,v) ((v) ? ERR : slk_attron(a)) #if !NCURSES_OPAQUE -#if defined(NCURSES_WIDECHAR) && 0 -#define wattr_set(win,a,p,opts) ((win)->_attrs = ((a) & ~A_COLOR), \ - (win)->_color = (p), \ - OK) -#define wattr_get(win,a,p,opts) ((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \ - (void)((p) != (void *)0 && (*(p) = (win)->_color)), \ - OK) -#else -#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK) -#define wattr_get(win,a,p,opts) ((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \ - (void)((p) != (void *)0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \ - OK) -#endif +#if NCURSES_WATTR_MACROS +#if NCURSES_WIDECHAR && 1 +#define wattr_set(win,a,p,opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)((win)->_attrs = ((a) & ~A_COLOR), \ + (win)->_color = (opts) ? *(int *)(opts) : (p)), \ + OK) \ + : ERR) +#define wattr_get(win,a,p,opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)(NCURSES_OK_ADDR(a) \ + ? (*(a) = (win)->_attrs) \ + : OK), \ + (void)(NCURSES_OK_ADDR(p) \ + ? (*(p) = (NCURSES_PAIRS_T) (win)->_color) \ + : OK), \ + (void)(NCURSES_OK_ADDR(opts) \ + ? (*(int *)(opts) = (win)->_color) \ + : OK), \ + OK) \ + : ERR) +#else /* !(NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#define wattr_set(win,a,p,opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)((win)->_attrs = (((a) & ~A_COLOR) | \ + (attr_t)COLOR_PAIR(p))), \ + OK) \ + : ERR) +#define wattr_get(win,a,p,opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)(NCURSES_OK_ADDR(a) \ + ? (*(a) = (win)->_attrs) \ + : OK), \ + (void)(NCURSES_OK_ADDR(p) \ + ? (*(p) = (NCURSES_PAIRS_T) PAIR_NUMBER((win)->_attrs)) \ + : OK), \ + OK) \ + : ERR) +#endif /* (NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#endif /* NCURSES_WATTR_MACROS */ #endif /* NCURSES_OPAQUE */ /* @@ -1290,8 +1398,8 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); * use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already * use stdarg.h, so... */ -#define vw_printw vwprintw -#define vw_scanw vwscanw +/* define vw_printw vwprintw */ +/* define vw_scanw vwscanw */ /* * Export fallback function for use in C++ binding. @@ -1304,35 +1412,41 @@ NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list); /* * These macros are extensions - not in X/Open Curses. */ - //TODO checj is needed. #if 1 #if !NCURSES_OPAQUE -#define is_cleared(win) ((win) ? (win)->_clear : FALSE) -#define is_idcok(win) ((win) ? (win)->_idcok : FALSE) -#define is_idlok(win) ((win) ? (win)->_idlok : FALSE) -#define is_immedok(win) ((win) ? (win)->_immed : FALSE) -#define is_keypad(win) ((win) ? (win)->_use_keypad : FALSE) -#define is_leaveok(win) ((win) ? (win)->_leaveok : FALSE) -#define is_nodelay(win) ((win) ? ((win)->_delay == 0) : FALSE) -#define is_notimeout(win) ((win) ? (win)->_notimeout : FALSE) -#define is_pad(win) ((win) ? ((win)->_flags & _ISPAD) != 0 : FALSE) -#define is_scrollok(win) ((win) ? (win)->_scroll : FALSE) -#define is_subwin(win) ((win) ? ((win)->_flags & _SUBWIN) != 0 : FALSE) -#define is_syncok(win) ((win) ? (win)->_sync : FALSE) -#define wgetparent(win) ((win) ? (win)->_parent : 0) -#define wgetscrreg(win,t,b) ((win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR) +#define is_cleared(win) (NCURSES_OK_ADDR(win) ? (win)->_clear : FALSE) +#define is_idcok(win) (NCURSES_OK_ADDR(win) ? (win)->_idcok : FALSE) +#define is_idlok(win) (NCURSES_OK_ADDR(win) ? (win)->_idlok : FALSE) +#define is_immedok(win) (NCURSES_OK_ADDR(win) ? (win)->_immed : FALSE) +#define is_keypad(win) (NCURSES_OK_ADDR(win) ? (win)->_use_keypad : FALSE) +#define is_leaveok(win) (NCURSES_OK_ADDR(win) ? (win)->_leaveok : FALSE) +#define is_nodelay(win) (NCURSES_OK_ADDR(win) ? ((win)->_delay == 0) : FALSE) +#define is_notimeout(win) (NCURSES_OK_ADDR(win) ? (win)->_notimeout : FALSE) +#define is_pad(win) (NCURSES_OK_ADDR(win) ? ((win)->_flags & _ISPAD) != 0 : FALSE) +#define is_scrollok(win) (NCURSES_OK_ADDR(win) ? (win)->_scroll : FALSE) +#define is_subwin(win) (NCURSES_OK_ADDR(win) ? ((win)->_flags & _SUBWIN) != 0 : FALSE) +#define is_syncok(win) (NCURSES_OK_ADDR(win) ? (win)->_sync : FALSE) +#define wgetdelay(win) (NCURSES_OK_ADDR(win) ? (win)->_delay : 0) +#define wgetparent(win) (NCURSES_OK_ADDR(win) ? (win)->_parent : 0) +#define wgetscrreg(win,t,b) (NCURSES_OK_ADDR(win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR) #endif #endif +/* + * X/Open says this returns a bool; SVr4 also checked for out-of-range line. + * The macro provides compatibility: + */ +#define is_linetouched(w,l) ((!(w) || ((l) > getmaxy(w)) || ((l) < 0)) ? ERR : (is_linetouched)((w),(l))) + #endif /* NCURSES_NOMACROS */ /* * Public variables. * * Notes: - * a. ESCDELAY was an undocumented feature under AIX curses. - * It gives the ESC expire time in milliseconds. - * b. ttytype is needed for backward compatibility + * a. ESCDELAY was an undocumented feature under AIX curses. + * It gives the ESC expire time in milliseconds. + * b. ttytype is needed for backward compatibility */ #if NCURSES_REENTRANT @@ -1363,7 +1477,6 @@ NCURSES_WRAPPED_VAR(int, TABSIZE); extern NCURSES_EXPORT_VAR(WINDOW *) curscr; extern NCURSES_EXPORT_VAR(WINDOW *) newscr; extern NCURSES_EXPORT_VAR(WINDOW *) stdscr; -//TODO ttytype extern NCURSES_EXPORT_VAR(char) ttytype[]; extern NCURSES_EXPORT_VAR(int) COLORS; extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS; @@ -1380,113 +1493,115 @@ extern NCURSES_EXPORT_VAR(int) TABSIZE; * is defined in your terminal's terminfo entry. * * Some keys (KEY_A1, etc) are arranged like this: - * a1 up a3 - * left b2 right - * c1 down c3 + * a1 up a3 + * left b2 right + * c1 down c3 * * A few key codes do not depend upon the terminfo entry. */ -#define KEY_CODE_YES 0400 /* A wchar_t contains a key code */ -#define KEY_MIN 0401 /* Minimum curses key */ -#define KEY_BREAK 0401 /* Break key (unreliable) */ -#define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */ -#define KEY_RESET 0531 /* Reset or hard reset (unreliable) */ +#define KEY_CODE_YES 0400 /* A wchar_t contains a key code */ +#define KEY_MIN 0401 /* Minimum curses key */ +#define KEY_BREAK 0401 /* Break key (unreliable) */ +#define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */ +#define KEY_RESET 0531 /* Reset or hard reset (unreliable) */ /* - * These definitions were generated by /build/buildd/ncurses-5.7+20101128/include/MKkey_defs.sh /build/buildd/ncurses-5.7+20101128/include/Caps + * These definitions were generated by ./MKkey_defs.sh ./Caps ./Caps-ncurses */ -#define KEY_DOWN 0402 /* down-arrow key */ -#define KEY_UP 0403 /* up-arrow key */ -#define KEY_LEFT 0404 /* left-arrow key */ -#define KEY_RIGHT 0405 /* right-arrow key */ -#define KEY_HOME 0406 /* home key */ -#define KEY_BACKSPACE 0407 /* backspace key */ -#define KEY_F0 0410 /* Function keys. Space for 64 */ -#define KEY_F(n) (KEY_F0+(n)) /* Value of function key n */ -#define KEY_DL 0510 /* delete-line key */ -#define KEY_IL 0511 /* insert-line key */ -#define KEY_DC 0512 /* delete-character key */ -#define KEY_IC 0513 /* insert-character key */ -#define KEY_EIC 0514 /* sent by rmir or smir in insert mode */ -#define KEY_CLEAR 0515 /* clear-screen or erase key */ -#define KEY_EOS 0516 /* clear-to-end-of-screen key */ -#define KEY_EOL 0517 /* clear-to-end-of-line key */ -#define KEY_SF 0520 /* scroll-forward key */ -#define KEY_SR 0521 /* scroll-backward key */ -#define KEY_NPAGE 0522 /* next-page key */ -#define KEY_PPAGE 0523 /* previous-page key */ -#define KEY_STAB 0524 /* set-tab key */ -#define KEY_CTAB 0525 /* clear-tab key */ -#define KEY_CATAB 0526 /* clear-all-tabs key */ -#define KEY_ENTER 0527 /* enter/send key */ -#define KEY_PRINT 0532 /* print key */ -#define KEY_LL 0533 /* lower-left key (home down) */ -#define KEY_A1 0534 /* upper left of keypad */ -#define KEY_A3 0535 /* upper right of keypad */ -#define KEY_B2 0536 /* center of keypad */ -#define KEY_C1 0537 /* lower left of keypad */ -#define KEY_C3 0540 /* lower right of keypad */ -#define KEY_BTAB 0541 /* back-tab key */ -#define KEY_BEG 0542 /* begin key */ -#define KEY_CANCEL 0543 /* cancel key */ -#define KEY_CLOSE 0544 /* close key */ -#define KEY_COMMAND 0545 /* command key */ -#define KEY_COPY 0546 /* copy key */ -#define KEY_CREATE 0547 /* create key */ -#define KEY_END 0550 /* end key */ -#define KEY_EXIT 0551 /* exit key */ -#define KEY_FIND 0552 /* find key */ -#define KEY_HELP 0553 /* help key */ -#define KEY_MARK 0554 /* mark key */ -#define KEY_MESSAGE 0555 /* message key */ -#define KEY_MOVE 0556 /* move key */ -#define KEY_NEXT 0557 /* next key */ -#define KEY_OPEN 0560 /* open key */ -#define KEY_OPTIONS 0561 /* options key */ -#define KEY_PREVIOUS 0562 /* previous key */ -#define KEY_REDO 0563 /* redo key */ -#define KEY_REFERENCE 0564 /* reference key */ -#define KEY_REFRESH 0565 /* refresh key */ -#define KEY_REPLACE 0566 /* replace key */ -#define KEY_RESTART 0567 /* restart key */ -#define KEY_RESUME 0570 /* resume key */ -#define KEY_SAVE 0571 /* save key */ -#define KEY_SBEG 0572 /* shifted begin key */ -#define KEY_SCANCEL 0573 /* shifted cancel key */ -#define KEY_SCOMMAND 0574 /* shifted command key */ -#define KEY_SCOPY 0575 /* shifted copy key */ -#define KEY_SCREATE 0576 /* shifted create key */ -#define KEY_SDC 0577 /* shifted delete-character key */ -#define KEY_SDL 0600 /* shifted delete-line key */ -#define KEY_SELECT 0601 /* select key */ -#define KEY_SEND 0602 /* shifted end key */ -#define KEY_SEOL 0603 /* shifted clear-to-end-of-line key */ -#define KEY_SEXIT 0604 /* shifted exit key */ -#define KEY_SFIND 0605 /* shifted find key */ -#define KEY_SHELP 0606 /* shifted help key */ -#define KEY_SHOME 0607 /* shifted home key */ -#define KEY_SIC 0610 /* shifted insert-character key */ -#define KEY_SLEFT 0611 /* shifted left-arrow key */ -#define KEY_SMESSAGE 0612 /* shifted message key */ -#define KEY_SMOVE 0613 /* shifted move key */ -#define KEY_SNEXT 0614 /* shifted next key */ -#define KEY_SOPTIONS 0615 /* shifted options key */ -#define KEY_SPREVIOUS 0616 /* shifted previous key */ -#define KEY_SPRINT 0617 /* shifted print key */ -#define KEY_SREDO 0620 /* shifted redo key */ -#define KEY_SREPLACE 0621 /* shifted replace key */ -#define KEY_SRIGHT 0622 /* shifted right-arrow key */ -#define KEY_SRSUME 0623 /* shifted resume key */ -#define KEY_SSAVE 0624 /* shifted save key */ -#define KEY_SSUSPEND 0625 /* shifted suspend key */ -#define KEY_SUNDO 0626 /* shifted undo key */ -#define KEY_SUSPEND 0627 /* suspend key */ -#define KEY_UNDO 0630 /* undo key */ -#define KEY_MOUSE 0631 /* Mouse event has occurred */ -#define KEY_RESIZE 0632 /* Terminal resize event */ -#define KEY_EVENT 0633 /* We were interrupted by an event */ - -#define KEY_MAX 0777 /* Maximum key value is 0633 */ -/* $Id: curses.wide,v 1.42 2010/03/30 00:39:41 tom Exp $ */ +#define KEY_DOWN 0402 /* down-arrow key */ +#define KEY_UP 0403 /* up-arrow key */ +#define KEY_LEFT 0404 /* left-arrow key */ +#define KEY_RIGHT 0405 /* right-arrow key */ +#define KEY_HOME 0406 /* home key */ +#define KEY_BACKSPACE 0407 /* backspace key */ +#define KEY_F0 0410 /* Function keys. Space for 64 */ +#define KEY_F(n) (KEY_F0+(n)) /* Value of function key n */ +#define KEY_DL 0510 /* delete-line key */ +#define KEY_IL 0511 /* insert-line key */ +#define KEY_DC 0512 /* delete-character key */ +#define KEY_IC 0513 /* insert-character key */ +#define KEY_EIC 0514 /* sent by rmir or smir in insert mode */ +#define KEY_CLEAR 0515 /* clear-screen or erase key */ +#define KEY_EOS 0516 /* clear-to-end-of-screen key */ +#define KEY_EOL 0517 /* clear-to-end-of-line key */ +#define KEY_SF 0520 /* scroll-forward key */ +#define KEY_SR 0521 /* scroll-backward key */ +#define KEY_NPAGE 0522 /* next-page key */ +#define KEY_PPAGE 0523 /* previous-page key */ +#define KEY_STAB 0524 /* set-tab key */ +#define KEY_CTAB 0525 /* clear-tab key */ +#define KEY_CATAB 0526 /* clear-all-tabs key */ +#define KEY_ENTER 0527 /* enter/send key */ +#define KEY_PRINT 0532 /* print key */ +#define KEY_LL 0533 /* lower-left key (home down) */ +#define KEY_A1 0534 /* upper left of keypad */ +#define KEY_A3 0535 /* upper right of keypad */ +#define KEY_B2 0536 /* center of keypad */ +#define KEY_C1 0537 /* lower left of keypad */ +#define KEY_C3 0540 /* lower right of keypad */ +#define KEY_BTAB 0541 /* back-tab key */ +#define KEY_BEG 0542 /* begin key */ +#define KEY_CANCEL 0543 /* cancel key */ +#define KEY_CLOSE 0544 /* close key */ +#define KEY_COMMAND 0545 /* command key */ +#define KEY_COPY 0546 /* copy key */ +#define KEY_CREATE 0547 /* create key */ +#define KEY_END 0550 /* end key */ +#define KEY_EXIT 0551 /* exit key */ +#define KEY_FIND 0552 /* find key */ +#define KEY_HELP 0553 /* help key */ +#define KEY_MARK 0554 /* mark key */ +#define KEY_MESSAGE 0555 /* message key */ +#define KEY_MOVE 0556 /* move key */ +#define KEY_NEXT 0557 /* next key */ +#define KEY_OPEN 0560 /* open key */ +#define KEY_OPTIONS 0561 /* options key */ +#define KEY_PREVIOUS 0562 /* previous key */ +#define KEY_REDO 0563 /* redo key */ +#define KEY_REFERENCE 0564 /* reference key */ +#define KEY_REFRESH 0565 /* refresh key */ +#define KEY_REPLACE 0566 /* replace key */ +#define KEY_RESTART 0567 /* restart key */ +#define KEY_RESUME 0570 /* resume key */ +#define KEY_SAVE 0571 /* save key */ +#define KEY_SBEG 0572 /* shifted begin key */ +#define KEY_SCANCEL 0573 /* shifted cancel key */ +#define KEY_SCOMMAND 0574 /* shifted command key */ +#define KEY_SCOPY 0575 /* shifted copy key */ +#define KEY_SCREATE 0576 /* shifted create key */ +#define KEY_SDC 0577 /* shifted delete-character key */ +#define KEY_SDL 0600 /* shifted delete-line key */ +#define KEY_SELECT 0601 /* select key */ +#define KEY_SEND 0602 /* shifted end key */ +#define KEY_SEOL 0603 /* shifted clear-to-end-of-line key */ +#define KEY_SEXIT 0604 /* shifted exit key */ +#define KEY_SFIND 0605 /* shifted find key */ +#define KEY_SHELP 0606 /* shifted help key */ +#define KEY_SHOME 0607 /* shifted home key */ +#define KEY_SIC 0610 /* shifted insert-character key */ +#define KEY_SLEFT 0611 /* shifted left-arrow key */ +#define KEY_SMESSAGE 0612 /* shifted message key */ +#define KEY_SMOVE 0613 /* shifted move key */ +#define KEY_SNEXT 0614 /* shifted next key */ +#define KEY_SOPTIONS 0615 /* shifted options key */ +#define KEY_SPREVIOUS 0616 /* shifted previous key */ +#define KEY_SPRINT 0617 /* shifted print key */ +#define KEY_SREDO 0620 /* shifted redo key */ +#define KEY_SREPLACE 0621 /* shifted replace key */ +#define KEY_SRIGHT 0622 /* shifted right-arrow key */ +#define KEY_SRSUME 0623 /* shifted resume key */ +#define KEY_SSAVE 0624 /* shifted save key */ +#define KEY_SSUSPEND 0625 /* shifted suspend key */ +#define KEY_SUNDO 0626 /* shifted undo key */ +#define KEY_SUSPEND 0627 /* suspend key */ +#define KEY_UNDO 0630 /* undo key */ +#define KEY_MOUSE 0631 /* Mouse event has occurred */ + +#ifdef NCURSES_EXT_FUNCS +#define KEY_RESIZE 0632 /* Terminal resize event */ +#endif + +#define KEY_MAX 0777 /* Maximum key value is 0632 */ +/* $Id: curses.wide,v 1.51 2021/05/22 20:28:29 tom Exp $ */ /* * vile:cmode: * This file is part of ncurses, designed to be appended after curses.h.in @@ -1494,111 +1609,111 @@ extern NCURSES_EXPORT_VAR(int) TABSIZE; */ #define _XOPEN_CURSES 1 -#ifdef NCURSES_WIDECHAR +#if NCURSES_WIDECHAR extern NCURSES_EXPORT_VAR(cchar_t *) _nc_wacs; -#define NCURSES_WACS(c) (&_nc_wacs[(unsigned char)c]) - -#define WACS_BSSB NCURSES_WACS('l') -#define WACS_SSBB NCURSES_WACS('m') -#define WACS_BBSS NCURSES_WACS('k') -#define WACS_SBBS NCURSES_WACS('j') -#define WACS_SBSS NCURSES_WACS('u') -#define WACS_SSSB NCURSES_WACS('t') -#define WACS_SSBS NCURSES_WACS('v') -#define WACS_BSSS NCURSES_WACS('w') -#define WACS_BSBS NCURSES_WACS('q') -#define WACS_SBSB NCURSES_WACS('x') -#define WACS_SSSS NCURSES_WACS('n') - -#define WACS_ULCORNER WACS_BSSB -#define WACS_LLCORNER WACS_SSBB -#define WACS_URCORNER WACS_BBSS -#define WACS_LRCORNER WACS_SBBS -#define WACS_RTEE WACS_SBSS -#define WACS_LTEE WACS_SSSB -#define WACS_BTEE WACS_SSBS -#define WACS_TTEE WACS_BSSS -#define WACS_HLINE WACS_BSBS -#define WACS_VLINE WACS_SBSB -#define WACS_PLUS WACS_SSSS - -#define WACS_S1 NCURSES_WACS('o') /* scan line 1 */ -#define WACS_S9 NCURSES_WACS('s') /* scan line 9 */ -#define WACS_DIAMOND NCURSES_WACS('`') /* diamond */ -#define WACS_CKBOARD NCURSES_WACS('a') /* checker board */ -#define WACS_DEGREE NCURSES_WACS('f') /* degree symbol */ -#define WACS_PLMINUS NCURSES_WACS('g') /* plus/minus */ -#define WACS_BULLET NCURSES_WACS('~') /* bullet */ - - /* Teletype 5410v1 symbols */ -#define WACS_LARROW NCURSES_WACS(',') /* arrow left */ -#define WACS_RARROW NCURSES_WACS('+') /* arrow right */ -#define WACS_DARROW NCURSES_WACS('.') /* arrow down */ -#define WACS_UARROW NCURSES_WACS('-') /* arrow up */ -#define WACS_BOARD NCURSES_WACS('h') /* board of squares */ -#define WACS_LANTERN NCURSES_WACS('i') /* lantern symbol */ -#define WACS_BLOCK NCURSES_WACS('0') /* solid square block */ - - /* ncurses extensions */ -#define WACS_S3 NCURSES_WACS('p') /* scan line 3 */ -#define WACS_S7 NCURSES_WACS('r') /* scan line 7 */ -#define WACS_LEQUAL NCURSES_WACS('y') /* less/equal */ -#define WACS_GEQUAL NCURSES_WACS('z') /* greater/equal */ -#define WACS_PI NCURSES_WACS('{') /* Pi */ -#define WACS_NEQUAL NCURSES_WACS('|') /* not equal */ -#define WACS_STERLING NCURSES_WACS('}') /* UK pound sign */ - - /* double lines */ -#define WACS_BDDB NCURSES_WACS('C') -#define WACS_DDBB NCURSES_WACS('D') -#define WACS_BBDD NCURSES_WACS('B') -#define WACS_DBBD NCURSES_WACS('A') -#define WACS_DBDD NCURSES_WACS('G') -#define WACS_DDDB NCURSES_WACS('F') -#define WACS_DDBD NCURSES_WACS('H') -#define WACS_BDDD NCURSES_WACS('I') -#define WACS_BDBD NCURSES_WACS('R') -#define WACS_DBDB NCURSES_WACS('Y') -#define WACS_DDDD NCURSES_WACS('E') - -#define WACS_D_ULCORNER WACS_BDDB -#define WACS_D_LLCORNER WACS_DDBB -#define WACS_D_URCORNER WACS_BBDD -#define WACS_D_LRCORNER WACS_DBBD -#define WACS_D_RTEE WACS_DBDD -#define WACS_D_LTEE WACS_DDDB -#define WACS_D_BTEE WACS_DDBD -#define WACS_D_TTEE WACS_BDDD -#define WACS_D_HLINE WACS_BDBD -#define WACS_D_VLINE WACS_DBDB -#define WACS_D_PLUS WACS_DDDD - - /* thick lines */ -#define WACS_BTTB NCURSES_WACS('L') -#define WACS_TTBB NCURSES_WACS('M') -#define WACS_BBTT NCURSES_WACS('K') -#define WACS_TBBT NCURSES_WACS('J') -#define WACS_TBTT NCURSES_WACS('U') -#define WACS_TTTB NCURSES_WACS('T') -#define WACS_TTBT NCURSES_WACS('V') -#define WACS_BTTT NCURSES_WACS('W') -#define WACS_BTBT NCURSES_WACS('Q') -#define WACS_TBTB NCURSES_WACS('X') -#define WACS_TTTT NCURSES_WACS('N') - -#define WACS_T_ULCORNER WACS_BTTB -#define WACS_T_LLCORNER WACS_TTBB -#define WACS_T_URCORNER WACS_BBTT -#define WACS_T_LRCORNER WACS_TBBT -#define WACS_T_RTEE WACS_TBTT -#define WACS_T_LTEE WACS_TTTB -#define WACS_T_BTEE WACS_TTBT -#define WACS_T_TTEE WACS_BTTT -#define WACS_T_HLINE WACS_BTBT -#define WACS_T_VLINE WACS_TBTB -#define WACS_T_PLUS WACS_TTTT +#define NCURSES_WACS(c) (&_nc_wacs[NCURSES_CAST(unsigned char,(c))]) + +#define WACS_BSSB NCURSES_WACS('l') +#define WACS_SSBB NCURSES_WACS('m') +#define WACS_BBSS NCURSES_WACS('k') +#define WACS_SBBS NCURSES_WACS('j') +#define WACS_SBSS NCURSES_WACS('u') +#define WACS_SSSB NCURSES_WACS('t') +#define WACS_SSBS NCURSES_WACS('v') +#define WACS_BSSS NCURSES_WACS('w') +#define WACS_BSBS NCURSES_WACS('q') +#define WACS_SBSB NCURSES_WACS('x') +#define WACS_SSSS NCURSES_WACS('n') + +#define WACS_ULCORNER WACS_BSSB +#define WACS_LLCORNER WACS_SSBB +#define WACS_URCORNER WACS_BBSS +#define WACS_LRCORNER WACS_SBBS +#define WACS_RTEE WACS_SBSS +#define WACS_LTEE WACS_SSSB +#define WACS_BTEE WACS_SSBS +#define WACS_TTEE WACS_BSSS +#define WACS_HLINE WACS_BSBS +#define WACS_VLINE WACS_SBSB +#define WACS_PLUS WACS_SSSS + +#define WACS_S1 NCURSES_WACS('o') /* scan line 1 */ +#define WACS_S9 NCURSES_WACS('s') /* scan line 9 */ +#define WACS_DIAMOND NCURSES_WACS('`') /* diamond */ +#define WACS_CKBOARD NCURSES_WACS('a') /* checker board */ +#define WACS_DEGREE NCURSES_WACS('f') /* degree symbol */ +#define WACS_PLMINUS NCURSES_WACS('g') /* plus/minus */ +#define WACS_BULLET NCURSES_WACS('~') /* bullet */ + + /* Teletype 5410v1 symbols */ +#define WACS_LARROW NCURSES_WACS(',') /* arrow left */ +#define WACS_RARROW NCURSES_WACS('+') /* arrow right */ +#define WACS_DARROW NCURSES_WACS('.') /* arrow down */ +#define WACS_UARROW NCURSES_WACS('-') /* arrow up */ +#define WACS_BOARD NCURSES_WACS('h') /* board of squares */ +#define WACS_LANTERN NCURSES_WACS('i') /* lantern symbol */ +#define WACS_BLOCK NCURSES_WACS('0') /* solid square block */ + + /* ncurses extensions */ +#define WACS_S3 NCURSES_WACS('p') /* scan line 3 */ +#define WACS_S7 NCURSES_WACS('r') /* scan line 7 */ +#define WACS_LEQUAL NCURSES_WACS('y') /* less/equal */ +#define WACS_GEQUAL NCURSES_WACS('z') /* greater/equal */ +#define WACS_PI NCURSES_WACS('{') /* Pi */ +#define WACS_NEQUAL NCURSES_WACS('|') /* not equal */ +#define WACS_STERLING NCURSES_WACS('}') /* UK pound sign */ + + /* double lines */ +#define WACS_BDDB NCURSES_WACS('C') +#define WACS_DDBB NCURSES_WACS('D') +#define WACS_BBDD NCURSES_WACS('B') +#define WACS_DBBD NCURSES_WACS('A') +#define WACS_DBDD NCURSES_WACS('G') +#define WACS_DDDB NCURSES_WACS('F') +#define WACS_DDBD NCURSES_WACS('H') +#define WACS_BDDD NCURSES_WACS('I') +#define WACS_BDBD NCURSES_WACS('R') +#define WACS_DBDB NCURSES_WACS('Y') +#define WACS_DDDD NCURSES_WACS('E') + +#define WACS_D_ULCORNER WACS_BDDB +#define WACS_D_LLCORNER WACS_DDBB +#define WACS_D_URCORNER WACS_BBDD +#define WACS_D_LRCORNER WACS_DBBD +#define WACS_D_RTEE WACS_DBDD +#define WACS_D_LTEE WACS_DDDB +#define WACS_D_BTEE WACS_DDBD +#define WACS_D_TTEE WACS_BDDD +#define WACS_D_HLINE WACS_BDBD +#define WACS_D_VLINE WACS_DBDB +#define WACS_D_PLUS WACS_DDDD + + /* thick lines */ +#define WACS_BTTB NCURSES_WACS('L') +#define WACS_TTBB NCURSES_WACS('M') +#define WACS_BBTT NCURSES_WACS('K') +#define WACS_TBBT NCURSES_WACS('J') +#define WACS_TBTT NCURSES_WACS('U') +#define WACS_TTTB NCURSES_WACS('T') +#define WACS_TTBT NCURSES_WACS('V') +#define WACS_BTTT NCURSES_WACS('W') +#define WACS_BTBT NCURSES_WACS('Q') +#define WACS_TBTB NCURSES_WACS('X') +#define WACS_TTTT NCURSES_WACS('N') + +#define WACS_T_ULCORNER WACS_BTTB +#define WACS_T_LLCORNER WACS_TTBB +#define WACS_T_URCORNER WACS_BBTT +#define WACS_T_LRCORNER WACS_TBBT +#define WACS_T_RTEE WACS_TBTT +#define WACS_T_LTEE WACS_TTTB +#define WACS_T_BTEE WACS_TTBT +#define WACS_T_TTEE WACS_BTTT +#define WACS_T_HLINE WACS_BTBT +#define WACS_T_VLINE WACS_TBTB +#define WACS_T_PLUS WACS_TTTT /* * Function prototypes for wide-character operations. @@ -1609,111 +1724,110 @@ extern NCURSES_EXPORT_VAR(cchar_t *) _nc_wacs; * "implemented" comments do not need this marker. */ -extern NCURSES_EXPORT(int) add_wch (const cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) add_wchnstr (const cchar_t *, int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) add_wchstr (const cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) addnwstr (const wchar_t *, int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) addwstr (const wchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) bkgrnd (const cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(void) bkgrndset (const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) add_wch (const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) add_wchnstr (const cchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) add_wchstr (const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) addnwstr (const wchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) addwstr (const wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) bkgrnd (const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(void) bkgrndset (const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(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*); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) box_set (WINDOW *, const cchar_t *, const cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) echo_wchar (const cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) erasewchar (wchar_t*); /* implemented */ -extern NCURSES_EXPORT(int) get_wch (wint_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) get_wstr (wint_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) getbkgrnd (cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, short*, void*); /* implemented */ -extern NCURSES_EXPORT(int) getn_wstr (wint_t *, int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) hline_set (const cchar_t *, int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) in_wch (cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) in_wchnstr (cchar_t *, int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) in_wchstr (cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) innwstr (wchar_t *, int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) ins_nwstr (const wchar_t *, int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) ins_wch (const cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) ins_wstr (const wchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) inwstr (wchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(NCURSES_CONST char*) key_name (wchar_t); /* implemented */ -extern NCURSES_EXPORT(int) killwchar (wchar_t *); /* implemented */ -extern NCURSES_EXPORT(int) mvadd_wch (int, int, const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) box_set (WINDOW *, const cchar_t *, const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) echo_wchar (const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) erasewchar (wchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) get_wch (wint_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) get_wstr (wint_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) getbkgrnd (cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, NCURSES_PAIRS_T*, void*); /* implemented */ +extern NCURSES_EXPORT(int) getn_wstr (wint_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) hline_set (const cchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wch (cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wchnstr (cchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wchstr (cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) innwstr (wchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_nwstr (const wchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_wch (const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_wstr (const wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) inwstr (wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(NCURSES_CONST char*) key_name (wchar_t); /* implemented */ +extern NCURSES_EXPORT(int) killwchar (wchar_t *); /* implemented */ +extern NCURSES_EXPORT(int) mvadd_wch (int, int, const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvadd_wchnstr (int, int, const cchar_t *, int);/* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvadd_wchstr (int, int, const cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvaddnwstr (int, int, const wchar_t *, int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvaddwstr (int, int, const wchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvget_wch (int, int, wint_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvget_wstr (int, int, wint_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvgetn_wstr (int, int, wint_t *, int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvhline_set (int, int, const cchar_t *, int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvin_wch (int, int, cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvin_wchnstr (int, int, cchar_t *, int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvin_wchstr (int, int, cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvinnwstr (int, int, wchar_t *, int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvins_nwstr (int, int, const wchar_t *, int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvins_wch (int, int, const cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvins_wstr (int, int, const wchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvinwstr (int, int, wchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvvline_set (int, int, const cchar_t *, int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvwadd_wch (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvadd_wchstr (int, int, const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvaddnwstr (int, int, const wchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvaddwstr (int, int, const wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvget_wch (int, int, wint_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvget_wstr (int, int, wint_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvgetn_wstr (int, int, wint_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvhline_set (int, int, const cchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvin_wch (int, int, cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvin_wchnstr (int, int, cchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvin_wchstr (int, int, cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvinnwstr (int, int, wchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvins_nwstr (int, int, const wchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvins_wch (int, int, const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvins_wstr (int, int, const wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvinwstr (int, int, wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvvline_set (int, int, const cchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwadd_wch (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwadd_wchnstr (WINDOW *, int, int, const cchar_t *, int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvwadd_wchstr (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwadd_wchstr (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwaddnwstr (WINDOW *, int, int, const wchar_t *, int);/* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvwaddwstr (WINDOW *, int, int, const wchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvwget_wch (WINDOW *, int, int, wint_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvwget_wstr (WINDOW *, int, int, wint_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwaddwstr (WINDOW *, int, int, const wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwget_wch (WINDOW *, int, int, wint_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwget_wstr (WINDOW *, int, int, wint_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwgetn_wstr (WINDOW *, int, int, wint_t *, int);/* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwhline_set (WINDOW *, int, int, const cchar_t *, int);/* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvwin_wch (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvwin_wchnstr (WINDOW *, int,int, cchar_t *,int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvwin_wchstr (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvwinnwstr (WINDOW *, int, int, wchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwin_wch (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwin_wchnstr (WINDOW *, int,int, cchar_t *,int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwin_wchstr (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwinnwstr (WINDOW *, int, int, wchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwins_nwstr (WINDOW *, int,int, const wchar_t *,int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvwins_wch (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvwins_wstr (WINDOW *, int, int, const wchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) mvwinwstr (WINDOW *, int, int, wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwins_wch (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwins_wstr (WINDOW *, int, int, const wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwinwstr (WINDOW *, int, int, wchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwvline_set (WINDOW *, int,int, const cchar_t *,int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) pecho_wchar (WINDOW *, const cchar_t *); /* implemented */ -extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, short, const void *); /* implemented */ -extern NCURSES_EXPORT(int) slk_wset (int, const wchar_t *, int); /* implemented */ -extern NCURSES_EXPORT(attr_t) term_attrs (void); /* implemented */ -extern NCURSES_EXPORT(int) unget_wch (const wchar_t); /* implemented */ -//TODO -extern NCURSES_EXPORT(int) vid_attr (attr_t, short, void *); /* implemented */ -extern NCURSES_EXPORT(int) vid_puts (attr_t, short, void *, NCURSES_OUTC); /* implemented */ -//end -extern NCURSES_EXPORT(int) vline_set (const cchar_t *, int); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *); /* implemented */ -extern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int); /* implemented */ -extern NCURSES_EXPORT(int) wadd_wchstr (WINDOW *,const cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) waddnwstr (WINDOW *,const wchar_t *,int); /* implemented */ -extern NCURSES_EXPORT(int) waddwstr (WINDOW *,const wchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) wbkgrnd (WINDOW *,const cchar_t *); /* implemented */ -extern NCURSES_EXPORT(void) wbkgrndset (WINDOW *,const cchar_t *); /* implemented */ -extern NCURSES_EXPORT(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*); /* implemented */ -extern NCURSES_EXPORT(int) wecho_wchar (WINDOW *, const cchar_t *); /* implemented */ -extern NCURSES_EXPORT(int) wget_wch (WINDOW *, wint_t *); /* implemented */ -extern NCURSES_EXPORT(int) wget_wstr (WINDOW *, wint_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) wgetbkgrnd (WINDOW *, cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) wgetn_wstr (WINDOW *,wint_t *, int); /* implemented */ -extern NCURSES_EXPORT(int) whline_set (WINDOW *, const cchar_t *, int); /* implemented */ -extern NCURSES_EXPORT(int) win_wch (WINDOW *, cchar_t *); /* implemented */ -extern NCURSES_EXPORT(int) win_wchnstr (WINDOW *, cchar_t *, int); /* implemented */ -extern NCURSES_EXPORT(int) win_wchstr (WINDOW *, cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) winnwstr (WINDOW *, wchar_t *, int); /* implemented */ -extern NCURSES_EXPORT(int) wins_nwstr (WINDOW *, const wchar_t *, int); /* implemented */ -extern NCURSES_EXPORT(int) wins_wch (WINDOW *, const cchar_t *); /* implemented */ -extern NCURSES_EXPORT(int) wins_wstr (WINDOW *, const wchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) winwstr (WINDOW *, wchar_t *); /* implemented */ -extern NCURSES_EXPORT(wchar_t*) wunctrl (cchar_t *); /* implemented */ -extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int); /* implemented */ +extern NCURSES_EXPORT(int) pecho_wchar (WINDOW *, const cchar_t *); /* implemented */ +extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, NCURSES_PAIRS_T, const void *); /* implemented */ +extern NCURSES_EXPORT(int) slk_wset (int, const wchar_t *, int); /* implemented */ +extern NCURSES_EXPORT(attr_t) term_attrs (void); /* implemented */ +extern NCURSES_EXPORT(int) unget_wch (const wchar_t); /* implemented */ +extern NCURSES_EXPORT(int) vid_attr (attr_t, NCURSES_PAIRS_T, void *); /* implemented */ +extern NCURSES_EXPORT(int) vid_puts (attr_t, NCURSES_PAIRS_T, void *, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vline_set (const cchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *); /* implemented */ +extern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int); /* implemented */ +extern NCURSES_EXPORT(int) wadd_wchstr (WINDOW *,const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) waddnwstr (WINDOW *,const wchar_t *,int); /* implemented */ +extern NCURSES_EXPORT(int) waddwstr (WINDOW *,const wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wbkgrnd (WINDOW *,const cchar_t *); /* implemented */ +extern NCURSES_EXPORT(void) wbkgrndset (WINDOW *,const cchar_t *); /* implemented */ +extern NCURSES_EXPORT(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*); /* implemented */ +extern NCURSES_EXPORT(int) wecho_wchar (WINDOW *, const cchar_t *); /* implemented */ +extern NCURSES_EXPORT(int) wget_wch (WINDOW *, wint_t *); /* implemented */ +extern NCURSES_EXPORT(int) wget_wstr (WINDOW *, wint_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wgetbkgrnd (WINDOW *, cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wgetn_wstr (WINDOW *, wint_t *, int); /* implemented */ +extern NCURSES_EXPORT(int) whline_set (WINDOW *, const cchar_t *, int); /* implemented */ +extern NCURSES_EXPORT(int) win_wch (WINDOW *, cchar_t *); /* implemented */ +extern NCURSES_EXPORT(int) win_wchnstr (WINDOW *, cchar_t *, int); /* implemented */ +extern NCURSES_EXPORT(int) win_wchstr (WINDOW *, cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) winnwstr (WINDOW *, wchar_t *, int); /* implemented */ +extern NCURSES_EXPORT(int) wins_nwstr (WINDOW *, const wchar_t *, int); /* implemented */ +extern NCURSES_EXPORT(int) wins_wch (WINDOW *, const cchar_t *); /* implemented */ +extern NCURSES_EXPORT(int) wins_wstr (WINDOW *, const wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) winwstr (WINDOW *, wchar_t *); /* implemented */ +extern NCURSES_EXPORT(wchar_t*) wunctrl (cchar_t *); /* implemented */ +extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int); /* implemented */ #if NCURSES_SP_FUNCS -extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(term_attrs) (SCREEN*); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(unget_wch) (SCREEN*, const wchar_t); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *); /* implemented:SP_FUNC */ -//TODO -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, short, void *); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, short, void *, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(term_attrs) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(erasewchar) (SCREEN*, wchar_t *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(killwchar) (SCREEN*, wchar_t *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(unget_wch) (SCREEN*, const wchar_t); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *); /* implemented:SP_FUNC */ #endif #ifndef NCURSES_NOMACROS @@ -1721,77 +1835,77 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, short, vo /* * XSI curses macros for XPG4 conformance. */ -#define add_wch(c) wadd_wch(stdscr,c) -#define add_wchnstr(str,n) wadd_wchnstr(stdscr,str,n) -#define add_wchstr(str) wadd_wchstr(stdscr,str) -#define addnwstr(wstr,n) waddnwstr(stdscr,wstr,n) -#define addwstr(wstr) waddwstr(stdscr,wstr) -#define bkgrnd(c) wbkgrnd(stdscr,c) -#define bkgrndset(c) wbkgrndset(stdscr,c) -#define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,l,r,t,b,tl,tr,bl,br) -#define box_set(w,v,h) wborder_set(w,v,v,h,h,0,0,0,0) -#define echo_wchar(c) wecho_wchar(stdscr,c) -#define get_wch(c) wget_wch(stdscr,c) -#define get_wstr(t) wget_wstr(stdscr,t) -#define getbkgrnd(wch) wgetbkgrnd(stdscr,wch) -#define getn_wstr(t,n) wgetn_wstr(stdscr,t,n) -#define hline_set(c,n) whline_set(stdscr,c,n) -#define in_wch(c) win_wch(stdscr,c) -#define in_wchnstr(c,n) win_wchnstr(stdscr,c,n) -#define in_wchstr(c) win_wchstr(stdscr,c) -#define innwstr(c,n) winnwstr(stdscr,c,n) -#define ins_nwstr(t,n) wins_nwstr(stdscr,t,n) -#define ins_wch(c) wins_wch(stdscr,c) -#define ins_wstr(t) wins_wstr(stdscr,t) -#define inwstr(c) winwstr(stdscr,c) -#define vline_set(c,n) wvline_set(stdscr,c,n) -#define wadd_wchstr(win,str) wadd_wchnstr(win,str,-1) -#define waddwstr(win,wstr) waddnwstr(win,wstr,-1) -#define wget_wstr(w,t) wgetn_wstr(w,t,-1) -#define win_wchstr(w,c) win_wchnstr(w,c,-1) -#define wins_wstr(w,t) wins_nwstr(w,t,-1) +#define add_wch(c) wadd_wch(stdscr,(c)) +#define add_wchnstr(str,n) wadd_wchnstr(stdscr,(str),(n)) +#define add_wchstr(str) wadd_wchstr(stdscr,(str)) +#define addnwstr(wstr,n) waddnwstr(stdscr,(wstr),(n)) +#define addwstr(wstr) waddwstr(stdscr,(wstr)) +#define bkgrnd(c) wbkgrnd(stdscr,(c)) +#define bkgrndset(c) wbkgrndset(stdscr,(c)) +#define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,(l),(r),(t),(b),tl,tr,bl,br) +#define box_set(w,v,h) wborder_set((w),(v),(v),(h),(h),0,0,0,0) +#define echo_wchar(c) wecho_wchar(stdscr,(c)) +#define get_wch(c) wget_wch(stdscr,(c)) +#define get_wstr(t) wget_wstr(stdscr,(t)) +#define getbkgrnd(wch) wgetbkgrnd(stdscr,(wch)) +#define getn_wstr(t,n) wgetn_wstr(stdscr,(t),(n)) +#define hline_set(c,n) whline_set(stdscr,(c),(n)) +#define in_wch(c) win_wch(stdscr,(c)) +#define in_wchnstr(c,n) win_wchnstr(stdscr,(c),(n)) +#define in_wchstr(c) win_wchstr(stdscr,(c)) +#define innwstr(c,n) winnwstr(stdscr,(c),(n)) +#define ins_nwstr(t,n) wins_nwstr(stdscr,(t),(n)) +#define ins_wch(c) wins_wch(stdscr,(c)) +#define ins_wstr(t) wins_wstr(stdscr,(t)) +#define inwstr(c) winwstr(stdscr,(c)) +#define vline_set(c,n) wvline_set(stdscr,(c),(n)) +#define wadd_wchstr(win,str) wadd_wchnstr((win),(str),-1) +#define waddwstr(win,wstr) waddnwstr((win),(wstr),-1) +#define wget_wstr(w,t) wgetn_wstr((w),(t),-1) +#define win_wchstr(w,c) win_wchnstr((w),(c),-1) +#define wins_wstr(w,t) wins_nwstr((w),(t),-1) #if !NCURSES_OPAQUE -#define wgetbkgrnd(win,wch) (*wch = win->_bkgrnd, OK) +#define wgetbkgrnd(win,wch) (NCURSES_OK_ADDR(wch) ? ((win) ? (*(wch) = (win)->_bkgrnd) : *(wch), OK) : ERR) #endif -#define mvadd_wch(y,x,c) mvwadd_wch(stdscr,y,x,c) -#define mvadd_wchnstr(y,x,s,n) mvwadd_wchnstr(stdscr,y,x,s,n) -#define mvadd_wchstr(y,x,s) mvwadd_wchstr(stdscr,y,x,s) -#define mvaddnwstr(y,x,wstr,n) mvwaddnwstr(stdscr,y,x,wstr,n) -#define mvaddwstr(y,x,wstr) mvwaddwstr(stdscr,y,x,wstr) -#define mvget_wch(y,x,c) mvwget_wch(stdscr,y,x,c) -#define mvget_wstr(y,x,t) mvwget_wstr(stdscr,y,x,t) -#define mvgetn_wstr(y,x,t,n) mvwgetn_wstr(stdscr,y,x,t,n) -#define mvhline_set(y,x,c,n) mvwhline_set(stdscr,y,x,c,n) -#define mvin_wch(y,x,c) mvwin_wch(stdscr,y,x,c) -#define mvin_wchnstr(y,x,c,n) mvwin_wchnstr(stdscr,y,x,c,n) -#define mvin_wchstr(y,x,c) mvwin_wchstr(stdscr,y,x,c) -#define mvinnwstr(y,x,c,n) mvwinnwstr(stdscr,y,x,c,n) -#define mvins_nwstr(y,x,t,n) mvwins_nwstr(stdscr,y,x,t,n) -#define mvins_wch(y,x,c) mvwins_wch(stdscr,y,x,c) -#define mvins_wstr(y,x,t) mvwins_wstr(stdscr,y,x,t) -#define mvinwstr(y,x,c) mvwinwstr(stdscr,y,x,c) -#define mvvline_set(y,x,c,n) mvwvline_set(stdscr,y,x,c,n) - -#define mvwadd_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : wadd_wch(win,c)) -#define mvwadd_wchnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : wadd_wchnstr(win,s,n)) -#define mvwadd_wchstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : wadd_wchstr(win,s)) -#define mvwaddnwstr(win,y,x,wstr,n) (wmove(win,y,x) == ERR ? ERR : waddnwstr(win,wstr,n)) -#define mvwaddwstr(win,y,x,wstr) (wmove(win,y,x) == ERR ? ERR : waddwstr(win,wstr)) -#define mvwget_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : wget_wch(win,c)) -#define mvwget_wstr(win,y,x,t) (wmove(win,y,x) == ERR ? ERR : wget_wstr(win,t)) -#define mvwgetn_wstr(win,y,x,t,n) (wmove(win,y,x) == ERR ? ERR : wgetn_wstr(win,t,n)) -#define mvwhline_set(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : whline_set(win,c,n)) -#define mvwin_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : win_wch(win,c)) -#define mvwin_wchnstr(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : win_wchnstr(win,c,n)) -#define mvwin_wchstr(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : win_wchstr(win,c)) -#define mvwinnwstr(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : winnwstr(win,c,n)) -#define mvwins_nwstr(win,y,x,t,n) (wmove(win,y,x) == ERR ? ERR : wins_nwstr(win,t,n)) -#define mvwins_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : wins_wch(win,c)) -#define mvwins_wstr(win,y,x,t) (wmove(win,y,x) == ERR ? ERR : wins_wstr(win,t)) -#define mvwinwstr(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winwstr(win,c)) -#define mvwvline_set(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : wvline_set(win,c,n)) +#define mvadd_wch(y,x,c) mvwadd_wch(stdscr,(y),(x),(c)) +#define mvadd_wchnstr(y,x,s,n) mvwadd_wchnstr(stdscr,(y),(x),(s),(n)) +#define mvadd_wchstr(y,x,s) mvwadd_wchstr(stdscr,(y),(x),(s)) +#define mvaddnwstr(y,x,wstr,n) mvwaddnwstr(stdscr,(y),(x),(wstr),(n)) +#define mvaddwstr(y,x,wstr) mvwaddwstr(stdscr,(y),(x),(wstr)) +#define mvget_wch(y,x,c) mvwget_wch(stdscr,(y),(x),(c)) +#define mvget_wstr(y,x,t) mvwget_wstr(stdscr,(y),(x),(t)) +#define mvgetn_wstr(y,x,t,n) mvwgetn_wstr(stdscr,(y),(x),(t),(n)) +#define mvhline_set(y,x,c,n) mvwhline_set(stdscr,(y),(x),(c),(n)) +#define mvin_wch(y,x,c) mvwin_wch(stdscr,(y),(x),(c)) +#define mvin_wchnstr(y,x,c,n) mvwin_wchnstr(stdscr,(y),(x),(c),(n)) +#define mvin_wchstr(y,x,c) mvwin_wchstr(stdscr,(y),(x),(c)) +#define mvinnwstr(y,x,c,n) mvwinnwstr(stdscr,(y),(x),(c),(n)) +#define mvins_nwstr(y,x,t,n) mvwins_nwstr(stdscr,(y),(x),(t),(n)) +#define mvins_wch(y,x,c) mvwins_wch(stdscr,(y),(x),(c)) +#define mvins_wstr(y,x,t) mvwins_wstr(stdscr,(y),(x),(t)) +#define mvinwstr(y,x,c) mvwinwstr(stdscr,(y),(x),(c)) +#define mvvline_set(y,x,c,n) mvwvline_set(stdscr,(y),(x),(c),(n)) + +#define mvwadd_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wch((win),(c))) +#define mvwadd_wchnstr(win,y,x,s,n) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wchnstr((win),(s),(n))) +#define mvwadd_wchstr(win,y,x,s) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wchstr((win),(s))) +#define mvwaddnwstr(win,y,x,wstr,n) (wmove(win,(y),(x)) == ERR ? ERR : waddnwstr((win),(wstr),(n))) +#define mvwaddwstr(win,y,x,wstr) (wmove(win,(y),(x)) == ERR ? ERR : waddwstr((win),(wstr))) +#define mvwget_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wget_wch((win),(c))) +#define mvwget_wstr(win,y,x,t) (wmove(win,(y),(x)) == ERR ? ERR : wget_wstr((win),(t))) +#define mvwgetn_wstr(win,y,x,t,n) (wmove(win,(y),(x)) == ERR ? ERR : wgetn_wstr((win),(t),(n))) +#define mvwhline_set(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : whline_set((win),(c),(n))) +#define mvwin_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : win_wch((win),(c))) +#define mvwin_wchnstr(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : win_wchnstr((win),(c),(n))) +#define mvwin_wchstr(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : win_wchstr((win),(c))) +#define mvwinnwstr(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : winnwstr((win),(c),(n))) +#define mvwins_nwstr(win,y,x,t,n) (wmove(win,(y),(x)) == ERR ? ERR : wins_nwstr((win),(t),(n))) +#define mvwins_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wins_wch((win),(c))) +#define mvwins_wstr(win,y,x,t) (wmove(win,(y),(x)) == ERR ? ERR : wins_wstr((win),(t))) +#define mvwinwstr(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : winwstr((win),(c))) +#define mvwvline_set(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : wvline_set((win),(c),(n))) #endif /* NCURSES_NOMACROS */ @@ -1801,7 +1915,7 @@ extern NCURSES_EXPORT(const char *) _nc_viswibuf(const wint_t *); #endif #endif /* NCURSES_WIDECHAR */ -/* $Id: curses.tail,v 1.20 2010/03/28 19:10:55 tom Exp $ */ +/* $Id: curses.tail,v 1.26 2021/03/20 15:49:25 tom Exp $ */ /* * vile:cmode: * This file is part of ncurses, designed to be appended after curses.h.in @@ -1810,43 +1924,43 @@ extern NCURSES_EXPORT(const char *) _nc_viswibuf(const wint_t *); /* mouse interface */ - #if NCURSES_MOUSE_VERSION > 1 #define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 5)) #else #define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 6)) #endif -//TODO implement this. -#define NCURSES_BUTTON_RELEASED 001L -#define NCURSES_BUTTON_PRESSED 002L -#define NCURSES_BUTTON_CLICKED 004L -#define NCURSES_DOUBLE_CLICKED 010L -#define NCURSES_TRIPLE_CLICKED 020L -#define NCURSES_RESERVED_EVENT 040L + +#define NCURSES_BUTTON_RELEASED 001L +#define NCURSES_BUTTON_PRESSED 002L +#define NCURSES_BUTTON_CLICKED 004L +#define NCURSES_DOUBLE_CLICKED 010L +#define NCURSES_TRIPLE_CLICKED 020L +#define NCURSES_RESERVED_EVENT 040L + /* event masks */ -#define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED) -#define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED) -#define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED) -#define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED) -#define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED) - -#define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED) -#define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED) -#define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED) -#define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED) -#define BUTTON2_TRIPLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED) - -#define BUTTON3_RELEASED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED) -#define BUTTON3_PRESSED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED) -#define BUTTON3_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED) -#define BUTTON3_DOUBLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED) -#define BUTTON3_TRIPLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED) - -#define BUTTON4_RELEASED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED) -#define BUTTON4_PRESSED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED) -#define BUTTON4_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED) -#define BUTTON4_DOUBLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED) -#define BUTTON4_TRIPLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED) +#define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED) +#define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED) +#define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED) +#define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED) +#define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED) + +#define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED) +#define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED) +#define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED) +#define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED) +#define BUTTON2_TRIPLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED) + +#define BUTTON3_RELEASED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED) +#define BUTTON3_PRESSED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED) +#define BUTTON3_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED) +#define BUTTON3_DOUBLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED) +#define BUTTON3_TRIPLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED) + +#define BUTTON4_RELEASED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED) +#define BUTTON4_PRESSED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED) +#define BUTTON4_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED) +#define BUTTON4_DOUBLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED) +#define BUTTON4_TRIPLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED) /* * In 32 bits the version-1 scheme does not provide enough space for a 5th @@ -1854,51 +1968,49 @@ extern NCURSES_EXPORT(const char *) _nc_viswibuf(const wint_t *); */ #if NCURSES_MOUSE_VERSION > 1 -#define BUTTON5_RELEASED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED) -#define BUTTON5_PRESSED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED) -#define BUTTON5_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED) -#define BUTTON5_DOUBLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED) -#define BUTTON5_TRIPLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED) +#define BUTTON5_RELEASED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED) +#define BUTTON5_PRESSED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED) +#define BUTTON5_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED) +#define BUTTON5_DOUBLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED) +#define BUTTON5_TRIPLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED) -#define BUTTON_CTRL NCURSES_MOUSE_MASK(6, 0001L) -#define BUTTON_SHIFT NCURSES_MOUSE_MASK(6, 0002L) -#define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L) -#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L) +#define BUTTON_CTRL NCURSES_MOUSE_MASK(6, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(6, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L) #else -//TODO these should be defined.. -#define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT) -#define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT) -#define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT) -#define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT) -//end -#define BUTTON_CTRL NCURSES_MOUSE_MASK(5, 0001L) -#define BUTTON_SHIFT NCURSES_MOUSE_MASK(5, 0002L) -#define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L) -#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L) + +#define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT) +#define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT) +#define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT) +#define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(5, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(5, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L) #endif -#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1) +#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1) /* macros to extract single event-bits from masks */ -//TODO -#define BUTTON_RELEASE(e, x) ((e) & NCURSES_MOUSE_MASK(x, 001)) -#define BUTTON_PRESS(e, x) ((e) & NCURSES_MOUSE_MASK(x, 002)) -#define BUTTON_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 004)) -#define BUTTON_DOUBLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 010)) -#define BUTTON_TRIPLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 020)) -#define BUTTON_RESERVED_EVENT(e, x) ((e) & NCURSES_MOUSE_MASK(x, 040)) +#define BUTTON_RELEASE(e, x) ((e) & NCURSES_MOUSE_MASK(x, 001)) +#define BUTTON_PRESS(e, x) ((e) & NCURSES_MOUSE_MASK(x, 002)) +#define BUTTON_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 004)) +#define BUTTON_DOUBLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 010)) +#define BUTTON_TRIPLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 020)) +#define BUTTON_RESERVED_EVENT(e, x) ((e) & NCURSES_MOUSE_MASK(x, 040)) typedef struct { - short id; /* ID to distinguish multiple devices */ - int x, y, z; /* event coordinates (character-cell) */ - mmask_t bstate; /* button state bits */ + short id; /* ID to distinguish multiple devices */ + int x, y, z; /* event coordinates (character-cell) */ + mmask_t bstate; /* button state bits */ } MEVENT; -//TODO has_mouse extern NCURSES_EXPORT(bool) has_mouse(void); extern NCURSES_EXPORT(int) getmouse (MEVENT *); extern NCURSES_EXPORT(int) ungetmouse (MEVENT *); @@ -1916,70 +2028,72 @@ extern NCURSES_EXPORT(mmask_t) NCURSES_SP_NAME(mousemask) (SCREEN*, mmask_t, mma extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mouseinterval) (SCREEN*, int); #endif +#ifndef NCURSES_NOMACROS #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen) +#endif /* other non-XSI functions */ -extern NCURSES_EXPORT(int) mcprint (char *, int); /* direct data to printer */ -extern NCURSES_EXPORT(int) has_key (int); /* do we have given key? */ +extern NCURSES_EXPORT(int) mcprint (char *, int); /* direct data to printer */ +extern NCURSES_EXPORT(int) has_key (int); /* do we have given key? */ #if NCURSES_SP_FUNCS extern NCURSES_EXPORT(int) NCURSES_SP_NAME(has_key) (SCREEN*, int); /* do we have given key? */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mcprint) (SCREEN*, char *, int); /* direct data to printer */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mcprint) (SCREEN*, char *, int); /* direct data to printer */ #endif /* Debugging : use with libncurses_g.a */ extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2); -extern NCURSES_EXPORT(void) _tracedump (const char *, WINDOW *); extern NCURSES_EXPORT(char *) _traceattr (attr_t); extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype); -extern NCURSES_EXPORT(char *) _nc_tracebits (void); extern NCURSES_EXPORT(char *) _tracechar (int); extern NCURSES_EXPORT(char *) _tracechtype (chtype); extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype); -#ifdef NCURSES_WIDECHAR -#define _tracech_t _tracecchar_t +#if NCURSES_WIDECHAR +#define _tracech_t _tracecchar_t extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *); -#define _tracech_t2 _tracecchar_t2 +#define _tracech_t2 _tracecchar_t2 extern NCURSES_EXPORT(char *) _tracecchar_t2 (int, const cchar_t *); #else -#define _tracech_t _tracechtype -#define _tracech_t2 _tracechtype2 +#define _tracech_t _tracechtype +#define _tracech_t2 _tracechtype2 #endif -extern NCURSES_EXPORT(char *) _tracemouse (const MEVENT *); -extern NCURSES_EXPORT(void) trace (const unsigned int); +extern NCURSES_EXPORT(void) trace (const unsigned) GCC_DEPRECATED("use curses_trace"); +extern NCURSES_EXPORT(unsigned) curses_trace (const unsigned); /* trace masks */ -#define TRACE_DISABLE 0x0000 /* turn off tracing */ -#define TRACE_TIMES 0x0001 /* trace user and system times of updates */ -#define TRACE_TPUTS 0x0002 /* trace tputs calls */ -#define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */ -#define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */ -#define TRACE_CHARPUT 0x0010 /* trace all character outputs */ -#define TRACE_ORDINARY 0x001F /* trace all update actions */ -#define TRACE_CALLS 0x0020 /* trace all curses calls */ -#define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */ -#define TRACE_IEVENT 0x0080 /* trace low-level input processing */ -#define TRACE_BITS 0x0100 /* trace state of TTY control bits */ -#define TRACE_ICALLS 0x0200 /* trace internal/nested calls */ -#define TRACE_CCALLS 0x0400 /* trace per-character calls */ -#define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */ -#define TRACE_ATTRS 0x1000 /* trace attribute updates */ - -#define TRACE_SHIFT 13 /* number of bits in the trace masks */ -#define TRACE_MAXIMUM ((1 << TRACE_SHIFT) - 1) /* maximum trace level */ +#define TRACE_DISABLE 0x0000 /* turn off tracing */ +#define TRACE_TIMES 0x0001 /* trace user and system times of updates */ +#define TRACE_TPUTS 0x0002 /* trace tputs calls */ +#define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */ +#define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */ +#define TRACE_CHARPUT 0x0010 /* trace all character outputs */ +#define TRACE_ORDINARY 0x001F /* trace all update actions */ +#define TRACE_CALLS 0x0020 /* trace all curses calls */ +#define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */ +#define TRACE_IEVENT 0x0080 /* trace low-level input processing */ +#define TRACE_BITS 0x0100 /* trace state of TTY control bits */ +#define TRACE_ICALLS 0x0200 /* trace internal/nested calls */ +#define TRACE_CCALLS 0x0400 /* trace per-character calls */ +#define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */ +#define TRACE_ATTRS 0x1000 /* trace attribute updates */ + +#define TRACE_SHIFT 13 /* number of bits in the trace masks */ +#define TRACE_MAXIMUM ((1 << TRACE_SHIFT) - 1) /* maximum trace level */ #if defined(TRACE) || defined(NCURSES_TEST) -extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ +extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); -#define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ -#define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ -#define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ -#define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */ +#define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ +#define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ +#define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ +#define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */ #endif -#include +extern GCC_NORETURN NCURSES_EXPORT(void) exit_curses (int); + +#include #ifdef __cplusplus diff --git a/C/cursesapp.h b/C/cursesapp.h new file mode 100644 index 0000000..1296f37 --- /dev/null +++ b/C/cursesapp.h @@ -0,0 +1,191 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright 2019-2020,2021 Thomas E. Dickey * + * Copyright 1998-2005,2011 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: cursesapp.h,v 1.18 2021/06/17 21:26:02 tom Exp $ + +#ifndef NCURSES_CURSESAPP_H_incl +#define NCURSES_CURSESAPP_H_incl + +#include + +#if (defined(_WIN32) || defined(_WIN64)) +# define NCURSES_CXX_MAIN_NAME cursespp_main +# define NCURSES_CXX_MAIN \ + int main(int argc, char *argv[]) { \ + return NCURSES_CXX_MAIN_NAME(argc, argv); \ + } +#else +# define NCURSES_CXX_MAIN_NAME main +#endif +NCURSES_CXX_IMPEXP int NCURSES_CXX_MAIN_NAME(int argc, char *argv[]); + +class NCURSES_CXX_IMPEXP NCursesApplication { +public: + typedef struct _slk_link { // This structure is used to maintain + struct _slk_link* prev; // a stack of SLKs + Soft_Label_Key_Set* SLKs; + } SLK_Link; +private: + static int rinit(NCursesWindow& w); // Internal Init function for title + static NCursesApplication* theApp; // Global ref. to the application + + static SLK_Link* slk_stack; + +protected: + static NCursesWindow* titleWindow; // The Title Window (if any) + + bool b_Colors; // Is this a color application? + NCursesWindow* Root_Window; // This is the stdscr equiv. + + // Initialization of attributes; + // Rewrite this in your derived class if you prefer other settings + virtual void init(bool bColors); + + // The number of lines for the title window. Default is no title window + // You may rewrite this in your derived class + virtual int titlesize() const { + return 0; + } + + // This method is called to put something into the title window initially + // You may rewrite this in your derived class + virtual void title() { + } + + // The layout used for the Soft Label Keys. Default is to have no SLKs. + // You may rewrite this in your derived class + virtual Soft_Label_Key_Set::Label_Layout useSLKs() const { + return Soft_Label_Key_Set::None; + } + + // This method is called to initialize the SLKs. Default is nothing. + // You may rewrite this in your derived class + virtual void init_labels(Soft_Label_Key_Set& S) const { + (void) S; + } + + // Your derived class must implement this method. The return value must + // be the exit value of your application. + virtual int run() = 0; + + // The constructor is protected, so you may use it in your derived + // class constructor. The argument tells whether or not you want colors. + NCursesApplication(bool wantColors = FALSE); + + NCursesApplication& operator=(const NCursesApplication& rhs) + { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesApplication(const NCursesApplication& rhs) + : b_Colors(rhs.b_Colors), + Root_Window(rhs.Root_Window) + { + } + + static NCursesWindow *&getTitleWindow(); + +public: + virtual ~NCursesApplication() THROWS(NCursesException); + + // Get a pointer to the current application object + static NCursesApplication* getApplication(); + + // This method runs the application and returns its exit value + int operator()(void); + + // Process the commandline arguments. The default implementation simply + // ignores them. Your derived class may rewrite this. + virtual void handleArgs(int argc, char* argv[]) { + (void) argc; + (void) argv; + } + + // Does this application use colors? + inline bool useColors() const { + return b_Colors; + } + + // Push the Key Set S onto the SLK Stack. S then becomes the current set + // of Soft Labelled Keys. + void push(Soft_Label_Key_Set& S); + + // Throw away the current set of SLKs and make the previous one the + // new current set. + bool pop(); + + // Retrieve the current set of Soft Labelled Keys. + Soft_Label_Key_Set* top() const; + + // Attributes to use for menu and forms foregrounds + virtual chtype foregrounds() const { + return b_Colors ? static_cast(COLOR_PAIR(1)) : A_BOLD; + } + + // Attributes to use for menu and forms backgrounds + virtual chtype backgrounds() const { + return b_Colors ? static_cast(COLOR_PAIR(2)) : A_NORMAL; + } + + // Attributes to use for inactive (menu) elements + virtual chtype inactives() const { + return b_Colors ? static_cast(COLOR_PAIR(3)|A_DIM) : A_DIM; + } + + // Attributes to use for (form) labels and SLKs + virtual chtype labels() const { + return b_Colors ? static_cast(COLOR_PAIR(4)) : A_NORMAL; + } + + // Attributes to use for form backgrounds + virtual chtype dialog_backgrounds() const { + return b_Colors ? static_cast(COLOR_PAIR(4)) : A_NORMAL; + } + + // Attributes to use as default for (form) window backgrounds + virtual chtype window_backgrounds() const { + return b_Colors ? static_cast(COLOR_PAIR(5)) : A_NORMAL; + } + + // Attributes to use for the title window + virtual chtype screen_titles() const { + return b_Colors ? static_cast(COLOR_PAIR(6)) : A_BOLD; + } + +}; + +#endif /* NCURSES_CURSESAPP_H_incl */ diff --git a/C/cursesf.h b/C/cursesf.h new file mode 100644 index 0000000..ea1aaf0 --- /dev/null +++ b/C/cursesf.h @@ -0,0 +1,968 @@ +// * This makes emacs happy -*-Mode: C++;-*- +// vile:cppmode +/**************************************************************************** + * Copyright 2019-2020,2021 Thomas E. Dickey * + * Copyright 1998-2012,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: cursesf.h,v 1.38 2021/04/17 18:11:08 tom Exp $ + +#ifndef NCURSES_CURSESF_H_incl +#define NCURSES_CURSESF_H_incl 1 + +#include + +#ifndef __EXT_QNX +#include +#endif + +extern "C" { +# include +} +// +// ------------------------------------------------------------------------- +// The abstract base class for builtin and user defined Fieldtypes. +// ------------------------------------------------------------------------- +// +class NCURSES_CXX_IMPEXP NCursesFormField; // forward declaration + +// Class to represent builtin field types as well as C++ written new +// fieldtypes (see classes UserDefineFieldType... +class NCURSES_CXX_IMPEXP NCursesFieldType +{ + friend class NCursesFormField; + +protected: + FIELDTYPE* fieldtype; + + inline void OnError(int err) const THROW2(NCursesException const, NCursesFormException) { + if (err!=E_OK) + THROW(new NCursesFormException (err)); + } + + NCursesFieldType(FIELDTYPE *f) : fieldtype(f) { + } + + virtual ~NCursesFieldType() {} + + // Set the fields f fieldtype to this one. + virtual void set(NCursesFormField& f) = 0; + +public: + NCursesFieldType() + : fieldtype(STATIC_CAST(FIELDTYPE*)(0)) + { + } + + NCursesFieldType& operator=(const NCursesFieldType& rhs) + { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesFieldType(const NCursesFieldType& rhs) + : fieldtype(rhs.fieldtype) + { + } + +}; + +// +// ------------------------------------------------------------------------- +// The class representing a forms field, wrapping the lowlevel FIELD struct +// ------------------------------------------------------------------------- +// +class NCURSES_CXX_IMPEXP NCursesFormField +{ + friend class NCursesForm; + +protected: + FIELD *field; // lowlevel structure + NCursesFieldType* ftype; // Associated field type + + // Error handler + inline void OnError (int err) const THROW2(NCursesException const, NCursesFormException) { + if (err != E_OK) + THROW(new NCursesFormException (err)); + } + +public: + // Create a 'Null' field. Can be used to delimit a field list + NCursesFormField() + : field(STATIC_CAST(FIELD*)(0)), + ftype(STATIC_CAST(NCursesFieldType*)(0)) + { + } + + // Create a new field + NCursesFormField (int rows, + int ncols, + int first_row = 0, + int first_col = 0, + int offscreen_rows = 0, + int additional_buffers = 0) + : field(0), + ftype(STATIC_CAST(NCursesFieldType*)(0)) + { + field = ::new_field(rows, ncols, first_row, first_col, + offscreen_rows, additional_buffers); + if (!field) + OnError(errno); + } + + NCursesFormField& operator=(const NCursesFormField& rhs) + { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesFormField(const NCursesFormField& rhs) + : field(rhs.field), ftype(rhs.ftype) + { + } + + virtual ~NCursesFormField () THROWS(NCursesException); + + // Duplicate the field at a new position + inline NCursesFormField* dup(int first_row, int first_col) + { + NCursesFormField* f = new NCursesFormField(); + if (!f) + OnError(E_SYSTEM_ERROR); + else { + f->ftype = ftype; + f->field = ::dup_field(field,first_row,first_col); + if (!f->field) + OnError(errno); + } + return f; + } + + // Link the field to a new location + inline NCursesFormField* link(int first_row, int first_col) { + NCursesFormField* f = new NCursesFormField(); + if (!f) + OnError(E_SYSTEM_ERROR); + else { + f->ftype = ftype; + f->field = ::link_field(field,first_row,first_col); + if (!f->field) + OnError(errno); + } + return f; + } + + // Get the lowlevel field representation + inline FIELD* get_field() const { + return field; + } + + // Retrieve info about the field + inline void info(int& rows, int& ncols, + int& first_row, int& first_col, + int& offscreen_rows, int& additional_buffers) const { + OnError(::field_info(field, &rows, &ncols, + &first_row, &first_col, + &offscreen_rows, &additional_buffers)); + } + + // Retrieve info about the fields dynamic properties. + inline void dynamic_info(int& dynamic_rows, int& dynamic_cols, + int& max_growth) const { + OnError(::dynamic_field_info(field, &dynamic_rows, &dynamic_cols, + &max_growth)); + } + + // For a dynamic field you may set the maximum growth limit. + // A zero means unlimited growth. + inline void set_maximum_growth(int growth = 0) { + OnError(::set_max_field(field,growth)); + } + + // Move the field to a new position + inline void move(int row, int col) { + OnError(::move_field(field,row,col)); + } + + // Mark the field to start a new page + inline void new_page(bool pageFlag = FALSE) { + OnError(::set_new_page(field,pageFlag)); + } + + // Retrieve whether or not the field starts a new page. + inline bool is_new_page() const { + return ::new_page(field); + } + + // Set the justification for the field + inline void set_justification(int just) { + OnError(::set_field_just(field,just)); + } + + // Retrieve the fields justification + inline int justification() const { + return ::field_just(field); + } + // Set the foreground attribute for the field + inline void set_foreground(chtype foreground) { + OnError(::set_field_fore(field,foreground)); + } + + // Retrieve the fields foreground attribute + inline chtype fore() const { + return ::field_fore(field); + } + + // Set the background attribute for the field + inline void set_background(chtype background) { + OnError(::set_field_back(field,background)); + } + + // Retrieve the fields background attribute + inline chtype back() const { + return ::field_back(field); + } + + // Set the padding character for the field + inline void set_pad_character(int padding) { + OnError(::set_field_pad(field, padding)); + } + + // Retrieve the fields padding character + inline int pad() const { + return ::field_pad(field); + } + + // Switch on the fields options + inline void options_on (Field_Options opts) { + OnError (::field_opts_on (field, opts)); + } + + // Switch off the fields options + inline void options_off (Field_Options opts) { + OnError (::field_opts_off (field, opts)); + } + + // Retrieve the fields options + inline Field_Options options () const { + return ::field_opts (field); + } + + // Set the fields options + inline void set_options (Field_Options opts) { + OnError (::set_field_opts (field, opts)); + } + + // Mark the field as changed + inline void set_changed(bool changeFlag = TRUE) { + OnError(::set_field_status(field,changeFlag)); + } + + // Test whether or not the field is marked as changed + inline bool changed() const { + return ::field_status(field); + } + + // Return the index of the field in the field array of a form + // or -1 if the field is not associated to a form + inline int (index)() const { + return ::field_index(field); + } + + // Store a value in a fields buffer. The default buffer is nr. 0 + inline void set_value(const char *val, int buffer = 0) { + OnError(::set_field_buffer(field,buffer,val)); + } + + // Retrieve the value of a fields buffer. The default buffer is nr. 0 + inline char* value(int buffer = 0) const { + return ::field_buffer(field,buffer); + } + + // Set the validation type of the field. + inline void set_fieldtype(NCursesFieldType& f) { + ftype = &f; + f.set(*this); // A good friend may do that... + } + + // Retrieve the validation type of the field. + inline NCursesFieldType* fieldtype() const { + return ftype; + } + +}; + + // This are the built-in hook functions in this C++ binding. In C++ we use + // virtual member functions (see below On_..._Init and On_..._Termination) + // to provide this functionality in an object oriented manner. +extern "C" { + void _nc_xx_frm_init(FORM *); + void _nc_xx_frm_term(FORM *); + void _nc_xx_fld_init(FORM *); + void _nc_xx_fld_term(FORM *); +} + +// +// ------------------------------------------------------------------------- +// The class representing a form, wrapping the lowlevel FORM struct +// ------------------------------------------------------------------------- +// +class NCURSES_CXX_IMPEXP NCursesForm : public NCursesPanel +{ +protected: + FORM* form; // the lowlevel structure + +private: + NCursesWindow* sub; // the subwindow object + bool b_sub_owner; // is this our own subwindow? + bool b_framed; // has the form a border? + bool b_autoDelete; // Delete fields when deleting form? + + NCursesFormField** my_fields; // The array of fields for this form + + // This structure is used for the form's user data field to link the + // FORM* to the C++ object and to provide extra space for a user pointer. + typedef struct { + void* m_user; // the pointer for the user's data + const NCursesForm* m_back; // backward pointer to C++ object + const FORM* m_owner; + } UserHook; + + // Get the backward pointer to the C++ object from a FORM + static inline NCursesForm* getHook(const FORM *f) { + UserHook* hook = reinterpret_cast(::form_userptr(f)); + assert(hook != 0 && hook->m_owner==f); + return const_cast(hook->m_back); + } + + friend void _nc_xx_frm_init(FORM *); + friend void _nc_xx_frm_term(FORM *); + friend void _nc_xx_fld_init(FORM *); + friend void _nc_xx_fld_term(FORM *); + + // Calculate FIELD* array for the menu + FIELD** mapFields(NCursesFormField* nfields[]); + +protected: + // internal routines + inline void set_user(void *user) { + UserHook* uptr = reinterpret_cast(::form_userptr (form)); + assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==form); + uptr->m_user = user; + } + + inline void *get_user() { + UserHook* uptr = reinterpret_cast(::form_userptr (form)); + assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==form); + return uptr->m_user; + } + + void InitForm (NCursesFormField* Fields[], + bool with_frame, + bool autoDeleteFields); + + inline void OnError (int err) const THROW2(NCursesException const, NCursesFormException) { + if (err != E_OK) + THROW(new NCursesFormException (err)); + } + + // this wraps the form_driver call. + virtual int driver (int c) ; + + // 'Internal' constructor, builds an object without association to a + // field array. + NCursesForm( int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0) + : NCursesPanel(nlines, ncols, begin_y, begin_x), + form (STATIC_CAST(FORM*)(0)), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_fields(0) + { + } + +public: + // Create form for the default panel. + NCursesForm (NCursesFormField* Fields[], + bool with_frame=FALSE, // reserve space for a frame? + bool autoDelete_Fields=FALSE) // do automatic cleanup? + : NCursesPanel(), + form(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_fields(0) + { + InitForm(Fields, with_frame, autoDelete_Fields); + } + + // Create a form in a panel with the given position and size. + NCursesForm (NCursesFormField* Fields[], + int nlines, + int ncols, + int begin_y, + int begin_x, + bool with_frame=FALSE, // reserve space for a frame? + bool autoDelete_Fields=FALSE) // do automatic cleanup? + : NCursesPanel(nlines, ncols, begin_y, begin_x), + form(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_fields(0) + { + InitForm(Fields, with_frame, autoDelete_Fields); + } + + NCursesForm& operator=(const NCursesForm& rhs) + { + if (this != &rhs) { + *this = rhs; + NCursesPanel::operator=(rhs); + } + return *this; + } + + NCursesForm(const NCursesForm& rhs) + : NCursesPanel(rhs), + form(rhs.form), + sub(rhs.sub), + b_sub_owner(rhs.b_sub_owner), + b_framed(rhs.b_framed), + b_autoDelete(rhs.b_autoDelete), + my_fields(rhs.my_fields) + { + } + + virtual ~NCursesForm() THROWS(NCursesException); + + // Set the default attributes for the form + virtual void setDefaultAttributes(); + + // Retrieve current field of the form. + inline NCursesFormField* current_field() const { + return my_fields[::field_index(::current_field(form))]; + } + + // Set the forms subwindow + void setSubWindow(NCursesWindow& sub); + + // Set these fields for the form + inline void setFields(NCursesFormField* Fields[]) { + OnError(::set_form_fields(form,mapFields(Fields))); + } + + // Remove the form from the screen + inline void unpost (void) { + OnError (::unpost_form (form)); + } + + // Post the form to the screen if flag is true, unpost it otherwise + inline void post(bool flag = TRUE) { + OnError (flag ? ::post_form(form) : ::unpost_form (form)); + } + + // Decorations + inline void frame(const char *title=NULL, const char* btitle=NULL) { + if (b_framed) + NCursesPanel::frame(title,btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void boldframe(const char *title=NULL, const char* btitle=NULL) { + if (b_framed) + NCursesPanel::boldframe(title,btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void label(const char *topLabel, const char *bottomLabel) { + if (b_framed) + NCursesPanel::label(topLabel,bottomLabel); + else + OnError(E_SYSTEM_ERROR); + } + + // ----- + // Hooks + // ----- + + // Called after the form gets repositioned in its window. + // This is especially true if the form is posted. + virtual void On_Form_Init(); + + // Called before the form gets repositioned in its window. + // This is especially true if the form is unposted. + virtual void On_Form_Termination(); + + // Called after the field became the current field + virtual void On_Field_Init(NCursesFormField& field); + + // Called before this field is left as current field. + virtual void On_Field_Termination(NCursesFormField& field); + + // Calculate required window size for the form. + void scale(int& rows, int& ncols) const { + OnError(::scale_form(form,&rows,&ncols)); + } + + // Retrieve number of fields in the form. + int count() const { + return ::field_count(form); + } + + // Make the page the current page of the form. + void set_page(int pageNum) { + OnError(::set_form_page(form, pageNum)); + } + + // Retrieve current page number + int page() const { + return ::form_page(form); + } + + // Switch on the forms options + inline void options_on (Form_Options opts) { + OnError (::form_opts_on (form, opts)); + } + + // Switch off the forms options + inline void options_off (Form_Options opts) { + OnError (::form_opts_off (form, opts)); + } + + // Retrieve the forms options + inline Form_Options options () const { + return ::form_opts (form); + } + + // Set the forms options + inline void set_options (Form_Options opts) { + OnError (::set_form_opts (form, opts)); + } + + // Are there more data in the current field after the data shown + inline bool data_ahead() const { + return ::data_ahead(form); + } + + // Are there more data in the current field before the data shown + inline bool data_behind() const { + return ::data_behind(form); + } + + // Position the cursor to the current field + inline void position_cursor () { + OnError (::pos_form_cursor (form)); + } + // Set the current field + inline void set_current(NCursesFormField& F) { + OnError (::set_current_field(form, F.field)); + } + + // Provide a default key virtualization. Translate the keyboard + // code c into a form request code. + // The default implementation provides a hopefully straightforward + // mapping for the most common keystrokes and form requests. + virtual int virtualize(int c); + + // Operators + inline NCursesFormField* operator[](int i) const { + if ( (i < 0) || (i >= ::field_count (form)) ) + OnError (E_BAD_ARGUMENT); + return my_fields[i]; + } + + // Perform the menu's operation + // Return the field where you left the form. + virtual NCursesFormField* operator()(void); + + // Exception handlers. The default is a Beep. + virtual void On_Request_Denied(int c) const; + virtual void On_Invalid_Field(int c) const; + virtual void On_Unknown_Command(int c) const; + +}; + +// +// ------------------------------------------------------------------------- +// This is the typical C++ typesafe way to allow to attach +// user data to a field of a form. Its assumed that the user +// data belongs to some class T. Use T as template argument +// to create a UserField. +// ------------------------------------------------------------------------- +template class NCURSES_CXX_IMPEXP NCursesUserField : public NCursesFormField +{ +public: + NCursesUserField (int rows, + int ncols, + int first_row = 0, + int first_col = 0, + const T* p_UserData = STATIC_CAST(T*)(0), + int offscreen_rows = 0, + int additional_buffers = 0) + : NCursesFormField (rows, ncols, + first_row, first_col, + offscreen_rows, additional_buffers) { + if (field) + OnError(::set_field_userptr(field, STATIC_CAST(void *)(p_UserData))); + } + + virtual ~NCursesUserField() THROWS(NCursesException) {}; + + inline const T* UserData (void) const { + return reinterpret_cast(::field_userptr (field)); + } + + inline virtual void setUserData(const T* p_UserData) { + if (field) + OnError (::set_field_userptr (field, STATIC_CAST(void *)(p_UserData))); + } +}; +// +// ------------------------------------------------------------------------- +// The same mechanism is used to attach user data to a form +// ------------------------------------------------------------------------- +// +template class NCURSES_CXX_IMPEXP NCursesUserForm : public NCursesForm +{ +protected: + // 'Internal' constructor, builds an object without association to a + // field array. + NCursesUserForm( int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesForm(nlines,ncols,begin_y,begin_x) { + if (form) + set_user (const_cast(reinterpret_cast + (p_UserData))); + } + +public: + NCursesUserForm (NCursesFormField* Fields[], + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame=FALSE, + bool autoDelete_Fields=FALSE) + : NCursesForm (Fields, with_frame, autoDelete_Fields) { + if (form) + set_user (const_cast(reinterpret_cast(p_UserData))); + }; + + NCursesUserForm (NCursesFormField* Fields[], + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame=FALSE, + bool autoDelete_Fields=FALSE) + : NCursesForm (Fields, nlines, ncols, begin_y, begin_x, + with_frame, autoDelete_Fields) { + if (form) + set_user (const_cast(reinterpret_cast + (p_UserData))); + }; + + virtual ~NCursesUserForm() THROWS(NCursesException) { + }; + + inline T* UserData (void) { + return reinterpret_cast(get_user ()); + }; + + inline virtual void setUserData (const T* p_UserData) { + if (form) + set_user (const_cast(reinterpret_cast(p_UserData))); + } + +}; +// +// ------------------------------------------------------------------------- +// Builtin Fieldtypes +// ------------------------------------------------------------------------- +// +class NCURSES_CXX_IMPEXP Alpha_Field : public NCursesFieldType +{ +private: + int min_field_width; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype,min_field_width)); + } + +public: + explicit Alpha_Field(int width) + : NCursesFieldType(TYPE_ALPHA), + min_field_width(width) { + } +}; + +class NCURSES_CXX_IMPEXP Alphanumeric_Field : public NCursesFieldType +{ +private: + int min_field_width; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype,min_field_width)); + } + +public: + explicit Alphanumeric_Field(int width) + : NCursesFieldType(TYPE_ALNUM), + min_field_width(width) { + } +}; + +class NCURSES_CXX_IMPEXP Integer_Field : public NCursesFieldType +{ +private: + int precision; + long lower_limit, upper_limit; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype, + precision,lower_limit,upper_limit)); + } + +public: + Integer_Field(int prec, long low=0L, long high=0L) + : NCursesFieldType(TYPE_INTEGER), + precision(prec), lower_limit(low), upper_limit(high) { + } +}; + +class NCURSES_CXX_IMPEXP Numeric_Field : public NCursesFieldType +{ +private: + int precision; + double lower_limit, upper_limit; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype, + precision,lower_limit,upper_limit)); + } + +public: + Numeric_Field(int prec, double low=0.0, double high=0.0) + : NCursesFieldType(TYPE_NUMERIC), + precision(prec), lower_limit(low), upper_limit(high) { + } +}; + +class NCURSES_CXX_IMPEXP Regular_Expression_Field : public NCursesFieldType +{ +private: + char* regex; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype,regex)); + } + + void copy_regex(const char *source) + { + regex = new char[1 + ::strlen(source)]; + (::strcpy)(regex, source); + } + +public: + explicit Regular_Expression_Field(const char *expr) + : NCursesFieldType(TYPE_REGEXP), + regex(NULL) + { + copy_regex(expr); + } + + Regular_Expression_Field& operator=(const Regular_Expression_Field& rhs) + { + if (this != &rhs) { + *this = rhs; + copy_regex(rhs.regex); + NCursesFieldType::operator=(rhs); + } + return *this; + } + + Regular_Expression_Field(const Regular_Expression_Field& rhs) + : NCursesFieldType(rhs), + regex(NULL) + { + copy_regex(rhs.regex); + } + + ~Regular_Expression_Field() { + delete[] regex; + } +}; + +class NCURSES_CXX_IMPEXP Enumeration_Field : public NCursesFieldType +{ +private: + const char** list; + int case_sensitive; + int non_unique_matches; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype, + list,case_sensitive,non_unique_matches)); + } +public: + Enumeration_Field(const char* enums[], + bool case_sens=FALSE, + bool non_unique=FALSE) + : NCursesFieldType(TYPE_ENUM), + list(enums), + case_sensitive(case_sens ? -1 : 0), + non_unique_matches(non_unique ? -1 : 0) { + } + + Enumeration_Field& operator=(const Enumeration_Field& rhs) + { + if (this != &rhs) { + *this = rhs; + NCursesFieldType::operator=(rhs); + } + return *this; + } + + Enumeration_Field(const Enumeration_Field& rhs) + : NCursesFieldType(rhs), + list(rhs.list), + case_sensitive(rhs.case_sensitive), + non_unique_matches(rhs.non_unique_matches) + { + } +}; + +class NCURSES_CXX_IMPEXP IPV4_Address_Field : public NCursesFieldType +{ +private: + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype)); + } + +public: + IPV4_Address_Field() : NCursesFieldType(TYPE_IPV4) { + } +}; + +extern "C" { + bool _nc_xx_fld_fcheck(FIELD *, const void*); + bool _nc_xx_fld_ccheck(int c, const void *); + void* _nc_xx_fld_makearg(va_list*); +} + +// +// ------------------------------------------------------------------------- +// Abstract base class for User-Defined Fieldtypes +// ------------------------------------------------------------------------- +// +class NCURSES_CXX_IMPEXP UserDefinedFieldType : public NCursesFieldType +{ + friend class UDF_Init; // Internal helper to set up statics +private: + // For all C++ defined fieldtypes we need only one generic lowlevel + // FIELDTYPE* element. + static FIELDTYPE* generic_fieldtype; + +protected: + // This are the functions required by the low level libforms functions + // to construct a fieldtype. + friend bool _nc_xx_fld_fcheck(FIELD *, const void*); + friend bool _nc_xx_fld_ccheck(int c, const void *); + friend void* _nc_xx_fld_makearg(va_list*); + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype,&f)); + } + +protected: + // Redefine this function to do a field validation. The argument + // is a reference to the field you should validate. + virtual bool field_check(NCursesFormField& f) = 0; + + // Redefine this function to do a character validation. The argument + // is the character to be validated. + virtual bool char_check (int c) = 0; + +public: + UserDefinedFieldType(); +}; + +extern "C" { + bool _nc_xx_next_choice(FIELD*, const void *); + bool _nc_xx_prev_choice(FIELD*, const void *); +} + +// +// ------------------------------------------------------------------------- +// Abstract base class for User-Defined Fieldtypes with Choice functions +// ------------------------------------------------------------------------- +// +class NCURSES_CXX_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType +{ + friend class UDF_Init; // Internal helper to set up statics +private: + // For all C++ defined fieldtypes with choice functions we need only one + // generic lowlevel FIELDTYPE* element. + static FIELDTYPE* generic_fieldtype_with_choice; + + // This are the functions required by the low level libforms functions + // to construct a fieldtype with choice functions. + friend bool _nc_xx_next_choice(FIELD*, const void *); + friend bool _nc_xx_prev_choice(FIELD*, const void *); + +protected: + // Redefine this function to do the retrieval of the next choice value. + // The argument is a reference to the field tobe examined. + virtual bool next (NCursesFormField& f) = 0; + + // Redefine this function to do the retrieval of the previous choice value. + // The argument is a reference to the field tobe examined. + virtual bool previous(NCursesFormField& f) = 0; + +public: + UserDefinedFieldType_With_Choice(); +}; + +#endif /* NCURSES_CURSESF_H_incl */ diff --git a/C/cursesm.h b/C/cursesm.h new file mode 100644 index 0000000..383c7e1 --- /dev/null +++ b/C/cursesm.h @@ -0,0 +1,674 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 1998-2012,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: cursesm.h,v 1.34 2020/05/24 01:40:20 anonymous.maarten Exp $ + +#ifndef NCURSES_CURSESM_H_incl +#define NCURSES_CURSESM_H_incl 1 + +#include + +extern "C" { +# include +} +// +// ------------------------------------------------------------------------- +// This wraps the ITEM type of +// ------------------------------------------------------------------------- +// +class NCURSES_CXX_IMPEXP NCursesMenuItem +{ + friend class NCursesMenu; + +protected: + ITEM *item; + + inline void OnError (int err) const THROW2(NCursesException const, NCursesMenuException) { + if (err != E_OK) + THROW(new NCursesMenuException (err)); + } + +public: + NCursesMenuItem (const char* p_name = NULL, + const char* p_descript = NULL) + : item(0) + { + item = p_name ? ::new_item (p_name, p_descript) : STATIC_CAST(ITEM*)(0); + if (p_name && !item) + OnError (E_SYSTEM_ERROR); + } + // Create an item. If you pass both parameters as NULL, a delimiting + // item is constructed which can be used to terminate a list of + // NCursesMenu objects. + + NCursesMenuItem& operator=(const NCursesMenuItem& rhs) + { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesMenuItem(const NCursesMenuItem& rhs) + : item(0) + { + (void) rhs; + } + + virtual ~NCursesMenuItem () THROWS(NCursesException); + // Release the items memory + + inline const char* name () const { + return ::item_name (item); + } + // Name of the item + + inline const char* description () const { + return ::item_description (item); + } + // Description of the item + + inline int (index) (void) const { + return ::item_index (item); + } + // Index of the item in an item array (or -1) + + inline void options_on (Item_Options opts) { + OnError (::item_opts_on (item, opts)); + } + // Switch on the items options + + inline void options_off (Item_Options opts) { + OnError (::item_opts_off (item, opts)); + } + // Switch off the item's option + + inline Item_Options options () const { + return ::item_opts (item); + } + // Retrieve the items options + + inline void set_options (Item_Options opts) { + OnError (::set_item_opts (item, opts)); + } + // Set the items options + + inline void set_value (bool f) { + OnError (::set_item_value (item,f)); + } + // Set/Reset the items selection state + + inline bool value () const { + return ::item_value (item); + } + // Retrieve the items selection state + + inline bool visible () const { + return ::item_visible (item); + } + // Retrieve visibility of the item + + virtual bool action(); + // Perform an action associated with this item; you may use this in an + // user supplied driver for a menu; you may derive from this class and + // overload action() to supply items with different actions. + // If an action returns true, the menu will be exited. The default action + // is to do nothing. +}; + +// Prototype for an items callback function. +typedef bool ITEMCALLBACK(NCursesMenuItem&); + +// If you don't like to create a child class for individual items to +// overload action(), you may use this class and provide a callback +// function pointer for items. +class NCURSES_CXX_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem +{ +private: + ITEMCALLBACK* p_fct; + +public: + NCursesMenuCallbackItem(ITEMCALLBACK* fct = NULL, + const char* p_name = NULL, + const char* p_descript = NULL ) + : NCursesMenuItem (p_name, p_descript), + p_fct (fct) { + } + + NCursesMenuCallbackItem& operator=(const NCursesMenuCallbackItem& rhs) + { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesMenuCallbackItem(const NCursesMenuCallbackItem& rhs) + : NCursesMenuItem(rhs), + p_fct(0) + { + } + + virtual ~NCursesMenuCallbackItem() THROWS(NCursesException); + + bool action(); +}; + + // This are the built-in hook functions in this C++ binding. In C++ we use + // virtual member functions (see below On_..._Init and On_..._Termination) + // to provide this functionality in an object oriented manner. +extern "C" { + void _nc_xx_mnu_init(MENU *); + void _nc_xx_mnu_term(MENU *); + void _nc_xx_itm_init(MENU *); + void _nc_xx_itm_term(MENU *); +} + +// +// ------------------------------------------------------------------------- +// This wraps the MENU type of +// ------------------------------------------------------------------------- +// +class NCURSES_CXX_IMPEXP NCursesMenu : public NCursesPanel +{ +protected: + MENU *menu; + +private: + NCursesWindow* sub; // the subwindow object + bool b_sub_owner; // is this our own subwindow? + bool b_framed; // has the menu a border? + bool b_autoDelete; // Delete items when deleting menu? + + NCursesMenuItem** my_items; // The array of items for this menu + + // This structure is used for the menu's user data field to link the + // MENU* to the C++ object and to provide extra space for a user pointer. + typedef struct { + void* m_user; // the pointer for the user's data + const NCursesMenu* m_back; // backward pointer to C++ object + const MENU* m_owner; + } UserHook; + + // Get the backward pointer to the C++ object from a MENU + static inline NCursesMenu* getHook(const MENU *m) { + UserHook* hook = STATIC_CAST(UserHook*)(::menu_userptr(m)); + assert(hook != 0 && hook->m_owner==m); + return const_cast(hook->m_back); + } + + friend void _nc_xx_mnu_init(MENU *); + friend void _nc_xx_mnu_term(MENU *); + friend void _nc_xx_itm_init(MENU *); + friend void _nc_xx_itm_term(MENU *); + + // Calculate ITEM* array for the menu + ITEM** mapItems(NCursesMenuItem* nitems[]); + +protected: + // internal routines + inline void set_user(void *user) { + UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr (menu)); + assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==menu); + uptr->m_user = user; + } + + inline void *get_user() { + UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr (menu)); + assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==menu); + return uptr->m_user; + } + + void InitMenu (NCursesMenuItem* menu[], + bool with_frame, + bool autoDeleteItems); + + inline void OnError (int err) const THROW2(NCursesException const, NCursesMenuException) { + if (err != E_OK) + THROW(new NCursesMenuException (this, err)); + } + + // this wraps the menu_driver call. + virtual int driver (int c) ; + + // 'Internal' constructor to create a menu without association to + // an array of items. + NCursesMenu( int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0) + : NCursesPanel(nlines,ncols,begin_y,begin_x), + menu (STATIC_CAST(MENU*)(0)), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_items(0) + { + } + +public: + // Make a full window size menu + NCursesMenu (NCursesMenuItem* Items[], + bool with_frame=FALSE, // Reserve space for a frame? + bool autoDelete_Items=FALSE) // Autocleanup of Items? + : NCursesPanel(), + menu(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_items(0) + { + InitMenu(Items, with_frame, autoDelete_Items); + } + + // Make a menu with a window of this size. + NCursesMenu (NCursesMenuItem* Items[], + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + bool with_frame=FALSE, // Reserve space for a frame? + bool autoDelete_Items=FALSE) // Autocleanup of Items? + : NCursesPanel(nlines, ncols, begin_y, begin_x), + menu(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_items(0) + { + InitMenu(Items, with_frame, autoDelete_Items); + } + + NCursesMenu& operator=(const NCursesMenu& rhs) + { + if (this != &rhs) { + *this = rhs; + NCursesPanel::operator=(rhs); + } + return *this; + } + + NCursesMenu(const NCursesMenu& rhs) + : NCursesPanel(rhs), + menu(rhs.menu), + sub(rhs.sub), + b_sub_owner(rhs.b_sub_owner), + b_framed(rhs.b_framed), + b_autoDelete(rhs.b_autoDelete), + my_items(rhs.my_items) + { + } + + virtual ~NCursesMenu () THROWS(NCursesException); + + // Retrieve the menus subwindow + inline NCursesWindow& subWindow() const { + assert(sub!=NULL); + return *sub; + } + + // Set the menus subwindow + void setSubWindow(NCursesWindow& sub); + + // Set these items for the menu + inline void setItems(NCursesMenuItem* Items[]) { + OnError(::set_menu_items(menu,mapItems(Items))); + } + + // Remove the menu from the screen + inline void unpost (void) { + OnError (::unpost_menu (menu)); + } + + // Post the menu to the screen if flag is true, unpost it otherwise + inline void post(bool flag = TRUE) { + flag ? OnError (::post_menu(menu)) : OnError (::unpost_menu (menu)); + } + + // Get the number of rows and columns for this menu + inline void scale (int& mrows, int& mcols) const { + OnError (::scale_menu (menu, &mrows, &mcols)); + } + + // Set the format of this menu + inline void set_format(int mrows, int mcols) { + OnError (::set_menu_format(menu, mrows, mcols)); + } + + // Get the format of this menu + inline void menu_format(int& rows,int& ncols) { + ::menu_format(menu,&rows,&ncols); + } + + // Items of the menu + inline NCursesMenuItem* items() const { + return *my_items; + } + + // Get the number of items in this menu + inline int count() const { + return ::item_count(menu); + } + + // Get the current item (i.e. the one the cursor is located) + inline NCursesMenuItem* current_item() const { + return my_items[::item_index(::current_item(menu))]; + } + + // Get the marker string + inline const char* mark() const { + return ::menu_mark(menu); + } + + // Set the marker string + inline void set_mark(const char *marker) { + OnError (::set_menu_mark (menu, marker)); + } + + // Get the name of the request code c + inline static const char* request_name(int c) { + return ::menu_request_name(c); + } + + // Get the current pattern + inline char* pattern() const { + return ::menu_pattern(menu); + } + + // true if there is a pattern match, false otherwise. + bool set_pattern (const char *pat); + + // set the default attributes for the menu + // i.e. set fore, back and grey attribute + virtual void setDefaultAttributes(); + + // Get the menus background attributes + inline chtype back() const { + return ::menu_back(menu); + } + + // Get the menus foreground attributes + inline chtype fore() const { + return ::menu_fore(menu); + } + + // Get the menus grey attributes (used for unselectable items) + inline chtype grey() const { + return ::menu_grey(menu); + } + + // Set the menus background attributes + inline chtype set_background(chtype a) { + return ::set_menu_back(menu,a); + } + + // Set the menus foreground attributes + inline chtype set_foreground(chtype a) { + return ::set_menu_fore(menu,a); + } + + // Set the menus grey attributes (used for unselectable items) + inline chtype set_grey(chtype a) { + return ::set_menu_grey(menu,a); + } + + inline void options_on (Menu_Options opts) { + OnError (::menu_opts_on (menu,opts)); + } + + inline void options_off(Menu_Options opts) { + OnError (::menu_opts_off(menu,opts)); + } + + inline Menu_Options options() const { + return ::menu_opts(menu); + } + + inline void set_options (Menu_Options opts) { + OnError (::set_menu_opts (menu,opts)); + } + + inline int pad() const { + return ::menu_pad(menu); + } + + inline void set_pad (int padch) { + OnError (::set_menu_pad (menu, padch)); + } + + // Position the cursor to the current item + inline void position_cursor () const { + OnError (::pos_menu_cursor (menu)); + } + + // Set the current item + inline void set_current(NCursesMenuItem& I) { + OnError (::set_current_item(menu, I.item)); + } + + // Get the current top row of the menu + inline int top_row (void) const { + return ::top_row (menu); + } + + // Set the current top row of the menu + inline void set_top_row (int row) { + OnError (::set_top_row (menu, row)); + } + + // spacing control + // Set the spacing for the menu + inline void setSpacing(int spc_description, + int spc_rows, + int spc_columns) { + OnError(::set_menu_spacing(menu, + spc_description, + spc_rows, + spc_columns)); + } + + // Get the spacing info for the menu + inline void Spacing(int& spc_description, + int& spc_rows, + int& spc_columns) const { + OnError(::menu_spacing(menu, + &spc_description, + &spc_rows, + &spc_columns)); + } + + // Decorations + inline void frame(const char *title=NULL, const char* btitle=NULL) { + if (b_framed) + NCursesPanel::frame(title,btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void boldframe(const char *title=NULL, const char* btitle=NULL) { + if (b_framed) + NCursesPanel::boldframe(title,btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void label(const char *topLabel, const char *bottomLabel) { + if (b_framed) + NCursesPanel::label(topLabel,bottomLabel); + else + OnError(E_SYSTEM_ERROR); + } + + // ----- + // Hooks + // ----- + + // Called after the menu gets repositioned in its window. + // This is especially true if the menu is posted. + virtual void On_Menu_Init(); + + // Called before the menu gets repositioned in its window. + // This is especially true if the menu is unposted. + virtual void On_Menu_Termination(); + + // Called after the item became the current item + virtual void On_Item_Init(NCursesMenuItem& item); + + // Called before this item is left as current item. + virtual void On_Item_Termination(NCursesMenuItem& item); + + // Provide a default key virtualization. Translate the keyboard + // code c into a menu request code. + // The default implementation provides a hopefully straightforward + // mapping for the most common keystrokes and menu requests. + virtual int virtualize(int c); + + + // Operators + inline NCursesMenuItem* operator[](int i) const { + if ( (i < 0) || (i >= ::item_count (menu)) ) + OnError (E_BAD_ARGUMENT); + return (my_items[i]); + } + + // Perform the menu's operation + // Return the item where you left the selection mark for a single + // selection menu, or NULL for a multivalued menu. + virtual NCursesMenuItem* operator()(void); + + // -------------------- + // Exception handlers + // Called by operator() + // -------------------- + + // Called if the request is denied + virtual void On_Request_Denied(int c) const; + + // Called if the item is not selectable + virtual void On_Not_Selectable(int c) const; + + // Called if pattern doesn't match + virtual void On_No_Match(int c) const; + + // Called if the command is unknown + virtual void On_Unknown_Command(int c) const; + +}; +// +// ------------------------------------------------------------------------- +// This is the typical C++ typesafe way to allow to attach +// user data to an item of a menu. Its assumed that the user +// data belongs to some class T. Use T as template argument +// to create a UserItem. +// ------------------------------------------------------------------------- +// +template class NCURSES_CXX_IMPEXP NCursesUserItem : public NCursesMenuItem +{ +public: + NCursesUserItem (const char* p_name, + const char* p_descript = NULL, + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesMenuItem (p_name, p_descript) { + if (item) + OnError (::set_item_userptr (item, const_cast(reinterpret_cast(p_UserData)))); + } + + virtual ~NCursesUserItem() THROWS(NCursesException) {} + + inline const T* UserData (void) const { + return reinterpret_cast(::item_userptr (item)); + }; + + inline virtual void setUserData(const T* p_UserData) { + if (item) + OnError (::set_item_userptr (item, const_cast(reinterpret_cast(p_UserData)))); + } +}; +// +// ------------------------------------------------------------------------- +// The same mechanism is used to attach user data to a menu +// ------------------------------------------------------------------------- +// +template class NCURSES_CXX_IMPEXP NCursesUserMenu : public NCursesMenu +{ +protected: + NCursesUserMenu( int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesMenu(nlines,ncols,begin_y,begin_x) { + if (menu) + set_user (const_cast(reinterpret_cast(p_UserData))); + } + +public: + NCursesUserMenu (NCursesMenuItem* Items[], + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame=FALSE, + bool autoDelete_Items=FALSE) + : NCursesMenu (Items, with_frame, autoDelete_Items) { + if (menu) + set_user (const_cast(reinterpret_cast(p_UserData))); + }; + + NCursesUserMenu (NCursesMenuItem* Items[], + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame=FALSE) + : NCursesMenu (Items, nlines, ncols, begin_y, begin_x, with_frame) { + if (menu) + set_user (const_cast(reinterpret_cast(p_UserData))); + }; + + virtual ~NCursesUserMenu() THROWS(NCursesException) { + }; + + inline T* UserData (void) { + return reinterpret_cast(get_user ()); + }; + + inline virtual void setUserData (const T* p_UserData) { + if (menu) + set_user (const_cast(reinterpret_cast(p_UserData))); + } +}; + +#endif /* NCURSES_CURSESM_H_incl */ diff --git a/C/cursesp.h b/C/cursesp.h new file mode 100644 index 0000000..1eb90e9 --- /dev/null +++ b/C/cursesp.h @@ -0,0 +1,271 @@ +// * This makes emacs happy -*-Mode: C++;-*- +// vile:cppmode +/**************************************************************************** + * Copyright 2019-2020,2021 Thomas E. Dickey * + * Copyright 1998-2012,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +#ifndef NCURSES_CURSESP_H_incl +#define NCURSES_CURSESP_H_incl 1 + +// $Id: cursesp.h,v 1.35 2021/04/17 18:11:08 tom Exp $ + +#include + +extern "C" { +# include +} + +class NCURSES_CXX_IMPEXP NCursesPanel + : public NCursesWindow +{ +protected: + PANEL *p; + static NCursesPanel *dummy; + +private: + // This structure is used for the panel's user data field to link the + // PANEL* to the C++ object and to provide extra space for a user pointer. + typedef struct { + void* m_user; // the pointer for the user's data + const NCursesPanel* m_back; // backward pointer to C++ object + const PANEL* m_owner; // the panel itself + } UserHook; + + inline UserHook *UserPointer() + { + UserHook* uptr = reinterpret_cast( + const_cast(::panel_userptr (p))); + return uptr; + } + + void init(); // Initialize the panel object + +protected: + void set_user(void *user) + { + UserHook* uptr = UserPointer(); + if (uptr != 0 && uptr->m_back==this && uptr->m_owner==p) { + uptr->m_user = user; + } + } + // Set the user pointer of the panel. + + void *get_user() + { + UserHook* uptr = UserPointer(); + void *result = 0; + if (uptr != 0 && uptr->m_back==this && uptr->m_owner==p) + result = uptr->m_user; + return result; + } + + void OnError (int err) const THROW2(NCursesException const, NCursesPanelException) + { + if (err==ERR) + THROW(new NCursesPanelException (this, err)); + } + // If err is equal to the curses error indicator ERR, an error handler + // is called. + + // Get a keystroke. Default implementation calls getch() + virtual int getKey(void); + +public: + NCursesPanel(int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0) + : NCursesWindow(nlines,ncols,begin_y,begin_x), p(0) + { + init(); + } + // Create a panel with this size starting at the requested position. + + NCursesPanel() + : NCursesWindow(::stdscr), p(0) + { + init(); + } + // This constructor creates the default Panel associated with the + // ::stdscr window + + NCursesPanel& operator=(const NCursesPanel& rhs) + { + if (this != &rhs) { + *this = rhs; + NCursesWindow::operator=(rhs); + } + return *this; + } + + NCursesPanel(const NCursesPanel& rhs) + : NCursesWindow(rhs), + p(rhs.p) + { + } + + virtual ~NCursesPanel() THROWS(NCursesException); + + // basic manipulation + inline void hide() + { + OnError (::hide_panel(p)); + } + // Hide the panel. It stays in the stack but becomes invisible. + + inline void show() + { + OnError (::show_panel(p)); + } + // Show the panel, i.e. make it visible. + + inline void top() + { + OnError (::top_panel(p)); + } + // Make this panel the top panel in the stack. + + inline void bottom() + { + OnError (::bottom_panel(p)); + } + // Make this panel the bottom panel in the stack. + // N.B.: The panel associated with ::stdscr is always on the bottom. So + // actually bottom() makes the panel the first above ::stdscr. + + virtual int mvwin(int y, int x) + { + OnError(::move_panel(p, y, x)); + return OK; + } + + inline bool hidden() const + { + return (::panel_hidden (p) ? TRUE : FALSE); + } + // Return TRUE if the panel is hidden, FALSE otherwise. + +/* The functions panel_above() and panel_below() are not reflected in + the NCursesPanel class. The reason for this is, that we cannot + assume that a panel retrieved by those operations is one wrapped + by a C++ class. Although this situation might be handled, we also + need a reverse mapping from PANEL to NCursesPanel which needs some + redesign of the low level stuff. At the moment, we define them in the + interface but they will always produce an error. */ + inline NCursesPanel& above() const + { + OnError(ERR); + return *dummy; + } + + inline NCursesPanel& below() const + { + OnError(ERR); + return *dummy; + } + + // Those two are rewrites of the corresponding virtual members of + // NCursesWindow + virtual int refresh(); + // Propagate all panel changes to the virtual screen and update the + // physical screen. + + virtual int noutrefresh(); + // Propagate all panel changes to the virtual screen. + + static void redraw(); + // Redraw all panels. + + // decorations + virtual void frame(const char* title=NULL, + const char* btitle=NULL); + // Put a frame around the panel and put the title centered in the top line + // and btitle in the bottom line. + + virtual void boldframe(const char* title=NULL, + const char* btitle=NULL); + // Same as frame(), but use highlighted attributes. + + virtual void label(const char* topLabel, + const char* bottomLabel); + // Put the title centered in the top line and btitle in the bottom line. + + virtual void centertext(int row,const char* label); + // Put the label text centered in the specified row. +}; + +/* We use templates to provide a typesafe mechanism to associate + * user data with a panel. A NCursesUserPanel is a panel + * associated with some user data of type T. + */ +template class NCursesUserPanel : public NCursesPanel +{ +public: + NCursesUserPanel (int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesPanel (nlines, ncols, begin_y, begin_x) + { + if (p) + set_user (const_cast(reinterpret_cast + (p_UserData))); + }; + // This creates an user panel of the requested size with associated + // user data pointed to by p_UserData. + + explicit NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel() + { + if (p) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + // This creates an user panel associated with the ::stdscr and user data + // pointed to by p_UserData. + + virtual ~NCursesUserPanel() THROWS(NCursesException) {}; + + T* UserData (void) + { + return reinterpret_cast(get_user ()); + }; + // Retrieve the user data associated with the panel. + + virtual void setUserData (const T* p_UserData) + { + if (p) + set_user (const_cast(reinterpret_cast(p_UserData))); + } + // Associate the user panel with the user data pointed to by p_UserData. +}; + +#endif /* NCURSES_CURSESP_H_incl */ diff --git a/C/cursesw.h b/C/cursesw.h new file mode 100644 index 0000000..001f6db --- /dev/null +++ b/C/cursesw.h @@ -0,0 +1,1581 @@ +// * This makes emacs happy -*-Mode: C++;-*- +// vile:cppmode +/**************************************************************************** + * Copyright 2019-2020,2021 Thomas E. Dickey * + * Copyright 1998-2014,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +#ifndef NCURSES_CURSESW_H_incl +#define NCURSES_CURSESW_H_incl 1 + +// $Id: cursesw.h,v 1.58 2021/04/17 18:11:08 tom Exp $ + +extern "C" { +# include +} + +#if defined(BUILDING_NCURSES_CXX) +# define NCURSES_CXX_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT +#else +# define NCURSES_CXX_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT +#endif + +#define NCURSES_CXX_WRAPPED_VAR(type,name) extern NCURSES_CXX_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) + +#define NCURSES_CXX_EXPORT(type) NCURSES_CXX_IMPEXP type NCURSES_API +#define NCURSES_CXX_EXPORT_VAR(type) NCURSES_CXX_IMPEXP type + +#include + +/* SCO 3.2v4 curses.h includes term.h, which defines lines as a macro. + Undefine it here, because NCursesWindow uses lines as a method. */ +#undef lines + +/* "Convert" macros to inlines. We'll define it as another symbol to avoid + * conflict with library symbols. + */ +#undef UNDEF +#define UNDEF(name) CUR_ ##name + +#ifdef addch +inline int UNDEF(addch)(chtype ch) { return addch(ch); } +#undef addch +#define addch UNDEF(addch) +#endif + +#ifdef addchstr +inline int UNDEF(addchstr)(chtype *at) { return addchstr(at); } +#undef addchstr +#define addchstr UNDEF(addchstr) +#endif + +#ifdef addnstr +inline int UNDEF(addnstr)(const char *str, int n) +{ return addnstr(str, n); } +#undef addnstr +#define addnstr UNDEF(addnstr) +#endif + +#ifdef addstr +inline int UNDEF(addstr)(const char * str) { return addstr(str); } +#undef addstr +#define addstr UNDEF(addstr) +#endif + +#ifdef attroff +inline int UNDEF(attroff)(chtype at) { return attroff(at); } +#undef attroff +#define attroff UNDEF(attroff) +#endif + +#ifdef attron +inline int UNDEF(attron)(chtype at) { return attron(at); } +#undef attron +#define attron UNDEF(attron) +#endif + +#ifdef attrset +inline chtype UNDEF(attrset)(chtype at) { return attrset(at); } +#undef attrset +#define attrset UNDEF(attrset) +#endif + +#ifdef bkgd +inline int UNDEF(bkgd)(chtype ch) { return bkgd(ch); } +#undef bkgd +#define bkgd UNDEF(bkgd) +#endif + +#ifdef bkgdset +inline void UNDEF(bkgdset)(chtype ch) { bkgdset(ch); } +#undef bkgdset +#define bkgdset UNDEF(bkgdset) +#endif + +#ifdef border +inline int UNDEF(border)(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br) +{ return border(ls, rs, ts, bs, tl, tr, bl, br); } +#undef border +#define border UNDEF(border) +#endif + +#ifdef box +inline int UNDEF(box)(WINDOW *win, int v, int h) { return box(win, v, h); } +#undef box +#define box UNDEF(box) +#endif + +#ifdef chgat +inline int UNDEF(chgat)(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts) { + return chgat(n, attr, color, opts); } +#undef chgat +#define chgat UNDEF(chgat) +#endif + +#ifdef clear +inline int UNDEF(clear)() { return clear(); } +#undef clear +#define clear UNDEF(clear) +#endif + +#ifdef clearok +inline int UNDEF(clearok)(WINDOW* win, bool bf) { return clearok(win, bf); } +#undef clearok +#define clearok UNDEF(clearok) +#else +extern "C" NCURSES_IMPEXP int NCURSES_API clearok(WINDOW*, bool); +#endif + +#ifdef clrtobot +inline int UNDEF(clrtobot)() { return clrtobot(); } +#undef clrtobot +#define clrtobot UNDEF(clrtobot) +#endif + +#ifdef clrtoeol +inline int UNDEF(clrtoeol)() { return clrtoeol(); } +#undef clrtoeol +#define clrtoeol UNDEF(clrtoeol) +#endif + +#ifdef color_set +inline chtype UNDEF(color_set)(NCURSES_PAIRS_T p, void* opts) { return color_set(p, opts); } +#undef color_set +#define color_set UNDEF(color_set) +#endif + +#ifdef crmode +inline int UNDEF(crmode)(void) { return crmode(); } +#undef crmode +#define crmode UNDEF(crmode) +#endif + +#ifdef delch +inline int UNDEF(delch)() { return delch(); } +#undef delch +#define delch UNDEF(delch) +#endif + +#ifdef deleteln +inline int UNDEF(deleteln)() { return deleteln(); } +#undef deleteln +#define deleteln UNDEF(deleteln) +#endif + +#ifdef echochar +inline int UNDEF(echochar)(chtype ch) { return echochar(ch); } +#undef echochar +#define echochar UNDEF(echochar) +#endif + +#ifdef erase +inline int UNDEF(erase)() { return erase(); } +#undef erase +#define erase UNDEF(erase) +#endif + +#ifdef fixterm +inline int UNDEF(fixterm)(void) { return fixterm(); } +#undef fixterm +#define fixterm UNDEF(fixterm) +#endif + +#ifdef flushok +inline int UNDEF(flushok)(WINDOW* _win, bool _bf) { + return flushok(_win, _bf); } +#undef flushok +#define flushok UNDEF(flushok) +#else +#define _no_flushok +#endif + +#ifdef getattrs +inline int UNDEF(getattrs)(WINDOW *win) { return getattrs(win); } +#undef getattrs +#define getattrs UNDEF(getattrs) +#endif + +#ifdef getbegyx +inline void UNDEF(getbegyx)(WINDOW* win, int& y, int& x) { getbegyx(win, y, x); } +#undef getbegyx +#define getbegyx UNDEF(getbegyx) +#endif + +#ifdef getbkgd +inline chtype UNDEF(getbkgd)(const WINDOW *win) { return getbkgd(win); } +#undef getbkgd +#define getbkgd UNDEF(getbkgd) +#endif + +#ifdef getch +inline int UNDEF(getch)() { return getch(); } +#undef getch +#define getch UNDEF(getch) +#endif + +#ifdef getmaxyx +inline void UNDEF(getmaxyx)(WINDOW* win, int& y, int& x) { getmaxyx(win, y, x); } +#undef getmaxyx +#define getmaxyx UNDEF(getmaxyx) +#endif + +#ifdef getnstr +inline int UNDEF(getnstr)(char *_str, int n) { return getnstr(_str, n); } +#undef getnstr +#define getnstr UNDEF(getnstr) +#endif + +#ifdef getparyx +inline void UNDEF(getparyx)(WINDOW* win, int& y, int& x) { getparyx(win, y, x); } +#undef getparyx +#define getparyx UNDEF(getparyx) +#endif + +#ifdef getstr +inline int UNDEF(getstr)(char *_str) { return getstr(_str); } +#undef getstr +#define getstr UNDEF(getstr) +#endif + +#ifdef getyx +inline void UNDEF(getyx)(const WINDOW* win, int& y, int& x) { + getyx(win, y, x); } +#undef getyx +#define getyx UNDEF(getyx) +#endif + +#ifdef hline +inline int UNDEF(hline)(chtype ch, int n) { return hline(ch, n); } +#undef hline +#define hline UNDEF(hline) +#endif + +#ifdef inch +inline chtype UNDEF(inch)() { return inch(); } +#undef inch +#define inch UNDEF(inch) +#endif + +#ifdef inchstr +inline int UNDEF(inchstr)(chtype *str) { return inchstr(str); } +#undef inchstr +#define inchstr UNDEF(inchstr) +#endif + +#ifdef innstr +inline int UNDEF(innstr)(char *_str, int n) { return innstr(_str, n); } +#undef innstr +#define innstr UNDEF(innstr) +#endif + +#ifdef insch +inline int UNDEF(insch)(chtype c) { return insch(c); } +#undef insch +#define insch UNDEF(insch) +#endif + +#ifdef insdelln +inline int UNDEF(insdelln)(int n) { return insdelln(n); } +#undef insdelln +#define insdelln UNDEF(insdelln) +#endif + +#ifdef insertln +inline int UNDEF(insertln)() { return insertln(); } +#undef insertln +#define insertln UNDEF(insertln) +#endif + +#ifdef insnstr +inline int UNDEF(insnstr)(const char *_str, int n) { + return insnstr(_str, n); } +#undef insnstr +#define insnstr UNDEF(insnstr) +#endif + +#ifdef insstr +inline int UNDEF(insstr)(const char *_str) { + return insstr(_str); } +#undef insstr +#define insstr UNDEF(insstr) +#endif + +#ifdef instr +inline int UNDEF(instr)(char *_str) { return instr(_str); } +#undef instr +#define instr UNDEF(instr) +#endif + +#ifdef intrflush +inline void UNDEF(intrflush)(WINDOW *win, bool bf) { intrflush(); } +#undef intrflush +#define intrflush UNDEF(intrflush) +#endif + +#ifdef is_linetouched +inline int UNDEF(is_linetouched)(WINDOW *w, int l) { return is_linetouched(w,l); } +#undef is_linetouched +#define is_linetouched UNDEF(is_linetouched) +#endif + +#ifdef leaveok +inline int UNDEF(leaveok)(WINDOW* win, bool bf) { return leaveok(win, bf); } +#undef leaveok +#define leaveok UNDEF(leaveok) +#else +extern "C" NCURSES_IMPEXP int NCURSES_API leaveok(WINDOW* win, bool bf); +#endif + +#ifdef move +inline int UNDEF(move)(int x, int y) { return move(x, y); } +#undef move +#define move UNDEF(move) +#endif + +#ifdef mvaddch +inline int UNDEF(mvaddch)(int y, int x, chtype ch) +{ return mvaddch(y, x, ch); } +#undef mvaddch +#define mvaddch UNDEF(mvaddch) +#endif + +#ifdef mvaddnstr +inline int UNDEF(mvaddnstr)(int y, int x, const char *str, int n) +{ return mvaddnstr(y, x, str, n); } +#undef mvaddnstr +#define mvaddnstr UNDEF(mvaddnstr) +#endif + +#ifdef mvaddstr +inline int UNDEF(mvaddstr)(int y, int x, const char * str) +{ return mvaddstr(y, x, str); } +#undef mvaddstr +#define mvaddstr UNDEF(mvaddstr) +#endif + +#ifdef mvchgat +inline int UNDEF(mvchgat)(int y, int x, int n, + attr_t attr, NCURSES_PAIRS_T color, const void *opts) { + return mvchgat(y, x, n, attr, color, opts); } +#undef mvchgat +#define mvchgat UNDEF(mvchgat) +#endif + +#ifdef mvdelch +inline int UNDEF(mvdelch)(int y, int x) { return mvdelch(y, x);} +#undef mvdelch +#define mvdelch UNDEF(mvdelch) +#endif + +#ifdef mvgetch +inline int UNDEF(mvgetch)(int y, int x) { return mvgetch(y, x);} +#undef mvgetch +#define mvgetch UNDEF(mvgetch) +#endif + +#ifdef mvgetnstr +inline int UNDEF(mvgetnstr)(int y, int x, char *str, int n) { + return mvgetnstr(y, x, str, n);} +#undef mvgetnstr +#define mvgetnstr UNDEF(mvgetnstr) +#endif + +#ifdef mvgetstr +inline int UNDEF(mvgetstr)(int y, int x, char *str) {return mvgetstr(y, x, str);} +#undef mvgetstr +#define mvgetstr UNDEF(mvgetstr) +#endif + +#ifdef mvinch +inline chtype UNDEF(mvinch)(int y, int x) { return mvinch(y, x);} +#undef mvinch +#define mvinch UNDEF(mvinch) +#endif + +#ifdef mvinnstr +inline int UNDEF(mvinnstr)(int y, int x, char *_str, int n) { + return mvinnstr(y, x, _str, n); } +#undef mvinnstr +#define mvinnstr UNDEF(mvinnstr) +#endif + +#ifdef mvinsch +inline int UNDEF(mvinsch)(int y, int x, chtype c) +{ return mvinsch(y, x, c); } +#undef mvinsch +#define mvinsch UNDEF(mvinsch) +#endif + +#ifdef mvinsnstr +inline int UNDEF(mvinsnstr)(int y, int x, const char *_str, int n) { + return mvinsnstr(y, x, _str, n); } +#undef mvinsnstr +#define mvinsnstr UNDEF(mvinsnstr) +#endif + +#ifdef mvinsstr +inline int UNDEF(mvinsstr)(int y, int x, const char *_str) { + return mvinsstr(y, x, _str); } +#undef mvinsstr +#define mvinsstr UNDEF(mvinsstr) +#endif + +#ifdef mvwaddch +inline int UNDEF(mvwaddch)(WINDOW *win, int y, int x, const chtype ch) +{ return mvwaddch(win, y, x, ch); } +#undef mvwaddch +#define mvwaddch UNDEF(mvwaddch) +#endif + +#ifdef mvwaddchnstr +inline int UNDEF(mvwaddchnstr)(WINDOW *win, int y, int x, const chtype *str, int n) +{ return mvwaddchnstr(win, y, x, str, n); } +#undef mvwaddchnstr +#define mvwaddchnstr UNDEF(mvwaddchnstr) +#endif + +#ifdef mvwaddchstr +inline int UNDEF(mvwaddchstr)(WINDOW *win, int y, int x, const chtype *str) +{ return mvwaddchstr(win, y, x, str); } +#undef mvwaddchstr +#define mvwaddchstr UNDEF(mvwaddchstr) +#endif + +#ifdef mvwaddnstr +inline int UNDEF(mvwaddnstr)(WINDOW *win, int y, int x, const char *str, int n) +{ return mvwaddnstr(win, y, x, str, n); } +#undef mvwaddnstr +#define mvwaddnstr UNDEF(mvwaddnstr) +#endif + +#ifdef mvwaddstr +inline int UNDEF(mvwaddstr)(WINDOW *win, int y, int x, const char * str) +{ return mvwaddstr(win, y, x, str); } +#undef mvwaddstr +#define mvwaddstr UNDEF(mvwaddstr) +#endif + +#ifdef mvwchgat +inline int UNDEF(mvwchgat)(WINDOW *win, int y, int x, int n, + attr_t attr, NCURSES_PAIRS_T color, const void *opts) { + return mvwchgat(win, y, x, n, attr, color, opts); } +#undef mvwchgat +#define mvwchgat UNDEF(mvwchgat) +#endif + +#ifdef mvwdelch +inline int UNDEF(mvwdelch)(WINDOW *win, int y, int x) +{ return mvwdelch(win, y, x); } +#undef mvwdelch +#define mvwdelch UNDEF(mvwdelch) +#endif + +#ifdef mvwgetch +inline int UNDEF(mvwgetch)(WINDOW *win, int y, int x) { return mvwgetch(win, y, x);} +#undef mvwgetch +#define mvwgetch UNDEF(mvwgetch) +#endif + +#ifdef mvwgetnstr +inline int UNDEF(mvwgetnstr)(WINDOW *win, int y, int x, char *str, int n) +{return mvwgetnstr(win, y, x, str, n);} +#undef mvwgetnstr +#define mvwgetnstr UNDEF(mvwgetnstr) +#endif + +#ifdef mvwgetstr +inline int UNDEF(mvwgetstr)(WINDOW *win, int y, int x, char *str) +{return mvwgetstr(win, y, x, str);} +#undef mvwgetstr +#define mvwgetstr UNDEF(mvwgetstr) +#endif + +#ifdef mvwhline +inline int UNDEF(mvwhline)(WINDOW *win, int y, int x, chtype c, int n) { + return mvwhline(win, y, x, c, n); } +#undef mvwhline +#define mvwhline UNDEF(mvwhline) +#endif + +#ifdef mvwinch +inline chtype UNDEF(mvwinch)(WINDOW *win, int y, int x) { + return mvwinch(win, y, x);} +#undef mvwinch +#define mvwinch UNDEF(mvwinch) +#endif + +#ifdef mvwinchnstr +inline int UNDEF(mvwinchnstr)(WINDOW *win, int y, int x, chtype *str, int n) { return mvwinchnstr(win, y, x, str, n); } +#undef mvwinchnstr +#define mvwinchnstr UNDEF(mvwinchnstr) +#endif + +#ifdef mvwinchstr +inline int UNDEF(mvwinchstr)(WINDOW *win, int y, int x, chtype *str) { return mvwinchstr(win, y, x, str); } +#undef mvwinchstr +#define mvwinchstr UNDEF(mvwinchstr) +#endif + +#ifdef mvwinnstr +inline int UNDEF(mvwinnstr)(WINDOW *win, int y, int x, char *_str, int n) { + return mvwinnstr(win, y, x, _str, n); } +#undef mvwinnstr +#define mvwinnstr UNDEF(mvwinnstr) +#endif + +#ifdef mvwinsch +inline int UNDEF(mvwinsch)(WINDOW *win, int y, int x, chtype c) +{ return mvwinsch(win, y, x, c); } +#undef mvwinsch +#define mvwinsch UNDEF(mvwinsch) +#endif + +#ifdef mvwinsnstr +inline int UNDEF(mvwinsnstr)(WINDOW *w, int y, int x, const char *_str, int n) { + return mvwinsnstr(w, y, x, _str, n); } +#undef mvwinsnstr +#define mvwinsnstr UNDEF(mvwinsnstr) +#endif + +#ifdef mvwinsstr +inline int UNDEF(mvwinsstr)(WINDOW *w, int y, int x, const char *_str) { + return mvwinsstr(w, y, x, _str); } +#undef mvwinsstr +#define mvwinsstr UNDEF(mvwinsstr) +#endif + +#ifdef mvwvline +inline int UNDEF(mvwvline)(WINDOW *win, int y, int x, chtype c, int n) { + return mvwvline(win, y, x, c, n); } +#undef mvwvline +#define mvwvline UNDEF(mvwvline) +#endif + +#ifdef napms +inline void UNDEF(napms)(unsigned long x) { napms(x); } +#undef napms +#define napms UNDEF(napms) +#endif + +#ifdef nocrmode +inline int UNDEF(nocrmode)(void) { return nocrmode(); } +#undef nocrmode +#define nocrmode UNDEF(nocrmode) +#endif + +#ifdef nodelay +inline void UNDEF(nodelay)() { nodelay(); } +#undef nodelay +#define nodelay UNDEF(nodelay) +#endif + +#ifdef redrawwin +inline int UNDEF(redrawwin)(WINDOW *win) { return redrawwin(win); } +#undef redrawwin +#define redrawwin UNDEF(redrawwin) +#endif + +#ifdef refresh +inline int UNDEF(refresh)() { return refresh(); } +#undef refresh +#define refresh UNDEF(refresh) +#endif + +#ifdef resetterm +inline int UNDEF(resetterm)(void) { return resetterm(); } +#undef resetterm +#define resetterm UNDEF(resetterm) +#endif + +#ifdef saveterm +inline int UNDEF(saveterm)(void) { return saveterm(); } +#undef saveterm +#define saveterm UNDEF(saveterm) +#endif + +#ifdef scrl +inline int UNDEF(scrl)(int l) { return scrl(l); } +#undef scrl +#define scrl UNDEF(scrl) +#endif + +#ifdef scroll +inline int UNDEF(scroll)(WINDOW *win) { return scroll(win); } +#undef scroll +#define scroll UNDEF(scroll) +#endif + +#ifdef scrollok +inline int UNDEF(scrollok)(WINDOW* win, bool bf) { return scrollok(win, bf); } +#undef scrollok +#define scrollok UNDEF(scrollok) +#else +#if defined(__NCURSES_H) +extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, bool); +#else +extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, char); +#endif +#endif + +#ifdef setscrreg +inline int UNDEF(setscrreg)(int t, int b) { return setscrreg(t, b); } +#undef setscrreg +#define setscrreg UNDEF(setscrreg) +#endif + +#ifdef standend +inline int UNDEF(standend)() { return standend(); } +#undef standend +#define standend UNDEF(standend) +#endif + +#ifdef standout +inline int UNDEF(standout)() { return standout(); } +#undef standout +#define standout UNDEF(standout) +#endif + +#ifdef subpad +inline WINDOW *UNDEF(subpad)(WINDOW *p, int l, int c, int y, int x) +{ return derwin(p, l, c, y, x); } +#undef subpad +#define subpad UNDEF(subpad) +#endif + +#ifdef timeout +inline void UNDEF(timeout)(int delay) { timeout(delay); } +#undef timeout +#define timeout UNDEF(timeout) +#endif + +#ifdef touchline +inline int UNDEF(touchline)(WINDOW *win, int s, int c) +{ return touchline(win, s, c); } +#undef touchline +#define touchline UNDEF(touchline) +#endif + +#ifdef touchwin +inline int UNDEF(touchwin)(WINDOW *win) { return touchwin(win); } +#undef touchwin +#define touchwin UNDEF(touchwin) +#endif + +#ifdef untouchwin +inline int UNDEF(untouchwin)(WINDOW *win) { return untouchwin(win); } +#undef untouchwin +#define untouchwin UNDEF(untouchwin) +#endif + +#ifdef vline +inline int UNDEF(vline)(chtype ch, int n) { return vline(ch, n); } +#undef vline +#define vline UNDEF(vline) +#endif + +#ifdef waddchstr +inline int UNDEF(waddchstr)(WINDOW *win, chtype *at) { return waddchstr(win, at); } +#undef waddchstr +#define waddchstr UNDEF(waddchstr) +#endif + +#ifdef waddstr +inline int UNDEF(waddstr)(WINDOW *win, char *str) { return waddstr(win, str); } +#undef waddstr +#define waddstr UNDEF(waddstr) +#endif + +#ifdef wattroff +inline int UNDEF(wattroff)(WINDOW *win, int att) { return wattroff(win, att); } +#undef wattroff +#define wattroff UNDEF(wattroff) +#endif + +#ifdef wattrset +inline int UNDEF(wattrset)(WINDOW *win, int att) { return wattrset(win, att); } +#undef wattrset +#define wattrset UNDEF(wattrset) +#endif + +#ifdef winch +inline chtype UNDEF(winch)(const WINDOW* win) { return winch(win); } +#undef winch +#define winch UNDEF(winch) +#endif + +#ifdef winchnstr +inline int UNDEF(winchnstr)(WINDOW *win, chtype *str, int n) { return winchnstr(win, str, n); } +#undef winchnstr +#define winchnstr UNDEF(winchnstr) +#endif + +#ifdef winchstr +inline int UNDEF(winchstr)(WINDOW *win, chtype *str) { return winchstr(win, str); } +#undef winchstr +#define winchstr UNDEF(winchstr) +#endif + +#ifdef winsstr +inline int UNDEF(winsstr)(WINDOW *w, const char *_str) { + return winsstr(w, _str); } +#undef winsstr +#define winsstr UNDEF(winsstr) +#endif + +#ifdef wstandend +inline int UNDEF(wstandend)(WINDOW *win) { return wstandend(win); } +#undef wstandend +#define wstandend UNDEF(wstandend) +#endif + +#ifdef wstandout +inline int UNDEF(wstandout)(WINDOW *win) { return wstandout(win); } +#undef wstandout +#define wstandout UNDEF(wstandout) +#endif + +/* + * + * C++ class for windows. + * + */ + +extern "C" int _nc_ripoffline(int, int (*init)(WINDOW*, int)); +extern "C" int _nc_xx_ripoff_init(WINDOW *, int); +extern "C" int _nc_has_mouse(void); + +class NCURSES_CXX_IMPEXP NCursesWindow +{ + friend class NCursesMenu; + friend class NCursesForm; + +private: + static bool b_initialized; + static void initialize(); + void constructing(); + friend int _nc_xx_ripoff_init(WINDOW *, int); + + void set_keyboard(); + + NCURSES_COLOR_T getcolor(int getback) const; + NCURSES_PAIRS_T getPair() const; + + static int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair); + static int colorInitialized; + + // This private constructor is only used during the initialization + // of windows generated by ripoffline() calls. + NCursesWindow(WINDOW* win, int ncols); + +protected: + virtual void err_handler(const char *) const THROWS(NCursesException); + // Signal an error with the given message text. + + static long count; // count of all active windows: + // We rely on the c++ promise that + // all otherwise uninitialized + // static class vars are set to 0 + + WINDOW* w; // the curses WINDOW + + bool alloced; // TRUE if we own the WINDOW + + NCursesWindow* par; // parent, if subwindow + NCursesWindow* subwins; // head of subwindows list + NCursesWindow* sib; // next subwindow of parent + + void kill_subwindows(); // disable all subwindows + // Destroy all subwindows. + + /* Only for use by derived classes. They are then in charge to + fill the member variables correctly. */ + NCursesWindow(); + +public: + explicit NCursesWindow(WINDOW* window); // useful only for stdscr + + NCursesWindow(int nlines, // number of lines + int ncols, // number of columns + int begin_y, // line origin + int begin_x); // col origin + + NCursesWindow(NCursesWindow& par,// parent window + int nlines, // number of lines + int ncols, // number of columns + int begin_y, // absolute or relative + int begin_x, // origins: + char absrel = 'a');// if `a', begin_y & begin_x are + // absolute screen pos, else if `r', they are relative to par origin + + NCursesWindow(NCursesWindow& par,// parent window + bool do_box = TRUE); + // this is the very common case that we want to create the subwindow that + // is two lines and two columns smaller and begins at (1,1). + // We may automatically request the box around it. + + NCursesWindow& operator=(const NCursesWindow& rhs) + { + if (this != &rhs) + *this = rhs; + return *this; + } + + NCursesWindow(const NCursesWindow& rhs) + : w(rhs.w), alloced(rhs.alloced), par(rhs.par), subwins(rhs.subwins), sib(rhs.sib) + { + } + + virtual ~NCursesWindow() THROWS(NCursesException); + + NCursesWindow Clone(); + // Make an exact copy of the window. + + // Initialization. + static void useColors(void); + // Call this routine very early if you want to have colors. + + static int ripoffline(int ripoff_lines, + int (*init)(NCursesWindow& win)); + // This function is used to generate a window of ripped-of lines. + // If the argument is positive, lines are removed from the top, if it + // is negative lines are removed from the bottom. This enhances the + // lowlevel ripoffline() function because it uses the internal + // implementation that allows to remove more than just a single line. + // This function must be called before any other ncurses function. The + // creation of the window is deferred until ncurses gets initialized. + // The initialization function is then called. + + // ------------------------------------------------------------------------- + // terminal status + // ------------------------------------------------------------------------- + int lines() const { initialize(); return LINES; } + // Number of lines on terminal, *not* window + + int cols() const { initialize(); return COLS; } + // Number of cols on terminal, *not* window + + int tabsize() const { initialize(); return TABSIZE; } + // Size of a tab on terminal, *not* window + + static int NumberOfColors(); + // Number of available colors + + int colors() const { return NumberOfColors(); } + // Number of available colors + + // ------------------------------------------------------------------------- + // window status + // ------------------------------------------------------------------------- + int height() const { return maxy() + 1; } + // Number of lines in this window + + int width() const { return maxx() + 1; } + // Number of columns in this window + + int begx() const { return getbegx(w); } + // Column of top left corner relative to stdscr + + int begy() const { return getbegy(w); } + // Line of top left corner relative to stdscr + + int curx() const { return getcurx(w); } + // Column of top left corner relative to stdscr + + int cury() const { return getcury(w); } + // Line of top left corner relative to stdscr + + int maxx() const { return getmaxx(w) == ERR ? ERR : getmaxx(w)-1; } + // Largest x coord in window + + int maxy() const { return getmaxy(w) == ERR ? ERR : getmaxy(w)-1; } + // Largest y coord in window + + NCURSES_PAIRS_T getcolor() const; + // Actual color pair + + NCURSES_COLOR_T foreground() const { return getcolor(0); } + // Actual foreground color + + NCURSES_COLOR_T background() const { return getcolor(1); } + // Actual background color + + int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back); + // Set color palette entry + + int setcolor(NCURSES_PAIRS_T pair); + // Set actually used palette entry + + // ------------------------------------------------------------------------- + // window positioning + // ------------------------------------------------------------------------- + virtual int mvwin(int begin_y, int begin_x) { + return ::mvwin(w, begin_y, begin_x); } + // Move window to new position with the new position as top left corner. + // This is virtual because it is redefined in NCursesPanel. + + // ------------------------------------------------------------------------- + // coordinate positioning + // ------------------------------------------------------------------------- + int move(int y, int x) { return ::wmove(w, y, x); } + // Move cursor the this position + + void getyx(int& y, int& x) const { ::getyx(w, y, x); } + // Get current position of the cursor + + void getbegyx(int& y, int& x) const { ::getbegyx(w, y, x); } + // Get beginning of the window + + void getmaxyx(int& y, int& x) const { ::getmaxyx(w, y, x); } + // Get size of the window + + void getparyx(int& y, int& x) const { ::getparyx(w, y, x); } + // Get parent's beginning of the window + + int mvcur(int oldrow, int oldcol, int newrow, int newcol) const { + return ::mvcur(oldrow, oldcol, newrow, newcol); } + // Perform lowlevel cursor motion that takes effect immediately. + + // ------------------------------------------------------------------------- + // input + // ------------------------------------------------------------------------- + int getch() { return ::wgetch(w); } + // Get a keystroke from the window. + + int getch(int y, int x) { return ::mvwgetch(w, y, x); } + // Move cursor to position and get a keystroke from the window + + int getstr(char* str, int n=-1) { + return ::wgetnstr(w, str, n); } + // Read a series of characters into str until a newline or carriage return + // is received. Read at most n characters. If n is negative, the limit is + // ignored. + + int getstr(int y, int x, char* str, int n=-1) { + return ::mvwgetnstr(w, y, x, str, n); } + // Move the cursor to the requested position and then perform the getstr() + // as described above. + + int instr(char *s, int n=-1) { return ::winnstr(w, s, n); } + // Get a string of characters from the window into the buffer s. Retrieve + // at most n characters, if n is negative retrieve all characters up to the + // end of the current line. Attributes are stripped from the characters. + + int instr(int y, int x, char *s, int n=-1) { + return ::mvwinnstr(w, y, x, s, n); } + // Move the cursor to the requested position and then perform the instr() + // as described above. + + int scanw(const char* fmt, ...) + // Perform a scanw function from the window. +#if __GNUG__ >= 2 + __attribute__ ((format (scanf, 2, 3))); +#else + ; +#endif + + int scanw(const char*, va_list); + // Perform a scanw function from the window. + + int scanw(int y, int x, const char* fmt, ...) + // Move the cursor to the requested position and then perform a scanw + // from the window. +#if __GNUG__ >= 2 + __attribute__ ((format (scanf, 4, 5))); +#else + ; +#endif + + int scanw(int y, int x, const char* fmt, va_list); + // Move the cursor to the requested position and then perform a scanw + // from the window. + + // ------------------------------------------------------------------------- + // output + // ------------------------------------------------------------------------- + int addch(const chtype ch) { return ::waddch(w, ch); } + // Put attributed character to the window. + + int addch(int y, int x, const chtype ch) { + return ::mvwaddch(w, y, x, ch); } + // Move cursor to the requested position and then put attributed character + // to the window. + + int echochar(const chtype ch) { return ::wechochar(w, ch); } + // Put attributed character to the window and refresh it immediately. + + int addstr(const char* str, int n=-1) { + return ::waddnstr(w, str, n); } + // Write the string str to the window, stop writing if the terminating + // NUL or the limit n is reached. If n is negative, it is ignored. + + int addstr(int y, int x, const char * str, int n=-1) { + return ::mvwaddnstr(w, y, x, str, n); } + // Move the cursor to the requested position and then perform the addchstr + // as described above. + + int addchstr(const chtype* str, int n=-1) { + return ::waddchnstr(w, str, n); } + // Write the string str to the window, stop writing if the terminating + // NUL or the limit n is reached. If n is negative, it is ignored. + + int addchstr(int y, int x, const chtype * str, int n=-1) { + return ::mvwaddchnstr(w, y, x, str, n); } + // Move the cursor to the requested position and then perform the addchstr + // as described above. + + int printw(const char* fmt, ...) + // Do a formatted print to the window. +#if (__GNUG__ >= 2) && !defined(printf) + __attribute__ ((format (printf, 2, 3))); +#else + ; +#endif + + int printw(int y, int x, const char * fmt, ...) + // Move the cursor and then do a formatted print to the window. +#if (__GNUG__ >= 2) && !defined(printf) + __attribute__ ((format (printf, 4, 5))); +#else + ; +#endif + + int printw(const char* fmt, va_list args); + // Do a formatted print to the window. + + int printw(int y, int x, const char * fmt, va_list args); + // Move the cursor and then do a formatted print to the window. + + chtype inch() const { return ::winch(w); } + // Retrieve attributed character under the current cursor position. + + chtype inch(int y, int x) { return ::mvwinch(w, y, x); } + // Move cursor to requested position and then retrieve attributed character + // at this position. + + int inchstr(chtype* str, int n=-1) { + return ::winchnstr(w, str, n); } + // Read the string str from the window, stop reading if the terminating + // NUL or the limit n is reached. If n is negative, it is ignored. + + int inchstr(int y, int x, chtype * str, int n=-1) { + return ::mvwinchnstr(w, y, x, str, n); } + // Move the cursor to the requested position and then perform the inchstr + // as described above. + + int insch(chtype ch) { return ::winsch(w, ch); } + // Insert attributed character into the window before current cursor + // position. + + int insch(int y, int x, chtype ch) { + return ::mvwinsch(w, y, x, ch); } + // Move cursor to requested position and then insert the attributed + // character before that position. + + int insertln() { return ::winsdelln(w, 1); } + // Insert an empty line above the current line. + + int insdelln(int n=1) { return ::winsdelln(w, n); } + // If n>0 insert that many lines above the current line. If n<0 delete + // that many lines beginning with the current line. + + int insstr(const char *s, int n=-1) { + return ::winsnstr(w, s, n); } + // Insert the string into the window before the current cursor position. + // Insert stops at end of string or when the limit n is reached. If n is + // negative, it is ignored. + + int insstr(int y, int x, const char *s, int n=-1) { + return ::mvwinsnstr(w, y, x, s, n); } + // Move the cursor to the requested position and then perform the insstr() + // as described above. + + int attron (chtype at) { return ::wattron (w, at); } + // Switch on the window attributes; + + int attroff(chtype at) { return ::wattroff(w, static_cast(at)); } + // Switch off the window attributes; + + int attrset(chtype at) { return ::wattrset(w, static_cast(at)); } + // Set the window attributes; + + chtype attrget() { return ::getattrs(w); } + // Get the window attributes; + + int color_set(NCURSES_PAIRS_T color_pair_number, void* opts=NULL) { + return ::wcolor_set(w, color_pair_number, opts); } + // Set the window color attribute; + + int chgat(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) { + return ::wchgat(w, n, attr, color, opts); } + // Change the attributes of the next n characters in the current line. If + // n is negative or greater than the number of remaining characters in the + // line, the attributes will be changed up to the end of the line. + + int chgat(int y, int x, + int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) { + return ::mvwchgat(w, y, x, n, attr, color, opts); } + // Move the cursor to the requested position and then perform chgat() as + // described above. + + // ------------------------------------------------------------------------- + // background + // ------------------------------------------------------------------------- + chtype getbkgd() const { return ::getbkgd(w); } + // Get current background setting. + + int bkgd(const chtype ch) { return ::wbkgd(w, ch); } + // Set the background property and apply it to the window. + + void bkgdset(chtype ch) { ::wbkgdset(w, ch); } + // Set the background property. + + // ------------------------------------------------------------------------- + // borders + // ------------------------------------------------------------------------- + int box(chtype vert=0, chtype hor=0) { + return ::wborder(w, vert, vert, hor, hor, 0, 0, 0, 0); } + // Draw a box around the window with the given vertical and horizontal + // drawing characters. If you specify a zero as character, curses will try + // to find a "nice" character. + + int border(chtype left=0, chtype right=0, + chtype top =0, chtype bottom=0, + chtype top_left =0, chtype top_right=0, + chtype bottom_left =0, chtype bottom_right=0) { + return ::wborder(w, left, right, top, bottom, top_left, top_right, + bottom_left, bottom_right); } + // Draw a border around the window with the given characters for the + // various parts of the border. If you pass zero for a character, curses + // will try to find "nice" characters. + + // ------------------------------------------------------------------------- + // lines and boxes + // ------------------------------------------------------------------------- + int hline(int len, chtype ch=0) { return ::whline(w, ch, len); } + // Draw a horizontal line of len characters with the given character. If + // you pass zero for the character, curses will try to find a "nice" one. + + int hline(int y, int x, int len, chtype ch=0) { + return ::mvwhline(w, y, x, ch, len); } + // Move the cursor to the requested position and then draw a horizontal line. + + int vline(int len, chtype ch=0) { return ::wvline(w, ch, len); } + // Draw a vertical line of len characters with the given character. If + // you pass zero for the character, curses will try to find a "nice" one. + + int vline(int y, int x, int len, chtype ch=0) { + return ::mvwvline(w, y, x, ch, len); } + // Move the cursor to the requested position and then draw a vertical line. + + // ------------------------------------------------------------------------- + // erasure + // ------------------------------------------------------------------------- + int erase() { return ::werase(w); } + // Erase the window. + + int clear() { return ::wclear(w); } + // Clear the window. + + int clearok(bool bf) { return ::clearok(w, bf); } + // Set/Reset the clear flag. If set, the next refresh() will clear the + // screen. + + int clrtobot() { return ::wclrtobot(w); } + // Clear to the end of the window. + + int clrtoeol() { return ::wclrtoeol(w); } + // Clear to the end of the line. + + int delch() { return ::wdelch(w); } + // Delete character under the cursor. + + int delch(int y, int x) { return ::mvwdelch(w, y, x); } + // Move cursor to requested position and delete the character under the + // cursor. + + int deleteln() { return ::winsdelln(w, -1); } + // Delete the current line. + + // ------------------------------------------------------------------------- + // screen control + // ------------------------------------------------------------------------- + int scroll(int amount=1) { return ::wscrl(w, amount); } + // Scroll amount lines. If amount is positive, scroll up, otherwise + // scroll down. + + int scrollok(bool bf) { return ::scrollok(w, bf); } + // If bf is TRUE, window scrolls if cursor is moved off the bottom + // edge of the window or a scrolling region, otherwise the cursor is left + // at the bottom line. + + int setscrreg(int from, int to) { + return ::wsetscrreg(w, from, to); } + // Define a soft scrolling region. + + int idlok(bool bf) { return ::idlok(w, bf); } + // If bf is TRUE, use insert/delete line hardware support if possible. + // Otherwise do it in software. + + void idcok(bool bf) { ::idcok(w, bf); } + // If bf is TRUE, use insert/delete character hardware support if possible. + // Otherwise do it in software. + + int touchline(int s, int c) { return ::touchline(w, s, c); } + // Mark the given lines as modified. + + int touchwin() { return ::wtouchln(w, 0, height(), 1); } + // Mark the whole window as modified. + + int untouchwin() { return ::wtouchln(w, 0, height(), 0); } + // Mark the whole window as unmodified. + + int touchln(int s, int cnt, bool changed=TRUE) { + return ::wtouchln(w, s, cnt, static_cast(changed ? 1 : 0)); } + // Mark cnt lines beginning from line s as changed or unchanged, depending + // on the value of the changed flag. + + bool is_linetouched(int line) const { + return (::is_linetouched(w, line) == TRUE ? TRUE:FALSE); } + // Return TRUE if line is marked as changed, FALSE otherwise + + bool is_wintouched() const { + return (::is_wintouched(w) ? TRUE:FALSE); } + // Return TRUE if window is marked as changed, FALSE otherwise + + int leaveok(bool bf) { return ::leaveok(w, bf); } + // If bf is TRUE, curses will leave the cursor after an update wherever + // it is after the update. + + int redrawln(int from, int n) { return ::wredrawln(w, from, n); } + // Redraw n lines starting from the requested line + + int redrawwin() { return ::wredrawln(w, 0, height()); } + // Redraw the whole window + + int doupdate() { return ::doupdate(); } + // Do all outputs to make the physical screen looking like the virtual one + + void syncdown() { ::wsyncdown(w); } + // Propagate the changes down to all descendant windows + + void syncup() { ::wsyncup(w); } + // Propagate the changes up in the hierarchy + + void cursyncup() { ::wcursyncup(w); } + // Position the cursor in all ancestor windows corresponding to our setting + + int syncok(bool bf) { return ::syncok(w, bf); } + // If called with bf=TRUE, syncup() is called whenever the window is changed + +#ifndef _no_flushok + int flushok(bool bf) { return ::flushok(w, bf); } +#endif + + void immedok(bool bf) { ::immedok(w, bf); } + // If called with bf=TRUE, any change in the window will cause an + // automatic immediate refresh() + + int intrflush(bool bf) { return ::intrflush(w, bf); } + + int keypad(bool bf) { return ::keypad(w, bf); } + // If called with bf=TRUE, the application will interpret function keys. + + int nodelay(bool bf) { return ::nodelay(w, bf); } + + int meta(bool bf) { return ::meta(w, bf); } + // If called with bf=TRUE, keys may generate 8-Bit characters. Otherwise + // 7-Bit characters are generated. + + int standout() { return ::wstandout(w); } + // Enable "standout" attributes + + int standend() { return ::wstandend(w); } + // Disable "standout" attributes + + // ------------------------------------------------------------------------- + // The next two are virtual, because we redefine them in the + // NCursesPanel class. + // ------------------------------------------------------------------------- + virtual int refresh() { return ::wrefresh(w); } + // Propagate the changes in this window to the virtual screen and call + // doupdate(). This is redefined in NCursesPanel. + + virtual int noutrefresh() { return ::wnoutrefresh(w); } + // Propagate the changes in this window to the virtual screen. This is + // redefined in NCursesPanel. + + // ------------------------------------------------------------------------- + // multiple window control + // ------------------------------------------------------------------------- + int overlay(NCursesWindow& win) { + return ::overlay(w, win.w); } + // Overlay this window over win. + + int overwrite(NCursesWindow& win) { + return ::overwrite(w, win.w); } + // Overwrite win with this window. + + int copywin(NCursesWindow& win, + int sminrow, int smincol, + int dminrow, int dmincol, + int dmaxrow, int dmaxcol, bool overlaywin=TRUE) { + return ::copywin(w, win.w, sminrow, smincol, dminrow, dmincol, + dmaxrow, dmaxcol, static_cast(overlaywin ? 1 : 0)); } + // Overlay or overwrite the rectangle in win given by dminrow,dmincol, + // dmaxrow,dmaxcol with the rectangle in this window beginning at + // sminrow,smincol. + + // ------------------------------------------------------------------------- + // Extended functions + // ------------------------------------------------------------------------- +#if defined(NCURSES_EXT_FUNCS) && (NCURSES_EXT_FUNCS != 0) + int wresize(int newLines, int newColumns) { + return ::wresize(w, newLines, newColumns); } +#endif + + // ------------------------------------------------------------------------- + // Mouse related + // ------------------------------------------------------------------------- + bool has_mouse() const; + // Return TRUE if terminal supports a mouse, FALSE otherwise + + // ------------------------------------------------------------------------- + // traversal support + // ------------------------------------------------------------------------- + NCursesWindow* child() { return subwins; } + // Get the first child window. + + NCursesWindow* sibling() { return sib; } + // Get the next child of my parent. + + NCursesWindow* parent() { return par; } + // Get my parent. + + bool isDescendant(NCursesWindow& win); + // Return TRUE if win is a descendant of this. +}; + +// ------------------------------------------------------------------------- +// We leave this here for compatibility reasons. +// ------------------------------------------------------------------------- +class NCURSES_CXX_IMPEXP NCursesColorWindow : public NCursesWindow +{ +public: + explicit NCursesColorWindow(WINDOW* &window) // useful only for stdscr + : NCursesWindow(window) { + useColors(); } + + NCursesColorWindow(int nlines, // number of lines + int ncols, // number of columns + int begin_y, // line origin + int begin_x) // col origin + : NCursesWindow(nlines, ncols, begin_y, begin_x) { + useColors(); } + + NCursesColorWindow(NCursesWindow& parentWin,// parent window + int nlines, // number of lines + int ncols, // number of columns + int begin_y, // absolute or relative + int begin_x, // origins: + char absrel = 'a') // if `a', by & bx are + : NCursesWindow(parentWin, + nlines, ncols, // absolute screen pos, + begin_y, begin_x, // else if `r', they are + absrel ) { // relative to par origin + useColors(); } +}; + +// These enum definitions really belong inside the NCursesPad class, but only +// recent compilers support that feature. + + typedef enum { + REQ_PAD_REFRESH = KEY_MAX + 1, + REQ_PAD_UP, + REQ_PAD_DOWN, + REQ_PAD_LEFT, + REQ_PAD_RIGHT, + REQ_PAD_EXIT + } Pad_Request; + + const Pad_Request PAD_LOW = REQ_PAD_REFRESH; // lowest op-code + const Pad_Request PAD_HIGH = REQ_PAD_EXIT; // highest op-code + +// ------------------------------------------------------------------------- +// Pad Support. We allow an association of a pad with a "real" window +// through which the pad may be viewed. +// ------------------------------------------------------------------------- +class NCURSES_CXX_IMPEXP NCursesPad : public NCursesWindow +{ +private: + NCursesWindow* viewWin; // the "viewport" window + NCursesWindow* viewSub; // the "viewport" subwindow + + int h_gridsize, v_gridsize; + +protected: + int min_row, min_col; // top left row/col of the pads display area + + NCursesWindow* Win(void) const { + // Get the window into which the pad should be copied (if any) + return (viewSub?viewSub:(viewWin?viewWin:0)); + } + + NCursesWindow* getWindow(void) const { + return viewWin; + } + + NCursesWindow* getSubWindow(void) const { + return viewSub; + } + + virtual int driver (int key); // Virtualize keystroke key + // The driver translates the keystroke c into an Pad_Request + + virtual void OnUnknownOperation(int pad_req) { + (void) pad_req; + ::beep(); + } + // This is called if the driver returns an unknown op-code + + virtual void OnNavigationError(int pad_req) { + (void) pad_req; + ::beep(); + } + // This is called if a navigation request couldn't be satisfied + + virtual void OnOperation(int pad_req) { + (void) pad_req; + }; + // OnOperation is called if a Pad_Operation was executed and just before + // the refresh() operation is done. + +public: + NCursesPad(int nlines, int ncols); + // create a pad with the given size + + NCursesPad& operator=(const NCursesPad& rhs) + { + if (this != &rhs) { + *this = rhs; + NCursesWindow::operator=(rhs); + } + return *this; + } + + NCursesPad(const NCursesPad& rhs) + : NCursesWindow(rhs), + viewWin(rhs.viewWin), + viewSub(rhs.viewSub), + h_gridsize(rhs.h_gridsize), + v_gridsize(rhs.v_gridsize), + min_row(rhs.min_row), + min_col(rhs.min_col) + { + } + + virtual ~NCursesPad() THROWS(NCursesException) {} + + int echochar(const chtype ch) { return ::pechochar(w, ch); } + // Put the attributed character onto the pad and immediately do a + // prefresh(). + + int refresh(); + // If a viewport is defined the pad is displayed in this window, otherwise + // this is a noop. + + int refresh(int pminrow, int pmincol, + int sminrow, int smincol, + int smaxrow, int smaxcol) { + return ::prefresh(w, pminrow, pmincol, + sminrow, smincol, smaxrow, smaxcol); + } + // The coordinates sminrow,smincol,smaxrow,smaxcol describe a rectangle + // on the screen. refresh copies a rectangle of this size beginning + // with top left corner pminrow,pmincol onto the screen and calls doupdate(). + + int noutrefresh(); + // If a viewport is defined the pad is displayed in this window, otherwise + // this is a noop. + + int noutrefresh(int pminrow, int pmincol, + int sminrow, int smincol, + int smaxrow, int smaxcol) { + return ::pnoutrefresh(w, pminrow, pmincol, + sminrow, smincol, smaxrow, smaxcol); + } + // Does the same as refresh() but without calling doupdate(). + + virtual void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1); + // Add the window "view" as viewing window to the pad. + + virtual void setSubWindow(NCursesWindow& sub); + // Use the subwindow "sub" of the viewport window for the actual viewing. + // The full viewport window is usually used to provide some decorations + // like frames, titles etc. + + virtual void operator() (void); + // Perform Pad's operation +}; + +// A FramedPad is constructed always with a viewport window. This viewport +// will be framed (by a box() command) and the interior of the box is the +// viewport subwindow. On the frame we display scrollbar sliders. +class NCURSES_CXX_IMPEXP NCursesFramedPad : public NCursesPad +{ +protected: + virtual void OnOperation(int pad_req); + +public: + NCursesFramedPad(NCursesWindow& win, int nlines, int ncols, + int v_grid = 1, int h_grid = 1) + : NCursesPad(nlines, ncols) { + NCursesPad::setWindow(win, v_grid, h_grid); + NCursesPad::setSubWindow(*(new NCursesWindow(win))); + } + // Construct the FramedPad with the given Window win as viewport. + + virtual ~NCursesFramedPad() THROWS(NCursesException) { + delete getSubWindow(); + } + + void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) { + (void) view; + (void) v_grid; + (void) h_grid; + err_handler("Operation not allowed"); + } + // Disable this call; the viewport is already defined + + void setSubWindow(NCursesWindow& sub) { + (void) sub; + err_handler("Operation not allowed"); + } + // Disable this call; the viewport subwindow is already defined + +}; + +#endif /* NCURSES_CURSESW_H_incl */ diff --git a/C/cursslk.h b/C/cursslk.h new file mode 100644 index 0000000..66564fe --- /dev/null +++ b/C/cursslk.h @@ -0,0 +1,240 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +// vile:cppmode +/**************************************************************************** + * Copyright 2019-2020,2021 Thomas E. Dickey * + * Copyright 1998-2003,2005 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: cursslk.h,v 1.19 2021/04/17 18:11:08 tom Exp $ + +#ifndef NCURSES_CURSSLK_H_incl +#define NCURSES_CURSSLK_H_incl + +#include + +class NCURSES_CXX_IMPEXP Soft_Label_Key_Set { +public: + // This inner class represents the attributes of a Soft Label Key (SLK) + class NCURSES_CXX_IMPEXP Soft_Label_Key { + friend class Soft_Label_Key_Set; + public: + typedef enum { Left=0, Center=1, Right=2 } Justification; + + private: + char *label; // The Text of the Label + Justification format; // The Justification + int num; // The number of the Label + + Soft_Label_Key() : label(NULL), format(Left), num(-1) { + } + + virtual ~Soft_Label_Key() { + delete[] label; + }; + + public: + // Set the text of the Label + Soft_Label_Key& operator=(char *text); + + // Set the Justification of the Label + Soft_Label_Key& operator=(Justification just) { + format = just; + return *this; + } + + // Retrieve the text of the label + inline char* operator()(void) const { + return label; + } + + Soft_Label_Key& operator=(const Soft_Label_Key& rhs) + { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + Soft_Label_Key(const Soft_Label_Key& rhs) + : label(NULL), + format(rhs.format), + num(rhs.num) + { + *this = rhs.label; + } + }; + +public: + typedef enum { + None = -1, + Three_Two_Three = 0, + Four_Four = 1, + PC_Style = 2, + PC_Style_With_Index = 3 + } Label_Layout; + +private: + static long count; // Number of Key Sets + static Label_Layout format; // Layout of the Key Sets + static int num_labels; // Number Of Labels in Key Sets + bool b_attrInit; // Are attributes initialized + + Soft_Label_Key *slk_array; // The array of SLK's + + // Init the Key Set + void init(); + + // Activate or Deactivate Label# i, Label counting starts with 1! + void activate_label(int i, bool bf=TRUE); + + // Activate of Deactivate all Labels + void activate_labels(bool bf); + +protected: + inline void Error (const char* msg) const THROWS(NCursesException) { + THROW(new NCursesException (msg)); + } + + // Remove SLK's from screen + void clear() { + if (ERR==::slk_clear()) + Error("slk_clear"); + } + + // Restore them + void restore() { + if (ERR==::slk_restore()) + Error("slk_restore"); + } + +public: + + // Construct a Key Set, use the most comfortable layout as default. + // You must create a Soft_Label_Key_Set before you create any object of + // the NCursesWindow, NCursesPanel or derived classes. (Actually before + // ::initscr() is called). + explicit Soft_Label_Key_Set(Label_Layout fmt); + + // This constructor assumes, that you already constructed a Key Set + // with a layout by the constructor above. This layout will be reused. + Soft_Label_Key_Set(); + + Soft_Label_Key_Set& operator=(const Soft_Label_Key_Set& rhs) + { + if (this != &rhs) { + *this = rhs; + init(); // allocate a new slk_array[] + } + return *this; + } + + Soft_Label_Key_Set(const Soft_Label_Key_Set& rhs) + : b_attrInit(rhs.b_attrInit), + slk_array(NULL) + { + init(); // allocate a new slk_array[] + } + + virtual ~Soft_Label_Key_Set() THROWS(NCursesException); + + // Get Label# i. Label counting starts with 1! + Soft_Label_Key& operator[](int i); + + // Retrieve number of Labels + int labels() const; + + // Refresh the SLK portion of the screen + inline void refresh() { + if (ERR==::slk_refresh()) + Error("slk_refresh"); + } + + // Mark the SLK portion of the screen for refresh, defer actual refresh + // until next update call. + inline void noutrefresh() { + if (ERR==::slk_noutrefresh()) + Error("slk_noutrefresh"); + } + + // Mark the whole SLK portion of the screen as modified + inline void touch() { + if (ERR==::slk_touch()) + Error("slk_touch"); + } + + // Activate Label# i + inline void show(int i) { + activate_label(i,FALSE); + activate_label(i,TRUE); + } + + // Hide Label# i + inline void hide(int i) { + activate_label(i,FALSE); + } + + // Show all Labels + inline void show() { + activate_labels(FALSE); + activate_labels(TRUE); + } + + // Hide all Labels + inline void hide() { + activate_labels(FALSE); + } + + inline void attron(attr_t attrs) { + if (ERR==::slk_attron(attrs)) + Error("slk_attron"); + } + + inline void attroff(attr_t attrs) { + if (ERR==::slk_attroff(attrs)) + Error("slk_attroff"); + } + + inline void attrset(attr_t attrs) { + if (ERR==::slk_attrset(attrs)) + Error("slk_attrset"); + } + + inline void color(short color_pair_number) { + if (ERR==::slk_color(color_pair_number)) + Error("slk_color"); + } + + inline attr_t attr() const { + return ::slk_attr(); + } +}; + +#endif /* NCURSES_CURSSLK_H_incl */ diff --git a/C/eti.h b/C/eti.h index baa6190..3c3302d 100644 --- a/C/eti.h +++ b/C/eti.h @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2002,2003 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -30,7 +31,7 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: eti.h,v 1.8 2003/10/25 15:24:29 tom Exp $ */ +/* $Id: eti.h,v 1.9 2020/02/02 23:34:34 tom Exp $ */ #ifndef NCURSES_ETI_H_incl #define NCURSES_ETI_H_incl 1 diff --git a/C/etip.h b/C/etip.h new file mode 100644 index 0000000..3b1a8fd --- /dev/null +++ b/C/etip.h @@ -0,0 +1,396 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2012,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: etip.h.in,v 1.48 2021/06/17 21:11:08 tom Exp $ + +#ifndef NCURSES_ETIP_H_incl +#define NCURSES_ETIP_H_incl 1 + +// These are substituted at configure/build time +#ifndef HAVE_BUILTIN_H +#define HAVE_BUILTIN_H 0 +#endif + +#ifndef HAVE_GXX_BUILTIN_H +#define HAVE_GXX_BUILTIN_H 0 +#endif + +#ifndef HAVE_GPP_BUILTIN_H +#define HAVE_GPP_BUILTIN_H 0 +#endif + +#ifndef HAVE_IOSTREAM +#define HAVE_IOSTREAM 1 +#endif + +#ifndef HAVE_TYPEINFO +#define HAVE_TYPEINFO 1 +#endif + +#ifndef HAVE_VALUES_H +#define HAVE_VALUES_H 0 +#endif + +#ifndef ETIP_NEEDS_MATH_H +#define ETIP_NEEDS_MATH_H 0 +#endif + +#ifndef ETIP_NEEDS_MATH_EXCEPTION +#define ETIP_NEEDS_MATH_EXCEPTION 0 +#endif + +#ifndef CPP_HAS_PARAM_INIT +#define CPP_HAS_PARAM_INIT 0 +#endif + +#ifndef CPP_HAS_STATIC_CAST +#define CPP_HAS_STATIC_CAST 1 +#endif + +#ifndef IOSTREAM_NAMESPACE +#define IOSTREAM_NAMESPACE 1 +#endif + +#ifdef __GNUG__ +# if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) +# if HAVE_TYPEINFO +# include +# endif +# endif +#endif + +#if defined(__GNUG__) +# if HAVE_BUILTIN_H || HAVE_GXX_BUILTIN_H || HAVE_GPP_BUILTIN_H +# if ETIP_NEEDS_MATH_H +# if ETIP_NEEDS_MATH_EXCEPTION +# undef exception +# define exception math_exception +# endif +# include +# endif +# undef exception +# define exception builtin_exception +# if HAVE_GPP_BUILTIN_H +# include +# elif HAVE_GXX_BUILTIN_H +# include +# else +# include +# endif +# undef exception +# endif +#elif defined (__SUNPRO_CC) +# include +#endif + +#include + +extern "C" { +#if HAVE_VALUES_H +# include +#endif + +#include +#include +#include +} + +// Language features +#if CPP_HAS_PARAM_INIT +#define NCURSES_PARAM_INIT(value) = value +#else +#define NCURSES_PARAM_INIT(value) /*nothing*/ +#endif + +#if CPP_HAS_STATIC_CAST +#define STATIC_CAST(s) static_cast +#else +#define STATIC_CAST(s) (s) +#endif + +#ifndef NCURSES_CXX_IMPEXP +#define NCURSES_CXX_IMPEXP /* nothing */ +#endif + +// Forward Declarations +class NCURSES_CXX_IMPEXP NCursesPanel; +class NCURSES_CXX_IMPEXP NCursesMenu; +class NCURSES_CXX_IMPEXP NCursesForm; + +class NCURSES_CXX_IMPEXP NCursesException +{ +public: + const char *message; + int errorno; + + NCursesException (const char* msg, int err) + : message(msg), errorno (err) + {}; + + explicit NCursesException (const char* msg) + : message(msg), errorno (E_SYSTEM_ERROR) + {}; + + NCursesException& operator=(const NCursesException& rhs) + { + message = rhs.message; + errorno = rhs.errorno; + return *this; + } + + NCursesException(const NCursesException& rhs) + : message(rhs.message), errorno(rhs.errorno) + { + } + + virtual const char *classname() const { + return "NCursesWindow"; + } + + virtual ~NCursesException() + { + } +}; + +class NCURSES_CXX_IMPEXP NCursesPanelException : public NCursesException +{ +public: + const NCursesPanel* p; + + NCursesPanelException (const char *msg, int err) : + NCursesException (msg, err), + p (0) + {}; + + NCursesPanelException (const NCursesPanel* panel, + const char *msg, + int err) : + NCursesException (msg, err), + p (panel) + {}; + + explicit NCursesPanelException (int err) : + NCursesException ("panel library error", err), + p (0) + {}; + + NCursesPanelException (const NCursesPanel* panel, + int err) : + NCursesException ("panel library error", err), + p (panel) + {}; + + NCursesPanelException& operator=(const NCursesPanelException& rhs) + { + if (this != &rhs) { + NCursesException::operator=(rhs); + p = rhs.p; + } + return *this; + } + + NCursesPanelException(const NCursesPanelException& rhs) + : NCursesException(rhs), p(rhs.p) + { + } + + virtual const char *classname() const { + return "NCursesPanel"; + } + + virtual ~NCursesPanelException() + { + } +}; + +class NCURSES_CXX_IMPEXP NCursesMenuException : public NCursesException +{ +public: + const NCursesMenu* m; + + NCursesMenuException (const char *msg, int err) : + NCursesException (msg, err), + m (0) + {}; + + NCursesMenuException (const NCursesMenu* menu, + const char *msg, + int err) : + NCursesException (msg, err), + m (menu) + {}; + + explicit NCursesMenuException (int err) : + NCursesException ("menu library error", err), + m (0) + {}; + + NCursesMenuException (const NCursesMenu* menu, + int err) : + NCursesException ("menu library error", err), + m (menu) + {}; + + NCursesMenuException& operator=(const NCursesMenuException& rhs) + { + if (this != &rhs) { + NCursesException::operator=(rhs); + m = rhs.m; + } + return *this; + } + + NCursesMenuException(const NCursesMenuException& rhs) + : NCursesException(rhs), m(rhs.m) + { + } + + virtual const char *classname() const { + return "NCursesMenu"; + } + + virtual ~NCursesMenuException() + { + } +}; + +class NCURSES_CXX_IMPEXP NCursesFormException : public NCursesException +{ +public: + const NCursesForm* f; + + NCursesFormException (const char *msg, int err) : + NCursesException (msg, err), + f (0) + {}; + + NCursesFormException (const NCursesForm* form, + const char *msg, + int err) : + NCursesException (msg, err), + f (form) + {}; + + explicit NCursesFormException (int err) : + NCursesException ("form library error", err), + f (0) + {}; + + NCursesFormException (const NCursesForm* form, + int err) : + NCursesException ("form library error", err), + f (form) + {}; + + NCursesFormException& operator=(const NCursesFormException& rhs) + { + if (this != &rhs) { + NCursesException::operator=(rhs); + f = rhs.f; + } + return *this; + } + + NCursesFormException(const NCursesFormException& rhs) + : NCursesException(rhs), f(rhs.f) + { + } + + virtual const char *classname() const { + return "NCursesForm"; + } + + virtual ~NCursesFormException() + { + } +}; + +#if !((defined(__GNUG__) && defined(__EXCEPTIONS) && (__GNUG__ < 7)) || defined(__SUNPRO_CC)) +# if HAVE_IOSTREAM +# include +# if IOSTREAM_NAMESPACE +using std::cerr; +using std::endl; +# endif +# else +# include +# endif +#endif + +inline void THROW(const NCursesException *e) { +#if defined(__GNUG__) && defined(__EXCEPTIONS) +# if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) + (*lib_error_handler)(e ? e->classname() : "", e ? e->message : ""); +# elif (__GNUG__ >= 7) + // g++ 7.0 warns about deprecation, but lacks the predefined symbols + ::endwin(); + std::cerr << "Found a problem - goodbye" << std::endl; + exit(EXIT_FAILURE); +# else +# define CPP_HAS_TRY_CATCH 1 +# endif +#elif defined(__SUNPRO_CC) +# if !defined(__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT < 5) + genericerror(1, ((e != 0) ? (char *)(e->message) : "")); +# else +# define CPP_HAS_TRY_CATCH 1 +# endif +#else + if (e) + cerr << e->message << endl; + exit(0); +#endif + +#ifndef CPP_HAS_TRY_CATCH +#define CPP_HAS_TRY_CATCH 0 +#define NCURSES_CPP_TRY /* nothing */ +#define NCURSES_CPP_CATCH(e) if (false) +#define THROWS(s) /* nothing */ +#define THROW2(s,t) /* nothing */ +#elif CPP_HAS_TRY_CATCH + throw *e; +#define NCURSES_CPP_TRY try +#define NCURSES_CPP_CATCH(e) catch(e) +#if defined(__cpp_noexcept_function_type) && (__cpp_noexcept_function_type >= 201510) +// C++17 deprecates the usage of throw(). +#define THROWS(s) /* nothing */ +#define THROW2(s,t) /* nothing */ +#else +#define THROWS(s) throw(s) +#define THROW2(s,t) throw(s,t) +#endif +#endif +} + +#endif /* NCURSES_ETIP_H_incl */ diff --git a/C/form.h b/C/form.h index a07ee30..3b62e39 100644 --- a/C/form.h +++ b/C/form.h @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2009 Free Software Foundation, Inc. * + * Copyright 2018-2019-2020,2021 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -30,18 +31,30 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: form.h,v 0.21 2009/11/07 19:31:11 tom Exp $ */ +/* $Id: form.h,v 0.32 2021/06/17 21:26:02 tom Exp $ */ #ifndef FORM_H #define FORM_H +/* *INDENT-OFF*/ -#include -#include +#include +#include #ifdef __cplusplus extern "C" { #endif +#if defined(BUILDING_FORM) +# define FORM_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT +#else +# define FORM_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT +#endif + +#define FORM_WRAPPED_VAR(type,name) extern FORM_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) + +#define FORM_EXPORT(type) FORM_IMPEXP type NCURSES_API +#define FORM_EXPORT_VAR(type) FORM_IMPEXP type + #ifndef FORM_PRIV_H typedef void *FIELD_CELL; #endif @@ -57,18 +70,24 @@ typedef int Field_Options; * _PAGE * **********/ -typedef struct { +typedef struct pagenode +#if !NCURSES_OPAQUE_FORM +{ short pmin; /* index of first field on page */ short pmax; /* index of last field on page */ short smin; /* index of top leftmost field on page */ short smax; /* index of bottom rightmost field on page */ -} _PAGE; +} +#endif /* !NCURSES_OPAQUE_FORM */ +_PAGE; /********** * FIELD * **********/ -typedef struct fieldnode { +typedef struct fieldnode +#if 1 /* not yet: !NCURSES_OPAQUE_FORM */ +{ unsigned short status; /* flags */ short rows; /* size in rows */ short cols; /* size in cols */ @@ -97,20 +116,24 @@ typedef struct fieldnode { /* * The wide-character configuration requires extra information. Because * there are existing applications that manipulate the members of FIELD - * directly, we cannot make the struct opaque. Offsets of members up to - * this point are the same in the narrow- and wide-character configuration. - * But note that the type of buf depends on the configuration, and is made - * opaque for that reason. + * directly, we cannot make the struct opaque, except by changing the ABI. + * Offsets of members up to this point are the same in the narrow- and + * wide-character configuration. But note that the type of buf depends on + * the configuration, and is made opaque for that reason. */ NCURSES_FIELD_INTERNALS -} FIELD; +} +#endif /* NCURSES_OPAQUE_FORM */ +FIELD; /********* * FORM * *********/ -typedef struct formnode { +typedef struct formnode +#if 1 /* not yet: !NCURSES_OPAQUE_FORM */ +{ unsigned short status; /* flags */ short rows; /* size in rows */ short cols; /* size in cols */ @@ -135,14 +158,18 @@ typedef struct formnode { void (*fieldinit)(struct formnode *); void (*fieldterm)(struct formnode *); -} FORM; +} +#endif /* !NCURSES_OPAQUE_FORM */ +FORM; /************** * FIELDTYPE * **************/ -typedef struct typenode { +typedef struct typenode +#if !NCURSES_OPAQUE_FORM +{ unsigned short status; /* flags */ long ref; /* reference count */ struct typenode * left; /* ptr to operand for | */ @@ -178,7 +205,9 @@ typedef struct typenode { bool (*next)(FIELD *,const void *); /* enumerate next value */ bool (*prev)(FIELD *,const void *); /* enumerate prev value */ #endif -} FIELDTYPE; +} +#endif /* !NCURSES_OPAQUE_FORM */ +FIELDTYPE; typedef void (*Form_Hook)(FORM *); @@ -203,6 +232,10 @@ typedef void (*Form_Hook)(FORM *); #define O_NULLOK (0x0080U) #define O_PASSOK (0x0100U) #define O_STATIC (0x0200U) +#define O_DYNAMIC_JUSTIFY (0x0400U) /* ncurses extension */ +#define O_NO_LEFT_STRIP (0x0800U) /* ncurses extension */ +#define O_EDGE_INSERT_STAY (0x1000U) /* ncurses extension */ +#define O_INPUT_LIMIT (0x2000U) /* ncurses extension */ /* form options */ #define O_NL_OVERLOAD (0x0001U) @@ -287,136 +320,141 @@ typedef void (*Form_Hook)(FORM *); /************************* * standard field types * *************************/ -extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA; -extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM; -extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM; -extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER; -extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC; -extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP; +extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA; +extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM; +extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM; +extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER; +extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC; +extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP; /************************************ * built-in additional field types * * They are not defined in SVr4 * ************************************/ -extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */ +extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */ /*********************** * FIELDTYPE routines * ***********************/ -extern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype ( +extern FORM_EXPORT(FIELDTYPE *) new_fieldtype ( bool (* const field_check)(FIELD *,const void *), bool (* const char_check)(int,const void *)); -extern NCURSES_EXPORT(FIELDTYPE *) link_fieldtype( +extern FORM_EXPORT(FIELDTYPE *) link_fieldtype( FIELDTYPE *, FIELDTYPE *); -extern NCURSES_EXPORT(int) free_fieldtype (FIELDTYPE *); -extern NCURSES_EXPORT(int) set_fieldtype_arg (FIELDTYPE *, +extern FORM_EXPORT(int) free_fieldtype (FIELDTYPE *); +extern FORM_EXPORT(int) set_fieldtype_arg (FIELDTYPE *, void * (* const make_arg)(va_list *), void * (* const copy_arg)(const void *), void (* const free_arg)(void *)); -extern NCURSES_EXPORT(int) set_fieldtype_choice (FIELDTYPE *, +extern FORM_EXPORT(int) set_fieldtype_choice (FIELDTYPE *, bool (* const next_choice)(FIELD *,const void *), bool (* const prev_choice)(FIELD *,const void *)); /******************* * FIELD routines * *******************/ -extern NCURSES_EXPORT(FIELD *) new_field (int,int,int,int,int,int); -extern NCURSES_EXPORT(FIELD *) dup_field (FIELD *,int,int); -extern NCURSES_EXPORT(FIELD *) link_field (FIELD *,int,int); - -extern NCURSES_EXPORT(int) free_field (FIELD *); -extern NCURSES_EXPORT(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *); -extern NCURSES_EXPORT(int) dynamic_field_info (const FIELD *,int *,int *,int *); -extern NCURSES_EXPORT(int) set_max_field ( FIELD *,int); -extern NCURSES_EXPORT(int) move_field (FIELD *,int,int); -extern NCURSES_EXPORT(int) set_field_type (FIELD *,FIELDTYPE *,...); -extern NCURSES_EXPORT(int) set_new_page (FIELD *,bool); -extern NCURSES_EXPORT(int) set_field_just (FIELD *,int); -extern NCURSES_EXPORT(int) field_just (const FIELD *); -extern NCURSES_EXPORT(int) set_field_fore (FIELD *,chtype); -extern NCURSES_EXPORT(int) set_field_back (FIELD *,chtype); -extern NCURSES_EXPORT(int) set_field_pad (FIELD *,int); -extern NCURSES_EXPORT(int) field_pad (const FIELD *); -extern NCURSES_EXPORT(int) set_field_buffer (FIELD *,int,const char *); -extern NCURSES_EXPORT(int) set_field_status (FIELD *,bool); -extern NCURSES_EXPORT(int) set_field_userptr (FIELD *, void *); -extern NCURSES_EXPORT(int) set_field_opts (FIELD *,Field_Options); -extern NCURSES_EXPORT(int) field_opts_on (FIELD *,Field_Options); -extern NCURSES_EXPORT(int) field_opts_off (FIELD *,Field_Options); - -extern NCURSES_EXPORT(chtype) field_fore (const FIELD *); -extern NCURSES_EXPORT(chtype) field_back (const FIELD *); - -extern NCURSES_EXPORT(bool) new_page (const FIELD *); -extern NCURSES_EXPORT(bool) field_status (const FIELD *); - -extern NCURSES_EXPORT(void *) field_arg (const FIELD *); - -extern NCURSES_EXPORT(void *) field_userptr (const FIELD *); - -extern NCURSES_EXPORT(FIELDTYPE *) field_type (const FIELD *); - -extern NCURSES_EXPORT(char *) field_buffer (const FIELD *,int); - -extern NCURSES_EXPORT(Field_Options) field_opts (const FIELD *); +extern FORM_EXPORT(FIELD *) new_field (int,int,int,int,int,int); +extern FORM_EXPORT(FIELD *) dup_field (FIELD *,int,int); +extern FORM_EXPORT(FIELD *) link_field (FIELD *,int,int); + +extern FORM_EXPORT(int) free_field (FIELD *); +extern FORM_EXPORT(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *); +extern FORM_EXPORT(int) dynamic_field_info (const FIELD *,int *,int *,int *); +extern FORM_EXPORT(int) set_max_field ( FIELD *,int); +extern FORM_EXPORT(int) move_field (FIELD *,int,int); +extern FORM_EXPORT(int) set_field_type (FIELD *,FIELDTYPE *,...); +extern FORM_EXPORT(int) set_new_page (FIELD *,bool); +extern FORM_EXPORT(int) set_field_just (FIELD *,int); +extern FORM_EXPORT(int) field_just (const FIELD *); +extern FORM_EXPORT(int) set_field_fore (FIELD *,chtype); +extern FORM_EXPORT(int) set_field_back (FIELD *,chtype); +extern FORM_EXPORT(int) set_field_pad (FIELD *,int); +extern FORM_EXPORT(int) field_pad (const FIELD *); +extern FORM_EXPORT(int) set_field_buffer (FIELD *,int,const char *); +extern FORM_EXPORT(int) set_field_status (FIELD *,bool); +extern FORM_EXPORT(int) set_field_userptr (FIELD *, void *); +extern FORM_EXPORT(int) set_field_opts (FIELD *,Field_Options); +extern FORM_EXPORT(int) field_opts_on (FIELD *,Field_Options); +extern FORM_EXPORT(int) field_opts_off (FIELD *,Field_Options); + +extern FORM_EXPORT(chtype) field_fore (const FIELD *); +extern FORM_EXPORT(chtype) field_back (const FIELD *); + +extern FORM_EXPORT(bool) new_page (const FIELD *); +extern FORM_EXPORT(bool) field_status (const FIELD *); + +extern FORM_EXPORT(void *) field_arg (const FIELD *); + +extern FORM_EXPORT(void *) field_userptr (const FIELD *); + +extern FORM_EXPORT(FIELDTYPE *) field_type (const FIELD *); + +extern FORM_EXPORT(char *) field_buffer (const FIELD *,int); + +extern FORM_EXPORT(Field_Options) field_opts (const FIELD *); /****************** * FORM routines * ******************/ -extern NCURSES_EXPORT(FORM *) new_form (FIELD **); - -extern NCURSES_EXPORT(FIELD **) form_fields (const FORM *); -extern NCURSES_EXPORT(FIELD *) current_field (const FORM *); - -extern NCURSES_EXPORT(WINDOW *) form_win (const FORM *); -extern NCURSES_EXPORT(WINDOW *) form_sub (const FORM *); - -extern NCURSES_EXPORT(Form_Hook) form_init (const FORM *); -extern NCURSES_EXPORT(Form_Hook) form_term (const FORM *); -extern NCURSES_EXPORT(Form_Hook) field_init (const FORM *); -extern NCURSES_EXPORT(Form_Hook) field_term (const FORM *); - -extern NCURSES_EXPORT(int) free_form (FORM *); -extern NCURSES_EXPORT(int) set_form_fields (FORM *,FIELD **); -extern NCURSES_EXPORT(int) field_count (const FORM *); -extern NCURSES_EXPORT(int) set_form_win (FORM *,WINDOW *); -extern NCURSES_EXPORT(int) set_form_sub (FORM *,WINDOW *); -extern NCURSES_EXPORT(int) set_current_field (FORM *,FIELD *); -extern NCURSES_EXPORT(int) field_index (const FIELD *); -extern NCURSES_EXPORT(int) set_form_page (FORM *,int); -extern NCURSES_EXPORT(int) form_page (const FORM *); -extern NCURSES_EXPORT(int) scale_form (const FORM *,int *,int *); -extern NCURSES_EXPORT(int) set_form_init (FORM *,Form_Hook); -extern NCURSES_EXPORT(int) set_form_term (FORM *,Form_Hook); -extern NCURSES_EXPORT(int) set_field_init (FORM *,Form_Hook); -extern NCURSES_EXPORT(int) set_field_term (FORM *,Form_Hook); -extern NCURSES_EXPORT(int) post_form (FORM *); -extern NCURSES_EXPORT(int) unpost_form (FORM *); -extern NCURSES_EXPORT(int) pos_form_cursor (FORM *); -extern NCURSES_EXPORT(int) form_driver (FORM *,int); -extern NCURSES_EXPORT(int) set_form_userptr (FORM *,void *); -extern NCURSES_EXPORT(int) set_form_opts (FORM *,Form_Options); -extern NCURSES_EXPORT(int) form_opts_on (FORM *,Form_Options); -extern NCURSES_EXPORT(int) form_opts_off (FORM *,Form_Options); -extern NCURSES_EXPORT(int) form_request_by_name (const char *); - -extern NCURSES_EXPORT(const char *) form_request_name (int); - -extern NCURSES_EXPORT(void *) form_userptr (const FORM *); - -extern NCURSES_EXPORT(Form_Options) form_opts (const FORM *); - -extern NCURSES_EXPORT(bool) data_ahead (const FORM *); -extern NCURSES_EXPORT(bool) data_behind (const FORM *); +extern FORM_EXPORT(FORM *) new_form (FIELD **); + +extern FORM_EXPORT(FIELD **) form_fields (const FORM *); +extern FORM_EXPORT(FIELD *) current_field (const FORM *); + +extern FORM_EXPORT(WINDOW *) form_win (const FORM *); +extern FORM_EXPORT(WINDOW *) form_sub (const FORM *); + +extern FORM_EXPORT(Form_Hook) form_init (const FORM *); +extern FORM_EXPORT(Form_Hook) form_term (const FORM *); +extern FORM_EXPORT(Form_Hook) field_init (const FORM *); +extern FORM_EXPORT(Form_Hook) field_term (const FORM *); + +extern FORM_EXPORT(int) free_form (FORM *); +extern FORM_EXPORT(int) set_form_fields (FORM *,FIELD **); +extern FORM_EXPORT(int) field_count (const FORM *); +extern FORM_EXPORT(int) set_form_win (FORM *,WINDOW *); +extern FORM_EXPORT(int) set_form_sub (FORM *,WINDOW *); +extern FORM_EXPORT(int) set_current_field (FORM *,FIELD *); +extern FORM_EXPORT(int) unfocus_current_field (FORM *); +extern FORM_EXPORT(int) field_index (const FIELD *); +extern FORM_EXPORT(int) set_form_page (FORM *,int); +extern FORM_EXPORT(int) form_page (const FORM *); +extern FORM_EXPORT(int) scale_form (const FORM *,int *,int *); +extern FORM_EXPORT(int) set_form_init (FORM *,Form_Hook); +extern FORM_EXPORT(int) set_form_term (FORM *,Form_Hook); +extern FORM_EXPORT(int) set_field_init (FORM *,Form_Hook); +extern FORM_EXPORT(int) set_field_term (FORM *,Form_Hook); +extern FORM_EXPORT(int) post_form (FORM *); +extern FORM_EXPORT(int) unpost_form (FORM *); +extern FORM_EXPORT(int) pos_form_cursor (FORM *); +extern FORM_EXPORT(int) form_driver (FORM *,int); +# if NCURSES_WIDECHAR +extern FORM_EXPORT(int) form_driver_w (FORM *,int,wchar_t); +# endif +extern FORM_EXPORT(int) set_form_userptr (FORM *,void *); +extern FORM_EXPORT(int) set_form_opts (FORM *,Form_Options); +extern FORM_EXPORT(int) form_opts_on (FORM *,Form_Options); +extern FORM_EXPORT(int) form_opts_off (FORM *,Form_Options); +extern FORM_EXPORT(int) form_request_by_name (const char *); + +extern FORM_EXPORT(const char *) form_request_name (int); + +extern FORM_EXPORT(void *) form_userptr (const FORM *); + +extern FORM_EXPORT(Form_Options) form_opts (const FORM *); + +extern FORM_EXPORT(bool) data_ahead (const FORM *); +extern FORM_EXPORT(bool) data_behind (const FORM *); #if NCURSES_SP_FUNCS -extern NCURSES_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **); +extern FORM_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **); #endif #ifdef __cplusplus } #endif +/* *INDENT-ON*/ -#endif /* FORM_H */ +#endif /* FORM_H */ diff --git a/C/menu.h b/C/menu.h index f76b248..e5a5372 100644 --- a/C/menu.h +++ b/C/menu.h @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2007,2009 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -30,7 +31,7 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: menu.h,v 1.20 2009/04/05 00:28:07 tom Exp $ */ +/* $Id: menu.h,v 1.26 2020/12/12 00:38:02 tom Exp $ */ #ifndef ETI_MENU #define ETI_MENU @@ -39,15 +40,27 @@ #define TEXT TEXT_ncurses #endif -#include -#include +#include +#include #ifdef __cplusplus -extern "C" { +extern "C" +{ +#endif + +#if defined(BUILDING_MENU) +# define MENU_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT +#else +# define MENU_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT #endif -typedef int Menu_Options; -typedef int Item_Options; +#define MENU_WRAPPED_VAR(type,name) extern MENU_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) + +#define MENU_EXPORT(type) MENU_IMPEXP type NCURSES_API +#define MENU_EXPORT_VAR(type) MENU_IMPEXP type + + typedef int Menu_Options; + typedef int Item_Options; /* Menu options: */ #define O_ONEVALUE (0x01) @@ -56,81 +69,91 @@ typedef int Item_Options; #define O_IGNORECASE (0x08) #define O_SHOWMATCH (0x10) #define O_NONCYCLIC (0x20) +#define O_MOUSE_MENU (0x40) /* Item options: */ #define O_SELECTABLE (0x01) -typedef struct -{ - const char* str; - unsigned short length; -} TEXT; - -typedef struct tagITEM -{ - TEXT name; /* name of menu item */ - TEXT description; /* description of item, optional in display */ - struct tagMENU *imenu; /* Pointer to parent menu */ - void *userptr; /* Pointer to user defined per item data */ - Item_Options opt; /* Item options */ - short index; /* Item number if connected to a menu */ - short y; /* y and x location of item in menu */ - short x; - bool value; /* Selection value */ - - struct tagITEM *left; /* neighbor items */ - struct tagITEM *right; - struct tagITEM *up; - struct tagITEM *down; - -} ITEM; - -typedef void (*Menu_Hook)(struct tagMENU *); - -typedef struct tagMENU -{ - short height; /* Nr. of chars high */ - short width; /* Nr. of chars wide */ - short rows; /* Nr. of items high */ - short cols; /* Nr. of items wide */ - short frows; /* Nr. of formatted items high */ - short fcols; /* Nr. of formatted items wide */ - short arows; /* Nr. of items high (actual) */ - short namelen; /* Max. name length */ - short desclen; /* Max. description length */ - short marklen; /* Length of mark, if any */ - short itemlen; /* Length of one item */ - short spc_desc; /* Spacing for descriptor */ - short spc_cols; /* Spacing for columns */ - short spc_rows; /* Spacing for rows */ - char *pattern; /* Buffer to store match chars */ - short pindex; /* Index into pattern buffer */ - WINDOW *win; /* Window containing menu */ - WINDOW *sub; /* Subwindow for menu display */ - WINDOW *userwin; /* User's window */ - WINDOW *usersub; /* User's subwindow */ - ITEM **items; /* array of items */ - short nitems; /* Nr. of items in menu */ - ITEM *curitem; /* Current item */ - short toprow; /* Top row of menu */ - chtype fore; /* Selection attribute */ - chtype back; /* Nonselection attribute */ - chtype grey; /* Inactive attribute */ - unsigned char pad; /* Pad character */ - - Menu_Hook menuinit; /* User hooks */ - Menu_Hook menuterm; - Menu_Hook iteminit; - Menu_Hook itemterm; - - void *userptr; /* Pointer to menus user data */ - char *mark; /* Pointer to marker string */ - - Menu_Options opt; /* Menu options */ - unsigned short status; /* Internal state of menu */ - -} MENU; - +#if !NCURSES_OPAQUE_MENU + typedef struct + { + const char *str; + unsigned short length; + } + TEXT; +#endif /* !NCURSES_OPAQUE_MENU */ + + struct tagMENU; + + typedef struct tagITEM +#if !NCURSES_OPAQUE_MENU + { + TEXT name; /* name of menu item */ + TEXT description; /* description of item, optional in display */ + struct tagMENU *imenu; /* Pointer to parent menu */ + void *userptr; /* Pointer to user defined per item data */ + Item_Options opt; /* Item options */ + short index; /* Item number if connected to a menu */ + short y; /* y and x location of item in menu */ + short x; + bool value; /* Selection value */ + + struct tagITEM *left; /* neighbor items */ + struct tagITEM *right; + struct tagITEM *up; + struct tagITEM *down; + + } +#endif /* !NCURSES_OPAQUE_MENU */ + ITEM; + + typedef void (*Menu_Hook) (struct tagMENU *); + + typedef struct tagMENU +#if 1 /* not yet: !NCURSES_OPAQUE_MENU */ + { + short height; /* Nr. of chars high */ + short width; /* Nr. of chars wide */ + short rows; /* Nr. of items high */ + short cols; /* Nr. of items wide */ + short frows; /* Nr. of formatted items high */ + short fcols; /* Nr. of formatted items wide */ + short arows; /* Nr. of items high (actual) */ + short namelen; /* Max. name length */ + short desclen; /* Max. description length */ + short marklen; /* Length of mark, if any */ + short itemlen; /* Length of one item */ + short spc_desc; /* Spacing for descriptor */ + short spc_cols; /* Spacing for columns */ + short spc_rows; /* Spacing for rows */ + char *pattern; /* Buffer to store match chars */ + short pindex; /* Index into pattern buffer */ + WINDOW *win; /* Window containing menu */ + WINDOW *sub; /* Subwindow for menu display */ + WINDOW *userwin; /* User's window */ + WINDOW *usersub; /* User's subwindow */ + ITEM **items; /* array of items */ + short nitems; /* Nr. of items in menu */ + ITEM *curitem; /* Current item */ + short toprow; /* Top row of menu */ + chtype fore; /* Selection attribute */ + chtype back; /* Nonselection attribute */ + chtype grey; /* Inactive attribute */ + unsigned char pad; /* Pad character */ + + Menu_Hook menuinit; /* User hooks */ + Menu_Hook menuterm; + Menu_Hook iteminit; + Menu_Hook itemterm; + + void *userptr; /* Pointer to menus user data */ + char *mark; /* Pointer to marker string */ + + Menu_Options opt; /* Menu options */ + unsigned short status; /* Internal state of menu */ + } +#endif /* !NCURSES_OPAQUE_MENU */ + MENU; /* Define keys */ @@ -169,92 +192,90 @@ typedef struct tagMENU # define MAX_COMMAND (KEY_MAX + 128) #endif - /* --------- prototypes for libmenu functions ----------------------------- */ -extern NCURSES_EXPORT(ITEM **) menu_items (const MENU *); -extern NCURSES_EXPORT(ITEM *) current_item (const MENU *); -extern NCURSES_EXPORT(ITEM *) new_item (const char *,const char *); - -extern NCURSES_EXPORT(MENU *) new_menu (ITEM **); - -extern NCURSES_EXPORT(Item_Options) item_opts (const ITEM *); -extern NCURSES_EXPORT(Menu_Options) menu_opts (const MENU *); - -extern NCURSES_EXPORT(Menu_Hook) item_init (const MENU *); -extern NCURSES_EXPORT(Menu_Hook) item_term (const MENU *); -extern NCURSES_EXPORT(Menu_Hook) menu_init (const MENU *); -extern NCURSES_EXPORT(Menu_Hook) menu_term (const MENU *); - -extern NCURSES_EXPORT(WINDOW *) menu_sub (const MENU *); -extern NCURSES_EXPORT(WINDOW *) menu_win (const MENU *); - -extern NCURSES_EXPORT(const char *) item_description (const ITEM *); -extern NCURSES_EXPORT(const char *) item_name (const ITEM *); -extern NCURSES_EXPORT(const char *) menu_mark (const MENU *); -extern NCURSES_EXPORT(const char *) menu_request_name (int); - -extern NCURSES_EXPORT(char *) menu_pattern (const MENU *); - -extern NCURSES_EXPORT(void *) menu_userptr (const MENU *); -extern NCURSES_EXPORT(void *) item_userptr (const ITEM *); - -extern NCURSES_EXPORT(chtype) menu_back (const MENU *); -extern NCURSES_EXPORT(chtype) menu_fore (const MENU *); -extern NCURSES_EXPORT(chtype) menu_grey (const MENU *); - -extern NCURSES_EXPORT(int) free_item (ITEM *); -extern NCURSES_EXPORT(int) free_menu (MENU *); -extern NCURSES_EXPORT(int) item_count (const MENU *); -extern NCURSES_EXPORT(int) item_index (const ITEM *); -extern NCURSES_EXPORT(int) item_opts_off (ITEM *,Item_Options); -extern NCURSES_EXPORT(int) item_opts_on (ITEM *,Item_Options); -extern NCURSES_EXPORT(int) menu_driver (MENU *,int); -extern NCURSES_EXPORT(int) menu_opts_off (MENU *,Menu_Options); -extern NCURSES_EXPORT(int) menu_opts_on (MENU *,Menu_Options); -extern NCURSES_EXPORT(int) menu_pad (const MENU *); -extern NCURSES_EXPORT(int) pos_menu_cursor (const MENU *); -extern NCURSES_EXPORT(int) post_menu (MENU *); -extern NCURSES_EXPORT(int) scale_menu (const MENU *,int *,int *); -extern NCURSES_EXPORT(int) set_current_item (MENU *menu,ITEM *item); -extern NCURSES_EXPORT(int) set_item_init (MENU *, Menu_Hook); -extern NCURSES_EXPORT(int) set_item_opts (ITEM *,Item_Options); -extern NCURSES_EXPORT(int) set_item_term (MENU *, Menu_Hook); -extern NCURSES_EXPORT(int) set_item_userptr (ITEM *, void *); -extern NCURSES_EXPORT(int) set_item_value (ITEM *,bool); -extern NCURSES_EXPORT(int) set_menu_back (MENU *,chtype); -extern NCURSES_EXPORT(int) set_menu_fore (MENU *,chtype); -extern NCURSES_EXPORT(int) set_menu_format (MENU *,int,int); -extern NCURSES_EXPORT(int) set_menu_grey (MENU *,chtype); -extern NCURSES_EXPORT(int) set_menu_init (MENU *, Menu_Hook); -extern NCURSES_EXPORT(int) set_menu_items (MENU *,ITEM **); -extern NCURSES_EXPORT(int) set_menu_mark (MENU *, const char *); -extern NCURSES_EXPORT(int) set_menu_opts (MENU *,Menu_Options); -extern NCURSES_EXPORT(int) set_menu_pad (MENU *,int); -extern NCURSES_EXPORT(int) set_menu_pattern (MENU *,const char *); -extern NCURSES_EXPORT(int) set_menu_sub (MENU *,WINDOW *); -extern NCURSES_EXPORT(int) set_menu_term (MENU *, Menu_Hook); -extern NCURSES_EXPORT(int) set_menu_userptr (MENU *,void *); -extern NCURSES_EXPORT(int) set_menu_win (MENU *,WINDOW *); -extern NCURSES_EXPORT(int) set_top_row (MENU *,int); -extern NCURSES_EXPORT(int) top_row (const MENU *); -extern NCURSES_EXPORT(int) unpost_menu (MENU *); -extern NCURSES_EXPORT(int) menu_request_by_name (const char *); -extern NCURSES_EXPORT(int) set_menu_spacing (MENU *,int,int,int); -extern NCURSES_EXPORT(int) menu_spacing (const MENU *,int *,int *,int *); - - -extern NCURSES_EXPORT(bool) item_value (const ITEM *); -extern NCURSES_EXPORT(bool) item_visible (const ITEM *); - -extern NCURSES_EXPORT(void) menu_format (const MENU *,int *,int *); + extern MENU_EXPORT(ITEM **) menu_items(const MENU *); + extern MENU_EXPORT(ITEM *) current_item(const MENU *); + extern MENU_EXPORT(ITEM *) new_item(const char *, const char *); + + extern MENU_EXPORT(MENU *) new_menu(ITEM **); + + extern MENU_EXPORT(Item_Options) item_opts(const ITEM *); + extern MENU_EXPORT(Menu_Options) menu_opts(const MENU *); + + extern MENU_EXPORT(Menu_Hook) item_init(const MENU *); + extern MENU_EXPORT(Menu_Hook) item_term(const MENU *); + extern MENU_EXPORT(Menu_Hook) menu_init(const MENU *); + extern MENU_EXPORT(Menu_Hook) menu_term(const MENU *); + + extern MENU_EXPORT(WINDOW *) menu_sub(const MENU *); + extern MENU_EXPORT(WINDOW *) menu_win(const MENU *); + + extern MENU_EXPORT(const char *) item_description(const ITEM *); + extern MENU_EXPORT(const char *) item_name(const ITEM *); + extern MENU_EXPORT(const char *) menu_mark(const MENU *); + extern MENU_EXPORT(const char *) menu_request_name(int); + + extern MENU_EXPORT(char *) menu_pattern(const MENU *); + + extern MENU_EXPORT(void *) menu_userptr(const MENU *); + extern MENU_EXPORT(void *) item_userptr(const ITEM *); + + extern MENU_EXPORT(chtype) menu_back(const MENU *); + extern MENU_EXPORT(chtype) menu_fore(const MENU *); + extern MENU_EXPORT(chtype) menu_grey(const MENU *); + + extern MENU_EXPORT(int) free_item(ITEM *); + extern MENU_EXPORT(int) free_menu(MENU *); + extern MENU_EXPORT(int) item_count(const MENU *); + extern MENU_EXPORT(int) item_index(const ITEM *); + extern MENU_EXPORT(int) item_opts_off(ITEM *, Item_Options); + extern MENU_EXPORT(int) item_opts_on(ITEM *, Item_Options); + extern MENU_EXPORT(int) menu_driver(MENU *, int); + extern MENU_EXPORT(int) menu_opts_off(MENU *, Menu_Options); + extern MENU_EXPORT(int) menu_opts_on(MENU *, Menu_Options); + extern MENU_EXPORT(int) menu_pad(const MENU *); + extern MENU_EXPORT(int) pos_menu_cursor(const MENU *); + extern MENU_EXPORT(int) post_menu(MENU *); + extern MENU_EXPORT(int) scale_menu(const MENU *, int *, int *); + extern MENU_EXPORT(int) set_current_item(MENU *menu, ITEM *item); + extern MENU_EXPORT(int) set_item_init(MENU *, Menu_Hook); + extern MENU_EXPORT(int) set_item_opts(ITEM *, Item_Options); + extern MENU_EXPORT(int) set_item_term(MENU *, Menu_Hook); + extern MENU_EXPORT(int) set_item_userptr(ITEM *, void *); + extern MENU_EXPORT(int) set_item_value(ITEM *, bool); + extern MENU_EXPORT(int) set_menu_back(MENU *, chtype); + extern MENU_EXPORT(int) set_menu_fore(MENU *, chtype); + extern MENU_EXPORT(int) set_menu_format(MENU *, int, int); + extern MENU_EXPORT(int) set_menu_grey(MENU *, chtype); + extern MENU_EXPORT(int) set_menu_init(MENU *, Menu_Hook); + extern MENU_EXPORT(int) set_menu_items(MENU *, ITEM **); + extern MENU_EXPORT(int) set_menu_mark(MENU *, const char *); + extern MENU_EXPORT(int) set_menu_opts(MENU *, Menu_Options); + extern MENU_EXPORT(int) set_menu_pad(MENU *, int); + extern MENU_EXPORT(int) set_menu_pattern(MENU *, const char *); + extern MENU_EXPORT(int) set_menu_sub(MENU *, WINDOW *); + extern MENU_EXPORT(int) set_menu_term(MENU *, Menu_Hook); + extern MENU_EXPORT(int) set_menu_userptr(MENU *, void *); + extern MENU_EXPORT(int) set_menu_win(MENU *, WINDOW *); + extern MENU_EXPORT(int) set_top_row(MENU *, int); + extern MENU_EXPORT(int) top_row(const MENU *); + extern MENU_EXPORT(int) unpost_menu(MENU *); + extern MENU_EXPORT(int) menu_request_by_name(const char *); + extern MENU_EXPORT(int) set_menu_spacing(MENU *, int, int, int); + extern MENU_EXPORT(int) menu_spacing(const MENU *, int *, int *, int *); + + extern MENU_EXPORT(bool) item_value(const ITEM *); + extern MENU_EXPORT(bool) item_visible(const ITEM *); + + extern MENU_EXPORT(void) menu_format(const MENU *, int *, int *); #if NCURSES_SP_FUNCS -extern NCURSES_EXPORT(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN*, ITEM **); + extern MENU_EXPORT(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN *, ITEM **); #endif #ifdef __cplusplus - } +} #endif -#endif /* ETI_MENU */ +#endif /* ETI_MENU */ diff --git a/C/nc_tparm.h b/C/nc_tparm.h new file mode 100644 index 0000000..943d947 --- /dev/null +++ b/C/nc_tparm.h @@ -0,0 +1,92 @@ +/**************************************************************************** + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2006-2012,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Thomas E. Dickey 2006 * + ****************************************************************************/ + +/* $Id: nc_tparm.h,v 1.11 2020/05/27 23:33:31 tom Exp $ */ + +#ifndef NC_TPARM_included +#define NC_TPARM_included 1 + +#include +#include + +/* + * Cast parameters past the formatting-string for tparm() to match the + * assumption of the varargs code. + */ +#ifndef TPARM_ARG +#ifdef NCURSES_TPARM_ARG +#define TPARM_ARG NCURSES_TPARM_ARG +#else +#define TPARM_ARG long +#endif +#endif /* TPARAM_ARG */ + +#define TPARM_N(n) (TPARM_ARG)(n) + +#define TPARM_9(a,b,c,d,e,f,g,h,i,j) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i),TPARM_N(j)) + +#if NCURSES_TPARM_VARARGS +#define TPARM_8(a,b,c,d,e,f,g,h,i) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i)) +#define TPARM_7(a,b,c,d,e,f,g,h) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h)) +#define TPARM_6(a,b,c,d,e,f,g) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g)) +#define TPARM_5(a,b,c,d,e,f) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f)) +#define TPARM_4(a,b,c,d,e) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e)) +#define TPARM_3(a,b,c,d) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d)) +#define TPARM_2(a,b,c) tparm(a,TPARM_N(b),TPARM_N(c)) +#define TPARM_1(a,b) tparm(a,TPARM_N(b)) +#define TPARM_0(a) tparm(a) +#else +#define TPARM_8(a,b,c,d,e,f,g,h,i) TPARM_9(a,b,c,d,e,f,g,h,i,0) +#define TPARM_7(a,b,c,d,e,f,g,h) TPARM_8(a,b,c,d,e,f,g,h,0) +#define TPARM_6(a,b,c,d,e,f,g) TPARM_7(a,b,c,d,e,f,g,0) +#define TPARM_5(a,b,c,d,e,f) TPARM_6(a,b,c,d,e,f,0) +#define TPARM_4(a,b,c,d,e) TPARM_5(a,b,c,d,e,0) +#define TPARM_3(a,b,c,d) TPARM_4(a,b,c,d,0) +#define TPARM_2(a,b,c) TPARM_3(a,b,c,0) +#define TPARM_1(a,b) TPARM_2(a,b,0) +#define TPARM_0(a) TPARM_1(a,0) +#endif + +#ifdef NCURSES_INTERNALS +#define TIPARM_1(s,a) _nc_tiparm(1,s,a) +#define TIPARM_2(s,a,b) _nc_tiparm(2,s,a,b) +#define TIPARM_3(s,a,b,c) _nc_tiparm(3,s,a,b,c) +#define TIPARM_4(s,a,b,c,d) _nc_tiparm(4,s,a,b,c,d) +#define TIPARM_5(s,a,b,c,d,e) _nc_tiparm(5,s,a,b,c,d,e) +#define TIPARM_6(s,a,b,c,d,e,f) _nc_tiparm(6,s,a,b,c,d,e,f) +#define TIPARM_7(s,a,b,c,d,e,f,g) _nc_tiparm(7,s,a,b,c,d,e,f,g) +#define TIPARM_8(s,a,b,c,d,e,f,g,h) _nc_tiparm(8,s,a,b,c,d,e,f,g,h) +#define TIPARM_9(s,a,b,c,d,e,f,g,h,i) _nc_tiparm(9,s,a,b,c,d,e,f,g,h,i) +#endif + +#endif /* NC_TPARM_included */ diff --git a/C/ncurses.h b/C/ncurses.h new file mode 120000 index 0000000..149de6c --- /dev/null +++ b/C/ncurses.h @@ -0,0 +1 @@ +curses.h \ No newline at end of file diff --git a/C/ncurses_dll.h b/C/ncurses_dll.h new file mode 100644 index 0000000..0ffd866 --- /dev/null +++ b/C/ncurses_dll.h @@ -0,0 +1,99 @@ +/**************************************************************************** + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2009,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ +/* $Id: ncurses_dll.h.in,v 1.17 2020/09/05 17:58:47 juergen Exp $ */ + +#ifndef NCURSES_DLL_H_incl +#define NCURSES_DLL_H_incl 1 + +/* + * MinGW gcc (unlike MSYS2 and Cygwin) should define _WIN32 and possibly _WIN64. + */ +#if defined(__MINGW64__) + +#ifndef _WIN64 +#define _WIN64 1 +#endif + +#elif defined(__MINGW32__) + +#ifndef _WIN32 +#define _WIN32 1 +#endif + +/* 2014-08-02 workaround for broken MinGW compiler. + * Oddly, only TRACE is mapped to trace - the other -D's are okay. + * suggest TDM as an alternative. + */ +#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) + +#ifdef trace +#undef trace +#define TRACE +#endif + +#endif /* broken compiler */ + +#endif /* MingW */ + +/* + * For reentrant code, we map the various global variables into SCREEN by + * using functions to access them. + */ +#define NCURSES_PUBLIC_VAR(name) _nc_##name + +#if defined(BUILDING_NCURSES) +# define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT +#else +# define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT +#endif + +#define NCURSES_WRAPPED_VAR(type,name) extern NCURSES_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) + +#define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type + +/* + * These symbols hide dllimport/dllexport, for compilers which care about it. + */ +#if defined(__CYGWIN__) || (defined(_WIN32) || defined(_WIN64)) +# if defined(NCURSES_STATIC) /* "static" here only implies "not-a-DLL" */ +# define NCURSES_EXPORT_GENERAL_IMPORT +# define NCURSES_EXPORT_GENERAL_EXPORT +# else +# define NCURSES_EXPORT_GENERAL_IMPORT __declspec(dllimport) +# define NCURSES_EXPORT_GENERAL_EXPORT __declspec(dllexport) +# endif +# define NCURSES_API __cdecl +#else +# define NCURSES_EXPORT_GENERAL_IMPORT +# define NCURSES_EXPORT_GENERAL_EXPORT +# define NCURSES_API /* FIXME: __attribute__ ((cdecl)) is only available on x86 */ +#endif + +#endif /* NCURSES_DLL_H_incl */ diff --git a/C/panel.h b/C/panel.h index cbad12e..62acc8f 100644 --- a/C/panel.h +++ b/C/panel.h @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,48 +33,62 @@ * and: Juergen Pfeifer 1996-1999,2008 * ****************************************************************************/ -/* $Id: panel.h,v 1.11 2009/04/11 19:50:40 tom Exp $ */ +/* $Id: panel.h,v 1.14 2020/07/04 20:38:43 tom Exp $ */ /* panel.h -- interface file for panels library */ #ifndef NCURSES_PANEL_H_incl #define NCURSES_PANEL_H_incl 1 -#include +#include typedef struct panel +#if !NCURSES_OPAQUE_PANEL { WINDOW *win; struct panel *below; struct panel *above; NCURSES_CONST void *user; -} PANEL; +} +#endif /* !NCURSES_OPAQUE_PANEL */ +PANEL; #if defined(__cplusplus) extern "C" { #endif -extern NCURSES_EXPORT(WINDOW*) panel_window (const PANEL *); -extern NCURSES_EXPORT(void) update_panels (void); -extern NCURSES_EXPORT(int) hide_panel (PANEL *); -extern NCURSES_EXPORT(int) show_panel (PANEL *); -extern NCURSES_EXPORT(int) del_panel (PANEL *); -extern NCURSES_EXPORT(int) top_panel (PANEL *); -extern NCURSES_EXPORT(int) bottom_panel (PANEL *); -extern NCURSES_EXPORT(PANEL*) new_panel (WINDOW *); -extern NCURSES_EXPORT(PANEL*) panel_above (const PANEL *); -extern NCURSES_EXPORT(PANEL*) panel_below (const PANEL *); -extern NCURSES_EXPORT(int) set_panel_userptr (PANEL *, NCURSES_CONST void *); -extern NCURSES_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *); -extern NCURSES_EXPORT(int) move_panel (PANEL *, int, int); -extern NCURSES_EXPORT(int) replace_panel (PANEL *,WINDOW *); -extern NCURSES_EXPORT(int) panel_hidden (const PANEL *); +#if defined(BUILDING_PANEL) +# define PANEL_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT +#else +# define PANEL_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT +#endif + +#define PANEL_WRAPPED_VAR(type,name) extern PANEL_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) + +#define PANEL_EXPORT(type) PANEL_IMPEXP type NCURSES_API +#define PANEL_EXPORT_VAR(type) PANEL_IMPEXP type + +extern PANEL_EXPORT(WINDOW*) panel_window (const PANEL *); +extern PANEL_EXPORT(void) update_panels (void); +extern PANEL_EXPORT(int) hide_panel (PANEL *); +extern PANEL_EXPORT(int) show_panel (PANEL *); +extern PANEL_EXPORT(int) del_panel (PANEL *); +extern PANEL_EXPORT(int) top_panel (PANEL *); +extern PANEL_EXPORT(int) bottom_panel (PANEL *); +extern PANEL_EXPORT(PANEL*) new_panel (WINDOW *); +extern PANEL_EXPORT(PANEL*) panel_above (const PANEL *); +extern PANEL_EXPORT(PANEL*) panel_below (const PANEL *); +extern PANEL_EXPORT(int) set_panel_userptr (PANEL *, NCURSES_CONST void *); +extern PANEL_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *); +extern PANEL_EXPORT(int) move_panel (PANEL *, int, int); +extern PANEL_EXPORT(int) replace_panel (PANEL *,WINDOW *); +extern PANEL_EXPORT(int) panel_hidden (const PANEL *); #if NCURSES_SP_FUNCS -extern NCURSES_EXPORT(PANEL *) ground_panel(SCREEN *); -extern NCURSES_EXPORT(PANEL *) ceiling_panel(SCREEN *); +extern PANEL_EXPORT(PANEL *) ground_panel(SCREEN *); +extern PANEL_EXPORT(PANEL *) ceiling_panel(SCREEN *); -extern NCURSES_EXPORT(void) NCURSES_SP_NAME(update_panels) (SCREEN*); +extern PANEL_EXPORT(void) NCURSES_SP_NAME(update_panels) (SCREEN*); #endif #if defined(__cplusplus) diff --git a/C/term.h b/C/term.h new file mode 100644 index 0000000..4779d96 --- /dev/null +++ b/C/term.h @@ -0,0 +1,893 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2013,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/****************************************************************************/ +/* Author: Zeyd M. Ben-Halim 1992,1995 */ +/* and: Eric S. Raymond */ +/* and: Thomas E. Dickey 1995-on */ +/****************************************************************************/ + +/* $Id: MKterm.h.awk.in,v 1.82 2021/09/24 17:02:46 tom Exp $ */ + +/* +** term.h -- Definition of struct term +*/ + +#ifndef NCURSES_TERM_H_incl +#define NCURSES_TERM_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.3" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H + * definition (based on the system for which this was configured). + */ + +#ifndef __NCURSES_H + +typedef struct screen SCREEN; + +#if 1 +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 20211021 +#undef NCURSES_SP_NAME +#define NCURSES_SP_NAME(name) name##_sp + +/* Define the sp-funcs helper function */ +#undef NCURSES_SP_OUTC +#define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC) +typedef int (*NCURSES_SP_OUTC)(SCREEN*, int); +#endif + +#endif /* __NCURSES_H */ + +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_SBOOL +#define NCURSES_SBOOL char + +#undef NCURSES_USE_DATABASE +#define NCURSES_USE_DATABASE 1 + +#undef NCURSES_USE_TERMCAP +#define NCURSES_USE_TERMCAP 0 + +#undef NCURSES_XNAMES +#define NCURSES_XNAMES 1 + +/* We will use these symbols to hide differences between + * termios/termio/sgttyb interfaces. + */ +#undef TTY +#undef SET_TTY +#undef GET_TTY + +/* Assume POSIX termio if we have the header and function */ +/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */ +#if 1 && 1 + +#undef TERMIOS +#define TERMIOS 1 + +#include +#define TTY struct termios + +#else /* !HAVE_TERMIOS_H */ + +/* #if HAVE_TERMIO_H */ +#if 1 + +#undef TERMIOS +#define TERMIOS 1 + +#include +#define TTY struct termio + +#else /* !HAVE_TERMIO_H */ + +#if (defined(_WIN32) || defined(_WIN64)) +#if 0 +#include +#define TTY struct winconmode +#else +#include +#define TTY struct termios +#endif +#else +#undef TERMIOS +#include +#include +#define TTY struct sgttyb +#endif /* MINGW32 */ +#endif /* HAVE_TERMIO_H */ + +#endif /* HAVE_TERMIOS_H */ + +#ifdef TERMIOS +#define GET_TTY(fd, buf) tcgetattr(fd, buf) +#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf) +#elif 0 && (defined(_WIN32) || defined(_WIN64)) +#define GET_TTY(fd, buf) _nc_console_getmode(_nc_console_fd2handle(fd),buf) +#define SET_TTY(fd, buf) _nc_console_setmode(_nc_console_fd2handle(fd),buf) +#else +#define GET_TTY(fd, buf) gtty(fd, buf) +#define SET_TTY(fd, buf) stty(fd, buf) +#endif + +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif + +#define NAMESIZE 256 + +/* The cast works because TERMTYPE is the first data in TERMINAL */ +#define CUR ((TERMTYPE *)(cur_term))-> + +#define auto_left_margin CUR Booleans[0] +#define auto_right_margin CUR Booleans[1] +#define no_esc_ctlc CUR Booleans[2] +#define ceol_standout_glitch CUR Booleans[3] +#define eat_newline_glitch CUR Booleans[4] +#define erase_overstrike CUR Booleans[5] +#define generic_type CUR Booleans[6] +#define hard_copy CUR Booleans[7] +#define has_meta_key CUR Booleans[8] +#define has_status_line CUR Booleans[9] +#define insert_null_glitch CUR Booleans[10] +#define memory_above CUR Booleans[11] +#define memory_below CUR Booleans[12] +#define move_insert_mode CUR Booleans[13] +#define move_standout_mode CUR Booleans[14] +#define over_strike CUR Booleans[15] +#define status_line_esc_ok CUR Booleans[16] +#define dest_tabs_magic_smso CUR Booleans[17] +#define tilde_glitch CUR Booleans[18] +#define transparent_underline CUR Booleans[19] +#define xon_xoff CUR Booleans[20] +#define needs_xon_xoff CUR Booleans[21] +#define prtr_silent CUR Booleans[22] +#define hard_cursor CUR Booleans[23] +#define non_rev_rmcup CUR Booleans[24] +#define no_pad_char CUR Booleans[25] +#define non_dest_scroll_region CUR Booleans[26] +#define can_change CUR Booleans[27] +#define back_color_erase CUR Booleans[28] +#define hue_lightness_saturation CUR Booleans[29] +#define col_addr_glitch CUR Booleans[30] +#define cr_cancels_micro_mode CUR Booleans[31] +#define has_print_wheel CUR Booleans[32] +#define row_addr_glitch CUR Booleans[33] +#define semi_auto_right_margin CUR Booleans[34] +#define cpi_changes_res CUR Booleans[35] +#define lpi_changes_res CUR Booleans[36] +#define columns CUR Numbers[0] +#define init_tabs CUR Numbers[1] +#define lines CUR Numbers[2] +#define lines_of_memory CUR Numbers[3] +#define magic_cookie_glitch CUR Numbers[4] +#define padding_baud_rate CUR Numbers[5] +#define virtual_terminal CUR Numbers[6] +#define width_status_line CUR Numbers[7] +#define num_labels CUR Numbers[8] +#define label_height CUR Numbers[9] +#define label_width CUR Numbers[10] +#define max_attributes CUR Numbers[11] +#define maximum_windows CUR Numbers[12] +#define max_colors CUR Numbers[13] +#define max_pairs CUR Numbers[14] +#define no_color_video CUR Numbers[15] +#define buffer_capacity CUR Numbers[16] +#define dot_vert_spacing CUR Numbers[17] +#define dot_horz_spacing CUR Numbers[18] +#define max_micro_address CUR Numbers[19] +#define max_micro_jump CUR Numbers[20] +#define micro_col_size CUR Numbers[21] +#define micro_line_size CUR Numbers[22] +#define number_of_pins CUR Numbers[23] +#define output_res_char CUR Numbers[24] +#define output_res_line CUR Numbers[25] +#define output_res_horz_inch CUR Numbers[26] +#define output_res_vert_inch CUR Numbers[27] +#define print_rate CUR Numbers[28] +#define wide_char_size CUR Numbers[29] +#define buttons CUR Numbers[30] +#define bit_image_entwining CUR Numbers[31] +#define bit_image_type CUR Numbers[32] +#define back_tab CUR Strings[0] +#define bell CUR Strings[1] +#define carriage_return CUR Strings[2] +#define change_scroll_region CUR Strings[3] +#define clear_all_tabs CUR Strings[4] +#define clear_screen CUR Strings[5] +#define clr_eol CUR Strings[6] +#define clr_eos CUR Strings[7] +#define column_address CUR Strings[8] +#define command_character CUR Strings[9] +#define cursor_address CUR Strings[10] +#define cursor_down CUR Strings[11] +#define cursor_home CUR Strings[12] +#define cursor_invisible CUR Strings[13] +#define cursor_left CUR Strings[14] +#define cursor_mem_address CUR Strings[15] +#define cursor_normal CUR Strings[16] +#define cursor_right CUR Strings[17] +#define cursor_to_ll CUR Strings[18] +#define cursor_up CUR Strings[19] +#define cursor_visible CUR Strings[20] +#define delete_character CUR Strings[21] +#define delete_line CUR Strings[22] +#define dis_status_line CUR Strings[23] +#define down_half_line CUR Strings[24] +#define enter_alt_charset_mode CUR Strings[25] +#define enter_blink_mode CUR Strings[26] +#define enter_bold_mode CUR Strings[27] +#define enter_ca_mode CUR Strings[28] +#define enter_delete_mode CUR Strings[29] +#define enter_dim_mode CUR Strings[30] +#define enter_insert_mode CUR Strings[31] +#define enter_secure_mode CUR Strings[32] +#define enter_protected_mode CUR Strings[33] +#define enter_reverse_mode CUR Strings[34] +#define enter_standout_mode CUR Strings[35] +#define enter_underline_mode CUR Strings[36] +#define erase_chars CUR Strings[37] +#define exit_alt_charset_mode CUR Strings[38] +#define exit_attribute_mode CUR Strings[39] +#define exit_ca_mode CUR Strings[40] +#define exit_delete_mode CUR Strings[41] +#define exit_insert_mode CUR Strings[42] +#define exit_standout_mode CUR Strings[43] +#define exit_underline_mode CUR Strings[44] +#define flash_screen CUR Strings[45] +#define form_feed CUR Strings[46] +#define from_status_line CUR Strings[47] +#define init_1string CUR Strings[48] +#define init_2string CUR Strings[49] +#define init_3string CUR Strings[50] +#define init_file CUR Strings[51] +#define insert_character CUR Strings[52] +#define insert_line CUR Strings[53] +#define insert_padding CUR Strings[54] +#define key_backspace CUR Strings[55] +#define key_catab CUR Strings[56] +#define key_clear CUR Strings[57] +#define key_ctab CUR Strings[58] +#define key_dc CUR Strings[59] +#define key_dl CUR Strings[60] +#define key_down CUR Strings[61] +#define key_eic CUR Strings[62] +#define key_eol CUR Strings[63] +#define key_eos CUR Strings[64] +#define key_f0 CUR Strings[65] +#define key_f1 CUR Strings[66] +#define key_f10 CUR Strings[67] +#define key_f2 CUR Strings[68] +#define key_f3 CUR Strings[69] +#define key_f4 CUR Strings[70] +#define key_f5 CUR Strings[71] +#define key_f6 CUR Strings[72] +#define key_f7 CUR Strings[73] +#define key_f8 CUR Strings[74] +#define key_f9 CUR Strings[75] +#define key_home CUR Strings[76] +#define key_ic CUR Strings[77] +#define key_il CUR Strings[78] +#define key_left CUR Strings[79] +#define key_ll CUR Strings[80] +#define key_npage CUR Strings[81] +#define key_ppage CUR Strings[82] +#define key_right CUR Strings[83] +#define key_sf CUR Strings[84] +#define key_sr CUR Strings[85] +#define key_stab CUR Strings[86] +#define key_up CUR Strings[87] +#define keypad_local CUR Strings[88] +#define keypad_xmit CUR Strings[89] +#define lab_f0 CUR Strings[90] +#define lab_f1 CUR Strings[91] +#define lab_f10 CUR Strings[92] +#define lab_f2 CUR Strings[93] +#define lab_f3 CUR Strings[94] +#define lab_f4 CUR Strings[95] +#define lab_f5 CUR Strings[96] +#define lab_f6 CUR Strings[97] +#define lab_f7 CUR Strings[98] +#define lab_f8 CUR Strings[99] +#define lab_f9 CUR Strings[100] +#define meta_off CUR Strings[101] +#define meta_on CUR Strings[102] +#define newline CUR Strings[103] +#define pad_char CUR Strings[104] +#define parm_dch CUR Strings[105] +#define parm_delete_line CUR Strings[106] +#define parm_down_cursor CUR Strings[107] +#define parm_ich CUR Strings[108] +#define parm_index CUR Strings[109] +#define parm_insert_line CUR Strings[110] +#define parm_left_cursor CUR Strings[111] +#define parm_right_cursor CUR Strings[112] +#define parm_rindex CUR Strings[113] +#define parm_up_cursor CUR Strings[114] +#define pkey_key CUR Strings[115] +#define pkey_local CUR Strings[116] +#define pkey_xmit CUR Strings[117] +#define print_screen CUR Strings[118] +#define prtr_off CUR Strings[119] +#define prtr_on CUR Strings[120] +#define repeat_char CUR Strings[121] +#define reset_1string CUR Strings[122] +#define reset_2string CUR Strings[123] +#define reset_3string CUR Strings[124] +#define reset_file CUR Strings[125] +#define restore_cursor CUR Strings[126] +#define row_address CUR Strings[127] +#define save_cursor CUR Strings[128] +#define scroll_forward CUR Strings[129] +#define scroll_reverse CUR Strings[130] +#define set_attributes CUR Strings[131] +#define set_tab CUR Strings[132] +#define set_window CUR Strings[133] +#define tab CUR Strings[134] +#define to_status_line CUR Strings[135] +#define underline_char CUR Strings[136] +#define up_half_line CUR Strings[137] +#define init_prog CUR Strings[138] +#define key_a1 CUR Strings[139] +#define key_a3 CUR Strings[140] +#define key_b2 CUR Strings[141] +#define key_c1 CUR Strings[142] +#define key_c3 CUR Strings[143] +#define prtr_non CUR Strings[144] +#define char_padding CUR Strings[145] +#define acs_chars CUR Strings[146] +#define plab_norm CUR Strings[147] +#define key_btab CUR Strings[148] +#define enter_xon_mode CUR Strings[149] +#define exit_xon_mode CUR Strings[150] +#define enter_am_mode CUR Strings[151] +#define exit_am_mode CUR Strings[152] +#define xon_character CUR Strings[153] +#define xoff_character CUR Strings[154] +#define ena_acs CUR Strings[155] +#define label_on CUR Strings[156] +#define label_off CUR Strings[157] +#define key_beg CUR Strings[158] +#define key_cancel CUR Strings[159] +#define key_close CUR Strings[160] +#define key_command CUR Strings[161] +#define key_copy CUR Strings[162] +#define key_create CUR Strings[163] +#define key_end CUR Strings[164] +#define key_enter CUR Strings[165] +#define key_exit CUR Strings[166] +#define key_find CUR Strings[167] +#define key_help CUR Strings[168] +#define key_mark CUR Strings[169] +#define key_message CUR Strings[170] +#define key_move CUR Strings[171] +#define key_next CUR Strings[172] +#define key_open CUR Strings[173] +#define key_options CUR Strings[174] +#define key_previous CUR Strings[175] +#define key_print CUR Strings[176] +#define key_redo CUR Strings[177] +#define key_reference CUR Strings[178] +#define key_refresh CUR Strings[179] +#define key_replace CUR Strings[180] +#define key_restart CUR Strings[181] +#define key_resume CUR Strings[182] +#define key_save CUR Strings[183] +#define key_suspend CUR Strings[184] +#define key_undo CUR Strings[185] +#define key_sbeg CUR Strings[186] +#define key_scancel CUR Strings[187] +#define key_scommand CUR Strings[188] +#define key_scopy CUR Strings[189] +#define key_screate CUR Strings[190] +#define key_sdc CUR Strings[191] +#define key_sdl CUR Strings[192] +#define key_select CUR Strings[193] +#define key_send CUR Strings[194] +#define key_seol CUR Strings[195] +#define key_sexit CUR Strings[196] +#define key_sfind CUR Strings[197] +#define key_shelp CUR Strings[198] +#define key_shome CUR Strings[199] +#define key_sic CUR Strings[200] +#define key_sleft CUR Strings[201] +#define key_smessage CUR Strings[202] +#define key_smove CUR Strings[203] +#define key_snext CUR Strings[204] +#define key_soptions CUR Strings[205] +#define key_sprevious CUR Strings[206] +#define key_sprint CUR Strings[207] +#define key_sredo CUR Strings[208] +#define key_sreplace CUR Strings[209] +#define key_sright CUR Strings[210] +#define key_srsume CUR Strings[211] +#define key_ssave CUR Strings[212] +#define key_ssuspend CUR Strings[213] +#define key_sundo CUR Strings[214] +#define req_for_input CUR Strings[215] +#define key_f11 CUR Strings[216] +#define key_f12 CUR Strings[217] +#define key_f13 CUR Strings[218] +#define key_f14 CUR Strings[219] +#define key_f15 CUR Strings[220] +#define key_f16 CUR Strings[221] +#define key_f17 CUR Strings[222] +#define key_f18 CUR Strings[223] +#define key_f19 CUR Strings[224] +#define key_f20 CUR Strings[225] +#define key_f21 CUR Strings[226] +#define key_f22 CUR Strings[227] +#define key_f23 CUR Strings[228] +#define key_f24 CUR Strings[229] +#define key_f25 CUR Strings[230] +#define key_f26 CUR Strings[231] +#define key_f27 CUR Strings[232] +#define key_f28 CUR Strings[233] +#define key_f29 CUR Strings[234] +#define key_f30 CUR Strings[235] +#define key_f31 CUR Strings[236] +#define key_f32 CUR Strings[237] +#define key_f33 CUR Strings[238] +#define key_f34 CUR Strings[239] +#define key_f35 CUR Strings[240] +#define key_f36 CUR Strings[241] +#define key_f37 CUR Strings[242] +#define key_f38 CUR Strings[243] +#define key_f39 CUR Strings[244] +#define key_f40 CUR Strings[245] +#define key_f41 CUR Strings[246] +#define key_f42 CUR Strings[247] +#define key_f43 CUR Strings[248] +#define key_f44 CUR Strings[249] +#define key_f45 CUR Strings[250] +#define key_f46 CUR Strings[251] +#define key_f47 CUR Strings[252] +#define key_f48 CUR Strings[253] +#define key_f49 CUR Strings[254] +#define key_f50 CUR Strings[255] +#define key_f51 CUR Strings[256] +#define key_f52 CUR Strings[257] +#define key_f53 CUR Strings[258] +#define key_f54 CUR Strings[259] +#define key_f55 CUR Strings[260] +#define key_f56 CUR Strings[261] +#define key_f57 CUR Strings[262] +#define key_f58 CUR Strings[263] +#define key_f59 CUR Strings[264] +#define key_f60 CUR Strings[265] +#define key_f61 CUR Strings[266] +#define key_f62 CUR Strings[267] +#define key_f63 CUR Strings[268] +#define clr_bol CUR Strings[269] +#define clear_margins CUR Strings[270] +#define set_left_margin CUR Strings[271] +#define set_right_margin CUR Strings[272] +#define label_format CUR Strings[273] +#define set_clock CUR Strings[274] +#define display_clock CUR Strings[275] +#define remove_clock CUR Strings[276] +#define create_window CUR Strings[277] +#define goto_window CUR Strings[278] +#define hangup CUR Strings[279] +#define dial_phone CUR Strings[280] +#define quick_dial CUR Strings[281] +#define tone CUR Strings[282] +#define pulse CUR Strings[283] +#define flash_hook CUR Strings[284] +#define fixed_pause CUR Strings[285] +#define wait_tone CUR Strings[286] +#define user0 CUR Strings[287] +#define user1 CUR Strings[288] +#define user2 CUR Strings[289] +#define user3 CUR Strings[290] +#define user4 CUR Strings[291] +#define user5 CUR Strings[292] +#define user6 CUR Strings[293] +#define user7 CUR Strings[294] +#define user8 CUR Strings[295] +#define user9 CUR Strings[296] +#define orig_pair CUR Strings[297] +#define orig_colors CUR Strings[298] +#define initialize_color CUR Strings[299] +#define initialize_pair CUR Strings[300] +#define set_color_pair CUR Strings[301] +#define set_foreground CUR Strings[302] +#define set_background CUR Strings[303] +#define change_char_pitch CUR Strings[304] +#define change_line_pitch CUR Strings[305] +#define change_res_horz CUR Strings[306] +#define change_res_vert CUR Strings[307] +#define define_char CUR Strings[308] +#define enter_doublewide_mode CUR Strings[309] +#define enter_draft_quality CUR Strings[310] +#define enter_italics_mode CUR Strings[311] +#define enter_leftward_mode CUR Strings[312] +#define enter_micro_mode CUR Strings[313] +#define enter_near_letter_quality CUR Strings[314] +#define enter_normal_quality CUR Strings[315] +#define enter_shadow_mode CUR Strings[316] +#define enter_subscript_mode CUR Strings[317] +#define enter_superscript_mode CUR Strings[318] +#define enter_upward_mode CUR Strings[319] +#define exit_doublewide_mode CUR Strings[320] +#define exit_italics_mode CUR Strings[321] +#define exit_leftward_mode CUR Strings[322] +#define exit_micro_mode CUR Strings[323] +#define exit_shadow_mode CUR Strings[324] +#define exit_subscript_mode CUR Strings[325] +#define exit_superscript_mode CUR Strings[326] +#define exit_upward_mode CUR Strings[327] +#define micro_column_address CUR Strings[328] +#define micro_down CUR Strings[329] +#define micro_left CUR Strings[330] +#define micro_right CUR Strings[331] +#define micro_row_address CUR Strings[332] +#define micro_up CUR Strings[333] +#define order_of_pins CUR Strings[334] +#define parm_down_micro CUR Strings[335] +#define parm_left_micro CUR Strings[336] +#define parm_right_micro CUR Strings[337] +#define parm_up_micro CUR Strings[338] +#define select_char_set CUR Strings[339] +#define set_bottom_margin CUR Strings[340] +#define set_bottom_margin_parm CUR Strings[341] +#define set_left_margin_parm CUR Strings[342] +#define set_right_margin_parm CUR Strings[343] +#define set_top_margin CUR Strings[344] +#define set_top_margin_parm CUR Strings[345] +#define start_bit_image CUR Strings[346] +#define start_char_set_def CUR Strings[347] +#define stop_bit_image CUR Strings[348] +#define stop_char_set_def CUR Strings[349] +#define subscript_characters CUR Strings[350] +#define superscript_characters CUR Strings[351] +#define these_cause_cr CUR Strings[352] +#define zero_motion CUR Strings[353] +#define char_set_names CUR Strings[354] +#define key_mouse CUR Strings[355] +#define mouse_info CUR Strings[356] +#define req_mouse_pos CUR Strings[357] +#define get_mouse CUR Strings[358] +#define set_a_foreground CUR Strings[359] +#define set_a_background CUR Strings[360] +#define pkey_plab CUR Strings[361] +#define device_type CUR Strings[362] +#define code_set_init CUR Strings[363] +#define set0_des_seq CUR Strings[364] +#define set1_des_seq CUR Strings[365] +#define set2_des_seq CUR Strings[366] +#define set3_des_seq CUR Strings[367] +#define set_lr_margin CUR Strings[368] +#define set_tb_margin CUR Strings[369] +#define bit_image_repeat CUR Strings[370] +#define bit_image_newline CUR Strings[371] +#define bit_image_carriage_return CUR Strings[372] +#define color_names CUR Strings[373] +#define define_bit_image_region CUR Strings[374] +#define end_bit_image_region CUR Strings[375] +#define set_color_band CUR Strings[376] +#define set_page_length CUR Strings[377] +#define display_pc_char CUR Strings[378] +#define enter_pc_charset_mode CUR Strings[379] +#define exit_pc_charset_mode CUR Strings[380] +#define enter_scancode_mode CUR Strings[381] +#define exit_scancode_mode CUR Strings[382] +#define pc_term_options CUR Strings[383] +#define scancode_escape CUR Strings[384] +#define alt_scancode_esc CUR Strings[385] +#define enter_horizontal_hl_mode CUR Strings[386] +#define enter_left_hl_mode CUR Strings[387] +#define enter_low_hl_mode CUR Strings[388] +#define enter_right_hl_mode CUR Strings[389] +#define enter_top_hl_mode CUR Strings[390] +#define enter_vertical_hl_mode CUR Strings[391] +#define set_a_attributes CUR Strings[392] +#define set_pglen_inch CUR Strings[393] + +#define BOOLWRITE 37 +#define NUMWRITE 33 +#define STRWRITE 394 + +/* older synonyms for some capabilities */ +#define beehive_glitch no_esc_ctlc +#define teleray_glitch dest_tabs_magic_smso + +/* HPUX-11 uses this name rather than the standard one */ +#ifndef micro_char_size +#define micro_char_size micro_col_size +#endif + +#ifdef __INTERNAL_CAPS_VISIBLE +#define termcap_init2 CUR Strings[394] +#define termcap_reset CUR Strings[395] +#define magic_cookie_glitch_ul CUR Numbers[33] +#define backspaces_with_bs CUR Booleans[37] +#define crt_no_scrolling CUR Booleans[38] +#define no_correctly_working_cr CUR Booleans[39] +#define carriage_return_delay CUR Numbers[34] +#define new_line_delay CUR Numbers[35] +#define linefeed_if_not_lf CUR Strings[396] +#define backspace_if_not_bs CUR Strings[397] +#define gnu_has_meta_key CUR Booleans[40] +#define linefeed_is_newline CUR Booleans[41] +#define backspace_delay CUR Numbers[36] +#define horizontal_tab_delay CUR Numbers[37] +#define number_of_function_keys CUR Numbers[38] +#define other_non_function_keys CUR Strings[398] +#define arrow_key_map CUR Strings[399] +#define has_hardware_tabs CUR Booleans[42] +#define return_does_clr_eol CUR Booleans[43] +#define acs_ulcorner CUR Strings[400] +#define acs_llcorner CUR Strings[401] +#define acs_urcorner CUR Strings[402] +#define acs_lrcorner CUR Strings[403] +#define acs_ltee CUR Strings[404] +#define acs_rtee CUR Strings[405] +#define acs_btee CUR Strings[406] +#define acs_ttee CUR Strings[407] +#define acs_hline CUR Strings[408] +#define acs_vline CUR Strings[409] +#define acs_plus CUR Strings[410] +#define memory_lock CUR Strings[411] +#define memory_unlock CUR Strings[412] +#define box_chars_1 CUR Strings[413] +#endif /* __INTERNAL_CAPS_VISIBLE */ + + +/* + * Predefined terminfo array sizes + */ +#define BOOLCOUNT 44 +#define NUMCOUNT 39 +#define STRCOUNT 414 + +/* used by code for comparing entries */ +#define acs_chars_index 146 + +typedef struct termtype { /* in-core form of terminfo data */ + char *term_names; /* str_table offset of term names */ + char *str_table; /* pointer to string table */ + NCURSES_SBOOL *Booleans; /* array of boolean values */ + short *Numbers; /* array of integer values */ + char **Strings; /* array of string offsets */ + +#if NCURSES_XNAMES + char *ext_str_table; /* pointer to extended string table */ + char **ext_Names; /* corresponding names */ + + unsigned short num_Booleans;/* count total Booleans */ + unsigned short num_Numbers; /* count total Numbers */ + unsigned short num_Strings; /* count total Strings */ + + unsigned short ext_Booleans;/* count extensions to Booleans */ + unsigned short ext_Numbers; /* count extensions to Numbers */ + unsigned short ext_Strings; /* count extensions to Strings */ +#endif /* NCURSES_XNAMES */ + +} TERMTYPE; + +/* + * The only reason these structures are visible is for read-only use. + * Programs which modify the data are not, never were, portable across + * curses implementations. + * + * The first field in TERMINAL is used in macros. + * The remaining fields are private. + */ +#ifdef NCURSES_INTERNALS + +#undef TERMINAL +#define TERMINAL struct term +TERMINAL; + +typedef struct termtype2 { /* in-core form of terminfo data */ + char *term_names; /* str_table offset of term names */ + char *str_table; /* pointer to string table */ + NCURSES_SBOOL *Booleans; /* array of boolean values */ + int *Numbers; /* array of integer values */ + char **Strings; /* array of string offsets */ + +#if NCURSES_XNAMES + char *ext_str_table; /* pointer to extended string table */ + char **ext_Names; /* corresponding names */ + + unsigned short num_Booleans;/* count total Booleans */ + unsigned short num_Numbers; /* count total Numbers */ + unsigned short num_Strings; /* count total Strings */ + + unsigned short ext_Booleans;/* count extensions to Booleans */ + unsigned short ext_Numbers; /* count extensions to Numbers */ + unsigned short ext_Strings; /* count extensions to Strings */ +#endif /* NCURSES_XNAMES */ + +} TERMTYPE2; +#else + +typedef struct term { /* describe an actual terminal */ + TERMTYPE type; /* terminal type description */ +} TERMINAL; + +#endif /* NCURSES_INTERNALS */ + + +#if 0 && !0 +extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term; +#elif 0 +NCURSES_WRAPPED_VAR(TERMINAL *, cur_term); +#define cur_term NCURSES_PUBLIC_VAR(cur_term()) +#else +extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term; +#endif + +#if 0 || 0 +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames); + +#define boolnames NCURSES_PUBLIC_VAR(boolnames()) +#define boolcodes NCURSES_PUBLIC_VAR(boolcodes()) +#define boolfnames NCURSES_PUBLIC_VAR(boolfnames()) +#define numnames NCURSES_PUBLIC_VAR(numnames()) +#define numcodes NCURSES_PUBLIC_VAR(numcodes()) +#define numfnames NCURSES_PUBLIC_VAR(numfnames()) +#define strnames NCURSES_PUBLIC_VAR(strnames()) +#define strcodes NCURSES_PUBLIC_VAR(strcodes()) +#define strfnames NCURSES_PUBLIC_VAR(strfnames()) + +#else + +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[]; + +#endif + +/* + * These entrypoints are used only by the ncurses utilities such as tic. + */ +#ifdef NCURSES_INTERNALS + +extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf); +extern NCURSES_EXPORT(int) _nc_read_entry2 (const char * const, char * const, TERMTYPE2 *const); +extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE2 *); +extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE2 *, char *, int); +extern NCURSES_EXPORT(char *) _nc_first_name (const char *const); +extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const); +extern NCURSES_EXPORT(char *) _nc_tiparm(int, const char *, ...); + +#endif /* NCURSES_INTERNALS */ + + +/* + * These entrypoints are used by tack 1.07. + */ +extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *); +extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const); + +/* + * Normal entry points + */ +extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *); +extern NCURSES_EXPORT(int) del_curterm (TERMINAL *); + +/* miscellaneous entry points */ +extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *); +extern NCURSES_EXPORT(int) setupterm (const char *,int,int *); + +/* terminfo entry points, also declared in curses.h */ +#if !defined(__NCURSES_H) +extern NCURSES_EXPORT(char *) tigetstr (const char *); +extern NCURSES_EXPORT_VAR(char) ttytype[]; +extern NCURSES_EXPORT(int) putp (const char *); +extern NCURSES_EXPORT(int) tigetflag (const char *); +extern NCURSES_EXPORT(int) tigetnum (const char *); + +#if 1 /* NCURSES_TPARM_VARARGS */ +extern NCURSES_EXPORT(char *) tparm (const char *, ...); /* special */ +#else +extern NCURSES_EXPORT(char *) tparm (const char *, long,long,long,long,long,long,long,long,long); /* special */ +#endif + +extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */ + +#endif /* __NCURSES_H */ + +/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ +#if !defined(NCURSES_TERMCAP_H_incl) +extern NCURSES_EXPORT(char *) tgetstr (const char *, char **); +extern NCURSES_EXPORT(char *) tgoto (const char *, int, int); +extern NCURSES_EXPORT(int) tgetent (char *, const char *); +extern NCURSES_EXPORT(int) tgetflag (const char *); +extern NCURSES_EXPORT(int) tgetnum (const char *); +extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); +#endif /* NCURSES_TERMCAP_H_incl */ + +/* + * Include curses.h before term.h to enable these extensions. + */ +#if defined(NCURSES_SP_FUNCS) && (NCURSES_SP_FUNCS != 0) + +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tigetstr) (SCREEN*, const char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(putp) (SCREEN*, const char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetflag) (SCREEN*, const char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetnum) (SCREEN*, const char *); + +#if 1 /* NCURSES_TPARM_VARARGS */ +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, const char *, ...); /* special */ +#else +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, const char *, long,long,long,long,long,long,long,long,long); /* special */ +#endif + +/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgetstr) (SCREEN*, const char *, char **); +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgoto) (SCREEN*, const char *, int, int); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetent) (SCREEN*, char *, const char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetflag) (SCREEN*, const char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetnum) (SCREEN*, const char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tputs) (SCREEN*, const char *, int, NCURSES_SP_OUTC); + +extern NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(set_curterm) (SCREEN*, TERMINAL *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm) (SCREEN*, TERMINAL *); + +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(restartterm) (SCREEN*, NCURSES_CONST char *, int, int *); +#endif /* NCURSES_SP_FUNCS */ + +/* + * Debugging features. + */ +extern GCC_NORETURN NCURSES_EXPORT(void) exit_terminfo(int); + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_TERM_H_incl */ diff --git a/C/term_entry.h b/C/term_entry.h new file mode 100644 index 0000000..e2cf838 --- /dev/null +++ b/C/term_entry.h @@ -0,0 +1,237 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2015,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1998-on * + ****************************************************************************/ + +/* $Id: term_entry.h,v 1.61 2021/09/04 10:52:55 tom Exp $ */ + +/* + * term_entry.h -- interface to entry-manipulation code + */ + +#ifndef NCURSES_TERM_ENTRY_H_incl +#define NCURSES_TERM_ENTRY_H_incl 1 +/* *INDENT-OFF* */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* + * These macros may be used by programs that know about TERMTYPE: + */ +#if NCURSES_XNAMES +#define NUM_BOOLEANS(tp) (tp)->num_Booleans +#define NUM_NUMBERS(tp) (tp)->num_Numbers +#define NUM_STRINGS(tp) (tp)->num_Strings +#define EXT_NAMES(tp,i,limit,index,table) (i >= limit) ? tp->ext_Names[index] : table[i] +#else +#define NUM_BOOLEANS(tp) BOOLCOUNT +#define NUM_NUMBERS(tp) NUMCOUNT +#define NUM_STRINGS(tp) STRCOUNT +#define EXT_NAMES(tp,i,limit,index,table) table[i] +#endif + +#define NUM_EXT_NAMES(tp) (unsigned) ((tp)->ext_Booleans + (tp)->ext_Numbers + (tp)->ext_Strings) + +#define for_each_boolean(n,tp) for(n = 0; n < NUM_BOOLEANS(tp); n++) +#define for_each_number(n,tp) for(n = 0; n < NUM_NUMBERS(tp); n++) +#define for_each_string(n,tp) for(n = 0; n < NUM_STRINGS(tp); n++) + +#if NCURSES_XNAMES +#define for_each_ext_boolean(n,tp) for(n = BOOLCOUNT; (int) n < (int) NUM_BOOLEANS(tp); n++) +#define for_each_ext_number(n,tp) for(n = NUMCOUNT; (int) n < (int) NUM_NUMBERS(tp); n++) +#define for_each_ext_string(n,tp) for(n = STRCOUNT; (int) n < (int) NUM_STRINGS(tp); n++) +#endif + +#define ExtBoolname(tp,i,names) EXT_NAMES(tp, i, BOOLCOUNT, (i - (tp->num_Booleans - tp->ext_Booleans)), names) +#define ExtNumname(tp,i,names) EXT_NAMES(tp, i, NUMCOUNT, (i - (tp->num_Numbers - tp->ext_Numbers)) + tp->ext_Booleans, names) +#define ExtStrname(tp,i,names) EXT_NAMES(tp, i, STRCOUNT, (i - (tp->num_Strings - tp->ext_Strings)) + (tp->ext_Numbers + tp->ext_Booleans), names) + +/* + * The remaining type-definitions and macros are used only internally by the + * ncurses utilities. + */ +#ifdef NCURSES_INTERNALS + +/* + * see db_iterator.c - this enumeration lists the places searched for a + * terminal description and defines the order in which they are searched. + */ +typedef enum { + dbdTIC = 0, /* special, used by tic when writing entry */ +#if NCURSES_USE_DATABASE + dbdEnvOnce, /* the $TERMINFO environment variable */ + dbdHome, /* $HOME/.terminfo */ + dbdEnvList, /* the $TERMINFO_DIRS environment variable */ + dbdCfgList, /* the compiled-in TERMINFO_DIRS value */ + dbdCfgOnce, /* the compiled-in TERMINFO value */ +#endif +#if NCURSES_USE_TERMCAP + dbdEnvOnce2, /* the $TERMCAP environment variable */ + dbdEnvList2, /* the $TERMPATH environment variable */ + dbdCfgList2, /* the compiled-in TERMPATH */ +#endif + dbdLAST +} DBDIRS; + +#define MAX_USES 32 +#define MAX_CROSSLINKS 16 + +typedef struct entry ENTRY; + +typedef struct { + char *name; + ENTRY *link; + long line; +} ENTRY_USES; + +struct entry { + TERMTYPE2 tterm; + unsigned nuses; + ENTRY_USES uses[MAX_USES]; + int ncrosslinks; + ENTRY *crosslinks[MAX_CROSSLINKS]; + long cstart; + long cend; + long startline; + ENTRY *next; + ENTRY *last; +}; + +extern NCURSES_EXPORT_VAR(ENTRY *) _nc_head; +extern NCURSES_EXPORT_VAR(ENTRY *) _nc_tail; +#define for_entry_list(qp) for (qp = _nc_head; qp; qp = qp->next) + +#define MAX_LINE 132 + +#define NULLHOOK (bool(*)(ENTRY *))0 + +/* + * Note that WANTED and PRESENT are not simple inverses! If a capability + * has been explicitly cancelled, it is not considered WANTED. + */ +#define WANTED(s) ((s) == ABSENT_STRING) +#define PRESENT(s) (((s) != ABSENT_STRING) && ((s) != CANCELLED_STRING)) + +#define ANDMISSING(p,q) \ + { \ + if (PRESENT(p) && !PRESENT(q)) \ + _nc_warning(#p " but no " #q); \ + } + +#define PAIRED(p,q) \ + { \ + if (PRESENT(q) && !PRESENT(p)) \ + _nc_warning(#q " but no " #p); \ + if (PRESENT(p) && !PRESENT(q)) \ + _nc_warning(#p " but no " #q); \ + } + +/* + * These entrypoints are used only by the ncurses utilities such as tic. + */ + +/* alloc_entry.c: elementary allocation code */ +extern NCURSES_EXPORT(ENTRY *) _nc_copy_entry (ENTRY *oldp); +extern NCURSES_EXPORT(char *) _nc_save_str (const char *const); +extern NCURSES_EXPORT(void) _nc_init_entry (ENTRY *const); +extern NCURSES_EXPORT(void) _nc_merge_entry (ENTRY *const, ENTRY *const); +extern NCURSES_EXPORT(void) _nc_wrap_entry (ENTRY *const, bool); + +/* alloc_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_align_termtype (TERMTYPE2 *, TERMTYPE2 *); + +/* free_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_free_termtype2 (TERMTYPE2 *); + +/* lib_termcap.c: trim sgr0 string for termcap users */ +extern NCURSES_EXPORT(char *) _nc_trim_sgr0 (TERMTYPE2 *); + +/* parse_entry.c: entry-parsing code */ +#if NCURSES_XNAMES +extern NCURSES_EXPORT_VAR(bool) _nc_user_definable; +extern NCURSES_EXPORT_VAR(bool) _nc_disable_period; +#endif +extern NCURSES_EXPORT(int) _nc_parse_entry (ENTRY *, int, bool); +extern NCURSES_EXPORT(int) _nc_capcmp (const char *, const char *); + +/* write_entry.c: writing an entry to the file system */ +extern NCURSES_EXPORT(void) _nc_set_writedir (const char *); +extern NCURSES_EXPORT(void) _nc_write_entry (TERMTYPE2 *const); +extern NCURSES_EXPORT(int) _nc_write_object (TERMTYPE2 *, char *, unsigned *, unsigned); + +/* comp_parse.c: entry list handling */ +extern NCURSES_EXPORT(void) _nc_read_entry_source (FILE*, char*, int, bool, bool (*)(ENTRY*)); +extern NCURSES_EXPORT(bool) _nc_entry_match (char *, char *); +extern NCURSES_EXPORT(int) _nc_resolve_uses (bool); /* obs 20040705 */ +extern NCURSES_EXPORT(int) _nc_resolve_uses2 (bool, bool); +extern NCURSES_EXPORT(void) _nc_free_entries (ENTRY *); +extern NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype)(TERMTYPE *); /* obs 20040705 */ +extern NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype2)(TERMTYPE2 *, bool); + +/* trace_xnames.c */ +extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *); + +#endif /* NCURSES_INTERNALS */ + +/* + * These entrypoints were used by tack before 1.08. + */ + +#undef NCURSES_TACK_1_08 +#ifdef NCURSES_INTERNALS +#define NCURSES_TACK_1_08 /* nothing */ +#else +#define NCURSES_TACK_1_08 GCC_DEPRECATED("upgrade to tack 1.08") +#endif + +/* alloc_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, const TERMTYPE *) NCURSES_TACK_1_08; + +/* lib_acs.c */ +extern NCURSES_EXPORT(void) _nc_init_acs (void) NCURSES_TACK_1_08; /* corresponds to traditional 'init_acs()' */ + +/* free_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *) NCURSES_TACK_1_08; + +#ifdef __cplusplus +} +#endif + +/* *INDENT-ON* */ + +#endif /* NCURSES_TERM_ENTRY_H_incl */ diff --git a/source/deimos/ncurses/panel.d b/C/termcap.h similarity index 66% rename from source/deimos/ncurses/panel.d rename to C/termcap.h index b2b60a6..ea8e5ee 100644 --- a/source/deimos/ncurses/panel.d +++ b/C/termcap.h @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. * + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,43 +28,46 @@ ****************************************************************************/ /**************************************************************************** - * Author: Zeyd M. Ben-Halim 1995 * + * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * - * and: Juergen Pfeifer 1996-1999,2008 * ****************************************************************************/ -/* $Id: panel.h,v 1.11 2009/04/11 19:50:40 tom Exp $ */ -/* panel.h -- interface file for panels library */ -module deimos.ncurses.panel; +/* $Id: termcap.h.in,v 1.20 2021/06/17 21:26:02 tom Exp $ */ -public import deimos.ncurses.curses; +#ifndef NCURSES_TERMCAP_H_incl +#define NCURSES_TERMCAP_H_incl 1 -extern (C) @nogc -{ +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.3" + +#include -struct PANEL +#ifdef __cplusplus +extern "C" { - WINDOW* win; - PANEL* below; - PANEL* above; - const void* user; -} +#endif /* __cplusplus */ + +#include -WINDOW* panel_window(const PANEL* pan); -void update_panels(); -int hide_panel(PANEL* pan); -int show_panel(PANEL* pan); -int del_panel(PANEL* pan); -int top_panel(PANEL* pan); -int bottom_panel(PANEL* pan); -PANEL* new_panel(WINDOW* win); -PANEL* panel_above(const PANEL* pan); -PANEL* panel_below(const PANEL* pan); -int set_panel_userptr(PANEL* pan, const void* ptr); -void* panel_userptr(const PANEL* pan); -int move_panel(PANEL* pan, int starty, int startx); -int replace_panel(PANEL* pan, WINDOW* window); -int panel_hidden(const PANEL* pan); +#undef NCURSES_OSPEED +#define NCURSES_OSPEED short +extern NCURSES_EXPORT_VAR(char) PC; +extern NCURSES_EXPORT_VAR(char *) UP; +extern NCURSES_EXPORT_VAR(char *) BC; +extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed; + +#if !defined(NCURSES_TERM_H_incl) +extern NCURSES_EXPORT(char *) tgetstr (const char *, char **); +extern NCURSES_EXPORT(char *) tgoto (const char *, int, int); +extern NCURSES_EXPORT(int) tgetent (char *, const char *); +extern NCURSES_EXPORT(int) tgetflag (const char *); +extern NCURSES_EXPORT(int) tgetnum (const char *); +extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); +#endif + +#ifdef __cplusplus } -/* end of panel.h */ +#endif + +#endif /* NCURSES_TERMCAP_H_incl */ diff --git a/C/tic.h b/C/tic.h new file mode 100644 index 0000000..36169f0 --- /dev/null +++ b/C/tic.h @@ -0,0 +1,397 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2012,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996 on * + ****************************************************************************/ + +/* + * $Id: tic.h,v 1.84 2021/08/21 00:24:45 tom Exp $ + * tic.h - Global variables and structures for the terminfo compiler. + */ + +#ifndef __TIC_H +#define __TIC_H +/* *INDENT-OFF* */ +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include /* for the _tracef() prototype, ERR/OK, bool defs */ + +/* +** The format of SVr2 compiled terminfo files is as follows: +** +** Header (12 bytes), containing information given below +** Names Section, containing the names of the terminal +** Boolean Section, containing the values of all of the +** boolean capabilities +** A null byte may be inserted here to make +** sure that the Number Section begins on an +** even word boundary. +** Number Section, containing the values of all of the numeric +** capabilities, each as a short integer +** String Section, containing short integer offsets into the +** String Table, one per string capability +** String Table, containing the actual characters of the string +** capabilities. +** +** In the SVr2 format, "short" means signed 16-bit numbers, which is sometimes +** inconvenient. The numbers are signed, to provide for absent and canceled +** values. ncurses6.1 introduced an extension to this compiled format, by +** making the Number Section a list of signed 32-bit integers. +** +** NOTE that all short integers in the file are stored using VAX/PDP-style +** byte-order, i.e., least-significant byte first. +** +** There is no structure definition here because it would only confuse +** matters. Terminfo format is a raw byte layout, not a structure +** dump. If you happen to be on a little-endian machine with 16-bit +** shorts that requires no padding between short members in a struct, +** then there is a natural C structure that captures the header, but +** not very helpfully. +*/ + +#define MAGIC 0432 /* first two bytes of a compiled entry */ +#define MAGIC2 01036 /* first two bytes of a compiled 32-bit entry */ + +#undef BYTE +#define BYTE(p,n) (unsigned char)((p)[n]) + +#define IS_NEG1(p) ((BYTE(p,0) == 0377) && (BYTE(p,1) == 0377)) +#define IS_NEG2(p) ((BYTE(p,0) == 0376) && (BYTE(p,1) == 0377)) +#define LOW_MSB(p) (BYTE(p,0) + 256*BYTE(p,1)) + +#define IS_TIC_MAGIC(p) (LOW_MSB(p) == MAGIC || LOW_MSB(p) == MAGIC2) + +#define quick_prefix(s) (!strncmp((s), "b64:", (size_t)4) || !strncmp((s), "hex:", (size_t)4)) + +/* + * The "maximum" here is misleading; XSI guarantees minimum values, which a + * given implementation may exceed. + */ +#define MAX_NAME_SIZE 512 /* maximum legal name field size (XSI:127) */ +#define MAX_ENTRY_SIZE1 4096 /* maximum legal entry size (SVr2) */ +#define MAX_ENTRY_SIZE2 32768 /* maximum legal entry size (ncurses6.1) */ + +#if NCURSES_EXT_COLORS && HAVE_INIT_EXTENDED_COLOR +#define MAX_ENTRY_SIZE MAX_ENTRY_SIZE2 +#else +#define MAX_ENTRY_SIZE MAX_ENTRY_SIZE1 +#endif + +/* + * The maximum size of individual name or alias is guaranteed in XSI to be at + * least 14, since that corresponds to the older filename lengths. Newer + * systems allow longer aliases, though not many terminal descriptions are + * written to use them. The MAX_ALIAS symbol is used for warnings. + */ +#if HAVE_LONG_FILE_NAMES +#define MAX_ALIAS 32 /* smaller than POSIX minimum for PATH_MAX */ +#else +#define MAX_ALIAS 14 /* SVr3 filename length */ +#endif + +/* location of user's personal info directory */ +#define PRIVATE_INFO "%s/.terminfo" /* plug getenv("HOME") into %s */ + +/* + * Some traces are designed to be used via tic's verbose option (and similar in + * infocmp and toe) rather than the 'trace()' function. So we use the bits + * above the normal trace() parameter as a debug-level. + */ + +#define MAX_DEBUG_LEVEL 15 +#define DEBUG_LEVEL(n) ((n) << TRACE_SHIFT) + +#define set_trace_level(n) \ + _nc_tracing &= DEBUG_LEVEL(MAX_DEBUG_LEVEL) \ + + DEBUG_LEVEL(MAX_DEBUG_LEVEL) - 1, \ + _nc_tracing |= DEBUG_LEVEL(n) + +#ifdef TRACE +#define DEBUG(n, a) if (_nc_tracing >= DEBUG_LEVEL(n)) _tracef a +#else +#define DEBUG(n, a) /*nothing*/ +#endif + +/* + * These are the types of tokens returned by the scanner. The first + * three are also used in the hash table of capability names. The scanner + * returns one of these values after loading the specifics into the global + * structure curr_token. + */ + +#define BOOLEAN 0 /* Boolean capability */ +#define NUMBER 1 /* Numeric capability */ +#define STRING 2 /* String-valued capability */ +#define CANCEL 3 /* Capability to be cancelled in following tc's */ +#define NAMES 4 /* The names for a terminal type */ +#define UNDEF 5 /* Undefined */ + +#define NO_PUSHBACK -1 /* used in pushtype to indicate no pushback */ + +/* + * The global structure in which the specific parts of a + * scanned token are returned. + */ + +struct token +{ + char *tk_name; /* name of capability */ + int tk_valnumber; /* value of capability (if a number) */ + char *tk_valstring; /* value of capability (if a string) */ +}; + +/* + * Offsets to string capabilities, with the corresponding functionkey codes. + */ +struct tinfo_fkeys { + unsigned offset; + chtype code; + }; + +typedef short HashValue; + +/* + * The file comp_captab.c contains an array of these structures, one per + * possible capability. These are indexed by a hash table array of pointers to + * the same structures for use by the parser. + */ +struct name_table_entry +{ + const char *nte_name; /* name to hash on */ + int nte_type; /* BOOLEAN, NUMBER or STRING */ + HashValue nte_index; /* index of associated variable in its array */ + HashValue nte_link; /* index in table of next hash, or -1 */ +}; + +/* + * Use this structure to hide differences between terminfo and termcap tables. + */ +typedef struct { + unsigned table_size; + const HashValue *table_data; + HashValue (*hash_of)(const char *); + int (*compare_names)(const char *, const char *); +} HashData; + +struct alias +{ + const char *from; + const char *to; + const char *source; +}; + +#define NOTFOUND ((struct name_table_entry *) 0) + +/* + * The file comp_userdefs.c contains an array of these structures, one per + * possible capability. These are indexed by a hash table array of pointers to + * the same structures for use by the parser. + */ +struct user_table_entry +{ + const char *ute_name; /* name to hash on */ + int ute_type; /* mask (BOOLEAN, NUMBER, STRING) */ + unsigned ute_argc; /* number of parameters */ + unsigned ute_args; /* bit-mask for string parameters */ + HashValue ute_index; /* index of associated variable in its array */ + HashValue ute_link; /* index in table of next hash, or -1 */ +}; + +/* + * The casts are required for correct sign-propagation with systems such as + * AIX, IRIX64, Solaris which default to unsigned characters. The C standard + * leaves this detail unspecified. + */ + +/* out-of-band values for representing absent capabilities */ +#define ABSENT_BOOLEAN ((signed char)-1) /* 255 */ +#define ABSENT_NUMERIC (-1) +#define ABSENT_STRING (char *)0 + +/* out-of-band values for representing cancels */ +#define CANCELLED_BOOLEAN ((signed char)-2) /* 254 */ +#define CANCELLED_NUMERIC (-2) +#define CANCELLED_STRING (char *)(-1) + +#define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1) /* reject "-1" */ +#define VALID_NUMERIC(s) ((s) >= 0) +#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING) + +/* termcap entries longer than this may break old binaries */ +#define MAX_TERMCAP_LENGTH 1023 + +/* this is a documented limitation of terminfo */ +#define MAX_TERMINFO_LENGTH 4096 + +#ifndef TERMINFO +#define TERMINFO "/usr/share/terminfo" +#endif + +#ifdef NCURSES_TERM_ENTRY_H_incl + +/* + * These entrypoints are used only by the ncurses utilities such as tic. + */ +#ifdef NCURSES_INTERNALS +/* access.c */ +extern NCURSES_EXPORT(unsigned) _nc_pathlast (const char *); +extern NCURSES_EXPORT(bool) _nc_is_abs_path (const char *); +extern NCURSES_EXPORT(bool) _nc_is_dir_path (const char *); +extern NCURSES_EXPORT(bool) _nc_is_file_path (const char *); +extern NCURSES_EXPORT(char *) _nc_basename (char *); +extern NCURSES_EXPORT(char *) _nc_rootname (char *); + +/* comp_captab.c */ +extern NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool); +extern NCURSES_EXPORT(const HashData *) _nc_get_hash_info (bool); +extern NCURSES_EXPORT(const struct alias *) _nc_get_alias_table (bool); + +/* comp_hash.c: name lookup */ +extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_type_entry + (const char *, int, bool); +extern NCURSES_EXPORT(struct user_table_entry const *) _nc_find_user_entry + (const char *); + +/* comp_scan.c: lexical analysis */ +extern NCURSES_EXPORT(int) _nc_get_token (bool); +extern NCURSES_EXPORT(void) _nc_panic_mode (char); +extern NCURSES_EXPORT(void) _nc_push_token (int); +extern NCURSES_EXPORT_VAR(int) _nc_curr_col; +extern NCURSES_EXPORT_VAR(int) _nc_curr_line; +extern NCURSES_EXPORT_VAR(int) _nc_syntax; +extern NCURSES_EXPORT_VAR(int) _nc_strict_bsd; +extern NCURSES_EXPORT_VAR(long) _nc_comment_end; +extern NCURSES_EXPORT_VAR(long) _nc_comment_start; +extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos; +extern NCURSES_EXPORT_VAR(long) _nc_start_line; +#define SYN_TERMINFO 0 +#define SYN_TERMCAP 1 + +/* comp_error.c: warning & abort messages */ +extern NCURSES_EXPORT(const char *) _nc_get_source (void); +extern GCC_NORETURN NCURSES_EXPORT(void) _nc_err_abort (const char *const,...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(void) _nc_get_type (char *name); +extern NCURSES_EXPORT(void) _nc_set_source (const char *const); +extern NCURSES_EXPORT(void) _nc_set_type (const char *const); +extern GCC_NORETURN NCURSES_EXPORT(void) _nc_syserr_abort (const char *const,...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(void) _nc_warning (const char *const,...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings; + +/* comp_scan.c */ +extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token; + +/* comp_userdefs.c */ +NCURSES_EXPORT(const struct user_table_entry *) _nc_get_userdefs_table (void); +NCURSES_EXPORT(const HashData *) _nc_get_hash_user (void); + +/* captoinfo.c: capability conversion */ +extern NCURSES_EXPORT(char *) _nc_captoinfo (const char *, const char *, int const); +extern NCURSES_EXPORT(char *) _nc_infotocap (const char *, const char *, int const); + +/* home_terminfo.c */ +extern NCURSES_EXPORT(char *) _nc_home_terminfo (void); + +/* init_keytry.c */ +#if BROKEN_LINKER +#define _nc_tinfo_fkeys _nc_tinfo_fkeysf() +extern NCURSES_EXPORT(const struct tinfo_fkeys *) _nc_tinfo_fkeysf (void); +#else +extern NCURSES_EXPORT_VAR(const struct tinfo_fkeys) _nc_tinfo_fkeys[]; +#endif + +/* lib_tparm.c */ +#define NUM_PARM 9 + +extern NCURSES_EXPORT_VAR(int) _nc_tparm_err; + +extern NCURSES_EXPORT(int) _nc_tparm_analyze(TERMINAL *, const char *, char **, int *); +extern NCURSES_EXPORT(void) _nc_reset_tparm(TERMINAL *); + +/* lib_trace.c */ +extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing; +extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); +extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *); + +/* lib_tputs.c */ +extern NCURSES_EXPORT_VAR(int) _nc_nulls_sent; /* Add one for every null sent */ + +/* comp_main.c: compiler main */ +extern const char * _nc_progname; + +/* db_iterator.c */ +extern NCURSES_EXPORT(const char *) _nc_next_db(DBDIRS *, int *); +extern NCURSES_EXPORT(const char *) _nc_tic_dir (const char *); +extern NCURSES_EXPORT(void) _nc_first_db(DBDIRS *, int *); +extern NCURSES_EXPORT(void) _nc_last_db(void); + +/* write_entry.c */ +extern NCURSES_EXPORT(int) _nc_tic_written (void); + +#endif /* NCURSES_INTERNALS */ + +/* + * These entrypoints were used by tack before 1.08. + */ + +#undef NCURSES_TACK_1_08 +#ifdef NCURSES_INTERNALS +#define NCURSES_TACK_1_08 /* nothing */ +#else +#define NCURSES_TACK_1_08 GCC_DEPRECATED("upgrade to tack 1.08") +#endif + +/* comp_hash.c: name lookup */ +extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_entry + (const char *, const HashValue *) NCURSES_TACK_1_08; +extern NCURSES_EXPORT(const HashValue *) _nc_get_hash_table (bool) NCURSES_TACK_1_08; + +/* comp_scan.c: lexical analysis */ +extern NCURSES_EXPORT(void) _nc_reset_input (FILE *, char *) NCURSES_TACK_1_08; + +/* comp_expand.c: expand string into readable form */ +extern NCURSES_EXPORT(char *) _nc_tic_expand (const char *, bool, int) NCURSES_TACK_1_08; + +/* comp_scan.c: decode string from readable form */ +extern NCURSES_EXPORT(int) _nc_trans_string (char *, char *) NCURSES_TACK_1_08; + +#endif /* NCURSES_TERM_ENTRY_H_incl */ + +#ifdef __cplusplus +} +#endif + +/* *INDENT-ON* */ +#endif /* __TIC_H */ diff --git a/C/unctrl.h b/C/unctrl.h index 0fd68bb..0dd2308 100644 --- a/C/unctrl.h +++ b/C/unctrl.h @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2001,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -39,24 +40,24 @@ * as ^?. Printable characters are displayed as is. */ -/* $Id: unctrl.h.in,v 1.11 2009/04/18 21:00:52 tom Exp $ */ +/* $Id: unctrl.h.in,v 1.12 2020/02/02 23:34:34 tom Exp $ */ #ifndef NCURSES_UNCTRL_H_incl -#define NCURSES_UNCTRL_H_incl 1 +#define NCURSES_UNCTRL_H_incl 1 #undef NCURSES_VERSION -#define NCURSES_VERSION "5.7" +#define NCURSES_VERSION "6.3" #ifdef __cplusplus extern "C" { #endif -#include +#include #undef unctrl NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype); -#if 0 +#if 1 NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype); #endif diff --git a/ISSUES b/ISSUES deleted file mode 100644 index 7a8579c..0000000 --- a/ISSUES +++ /dev/null @@ -1,7 +0,0 @@ -Mouse Events: - This one is a little tricky since most of this is system specific... - Some of the functions haven't been implemented yet... - -Other Files: - There are several other files listed in the include/ncurses folder. things like termcap.h and a few that - look to be higher-level wrappers.. How much should be included? diff --git a/README.md b/README.md index 2854828..ca295f5 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,23 @@ Ncurses ======= -[![Build Status](https://travis-ci.org/D-Programming-Deimos/ncurses.svg?branch=master)](https://travis-ci.org/D-Programming-Deimos/ncurses) +## Description -This is currently in BETA. --------------------------- -There will be bugs. C Macros are missing, enums are slightly renamed. -If you have any trouble, or think that something should be fixed, -then please create a bug report. +This repository hosts D bindings for the C library ncurses, as well as some examples. -Variants of this package ------------------------- +The bindings are implemented as source-only (`.di` files), and do not need to be compiled into a library or object files first. -This package can be build in three variants: +## Status + +The main C header files are up to date with ncurses 6.3, as it is [configured and packaged by Arch Linux](https://github.com/archlinux/svntogit-packages/blob/packages/ncurses/trunk/PKGBUILD). + +C++ header files, and the termcap-related header files, are not currently translated. + +## Build settings + +### Dub configurations + +Three dub configurations are made available, which select which libraries are added to be linked into your application: * **minimal**: The minimal (which is the default configuration) configurations only links the ncursesw library. @@ -20,16 +25,21 @@ This package can be build in three variants: * **full**: The full configuration additionally links the formw and menuw library. -To use a specific configuration in your projects, depend on this package by adding the following config snippet to your project's dub.json: +To use a specific configuration in your projects, depend on this package by adding the following config snippet to your project's `dub.sdl`: +```sdlang +subConfiguration "ncurses" "full" ``` -"subConfigurations": { - "ncurses": "full" -} + +### Reentrant API + +ncurses provides a reentrant API. If the ncurses library you are linking against was built with the reentrant API enabled, you can enable it in the bindings by building with `-version=NCURSES_REENTRANT`. In `dub.sdl` this can be done by adding: + +```sdlang +versions "NCURSES_REENTRANT" ``` -Building on macOS ------------------ +## Building on macOS The stock ncurses libraries on macOS don't include the wide libraries. Thus the full ncurses version needs to be installed with [Homebrew](https://brew.sh/). Homebrew installs ncurses below ```/usr/local/opt/ncurses```, where the dub configuration will pick it up. @@ -38,7 +48,3 @@ First install Homebrew using the instructions on the web site, then you can add ```` brew install ncurses ```` - -WARNINGS & PRECAUTIONS ----------------------- -What files make up the 'official' ncurses package? diff --git a/dub.sdl b/dub.sdl new file mode 100644 index 0000000..7b55644 --- /dev/null +++ b/dub.sdl @@ -0,0 +1,47 @@ +name "ncurses" +description "Interface to the C ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors \ + "Jon \"ylixir\" Allen" \ + "Dejan Lekic" \ + "Jude \"1100110\" Young" \ + "Vladimir Panteleev" +license "ncurses" +targetType "sourceLibrary" # .di files only +targetName "ncurses-d" + +# Howebrew installs libncurses here: +lflags "-L/usr/local/opt/ncurses/lib" platform="osx" + +configuration "minimal" { + libs "ncursesw" +} + +configuration "panels" { + libs "ncursesw" "panelw" + +} +configuration "full" { + libs "ncursesw" "panelw" "menuw" "formw" +} + +subPackage "examples/acs_vars" +subPackage "examples/hellounicode" +subPackage "examples/hello_world" +subPackage "examples/key_code" +subPackage "examples/mouse_menu" +subPackage "examples/other_border" +subPackage "examples/printbold" +subPackage "examples/printw_example" +subPackage "examples/simple_color" +subPackage "examples/simple_key" +subPackage "examples/simplespectrum" +subPackage "examples/temp_leave" +subPackage "examples/win_border" +subPackage "examples/with_chgat" +subPackage "examples/form_attrib" +subPackage "examples/menu_attrib" +subPackage "examples/menu_scroll" +subPackage "examples/menu_simple" +subPackage "examples/panel_simple" +subPackage "examples/ptest" diff --git a/examples/acs_vars/dub.json b/examples/acs_vars/dub.json deleted file mode 100644 index 17ab116..0000000 --- a/examples/acs_vars/dub.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "acs_vars", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Pradeep Padala", - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "acs_vars" -} diff --git a/examples/acs_vars/dub.sdl b/examples/acs_vars/dub.sdl new file mode 100644 index 0000000..ce4da5b --- /dev/null +++ b/examples/acs_vars/dub.sdl @@ -0,0 +1,9 @@ +name "acs_vars" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Pradeep Padala" "Jude \"1100110\" Young" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "acs_vars" diff --git a/examples/acs_vars/source/acs_vars.d b/examples/acs_vars/source/acs_vars.d index 2660a20..9259d18 100644 --- a/examples/acs_vars/source/acs_vars.d +++ b/examples/acs_vars/source/acs_vars.d @@ -1,5 +1,5 @@ import std.string : toStringz; -import deimos.ncurses.curses; +import deimos.curses; void main() { diff --git a/examples/form_attrib/dub.json b/examples/form_attrib/dub.json deleted file mode 100644 index 047d051..0000000 --- a/examples/form_attrib/dub.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "form_attrib", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Pradeep Padala", - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "subConfigurations": { - "ncurses": "full" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "form_attrib" -} diff --git a/examples/form_attrib/dub.sdl b/examples/form_attrib/dub.sdl new file mode 100644 index 0000000..e1d4281 --- /dev/null +++ b/examples/form_attrib/dub.sdl @@ -0,0 +1,10 @@ +name "form_attrib" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Pradeep Padala" "Jude \"1100110\" Young" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "form_attrib" +subConfiguration "ncurses" "full" diff --git a/examples/form_attrib/source/form_attrib.d b/examples/form_attrib/source/form_attrib.d index 4e437c2..bd66c55 100644 --- a/examples/form_attrib/source/form_attrib.d +++ b/examples/form_attrib/source/form_attrib.d @@ -1,4 +1,4 @@ -import deimos.ncurses.form; +import deimos.form; import std.string; void main() diff --git a/examples/hello_world/dub.json b/examples/hello_world/dub.json deleted file mode 100644 index 38973e1..0000000 --- a/examples/hello_world/dub.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "hello_world", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Pradeep Padala", - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "hello_world" -} diff --git a/examples/hello_world/dub.sdl b/examples/hello_world/dub.sdl new file mode 100644 index 0000000..2095983 --- /dev/null +++ b/examples/hello_world/dub.sdl @@ -0,0 +1,9 @@ +name "hello_world" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Pradeep Padala" "Jude \"1100110\" Young" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "hello_world" diff --git a/examples/hellounicode/dub.json b/examples/hellounicode/dub.json deleted file mode 100644 index 67b73f7..0000000 --- a/examples/hellounicode/dub.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "hellounicode", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Wyatt" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "helloUnicode" -} diff --git a/examples/hellounicode/dub.sdl b/examples/hellounicode/dub.sdl new file mode 100644 index 0000000..ce18358 --- /dev/null +++ b/examples/hellounicode/dub.sdl @@ -0,0 +1,9 @@ +name "hellounicode" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Wyatt" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "helloUnicode" diff --git a/examples/key_code/dub.json b/examples/key_code/dub.json deleted file mode 100644 index 96dafd6..0000000 --- a/examples/key_code/dub.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "key_code", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Pradeep Padala", - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "key_code" -} diff --git a/examples/key_code/dub.sdl b/examples/key_code/dub.sdl new file mode 100644 index 0000000..e24e020 --- /dev/null +++ b/examples/key_code/dub.sdl @@ -0,0 +1,9 @@ +name "key_code" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Pradeep Padala" "Jude \"1100110\" Young" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "key_code" diff --git a/examples/menu_attrib/dub.json b/examples/menu_attrib/dub.json deleted file mode 100644 index 02f50d4..0000000 --- a/examples/menu_attrib/dub.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "menu_attrib", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Pradeep Padala", - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "subConfigurations": { - "ncurses": "full" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "menu_attrib" -} diff --git a/examples/menu_attrib/dub.sdl b/examples/menu_attrib/dub.sdl new file mode 100644 index 0000000..597f339 --- /dev/null +++ b/examples/menu_attrib/dub.sdl @@ -0,0 +1,10 @@ +name "menu_attrib" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Pradeep Padala" "Jude \"1100110\" Young" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "menu_attrib" +subConfiguration "ncurses" "full" diff --git a/examples/menu_attrib/source/menu_attrib.d b/examples/menu_attrib/source/menu_attrib.d index 7d5d7ed..abb36f4 100644 --- a/examples/menu_attrib/source/menu_attrib.d +++ b/examples/menu_attrib/source/menu_attrib.d @@ -1,4 +1,4 @@ -import deimos.ncurses.menu; +import deimos.menu; import std.conv : to; const int CTRLD = 4; diff --git a/examples/menu_scroll/dub.json b/examples/menu_scroll/dub.json deleted file mode 100644 index accee96..0000000 --- a/examples/menu_scroll/dub.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "menu_scroll", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Pradeep Padala", - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "subConfigurations": { - "ncurses": "full" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "menu_scroll" -} diff --git a/examples/menu_scroll/dub.sdl b/examples/menu_scroll/dub.sdl new file mode 100644 index 0000000..1a8354f --- /dev/null +++ b/examples/menu_scroll/dub.sdl @@ -0,0 +1,10 @@ +name "menu_scroll" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Pradeep Padala" "Jude \"1100110\" Young" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "menu_scroll" +subConfiguration "ncurses" "full" diff --git a/examples/menu_scroll/source/menu_scroll.d b/examples/menu_scroll/source/menu_scroll.d index 4ffe9fb..7f577ee 100644 --- a/examples/menu_scroll/source/menu_scroll.d +++ b/examples/menu_scroll/source/menu_scroll.d @@ -1,5 +1,5 @@ import std.conv : to; -import deimos.ncurses.menu; +import deimos.menu; const int CTRLD = 4; diff --git a/examples/menu_simple/dub.json b/examples/menu_simple/dub.json deleted file mode 100644 index 3c0188f..0000000 --- a/examples/menu_simple/dub.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "menu_simple", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Pradeep Padala", - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "subConfigurations": { - "ncurses": "full" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "menu_simple" -} diff --git a/examples/menu_simple/dub.sdl b/examples/menu_simple/dub.sdl new file mode 100644 index 0000000..b506487 --- /dev/null +++ b/examples/menu_simple/dub.sdl @@ -0,0 +1,10 @@ +name "menu_simple" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Pradeep Padala" "Jude \"1100110\" Young" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "menu_simple" +subConfiguration "ncurses" "full" diff --git a/examples/menu_simple/source/menu_simple.d b/examples/menu_simple/source/menu_simple.d index 5f78932..133622d 100644 --- a/examples/menu_simple/source/menu_simple.d +++ b/examples/menu_simple/source/menu_simple.d @@ -1,5 +1,5 @@ import std.conv : to; -import deimos.ncurses.menu; +import deimos.menu; enum CTRLD = 4; immutable char[][] choices = [ "Choice 1", diff --git a/examples/mouse_menu/dub.json b/examples/mouse_menu/dub.json deleted file mode 100644 index 365a853..0000000 --- a/examples/mouse_menu/dub.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "mouse_menu", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Pradeep Padala", - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "mouse_menu" -} diff --git a/examples/mouse_menu/dub.sdl b/examples/mouse_menu/dub.sdl new file mode 100644 index 0000000..7165bee --- /dev/null +++ b/examples/mouse_menu/dub.sdl @@ -0,0 +1,9 @@ +name "mouse_menu" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Pradeep Padala" "Jude \"1100110\" Young" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "mouse_menu" diff --git a/examples/mouse_menu/source/mouse_menu.d b/examples/mouse_menu/source/mouse_menu.d index 0836184..8435058 100644 --- a/examples/mouse_menu/source/mouse_menu.d +++ b/examples/mouse_menu/source/mouse_menu.d @@ -18,7 +18,7 @@ void main() initscr(); // hopefully you've seen all of this before. scope (exit) endwin(); - nclear(); + clear(); noecho(); cbreak(); keypad(stdscr, true); diff --git a/examples/other_border/dub.json b/examples/other_border/dub.json deleted file mode 100644 index aace949..0000000 --- a/examples/other_border/dub.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "other_border", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Pradeep Padala", - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "other_border" -} diff --git a/examples/other_border/dub.sdl b/examples/other_border/dub.sdl new file mode 100644 index 0000000..dfa68a9 --- /dev/null +++ b/examples/other_border/dub.sdl @@ -0,0 +1,9 @@ +name "other_border" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Pradeep Padala" "Jude \"1100110\" Young" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "other_border" diff --git a/examples/panel_simple/dub.json b/examples/panel_simple/dub.json deleted file mode 100644 index 81c53ce..0000000 --- a/examples/panel_simple/dub.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "panel_simple", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Pradeep Padala", - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "subConfigurations": { - "ncurses": "panels" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "panel_simple" -} diff --git a/examples/panel_simple/dub.sdl b/examples/panel_simple/dub.sdl new file mode 100644 index 0000000..a6147e3 --- /dev/null +++ b/examples/panel_simple/dub.sdl @@ -0,0 +1,10 @@ +name "panel_simple" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Pradeep Padala" "Jude \"1100110\" Young" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "panel_simple" +subConfiguration "ncurses" "panels" diff --git a/examples/panel_simple/source/panel_simple.d b/examples/panel_simple/source/panel_simple.d index ddaba07..e740316 100644 --- a/examples/panel_simple/source/panel_simple.d +++ b/examples/panel_simple/source/panel_simple.d @@ -1,4 +1,4 @@ -import deimos.ncurses.panel; +import deimos.panel; int main() { diff --git a/examples/printbold/dub.json b/examples/printbold/dub.json deleted file mode 100644 index 074c5de..0000000 --- a/examples/printbold/dub.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "printbold", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "printBold" -} diff --git a/examples/printbold/dub.sdl b/examples/printbold/dub.sdl new file mode 100644 index 0000000..09075e8 --- /dev/null +++ b/examples/printbold/dub.sdl @@ -0,0 +1,9 @@ +name "printbold" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Jude \"1100110\" Young" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "printBold" diff --git a/examples/printw_example/dub.json b/examples/printw_example/dub.json deleted file mode 100644 index f931f55..0000000 --- a/examples/printw_example/dub.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "printw_example", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Pradeep Padala", - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "printw_example" -} diff --git a/examples/printw_example/dub.sdl b/examples/printw_example/dub.sdl new file mode 100644 index 0000000..fa858a6 --- /dev/null +++ b/examples/printw_example/dub.sdl @@ -0,0 +1,9 @@ +name "printw_example" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Pradeep Padala" "Jude \"1100110\" Young" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "printw_example" diff --git a/examples/printw_example/source/printw_example.d b/examples/printw_example/source/printw_example.d index f1e5bb5..d7af4ca 100644 --- a/examples/printw_example/source/printw_example.d +++ b/examples/printw_example/source/printw_example.d @@ -24,7 +24,7 @@ void main() auto rowcol = "This screen has %d rows and %d columns\n".toStringz; mvprintw(row - 2, 0, rowcol, row + 1, col + 1); - deimos.ncurses.printw( + printw( toStringz("Try resizing your window(if possible) and then run this program again")); refresh(); diff --git a/examples/ptest/dub.json b/examples/ptest/dub.json deleted file mode 100644 index 272aed9..0000000 --- a/examples/ptest/dub.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "ptest", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Mark Hessling", - "William McBrine", - "Joachim de Groot" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "subConfigurations": { - "ncurses": "panels" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "ptest" -} diff --git a/examples/ptest/dub.sdl b/examples/ptest/dub.sdl new file mode 100644 index 0000000..91cadc2 --- /dev/null +++ b/examples/ptest/dub.sdl @@ -0,0 +1,10 @@ +name "ptest" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Mark Hessling" "William McBrine" "Joachim de Groot" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "ptest" +subConfiguration "ncurses" "panels" diff --git a/examples/ptest/source/ptest.d b/examples/ptest/source/ptest.d index 1a5c226..16cae55 100644 --- a/examples/ptest/source/ptest.d +++ b/examples/ptest/source/ptest.d @@ -3,7 +3,7 @@ import std.conv : to; import std.string : toStringz; import deimos.ncurses; -import deimos.ncurses.panel; +import deimos.panel; string[] mod = ["test ", "TEST ", "(**) ", "*()* ", "<--> ", "LAST "]; diff --git a/examples/simple_color/dub.json b/examples/simple_color/dub.json deleted file mode 100644 index 4f7be4e..0000000 --- a/examples/simple_color/dub.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "simple_color", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Pradeep Padala", - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "simple_color" -} diff --git a/examples/simple_color/dub.sdl b/examples/simple_color/dub.sdl new file mode 100644 index 0000000..c8a51f8 --- /dev/null +++ b/examples/simple_color/dub.sdl @@ -0,0 +1,9 @@ +name "simple_color" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Pradeep Padala" "Jude \"1100110\" Young" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "simple_color" diff --git a/examples/simple_key/dub.json b/examples/simple_key/dub.json deleted file mode 100644 index ff81a95..0000000 --- a/examples/simple_key/dub.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "simple_key", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Pradeep Padala", - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "simple_key" -} diff --git a/examples/simple_key/dub.sdl b/examples/simple_key/dub.sdl new file mode 100644 index 0000000..071ae33 --- /dev/null +++ b/examples/simple_key/dub.sdl @@ -0,0 +1,9 @@ +name "simple_key" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Pradeep Padala" "Jude \"1100110\" Young" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "simple_key" diff --git a/examples/simple_key/source/simple_key.d b/examples/simple_key/source/simple_key.d index 4d7a362..cc27003 100644 --- a/examples/simple_key/source/simple_key.d +++ b/examples/simple_key/source/simple_key.d @@ -23,7 +23,7 @@ int main() int c; initscr(); - nclear(); + clear(); noecho(); cbreak(); /* Line buffering disabled. pass on everything */ startx = (80 - WIDTH) / 2; diff --git a/examples/simplespectrum/dub.json b/examples/simplespectrum/dub.json deleted file mode 100644 index f3e9636..0000000 --- a/examples/simplespectrum/dub.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "simplespectrum", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Wyatt" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "simpleSpectrum" -} diff --git a/examples/simplespectrum/dub.sdl b/examples/simplespectrum/dub.sdl new file mode 100644 index 0000000..ffeacf3 --- /dev/null +++ b/examples/simplespectrum/dub.sdl @@ -0,0 +1,9 @@ +name "simplespectrum" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Wyatt" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "simpleSpectrum" diff --git a/examples/simplespectrum/source/simpleSpectrum.d b/examples/simplespectrum/source/simpleSpectrum.d index 0167168..122e80a 100644 --- a/examples/simplespectrum/source/simpleSpectrum.d +++ b/examples/simplespectrum/source/simpleSpectrum.d @@ -39,7 +39,7 @@ int main() foreach (ushort i; 0 .. 16) { attron(COLOR_PAIR(i)); - mvwhline(stdscr, cast(int)(i % 8), w * (i / 8), to!size_t(' '), w); // chtype is a size_t by spec. + mvwhline(stdscr, cast(int)(i % 8), w * (i / 8), to!chtype(' '), w); attroff(COLOR_PAIR(i)); } @@ -48,7 +48,7 @@ int main() { attron(COLOR_PAIR(i)); mvwhline(stdscr, cast(int)((i - 16) % 36), (2 * w + w * ((i - 16) / 36)), - to!size_t(' '), w); + to!chtype(' '), w); attroff(COLOR_PAIR(i)); } @@ -56,7 +56,7 @@ int main() foreach (ushort i; 232 .. 256) { attron(COLOR_PAIR(i)); - mvwhline(stdscr, cast(int)(i - 232), (8 * w), to!size_t(' '), w); + mvwhline(stdscr, cast(int)(i - 232), (8 * w), to!chtype(' '), w); attroff(COLOR_PAIR(i)); } diff --git a/examples/temp_leave/dub.json b/examples/temp_leave/dub.json deleted file mode 100644 index 13434fd..0000000 --- a/examples/temp_leave/dub.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "temp_leave", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Pradeep Padala", - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "temp_leave" -} diff --git a/examples/temp_leave/dub.sdl b/examples/temp_leave/dub.sdl new file mode 100644 index 0000000..0802828 --- /dev/null +++ b/examples/temp_leave/dub.sdl @@ -0,0 +1,9 @@ +name "temp_leave" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Pradeep Padala" "Jude \"1100110\" Young" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "temp_leave" diff --git a/examples/win_border/dub.json b/examples/win_border/dub.json deleted file mode 100644 index 097dbb4..0000000 --- a/examples/win_border/dub.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "win_border", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Pradeep Padala", - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "win_border" -} diff --git a/examples/win_border/dub.sdl b/examples/win_border/dub.sdl new file mode 100644 index 0000000..5fdb05c --- /dev/null +++ b/examples/win_border/dub.sdl @@ -0,0 +1,9 @@ +name "win_border" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Pradeep Padala" "Jude \"1100110\" Young" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "win_border" diff --git a/examples/with_chgat/dub.json b/examples/with_chgat/dub.json deleted file mode 100644 index e1eecb4..0000000 --- a/examples/with_chgat/dub.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "with_chgat", - "description": "Example application for the D ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Pradeep Padala", - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "dependencies": { - "ncurses": "*" - }, - "targetPath": "bin", - "targetType": "executable", - "targetName": "with_chgat" -} diff --git a/examples/with_chgat/dub.sdl b/examples/with_chgat/dub.sdl new file mode 100644 index 0000000..fe2225e --- /dev/null +++ b/examples/with_chgat/dub.sdl @@ -0,0 +1,9 @@ +name "with_chgat" +description "Example application for the D ncurses library" +homepage "https://github.com/D-Programming-Deimos/ncurses" +authors "Pradeep Padala" "Jude \"1100110\" Young" +license "ncurses" +dependency "ncurses" version="*" path="../.." +targetType "executable" +targetPath "bin" +targetName "with_chgat" diff --git a/package.json b/package.json deleted file mode 100644 index ad05c40..0000000 --- a/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "ncurses", - "description": "Interface to the C ncurses library", - "homepage": "https://github.com/D-Programming-Deimos/ncurses", - "authors": [ - "Jon \"ylixir\" Allen", - "Dejan Lekic", - "Jude \"1100110\" Young" - ], - "license": "ncurses", - "targetType": "staticLibrary", - "targetName": "ncurses-d", - "lflags-osx": ["-L/usr/local/opt/ncurses/lib"], - "configurations": [ - { - "name": "minimal", - "libs": [ - "ncursesw" - ] - }, - { - "name": "panels", - "libs": [ - "ncursesw", - "panelw" - ] - }, - { - "name": "full", - "libs": [ - "ncursesw", - "panelw", - "menuw", - "formw" - ] - } - ], - "subPackages": [ - "examples/acs_vars", - "examples/hellounicode", - "examples/hello_world", - "examples/key_code", - "examples/mouse_menu", - "examples/other_border", - "examples/printbold", - "examples/printw_example", - "examples/simple_color", - "examples/simple_key", - "examples/simplespectrum", - "examples/temp_leave", - "examples/win_border", - "examples/with_chgat", - "examples/form_attrib", - "examples/menu_attrib", - "examples/menu_scroll", - "examples/menu_simple", - "examples/panel_simple", - "examples/ptest" - ] -} diff --git a/source/deimos/curses.di b/source/deimos/curses.di new file mode 100644 index 0000000..2eb06ce --- /dev/null +++ b/source/deimos/curses.di @@ -0,0 +1,1977 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* $Id: curses.h.in,v 1.277 2021/09/24 16:07:37 tom Exp $ */ +module deimos.curses; + +extern (C): + +/* + The symbols beginning NCURSES_ or USE_ are configuration choices. + A few of the former can be overridden by applications at compile-time. + Most of the others correspond to configure-script options (or checks + by the configure-script for features of the system on which it is built). + + These symbols can be overridden by applications at compile-time: + NCURSES_NOMACROS suppresses macro definitions in favor of functions + NCURSES_WATTR_MACROS suppresses wattr_* macro definitions + NCURSES_WIDECHAR is an alternative for declaring wide-character functions. + + These symbols are used only when building ncurses: + NCURSES_ATTR_T + NCURSES_FIELD_INTERNALS + NCURSES_INTERNALS + + These symbols are set by the configure script: + NCURSES_ENABLE_STDBOOL_H + NCURSES_EXPANDED + NCURSES_EXT_COLORS + NCURSES_EXT_FUNCS + NCURSES_EXT_PUTWIN + NCURSES_NO_PADDING + NCURSES_OSPEED_COMPAT + NCURSES_PATHSEP + NCURSES_REENTRANT + */ + +enum CURSES = 1; +enum CURSES_H = 1; + +/* These are defined only in curses.h, and are used for conditional compiles */ +enum NCURSES_VERSION_MAJOR = 6; +enum NCURSES_VERSION_MINOR = 3; +enum NCURSES_VERSION_PATCH = 20211021; + +/* This is defined in more than one ncurses header, for identification */ +enum NCURSES_VERSION = "6.3"; + +/* + * Identify the mouse encoding version. + */ +enum NCURSES_MOUSE_VERSION = 2; + +/* + * Definitions to facilitate DLL's. + */ +public import deimos.ncurses_dll; + +/* + * Extra headers. + */ +static if (1) { +import core.stdc.stdint; +} + +/* + * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses + * configured using --disable-macros. + */ +alias NCURSES_ATTR_T = int; + +/* + * Expands to 'const' if ncurses is configured using --enable-const. Note that + * doing so makes it incompatible with other implementations of X/Open Curses. + */ +// #undef NCURSES_CONST +alias NCURSES_CONST(T) = const(T); + +/* + * The standard type used for color values, and for color-pairs. The latter + * allows the curses library to enumerate the combinations of foreground and + * background colors used by an application, and is normally the product of the + * total foreground and background colors. + * + * X/Open uses "short" for both of these types, ultimately because they are + * numbers from the SVr4 terminal database, which uses 16-bit signed values. + */ +alias NCURSES_COLOR_T = short; + +alias NCURSES_PAIRS_T = short; + +/* + * Definitions used to make WINDOW and similar structs opaque. + */ +version (NCURSES_INTERNALS) {} else { +enum NCURSES_OPAQUE = 0; +enum NCURSES_OPAQUE_FORM = 0; +enum NCURSES_OPAQUE_MENU = 0; +enum NCURSES_OPAQUE_PANEL = 0; +} + +/* + * Definition used to optionally suppress wattr* macros to help with the + * transition from ncurses5 to ncurses6 by allowing the header files to + * be shared across development packages for ncursesw in both ABIs. + */ +static if (!is(typeof(NCURSES_WATTR_MACROS))) { +enum NCURSES_WATTR_MACROS = 0; +} + +/* + * The reentrant code relies on the opaque setting, but adds features. + */ +// static if (!is(typeof(NCURSES_REENTRANT))) { +// enum NCURSES_REENTRANT = 0; +// } + +/* + * In certain environments, we must work around linker problems for data + */ +// #undef NCURSES_BROKEN_LINKER +version (none) { +enum NCURSES_BROKEN_LINKER = 1; +} + +/* + * Control whether bindings for interop support are added. + */ +// #undef NCURSES_INTEROP_FUNCS +enum NCURSES_INTEROP_FUNCS = 1; + +/* + * The internal type used for window dimensions. + */ +// #undef NCURSES_SIZE_T +alias NCURSES_SIZE_T = short; + +/* + * Control whether tparm() supports varargs or fixed-parameter list. + */ +// #undef NCURSES_TPARM_VARARGS +enum NCURSES_TPARM_VARARGS = 1; + +/* + * Control type used for tparm's arguments. While X/Open equates c_long and + * char* values, this is not always workable for 64-bit platforms. + */ +// #undef NCURSES_TPARM_ARG +alias NCURSES_TPARM_ARG = intptr_t; + +/* + * Control whether ncurses uses wcwidth() for checking width of line-drawing + * characters. + */ +// #undef NCURSES_WCWIDTH_GRAPHICS +enum NCURSES_WCWIDTH_GRAPHICS = 1; + +/* + * NCURSES_CH_T is used in building the library, but not used otherwise in + * this header file, since that would make the normal/wide-character versions + * of the header incompatible. + */ +private mixin template mixin_NCURSES_CH_T() { +alias NCURSES_CH_T = cchar_t; +} + +/* types */ +alias chtype = uint; +alias mmask_t = uint; + +/* + * We need FILE, etc. Include this before checking any feature symbols. + */ +import core.stdc.stdio; + +/* + * With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or + * conflicting) when _XOPEN_SOURCE is 500 or greater. If NCURSES_WIDECHAR is + * not already defined, e.g., if the platform relies upon nonstandard feature + * test macros, define it at this point if the standard feature test macros + * indicate that it should be defined. + */ +enum NCURSES_WIDECHAR = 1; // D port note: we always set this to 1 + +import core.stdc.stdarg; /* we need va_list */ +static if (NCURSES_WIDECHAR) { +import core.stdc.stddef; /* we want wchar_t */ +} + +/* X/Open and SVr4 specify that curses implements 'bool'. However, C++ may also + * implement it. If so, we must use the C++ compiler's type to avoid conflict + * with other interfaces. + * + * A further complication is that may declare 'bool' to be a + * different type, such as an enum which is not necessarily compatible with + * C++. If we have , make 'bool' a macro, so users may #undef it. + * Otherwise, let it remain a typedef to avoid conflicts with other #define's. + * In either case, make a typedef for NCURSES_BOOL which can be used if needed + * from either C or C++. + */ + +enum TRUE = 1; + +enum FALSE = 0; + +alias NCURSES_BOOL = bool; + +auto NCURSES_OK_ADDR(p)(p p) { pragma(inline, true); return (null != cast(const(void) *)((p))); } + +/* + * X/Open attributes. In the ncurses implementation, they are identical to the + * A_ attributes. + */ +enum WA_ATTRIBUTES = A_ATTRIBUTES; +enum WA_NORMAL = A_NORMAL; +enum WA_STANDOUT = A_STANDOUT; +enum WA_UNDERLINE = A_UNDERLINE; +enum WA_REVERSE = A_REVERSE; +enum WA_BLINK = A_BLINK; +enum WA_DIM = A_DIM; +enum WA_BOLD = A_BOLD; +enum WA_ALTCHARSET = A_ALTCHARSET; +enum WA_INVIS = A_INVIS; +enum WA_PROTECT = A_PROTECT; +enum WA_HORIZONTAL = A_HORIZONTAL; +enum WA_LEFT = A_LEFT; +enum WA_LOW = A_LOW; +enum WA_RIGHT = A_RIGHT; +enum WA_TOP = A_TOP; +enum WA_VERTICAL = A_VERTICAL; + +version (all) { +enum WA_ITALIC = A_ITALIC /* ncurses extension */; +} + +/* colors */ +enum COLOR_BLACK = 0; +enum COLOR_RED = 1; +enum COLOR_GREEN = 2; +enum COLOR_YELLOW = 3; +enum COLOR_BLUE = 4; +enum COLOR_MAGENTA = 5; +enum COLOR_CYAN = 6; +enum COLOR_WHITE = 7; + +/* line graphics */ + +extern nothrow @nogc __gshared chtype[256] acs_map; + +@property auto NCURSES_ACS(C)(C c) { pragma(inline, true); return acs_map[cast(ubyte)c]; } + +/* VT100 symbols begin here */ +@property auto ACS_ULCORNER ()() { pragma(inline, true); return NCURSES_ACS('l'); } /* upper left corner */ +@property auto ACS_LLCORNER ()() { pragma(inline, true); return NCURSES_ACS('m'); } /* lower left corner */ +@property auto ACS_URCORNER ()() { pragma(inline, true); return NCURSES_ACS('k'); } /* upper right corner */ +@property auto ACS_LRCORNER ()() { pragma(inline, true); return NCURSES_ACS('j'); } /* lower right corner */ +@property auto ACS_LTEE ()() { pragma(inline, true); return NCURSES_ACS('t'); } /* tee pointing right */ +@property auto ACS_RTEE ()() { pragma(inline, true); return NCURSES_ACS('u'); } /* tee pointing left */ +@property auto ACS_BTEE ()() { pragma(inline, true); return NCURSES_ACS('v'); } /* tee pointing up */ +@property auto ACS_TTEE ()() { pragma(inline, true); return NCURSES_ACS('w'); } /* tee pointing down */ +@property auto ACS_HLINE ()() { pragma(inline, true); return NCURSES_ACS('q'); } /* horizontal line */ +@property auto ACS_VLINE ()() { pragma(inline, true); return NCURSES_ACS('x'); } /* vertical line */ +@property auto ACS_PLUS ()() { pragma(inline, true); return NCURSES_ACS('n'); } /* large plus or crossover */ +@property auto ACS_S1 ()() { pragma(inline, true); return NCURSES_ACS('o'); } /* scan line 1 */ +@property auto ACS_S9 ()() { pragma(inline, true); return NCURSES_ACS('s'); } /* scan line 9 */ +@property auto ACS_DIAMOND ()() { pragma(inline, true); return NCURSES_ACS('`'); } /* diamond */ +@property auto ACS_CKBOARD ()() { pragma(inline, true); return NCURSES_ACS('a'); } /* checker board (stipple) */ +@property auto ACS_DEGREE ()() { pragma(inline, true); return NCURSES_ACS('f'); } /* degree symbol */ +@property auto ACS_PLMINUS ()() { pragma(inline, true); return NCURSES_ACS('g'); } /* plus/minus */ +@property auto ACS_BULLET ()() { pragma(inline, true); return NCURSES_ACS('~'); } /* bullet */ +/* Teletype 5410v1 symbols begin here */ +@property auto ACS_LARROW ()() { pragma(inline, true); return NCURSES_ACS(','); } /* arrow pointing left */ +@property auto ACS_RARROW ()() { pragma(inline, true); return NCURSES_ACS('+'); } /* arrow pointing right */ +@property auto ACS_DARROW ()() { pragma(inline, true); return NCURSES_ACS('.'); } /* arrow pointing down */ +@property auto ACS_UARROW ()() { pragma(inline, true); return NCURSES_ACS('-'); } /* arrow pointing up */ +@property auto ACS_BOARD ()() { pragma(inline, true); return NCURSES_ACS('h'); } /* board of squares */ +@property auto ACS_LANTERN ()() { pragma(inline, true); return NCURSES_ACS('i'); } /* lantern symbol */ +@property auto ACS_BLOCK ()() { pragma(inline, true); return NCURSES_ACS('0'); } /* solid square block */ +/* + * These aren't documented, but a lot of System Vs have them anyway + * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings). + * The ACS_names may not match AT&T's, our source didn't know them. + */ +@property auto ACS_S3 ()() { pragma(inline, true); return NCURSES_ACS('p'); } /* scan line 3 */ +@property auto ACS_S7 ()() { pragma(inline, true); return NCURSES_ACS('r'); } /* scan line 7 */ +@property auto ACS_LEQUAL ()() { pragma(inline, true); return NCURSES_ACS('y'); } /* less/equal */ +@property auto ACS_GEQUAL ()() { pragma(inline, true); return NCURSES_ACS('z'); } /* greater/equal */ +@property auto ACS_PI ()() { pragma(inline, true); return NCURSES_ACS('{'); } /* Pi */ +@property auto ACS_NEQUAL ()() { pragma(inline, true); return NCURSES_ACS('|'); } /* not equal */ +@property auto ACS_STERLING ()() { pragma(inline, true); return NCURSES_ACS('}'); } /* UK pound sign */ + +/* + * Line drawing ACS names are of the form ACS_trbl, where t is the top, r + * is the right, b is the bottom, and l is the left. t, r, b, and l might + * be B (blank), S (single), D (double), or T (thick). The subset defined + * here only uses B and S. + */ +@property auto ACS_BSSB () { pragma(inline, true); return ACS_ULCORNER; } +@property auto ACS_SSBB () { pragma(inline, true); return ACS_LLCORNER; } +@property auto ACS_BBSS () { pragma(inline, true); return ACS_URCORNER; } +@property auto ACS_SBBS () { pragma(inline, true); return ACS_LRCORNER; } +@property auto ACS_SBSS () { pragma(inline, true); return ACS_RTEE; } +@property auto ACS_SSSB () { pragma(inline, true); return ACS_LTEE; } +@property auto ACS_SSBS () { pragma(inline, true); return ACS_BTEE; } +@property auto ACS_BSSS () { pragma(inline, true); return ACS_TTEE; } +@property auto ACS_BSBS () { pragma(inline, true); return ACS_HLINE; } +@property auto ACS_SBSB () { pragma(inline, true); return ACS_VLINE; } +@property auto ACS_SSSS () { pragma(inline, true); return ACS_PLUS; } + +enum ERR = (-1); + +enum OK = (0); + +/* values for the _flags member */ +enum _SUBWIN = 0x01; /* is this a sub-window? */ +enum _ENDLINE = 0x02; /* is the window flush right? */ +enum _FULLWIN = 0x04; /* is the window full-screen? */ +enum _SCROLLWIN = 0x08; /* bottom edge is at screen bottom? */ +enum _ISPAD = 0x10; /* is this window a pad? */ +enum _HASMOVED = 0x20; /* has cursor moved since last refresh? */ +enum _WRAPPED = 0x40; /* cursor was just wrappped */ + +/* + * this value is used in the firstchar and lastchar fields to mark + * unchanged lines + */ +enum _NOCHANGE = -1; + +/* + * this value is used in the oldindex field to mark lines created by insertions + * and scrolls. + */ +enum _NEWINDEX = -1; + +struct screen; +alias SCREEN = screen; + +// D porting note: WINDOW moved to the bottom of the file + +alias attr_t = chtype; /* ...must be at least as wide as chtype */ + +static if (NCURSES_WIDECHAR) { + +version (all) { +import core.stdc.wchar_; /* ...to get mbstate_t, etc. */ +} + +version (none) { +alias wchar_t1 = ushort; +} + +version (none) { +alias wint_t1 = uint; +} + +/* + * cchar_t stores an array of CCHARW_MAX wide characters. The first is + * normally a spacing character. The others are non-spacing. If those + * (spacing and nonspacing) do not fill the array, a null L'\0' follows. + * Otherwise, a null is assumed to follow when extracting via getcchar(). + */ +enum CCHARW_MAX = 5; +struct cchar_t +{ + attr_t attr; + wchar_t[CCHARW_MAX] chars = 0; +version (all) { + int ext_color; /* color pair, must be more than 16-bits */ +} +} +enum NCURSES_EXT_COLORS = 20211021; + +} /* NCURSES_WIDECHAR */ + +static if (!NCURSES_OPAQUE) { +struct ldat; + +struct _win_st +{ + NCURSES_SIZE_T _cury, _curx; /* current cursor position */ + + /* window location and size */ + NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */ + NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */ + + short _flags; /* window state flags */ + + /* attribute tracking */ + attr_t _attrs; /* current attribute for non-space character */ + chtype _bkgd; /* current background char/attribute pair */ + + /* option values set by user */ + bool _notimeout; /* no time out on function-key entry? */ + bool _clear; /* consider all data in the window invalid? */ + bool _leaveok; /* OK to not reset cursor on exit? */ + bool _scroll; /* OK to scroll this window? */ + bool _idlok; /* OK to use insert/delete line? */ + bool _idcok; /* OK to use insert/delete char? */ + bool _immed; /* window in immed mode? (not yet used) */ + bool _sync; /* window in sync mode? */ + bool _use_keypad; /* process function keys into KEY_ symbols? */ + int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ + + ldat *_line; /* the actual line data */ + + /* global screen state */ + NCURSES_SIZE_T _regtop; /* top line of scrolling region */ + NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */ + + /* these are used only if this is a sub-window */ + int _parx; /* x coordinate of this window in parent */ + int _pary; /* y coordinate of this window in parent */ + WINDOW *_parent; /* pointer to parent if a sub-window */ + + /* these are used only if this is a pad */ + struct pdat + { + NCURSES_SIZE_T _pad_y, _pad_x; + NCURSES_SIZE_T _pad_top, _pad_left; + NCURSES_SIZE_T _pad_bottom, _pad_right; + } pdat _pad; + + NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ + +static if (NCURSES_WIDECHAR) { + cchar_t _bkgrnd; /* current background char/attribute pair */ +version (all) { + int _color; /* current color-pair for non-space character */ +} +} +} +} /* NCURSES_OPAQUE */ + +/* + * Curses uses a helper function. Define our type for this to simplify + * extending it for the sp-funcs feature. + */ +alias NCURSES_OUTC = int function(int); + +/* + * Function prototypes. This is the complete X/Open Curses list of required + * functions. Those marked `generated' will have sources generated from the + * macro definitions later in this file, in order to satisfy XPG4.2 + * requirements. + */ + +// extern nothrow @nogc int addch (const(chtype)); /* generated */ +// extern nothrow @nogc int addchnstr (const(chtype) *, int); /* generated */ +// extern nothrow @nogc int addchstr (const(chtype) *); /* generated */ +// extern nothrow @nogc int addnstr (const(char) *, int); /* generated */ +// extern nothrow @nogc int addstr (const(char) *); /* generated */ +// extern nothrow @nogc int attroff (NCURSES_ATTR_T); /* generated */ +// extern nothrow @nogc int attron (NCURSES_ATTR_T); /* generated */ +// extern nothrow @nogc int attrset (NCURSES_ATTR_T); /* generated */ +// extern nothrow @nogc int attr_get (attr_t *, NCURSES_PAIRS_T *, void *); /* generated */ +// extern nothrow @nogc int attr_off (attr_t, void *); /* generated */ +// extern nothrow @nogc int attr_on (attr_t, void *); /* generated */ +// extern nothrow @nogc int attr_set (attr_t, NCURSES_PAIRS_T, void *); /* generated */ +extern nothrow @nogc int baudrate (); /* implemented */ +extern nothrow @nogc int beep (); /* implemented */ +// extern nothrow @nogc int bkgd (chtype); /* generated */ +// extern nothrow @nogc void bkgdset (chtype); /* generated */ +// extern nothrow @nogc int border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */ +// extern nothrow @nogc int box (WINDOW *, chtype, chtype); /* generated */ +extern nothrow @nogc bool can_change_color (); /* implemented */ +extern nothrow @nogc int cbreak (); /* implemented */ +// extern nothrow @nogc int chgat (int, attr_t, NCURSES_PAIRS_T, const(void) *); /* generated */ +// extern nothrow @nogc int clear (); /* generated */ +extern nothrow @nogc int clearok (WINDOW *,bool); /* implemented */ +// extern nothrow @nogc int clrtobot (); /* generated */ +// extern nothrow @nogc int clrtoeol (); /* generated */ +extern nothrow @nogc int color_content (NCURSES_COLOR_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */ +// extern nothrow @nogc int color_set (NCURSES_PAIRS_T,void*); /* generated */ +// extern nothrow @nogc int COLOR_PAIR (int); /* generated */ +extern nothrow @nogc int copywin (const(WINDOW)*,WINDOW*,int,int,int,int,int,int,int); /* implemented */ +extern nothrow @nogc int curs_set (int); /* implemented */ +extern nothrow @nogc int def_prog_mode (); /* implemented */ +extern nothrow @nogc int def_shell_mode (); /* implemented */ +extern nothrow @nogc int delay_output (int); /* implemented */ +// extern nothrow @nogc int delch (); /* generated */ +extern nothrow @nogc void delscreen (SCREEN *); /* implemented */ +extern nothrow @nogc int delwin (WINDOW *); /* implemented */ +// extern nothrow @nogc int deleteln (); /* generated */ +extern nothrow @nogc WINDOW * derwin (WINDOW *,int,int,int,int); /* implemented */ +extern nothrow @nogc int doupdate (); /* implemented */ +extern nothrow @nogc WINDOW * dupwin (WINDOW *); /* implemented */ +extern nothrow @nogc int echo (); /* implemented */ +// extern nothrow @nogc int echochar (const(chtype)); /* generated */ +// extern nothrow @nogc int erase (); /* generated */ +extern nothrow @nogc int endwin (); /* implemented */ +extern nothrow @nogc char erasechar (); /* implemented */ +extern nothrow @nogc void filter (); /* implemented */ +extern nothrow @nogc int flash (); /* implemented */ +extern nothrow @nogc int flushinp (); /* implemented */ +// extern nothrow @nogc chtype getbkgd (WINDOW *); /* generated */ +// extern nothrow @nogc int getch (); /* generated */ +// extern nothrow @nogc int getnstr (char *, int); /* generated */ +// extern nothrow @nogc int getstr (char *); /* generated */ +extern nothrow @nogc WINDOW * getwin (FILE *); /* implemented */ +extern nothrow @nogc int halfdelay (int); /* implemented */ +extern nothrow @nogc bool has_colors (); /* implemented */ +extern nothrow @nogc bool has_ic (); /* implemented */ +extern nothrow @nogc bool has_il (); /* implemented */ +// extern nothrow @nogc int hline (chtype, int); /* generated */ +extern nothrow @nogc void idcok (WINDOW *, bool); /* implemented */ +extern nothrow @nogc int idlok (WINDOW *, bool); /* implemented */ +extern nothrow @nogc void immedok (WINDOW *, bool); /* implemented */ +// extern nothrow @nogc chtype inch (); /* generated */ +// extern nothrow @nogc int inchnstr (chtype *, int); /* generated */ +// extern nothrow @nogc int inchstr (chtype *); /* generated */ +extern nothrow @nogc WINDOW * initscr (); /* implemented */ +extern nothrow @nogc int init_color (NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */ +extern nothrow @nogc int init_pair (NCURSES_PAIRS_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */ +// extern nothrow @nogc int innstr (char *, int); /* generated */ +// extern nothrow @nogc int insch (chtype); /* generated */ +// extern nothrow @nogc int insdelln (int); /* generated */ +// extern nothrow @nogc int insertln (); /* generated */ +// extern nothrow @nogc int insnstr (const(char) *, int); /* generated */ +// extern nothrow @nogc int insstr (const(char) *); /* generated */ +// extern nothrow @nogc int instr (char *); /* generated */ +extern nothrow @nogc int intrflush (WINDOW *,bool); /* implemented */ +extern nothrow @nogc bool isendwin (); /* implemented */ +extern nothrow @nogc bool is_linetouched (WINDOW *,int); /* implemented */ +extern nothrow @nogc bool is_wintouched (WINDOW *); /* implemented */ +extern nothrow @nogc NCURSES_CONST!char * keyname (int); /* implemented */ +extern nothrow @nogc int keypad (WINDOW *,bool); /* implemented */ +extern nothrow @nogc char killchar (); /* implemented */ +extern nothrow @nogc int leaveok (WINDOW *,bool); /* implemented */ +extern nothrow @nogc char * longname (); /* implemented */ +extern nothrow @nogc int meta (WINDOW *,bool); /* implemented */ +// extern nothrow @nogc int move (int, int); /* generated */ +// extern nothrow @nogc int mvaddch (int, int, const(chtype)); /* generated */ +// extern nothrow @nogc int mvaddchnstr (int, int, const(chtype) *, int); /* generated */ +// extern nothrow @nogc int mvaddchstr (int, int, const(chtype) *); /* generated */ +// extern nothrow @nogc int mvaddnstr (int, int, const(char) *, int); /* generated */ +// extern nothrow @nogc int mvaddstr (int, int, const(char) *); /* generated */ +// extern nothrow @nogc int mvchgat (int, int, int, attr_t, NCURSES_PAIRS_T, const(void) *); /* generated */ +extern nothrow @nogc int mvcur (int,int,int,int); /* implemented */ +// extern nothrow @nogc int mvdelch (int, int); /* generated */ +extern nothrow @nogc int mvderwin (WINDOW *, int, int); /* implemented */ +// extern nothrow @nogc int mvgetch (int, int); /* generated */ +// extern nothrow @nogc int mvgetnstr (int, int, char *, int); /* generated */ +// extern nothrow @nogc int mvgetstr (int, int, char *); /* generated */ +// extern nothrow @nogc int mvhline (int, int, chtype, int); /* generated */ +// extern nothrow @nogc chtype mvinch (int, int); /* generated */ +// extern nothrow @nogc int mvinchnstr (int, int, chtype *, int); /* generated */ +// extern nothrow @nogc int mvinchstr (int, int, chtype *); /* generated */ +// extern nothrow @nogc int mvinnstr (int, int, char *, int); /* generated */ +// extern nothrow @nogc int mvinsch (int, int, chtype); /* generated */ +// extern nothrow @nogc int mvinsnstr (int, int, const(char) *, int); /* generated */ +// extern nothrow @nogc int mvinsstr (int, int, const(char) *); /* generated */ +// extern nothrow @nogc int mvinstr (int, int, char *); /* generated */ +extern nothrow @nogc int mvprintw (int,int, const(char) *,...) /* implemented */ + /*GCC_PRINTFLIKE(3,4)*/; +extern nothrow @nogc int mvscanw (int,int, const(char) *,...) /* implemented */ + /*GCC_SCANFLIKE(3,4)*/; +// extern nothrow @nogc int mvvline (int, int, chtype, int); /* generated */ +// extern nothrow @nogc int mvwaddch (WINDOW *, int, int, const(chtype)); /* generated */ +// extern nothrow @nogc int mvwaddchnstr (WINDOW *, int, int, const(chtype) *, int);/* generated */ +// extern nothrow @nogc int mvwaddchstr (WINDOW *, int, int, const(chtype) *); /* generated */ +// extern nothrow @nogc int mvwaddnstr (WINDOW *, int, int, const(char) *, int); /* generated */ +// extern nothrow @nogc int mvwaddstr (WINDOW *, int, int, const(char) *); /* generated */ +// extern nothrow @nogc int mvwchgat (WINDOW *, int, int, int, attr_t, NCURSES_PAIRS_T, const(void) *);/* generated */ +// extern nothrow @nogc int mvwdelch (WINDOW *, int, int); /* generated */ +// extern nothrow @nogc int mvwgetch (WINDOW *, int, int); /* generated */ +// extern nothrow @nogc int mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */ +// extern nothrow @nogc int mvwgetstr (WINDOW *, int, int, char *); /* generated */ +// extern nothrow @nogc int mvwhline (WINDOW *, int, int, chtype, int); /* generated */ +extern nothrow @nogc int mvwin (WINDOW *,int,int); /* implemented */ +// extern nothrow @nogc chtype mvwinch (WINDOW *, int, int); /* generated */ +// extern nothrow @nogc int mvwinchnstr (WINDOW *, int, int, chtype *, int); /* generated */ +// extern nothrow @nogc int mvwinchstr (WINDOW *, int, int, chtype *); /* generated */ +// extern nothrow @nogc int mvwinnstr (WINDOW *, int, int, char *, int); /* generated */ +// extern nothrow @nogc int mvwinsch (WINDOW *, int, int, chtype); /* generated */ +// extern nothrow @nogc int mvwinsnstr (WINDOW *, int, int, const(char) *, int); /* generated */ +// extern nothrow @nogc int mvwinsstr (WINDOW *, int, int, const(char) *); /* generated */ +// extern nothrow @nogc int mvwinstr (WINDOW *, int, int, char *); /* generated */ +extern nothrow @nogc int mvwprintw (WINDOW*,int,int, const(char) *,...) /* implemented */ + /*GCC_PRINTFLIKE(4,5)*/; +extern nothrow @nogc int mvwscanw (WINDOW *,int,int, const(char) *,...) /* implemented */ + /*GCC_SCANFLIKE(4,5)*/; +// extern nothrow @nogc int mvwvline (WINDOW *,int, int, chtype, int); /* generated */ +extern nothrow @nogc int napms (int); /* implemented */ +extern nothrow @nogc WINDOW * newpad (int,int); /* implemented */ +extern nothrow @nogc SCREEN * newterm (const(char) *,FILE *,FILE *); /* implemented */ +extern nothrow @nogc WINDOW * newwin (int,int,int,int); /* implemented */ +extern nothrow @nogc int nl (); /* implemented */ +extern nothrow @nogc int nocbreak (); /* implemented */ +extern nothrow @nogc int nodelay (WINDOW *,bool); /* implemented */ +extern nothrow @nogc int noecho (); /* implemented */ +extern nothrow @nogc int nonl (); /* implemented */ +extern nothrow @nogc void noqiflush (); /* implemented */ +extern nothrow @nogc int noraw (); /* implemented */ +extern nothrow @nogc int notimeout (WINDOW *,bool); /* implemented */ +extern nothrow @nogc int overlay (const(WINDOW)*,WINDOW *); /* implemented */ +extern nothrow @nogc int overwrite (const(WINDOW)*,WINDOW *); /* implemented */ +extern nothrow @nogc int pair_content (NCURSES_PAIRS_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */ +// extern nothrow @nogc int PAIR_NUMBER (int); /* generated */ +extern nothrow @nogc int pechochar (WINDOW *, const(chtype)); /* implemented */ +extern nothrow @nogc int pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */ +extern nothrow @nogc int prefresh (WINDOW *,int,int,int,int,int,int); /* implemented */ +extern nothrow @nogc int printw (const(char) *,...) /* implemented */ + /*GCC_PRINTFLIKE(1,2)*/; +extern nothrow @nogc int putwin (WINDOW *, FILE *); /* implemented */ +extern nothrow @nogc void qiflush (); /* implemented */ +extern nothrow @nogc int raw (); /* implemented */ +// extern nothrow @nogc int redrawwin (WINDOW *); /* generated */ +// extern nothrow @nogc int refresh (); /* generated */ +extern nothrow @nogc int resetty (); /* implemented */ +extern nothrow @nogc int reset_prog_mode (); /* implemented */ +extern nothrow @nogc int reset_shell_mode (); /* implemented */ +extern nothrow @nogc int ripoffline (int, int function(WINDOW *, int)); /* implemented */ +extern nothrow @nogc int savetty (); /* implemented */ +extern nothrow @nogc int scanw (const(char) *,...) /* implemented */ + /*GCC_SCANFLIKE(1,2)*/; +extern nothrow @nogc int scr_dump (const(char) *); /* implemented */ +extern nothrow @nogc int scr_init (const(char) *); /* implemented */ +// extern nothrow @nogc int scrl (int); /* generated */ +// extern nothrow @nogc int scroll (WINDOW *); /* generated */ +extern nothrow @nogc int scrollok (WINDOW *,bool); /* implemented */ +extern nothrow @nogc int scr_restore (const(char) *); /* implemented */ +extern nothrow @nogc int scr_set (const(char) *); /* implemented */ +// extern nothrow @nogc int setscrreg (int,int); /* generated */ +extern nothrow @nogc SCREEN * set_term (SCREEN *); /* implemented */ +extern nothrow @nogc int slk_attroff (const(chtype)); /* implemented */ +extern nothrow @nogc int slk_attr_off (const(attr_t), void *); /* generated:WIDEC */ +extern nothrow @nogc int slk_attron (const(chtype)); /* implemented */ +extern nothrow @nogc int slk_attr_on (attr_t,void*); /* generated:WIDEC */ +extern nothrow @nogc int slk_attrset (const(chtype)); /* implemented */ +extern nothrow @nogc attr_t slk_attr (); /* implemented */ +extern nothrow @nogc int slk_attr_set (const(attr_t),NCURSES_PAIRS_T,void*); /* implemented */ +extern nothrow @nogc int slk_clear (); /* implemented */ +extern nothrow @nogc int slk_color (NCURSES_PAIRS_T); /* implemented */ +extern nothrow @nogc int slk_init (int); /* implemented */ +extern nothrow @nogc char * slk_label (int); /* implemented */ +extern nothrow @nogc int slk_noutrefresh (); /* implemented */ +extern nothrow @nogc int slk_refresh (); /* implemented */ +extern nothrow @nogc int slk_restore (); /* implemented */ +extern nothrow @nogc int slk_set (int,const(char) *,int); /* implemented */ +extern nothrow @nogc int slk_touch (); /* implemented */ +// extern nothrow @nogc int standout (); /* generated */ +// extern nothrow @nogc int standend (); /* generated */ +extern nothrow @nogc int start_color (); /* implemented */ +extern nothrow @nogc WINDOW * subpad (WINDOW *, int, int, int, int); /* implemented */ +extern nothrow @nogc WINDOW * subwin (WINDOW *, int, int, int, int); /* implemented */ +extern nothrow @nogc int syncok (WINDOW *, bool); /* implemented */ +extern nothrow @nogc chtype termattrs (); /* implemented */ +extern nothrow @nogc char * termname (); /* implemented */ +// extern nothrow @nogc void timeout (int); /* generated */ +// extern nothrow @nogc int touchline (WINDOW *, int, int); /* generated */ +// extern nothrow @nogc int touchwin (WINDOW *); /* generated */ +extern nothrow @nogc int typeahead (int); /* implemented */ +extern nothrow @nogc int ungetch (int); /* implemented */ +// extern nothrow @nogc int untouchwin (WINDOW *); /* generated */ +extern nothrow @nogc void use_env (bool); /* implemented */ +extern nothrow @nogc void use_tioctl (bool); /* implemented */ +extern nothrow @nogc int vidattr (chtype); /* implemented */ +extern nothrow @nogc int vidputs (chtype, NCURSES_OUTC); /* implemented */ +// extern nothrow @nogc int vline (chtype, int); /* generated */ +deprecated("use vw_printw") extern nothrow @nogc int vwprintw (WINDOW *, const(char) *, va_list) /* implemented */ + /*GCC_PRINTFLIKE(2,0)*/; +extern nothrow @nogc int vw_printw (WINDOW *, const(char) *, va_list) /* implemented */ + /*GCC_PRINTFLIKE(2,0)*/; +deprecated("use vw_scanw") extern nothrow @nogc int vwscanw (WINDOW *, const(char) *, va_list) /* implemented */ + /*GCC_SCANFLIKE(2,0)*/; +extern nothrow @nogc int vw_scanw (WINDOW *, const(char) *, va_list) /* implemented */ + /*GCC_SCANFLIKE(2,0)*/; +extern nothrow @nogc int waddch (WINDOW *, const(chtype)); /* implemented */ +extern nothrow @nogc int waddchnstr (WINDOW *,const(chtype) *,int); /* implemented */ +// extern nothrow @nogc int waddchstr (WINDOW *,const(chtype) *); /* generated */ +extern nothrow @nogc int waddnstr (WINDOW *,const(char) *,int); /* implemented */ +// extern nothrow @nogc int waddstr (WINDOW *,const(char) *); /* generated */ +// extern nothrow @nogc int wattron (WINDOW *, int); /* generated */ +// extern nothrow @nogc int wattroff (WINDOW *, int); /* generated */ +// extern nothrow @nogc int wattrset (WINDOW *, int); /* generated */ +// extern nothrow @nogc int wattr_get (WINDOW *, attr_t *, NCURSES_PAIRS_T *, void *); /* generated */ +extern nothrow @nogc int wattr_on (WINDOW *, attr_t, void *); /* implemented */ +extern nothrow @nogc int wattr_off (WINDOW *, attr_t, void *); /* implemented */ +// extern nothrow @nogc int wattr_set (WINDOW *, attr_t, NCURSES_PAIRS_T, void *); /* generated */ +extern nothrow @nogc int wbkgd (WINDOW *, chtype); /* implemented */ +extern nothrow @nogc void wbkgdset (WINDOW *,chtype); /* implemented */ +extern nothrow @nogc int wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */ +extern nothrow @nogc int wchgat (WINDOW *, int, attr_t, NCURSES_PAIRS_T, const(void) *);/* implemented */ +extern nothrow @nogc int wclear (WINDOW *); /* implemented */ +extern nothrow @nogc int wclrtobot (WINDOW *); /* implemented */ +extern nothrow @nogc int wclrtoeol (WINDOW *); /* implemented */ +extern nothrow @nogc int wcolor_set (WINDOW*,NCURSES_PAIRS_T,void*); /* implemented */ +extern nothrow @nogc void wcursyncup (WINDOW *); /* implemented */ +extern nothrow @nogc int wdelch (WINDOW *); /* implemented */ +// extern nothrow @nogc int wdeleteln (WINDOW *); /* generated */ +extern nothrow @nogc int wechochar (WINDOW *, const(chtype)); /* implemented */ +extern nothrow @nogc int werase (WINDOW *); /* implemented */ +extern nothrow @nogc int wgetch (WINDOW *); /* implemented */ +extern nothrow @nogc int wgetnstr (WINDOW *,char *,int); /* implemented */ +// extern nothrow @nogc int wgetstr (WINDOW *, char *); /* generated */ +extern nothrow @nogc int whline (WINDOW *, chtype, int); /* implemented */ +extern nothrow @nogc chtype winch (WINDOW *); /* implemented */ +extern nothrow @nogc int winchnstr (WINDOW *, chtype *, int); /* implemented */ +// extern nothrow @nogc int winchstr (WINDOW *, chtype *); /* generated */ +extern nothrow @nogc int winnstr (WINDOW *, char *, int); /* implemented */ +extern nothrow @nogc int winsch (WINDOW *, chtype); /* implemented */ +extern nothrow @nogc int winsdelln (WINDOW *,int); /* implemented */ +// extern nothrow @nogc int winsertln (WINDOW *); /* generated */ +extern nothrow @nogc int winsnstr (WINDOW *, const(char) *,int); /* implemented */ +// extern nothrow @nogc int winsstr (WINDOW *, const(char) *); /* generated */ +// extern nothrow @nogc int winstr (WINDOW *, char *); /* generated */ +extern nothrow @nogc int wmove (WINDOW *,int,int); /* implemented */ +extern nothrow @nogc int wnoutrefresh (WINDOW *); /* implemented */ +extern nothrow @nogc int wprintw (WINDOW *, const(char) *,...) /* implemented */ + /*GCC_PRINTFLIKE(2,3)*/; +extern nothrow @nogc int wredrawln (WINDOW *,int,int); /* implemented */ +extern nothrow @nogc int wrefresh (WINDOW *); /* implemented */ +extern nothrow @nogc int wscanw (WINDOW *, const(char) *,...) /* implemented */ + /*GCC_SCANFLIKE(2,3)*/; +extern nothrow @nogc int wscrl (WINDOW *,int); /* implemented */ +extern nothrow @nogc int wsetscrreg (WINDOW *,int,int); /* implemented */ +// extern nothrow @nogc int wstandout (WINDOW *); /* generated */ +// extern nothrow @nogc int wstandend (WINDOW *); /* generated */ +extern nothrow @nogc void wsyncdown (WINDOW *); /* implemented */ +extern nothrow @nogc void wsyncup (WINDOW *); /* implemented */ +extern nothrow @nogc void wtimeout (WINDOW *,int); /* implemented */ +extern nothrow @nogc int wtouchln (WINDOW *,int,int,int); /* implemented */ +extern nothrow @nogc int wvline (WINDOW *,chtype,int); /* implemented */ + +/* + * These are also declared in : + */ +extern nothrow @nogc int tigetflag (const(char) *); /* implemented */ +extern nothrow @nogc int tigetnum (const(char) *); /* implemented */ +extern nothrow @nogc char * tigetstr (const(char) *); /* implemented */ +extern nothrow @nogc int putp (const(char) *); /* implemented */ + +static if (NCURSES_TPARM_VARARGS) { +extern nothrow @nogc char * tparm (const(char) *, ...); /* special */ +} else { +extern nothrow @nogc char * tparm (const(char) *, NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG); /* special */ +} + +extern nothrow @nogc char * tiparm (const(char) *, ...); /* special */ + +/* + * These functions are not in X/Open, but we use them in macro definitions: + */ +// extern nothrow @nogc int getattrs (const(WINDOW) *); /* generated */ +// extern nothrow @nogc int getcurx (const(WINDOW) *); /* generated */ +// extern nothrow @nogc int getcury (const(WINDOW) *); /* generated */ +// extern nothrow @nogc int getbegx (const(WINDOW) *); /* generated */ +// extern nothrow @nogc int getbegy (const(WINDOW) *); /* generated */ +// extern nothrow @nogc int getmaxx (const(WINDOW) *); /* generated */ +// extern nothrow @nogc int getmaxy (const(WINDOW) *); /* generated */ +// extern nothrow @nogc int getparx (const(WINDOW) *); /* generated */ +// extern nothrow @nogc int getpary (const(WINDOW) *); /* generated */ + +/* + * vid_attr() was implemented originally based on a draft of X/Open curses. + */ +static if (!NCURSES_WIDECHAR) { +auto vid_attr(A, PAIR, OPTS)(A a,PAIR pair,OPTS opts) { pragma(inline, true); return vidattr(a); } +} + +/* + * These functions are extensions - not in X/Open Curses. + */ +version (all) { +//#undef NCURSES_EXT_FUNCS +enum NCURSES_EXT_FUNCS = 20211021; +alias NCURSES_WINDOW_CB = int function(WINDOW *, void *); +alias NCURSES_SCREEN_CB = int function (SCREEN *, void *); +extern nothrow @nogc bool is_term_resized (int, int); +extern nothrow @nogc char * keybound (int, int); +extern nothrow @nogc const(char) * curses_version (); +extern nothrow @nogc int alloc_pair (int, int); +extern nothrow @nogc int assume_default_colors (int, int); +extern nothrow @nogc int define_key (const(char) *, int); +extern nothrow @nogc int extended_color_content(int, int *, int *, int *); +extern nothrow @nogc int extended_pair_content(int, int *, int *); +extern nothrow @nogc int extended_slk_color(int); +extern nothrow @nogc int find_pair (int, int); +extern nothrow @nogc int free_pair (int); +extern nothrow @nogc int get_escdelay (); +extern nothrow @nogc int init_extended_color(int, int, int, int); +extern nothrow @nogc int init_extended_pair(int, int, int); +extern nothrow @nogc int key_defined (const(char) *); +extern nothrow @nogc int keyok (int, bool); +extern nothrow @nogc void reset_color_pairs (); +extern nothrow @nogc int resize_term (int, int); +extern nothrow @nogc int resizeterm (int, int); +extern nothrow @nogc int set_escdelay (int); +extern nothrow @nogc int set_tabsize (int); +extern nothrow @nogc int use_default_colors (); +extern nothrow @nogc int use_extended_names (bool); +extern nothrow @nogc int use_legacy_coding (int); +extern nothrow @nogc int use_screen (SCREEN *, NCURSES_SCREEN_CB, void *); +extern nothrow @nogc int use_window (WINDOW *, NCURSES_WINDOW_CB, void *); +extern nothrow @nogc int wresize (WINDOW *, int, int); +extern nothrow @nogc void nofilter(); + +/* + * These extensions provide access to information stored in the WINDOW even + * when NCURSES_OPAQUE is set: + */ +// extern nothrow @nogc WINDOW * wgetparent (const(WINDOW) *); /* generated */ +// extern nothrow @nogc bool is_cleared (const(WINDOW) *); /* generated */ +// extern nothrow @nogc bool is_idcok (const(WINDOW) *); /* generated */ +// extern nothrow @nogc bool is_idlok (const(WINDOW) *); /* generated */ +// extern nothrow @nogc bool is_immedok (const(WINDOW) *); /* generated */ +// extern nothrow @nogc bool is_keypad (const(WINDOW) *); /* generated */ +// extern nothrow @nogc bool is_leaveok (const(WINDOW) *); /* generated */ +// extern nothrow @nogc bool is_nodelay (const(WINDOW) *); /* generated */ +// extern nothrow @nogc bool is_notimeout (const(WINDOW) *); /* generated */ +// extern nothrow @nogc bool is_pad (const(WINDOW) *); /* generated */ +// extern nothrow @nogc bool is_scrollok (const(WINDOW) *); /* generated */ +// extern nothrow @nogc bool is_subwin (const(WINDOW) *); /* generated */ +// extern nothrow @nogc bool is_syncok (const(WINDOW) *); /* generated */ +// extern nothrow @nogc int wgetdelay (const(WINDOW) *); /* generated */ +// extern nothrow @nogc int wgetscrreg (const(WINDOW) *, int *, int *); /* generated */ + +} else { +auto curses_version()() { pragma(inline, true); return NCURSES_VERSION; } +} + +/* + * Extra extension-functions, which pass a SCREEN pointer rather than using + * a global variable SP. + */ +version (all) { +//#undef NCURSES_SP_FUNCS +enum NCURSES_SP_FUNCS = 20211021; +string NCURSES_SP_NAME(string name) { pragma(inline, true); return name ~ "_sp"; } + +/* Define the sp-funcs helper function */ +mixin(q{alias } ~ NCURSES_SP_NAME(q{NCURSES_OUTC}) ~ q{ = NCURSES_SP_OUTC;}); +alias NCURSES_SP_OUTC = int function(SCREEN*, int); + +extern nothrow @nogc SCREEN * new_prescr (); /* implemented:SP_FUNC */ + +extern nothrow @nogc int baudrate_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int beep_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc bool can_change_color_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int cbreak_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int curs_set_sp (SCREEN*, int); /* implemented:SP_FUNC */ +extern nothrow @nogc int color_content_sp (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern nothrow @nogc int def_prog_mode_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int def_shell_mode_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int delay_output_sp (SCREEN*, int); /* implemented:SP_FUNC */ +extern nothrow @nogc int doupdate_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int echo_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int endwin_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc char erasechar_sp (SCREEN*);/* implemented:SP_FUNC */ +extern nothrow @nogc void filter_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int flash_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int flushinp_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc WINDOW * getwin_sp (SCREEN*, FILE *); /* implemented:SP_FUNC */ +extern nothrow @nogc int halfdelay_sp (SCREEN*, int); /* implemented:SP_FUNC */ +extern nothrow @nogc bool has_colors_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc bool has_ic_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc bool has_il_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int init_color_sp (SCREEN*, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern nothrow @nogc int init_pair_sp (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern nothrow @nogc int intrflush_sp (SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */ +extern nothrow @nogc bool isendwin_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc NCURSES_CONST!char * keyname_sp (SCREEN*, int); /* implemented:SP_FUNC */ +extern nothrow @nogc char killchar_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc char * longname_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int mvcur_sp (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern nothrow @nogc int napms_sp (SCREEN*, int); /* implemented:SP_FUNC */ +extern nothrow @nogc WINDOW * newpad_sp (SCREEN*, int, int); /* implemented:SP_FUNC */ +extern nothrow @nogc SCREEN * newterm_sp (SCREEN*, const(char) *, FILE *, FILE *); /* implemented:SP_FUNC */ +extern nothrow @nogc WINDOW * newwin_sp (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern nothrow @nogc int nl_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int nocbreak_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int noecho_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int nonl_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc void noqiflush_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int noraw_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int pair_content_sp (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern nothrow @nogc void qiflush_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int raw_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int reset_prog_mode_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int reset_shell_mode_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int resetty_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int ripoffline_sp (SCREEN*, int, int function(WINDOW *, int)); /* implemented:SP_FUNC */ +extern nothrow @nogc int savetty_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int scr_init_sp (SCREEN*, const(char) *); /* implemented:SP_FUNC */ +extern nothrow @nogc int scr_restore_sp (SCREEN*, const(char) *); /* implemented:SP_FUNC */ +extern nothrow @nogc int scr_set_sp (SCREEN*, const(char) *); /* implemented:SP_FUNC */ +extern nothrow @nogc int slk_attroff_sp (SCREEN*, const(chtype)); /* implemented:SP_FUNC */ +extern nothrow @nogc int slk_attron_sp (SCREEN*, const(chtype)); /* implemented:SP_FUNC */ +extern nothrow @nogc int slk_attrset_sp (SCREEN*, const(chtype)); /* implemented:SP_FUNC */ +extern nothrow @nogc attr_t slk_attr_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int slk_attr_set_sp (SCREEN*, const(attr_t), NCURSES_PAIRS_T, void*); /* implemented:SP_FUNC */ +extern nothrow @nogc int slk_clear_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int slk_color_sp (SCREEN*, NCURSES_PAIRS_T); /* implemented:SP_FUNC */ +extern nothrow @nogc int slk_init_sp (SCREEN*, int); /* implemented:SP_FUNC */ +extern nothrow @nogc char * slk_label_sp (SCREEN*, int); /* implemented:SP_FUNC */ +extern nothrow @nogc int slk_noutrefresh_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int slk_refresh_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int slk_restore_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int slk_set_sp (SCREEN*, int, const(char) *, int); /* implemented:SP_FUNC */ +extern nothrow @nogc int slk_touch_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int start_color_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc chtype termattrs_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc char * termname_sp (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc int typeahead_sp (SCREEN*, int); /* implemented:SP_FUNC */ +extern nothrow @nogc int ungetch_sp (SCREEN*, int); /* implemented:SP_FUNC */ +extern nothrow @nogc void use_env_sp (SCREEN*, bool); /* implemented:SP_FUNC */ +extern nothrow @nogc void use_tioctl_sp (SCREEN*, bool); /* implemented:SP_FUNC */ +extern nothrow @nogc int vidattr_sp (SCREEN*, chtype); /* implemented:SP_FUNC */ +extern nothrow @nogc int vidputs_sp (SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +version (all) { +extern nothrow @nogc char * keybound_sp (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int alloc_pair_sp (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int assume_default_colors_sp (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int define_key_sp (SCREEN*, const(char) *, int); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int extended_color_content_sp (SCREEN*, int, int *, int *, int *); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int extended_pair_content_sp (SCREEN*, int, int *, int *); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int extended_slk_color_sp (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int get_escdelay_sp (SCREEN*); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int find_pair_sp (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int free_pair_sp (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int init_extended_color_sp (SCREEN*, int, int, int, int); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int init_extended_pair_sp (SCREEN*, int, int, int); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc bool is_term_resized_sp (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int key_defined_sp (SCREEN*, const(char) *); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int keyok_sp (SCREEN*, int, bool); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc void nofilter_sp (SCREEN*); /* implemented */ /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc void reset_color_pairs_sp (SCREEN*); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int resize_term_sp (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int resizeterm_sp (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int set_escdelay_sp (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int set_tabsize_sp (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int use_default_colors_sp (SCREEN*); /* implemented:EXT_SP_FUNC */ +extern nothrow @nogc int use_legacy_coding_sp (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +} +} else { +//#undef NCURSES_SP_FUNCS +enum NCURSES_SP_FUNCS = 0; +alias NCURSES_SP_NAME(string name) = mixin(name ~ "_sp"); +alias NCURSES_SP_OUTC = NCURSES_OUTC; +} + +/* attributes */ + +enum NCURSES_ATTR_SHIFT = 8; +auto NCURSES_BITS(Mask, Shift)(Mask mask,Shift shift) { pragma(inline, true); return (cast(chtype)(mask)) << ((shift) + NCURSES_ATTR_SHIFT); } + +enum A_NORMAL = (1U - 1U); +enum A_ATTRIBUTES = NCURSES_BITS(~(1U - 1U),0); +enum A_CHARTEXT = (NCURSES_BITS(1U,0) - 1U); +enum A_COLOR = NCURSES_BITS(((1U) << 8) - 1U,0); +enum A_STANDOUT = NCURSES_BITS(1U,8); +enum A_UNDERLINE = NCURSES_BITS(1U,9); +enum A_REVERSE = NCURSES_BITS(1U,10); +enum A_BLINK = NCURSES_BITS(1U,11); +enum A_DIM = NCURSES_BITS(1U,12); +enum A_BOLD = NCURSES_BITS(1U,13); +enum A_ALTCHARSET = NCURSES_BITS(1U,14); +enum A_INVIS = NCURSES_BITS(1U,15); +enum A_PROTECT = NCURSES_BITS(1U,16); +enum A_HORIZONTAL = NCURSES_BITS(1U,17); +enum A_LEFT = NCURSES_BITS(1U,18); +enum A_LOW = NCURSES_BITS(1U,19); +enum A_RIGHT = NCURSES_BITS(1U,20); +enum A_TOP = NCURSES_BITS(1U,21); +enum A_VERTICAL = NCURSES_BITS(1U,22); + +version (all) { +enum A_ITALIC = NCURSES_BITS(1U,23); /* ncurses extension */ +} + +/* + * Most of the pseudo functions are macros that either provide compatibility + * with older versions of curses, or provide inline functionality to improve + * performance. + */ + +/* + * These pseudo functions are always implemented as macros: + */ + +void getyx (Win,Y,X)(Win win,ref Y y,ref X x) { pragma(inline, true); y = getcury(win); x = getcurx(win); } +void getbegyx(Win,Y,X)(Win win,ref Y y,ref X x) { pragma(inline, true); y = getbegy(win); x = getbegx(win); } +void getmaxyx(Win,Y,X)(Win win,ref Y y,ref X x) { pragma(inline, true); y = getmaxy(win); x = getmaxx(win); } +void getparyx(Win,Y,X)(Win win,ref Y y,ref X x) { pragma(inline, true); y = getpary(win); x = getparx(win); } + +void getsyx(Y,X)(ref Y y,ref X x) { + pragma(inline, true); + if (newscr) { + if (is_leaveok(newscr)) + (y) = (x) = -1; + else + getyx(newscr,(y), (x)); + } + } + +void getsyx(Y,X)(ref Y y,ref X x) { + pragma(inline, true); + if (newscr) { + if ((y) == -1 && (x) == -1) + leaveok(newscr, TRUE); + else { + leaveok(newscr, FALSE); + wmove(newscr, (y), (x)); + } + } + } + +static if (!is(typeof(NCURSES_NOMACROS))) { + +/* + * These miscellaneous pseudo functions are provided for compatibility: + */ + +auto wgetstr(w, s)(w w, s s) { pragma(inline, true); return wgetnstr(w, s, -1); } +auto getnstr(s, n)(s s, n n) { pragma(inline, true); return wgetnstr(stdscr, s, (n)); } + +auto setterm(term)(term term) { pragma(inline, true); return setupterm(term, 1, cast(int *)0); } + +auto fixterm()() { pragma(inline, true); return reset_prog_mode(); } +auto resetterm()() { pragma(inline, true); return reset_shell_mode(); } +auto saveterm()() { pragma(inline, true); return def_prog_mode(); } +auto crmode()() { pragma(inline, true); return cbreak(); } +auto nocrmode()() { pragma(inline, true); return nocbreak(); } +void gettmode()() { pragma(inline, true); } + +/* It seems older SYSV curses versions define these */ +static if (!NCURSES_OPAQUE) { +auto getattrs(win)(win win) { pragma(inline, true); return cast(int)(NCURSES_OK_ADDR(win) ? (win)._attrs : A_NORMAL); } +auto getcurx(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (win)._curx : ERR); } +auto getcury(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (win)._cury : ERR); } +auto getbegx(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (win)._begx : ERR); } +auto getbegy(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (win)._begy : ERR); } +auto getmaxx(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? ((win)._maxx + 1) : ERR); } +auto getmaxy(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? ((win)._maxy + 1) : ERR); } +auto getparx(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (win)._parx : ERR); } +auto getpary(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (win)._pary : ERR); } +} /* NCURSES_OPAQUE */ + +auto wstandout(win)(win win) { pragma(inline, true); return (wattrset(win,A_STANDOUT)); } +auto wstandend(win)(win win) { pragma(inline, true); return (wattrset(win,A_NORMAL)); } + +auto wattron(win,at)(win win,at at) { pragma(inline, true); return wattr_on(win, cast(attr_t)(at), null); } +auto wattroff(win,at)(win win,at at) { pragma(inline, true); return wattr_off(win, cast(attr_t)(at), null); } + +static if (!NCURSES_OPAQUE) { +static if (NCURSES_WATTR_MACROS) { +static if (NCURSES_WIDECHAR && 1) { +auto wattrset(win,at)(win win,at at) { pragma(inline, true); return + (NCURSES_OK_ADDR(win) + ? ((win)._color = cast(int)(PAIR_NUMBER(at)), + (win)._attrs = cast(attr_t)(at), + OK) + : ERR); } +} else { +auto wattrset(win,at)(win win,at at) { pragma(inline, true); return + (NCURSES_OK_ADDR(win) + ? ((win)._attrs = cast(attr_t)(at), + OK) + : ERR); } +} +} /* NCURSES_WATTR_MACROS */ +} /* NCURSES_OPAQUE */ + +auto scroll(win)(win win) { pragma(inline, true); return wscrl(win,1); } + +auto touchwin(win)(win win) { pragma(inline, true); return wtouchln((win), 0, getmaxy(win), 1); } +auto touchline(win, s, c)(win win, s s, c c) { pragma(inline, true); return wtouchln((win), s, c, 1); } +auto untouchwin(win)(win win) { pragma(inline, true); return wtouchln((win), 0, getmaxy(win), 0); } + +auto box(win, v, h)(win win, v v, h h) { pragma(inline, true); return wborder(win, v, v, h, h, 0, 0, 0, 0); } +auto border(ls, rs, ts, bs, tl, tr, bl, br)(ls ls, rs rs, ts ts, bs bs, tl tl, tr tr, bl bl, br br) { pragma(inline, true); return wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br); } +auto hline(ch, n)(ch ch, n n) { pragma(inline, true); return whline(stdscr, ch, (n)); } +auto vline(ch, n)(ch ch, n n) { pragma(inline, true); return wvline(stdscr, ch, (n)); } + +auto winstr(w, s)(w w, s s) { pragma(inline, true); return winnstr(w, s, -1); } +auto winchstr(w, s)(w w, s s) { pragma(inline, true); return winchnstr(w, s, -1); } +auto winsstr(w, s)(w w, s s) { pragma(inline, true); return winsnstr(w, s, -1); } + +static if (!NCURSES_OPAQUE) { +auto redrawwin(win)(win win) { pragma(inline, true); return wredrawln(win, 0, (NCURSES_OK_ADDR(win) ? (win)._maxy+1 : -1)); } +} /* NCURSES_OPAQUE */ + +auto waddstr(win,str)(win win,str str) { pragma(inline, true); return waddnstr(win,str,-1); } +auto waddchstr(win,str)(win win,str str) { pragma(inline, true); return waddchnstr(win,str,-1); } + +/* + * These apply to the first 256 color pairs. + */ +auto COLOR_PAIR(n)(n n) { pragma(inline, true); return (NCURSES_BITS((n), 0) & A_COLOR); } +auto PAIR_NUMBER(a)(a a) { pragma(inline, true); return (cast(int)(((cast(c_ulong)((a)) & A_COLOR) >> NCURSES_ATTR_SHIFT))); } + +/* + * pseudo functions for standard screen + */ + +auto addch(ch)(ch ch) { pragma(inline, true); return waddch(stdscr,(ch)); } +auto addchnstr(str,n)(str str,n n) { pragma(inline, true); return waddchnstr(stdscr,(str),(n)); } +auto addchstr(str)(str str) { pragma(inline, true); return waddchstr(stdscr,(str)); } +auto addnstr(str,n)(str str,n n) { pragma(inline, true); return waddnstr(stdscr,(str),(n)); } +auto addstr(str)(str str) { pragma(inline, true); return waddnstr(stdscr,(str),-1); } +auto attr_get(ap,cp,o)(ap ap,cp cp,o o) { pragma(inline, true); return wattr_get(stdscr,(ap),(cp),(o)); } +auto attr_off(a,o)(a a,o o) { pragma(inline, true); return wattr_off(stdscr,(a),(o)); } +auto attr_on(a,o)(a a,o o) { pragma(inline, true); return wattr_on(stdscr,(a),(o)); } +auto attr_set(a,c,o)(a a,c c,o o) { pragma(inline, true); return wattr_set(stdscr,(a),(c),(o)); } +auto attroff(at)(at at) { pragma(inline, true); return wattroff(stdscr,(at)); } +auto attron(at)(at at) { pragma(inline, true); return wattron(stdscr,(at)); } +auto attrset(at)(at at) { pragma(inline, true); return wattrset(stdscr,(at)); } +auto bkgd(ch)(ch ch) { pragma(inline, true); return wbkgd(stdscr,(ch)); } +auto bkgdset(ch)(ch ch) { pragma(inline, true); return wbkgdset(stdscr,(ch)); } +auto chgat(n,a,c,o)(n n,a a,c c,o o) { pragma(inline, true); return wchgat(stdscr,(n),(a),(c),(o)); } +auto clear()() { pragma(inline, true); return wclear(stdscr); } +auto clrtobot()() { pragma(inline, true); return wclrtobot(stdscr); } +auto clrtoeol()() { pragma(inline, true); return wclrtoeol(stdscr); } +auto color_set(c,o)(c c,o o) { pragma(inline, true); return wcolor_set(stdscr,(c),(o)); } +auto delch()() { pragma(inline, true); return wdelch(stdscr); } +auto deleteln()() { pragma(inline, true); return winsdelln(stdscr,-1); } +auto echochar(c)(c c) { pragma(inline, true); return wechochar(stdscr,(c)); } +auto erase()() { pragma(inline, true); return werase(stdscr); } +auto getch()() { pragma(inline, true); return wgetch(stdscr); } +auto getstr(str)(str str) { pragma(inline, true); return wgetstr(stdscr,(str)); } +auto inch()() { pragma(inline, true); return winch(stdscr); } +auto inchnstr(s,n)(s s,n n) { pragma(inline, true); return winchnstr(stdscr,(s),(n)); } +auto inchstr(s)(s s) { pragma(inline, true); return winchstr(stdscr,(s)); } +auto innstr(s,n)(s s,n n) { pragma(inline, true); return winnstr(stdscr,(s),(n)); } +auto insch(c)(c c) { pragma(inline, true); return winsch(stdscr,(c)); } +auto insdelln(n)(n n) { pragma(inline, true); return winsdelln(stdscr,(n)); } +auto insertln()() { pragma(inline, true); return winsdelln(stdscr,1); } +auto insnstr(s,n)(s s,n n) { pragma(inline, true); return winsnstr(stdscr,(s),(n)); } +auto insstr(s)(s s) { pragma(inline, true); return winsstr(stdscr,(s)); } +auto instr(s)(s s) { pragma(inline, true); return winstr(stdscr,(s)); } +auto move(y,x)(y y,x x) { pragma(inline, true); return wmove(stdscr,(y),(x)); } +auto refresh()() { pragma(inline, true); return wrefresh(stdscr); } +auto scrl(n)(n n) { pragma(inline, true); return wscrl(stdscr,(n)); } +auto setscrreg(t,b)(t t,b b) { pragma(inline, true); return wsetscrreg(stdscr,(t),(b)); } +auto standend()() { pragma(inline, true); return wstandend(stdscr); } +auto standout()() { pragma(inline, true); return wstandout(stdscr); } +auto timeout(delay)(delay delay) { pragma(inline, true); return wtimeout(stdscr,(delay)); } +auto wdeleteln(win)(win win) { pragma(inline, true); return winsdelln(win,-1); } +auto winsertln(win)(win win) { pragma(inline, true); return winsdelln(win,1); } + +/* + * mv functions + */ + +auto mvwaddch(win,y,x,ch)(win win,y y,x x,ch ch) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : waddch((win),(ch))); } +auto mvwaddchnstr(win,y,x,str,n)(win win,y y,x x,str str,n n) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),(n))); } +auto mvwaddchstr(win,y,x,str)(win win,y y,x x,str str) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),-1)); } +auto mvwaddnstr(win,y,x,str,n)(win win,y y,x x,str str,n n) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),(n))); } +auto mvwaddstr(win,y,x,str)(win win,y y,x x,str str) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),-1)); } +auto mvwchgat(win,y,x,n,a,c,o)(win win,y y,x x,n n,a a,c c,o o) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : wchgat((win),(n),(a),(c),(o))); } +auto mvwdelch(win,y,x)(win win,y y,x x) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : wdelch(win)); } +auto mvwgetch(win,y,x)(win win,y y,x x) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : wgetch(win)); } +auto mvwgetnstr(win,y,x,str,n)(win win,y y,x x,str str,n n) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : wgetnstr((win),(str),(n))); } +auto mvwgetstr(win,y,x,str)(win win,y y,x x,str str) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : wgetstr((win),(str))); } +auto mvwhline(win,y,x,c,n)(win win,y y,x x,c c,n n) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : whline((win),(c),(n))); } +auto mvwinch(win,y,x)(win win,y y,x x) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? cast(chtype)(ERR) : winch(win)); } +auto mvwinchnstr(win,y,x,s,n)(win win,y y,x x,s s,n n) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : winchnstr((win),(s),(n))); } +auto mvwinchstr(win,y,x,s)(win win,y y,x x,s s) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : winchstr((win),(s))); } +auto mvwinnstr(win,y,x,s,n)(win win,y y,x x,s s,n n) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : winnstr((win),(s),(n))); } +auto mvwinsch(win,y,x,c)(win win,y y,x x,c c) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : winsch((win),(c))); } +auto mvwinsnstr(win,y,x,s,n)(win win,y y,x x,s s,n n) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : winsnstr((win),(s),(n))); } +auto mvwinsstr(win,y,x,s)(win win,y y,x x,s s) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : winsstr((win),(s))); } +auto mvwinstr(win,y,x,s)(win win,y y,x x,s s) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : winstr((win),(s))); } +auto mvwvline(win,y,x,c,n)(win win,y y,x x,c c,n n) { pragma(inline, true); return (wmove((win),(y),(x)) == ERR ? ERR : wvline((win),(c),(n))); } + +auto mvaddch(y,x,ch)(y y,x x,ch ch) { pragma(inline, true); return mvwaddch(stdscr,(y),(x),(ch)); } +auto mvaddchnstr(y,x,str,n)(y y,x x,str str,n n) { pragma(inline, true); return mvwaddchnstr(stdscr,(y),(x),(str),(n)); } +auto mvaddchstr(y,x,str)(y y,x x,str str) { pragma(inline, true); return mvwaddchstr(stdscr,(y),(x),(str)); } +auto mvaddnstr(y,x,str,n)(y y,x x,str str,n n) { pragma(inline, true); return mvwaddnstr(stdscr,(y),(x),(str),(n)); } +auto mvaddstr(y,x,str)(y y,x x,str str) { pragma(inline, true); return mvwaddstr(stdscr,(y),(x),(str)); } +auto mvchgat(y,x,n,a,c,o)(y y,x x,n n,a a,c c,o o) { pragma(inline, true); return mvwchgat(stdscr,(y),(x),(n),(a),(c),(o)); } +auto mvdelch(y,x)(y y,x x) { pragma(inline, true); return mvwdelch(stdscr,(y),(x)); } +auto mvgetch(y,x)(y y,x x) { pragma(inline, true); return mvwgetch(stdscr,(y),(x)); } +auto mvgetnstr(y,x,str,n)(y y,x x,str str,n n) { pragma(inline, true); return mvwgetnstr(stdscr,(y),(x),(str),(n)); } +auto mvgetstr(y,x,str)(y y,x x,str str) { pragma(inline, true); return mvwgetstr(stdscr,(y),(x),(str)); } +auto mvhline(y,x,c,n)(y y,x x,c c,n n) { pragma(inline, true); return mvwhline(stdscr,(y),(x),(c),(n)); } +auto mvinch(y,x)(y y,x x) { pragma(inline, true); return mvwinch(stdscr,(y),(x)); } +auto mvinchnstr(y,x,s,n)(y y,x x,s s,n n) { pragma(inline, true); return mvwinchnstr(stdscr,(y),(x),(s),(n)); } +auto mvinchstr(y,x,s)(y y,x x,s s) { pragma(inline, true); return mvwinchstr(stdscr,(y),(x),(s)); } +auto mvinnstr(y,x,s,n)(y y,x x,s s,n n) { pragma(inline, true); return mvwinnstr(stdscr,(y),(x),(s),(n)); } +auto mvinsch(y,x,c)(y y,x x,c c) { pragma(inline, true); return mvwinsch(stdscr,(y),(x),(c)); } +auto mvinsnstr(y,x,s,n)(y y,x x,s s,n n) { pragma(inline, true); return mvwinsnstr(stdscr,(y),(x),(s),(n)); } +auto mvinsstr(y,x,s)(y y,x x,s s) { pragma(inline, true); return mvwinsstr(stdscr,(y),(x),(s)); } +auto mvinstr(y,x,s)(y y,x x,s s) { pragma(inline, true); return mvwinstr(stdscr,(y),(x),(s)); } +auto mvvline(y,x,c,n)(y y,x x,c c,n n) { pragma(inline, true); return mvwvline(stdscr,(y),(x),(c),(n)); } + +/* + * Some wide-character functions can be implemented without the extensions. + */ +static if (!NCURSES_OPAQUE) { +auto getbkgd(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? ((win)._bkgd) : 0); } +} /* NCURSES_OPAQUE */ + +auto slk_attr_off(a,v)(a a,v v) { pragma(inline, true); return ((v) ? ERR : slk_attroff(a)); } +auto slk_attr_on(a,v)(a a,v v) { pragma(inline, true); return ((v) ? ERR : slk_attron(a)); } + +static if (!NCURSES_OPAQUE) { +static if (NCURSES_WATTR_MACROS) { +static if (NCURSES_WIDECHAR && 1) { +auto wattr_set(win,a,p,opts)(win win,a a,p p,opts opts) { pragma(inline, true); return + (NCURSES_OK_ADDR(win) + ? (cast(void)((win)._attrs = ((a) & ~A_COLOR), + (win)._color = (opts) ? *cast(int *)(opts) : (p)), + OK) + : ERR); } +auto wattr_get(win,a,p,opts)(win win,a a,p p,opts opts) { pragma(inline, true); return + (NCURSES_OK_ADDR(win) + ? (cast(void)(NCURSES_OK_ADDR(a) + ? (*(a) = (win)._attrs) + : OK), + cast(void)(NCURSES_OK_ADDR(p) + ? (*(p) = cast(NCURSES_PAIRS_T) (win)._color) + : OK), + cast(void)(NCURSES_OK_ADDR(opts) + ? (*cast(int *)(opts) = (win)._color) + : OK), + OK) + : ERR); } +} else { /* !(NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +auto wattr_set(win,a,p,opts)(win win,a a,p p,opts opts) { pragma(inline, true); return + (NCURSES_OK_ADDR(win) + ? (cast(void)((win)._attrs = (((a) & ~A_COLOR) | + cast(attr_t)COLOR_PAIR(p))), + OK) + : ERR); } +auto wattr_get(win,a,p,opts)(win win,a a,p p,opts opts) { pragma(inline, true); return + (NCURSES_OK_ADDR(win) + ? (cast(void)(NCURSES_OK_ADDR(a) + ? (*(a) = (win)._attrs) + : OK), + cast(void)(NCURSES_OK_ADDR(p) + ? (*(p) = cast(NCURSES_PAIRS_T) PAIR_NUMBER((win)._attrs)) + : OK), + OK) + : ERR); } +} /* (NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +} /* NCURSES_WATTR_MACROS */ +} /* NCURSES_OPAQUE */ + +/* + * X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use + * varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to + * use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already + * use stdarg.h, so... + */ +/* define vw_printw vwprintw */ +/* define vw_scanw vwscanw */ + +/* + * Export fallback function for use in C++ binding. + */ +static if (!1) { +alias vsscanf = _nc_vsscanf; +int _nc_vsscanf(const(char) *, const(char) *, va_list); +} + +/* + * These macros are extensions - not in X/Open Curses. + */ +version (all) { +static if (!NCURSES_OPAQUE) { +auto is_cleared(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (win)._clear : FALSE); } +auto is_idcok(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (win)._idcok : FALSE); } +auto is_idlok(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (win)._idlok : FALSE); } +auto is_immedok(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (win)._immed : FALSE); } +auto is_keypad(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (win)._use_keypad : FALSE); } +auto is_leaveok(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (win)._leaveok : FALSE); } +auto is_nodelay(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? ((win)._delay == 0) : FALSE); } +auto is_notimeout(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (win)._notimeout : FALSE); } +auto is_pad(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? ((win)._flags & _ISPAD) != 0 : FALSE); } +auto is_scrollok(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (win)._scroll : FALSE); } +auto is_subwin(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? ((win)._flags & _SUBWIN) != 0 : FALSE); } +auto is_syncok(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (win)._sync : FALSE); } +auto wgetdelay(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (win)._delay : 0); } +auto wgetparent(win)(win win) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (win)._parent : 0); } +auto wgetscrreg(win,t,b)(win win,t t,b b) { pragma(inline, true); return (NCURSES_OK_ADDR(win) ? (*(t) = (win)._regtop, *(b) = (win)._regbottom, OK) : ERR); } +} +} + +/* + * X/Open says this returns a bool; SVr4 also checked for out-of-range line. + * The macro provides compatibility: + */ +// auto is_linetouched(w,l)(w w,l l) { pragma(inline, true); return ((!(w) || ((l) > getmaxy(w)) || ((l) < 0)) ? ERR : is_linetouched((w),(l))); } + +} /* NCURSES_NOMACROS */ + +/* + * Public variables. + * + * Notes: + * a. ESCDELAY was an undocumented feature under AIX curses. + * It gives the ESC expire time in milliseconds. + * b. ttytype is needed for backward compatibility + */ +version (NCURSES_REENTRANT) { + +mixin NCURSES_D_VAR!(WINDOW *, q{curscr}); +mixin NCURSES_D_VAR!(WINDOW *, q{newscr}); +mixin NCURSES_D_VAR!(WINDOW *, q{stdscr}); +mixin NCURSES_D_VAR!(char *, q{ttytype}); +mixin NCURSES_D_VAR!(int, q{COLORS}); +mixin NCURSES_D_VAR!(int, q{COLOR_PAIRS}); +mixin NCURSES_D_VAR!(int, q{COLS}); +mixin NCURSES_D_VAR!(int, q{ESCDELAY}); +mixin NCURSES_D_VAR!(int, q{LINES}); +mixin NCURSES_D_VAR!(int, q{TABSIZE}); + +} else { + +extern __gshared NCURSES_EXPORT_VAR!(WINDOW *) curscr; +extern __gshared NCURSES_EXPORT_VAR!(WINDOW *) newscr; +extern __gshared NCURSES_EXPORT_VAR!(WINDOW *) stdscr; +extern __gshared NCURSES_EXPORT_VAR!(char*/*[]*/) ttytype; +extern __gshared NCURSES_EXPORT_VAR!(int) COLORS; +extern __gshared NCURSES_EXPORT_VAR!(int) COLOR_PAIRS; +extern __gshared NCURSES_EXPORT_VAR!(int) COLS; +extern __gshared NCURSES_EXPORT_VAR!(int) ESCDELAY; +extern __gshared NCURSES_EXPORT_VAR!(int) LINES; +extern __gshared NCURSES_EXPORT_VAR!(int) TABSIZE; + +} +/* + * Pseudo-character tokens outside ASCII range. The curses wgetch() function + * will return any given one of these only if the corresponding k- capability + * is defined in your terminal's terminfo entry. + * + * Some keys (KEY_A1, etc) are arranged like this: + * a1 up a3 + * left b2 right + * c1 down c3 + * + * A few key codes do not depend upon the terminfo entry. + */ +enum KEY_CODE_YES = /*0400*/ 0x100; /* A wchar_t contains a key code */ +enum KEY_MIN = /*0401*/ 0x101; /* Minimum curses key */ +enum KEY_BREAK = /*0401*/ 0x101; /* Break key (unreliable) */ +enum KEY_SRESET = /*0530*/ 0x158; /* Soft (partial) reset (unreliable) */ +enum KEY_RESET = /*0531*/ 0x159; /* Reset or hard reset (unreliable) */ +/* + * These definitions were generated by ./MKkey_defs.sh ./Caps ./Caps-ncurses + */ +enum KEY_DOWN = /*0402*/ 0x102; /* down-arrow key */ +enum KEY_UP = /*0403*/ 0x103; /* up-arrow key */ +enum KEY_LEFT = /*0404*/ 0x104; /* left-arrow key */ +enum KEY_RIGHT = /*0405*/ 0x105; /* right-arrow key */ +enum KEY_HOME = /*0406*/ 0x106; /* home key */ +enum KEY_BACKSPACE = /*0407*/ 0x107; /* backspace key */ +enum KEY_F0 = /*0410*/ 0x108; /* Function keys. Space for 64 */ +auto KEY_F(n)(n n) { pragma(inline, true); return (KEY_F0+(n)); } /* Value of function key n */ +enum KEY_DL = /*0510*/ 0x148; /* delete-line key */ +enum KEY_IL = /*0511*/ 0x149; /* insert-line key */ +enum KEY_DC = /*0512*/ 0x14a; /* delete-character key */ +enum KEY_IC = /*0513*/ 0x14b; /* insert-character key */ +enum KEY_EIC = /*0514*/ 0x14c; /* sent by rmir or smir in insert mode */ +enum KEY_CLEAR = /*0515*/ 0x14d; /* clear-screen or erase key */ +enum KEY_EOS = /*0516*/ 0x14e; /* clear-to-end-of-screen key */ +enum KEY_EOL = /*0517*/ 0x14f; /* clear-to-end-of-line key */ +enum KEY_SF = /*0520*/ 0x150; /* scroll-forward key */ +enum KEY_SR = /*0521*/ 0x151; /* scroll-backward key */ +enum KEY_NPAGE = /*0522*/ 0x152; /* next-page key */ +enum KEY_PPAGE = /*0523*/ 0x153; /* previous-page key */ +enum KEY_STAB = /*0524*/ 0x154; /* set-tab key */ +enum KEY_CTAB = /*0525*/ 0x155; /* clear-tab key */ +enum KEY_CATAB = /*0526*/ 0x156; /* clear-all-tabs key */ +enum KEY_ENTER = /*0527*/ 0x157; /* enter/send key */ +enum KEY_PRINT = /*0532*/ 0x15a; /* print key */ +enum KEY_LL = /*0533*/ 0x15b; /* lower-left key (home down) */ +enum KEY_A1 = /*0534*/ 0x15c; /* upper left of keypad */ +enum KEY_A3 = /*0535*/ 0x15d; /* upper right of keypad */ +enum KEY_B2 = /*0536*/ 0x15e; /* center of keypad */ +enum KEY_C1 = /*0537*/ 0x15f; /* lower left of keypad */ +enum KEY_C3 = /*0540*/ 0x160; /* lower right of keypad */ +enum KEY_BTAB = /*0541*/ 0x161; /* back-tab key */ +enum KEY_BEG = /*0542*/ 0x162; /* begin key */ +enum KEY_CANCEL = /*0543*/ 0x163; /* cancel key */ +enum KEY_CLOSE = /*0544*/ 0x164; /* close key */ +enum KEY_COMMAND = /*0545*/ 0x165; /* command key */ +enum KEY_COPY = /*0546*/ 0x166; /* copy key */ +enum KEY_CREATE = /*0547*/ 0x167; /* create key */ +enum KEY_END = /*0550*/ 0x168; /* end key */ +enum KEY_EXIT = /*0551*/ 0x169; /* exit key */ +enum KEY_FIND = /*0552*/ 0x16a; /* find key */ +enum KEY_HELP = /*0553*/ 0x16b; /* help key */ +enum KEY_MARK = /*0554*/ 0x16c; /* mark key */ +enum KEY_MESSAGE = /*0555*/ 0x16d; /* message key */ +enum KEY_MOVE = /*0556*/ 0x16e; /* move key */ +enum KEY_NEXT = /*0557*/ 0x16f; /* next key */ +enum KEY_OPEN = /*0560*/ 0x170; /* open key */ +enum KEY_OPTIONS = /*0561*/ 0x171; /* options key */ +enum KEY_PREVIOUS = /*0562*/ 0x172; /* previous key */ +enum KEY_REDO = /*0563*/ 0x173; /* redo key */ +enum KEY_REFERENCE = /*0564*/ 0x174; /* reference key */ +enum KEY_REFRESH = /*0565*/ 0x175; /* refresh key */ +enum KEY_REPLACE = /*0566*/ 0x176; /* replace key */ +enum KEY_RESTART = /*0567*/ 0x177; /* restart key */ +enum KEY_RESUME = /*0570*/ 0x178; /* resume key */ +enum KEY_SAVE = /*0571*/ 0x179; /* save key */ +enum KEY_SBEG = /*0572*/ 0x17a; /* shifted begin key */ +enum KEY_SCANCEL = /*0573*/ 0x17b; /* shifted cancel key */ +enum KEY_SCOMMAND = /*0574*/ 0x17c; /* shifted command key */ +enum KEY_SCOPY = /*0575*/ 0x17d; /* shifted copy key */ +enum KEY_SCREATE = /*0576*/ 0x17e; /* shifted create key */ +enum KEY_SDC = /*0577*/ 0x17f; /* shifted delete-character key */ +enum KEY_SDL = /*0600*/ 0x180; /* shifted delete-line key */ +enum KEY_SELECT = /*0601*/ 0x181; /* select key */ +enum KEY_SEND = /*0602*/ 0x182; /* shifted end key */ +enum KEY_SEOL = /*0603*/ 0x183; /* shifted clear-to-end-of-line key */ +enum KEY_SEXIT = /*0604*/ 0x184; /* shifted exit key */ +enum KEY_SFIND = /*0605*/ 0x185; /* shifted find key */ +enum KEY_SHELP = /*0606*/ 0x186; /* shifted help key */ +enum KEY_SHOME = /*0607*/ 0x187; /* shifted home key */ +enum KEY_SIC = /*0610*/ 0x188; /* shifted insert-character key */ +enum KEY_SLEFT = /*0611*/ 0x189; /* shifted left-arrow key */ +enum KEY_SMESSAGE = /*0612*/ 0x18a; /* shifted message key */ +enum KEY_SMOVE = /*0613*/ 0x18b; /* shifted move key */ +enum KEY_SNEXT = /*0614*/ 0x18c; /* shifted next key */ +enum KEY_SOPTIONS = /*0615*/ 0x18d; /* shifted options key */ +enum KEY_SPREVIOUS = /*0616*/ 0x18e; /* shifted previous key */ +enum KEY_SPRINT = /*0617*/ 0x18f; /* shifted print key */ +enum KEY_SREDO = /*0620*/ 0x190; /* shifted redo key */ +enum KEY_SREPLACE = /*0621*/ 0x191; /* shifted replace key */ +enum KEY_SRIGHT = /*0622*/ 0x192; /* shifted right-arrow key */ +enum KEY_SRSUME = /*0623*/ 0x193; /* shifted resume key */ +enum KEY_SSAVE = /*0624*/ 0x194; /* shifted save key */ +enum KEY_SSUSPEND = /*0625*/ 0x195; /* shifted suspend key */ +enum KEY_SUNDO = /*0626*/ 0x196; /* shifted undo key */ +enum KEY_SUSPEND = /*0627*/ 0x197; /* suspend key */ +enum KEY_UNDO = /*0630*/ 0x198; /* undo key */ +enum KEY_MOUSE = /*0631*/ 0x199; /* Mouse event has occurred */ + +version (NCURSES_EXT_FUNCS) { +enum KEY_RESIZE = /*0632*/ 0x19a; /* Terminal resize event */ +} + +enum KEY_MAX = /*0777*/ 0x1ff; /* Maximum key value is 0632 */ +/* $Id: curses.wide,v 1.51 2021/05/22 20:28:29 tom Exp $ */ +/* + * vile:cmode: + * This file is part of ncurses, designed to be appended after curses.h.in + * (see that file for the relevant copyright). + */ +enum _XOPEN_CURSES = 1; + +static if (NCURSES_WIDECHAR) { + +extern NCURSES_EXPORT_VAR!(cchar_t *) _nc_wacs; + +auto NCURSES_WACS(c)(c c) { pragma(inline, true); return (&_nc_wacs[cast(ubyte)(c)]); } + +@property auto WACS_BSSB () { pragma(inline, true); return NCURSES_WACS('l'); } +@property auto WACS_SSBB () { pragma(inline, true); return NCURSES_WACS('m'); } +@property auto WACS_BBSS () { pragma(inline, true); return NCURSES_WACS('k'); } +@property auto WACS_SBBS () { pragma(inline, true); return NCURSES_WACS('j'); } +@property auto WACS_SBSS () { pragma(inline, true); return NCURSES_WACS('u'); } +@property auto WACS_SSSB () { pragma(inline, true); return NCURSES_WACS('t'); } +@property auto WACS_SSBS () { pragma(inline, true); return NCURSES_WACS('v'); } +@property auto WACS_BSSS () { pragma(inline, true); return NCURSES_WACS('w'); } +@property auto WACS_BSBS () { pragma(inline, true); return NCURSES_WACS('q'); } +@property auto WACS_SBSB () { pragma(inline, true); return NCURSES_WACS('x'); } +@property auto WACS_SSSS () { pragma(inline, true); return NCURSES_WACS('n'); } + +alias WACS_ULCORNER = WACS_BSSB; +alias WACS_LLCORNER = WACS_SSBB; +alias WACS_URCORNER = WACS_BBSS; +alias WACS_LRCORNER = WACS_SBBS; +alias WACS_RTEE = WACS_SBSS; +alias WACS_LTEE = WACS_SSSB; +alias WACS_BTEE = WACS_SSBS; +alias WACS_TTEE = WACS_BSSS; +alias WACS_HLINE = WACS_BSBS; +alias WACS_VLINE = WACS_SBSB; +alias WACS_PLUS = WACS_SSSS; + +@property auto WACS_S1 () { pragma(inline, true); return NCURSES_WACS('o'); } /* scan line 1 */ +@property auto WACS_S9 () { pragma(inline, true); return NCURSES_WACS('s'); } /* scan line 9 */ +@property auto WACS_DIAMOND () { pragma(inline, true); return NCURSES_WACS('`'); } /* diamond */ +@property auto WACS_CKBOARD () { pragma(inline, true); return NCURSES_WACS('a'); } /* checker board */ +@property auto WACS_DEGREE () { pragma(inline, true); return NCURSES_WACS('f'); } /* degree symbol */ +@property auto WACS_PLMINUS () { pragma(inline, true); return NCURSES_WACS('g'); } /* plus/minus */ +@property auto WACS_BULLET () { pragma(inline, true); return NCURSES_WACS('~'); } /* bullet */ + + /* Teletype 5410v1 symbols */ +@property auto WACS_LARROW () { pragma(inline, true); return NCURSES_WACS(','); } /* arrow left */ +@property auto WACS_RARROW () { pragma(inline, true); return NCURSES_WACS('+'); } /* arrow right */ +@property auto WACS_DARROW () { pragma(inline, true); return NCURSES_WACS('.'); } /* arrow down */ +@property auto WACS_UARROW () { pragma(inline, true); return NCURSES_WACS('-'); } /* arrow up */ +@property auto WACS_BOARD () { pragma(inline, true); return NCURSES_WACS('h'); } /* board of squares */ +@property auto WACS_LANTERN () { pragma(inline, true); return NCURSES_WACS('i'); } /* lantern symbol */ +@property auto WACS_BLOCK () { pragma(inline, true); return NCURSES_WACS('0'); } /* solid square block */ + + /* ncurses extensions */ +@property auto WACS_S3 () { pragma(inline, true); return NCURSES_WACS('p'); } /* scan line 3 */ +@property auto WACS_S7 () { pragma(inline, true); return NCURSES_WACS('r'); } /* scan line 7 */ +@property auto WACS_LEQUAL () { pragma(inline, true); return NCURSES_WACS('y'); } /* less/equal */ +@property auto WACS_GEQUAL () { pragma(inline, true); return NCURSES_WACS('z'); } /* greater/equal */ +@property auto WACS_PI () { pragma(inline, true); return NCURSES_WACS('{'); } /* Pi */ +@property auto WACS_NEQUAL () { pragma(inline, true); return NCURSES_WACS('|'); } /* not equal */ +@property auto WACS_STERLING () { pragma(inline, true); return NCURSES_WACS('}'); } /* UK pound sign */ + + /* double lines */ +@property auto WACS_BDDB () { pragma(inline, true); return NCURSES_WACS('C'); } +@property auto WACS_DDBB () { pragma(inline, true); return NCURSES_WACS('D'); } +@property auto WACS_BBDD () { pragma(inline, true); return NCURSES_WACS('B'); } +@property auto WACS_DBBD () { pragma(inline, true); return NCURSES_WACS('A'); } +@property auto WACS_DBDD () { pragma(inline, true); return NCURSES_WACS('G'); } +@property auto WACS_DDDB () { pragma(inline, true); return NCURSES_WACS('F'); } +@property auto WACS_DDBD () { pragma(inline, true); return NCURSES_WACS('H'); } +@property auto WACS_BDDD () { pragma(inline, true); return NCURSES_WACS('I'); } +@property auto WACS_BDBD () { pragma(inline, true); return NCURSES_WACS('R'); } +@property auto WACS_DBDB () { pragma(inline, true); return NCURSES_WACS('Y'); } +@property auto WACS_DDDD () { pragma(inline, true); return NCURSES_WACS('E'); } + +alias WACS_D_ULCORNER = WACS_BDDB; +alias WACS_D_LLCORNER = WACS_DDBB; +alias WACS_D_URCORNER = WACS_BBDD; +alias WACS_D_LRCORNER = WACS_DBBD; +alias WACS_D_RTEE = WACS_DBDD; +alias WACS_D_LTEE = WACS_DDDB; +alias WACS_D_BTEE = WACS_DDBD; +alias WACS_D_TTEE = WACS_BDDD; +alias WACS_D_HLINE = WACS_BDBD; +alias WACS_D_VLINE = WACS_DBDB; +alias WACS_D_PLUS = WACS_DDDD; + + /* thick lines */ +@property auto WACS_BTTB () { pragma(inline, true); return NCURSES_WACS('L'); } +@property auto WACS_TTBB () { pragma(inline, true); return NCURSES_WACS('M'); } +@property auto WACS_BBTT () { pragma(inline, true); return NCURSES_WACS('K'); } +@property auto WACS_TBBT () { pragma(inline, true); return NCURSES_WACS('J'); } +@property auto WACS_TBTT () { pragma(inline, true); return NCURSES_WACS('U'); } +@property auto WACS_TTTB () { pragma(inline, true); return NCURSES_WACS('T'); } +@property auto WACS_TTBT () { pragma(inline, true); return NCURSES_WACS('V'); } +@property auto WACS_BTTT () { pragma(inline, true); return NCURSES_WACS('W'); } +@property auto WACS_BTBT () { pragma(inline, true); return NCURSES_WACS('Q'); } +@property auto WACS_TBTB () { pragma(inline, true); return NCURSES_WACS('X'); } +@property auto WACS_TTTT () { pragma(inline, true); return NCURSES_WACS('N'); } + +alias WACS_T_ULCORNER = WACS_BTTB; +alias WACS_T_LLCORNER = WACS_TTBB; +alias WACS_T_URCORNER = WACS_BBTT; +alias WACS_T_LRCORNER = WACS_TBBT; +alias WACS_T_RTEE = WACS_TBTT; +alias WACS_T_LTEE = WACS_TTTB; +alias WACS_T_BTEE = WACS_TTBT; +alias WACS_T_TTEE = WACS_BTTT; +alias WACS_T_HLINE = WACS_BTBT; +alias WACS_T_VLINE = WACS_TBTB; +alias WACS_T_PLUS = WACS_TTTT; + +/* + * Function prototypes for wide-character operations. + * + * "generated" comments should include ":WIDEC" to make the corresponding + * functions ifdef'd in lib_gen.c + * + * "implemented" comments do not need this marker. + */ + +extern nothrow @nogc NCURSES_EXPORT!(int) add_wch (const(cchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) add_wchnstr (const(cchar_t) *, int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) add_wchstr (const(cchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) addnwstr (const(wchar_t) *, int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) addwstr (const(wchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) bkgrnd (const(cchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(void) bkgrndset (const(cchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(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)*); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) box_set (WINDOW *, const(cchar_t) *, const(cchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) echo_wchar (const(cchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) erasewchar (wchar_t*); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) get_wch (wint_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) get_wstr (wint_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) getbkgrnd (cchar_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) getcchar (const(cchar_t) *, wchar_t*, attr_t*, NCURSES_PAIRS_T*, void*); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) getn_wstr (wint_t *, int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) hline_set (const(cchar_t) *, int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) in_wch (cchar_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) in_wchnstr (cchar_t *, int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) in_wchstr (cchar_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) innwstr (wchar_t *, int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) ins_nwstr (const(wchar_t) *, int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) ins_wch (const(cchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) ins_wstr (const(wchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) inwstr (wchar_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(NCURSES_CONST!char*) key_name (wchar_t); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) killwchar (wchar_t *); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvadd_wch (int, int, const(cchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvadd_wchnstr (int, int, const(cchar_t) *, int);/* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvadd_wchstr (int, int, const(cchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvaddnwstr (int, int, const(wchar_t) *, int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvaddwstr (int, int, const(wchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvget_wch (int, int, wint_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvget_wstr (int, int, wint_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvgetn_wstr (int, int, wint_t *, int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvhline_set (int, int, const(cchar_t) *, int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvin_wch (int, int, cchar_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvin_wchnstr (int, int, cchar_t *, int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvin_wchstr (int, int, cchar_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvinnwstr (int, int, wchar_t *, int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvins_nwstr (int, int, const(wchar_t) *, int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvins_wch (int, int, const(cchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvins_wstr (int, int, const(wchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvinwstr (int, int, wchar_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvvline_set (int, int, const(cchar_t) *, int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwadd_wch (WINDOW *, int, int, const(cchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwadd_wchnstr (WINDOW *, int, int, const(cchar_t) *, int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwadd_wchstr (WINDOW *, int, int, const(cchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwaddnwstr (WINDOW *, int, int, const(wchar_t) *, int);/* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwaddwstr (WINDOW *, int, int, const(wchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwget_wch (WINDOW *, int, int, wint_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwget_wstr (WINDOW *, int, int, wint_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwgetn_wstr (WINDOW *, int, int, wint_t *, int);/* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwhline_set (WINDOW *, int, int, const(cchar_t) *, int);/* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwin_wch (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwin_wchnstr (WINDOW *, int,int, cchar_t *,int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwin_wchstr (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwinnwstr (WINDOW *, int, int, wchar_t *, int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwins_nwstr (WINDOW *, int,int, const(wchar_t) *,int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwins_wch (WINDOW *, int, int, const(cchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwins_wstr (WINDOW *, int, int, const(wchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwinwstr (WINDOW *, int, int, wchar_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) mvwvline_set (WINDOW *, int,int, const(cchar_t) *,int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) pecho_wchar (WINDOW *, const(cchar_t) *); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) setcchar (cchar_t *, const(wchar_t) *, const(attr_t), NCURSES_PAIRS_T, const(void) *); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) slk_wset (int, const(wchar_t) *, int); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(attr_t) term_attrs (); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) unget_wch (const(wchar_t)); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) vid_attr (attr_t, NCURSES_PAIRS_T, void *); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) vid_puts (attr_t, NCURSES_PAIRS_T, void *, NCURSES_OUTC); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) vline_set (const(cchar_t) *, int); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) wadd_wch (WINDOW *,const(cchar_t) *); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) wadd_wchnstr (WINDOW *,const(cchar_t) *,int); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) wadd_wchstr (WINDOW *,const(cchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) waddnwstr (WINDOW *,const(wchar_t) *,int); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) waddwstr (WINDOW *,const(wchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) wbkgrnd (WINDOW *,const(cchar_t) *); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(void) wbkgrndset (WINDOW *,const(cchar_t) *); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(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)*); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) wecho_wchar (WINDOW *, const(cchar_t) *); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) wget_wch (WINDOW *, wint_t *); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) wget_wstr (WINDOW *, wint_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) wgetbkgrnd (WINDOW *, cchar_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) wgetn_wstr (WINDOW *, wint_t *, int); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) whline_set (WINDOW *, const(cchar_t) *, int); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) win_wch (WINDOW *, cchar_t *); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) win_wchnstr (WINDOW *, cchar_t *, int); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) win_wchstr (WINDOW *, cchar_t *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) winnwstr (WINDOW *, wchar_t *, int); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) wins_nwstr (WINDOW *, const(wchar_t) *, int); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) wins_wch (WINDOW *, const(cchar_t) *); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) wins_wstr (WINDOW *, const(wchar_t) *); /* generated:WIDEC */ +extern nothrow @nogc NCURSES_EXPORT!(int) winwstr (WINDOW *, wchar_t *); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(wchar_t*) wunctrl (cchar_t *); /* implemented */ +extern nothrow @nogc NCURSES_EXPORT!(int) wvline_set (WINDOW *, const(cchar_t) *, int); /* implemented */ + +static if (NCURSES_SP_FUNCS) { +extern nothrow @nogc NCURSES_EXPORT!(attr_t) NCURSES_SP_NAME(term_attrs) (SCREEN*); /* implemented:SP_FUNC */ +extern nothrow @nogc NCURSES_EXPORT!(int) NCURSES_SP_NAME(erasewchar) (SCREEN*, wchar_t *); /* implemented:SP_FUNC */ +extern nothrow @nogc NCURSES_EXPORT!(int) NCURSES_SP_NAME(killwchar) (SCREEN*, wchar_t *); /* implemented:SP_FUNC */ +extern nothrow @nogc NCURSES_EXPORT!(int) NCURSES_SP_NAME(unget_wch) (SCREEN*, const(wchar_t)); /* implemented:SP_FUNC */ +extern nothrow @nogc NCURSES_EXPORT!(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *); /* implemented:SP_FUNC */ +extern nothrow @nogc NCURSES_EXPORT!(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +extern nothrow @nogc NCURSES_EXPORT!(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *); /* implemented:SP_FUNC */ +} + +version (NCURSES_NOMACROS) {} else { + +/* + * XSI curses macros for XPG4 conformance. + */ +auto add_wch(c)(c c) { pragma(inline, true); return wadd_wch(stdscr,(c)); } +auto add_wchnstr(str,n)(str str,n n) { pragma(inline, true); return wadd_wchnstr(stdscr,(str),(n)); } +auto add_wchstr(str)(str str) { pragma(inline, true); return wadd_wchstr(stdscr,(str)); } +auto addnwstr(wstr,n)(wstr wstr,n n) { pragma(inline, true); return waddnwstr(stdscr,(wstr),(n)); } +auto addwstr(wstr)(wstr wstr) { pragma(inline, true); return waddwstr(stdscr,(wstr)); } +auto bkgrnd(c)(c c) { pragma(inline, true); return wbkgrnd(stdscr,(c)); } +auto bkgrndset(c)(c c) { pragma(inline, true); return wbkgrndset(stdscr,(c)); } +auto border_set(l,r,t,b,tl,tr,bl,br)(l l,r r,t t,b b,tl tl,tr tr,bl bl,br br) { pragma(inline, true); return wborder_set(stdscr,(l),(r),(t),(b),tl,tr,bl,br); } +auto box_set(w,v,h)(w w,v v,h h) { pragma(inline, true); return wborder_set((w),(v),(v),(h),(h),0,0,0,0); } +auto echo_wchar(c)(c c) { pragma(inline, true); return wecho_wchar(stdscr,(c)); } +auto get_wch(c)(c c) { pragma(inline, true); return wget_wch(stdscr,(c)); } +auto get_wstr(t)(t t) { pragma(inline, true); return wget_wstr(stdscr,(t)); } +auto getbkgrnd(wch)(wch wch) { pragma(inline, true); return wgetbkgrnd(stdscr,(wch)); } +auto getn_wstr(t,n)(t t,n n) { pragma(inline, true); return wgetn_wstr(stdscr,(t),(n)); } +auto hline_set(c,n)(c c,n n) { pragma(inline, true); return whline_set(stdscr,(c),(n)); } +auto in_wch(c)(c c) { pragma(inline, true); return win_wch(stdscr,(c)); } +auto in_wchnstr(c,n)(c c,n n) { pragma(inline, true); return win_wchnstr(stdscr,(c),(n)); } +auto in_wchstr(c)(c c) { pragma(inline, true); return win_wchstr(stdscr,(c)); } +auto innwstr(c,n)(c c,n n) { pragma(inline, true); return winnwstr(stdscr,(c),(n)); } +auto ins_nwstr(t,n)(t t,n n) { pragma(inline, true); return wins_nwstr(stdscr,(t),(n)); } +auto ins_wch(c)(c c) { pragma(inline, true); return wins_wch(stdscr,(c)); } +auto ins_wstr(t)(t t) { pragma(inline, true); return wins_wstr(stdscr,(t)); } +auto inwstr(c)(c c) { pragma(inline, true); return winwstr(stdscr,(c)); } +auto vline_set(c,n)(c c,n n) { pragma(inline, true); return wvline_set(stdscr,(c),(n)); } +auto wadd_wchstr(win,str)(win win,str str) { pragma(inline, true); return wadd_wchnstr((win),(str),-1); } +auto waddwstr(win,wstr)(win win,wstr wstr) { pragma(inline, true); return waddnwstr((win),(wstr),-1); } +auto wget_wstr(w,t)(w w,t t) { pragma(inline, true); return wgetn_wstr((w),(t),-1); } +auto win_wchstr(w,c)(w w,c c) { pragma(inline, true); return win_wchnstr((w),(c),-1); } +auto wins_wstr(w,t)(w w,t t) { pragma(inline, true); return wins_nwstr((w),(t),-1); } + +static if (!NCURSES_OPAQUE) { +auto wgetbkgrnd(win,wch)(win win,wch wch) { pragma(inline, true); return (NCURSES_OK_ADDR(wch) ? ((win) ? (*(wch) = (win)._bkgrnd) : *(wch), OK) : ERR); } +} + +auto mvadd_wch(y,x,c)(y y,x x,c c) { pragma(inline, true); return mvwadd_wch(stdscr,(y),(x),(c)); } +auto mvadd_wchnstr(y,x,s,n)(y y,x x,s s,n n) { pragma(inline, true); return mvwadd_wchnstr(stdscr,(y),(x),(s),(n)); } +auto mvadd_wchstr(y,x,s)(y y,x x,s s) { pragma(inline, true); return mvwadd_wchstr(stdscr,(y),(x),(s)); } +auto mvaddnwstr(y,x,wstr,n)(y y,x x,wstr wstr,n n) { pragma(inline, true); return mvwaddnwstr(stdscr,(y),(x),(wstr),(n)); } +auto mvaddwstr(y,x,wstr)(y y,x x,wstr wstr) { pragma(inline, true); return mvwaddwstr(stdscr,(y),(x),(wstr)); } +auto mvget_wch(y,x,c)(y y,x x,c c) { pragma(inline, true); return mvwget_wch(stdscr,(y),(x),(c)); } +auto mvget_wstr(y,x,t)(y y,x x,t t) { pragma(inline, true); return mvwget_wstr(stdscr,(y),(x),(t)); } +auto mvgetn_wstr(y,x,t,n)(y y,x x,t t,n n) { pragma(inline, true); return mvwgetn_wstr(stdscr,(y),(x),(t),(n)); } +auto mvhline_set(y,x,c,n)(y y,x x,c c,n n) { pragma(inline, true); return mvwhline_set(stdscr,(y),(x),(c),(n)); } +auto mvin_wch(y,x,c)(y y,x x,c c) { pragma(inline, true); return mvwin_wch(stdscr,(y),(x),(c)); } +auto mvin_wchnstr(y,x,c,n)(y y,x x,c c,n n) { pragma(inline, true); return mvwin_wchnstr(stdscr,(y),(x),(c),(n)); } +auto mvin_wchstr(y,x,c)(y y,x x,c c) { pragma(inline, true); return mvwin_wchstr(stdscr,(y),(x),(c)); } +auto mvinnwstr(y,x,c,n)(y y,x x,c c,n n) { pragma(inline, true); return mvwinnwstr(stdscr,(y),(x),(c),(n)); } +auto mvins_nwstr(y,x,t,n)(y y,x x,t t,n n) { pragma(inline, true); return mvwins_nwstr(stdscr,(y),(x),(t),(n)); } +auto mvins_wch(y,x,c)(y y,x x,c c) { pragma(inline, true); return mvwins_wch(stdscr,(y),(x),(c)); } +auto mvins_wstr(y,x,t)(y y,x x,t t) { pragma(inline, true); return mvwins_wstr(stdscr,(y),(x),(t)); } +auto mvinwstr(y,x,c)(y y,x x,c c) { pragma(inline, true); return mvwinwstr(stdscr,(y),(x),(c)); } +auto mvvline_set(y,x,c,n)(y y,x x,c c,n n) { pragma(inline, true); return mvwvline_set(stdscr,(y),(x),(c),(n)); } + +auto mvwadd_wch(win,y,x,c)(win win,y y,x x,c c) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : wadd_wch((win),(c))); } +auto mvwadd_wchnstr(win,y,x,s,n)(win win,y y,x x,s s,n n) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : wadd_wchnstr((win),(s),(n))); } +auto mvwadd_wchstr(win,y,x,s)(win win,y y,x x,s s) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : wadd_wchstr((win),(s))); } +auto mvwaddnwstr(win,y,x,wstr,n)(win win,y y,x x,wstr wstr,n n) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : waddnwstr((win),(wstr),(n))); } +auto mvwaddwstr(win,y,x,wstr)(win win,y y,x x,wstr wstr) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : waddwstr((win),(wstr))); } +auto mvwget_wch(win,y,x,c)(win win,y y,x x,c c) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : wget_wch((win),(c))); } +auto mvwget_wstr(win,y,x,t)(win win,y y,x x,t t) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : wget_wstr((win),(t))); } +auto mvwgetn_wstr(win,y,x,t,n)(win win,y y,x x,t t,n n) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : wgetn_wstr((win),(t),(n))); } +auto mvwhline_set(win,y,x,c,n)(win win,y y,x x,c c,n n) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : whline_set((win),(c),(n))); } +auto mvwin_wch(win,y,x,c)(win win,y y,x x,c c) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : win_wch((win),(c))); } +auto mvwin_wchnstr(win,y,x,c,n)(win win,y y,x x,c c,n n) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : win_wchnstr((win),(c),(n))); } +auto mvwin_wchstr(win,y,x,c)(win win,y y,x x,c c) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : win_wchstr((win),(c))); } +auto mvwinnwstr(win,y,x,c,n)(win win,y y,x x,c c,n n) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : winnwstr((win),(c),(n))); } +auto mvwins_nwstr(win,y,x,t,n)(win win,y y,x x,t t,n n) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : wins_nwstr((win),(t),(n))); } +auto mvwins_wch(win,y,x,c)(win win,y y,x x,c c) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : wins_wch((win),(c))); } +auto mvwins_wstr(win,y,x,t)(win win,y y,x x,t t) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : wins_wstr((win),(t))); } +auto mvwinwstr(win,y,x,c)(win win,y y,x x,c c) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : winwstr((win),(c))); } +auto mvwvline_set(win,y,x,c,n)(win win,y y,x x,c c,n n) { pragma(inline, true); return (wmove(win,(y),(x)) == ERR ? ERR : wvline_set((win),(c),(n))); } + +} /* NCURSES_NOMACROS */ + +// #if defined(TRACE) || defined(NCURSES_TEST) +// extern nothrow @nogc NCURSES_EXPORT!(const(char) *) _nc_viswbuf(const(wchar_t) *); +// extern nothrow @nogc NCURSES_EXPORT!(const(char) *) _nc_viswibuf(const(wint_t) *); +// #endif + +} /* NCURSES_WIDECHAR */ +/* $Id: curses.tail,v 1.26 2021/03/20 15:49:25 tom Exp $ */ +/* + * vile:cmode: + * This file is part of ncurses, designed to be appended after curses.h.in + * (see that file for the relevant copyright). + */ + +/* mouse interface */ + +static if (NCURSES_MOUSE_VERSION > 1) { +auto NCURSES_MOUSE_MASK(b,m)(b b,m m) { pragma(inline, true); return ((m) << (((b) - 1) * 5)); } +} else { +auto NCURSES_MOUSE_MASK(b,m)(b b,m m) { pragma(inline, true); return ((m) << (((b) - 1) * 6)); } +} + +enum NCURSES_BUTTON_RELEASED = /*001*/ 0x01L; +enum NCURSES_BUTTON_PRESSED = /*002*/ 0x02L; +enum NCURSES_BUTTON_CLICKED = /*004*/ 0x04L; +enum NCURSES_DOUBLE_CLICKED = /*010*/ 0x08L; +enum NCURSES_TRIPLE_CLICKED = /*020*/ 0x10L; +enum NCURSES_RESERVED_EVENT = /*040*/ 0x20L; + +/* event masks */ +enum BUTTON1_RELEASED = NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED); +enum BUTTON1_PRESSED = NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED); +enum BUTTON1_CLICKED = NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED); +enum BUTTON1_DOUBLE_CLICKED = NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED); +enum BUTTON1_TRIPLE_CLICKED = NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED); + +enum BUTTON2_RELEASED = NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED); +enum BUTTON2_PRESSED = NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED); +enum BUTTON2_CLICKED = NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED); +enum BUTTON2_DOUBLE_CLICKED = NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED); +enum BUTTON2_TRIPLE_CLICKED = NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED); + +enum BUTTON3_RELEASED = NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED); +enum BUTTON3_PRESSED = NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED); +enum BUTTON3_CLICKED = NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED); +enum BUTTON3_DOUBLE_CLICKED = NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED); +enum BUTTON3_TRIPLE_CLICKED = NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED); + +enum BUTTON4_RELEASED = NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED); +enum BUTTON4_PRESSED = NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED); +enum BUTTON4_CLICKED = NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED); +enum BUTTON4_DOUBLE_CLICKED = NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED); +enum BUTTON4_TRIPLE_CLICKED = NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED); + +/* + * In 32 bits the version-1 scheme does not provide enough space for a 5th + * button, unless we choose to change the ABI by omitting the reserved-events. + */ +static if (NCURSES_MOUSE_VERSION > 1) { + +enum BUTTON5_RELEASED = NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED); +enum BUTTON5_PRESSED = NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED); +enum BUTTON5_CLICKED = NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED); +enum BUTTON5_DOUBLE_CLICKED = NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED); +enum BUTTON5_TRIPLE_CLICKED = NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED); + +enum BUTTON_CTRL = NCURSES_MOUSE_MASK(6, /*001*/ 0x01L); +enum BUTTON_SHIFT = NCURSES_MOUSE_MASK(6, /*002*/ 0x02L); +enum BUTTON_ALT = NCURSES_MOUSE_MASK(6, /*004*/ 0x04L); +enum REPORT_MOUSE_POSITION = NCURSES_MOUSE_MASK(6, /*010*/ 0x08L); + +} else { + +enum BUTTON1_RESERVED_EVENT = NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT); +enum BUTTON2_RESERVED_EVENT = NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT); +enum BUTTON3_RESERVED_EVENT = NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT); +enum BUTTON4_RESERVED_EVENT = NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT); + +enum BUTTON_CTRL = NCURSES_MOUSE_MASK(5, /*001*/ 0x01L); +enum BUTTON_SHIFT = NCURSES_MOUSE_MASK(5, /*002*/ 0x02L); +enum BUTTON_ALT = NCURSES_MOUSE_MASK(5, /*004*/ 0x04L); +enum REPORT_MOUSE_POSITION = NCURSES_MOUSE_MASK(5, /*010*/ 0x08L); + +} + +enum ALL_MOUSE_EVENTS = (REPORT_MOUSE_POSITION - 1); + +/* macros to extract single event-bits from masks */ +auto BUTTON_RELEASE(e, x)(e e, x x) { pragma(inline, true); return ((e) & NCURSES_MOUSE_MASK(x, /*001*/ 0x01)); } +auto BUTTON_PRESS(e, x)(e e, x x) { pragma(inline, true); return ((e) & NCURSES_MOUSE_MASK(x, /*002*/ 0x02)); } +auto BUTTON_CLICK(e, x)(e e, x x) { pragma(inline, true); return ((e) & NCURSES_MOUSE_MASK(x, /*004*/ 0x04)); } +auto BUTTON_DOUBLE_CLICK(e, x)(e e, x x) { pragma(inline, true); return ((e) & NCURSES_MOUSE_MASK(x, /*010*/ 0x08)); } +auto BUTTON_TRIPLE_CLICK(e, x)(e e, x x) { pragma(inline, true); return ((e) & NCURSES_MOUSE_MASK(x, /*020*/ 0x10)); } +auto BUTTON_RESERVED_EVENT(e, x)(e e, x x) { pragma(inline, true); return ((e) & NCURSES_MOUSE_MASK(x, /*040*/ 0x20)); } + +struct MEVENT +{ + short id; /* ID to distinguish multiple devices */ + int x, y, z; /* event coordinates (character-cell) */ + mmask_t bstate; /* button state bits */ +} + +extern nothrow @nogc NCURSES_EXPORT!(bool) has_mouse(); +extern nothrow @nogc NCURSES_EXPORT!(int) getmouse (MEVENT *); +extern nothrow @nogc NCURSES_EXPORT!(int) ungetmouse (MEVENT *); +extern nothrow @nogc NCURSES_EXPORT!(mmask_t) mousemask (mmask_t, mmask_t *); +extern nothrow @nogc NCURSES_EXPORT!(bool) wenclose (const(WINDOW) *, int, int); +extern nothrow @nogc NCURSES_EXPORT!(int) mouseinterval (int); +extern nothrow @nogc NCURSES_EXPORT!(bool) wmouse_trafo (const(WINDOW)*, int*, int*, bool); +// extern nothrow @nogc NCURSES_EXPORT!(bool) mouse_trafo (int*, int*, bool); /* generated */ + +static if (NCURSES_SP_FUNCS) { +extern nothrow @nogc NCURSES_EXPORT!(bool) NCURSES_SP_NAME(has_mouse) (SCREEN*); +extern nothrow @nogc NCURSES_EXPORT!(int) NCURSES_SP_NAME(getmouse) (SCREEN*, MEVENT *); +extern nothrow @nogc NCURSES_EXPORT!(int) NCURSES_SP_NAME(ungetmouse) (SCREEN*,MEVENT *); +extern nothrow @nogc NCURSES_EXPORT!(mmask_t) NCURSES_SP_NAME(mousemask) (SCREEN*, mmask_t, mmask_t *); +extern nothrow @nogc NCURSES_EXPORT!(int) NCURSES_SP_NAME(mouseinterval) (SCREEN*, int); +} + +version (NCURSES_NOMACROS) {} else { +auto mouse_trafo(y,x,to_screen)(y y,x x,to_screen to_screen) { pragma(inline, true); return wmouse_trafo(stdscr,y,x,to_screen); } +} + +/* other non-XSI functions */ + +extern nothrow @nogc NCURSES_EXPORT!(int) mcprint (char *, int); /* direct data to printer */ +extern nothrow @nogc NCURSES_EXPORT!(int) has_key (int); /* do we have given key? */ + +static if (NCURSES_SP_FUNCS) { +extern nothrow @nogc NCURSES_EXPORT!(int) NCURSES_SP_NAME(has_key) (SCREEN*, int); /* do we have given key? */ +extern nothrow @nogc NCURSES_EXPORT!(int) NCURSES_SP_NAME(mcprint) (SCREEN*, char *, int); /* direct data to printer */ +} + +/* Debugging : use with libncurses_g.a */ + +extern nothrow @nogc NCURSES_EXPORT!(void) _tracef (const(char) *, ...) /*GCC_PRINTFLIKE(1,2)*/; +extern nothrow @nogc NCURSES_EXPORT!(char *) _traceattr (attr_t); +extern nothrow @nogc NCURSES_EXPORT!(char *) _traceattr2 (int, chtype); +extern nothrow @nogc NCURSES_EXPORT!(char *) _tracechar (int); +extern nothrow @nogc NCURSES_EXPORT!(char *) _tracechtype (chtype); +extern nothrow @nogc NCURSES_EXPORT!(char *) _tracechtype2 (int, chtype); +static if (NCURSES_WIDECHAR) { +alias _tracech_t = _tracecchar_t; +extern nothrow @nogc NCURSES_EXPORT!(char *) _tracecchar_t (const(cchar_t) *); +alias _tracech_t2 = _tracecchar_t2; +extern nothrow @nogc NCURSES_EXPORT!(char *) _tracecchar_t2 (int, const(cchar_t) *); +} else { +alias _tracech_t = _tracechtype; +alias _tracech_t2 = _tracechtype2; +} +deprecated("use curses_trace") extern nothrow @nogc NCURSES_EXPORT!(void) trace (const(uint)); +extern nothrow @nogc NCURSES_EXPORT!(uint) curses_trace (const(uint)); + +/* trace masks */ +enum TRACE_DISABLE = 0x0000; /* turn off tracing */ +enum TRACE_TIMES = 0x0001; /* trace user and system times of updates */ +enum TRACE_TPUTS = 0x0002; /* trace tputs calls */ +enum TRACE_UPDATE = 0x0004; /* trace update actions, old & new screens */ +enum TRACE_MOVE = 0x0008; /* trace cursor moves and scrolls */ +enum TRACE_CHARPUT = 0x0010; /* trace all character outputs */ +enum TRACE_ORDINARY = 0x001F; /* trace all update actions */ +enum TRACE_CALLS = 0x0020; /* trace all curses calls */ +enum TRACE_VIRTPUT = 0x0040; /* trace virtual character puts */ +enum TRACE_IEVENT = 0x0080; /* trace low-level input processing */ +enum TRACE_BITS = 0x0100; /* trace state of TTY control bits */ +enum TRACE_ICALLS = 0x0200; /* trace internal/nested calls */ +enum TRACE_CCALLS = 0x0400; /* trace per-character calls */ +enum TRACE_DATABASE = 0x0800; /* trace read/write of terminfo/termcap data */ +enum TRACE_ATTRS = 0x1000; /* trace attribute updates */ + +enum TRACE_SHIFT = 13; /* number of bits in the trace masks */ +enum TRACE_MAXIMUM = ((1 << TRACE_SHIFT) - 1); /* maximum trace level */ + +// #if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT_VAR!(int) _nc_optimize_enable; /* enable optimizations */ +extern nothrow @nogc NCURSES_EXPORT!(const(char) *) _nc_visbuf (const(char) *); +enum OPTIMIZE_MVCUR = 0x01; /* cursor movement optimization */ +enum OPTIMIZE_HASHMAP = 0x02; /* diff hashing to detect scrolls */ +enum OPTIMIZE_SCROLL = 0x04; /* scroll optimization */ +enum OPTIMIZE_ALL = 0xff; /* enable all optimizations (dflt) */ +// #endif + +extern nothrow @nogc /*GCC_NORETURN*/ NCURSES_EXPORT!(void) exit_curses (int); + +// #include + +// #ifdef __cplusplus + +// #ifndef NCURSES_NOMACROS + +/* these names conflict with STL */ +// #undef box +// #undef clear +// #undef erase +// #undef move +// #undef refresh + +// #endif /* NCURSES_NOMACROS */ + +// D porting note: these have to be here to avoid dependency issues. + +// struct _win_st; +alias WINDOW = _win_st; diff --git a/source/deimos/ncurses/eti.d b/source/deimos/eti.di similarity index 74% rename from source/deimos/ncurses/eti.d rename to source/deimos/eti.di index 7707e00..6345692 100644 --- a/source/deimos/ncurses/eti.d +++ b/source/deimos/eti.di @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2002,2003 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,25 +30,23 @@ /**************************************************************************** * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: eti.h,v 1.8 2003/10/25 15:24:29 tom Exp $ */ -module deimos.ncurses.eti; +/* $Id: eti.h,v 1.9 2020/02/02 23:34:34 tom Exp $ */ -immutable enum :int -{ - E_OK = 0, - E_SYSTEM_ERROR = -1, - E_BAD_ARGUMENT = -2, - E_POSTED = -3, - E_CONNECTED = -4, - E_BAD_STATE = -5, - E_NO_ROOM = -6, - E_NOT_POSTED = -7, - E_UNKNOWN_COMMAND = -8, - E_NO_MATCH = -9, - E_NOT_SELECTABLE = -10, - E_NOT_CONNECTED = -11, - E_REQUEST_DENIED = -12, - E_INVALID_FIELD = -13, - E_CURRENT = -14 -} +module deimos.eti; + +enum E_OK = (0); +enum E_SYSTEM_ERROR = (-1); +enum E_BAD_ARGUMENT = (-2); +enum E_POSTED = (-3); +enum E_CONNECTED = (-4); +enum E_BAD_STATE = (-5); +enum E_NO_ROOM = (-6); +enum E_NOT_POSTED = (-7); +enum E_UNKNOWN_COMMAND = (-8); +enum E_NO_MATCH = (-9); +enum E_NOT_SELECTABLE = (-10); +enum E_NOT_CONNECTED = (-11); +enum E_REQUEST_DENIED = (-12); +enum E_INVALID_FIELD = (-13); +enum E_CURRENT = (-14); diff --git a/source/deimos/form.di b/source/deimos/form.di new file mode 100644 index 0000000..8e18c1d --- /dev/null +++ b/source/deimos/form.di @@ -0,0 +1,459 @@ +/**************************************************************************** + * Copyright 2018-2019-2020,2021 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1995,1997 * + ****************************************************************************/ + +/* $Id: form.h,v 0.32 2021/06/17 21:26:02 tom Exp $ */ + +module deimos.form; + +extern (C): + +import core.stdc.config; +import core.stdc.stdarg; +import core.stdc.stddef; + +/* *INDENT-OFF*/ + +public import deimos.curses; +public import deimos.eti; + +// D porting note: this replaces FORM_WRAPPED_VAR and NCURSES_PUBLIC_VAR. +mixin template FORM_D_VAR(type,string name) +{ + mixin(" + extern /*FORM_IMPEXP*/ type " ~ NCURSES_PUBLIC_VAR(name) ~ "(); + @property auto " ~ name ~ "() { pragma(inline, true); return " ~ NCURSES_PUBLIC_VAR(name) ~ "(); } + "); +} + +// D porting note: "export"/"extern" must be moved to the declaration, it cannot be added here. +alias FORM_EXPORT(type) = /*FORM_IMPEXP*/ type /*NCURSES_API*/; +alias FORM_EXPORT_VAR(type) = /*FORM_IMPEXP*/ type; + +// #ifndef FORM_PRIV_H +alias FIELD_CELL = void *; +// #endif + +// #ifndef NCURSES_FIELD_INTERNALS +mixin template NCURSES_FIELD_INTERNALS() {} /* nothing */ +// #endif + +alias Form_Options = int; +alias Field_Options = int; + + /********** + * _PAGE * + **********/ + +struct pagenode +// #if !NCURSES_OPAQUE_FORM +{ + short pmin; /* index of first field on page */ + short pmax; /* index of last field on page */ + short smin; /* index of top leftmost field on page */ + short smax; /* index of bottom rightmost field on page */ +} +// #endif /* !NCURSES_OPAQUE_FORM */ +alias _PAGE = pagenode; + + /********** + * FIELD * + **********/ + +struct fieldnode +// #if 1 /* not yet: !NCURSES_OPAQUE_FORM */ +{ + ushort status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + short frow; /* first row */ + short fcol; /* first col */ + int drows; /* dynamic rows */ + int dcols; /* dynamic cols */ + int maxgrow; /* maximum field growth */ + int nrow; /* off-screen rows */ + short nbuf; /* additional buffers */ + short just; /* justification */ + short page; /* page on form */ + short index; /* into form -> field */ + int pad; /* pad character */ + chtype fore; /* foreground attribute */ + chtype back; /* background attribute */ + Field_Options opts; /* options */ + fieldnode * snext; /* sorted order pointer */ + fieldnode * sprev; /* sorted order pointer */ + fieldnode * link; /* linked field chain */ + formnode * form; /* containing form */ + typenode * type; /* field type */ + void * arg; /* argument for type */ + FIELD_CELL * buf; /* field buffers */ + void * usrptr; /* user pointer */ + /* + * The wide-character configuration requires extra information. Because + * there are existing applications that manipulate the members of FIELD + * directly, we cannot make the struct opaque, except by changing the ABI. + * Offsets of members up to this point are the same in the narrow- and + * wide-character configuration. But note that the type of buf depends on + * the configuration, and is made opaque for that reason. + */ + mixin NCURSES_FIELD_INTERNALS; +} +// #endif /* NCURSES_OPAQUE_FORM */ +alias FIELD = fieldnode; + + + /********* + * FORM * + *********/ + +struct formnode +// #if 1 /* not yet: !NCURSES_OPAQUE_FORM */ +{ + ushort status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + int currow; /* current row in field window */ + int curcol; /* current col in field window */ + int toprow; /* in scrollable field window */ + int begincol; /* in horiz. scrollable field */ + short maxfield; /* number of fields */ + short maxpage; /* number of pages */ + short curpage; /* index into page */ + Form_Options opts; /* options */ + WINDOW * win; /* window */ + WINDOW * sub; /* subwindow */ + WINDOW * w; /* window for current field */ + FIELD ** field; /* field [maxfield] */ + FIELD * current; /* current field */ + _PAGE * page; /* page [maxpage] */ + void * usrptr; /* user pointer */ + + void function(formnode *) forminit; + void function(formnode *) formterm; + void function(formnode *) fieldinit; + void function(formnode *) fieldterm; + +} +// #endif /* !NCURSES_OPAQUE_FORM */ +alias FORM = formnode; + + + /************** + * FIELDTYPE * + **************/ + +struct typenode +// #if !NCURSES_OPAQUE_FORM +{ + ushort status; /* flags */ + c_long ref_; /* reference count */ + typenode * left; /* ptr to operand for | */ + typenode * right; /* ptr to operand for | */ + + void* function(va_list *) makearg; /* make fieldtype arg */ + void* function(const(void) *) copyarg; /* copy fieldtype arg */ + void function(void *) freearg; /* free fieldtype arg */ + +static if (NCURSES_INTEROP_FUNCS) { + union { + bool function(FIELD *,const(void) *) ofcheck; /* field validation */ + bool function(FORM*,FIELD *,const(void)*) gfcheck; /* generic field validation */ + } /*fieldcheck;*/ + union { + bool function(int,const(void) *) occheck; /* character validation */ + bool function(int,FORM*, + FIELD*,const(void)*) gccheck; /* generic char validation */ + } /*charcheck;*/ + union { + bool function(FIELD *,const(void) *) onext; /* enumerate next value */ + bool function(FORM*,FIELD*,const(void)*) gnext; /* generic enumerate next */ + } /*enum_next;*/ + union { + bool function(FIELD *,const(void) *) oprev; /* enumerate prev value */ + bool function(FORM*,FIELD*,const(void)*) gprev; /* generic enumerate prev */ + } /*enum_prev;*/ + void* function(void*) genericarg; /* Alternate Arg method */ +} else { + bool function(FIELD *,const(void) *) fcheck; /* field validation */ + bool function(int,const(void) *) ccheck; /* character validation */ + + bool function(FIELD *,const(void) *) next; /* enumerate next value */ + bool function(FIELD *,const(void) *) prev; /* enumerate prev value */ +} +} +// #endif /* !NCURSES_OPAQUE_FORM */ +alias FIELDTYPE = typenode; + +alias Form_Hook = void function(FORM *); + + /*************************** + * miscellaneous #defines * + ***************************/ + +/* field justification */ +enum NO_JUSTIFICATION = (0); +enum JUSTIFY_LEFT = (1); +enum JUSTIFY_CENTER = (2); +enum JUSTIFY_RIGHT = (3); + +/* field options */ +enum O_VISIBLE = (0x0001U); +enum O_ACTIVE = (0x0002U); +enum O_PUBLIC = (0x0004U); +enum O_EDIT = (0x0008U); +enum O_WRAP = (0x0010U); +enum O_BLANK = (0x0020U); +enum O_AUTOSKIP = (0x0040U); +enum O_NULLOK = (0x0080U); +enum O_PASSOK = (0x0100U); +enum O_STATIC = (0x0200U); +enum O_DYNAMIC_JUSTIFY = (0x0400U); /* ncurses extension */ +enum O_NO_LEFT_STRIP = (0x0800U); /* ncurses extension */ +enum O_EDGE_INSERT_STAY = (0x1000U); /* ncurses extension */ +enum O_INPUT_LIMIT = (0x2000U); /* ncurses extension */ + +/* form options */ +enum O_NL_OVERLOAD = (0x0001U); +enum O_BS_OVERLOAD = (0x0002U); + +/* form driver commands */ +enum REQ_NEXT_PAGE = (KEY_MAX + 1); /* move to next page */ +enum REQ_PREV_PAGE = (KEY_MAX + 2); /* move to previous page */ +enum REQ_FIRST_PAGE = (KEY_MAX + 3); /* move to first page */ +enum REQ_LAST_PAGE = (KEY_MAX + 4); /* move to last page */ + +enum REQ_NEXT_FIELD = (KEY_MAX + 5); /* move to next field */ +enum REQ_PREV_FIELD = (KEY_MAX + 6); /* move to previous field */ +enum REQ_FIRST_FIELD = (KEY_MAX + 7); /* move to first field */ +enum REQ_LAST_FIELD = (KEY_MAX + 8); /* move to last field */ +enum REQ_SNEXT_FIELD = (KEY_MAX + 9); /* move to sorted next field */ +enum REQ_SPREV_FIELD = (KEY_MAX + 10); /* move to sorted prev field */ +enum REQ_SFIRST_FIELD = (KEY_MAX + 11); /* move to sorted first field */ +enum REQ_SLAST_FIELD = (KEY_MAX + 12); /* move to sorted last field */ +enum REQ_LEFT_FIELD = (KEY_MAX + 13); /* move to left to field */ +enum REQ_RIGHT_FIELD = (KEY_MAX + 14); /* move to right to field */ +enum REQ_UP_FIELD = (KEY_MAX + 15); /* move to up to field */ +enum REQ_DOWN_FIELD = (KEY_MAX + 16); /* move to down to field */ + +enum REQ_NEXT_CHAR = (KEY_MAX + 17); /* move to next char in field */ +enum REQ_PREV_CHAR = (KEY_MAX + 18); /* move to prev char in field */ +enum REQ_NEXT_LINE = (KEY_MAX + 19); /* move to next line in field */ +enum REQ_PREV_LINE = (KEY_MAX + 20); /* move to prev line in field */ +enum REQ_NEXT_WORD = (KEY_MAX + 21); /* move to next word in field */ +enum REQ_PREV_WORD = (KEY_MAX + 22); /* move to prev word in field */ +enum REQ_BEG_FIELD = (KEY_MAX + 23); /* move to first char in field */ +enum REQ_END_FIELD = (KEY_MAX + 24); /* move after last char in fld */ +enum REQ_BEG_LINE = (KEY_MAX + 25); /* move to beginning of line */ +enum REQ_END_LINE = (KEY_MAX + 26); /* move after last char in line */ +enum REQ_LEFT_CHAR = (KEY_MAX + 27); /* move left in field */ +enum REQ_RIGHT_CHAR = (KEY_MAX + 28); /* move right in field */ +enum REQ_UP_CHAR = (KEY_MAX + 29); /* move up in field */ +enum REQ_DOWN_CHAR = (KEY_MAX + 30); /* move down in field */ + +enum REQ_NEW_LINE = (KEY_MAX + 31); /* insert/overlay new line */ +enum REQ_INS_CHAR = (KEY_MAX + 32); /* insert blank char at cursor */ +enum REQ_INS_LINE = (KEY_MAX + 33); /* insert blank line at cursor */ +enum REQ_DEL_CHAR = (KEY_MAX + 34); /* delete char at cursor */ +enum REQ_DEL_PREV = (KEY_MAX + 35); /* delete char before cursor */ +enum REQ_DEL_LINE = (KEY_MAX + 36); /* delete line at cursor */ +enum REQ_DEL_WORD = (KEY_MAX + 37); /* delete word at cursor */ +enum REQ_CLR_EOL = (KEY_MAX + 38); /* clear to end of line */ +enum REQ_CLR_EOF = (KEY_MAX + 39); /* clear to end of field */ +enum REQ_CLR_FIELD = (KEY_MAX + 40); /* clear entire field */ +enum REQ_OVL_MODE = (KEY_MAX + 41); /* begin overlay mode */ +enum REQ_INS_MODE = (KEY_MAX + 42); /* begin insert mode */ +enum REQ_SCR_FLINE = (KEY_MAX + 43); /* scroll field forward a line */ +enum REQ_SCR_BLINE = (KEY_MAX + 44); /* scroll field backward a line */ +enum REQ_SCR_FPAGE = (KEY_MAX + 45); /* scroll field forward a page */ +enum REQ_SCR_BPAGE = (KEY_MAX + 46); /* scroll field backward a page */ +enum REQ_SCR_FHPAGE = (KEY_MAX + 47); /* scroll field forward half page */ +enum REQ_SCR_BHPAGE = (KEY_MAX + 48); /* scroll field backward half page */ +enum REQ_SCR_FCHAR = (KEY_MAX + 49); /* horizontal scroll char */ +enum REQ_SCR_BCHAR = (KEY_MAX + 50); /* horizontal scroll char */ +enum REQ_SCR_HFLINE = (KEY_MAX + 51); /* horizontal scroll line */ +enum REQ_SCR_HBLINE = (KEY_MAX + 52); /* horizontal scroll line */ +enum REQ_SCR_HFHALF = (KEY_MAX + 53); /* horizontal scroll half line */ +enum REQ_SCR_HBHALF = (KEY_MAX + 54); /* horizontal scroll half line */ + +enum REQ_VALIDATION = (KEY_MAX + 55); /* validate field */ +enum REQ_NEXT_CHOICE = (KEY_MAX + 56); /* display next field choice */ +enum REQ_PREV_CHOICE = (KEY_MAX + 57); /* display prev field choice */ + +enum MIN_FORM_COMMAND = (KEY_MAX + 1); /* used by form_driver */ +enum MAX_FORM_COMMAND = (KEY_MAX + 57); /* used by form_driver */ + +// #if defined(MAX_COMMAND) +// # if (MAX_FORM_COMMAND > MAX_COMMAND) +// # error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND +// # elif (MAX_COMMAND != (KEY_MAX + 128)) +// # error Something is wrong -- MAX_COMMAND is already inconsistently defined. +// # endif +// #else + enum MAX_COMMAND = (KEY_MAX + 128); +// #endif + + /************************* + * standard field types * + *************************/ +extern __gshared FORM_EXPORT_VAR!(FIELDTYPE *) TYPE_ALPHA; +extern __gshared FORM_EXPORT_VAR!(FIELDTYPE *) TYPE_ALNUM; +extern __gshared FORM_EXPORT_VAR!(FIELDTYPE *) TYPE_ENUM; +extern __gshared FORM_EXPORT_VAR!(FIELDTYPE *) TYPE_INTEGER; +extern __gshared FORM_EXPORT_VAR!(FIELDTYPE *) TYPE_NUMERIC; +extern __gshared FORM_EXPORT_VAR!(FIELDTYPE *) TYPE_REGEXP; + + /************************************ + * built-in additional field types * + * They are not defined in SVr4 * + ************************************/ +extern __gshared FORM_EXPORT_VAR!(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */ + + /*********************** + * FIELDTYPE routines * + ***********************/ +extern nothrow @nogc FORM_EXPORT!(FIELDTYPE *) new_fieldtype ( + const bool function(FIELD *,const(void) *) field_check, + const bool function(int,const(void) *) char_check); +extern nothrow @nogc FORM_EXPORT!(FIELDTYPE *) link_fieldtype( + FIELDTYPE *, FIELDTYPE *); + +extern nothrow @nogc FORM_EXPORT!(int) free_fieldtype (FIELDTYPE *); +extern nothrow @nogc FORM_EXPORT!(int) set_fieldtype_arg (FIELDTYPE *, + const void * function(va_list *) make_arg, + const void * function(const(void) *), + const void function(void *) free_arg); +extern nothrow @nogc FORM_EXPORT!(int) set_fieldtype_choice (FIELDTYPE *, + const bool function(FIELD *,const(void) *) next_choice, + const bool function(FIELD *,const(void) *) prev_choice); + + /******************* + * FIELD routines * + *******************/ +extern nothrow @nogc FORM_EXPORT!(FIELD *) new_field (int,int,int,int,int,int); +extern nothrow @nogc FORM_EXPORT!(FIELD *) dup_field (FIELD *,int,int); +extern nothrow @nogc FORM_EXPORT!(FIELD *) link_field (FIELD *,int,int); + +extern nothrow @nogc FORM_EXPORT!(int) free_field (FIELD *); +extern nothrow @nogc FORM_EXPORT!(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *); +extern nothrow @nogc FORM_EXPORT!(int) dynamic_field_info (const FIELD *,int *,int *,int *); +extern nothrow @nogc FORM_EXPORT!(int) set_max_field ( FIELD *,int); +extern nothrow @nogc FORM_EXPORT!(int) move_field (FIELD *,int,int); +extern nothrow @nogc FORM_EXPORT!(int) set_field_type (FIELD *,FIELDTYPE *,...); +extern nothrow @nogc FORM_EXPORT!(int) set_new_page (FIELD *,bool); +extern nothrow @nogc FORM_EXPORT!(int) set_field_just (FIELD *,int); +extern nothrow @nogc FORM_EXPORT!(int) field_just (const FIELD *); +extern nothrow @nogc FORM_EXPORT!(int) set_field_fore (FIELD *,chtype); +extern nothrow @nogc FORM_EXPORT!(int) set_field_back (FIELD *,chtype); +extern nothrow @nogc FORM_EXPORT!(int) set_field_pad (FIELD *,int); +extern nothrow @nogc FORM_EXPORT!(int) field_pad (const FIELD *); +extern nothrow @nogc FORM_EXPORT!(int) set_field_buffer (FIELD *,int,const char *); +extern nothrow @nogc FORM_EXPORT!(int) set_field_status (FIELD *,bool); +extern nothrow @nogc FORM_EXPORT!(int) set_field_userptr (FIELD *, void *); +extern nothrow @nogc FORM_EXPORT!(int) set_field_opts (FIELD *,Field_Options); +extern nothrow @nogc FORM_EXPORT!(int) field_opts_on (FIELD *,Field_Options); +extern nothrow @nogc FORM_EXPORT!(int) field_opts_off (FIELD *,Field_Options); + +extern nothrow @nogc FORM_EXPORT!(chtype) field_fore (const FIELD *); +extern nothrow @nogc FORM_EXPORT!(chtype) field_back (const FIELD *); + +extern nothrow @nogc FORM_EXPORT!(bool) new_page (const FIELD *); +extern nothrow @nogc FORM_EXPORT!(bool) field_status (const FIELD *); + +extern nothrow @nogc FORM_EXPORT!(void *) field_arg (const FIELD *); + +extern nothrow @nogc FORM_EXPORT!(void *) field_userptr (const FIELD *); + +extern nothrow @nogc FORM_EXPORT!(FIELDTYPE *) field_type (const FIELD *); + +extern nothrow @nogc FORM_EXPORT!(char *) field_buffer (const FIELD *,int); + +extern nothrow @nogc FORM_EXPORT!(Field_Options) field_opts (const FIELD *); + + /****************** + * FORM routines * + ******************/ + +extern nothrow @nogc FORM_EXPORT!(FORM *) new_form (FIELD **); + +extern nothrow @nogc FORM_EXPORT!(FIELD **) form_fields (const FORM *); +extern nothrow @nogc FORM_EXPORT!(FIELD *) current_field (const FORM *); + +extern nothrow @nogc FORM_EXPORT!(WINDOW *) form_win (const FORM *); +extern nothrow @nogc FORM_EXPORT!(WINDOW *) form_sub (const FORM *); + +extern nothrow @nogc FORM_EXPORT!(Form_Hook) form_init (const FORM *); +extern nothrow @nogc FORM_EXPORT!(Form_Hook) form_term (const FORM *); +extern nothrow @nogc FORM_EXPORT!(Form_Hook) field_init (const FORM *); +extern nothrow @nogc FORM_EXPORT!(Form_Hook) field_term (const FORM *); + +extern nothrow @nogc FORM_EXPORT!(int) free_form (FORM *); +extern nothrow @nogc FORM_EXPORT!(int) set_form_fields (FORM *,FIELD **); +extern nothrow @nogc FORM_EXPORT!(int) field_count (const FORM *); +extern nothrow @nogc FORM_EXPORT!(int) set_form_win (FORM *,WINDOW *); +extern nothrow @nogc FORM_EXPORT!(int) set_form_sub (FORM *,WINDOW *); +extern nothrow @nogc FORM_EXPORT!(int) set_current_field (FORM *,FIELD *); +extern nothrow @nogc FORM_EXPORT!(int) unfocus_current_field (FORM *); +extern nothrow @nogc FORM_EXPORT!(int) field_index (const FIELD *); +extern nothrow @nogc FORM_EXPORT!(int) set_form_page (FORM *,int); +extern nothrow @nogc FORM_EXPORT!(int) form_page (const FORM *); +extern nothrow @nogc FORM_EXPORT!(int) scale_form (const FORM *,int *,int *); +extern nothrow @nogc FORM_EXPORT!(int) set_form_init (FORM *,Form_Hook); +extern nothrow @nogc FORM_EXPORT!(int) set_form_term (FORM *,Form_Hook); +extern nothrow @nogc FORM_EXPORT!(int) set_field_init (FORM *,Form_Hook); +extern nothrow @nogc FORM_EXPORT!(int) set_field_term (FORM *,Form_Hook); +extern nothrow @nogc FORM_EXPORT!(int) post_form (FORM *); +extern nothrow @nogc FORM_EXPORT!(int) unpost_form (FORM *); +extern nothrow @nogc FORM_EXPORT!(int) pos_form_cursor (FORM *); +extern nothrow @nogc FORM_EXPORT!(int) form_driver (FORM *,int); +static if (NCURSES_WIDECHAR) { +extern nothrow @nogc FORM_EXPORT!(int) form_driver_w (FORM *,int,wchar_t); +} +extern nothrow @nogc FORM_EXPORT!(int) set_form_userptr (FORM *,void *); +extern nothrow @nogc FORM_EXPORT!(int) set_form_opts (FORM *,Form_Options); +extern nothrow @nogc FORM_EXPORT!(int) form_opts_on (FORM *,Form_Options); +extern nothrow @nogc FORM_EXPORT!(int) form_opts_off (FORM *,Form_Options); +extern nothrow @nogc FORM_EXPORT!(int) form_request_by_name (const char *); + +extern nothrow @nogc FORM_EXPORT!(const char *) form_request_name (int); + +extern nothrow @nogc FORM_EXPORT!(void *) form_userptr (const FORM *); + +extern nothrow @nogc FORM_EXPORT!(Form_Options) form_opts (const FORM *); + +extern nothrow @nogc FORM_EXPORT!(bool) data_ahead (const FORM *); +extern nothrow @nogc FORM_EXPORT!(bool) data_behind (const FORM *); + +static if (NCURSES_SP_FUNCS) { +extern nothrow @nogc FORM_EXPORT!(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **); +} + +/* *INDENT-ON*/ diff --git a/source/deimos/menu.di b/source/deimos/menu.di new file mode 100644 index 0000000..87ffa57 --- /dev/null +++ b/source/deimos/menu.di @@ -0,0 +1,272 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1995,1997 * + ****************************************************************************/ + +/* $Id: menu.h,v 1.26 2020/12/12 00:38:02 tom Exp $ */ + +module deimos.menu; + +extern(C): + +version (AMIGA) { +alias TEXT = TEXT_ncurses; +} + +public import deimos.curses; +public import deimos.eti; + +// D porting note: this replaces MENU_WRAPPED_VAR and NCURSES_PUBLIC_VAR. +mixin template MENU_D_VAR(type,string name) +{ + mixin(" + extern /*MENU_IMPEXP*/ type " ~ NCURSES_PUBLIC_VAR(name) ~ "(); + @property auto " ~ name ~ "() { pragma(inline, true); return " ~ NCURSES_PUBLIC_VAR(name) ~ "(); } + "); +} + +// D porting note: "export"/"extern" must be moved to the declaration, it cannot be added here. +alias MENU_EXPORT(type) = /*MENU_IMPEXP*/ type /*NCURSES_API*/; +alias MENU_EXPORT_VAR(type) = /*MENU_IMPEXP*/ type; + + alias Menu_Options = int; + alias Item_Options = int; + +/* Menu options: */ +enum O_ONEVALUE = (0x01); +enum O_SHOWDESC = (0x02); +enum O_ROWMAJOR = (0x04); +enum O_IGNORECASE = (0x08); +enum O_SHOWMATCH = (0x10); +enum O_NONCYCLIC = (0x20); +enum O_MOUSE_MENU = (0x40); + +/* Item options: */ +enum O_SELECTABLE = (0x01); + +static if (!NCURSES_OPAQUE_MENU) { + struct TEXT + { + const(char) *str; + ushort length; + } +} /* !NCURSES_OPAQUE_MENU */ + + // struct tagMENU; + + struct tagITEM +// #if !NCURSES_OPAQUE_MENU + { + TEXT name; /* name of menu item */ + TEXT description; /* description of item, optional in display */ + tagMENU *imenu; /* Pointer to parent menu */ + void *userptr; /* Pointer to user defined per item data */ + Item_Options opt; /* Item options */ + short index; /* Item number if connected to a menu */ + short y; /* y and x location of item in menu */ + short x; + bool value; /* Selection value */ + + tagITEM *left; /* neighbor items */ + tagITEM *right; + tagITEM *up; + tagITEM *down; + + } +// #endif /* !NCURSES_OPAQUE_MENU */ + alias ITEM = tagITEM; + + alias Menu_Hook = void function (tagMENU *); + + struct tagMENU +// #if 1 /* not yet: !NCURSES_OPAQUE_MENU */ + { + short height; /* Nr. of chars high */ + short width; /* Nr. of chars wide */ + short rows; /* Nr. of items high */ + short cols; /* Nr. of items wide */ + short frows; /* Nr. of formatted items high */ + short fcols; /* Nr. of formatted items wide */ + short arows; /* Nr. of items high (actual) */ + short namelen; /* Max. name length */ + short desclen; /* Max. description length */ + short marklen; /* Length of mark, if any */ + short itemlen; /* Length of one item */ + short spc_desc; /* Spacing for descriptor */ + short spc_cols; /* Spacing for columns */ + short spc_rows; /* Spacing for rows */ + char *pattern; /* Buffer to store match chars */ + short pindex; /* Index into pattern buffer */ + WINDOW *win; /* Window containing menu */ + WINDOW *sub; /* Subwindow for menu display */ + WINDOW *userwin; /* User's window */ + WINDOW *usersub; /* User's subwindow */ + ITEM **items; /* array of items */ + short nitems; /* Nr. of items in menu */ + ITEM *curitem; /* Current item */ + short toprow; /* Top row of menu */ + chtype fore; /* Selection attribute */ + chtype back; /* Nonselection attribute */ + chtype grey; /* Inactive attribute */ + ubyte pad; /* Pad character */ + + Menu_Hook menuinit; /* User hooks */ + Menu_Hook menuterm; + Menu_Hook iteminit; + Menu_Hook itemterm; + + void *userptr; /* Pointer to menus user data */ + char *mark; /* Pointer to marker string */ + + Menu_Options opt; /* Menu options */ + ushort status; /* Internal state of menu */ + } +// #endif /* !NCURSES_OPAQUE_MENU */ + alias MENU = tagMENU; + +/* Define keys */ + +enum REQ_LEFT_ITEM = (KEY_MAX + 1); +enum REQ_RIGHT_ITEM = (KEY_MAX + 2); +enum REQ_UP_ITEM = (KEY_MAX + 3); +enum REQ_DOWN_ITEM = (KEY_MAX + 4); +enum REQ_SCR_ULINE = (KEY_MAX + 5); +enum REQ_SCR_DLINE = (KEY_MAX + 6); +enum REQ_SCR_DPAGE = (KEY_MAX + 7); +enum REQ_SCR_UPAGE = (KEY_MAX + 8); +enum REQ_FIRST_ITEM = (KEY_MAX + 9); +enum REQ_LAST_ITEM = (KEY_MAX + 10); +enum REQ_NEXT_ITEM = (KEY_MAX + 11); +enum REQ_PREV_ITEM = (KEY_MAX + 12); +enum REQ_TOGGLE_ITEM = (KEY_MAX + 13); +enum REQ_CLEAR_PATTERN = (KEY_MAX + 14); +enum REQ_BACK_PATTERN = (KEY_MAX + 15); +enum REQ_NEXT_MATCH = (KEY_MAX + 16); +enum REQ_PREV_MATCH = (KEY_MAX + 17); + +enum MIN_MENU_COMMAND = (KEY_MAX + 1); +enum MAX_MENU_COMMAND = (KEY_MAX + 17); + +/* + * Some AT&T code expects MAX_COMMAND to be out-of-band not + * just for menu commands but for forms ones as well. + */ +// #if defined(MAX_COMMAND) +// # if (MAX_MENU_COMMAND > MAX_COMMAND) +// # error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND +// # elif (MAX_COMMAND != (KEY_MAX + 128)) +// # error Something is wrong -- MAX_COMMAND is already inconsistently defined. +// # endif +// #else + enum MAX_COMMAND = (KEY_MAX + 128); +// #endif + +/* --------- prototypes for libmenu functions ----------------------------- */ + + extern nothrow @nogc MENU_EXPORT!(ITEM **) menu_items(const(MENU) *); + extern nothrow @nogc MENU_EXPORT!(ITEM *) current_item(const(MENU) *); + extern nothrow @nogc MENU_EXPORT!(ITEM *) new_item(const(char) *, const(char) *); + + extern nothrow @nogc MENU_EXPORT!(MENU *) new_menu(ITEM **); + + extern nothrow @nogc MENU_EXPORT!(Item_Options) item_opts(const(ITEM) *); + extern nothrow @nogc MENU_EXPORT!(Menu_Options) menu_opts(const(MENU) *); + + extern nothrow @nogc MENU_EXPORT!(Menu_Hook) item_init(const(MENU) *); + extern nothrow @nogc MENU_EXPORT!(Menu_Hook) item_term(const(MENU) *); + extern nothrow @nogc MENU_EXPORT!(Menu_Hook) menu_init(const(MENU) *); + extern nothrow @nogc MENU_EXPORT!(Menu_Hook) menu_term(const(MENU) *); + + extern nothrow @nogc MENU_EXPORT!(WINDOW *) menu_sub(const(MENU) *); + extern nothrow @nogc MENU_EXPORT!(WINDOW *) menu_win(const(MENU) *); + + extern nothrow @nogc MENU_EXPORT!(const(char) *) item_description(const(ITEM) *); + extern nothrow @nogc MENU_EXPORT!(const(char) *) item_name(const(ITEM) *); + extern nothrow @nogc MENU_EXPORT!(const(char) *) menu_mark(const(MENU) *); + extern nothrow @nogc MENU_EXPORT!(const(char) *) menu_request_name(int); + + extern nothrow @nogc MENU_EXPORT!(char *) menu_pattern(const(MENU) *); + + extern nothrow @nogc MENU_EXPORT!(void *) menu_userptr(const(MENU) *); + extern nothrow @nogc MENU_EXPORT!(void *) item_userptr(const(ITEM) *); + + extern nothrow @nogc MENU_EXPORT!(chtype) menu_back(const(MENU) *); + extern nothrow @nogc MENU_EXPORT!(chtype) menu_fore(const(MENU) *); + extern nothrow @nogc MENU_EXPORT!(chtype) menu_grey(const(MENU) *); + + extern nothrow @nogc MENU_EXPORT!(int) free_item(ITEM *); + extern nothrow @nogc MENU_EXPORT!(int) free_menu(MENU *); + extern nothrow @nogc MENU_EXPORT!(int) item_count(const(MENU) *); + extern nothrow @nogc MENU_EXPORT!(int) item_index(const(ITEM) *); + extern nothrow @nogc MENU_EXPORT!(int) item_opts_off(ITEM *, Item_Options); + extern nothrow @nogc MENU_EXPORT!(int) item_opts_on(ITEM *, Item_Options); + extern nothrow @nogc MENU_EXPORT!(int) menu_driver(MENU *, int); + extern nothrow @nogc MENU_EXPORT!(int) menu_opts_off(MENU *, Menu_Options); + extern nothrow @nogc MENU_EXPORT!(int) menu_opts_on(MENU *, Menu_Options); + extern nothrow @nogc MENU_EXPORT!(int) menu_pad(const(MENU) *); + extern nothrow @nogc MENU_EXPORT!(int) pos_menu_cursor(const(MENU) *); + extern nothrow @nogc MENU_EXPORT!(int) post_menu(MENU *); + extern nothrow @nogc MENU_EXPORT!(int) scale_menu(const(MENU) *, int *, int *); + extern nothrow @nogc MENU_EXPORT!(int) set_current_item(MENU *menu, ITEM *item); + extern nothrow @nogc MENU_EXPORT!(int) set_item_init(MENU *, Menu_Hook); + extern nothrow @nogc MENU_EXPORT!(int) set_item_opts(ITEM *, Item_Options); + extern nothrow @nogc MENU_EXPORT!(int) set_item_term(MENU *, Menu_Hook); + extern nothrow @nogc MENU_EXPORT!(int) set_item_userptr(ITEM *, void *); + extern nothrow @nogc MENU_EXPORT!(int) set_item_value(ITEM *, bool); + extern nothrow @nogc MENU_EXPORT!(int) set_menu_back(MENU *, chtype); + extern nothrow @nogc MENU_EXPORT!(int) set_menu_fore(MENU *, chtype); + extern nothrow @nogc MENU_EXPORT!(int) set_menu_format(MENU *, int, int); + extern nothrow @nogc MENU_EXPORT!(int) set_menu_grey(MENU *, chtype); + extern nothrow @nogc MENU_EXPORT!(int) set_menu_init(MENU *, Menu_Hook); + extern nothrow @nogc MENU_EXPORT!(int) set_menu_items(MENU *, ITEM **); + extern nothrow @nogc MENU_EXPORT!(int) set_menu_mark(MENU *, const(char) *); + extern nothrow @nogc MENU_EXPORT!(int) set_menu_opts(MENU *, Menu_Options); + extern nothrow @nogc MENU_EXPORT!(int) set_menu_pad(MENU *, int); + extern nothrow @nogc MENU_EXPORT!(int) set_menu_pattern(MENU *, const(char) *); + extern nothrow @nogc MENU_EXPORT!(int) set_menu_sub(MENU *, WINDOW *); + extern nothrow @nogc MENU_EXPORT!(int) set_menu_term(MENU *, Menu_Hook); + extern nothrow @nogc MENU_EXPORT!(int) set_menu_userptr(MENU *, void *); + extern nothrow @nogc MENU_EXPORT!(int) set_menu_win(MENU *, WINDOW *); + extern nothrow @nogc MENU_EXPORT!(int) set_top_row(MENU *, int); + extern nothrow @nogc MENU_EXPORT!(int) top_row(const(MENU) *); + extern nothrow @nogc MENU_EXPORT!(int) unpost_menu(MENU *); + extern nothrow @nogc MENU_EXPORT!(int) menu_request_by_name(const(char) *); + extern nothrow @nogc MENU_EXPORT!(int) set_menu_spacing(MENU *, int, int, int); + extern nothrow @nogc MENU_EXPORT!(int) menu_spacing(const(MENU) *, int *, int *, int *); + + extern nothrow @nogc MENU_EXPORT!(bool) item_value(const(ITEM) *); + extern nothrow @nogc MENU_EXPORT!(bool) item_visible(const(ITEM) *); + + extern nothrow @nogc MENU_EXPORT!(void) menu_format(const(MENU) *, int *, int *); + +static if (NCURSES_SP_FUNCS) { + extern nothrow @nogc MENU_EXPORT!(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN *, ITEM **); +} diff --git a/source/deimos/ncurses.di b/source/deimos/ncurses.di new file mode 100644 index 0000000..bbf1d67 --- /dev/null +++ b/source/deimos/ncurses.di @@ -0,0 +1,4 @@ +module deimos.ncurses; + +// D porting note: this file is a symbolic link in the C headers. +public import deimos.curses; diff --git a/source/deimos/ncurses/curses.d b/source/deimos/ncurses/curses.d deleted file mode 100644 index 21fa733..0000000 --- a/source/deimos/ncurses/curses.d +++ /dev/null @@ -1,1502 +0,0 @@ -/**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * - * "Software"), to deal in the Software without restriction, including * - * without limitation the rights to use, copy, modify, merge, publish, * - * distribute, distribute with modifications, sublicense, and/or sell * - * copies of the Software, and to permit persons to whom the Software is * - * furnished to do so, subject to the following conditions: * - * * - * The above copyright notice and this permission notice shall be included * - * in all copies or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * - * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * - * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * * - * Except as contained in this notice, the name(s) of the above copyright * - * holders shall not be used in advertising or otherwise to promote the * - * sale, use or other dealings in this Software without prior written * - * authorization. * - ****************************************************************************/ - -/**************************************************************************** - * Author: Zeyd M. Ben-Halim 1992,1995 * - * and: Eric S. Raymond * - * and: Thomas E. Dickey 1996-on * - ****************************************************************************/ - -/* $Id: curses.h.in,v 1.215 2010/04/29 09:46:38 tom Exp $ */ -module deimos.ncurses.curses; - -/* - * We need FILE, etc. Include this before checking any feature symbols. - */ -import core.stdc.stdio; -import core.stdc.stddef; /* we want wchar_t */ -import core.stdc.stdarg; /* we need va_list */ -import core.stdc.config; /* we need c_ulong */ - -public import deimos.ncurses.unctrl; - -//TODO check if needed... I don't have a windows machine... -version(Win32) -{ - alias wchar wint_t; -} -else -{ - alias dchar wint_t; -} - -/* These are defined only in curses.h, and are used for conditional compiles */ -immutable enum -{ - NCURSES_VERSION_MAJOR = 5, - NCURSES_VERSION_MINOR = 7, - NCURSES_VERSION_PATCH = 20101128 -} -/* This is defined in more than one ncurses header, for identification */ -string NCURSES_VERSION = "5.7"; - -extern (C) @nogc nothrow -{ - -/* types */ -alias uint chtype; -alias uint mmask_t; -alias chtype attr_t; -alias int OPTIONS; -alias void SCREEN; - - -/* attributes */ -//Thank you, Dejan Lekic, dejan.lekic @ (gmail.com || kcl.ac.uk) -immutable ubyte NCURSES_ATTR_SHIFT = 8; - -chtype NCURSES_BITS(uint mask, ubyte shift) -{ return (mask << (shift + NCURSES_ATTR_SHIFT)); } - -immutable enum :chtype -{ - A_NORMAL = (1u - 1u), - A_ATTRIBUTES = NCURSES_BITS(~(1u - 1u),0), - A_CHARTEXT = (NCURSES_BITS(1u,0) - 1u), - A_COLOR = NCURSES_BITS(((1u) << 8) - 1u,0), - A_STANDOUT = NCURSES_BITS(1u,8), - A_UNDERLINE = NCURSES_BITS(1u,9), - A_REVERSE = NCURSES_BITS(1u,10), - A_BLINK = NCURSES_BITS(1u,11), - A_DIM = NCURSES_BITS(1u,12), - A_BOLD = NCURSES_BITS(1u,13), - A_ALTCHARSET = NCURSES_BITS(1u,14), - A_INVIS = NCURSES_BITS(1u,15), - A_PROTECT = NCURSES_BITS(1u,16), - A_HORIZONTAL = NCURSES_BITS(1u,17), - A_LEFT = NCURSES_BITS(1u,18), - A_LOW = NCURSES_BITS(1u,19), - A_RIGHT = NCURSES_BITS(1u,20), - A_TOP = NCURSES_BITS(1u,21), - A_VERTICAL = NCURSES_BITS(1u,22), - -/* - * X/Open attributes. In the ncurses implementation, they are identical to the - * A_ attributes. - */ - WA_ATTRIBUTES = A_ATTRIBUTES, - WA_NORMAL = A_NORMAL, - WA_STANDOUT = A_STANDOUT, - WA_UNDERLINE = A_UNDERLINE, - WA_REVERSE = A_REVERSE, - WA_BLINK = A_BLINK, - WA_DIM = A_DIM, - WA_BOLD = A_BOLD, - WA_ALTCHARSET = A_ALTCHARSET, - WA_INVIS = A_INVIS, - WA_PROTECT = A_PROTECT, - WA_HORIZONTAL = A_HORIZONTAL, - WA_LEFT = A_LEFT, - WA_LOW = A_LOW, - WA_RIGHT = A_RIGHT, - WA_TOP = A_TOP, - WA_VERTICAL = A_VERTICAL -} - - -immutable enum :chtype -{ - /* colors */ - COLOR_BLACK = 0, - COLOR_RED = 1, - COLOR_GREEN = 2, - COLOR_YELLOW = 3, - COLOR_BLUE = 4, - COLOR_MAGENTA = 5, - COLOR_CYAN = 6, - COLOR_WHITE = 7 -} - - -/* global variables */ -extern __gshared WINDOW* stdscr; -extern __gshared WINDOW* curscr; -extern __gshared WINDOW* newscr; -extern __gshared char[] ttytype; -extern __gshared int COLORS; -extern __gshared int COLOR_PAIRS; -extern __gshared int LINES; -extern __gshared int COLS; -extern __gshared int TABSIZE; -extern __gshared int ESCDELAY; -extern __gshared chtype[256] acs_map; - - - -/* acs symbols */ -/* VT100 symbols begin here */ - -@property auto ACS_ULCORNER()() -{ return acs_map[cast(ubyte)'l']; } -@property auto ACS_LLCORNER()() -{ return acs_map[cast(ubyte)'m']; } -@property auto ACS_URCORNER()() -{ return acs_map[cast(ubyte)'k']; } -@property auto ACS_LRCORNER()() -{ return acs_map[cast(ubyte)'j']; } -@property auto ACS_LTEE()() -{ return acs_map[cast(ubyte)'t']; } -@property auto ACS_RTEE()() -{ return acs_map[cast(ubyte)'u']; } -@property auto ACS_BTEE()() -{ return acs_map[cast(ubyte)'v']; } -@property auto ACS_TTEE()() -{ return acs_map[cast(ubyte)'w']; } -@property auto ACS_HLINE()() -{ return acs_map[cast(ubyte)'q']; } -@property auto ACS_VLINE()() -{ return acs_map[cast(ubyte)'x']; } -@property auto ACS_PLUS()() -{ return acs_map[cast(ubyte)'n']; } -@property auto ACS_S1()() -{ return acs_map[cast(ubyte)'o']; } -@property auto ACS_S9()() -{ return acs_map[cast(ubyte)'s']; } -@property auto ACS_DIAMOND()() -{ return acs_map[cast(ubyte)'`']; } -@property auto ACS_CKBOARD()() -{ return acs_map[cast(ubyte)'a']; } -@property auto ACS_DEGREE()() -{ return acs_map[cast(ubyte)'f']; } -@property auto ACS_PLMINUS()() -{ return acs_map[cast(ubyte)'g']; } -@property auto ACS_BULLET()() -{ return acs_map[cast(ubyte)'~']; } - -/* Teletype 5410v1 symbols begin here */ -@property auto ACS_LARROW()() -{ return acs_map[cast(ubyte)',']; } -@property auto ACS_RARROW()() -{ return acs_map[cast(ubyte)'+'];} -@property auto ACS_DARROW()() -{ return acs_map[cast(ubyte)'.']; } -@property auto ACS_UARROW()() -{ return acs_map[cast(ubyte)'-']; } -@property auto ACS_BOARD()() -{ return acs_map[cast(ubyte)'h']; } -@property auto ACS_LANTERN()() -{ return acs_map[cast(ubyte)'i']; } -@property auto ACS_BLOCK()() -{ return acs_map[cast(ubyte)'0']; } - -/* - * These aren't documented, but a lot of System Vs have them anyway - * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings). - * The ACS_names may not match AT&T's, our source didn't know them. - */ -@property auto ACS_S3()() -{ return acs_map[cast(ubyte)'p']; } -@property auto ACS_S7()() -{ return acs_map[cast(ubyte)'r']; } -@property auto ACS_LEQUAL()() -{ return acs_map[cast(ubyte)'y']; } -@property auto ACS_GEQUAL()() -{ return acs_map[cast(ubyte)'z']; } -@property auto ACS_PI()() -{ return acs_map[cast(ubyte)'{']; } -@property auto ACS_NEQUAL()() -{ return acs_map[cast(ubyte)'|']; } -@property auto ACS_STERLING()() -{ return acs_map[cast(ubyte)'}']; } - -/* - * Line drawing ACS names are of the form ACS_trbl, where t is the top, r - * is the right, b is the bottom, and l is the left. t, r, b, and l might - * be B (blank), S (single), D (double), or T (thick). The subset defined - * here only uses B and S. - */ -@property auto ACS_BSSB()() -{ return ACS_ULCORNER(); } -@property auto ACS_SSBB()() -{ return ACS_LLCORNER(); } -@property auto ACS_BBSS()() -{ return ACS_URCORNER(); } -@property auto ACS_SBBS()() -{ return ACS_LRCORNER(); } -@property auto ACS_SBSS()() -{ return ACS_RTEE(); } -@property auto ACS_SSSB()() -{ return ACS_LTEE(); } -@property auto ACS_SSBS()() -{ return ACS_BTEE(); } -@property auto ACS_BSSS()() -{ return ACS_TTEE(); } -@property auto ACS_BSBS()() -{ return ACS_HLINE(); } -@property auto ACS_SBSB()() -{ return ACS_VLINE(); } -@property auto ACS_SSSS()() -{ return ACS_PLUS(); } - - -/* error codes */ -immutable enum -{ - OK = 0, - ERR = -1 -} - -immutable enum -{ - /* values for the _flags member */ - _SUBWIN = 0x01, /* is this a sub-window? */ - _ENDLINE = 0x02, /* is the window flush right? */ - _FULLWIN = 0x04, /* is the window full-screen? */ - _SCROLLWIN = 0x08, /* bottom edge is at screen bottom? */ - _ISPAD = 0x10, /* is this window a pad? */ - _HASMOVED = 0x20, /* has cursor moved since last refresh? */ - _WRAPPED = 0x40 /* cursor was just wrappped */ -} - -/* - * this value is used in the firstchar and lastchar fields to mark - * unchanged lines - */ -immutable int _NOCHANGE = -1; - -/* - * this value is used in the oldindex field to mark lines created by insertions - * and scrolls. - */ -immutable int _NEWINDEX = -1; - -/* - * cchar_t stores an array of CCHARW_MAX wide characters. The first is - * normally a spacing character. The others are non-spacing. If those - * (spacing and nonspacing) do not fill the array, a null L'\0' follows. - * Otherwise, a null is assumed to follow when extracting via getcchar(). - */ -immutable size_t CCHARW_MAX = 5; - -struct cchar_t -{ - attr_t attr; - wchar_t[CCHARW_MAX] chars; - int ext_color; -} -static assert (cchar_t.sizeof == 28); - -struct WINDOW -{ - short cury, curx; - short maxy, maxx; - short begy, begx; - short flags; - - attr_t attrs; - chtype bkgd; - bool notimeout, - clear, - leaveok, - scroll, - idlok, - idcok, - immed, - sync, - use_keypad; - int delay; - void* line; - short regtop, - regbottom; - int parx, - pary; - WINDOW* parent; - - struct pdat - { - short pad_y, pad_x, - pad_top, pad_left, - pad_bottom, pad_right; - } - pdat pad; - - short yoffset; - cchar_t bkgrnd; -} - -struct _nc_event -{ - int type; - union data - { - long timeout_msec; /* _NC_EVENT_TIMEOUT_MSEC */ - struct fev - { - uint flags; - int fd; - uint result; - } /* _NC_EVENT_FILE */ - } -} - - -struct _nc_eventlist -{ - int count; - int result_flags; /* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */ - _nc_event*[1] events; -} - -int wgetch_events(WINDOW* win, _nc_eventlist* nc); /* experimental */ -int wgetnstr_events(WINDOW* win, char* str, int one, _nc_eventlist* nc);/* experimental */ - - -/* - * Function prototypes. This is the complete X/Open Curses list of required - * functions. Those marked `generated' will have sources generated from the - * macro definitions later in this file, in order to satisfy XPG4.2 - * requirements. - */ - -int addch(C:chtype)(C ch) -{ return waddch(stdscr, ch); } -int addchnstr(C:chtype, N:int)(C* chstr, N n) -{ return waddchnstr(stdscr, chstr, n); } -int addchstr(C:chtype)(C* chstr) -{ return waddchstr(stdscr, str); } -int addnstr(C:const char, N:int)(C* str, N n) -{ return waddnstr(stdscr, str, n); } -int addstr(C:const char)(C* str) -{ return waddnstr(stdscr, str, -1); } -int attroff(N:chtype)(N attrs) -{ return wattroff(stdscr, attrs); } -int attron(N:chtype)(N attrs) -{ return wattron(stdscr, attrs); } -int attrset(N:chtype)(N attrs) -{ return wattrset(stdscr, attrs); } -int attr_get(A:attr_t, S:short, V:void)(A* attrs, S* pair, V* opts) -{ return wattr_get(stdscr, attrs, pair, opts); } -int attr_off(A:attr_t, V:void)(A attrs, V* opts) -{ return wattr_off(stdscr, attrs, opts); } -int attr_on(A:attr_t, V:void)(A attrs, V* opts) -{ return wattr_on(stdscr, attrs, opts); } -int attr_set(A:attr_t, S:short, V:void)(A attrs, S pair, V* opts) -{ return wattr_set(stdscr, attrs, pair, opts); } -int baudrate(); -int beep(); -int bkgd(C:chtype)(C ch) -{ return wbkgd(stdscr, ch); } -void bkgdset(C:chtype)(C ch) -{ return wbkgdset(stdscr, ch); } -int border(C:chtype)(C ls, C rs, C ts, C bs, C tl, C tr, C bl, C br) -{ return wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br); } -int box(W:WINDOW, C:chtype)(W* win, C verch, C horch) -{ return wborder(win, verch, verch, horch, horch, 0, 0, 0, 0); } -bool can_change_color(); -int cbreak(); -int chgat(N:int, A:attr_t, S:short, V:void)(N n, A attr, S color, V* opts) -{ return wchgat(stdscr, n, attr, color, opts); } -int clear()() -{ return wclear(stdscr); } -int clearok(WINDOW* win, bool bf); -int clrtobot()() -{ return wclrtobot(stdscr); } -int clrtoeol()() -{ return wclrtoeol(stdscr); } -int color_content(short color, short* r, short* g, short* b); -int color_set(N:short, V:void)(N color_pair_number, V* opts) -{ return wcolor_set(stdscr, color_pair_number, opts); } -chtype COLOR_PAIR(N:int)(N n) -{ return NCURSES_BITS(n, 0); } -int copywin(WINDOW* srcwin, WINDOW* dstwin, int sminrow, - int smincol, int dminrow, int dmincol, int dmaxrow, - int dmaxcol, int overlay); -int curs_set(int visibility); -int def_prog_mode(); -int def_shell_mode(); -int delay_output(int ms); -int delch()() -{ return wdelch(stdscr); } -void delscreen(SCREEN* sp); -int delwin(WINDOW* win); -int deleteln()() -{ return winsdelln(stdscr, -1); } -WINDOW* derwin(WINDOW* orig, int nlines, int ncols, int begin_y, int begin_x); -int doupdate(); -WINDOW* dupwin(WINDOW* win); -int echo(); -int echochar(C:chtype)(C ch) -{ return wechochar(stdscr, ch); } -int erase()() -{ return werase(stdscr); } -int endwin(); -char erasechar(); -void filter(); -int flash(); -int flushinp(); -chtype getbkgd(W:WINDOW)(W* win) -{ return win.bkgd; } -int getch()() -{ return wgetch(stdscr); } -int getnstr(C:char, N:int)(C* str, N n) -{ return wgetnstr(stdscr, str, n); } -int getstr(C:char)(C* str) -{ return wgetstr(stdscr, str); } -WINDOW* getwin(FILE* filep); -int halfdelay(int tenths); -bool has_colors(); -bool has_ic(); -bool has_il(); -int hline(C:chtype, N:int)(C ch, N n) -{ return whline(stdscr, ch, n); } -void idcok(WINDOW* win, bool bf); -int idlok(WINDOW* win, bool bf); -void immedok(WINDOW* win, bool bf); -chtype inch()() -{ return winch(stdscr); } -int inchnstr(C:chtype, N:int)(C* chstr, N n) -{ return winchnstr(stdscr, chstr, n); } -int inchstr(C:chtype)(C* chstr) -{ return winchstr(stdscr, chstr); } -WINDOW* initscr(); -int init_color(short color, short r, short g, short b); -int init_pair(short pair, short f, short b); -int innstr(C:char, N:int)(C* str, N n) -{ return winnstr(stdscr, str, n); } -int insch(CH:chtype)(CH ch) -{ return winsch(stdscr, ch); } -int insdelln(N:int)(N n) -{ return winsdelln(stdscr, n); } -int insertln()() -{ return winsdelln(stdscr, 1); } -int insnstr(C:char, N:int)(C* str, N n) -{ return winsnstr(stdscr, str, n); } -int insstr(C:char)(C* str) -{ return winsstr(stdscr, str); } -int instr(C:char)(C* str) -{ return winstr(stdscr, str); } -int intrflush(WINDOW* win, bool bf); -bool isendwin(); -bool is_linetouched(WINDOW* win, int line); -bool is_wintouched(WINDOW* win); -char* keyname(int c); -int keypad(WINDOW* win, bool bf); -char killchar(); -int leaveok(WINDOW* win, bool bf); -char* longname(); -int meta(WINDOW* win, bool bf); -int move(N:int)(N y, N x) -{ return wmove(stdscr, y, x); } -int mvaddch(N:int, C:chtype)(N y, N x, C ch) -{ return mvwaddch(stdscr, y, x, ch); } -int mvaddch(N:int, C:char)(N y, N x, C ch) -{ return mvwaddch(stdscr, y, x, ch); } -int mvaddchnstr(N:int, C:chtype)(N y, N x, C* chstr, N n)///ditto -{ return mvwaddchnstr(stdscr, y, x, chstr, n); } -int mvaddchstr(N:int, C:chtype)(N y, N x, C* chstr)///ditto -{ return mvwaddchstr(stdscr, y, x, str); } -int mvaddnstr(N:int, C:const char)(N y, N x, C* str, N n) -{ return mvwaddnstr(stdscr, y, x, str, n); } -int mvaddstr(N:int, C:const char)(N y, N x, C* str) -{ return mvwaddstr(stdscr, y, x, str); } -int mvchgat(N:int, A:attr_t, S:short, V:void) - (N y, N x, N n, A attr, S color, V* opts) -{ return mvwchgat(stdscr, y, x, n, attr, color, opts); } -int mvcur(int,int,int,int); -int mvdelch(N:int)(N y, N x) -{ return mvwdelch(stdscr, y, x); } -int mvderwin(WINDOW* win, int par_y, int par_x); -int mvgetch(N:int)(N y, N x) -{ return mvwgetch(stdscr, y, x); } -int mvgetnstr(N:int, C:char)(N y, N x, C* str, N n) -{ return mvwgetnstr(stdscr, y, x, str, n); } -int mvgetstr(N:int, C:char)(N y, N x, C* str) -{ return mvwgetstr(stdscr, y, x, str); } -int mvhline(N:int, C:chtype)(N y, N x, C ch, N n) -{ return mvwhline(stdscr, y, x, ch, n); } -chtype mvinch(N:int)(N y, N x) -{ return mvwinch(stdscr, y, x); } -int mvinchnstr(N:int, C:chtype)(N y, N x, C* chstr, N n) -{ return mvwinchnstr(stdscr, y, x, chstr, n); } -int mvinchstr(N:int, C:chtype)(N y, N x, C* chstr) -{ return mvwinchstr(stdscr, y, x, chstr); } -int mvinnstr(N:int, C:char)(N y, N x, C* str, N n) -{ return mvwinnstr(stdscr, y, x, str, n); } -int mvinsch(N:int, CH:chtype)(N y, N x, CH ch) -{ return mvwinsch(stdscr, y, x, ch); } -int mvinsnstr(N:int, C:char)(N y, N x, C* str, N n) -{ return mvwinsnstr(stdscr, y, x, str, n); } -int mvinsstr(N:int, C:char)(N y, N x, C* str) -{ return mvwinsstr(stdscr, y, x, str); } -int mvinstr(N:int, C:char)(N y, N x, C* str) -{ return mvwinstr(stdscr, y, x, str); } -int mvprintw(int y, int x, const char* fmt, ...); -int mvscanw(int y, int x, const char* fmt, ...); -int mvvline(N:int, C:chtype)(N y, N x, C ch, N n) -{ return mvwvline(stdscr, y, x, ch, n); } -int mvwaddch(W:WINDOW, N:int, C:chtype)(W* win, N y, N x, C ch) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return waddch(win, ch); -} -int mvwaddch(W:WINDOW, N:int, C:char)(W* win, N y, N x, C ch) -{ return mvwaddch(win, y, x, cast(chtype)ch); } -int mvwaddchnstr(W:WINDOW, N:int, C:chtype) - (W* win, N y, N x, C* chstr, N n) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return waddchnstr(win, chstr, n); -} -int mvwaddchstr(W:WINDOW, N:int, C:chtype) - (W* win, N y, N x, C* chstr) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return waddchnstr(win, chstr, -1); -} -int mvwaddnstr(W:WINDOW, N:int, C:const char)(W* win, N y, N x, C* str, N n) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return waddnstr(win, str, n); -} -int mvwaddstr(W:WINDOW, N:int, C:const char)(W* win, N y, N x, C* str) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return waddnstr(win, str, -1); -} -int mvwchgat(W:WINDOW, N:int, A:attr_t, S:short, V:void) - (W* win, N y, N x, N n, A attr, S color, V* opts) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return wchgat(win, n, attr, color, opts); -} -int mvwdelch(W:WINDOW, N:int)(W* win, N y, N x) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return wdelch(win); -} -int mvwgetch(W:WINDOW, N:int)(W* win, N y, N x) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return wgetch(win); -} -int mvwgetnstr(W:WINDOW, N:int, C:char)(W* win, N y, N x, C* str, N n) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return wgetnstr(win, str, n); -} -int mvwgetstr(W:WINDOW, N:int, C:char)(W* win, N y, N x, C* str) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return wgetstr(win, str); -} -int mvwhline(W:WINDOW, N:int, C:chtype)(W* win, N y, N x, C ch, N n) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return whline(win, ch, n); -} -int mvwin(WINDOW* win, int y, int x); -chtype mvwinch(W:WINDOW, N:int)(W* win, N y, N x) -{ - if(wmove(win, y, x) == ERR) - return cast(chtype)ERR; - return winch(win); -} -int mvwinchnstr(W:WINDOW, N:int, C:chtype)(W* win, N y, N x, C* chstr, N n) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return winchnstr(win, chstr, n); -} -int mvwinchstr(W:WINDOW, N:int, C:chtype)(W* win, N y, N x, C* chstr) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return winchstr(win, chstr); -} -int mvwinnstr(W:WINDOW, N:int, C:char)(W* win, N y, N x, C* str, N n) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return winnstr(win, str, n); -} -int mvwinsch(W:WINDOW, N:int, CH:chtype)(W* win, N y, N x, CH ch) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return winsch(win, ch); -} -int mvwinsnstr(W:WINDOW, N:int, C:char)(W* win, N y, N x, char* str, N n) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return winsnstr(win, str, n); -} -int mvwinsstr(W:WINDOW, N:int, C:char)(W* win, N y, N x, C* str) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return winsstr(win, str); -} -int mvwinstr(W:WINDOW, N:int, C:char)(W* win, N y, N x, C* str) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return winstr(win, str); -} -int mvwprintw(WINDOW* win, int y, int x, const char* fmt, ...); -int mvwscanw(WINDOW* win, int y, int x, const char* fmt, ...); -int mvwvline(W:WINDOW, N:int, C:chtype)(W* win, N y, N x, C ch, N n) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return wvline(win, ch, n); -} -int napms(int ms); -WINDOW* newpad(int nlines, int ncols); -SCREEN* newterm(char* type, FILE* outfd, FILE* infd); -WINDOW* newwin(int nlines, int ncols, int begin_y, int begin_x); -int nl(); -int nocbreak(); -int nodelay(WINDOW *win, bool bf); -int noecho(); -int nonl(); -void noqiflush(); -int noraw(); -int notimeout(WINDOW *win, bool bf); -int overlay(WINDOW* srcwin, WINDOW* dstwin); -int overwrite(WINDOW* srcwin, WINDOW* dstwin); -int pair_content(short pair, short* f, short* b); -//TODO check this, .h returns an int. and accepts an int... -short PAIR_NUMBER(A:attr_t)(A attrs) -{ return (attrs & A_COLOR) >> 8; } -int pechochar(WINDOW* pad, chtype ch); -int pnoutrefresh(WINDOW* pad, int pminrow, int pmincol, - int sminrow, int smincol, int smaxrow, int smaxcol); -int prefresh(WINDOW* pad, int pminrow, int pmincol, - int sminrow, int smincol, int smaxrow, int smaxcol); -int printw(const char* fmt, ...); -int putwin(WINDOW* win, FILE* filep); -void qiflush(); -int raw(); -int redrawwin(W:WINDOW)(W* win) -{ return wredrawln(win, 0, win.maxy+1); } -int refresh()() -{ return wrefresh(stdscr); } -int resetty(); -int reset_prog_mode(); -int reset_shell_mode(); -int ripoffline(int line, int function(WINDOW* win, int cols) init); -int savetty(); -int scanw(const char* fmt, ...); -int scr_dump(char *filename); -int scr_init(char *filename); -int scrl(N:int)(N n) -{ return wscrl(stdscr, n); } -int scroll(W:WINDOW)(W* win) -{ return wscrl(win, 1); } -int scrollok(WINDOW* win, bool bf); -int scr_restore(char *filename); -int scr_set(char *filename); -int setscrreg(N:int)(N top, N bot) -{ return wsetscrreg(stdscr, top, bot); } -SCREEN* set_term(SCREEN* newscreen); -int slk_attroff(chtype attrs); -int slk_attr_off(A:attr_t, V:void)(A attrs, V* opts) -{ - if(opts == null) - return ERR; - return slk_attroff(a); -} -int slk_attron(chtype attrs); -int slk_attr_on(A:attr_t, V:void)(A attrs, V* opts) -{ - if(opts == null) - return ERR; - return slk_attron(a); -} -int slk_attrset(chtype attrs); -attr_t slk_attr(); -int slk_attr_set(attr_t attrs, short color_pair_number, void* opts); -int slk_clear(); -int slk_color(short color_pair_number); -int slk_init(int fmt); -char* slk_label(int labnum); -int slk_noutrefresh(); -int slk_refresh(); -int slk_restore(); -int slk_set(int labnum, char* label, int fmt); -int slk_touch(); -int standout()() -{ return wstandout(stdscr); } -int standend()() -{ return wstandend(stdscr); } -int start_color(); -WINDOW* subpad(WINDOW* orig, int nlines, int ncols, int begin_y, int begin_x); -WINDOW* subwin(WINDOW* orig, int nlines, int ncols, int begin_y, int begin_x); -int syncok(WINDOW* win, bool bf); -chtype termattrs(); -char* termname(); -void timeout(N:int)(N delay) -{ return wtimeout(stdscr, delay); } -int touchline(W:WINDOW, N:int)(W* win, N start, N count) -{ return wtouchln(win, start, count, 1); } -int touchwin(W:WINDOW)(W* win) -{ return wtouchln(win, 0, getmaxy(win), 1); } -int typeahead(int fd); -int ungetch(int ch); -int untouchwin(W:WINDOW)(W* win) -{ return wtouchln(win, 0, getmaxy(win), 0); } -void use_env(bool f); -int vidattr(chtype c); -int vidputs(chtype, int function(int)); -int vline(C:chtype, N:int)(C ch, N n) -{ return wvline(stdscr, ch, n); } -int vwprintw(WINDOW* win, const char* fmt, va_list varglist); -int vw_printw(W:WINDOW, C:const char, V:va_list)(W* win, C* fmt, V varglist) -{ return vwprintw(win, fmt, varglist); } -int vw_scanw(W:WINDOW, C:char, V:va_list)(W* win, C* fmt, V varglist) -{ return vwscanw(win, fmt, varglist); } -int vwscanw(WINDOW* win, char* fmt, va_list varglist); -int waddch(WINDOW* win, chtype ch); -int waddchnstr(WINDOW* win, chtype* chstr, int n); -int waddchstr(W:WINDOW, C:chtype)(W* win, C* chstr) -{ return waddchnstr(win, chstr, -1); } -int waddnstr(WINDOW* win, const char* str, int n); -int waddstr(W:WINDOW, C:const char)(W* win, C* str) -{ return waddnstr(win, str, -1); } -int wattron(W:WINDOW, N:chtype)(W* win, N attrs) -{ return wattr_on(win, cast(attr_t)attrs, null); } -int wattroff(W:WINDOW, N:chtype)(W* win, N attrs) -{ return wattr_off(win, attrs, null); } -int wattrset(W:WINDOW, N:chtype)(W* win, N attrs) -{ - if(win == null) return ERR; - win.attrs = attrs; - return OK; -} -int wattr_get(W:WINDOW, A:attr_t, S:short, V:void) - (W* win, A* attrs, S* pair, V* opts) -{ - if(attrs == null || pair == null) - return ERR; - - *attrs = win.attrs; - *pair = PAIR_NUMBER(win.attrs); - return OK; -} -int wattr_on(WINDOW* win, attr_t attrs, void* opts); -int wattr_off(WINDOW* win, attr_t attrs, void* opts); -int wattr_set(W:WINDOW, A:attr_t, S:short, V:void) - (W* win, A attrs, S pair, V* opts) -{ win.attrs = (attrs & ~A_COLOR) | COLOR_PAIR(pair); return OK; } -int wbkgd(WINDOW* win, chtype ch); -void wbkgdset(WINDOW* win, chtype ch); -int wborder(WINDOW* win, chtype ls, chtype rs, - chtype ts, chtype bs, chtype tl, chtype tr, - chtype bl, chtype br); -int wchgat(WINDOW* win, int n, attr_t attr, short color, void* opts); -int wclear(WINDOW* win); -int wclrtobot(WINDOW* win); -int wclrtoeol(WINDOW* win); -int wcolor_set(WINDOW* win, short color_pair_number, void* opts); -void wcursyncup(WINDOW* win); -int wdelch(WINDOW* win); -int wdeleteln(W:WINDOW)(W* win) -{ return winsdelln(win, -1); } -int wechochar(WINDOW* win, chtype ch); -int werase(WINDOW* win); -int wgetch(WINDOW* win); -int wgetnstr(WINDOW* win, char* str, int n); -int wgetstr(W:WINDOW, C:char)(W* win, C* str) -{ return wgetnstr(win, str, -1); } -int whline(WINDOW* win, chtype ch, int n); -chtype winch(WINDOW* win); -int winchnstr(WINDOW* win, chtype* chstr, int n); -int winchstr(W:WINDOW, C:chtype)(W* win, C* chstr) -{ return winchnstr(win, chstr, -1); } -int winnstr(WINDOW* win, char* str, int n); -int winsch(WINDOW* win, chtype ch); -int winsdelln(WINDOW* win, int n); -int winsertln(W:WINDOW)(W* win) -{ return winsdelln(win, 1); } -int winsnstr(WINDOW* win, char* str, int n); -int winsstr(W:WINDOW, C:char)(W* win, C* str) -{ return winsnstr(win, str, -1); } -int winstr(W:WINDOW, C:char)(W* win, C* str) -{ return winnstr(win, str, -1); } -int wmove(WINDOW* win, int y, int x); -int wnoutrefresh(WINDOW* win); -int wprintw(WINDOW* win, const char* fmt, ...); -int wredrawln(WINDOW* win, int beg_line, int num_lines); -int wrefresh(WINDOW* win); -int wscanw(WINDOW* win, const char* fmt, ...); -int wscrl(WINDOW *win, int n); -int wsetscrreg(WINDOW* win, int top, int bot); -int wstandout(W:WINDOW)(W* win) -{ return wattrset(win, A_STANDOUT); } -int wstandend(W:WINDOW)(W* win) -{ return wattrset(win, A_NORMAL); } -void wsyncdown(WINDOW* win); -void wsyncup(WINDOW* win); -void wtimeout(WINDOW *win, int delay); -int wtouchln(WINDOW* win, int y, int n, int changed); -int wvline(WINDOW* win, chtype ch, int n); - -/* - * These are also declared in : - */ -int tigetflag(char *); -int tigetnum(char *); -char* tigetstr (char *); -int putp (char *); - -//#if NCURSES_TPARM_VARARGS | Set to 1 on my system... -char* tparm (char *, ...); -//endif -char* tiparm(const char*, ...); /* special */ - - -/* - * These functions are not in X/Open, but we use them in macro definitions: - */ - -int getattrs(U:WINDOW)(U win) -{ return win ? win.curx : ERR; } -int getcurx(U:WINDOW*)(U win) -{ return win ? win.curx : ERR; } -int getcury(U:WINDOW*)(U win) -{ return win ? win.cury : ERR; } -int getbegx(U:WINDOW*)(U win) -{ return win ? win.begx : ERR; } -int getbegy(U:WINDOW*)(U win) -{ return win ? win.begy : ERR; } -int getmaxx(U:WINDOW*)(U win) -{ return win ? win.maxx : ERR; } -int getmaxy(U:WINDOW*)(U win) -{ return win ? win.maxy : ERR; } -int getparx(U:WINDOW*)(U win) -{ return win ? win.parx : ERR; } -int getpary(U:WINDOW*)(U win) -{ return win ? win.pary : ERR; } - -/* - * vid_attr() was implemented originally based on a draft of X/Open curses. - */ -int vid_attr()(chtype a, ...) -{ return vidattr(a); } - - -/* - * These functions are extensions - not in X/Open Curses. - */ - //TODO Check - -bool is_term_resized(int lines, int columns); -char* keybound(int keycode, int count); -char* curses_version(); -int assume_default_colors(int fg, int bg); -int define_key(char* definition, int keycode); -int get_escdelay(); -int key_defined(char* definition); -int keyok(int keycode, bool enable); -int resize_term(int lines, int columns); -int resizeterm(int lines, int columns); -int set_escdelay(int i); -//TODO check -int set_tabsize(int i); -int use_default_colors(); -int use_extended_names(bool enable); -int use_legacy_coding(int i); -//TODO check, I might not have gotten the function pointer alias correct. -int use_screen(SCREEN* scr, NCURSES_SCREEN_CB, void* v); -int use_window(WINDOW* win, NCURSES_WINDOW_CB, void* v); -int wresize(WINDOW* win, int lines, int columns); -void nofilter(); - - -/* - * These extensions provide access to information stored in the WINDOW even - * when NCURSES_OPAQUE is set: - */ -//TODO implement -//extern NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW *); /* generated */ -//extern NCURSES_EXPORT(bool) is_cleared (const WINDOW *); /* generated */ -//extern NCURSES_EXPORT(bool) is_idcok (const WINDOW *); /* generated */ -//extern NCURSES_EXPORT(bool) is_idlok (const WINDOW *); /* generated */ -//extern NCURSES_EXPORT(bool) is_immedok (const WINDOW *); /* generated */ -//extern NCURSES_EXPORT(bool) is_keypad (const WINDOW *); /* generated */ -//extern NCURSES_EXPORT(bool) is_leaveok (const WINDOW *); /* generated */ -//extern NCURSES_EXPORT(bool) is_nodelay (const WINDOW *); /* generated */ -//extern NCURSES_EXPORT(bool) is_notimeout (const WINDOW *); /* generated */ -//extern NCURSES_EXPORT(bool) is_pad (const WINDOW *); /* generated */ -//extern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *); /* generated */ -//extern NCURSES_EXPORT(bool) is_subwin (const WINDOW *); /* generated */ -//extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *); /* generated */ -//extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generated */ - -/* A few macros.. */ - -void getyx(U:WINDOW*, T: int)(U win, ref T y, ref T x) -{ - y = getcury(win); - x = getcurx(win); -} -void getparyx(U:WINDOW*, T: int)(U win, ref T y, ref T x) -{ - y = getpary(win); - x = getparx(win); -} -void getmaxyx(U:WINDOW*, T: int)(U win, ref T y, ref T x) -{ - y = getmaxy(win); - x = getmaxx(win); -} -void getbegyx(U:WINDOW*, T: int)(U win, ref T y, ref T x) -{ - y = getbegy(win); - x = getbegx(win); -} - - - -/* - * Pseudo-character tokens outside ASCII range. The curses wgetch() function - * will return any given one of these only if the corresponding k- capability - * is defined in your terminal's terminfo entry. - * - * Some keys (KEY_A1, etc) are arranged like this: - * a1 up a3 - * left b2 right - * c1 down c3 - * - * A few key codes do not depend upon the terminfo entry. - */ - -immutable enum :int -{ - KEY_CODE_YES = 0x100, - KEY_MIN = 0x101, - KEY_BREAK = 0x101, -/* - * These definitions were generated by /build/buildd/ncurses-5.7+20101128/include/MKkey_defs.sh /build/buildd/ncurses-5.7+20101128/include/Caps - */ - KEY_DOWN = 0x102, - KEY_UP = 0x103, - KEY_LEFT = 0x104, - KEY_RIGHT = 0x105, - KEY_HOME = 0x106, - KEY_BACKSPACE = 0x107, - KEY_F0 = 0x108, - KEY_DL = 0x148, - KEY_IL = 0x149, - KEY_DC = 0x14A, - KEY_IC = 0x14B, - KEY_EIC = 0x14C, - KEY_CLEAR = 0x14D, - KEY_EOS = 0x14E, - KEY_EOL = 0x14F, - KEY_SF = 0x150, - KEY_SR = 0x151, - KEY_NPAGE = 0x152, - KEY_PPAGE = 0x153, - KEY_STAB = 0x154, - KEY_CTAB = 0x155, - KEY_CATAB = 0x156, - KEY_ENTER = 0x157, - KEY_SRESET = 0x158, - KEY_RESET = 0x159, - KEY_PRINT = 0x15A, - KEY_LL = 0x15B, - KEY_A1 = 0x15C, - KEY_A3 = 0x15D, - KEY_B2 = 0x15E, - KEY_C1 = 0x15F, - KEY_C3 = 0x160, - KEY_BTAB = 0x161, - KEY_BEG = 0x162, - KEY_CANCEL = 0x163, - KEY_CLOSE = 0x164, - KEY_COMMAND = 0x165, - KEY_COPY = 0x166, - KEY_CREATE = 0x167, - KEY_END = 0x168, - KEY_EXIT = 0x169, - KEY_FIND = 0x16A, - KEY_HELP = 0x16B, - KEY_MARK = 0x16C, - KEY_MESSAGE = 0x16D, - KEY_MOVE = 0x16E, - KEY_NEXT = 0x16F, - KEY_OPEN = 0x170, - KEY_OPTIONS = 0x171, - KEY_PREVIOUS = 0x172, - KEY_REDO = 0x173, - KEY_REFERENCE = 0x174, - KEY_REFRESH = 0x175, - KEY_REPLACE = 0x176, - KEY_RESTART = 0x177, - KEY_RESUME = 0x178, - KEY_SAVE = 0x179, - KEY_SBEG = 0x17A, - KEY_SCANCEL = 0x17B, - KEY_SCOMMAND = 0x17C, - KEY_SCOPY = 0x17D, - KEY_SCREATE = 0x17E, - KEY_SDC = 0x17F, - KEY_SDL = 0x180, - KEY_SELECT = 0x181, - KEY_SEND = 0x182, - KEY_SEOL = 0x183, - KEY_SEXIT = 0x184, - KEY_SFIND = 0x185, - KEY_SHELP = 0x186, - KEY_SHOME = 0x187, - KEY_SIC = 0x188, - KEY_SLEFT = 0x189, - KEY_SMESSAGE = 0x18A, - KEY_SMOVE = 0x18B, - KEY_SNEXT = 0x18C, - KEY_SOPTIONS = 0x18D, - KEY_SPREVIOUS = 0x18E, - KEY_SPRINT = 0x18F, - KEY_SREDO = 0x190, - KEY_SREPLACE = 0x191, - KEY_SRIGHT = 0x192, - KEY_SRSUME = 0x193, - KEY_SSAVE = 0x194, - KEY_SSUSPEND = 0x195, - KEY_SUNDO = 0x196, - KEY_SUSPEND = 0x197, - KEY_UNDO = 0x198, - KEY_MOUSE = 0x199, - KEY_RESIZE = 0x19A, - KEY_EVENT = 0x19B, - KEY_MAX = 0x1FF -} - - -/* - * Function prototypes for wide-character operations. - * - * "generated" comments should include ":WIDEC" to make the corresponding - * functions ifdef'd in lib_gen.c - * - * "implemented" comments do not need this marker. - */ -int add_wch(C:cchar_t)(C* wch) -{ return wadd_wch(stdscr, wch); } -int add_wchnstr(C:cchar_t, N:int)(C* wchstr, N n) -{ return wadd_wchnstr(stdscr, wchstr, n); } -int add_wchstr(C:cchar_t)(C* wchstr) -{ return wadd_wchstr(stdscr, wchstr); } -int addnwstr(WC:wchar_t, N:int)(WC* wstr, N n) -{ return waddnwstr(stdscr, wstr); } -int addwstr(WC:wchar_t)(WC* wstr) -{ return waddwstr(stdscr, wstr); } -int bkgrnd(C:cchar_t)(C* wch) -{ return wbkgrnd(stdscr, wch); } -void bkgrndset(C:cchar_t)(C* wch ) -{ wbkgrndset(stdscr, wch); } -int border_set(C:cchar_t) - (C* ls, C* rs, C* ts, C* bs, C* tl, C* tr, C* bl, C* br) -{ return wborder_set(stdscr, ls, rs, ts, bs, tl, tr, bl, br); } -int box_set(W:WINDOW, C:cchar_t)(W* win, C* verch, C* horch) -{return wborder_set(win, verch, verch, horch, horch, null, null, null, null); } -int echo_wchar(C:cchar_t)(C* wch ) -{ return wecho_wchar(stdscr, wch); } -int erasewchar(wchar_t* ch); -int get_wch(WN:wint_t)(WN* wch) -{ return wget_wch(stdscr, wch); } -int get_wstr(WN:wint_t)(WN* wstr) -{ return wget_wstr(stdscr, wstr); } -int getbkgrnd(C:cchar_t)(C* wch) -{ return wgetbkgrnd(stdscr, wch); } -int getcchar(cchar_t* wcval, wchar_t* wch, attr_t* attrs, short* color_pair, void* opts); -int getn_wstr(WN:wint_t, N:int)(WN* wstr, N n) -{ return wgetn_wstr(stdscr, wstr, n); } -int hline_set(C:cchar_t, N:int)(C* wch, N n) -{ return whline_set(stdscr, wch, n); } -int in_wch(CC:cchar_t)(CC* wcval) -{ return win_wch(stdscr, wcval); } -int in_wchnstr(CC:cchar_t, N:int)(CC* wchstr, N n) -{ return win_wchnstr(stdscr, wchstr, n); } -int in_wchstr(CC:cchar_t)(CC* wchstr) -{ return win_wchstr(stdscr, wchstr); } -int innwstr(WC:wchar_t, N:int)(WC* str, N n) -{ return winnwstr(stdscr, str, n); } -int ins_nwstr(WC:wchar_t, N:int)(WC* wstr, N n) -{ return wins_nwstr(stdscr, wstr, n); } -int ins_wch(CC:cchar_t)(CC* wch) -{ return wins_wch(stdscr, wch); } -int ins_wstr(WC:wchar_t)(WC* wstr) -{ return wins_wstr(stdscr, wstr); } -int inwstr(WC:wchar_t)(WC* str) -{ return winwstr(stdscr, str); } -char* key_name(wchar_t w); -int killwchar(wchar_t* ch); -int mvadd_wch(N:int, C:cchar_t)(N y, N x, C* wch) -{ return mvwadd_wch(stdscr, y, x, wch); } -int mvadd_wchnstr(N:int,C:cchar_t)(N y, N x, C* wchstr, N n) -{ return mvwadd_wchnstr(stdscr, y, x, wchstr, n); } -int mvadd_wchstr(N:int, C:cchar_t)(N y, N x, C* wchstr) -{ return mvwadd_wchstr(stdscr, y, x, wchstr); } -int mvaddnwstr(N:int, WC:wchar_t)(N y, N x, WC* wstr, N n) -{ return mvwaddnwstr(stdscr, y, x, wstr, n); } -int mvaddwstr(N:int, WC:wchar_t)(N y, N x, WC* wstr) -{ return mvwaddwstr(stdscr, y, x, wstr); } -int mvget_wch(N:int, WN:wint_t)(N y, N x, WN* wch) -{ return mvwget_wch(stdscr, y, x, wch); } -int mvget_wstr(N:int, WN:wint_t)(N y, N x, WN* wstr) -{ return mvwget_wstr(stdscr, y, x, wstr); } -int mvgetn_wstr(N:int, WN:wint_t)(N y, N x, WN* wstr, N n) -{ return mvwgetn_wstr(stdscr, y, x, wstr, n); } -int mvhline_set(N:int, C:cchar_t)(N y, N x, C* wch, N n) -{ return mvwhline_set(stdscr, y, x, wch, n); } -int mvin_wch(N:int, CC:cchar_t)(N y, N x, CC* wcval) -{ return mvwin_wch(stdscr, y, x, wcval); } -int mvin_wchnstr(N:int, CC:cchar_t)(N y, N x, CC* wchstr, N n) -{ return mvwin_wchnstr(stdscr, y, x, wchstr, n); } -int mvin_wchstr(N:int, CC:cchar_t)(N y, N x, CC* wchstr) -{ return mvwin_wchstr(stdscr, y, x, wchstr); } -int mvinnwstr(N:int, WC:wchar_t)(N y, N x, WC* str, N n) -{ return mvwinnwstr(stdscr, y, x, str, n); } -int mvins_nwstr(N:int, WC:wchar_t)(N y, N x, WC* wstr, N n) -{ return mvwins_nwstr(stdscr, y, x, wstr, n); } -int mvins_wch(N:int, CC:cchar_t)(N y, N x, CC* wch) -{ return mvwins_wch(stdscr, y, x, wch); } -int mvins_wstr(N:int, WC:wchar_t)(N y, N x, WC* wstr) -{ return mvwins_wstr(stdscr, y, x, wstr); } -int mvinwstr(N:int, WC:wchar_t)(N y, N x, WC* str) -{ return mvwinwstr(stdscr, y, x, str); } -int mvvline_set(N:int, C:cchar_t)(N y, N x, C* wch, N n) -{ return mvwvline_set(stdscr, y, x, wch, n); } -int mvwadd_wch(W:WINDOW, N:int, C:cchar_t) - (W* win, N y, N x, C* wch) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return wadd_wch(win, wch); -} -int mvwadd_wchnstr(W:WINDOW, N:int, C:cchar_t) - (W* win, N y, N x, C* wchstr, N n) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return wadd_wchnstr(win, wchstr, n); -} -int mvwadd_wchstr(W:WINDOW, N:int, C:cchar_t) - (W* win, N y, N x, C* wchstr) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return wadd_wchstr(win, wchstr); -} -int mvwaddnwstr(W:WINDOW, N:int, WC:wchar_t) - (W* win, N y, N x, WC* wstr, N n) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return waddnwstr(win, wstr, n); -} -int mvwaddwstr(W:WINDOW, N:int, WC:wchar_t)(W* win, N y, N x, WC* wstr) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return waddwstr(win, wstr); -} -int mvwget_wch(W:WINDOW, N:int, WN:wint_t)(W* win, N y, N x, WN* wch) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return wget_wch(win, wch); -} -int mvwget_wstr(W:WINDOW, N:int, WN:wint_t)(W* win, N y, N x, WN* wstr) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return wget_wstr(win, wstr); -} -int mvwgetn_wstr(W:WINDOW, N:int, WN:wint_t) - (W* win, N y, N x, WN* wstr, N n) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return wgetn_wstr(win, wstr, n); -} -int mvwhline_set(W:WINDOW, N:int, C:cchar_t) - (W* win, N y, N x, C* wch, N n) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return whline_set(win, wch, n); -} -int mvwin_wch(W:WINDOW, N:int, CC:cchar_t)(W* win, N y, N x, CC* wcval) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return win_wch(win, wcval); -} -int mvwin_wchnstr(W:WINDOW, N:int, CC:cchar_t) - (W* win, N y, N x, CC* wchstr, N n) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return win_wchnstr(win, wchstr, n); -} -int mvwin_wchstr(W:WINDOW, N:int, CC:cchar_t) - (W* win, N y, N x, CC* wchstr) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return win_wchstr(win, wchstr); -} -int mvwinnwstr(W:WINDOW, N:int, WC:wchar_t)(W* win, N y, N x, WC* str, N n) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return winnwstr(win, str, n); -} -int mvwins_nwstr(W:WINDOW, N:int, WC:wchar_t) - (W* win, N y, N x, WC* wstr, N n) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return wins_nwstr(win, wstr, n); -} -int mvwins_wch(W:WINDOW, N:int, CC:cchar_t)(W* win, N y, N x, CC* wch) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return wins_wch(win, wch); -} -int mvwins_wstr(W:WINDOW, N:int, WC:wchar_t)(W* win, N y, N x, WC* wstr) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return wins_wstr(win, wstr); -} -int mvwinwstr(W:WINDOW, N:int, WC:wchar_t)(W* win, N y, N x, WC* str) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return winwstr(win, str); -} -int mvwvline_set(W:WINDOW, N:int, C:cchar_t) - (W* win, N y, N x, C* wch, N n) -{ - if(wmove(win, y, x) == ERR) - return ERR; - return wvline_set(win, wch, n); -} -int pecho_wchar(WINDOW* pad, cchar_t *wch); -int setcchar(cchar_t *wcval, wchar_t* wch, attr_t attrs, short color_pair, void* opts ); -//TODO check -int slk_wset(int one, const wchar_t* two, int three); /* implemented */ -attr_t term_attrs(); -int unget_wch(wchar_t wch); - -int vline_set(C:cchar_t, N:int)(C* wch, N n) -{ - return wvline_set(stdscr, wch, n); -} -int wadd_wch(WINDOW* win, cchar_t* wch); -int wadd_wchnstr(WINDOW* win, cchar_t* wchstr, int n); -int wadd_wchstr(W:WINDOW, C:cchar_t)(W* win, C* wchstr) -{ return wadd_wchnstr(win, wchstr, -1); } -int waddnwstr(WINDOW* win, wchar_t* wstr, int n); -int waddwstr(W:WINDOW, WC:wchar_t)(W* win, WC* wstr) -{ return waddnwstr(win, wstr, -1); } -int wbkgrnd(WINDOW* win, cchar_t* wch); -void wbkgrndset(WINDOW* win, cchar_t* wch); -int wborder_set( - WINDOW* win, - cchar_t* ls, cchar_t* rs, cchar_t* ts, cchar_t* bs, - cchar_t* tl, cchar_t* tr, cchar_t* bl, cchar_t* br); -int wecho_wchar(WINDOW* win, cchar_t* wch); -int wget_wch(WINDOW* win, wint_t* wch); -int wget_wstr(W:WINDOW, WN:wint_t)(W* win, WN* wstr) -{ return wgetn_wstr(win, wstr, -1); } -int wgetbkgrnd(W:WINDOW, C:cchar_t)(W* win, C* wch) -{ - *wch=win.bkgrnd; - return OK; -} -int wgetn_wstr(WINDOW* win, wint_t* wstr, int n); -int whline_set(WINDOW* win, cchar_t* wch, int n); -int win_wch(WINDOW* win, cchar_t* wcval); -int win_wchnstr(WINDOW* win, cchar_t* wchstr, int n); -int win_wchstr(W:WINDOW, CC:cchar_t)(W* win, CC* wchstr) -{ return win_wchnstr(win, wchstr, -1); } -int winnwstr(WINDOW* win, wchar_t* str, int n); -int wins_nwstr(WINDOW* win, wchar_t* wstr, int n); -int wins_wch(WINDOW* win, cchar_t* wch); -int wins_wstr(W:WINDOW, WC:wchar_t)(W* win, WC* wstr) -{ return wins_nwstr(win, wstr, -1); } -int winwstr(W:WINDOW, WC:wchar_t)(W* win, WC* str) -{ return winnwstr(win, str, -1); } -char* wunctrl(cchar_t* c); -int wvline_set(WINDOW* win, cchar_t* wch, int n); - - -/* mouse interface */ - -/* mouse events */ -immutable enum :mmask_t -{ - BUTTON1_RELEASED = 0x1, - BUTTON2_RELEASED = 0x40, - BUTTON3_RELEASED = 0x1000, - BUTTON4_RELEASED = 0x40000, - BUTTON1_PRESSED = 0x2, - BUTTON2_PRESSED = 0x80, - BUTTON3_PRESSED = 0x2000, - BUTTON4_PRESSED = 0x80000, - BUTTON1_CLICKED = 0x4, - BUTTON2_CLICKED = 0x100, - BUTTON3_CLICKED = 0x4000, - BUTTON4_CLICKED = 0x100000, - BUTTON1_DOUBLE_CLICKED = 0x8, - BUTTON2_DOUBLE_CLICKED = 0x200, - BUTTON3_DOUBLE_CLICKED = 0x8000, - BUTTON4_DOUBLE_CLICKED = 0x200000, - BUTTON1_TRIPLE_CLICKED = 0x10, - BUTTON2_TRIPLE_CLICKED = 0x400, - BUTTON3_TRIPLE_CLICKED = 0x10000, - BUTTON4_TRIPLE_CLICKED = 0x400000, - BUTTON_CTRL = 0x1000000, - BUTTON_SHIFT = 0x2000000, - BUTTON_ALT = 0x4000000, - REPORT_MOUSE_POSITION = 0x8000000, - ALL_MOUSE_EVENTS = 0x7FFFFFF -} - -/++ TODO - + #define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT) -#define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT) -#define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT) -#define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT) - -/* macros to extract single event-bits from masks */ -//TODO -#define BUTTON_RELEASE(e, x) ((e) & NCURSES_MOUSE_MASK(x, 001)) -#define BUTTON_PRESS(e, x) ((e) & NCURSES_MOUSE_MASK(x, 002)) -#define BUTTON_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 004)) -#define BUTTON_DOUBLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 010)) -#define BUTTON_TRIPLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 020)) -#define BUTTON_RESERVED_EVENT(e, x) ((e) & NCURSES_MOUSE_MASK(x, 040)) -++/ - -struct MEVENT -{ - short id; - int x, - y, - z; - mmask_t bstate; -} - -bool has_mouse(); -int getmouse(MEVENT* event); -int ungetmouse(MEVENT* event); -mmask_t mousemask(mmask_t newmask, mmask_t* oldmask); -int mouseinterval(int erval); -int mcprint(char *data, int len); -int has_key(int ch); - - -void _tracef(char* format, ...); -void _tracedump(char* label, WINDOW* win); -char* _traceattr(attr_t attr); -char* _traceattr2(int buffer, chtype ch); -char* _nc_tracebits(); -char* _tracechar(ubyte ch); -char* _tracechtype(chtype ch); -char* _tracechtype2(int buffer, chtype ch); -char* _tracemouse(MEVENT* event); -void trace(uint param); - - -/* trace masks */ -immutable enum :uint -{ - TRACE_DISABLE = 0x0000, - TRACE_TIMES = 0x0001, - TRACE_TPUTS = 0x0002, - TRACE_UPDATE = 0x0004, - TRACE_MOVE = 0x0008, - TRACE_CHARPUT = 0x0010, - TRACE_ORDINARY = 0x001F, - TRACE_CALLS = 0x0020, - TRACE_VIRTPUT = 0x0040, - TRACE_IEVENT = 0x0080, - TRACE_BITS = 0x0100, - TRACE_ICALLS = 0x0200, - TRACE_CCALLS = 0x0400, - TRACE_DATABASE = 0x0800, - TRACE_ATTRS = 0x1000, - - TRACE_SHIFT = 13, - TRACE_MAXIMUM = ((1 << TRACE_SHIFT) - 1) -} - -int KEY_F(N:int)(N n) -in -{ - assert (n>=0, "Invalid value for KEY_F(n)"); - assert (n<=63, "Invalid value for KEY_F(n)"); -} -out (result) -{ - assert (result < KEY_DL, "Invalid value for KEY_F(n)"); -} -do -{ - return KEY_F0 + n; -} - -}//end extern (C) - -// Things where @nogc would be needlessly limiting. -extern (C) nothrow -{ - -alias int function(WINDOW *, void *) NCURSES_WINDOW_CB; -alias int function(SCREEN *, void *) NCURSES_SCREEN_CB; - -} diff --git a/source/deimos/ncurses/form.d b/source/deimos/ncurses/form.d deleted file mode 100644 index c8fab64..0000000 --- a/source/deimos/ncurses/form.d +++ /dev/null @@ -1,388 +0,0 @@ -/**************************************************************************** - * Copyright (c) 1998-2004,2009 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * - * "Software"), to deal in the Software without restriction, including * - * without limitation the rights to use, copy, modify, merge, publish, * - * distribute, distribute with modifications, sublicense, and/or sell * - * copies of the Software, and to permit persons to whom the Software is * - * furnished to do so, subject to the following conditions: * - * * - * The above copyright notice and this permission notice shall be included * - * in all copies or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * - * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * - * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * * - * Except as contained in this notice, the name(s) of the above copyright * - * holders shall not be used in advertising or otherwise to promote the * - * sale, use or other dealings in this Software without prior written * - * authorization. * - ****************************************************************************/ - -/**************************************************************************** - * Author: Juergen Pfeifer, 1995,1997 * - ****************************************************************************/ - -/* $Id: form.h,v 0.21 2009/11/07 19:31:11 tom Exp $ */ - -module deimos.ncurses.form; - - -import core.stdc.stdarg; -public import deimos.ncurses.ncurses; -public import deimos.ncurses.eti; - -extern(C) @nogc -{ - -alias void* FIELD_CELL; -alias int Form_Options; -alias int Field_Options; - - - /********** - * _PAGE * - **********/ - -struct _PAGE -{ - short pmin; /* index of first field on page */ - short pmax; /* index of last field on page */ - short smin; /* index of top leftmost field on page */ - short smax; /* index of bottom rightmost field on page */ -} - - /********** - * FIELD * - **********/ - -struct FIELD -{ - ushort status; /* flags */ - short rows; /* size in rows */ - short cols; /* size in cols */ - short frow; /* first row */ - short fcol; /* first col */ - int drows; /* dynamic rows */ - int dcols; /* dynamic cols */ - int maxgrow; /* maximum field growth */ - int nrow; /* off-screen rows */ - short nbuf; /* additional buffers */ - short just; /* justification */ - short page; /* page on form */ - short index; /* into form -> field */ - int pad; /* pad character */ - chtype fore; /* foreground attribute */ - chtype back; /* background attribute */ - Field_Options opts; /* options */ - FIELD* snext; /* sorted order pointer */ - FIELD* sprev; /* sorted order pointer */ - FIELD* link; /* linked field chain */ - FORM* form; /* containing form */ - FORM* type; /* field type */ - void* arg; /* argument for type */ - FIELD_CELL* buf; /* field buffers */ - void* usrptr; /* user pointer */ - /* - * The wide-character configuration requires extra information. Because - * there are existing applications that manipulate the members of FIELD - * directly, we cannot make the struct opaque. Offsets of members up to - * this point are the same in the narrow- and wide-character configuration. - * But note that the type of buf depends on the configuration, and is made - * opaque for that reason. - */ -} - - /********* - * FORM * - *********/ - -struct FORM -{ - ushort status; /* flags */ - short rows; /* size in rows */ - short cols; /* size in cols */ - int currow; /* current row in field window */ - int curcol; /* current col in field window */ - int toprow; /* in scrollable field window */ - int begincol; /* in horiz. scrollable field */ - short maxfield; /* number of fields */ - short maxpage; /* number of pages */ - short curpage; /* index into page */ - Form_Options opts; /* options */ - WINDOW* win; /* window */ - WINDOW* sub; /* subwindow */ - WINDOW* w; /* window for current field */ - FIELD** field; /* field [maxfield] */ - FIELD* current; /* current field */ - _PAGE* page; /* page [maxpage] */ - void* usrptr; /* user pointer */ - //TODO check... - void function(FORM* form) forminit; - void function(FORM* form) formterm; - void function(FORM* form) fieldinit; - void function(FORM* form) fieldterm; -} - - - /************** - * FIELDTYPE * - **************/ - -struct FIELDTYPE -{ - ushort status; /* flags */ - long reference; /* reference count */ - FIELDTYPE* left; /* ptr to operand for | */ - FIELDTYPE* right; /* ptr to operand for | */ - - void* function(va_list*) makearg; /* make fieldtype arg */ - void* function(const void*) copyarg; /* copy fieldtype arg */ - void function(void*) freearg; /* free fieldtype arg */ - - bool function(FIELD*, const void*) fcheck; /* field validation */ - bool function(int, const void*) ccheck; /* character validation */ - - bool function(FIELD*, const void*) next; /* enumerate next value */ - bool function(FIELD*, const void*) prev; /* enumerate prev value */ -} - - /*************************** - * miscellaneous #defines * - ***************************/ - -immutable enum -{ - /* field justification */ - NO_JUSTIFICATION = 0, - JUSTIFY_LEFT = 1, - JUSTIFY_CENTER = 2, - JUSTIFY_RIGHT = 3 -} - -immutable enum :OPTIONS -{ - /* field options */ - O_VISIBLE = 0x0001, - O_ACTIVE = 0x0002, - O_PUBLIC = 0x0004, - O_EDIT = 0x0008, - O_WRAP = 0x0010, - O_BLANK = 0x0020, - O_AUTOSKIP = 0x0040, - O_NULLOK = 0x0080, - O_PASSOK = 0x0100, - O_STATIC = 0x0200, - - /* form options */ - O_NL_OVERLOAD = 0x0001, - O_BS_OVERLOAD = 0x0002 -} - -immutable enum -{ - /* form driver commands */ - REQ_NEXT_PAGE = (KEY_MAX + 1), /* move to next page */ - REQ_PREV_PAGE = (KEY_MAX + 2), /* move to previous page */ - REQ_FIRST_PAGE = (KEY_MAX + 3), /* move to first page */ - REQ_LAST_PAGE = (KEY_MAX + 4), /* move to last page */ - - REQ_NEXT_FIELD = (KEY_MAX + 5), /* move to next field */ - REQ_PREV_FIELD = (KEY_MAX + 6), /* move to previous field */ - REQ_FIRST_FIELD = (KEY_MAX + 7), /* move to first field */ - REQ_LAST_FIELD = (KEY_MAX + 8), /* move to last field */ - REQ_SNEXT_FIELD = (KEY_MAX + 9), /* move to sorted next field */ - REQ_SPREV_FIELD = (KEY_MAX + 10), /* move to sorted prev field */ - REQ_SFIRST_FIELD = (KEY_MAX + 11), /* move to sorted first field */ - REQ_SLAST_FIELD = (KEY_MAX + 12), /* move to sorted last field */ - REQ_LEFT_FIELD = (KEY_MAX + 13), /* move to left to field */ - REQ_RIGHT_FIELD = (KEY_MAX + 14), /* move to right to field */ - REQ_UP_FIELD = (KEY_MAX + 15), /* move to up to field */ - REQ_DOWN_FIELD = (KEY_MAX + 16), /* move to down to field */ - - REQ_NEXT_CHAR = (KEY_MAX + 17), /* move to next char in field */ - REQ_PREV_CHAR = (KEY_MAX + 18), /* move to prev char in field */ - REQ_NEXT_LINE = (KEY_MAX + 19), /* move to next line in field */ - REQ_PREV_LINE = (KEY_MAX + 20), /* move to prev line in field */ - REQ_NEXT_WORD = (KEY_MAX + 21), /* move to next word in field */ - REQ_PREV_WORD = (KEY_MAX + 22), /* move to prev word in field */ - REQ_BEG_FIELD = (KEY_MAX + 23), /* move to first char in field */ - REQ_END_FIELD = (KEY_MAX + 24), /* move after last char in fld */ - REQ_BEG_LINE = (KEY_MAX + 25), /* move to beginning of line */ - REQ_END_LINE = (KEY_MAX + 26), /* move after last char in line */ - REQ_LEFT_CHAR = (KEY_MAX + 27), /* move left in field */ - REQ_RIGHT_CHAR = (KEY_MAX + 28), /* move right in field */ - REQ_UP_CHAR = (KEY_MAX + 29), /* move up in field */ - REQ_DOWN_CHAR = (KEY_MAX + 30), /* move down in field */ - - REQ_NEW_LINE = (KEY_MAX + 31), /* insert/overlay new line */ - REQ_INS_CHAR = (KEY_MAX + 32), /* insert blank char at cursor */ - REQ_INS_LINE = (KEY_MAX + 33), /* insert blank line at cursor */ - REQ_DEL_CHAR = (KEY_MAX + 34), /* delete char at cursor */ - REQ_DEL_PREV = (KEY_MAX + 35), /* delete char before cursor */ - REQ_DEL_LINE = (KEY_MAX + 36), /* delete line at cursor */ - REQ_DEL_WORD = (KEY_MAX + 37), /* delete word at cursor */ - REQ_CLR_EOL = (KEY_MAX + 38), /* clear to end of line */ - REQ_CLR_EOF = (KEY_MAX + 39), /* clear to end of field */ - REQ_CLR_FIELD = (KEY_MAX + 40), /* clear entire field */ - REQ_OVL_MODE = (KEY_MAX + 41), /* begin overlay mode */ - REQ_INS_MODE = (KEY_MAX + 42), /* begin insert mode */ - REQ_SCR_FLINE = (KEY_MAX + 43), /* scroll field forward a line */ - REQ_SCR_BLINE = (KEY_MAX + 44), /* scroll field backward a line */ - REQ_SCR_FPAGE = (KEY_MAX + 45), /* scroll field forward a page */ - REQ_SCR_BPAGE = (KEY_MAX + 46), /* scroll field backward a page */ - REQ_SCR_FHPAGE = (KEY_MAX + 47), /* scroll field forward half page */ - REQ_SCR_BHPAGE = (KEY_MAX + 48), /* scroll field backward half page */ - REQ_SCR_FCHAR = (KEY_MAX + 49), /* horizontal scroll char */ - REQ_SCR_BCHAR = (KEY_MAX + 50), /* horizontal scroll char */ - REQ_SCR_HFLINE = (KEY_MAX + 51), /* horizontal scroll line */ - REQ_SCR_HBLINE = (KEY_MAX + 52), /* horizontal scroll line */ - REQ_SCR_HFHALF = (KEY_MAX + 53), /* horizontal scroll half line */ - REQ_SCR_HBHALF = (KEY_MAX + 54), /* horizontal scroll half line */ - - REQ_VALIDATION = (KEY_MAX + 55), /* validate field */ - REQ_NEXT_CHOICE = (KEY_MAX + 56), /* display next field choice */ - REQ_PREV_CHOICE = (KEY_MAX + 57), /* display prev field choice */ - - MIN_FORM_COMMAND = (KEY_MAX + 1), /* used by form_driver */ - MAX_FORM_COMMAND = (KEY_MAX + 57) /* used by form_driver */ -} - -immutable MAX_COMMAND = (KEY_MAX + 128); - - /************************* - * standard field types * - *************************/ -FIELDTYPE* TYPE_ALNUM; -FIELDTYPE* TYPE_ALPHA; -FIELDTYPE* TYPE_ENUM; -FIELDTYPE* TYPE_INTEGER; -FIELDTYPE* TYPE_NUMERIC; -FIELDTYPE* TYPE_REGEXP; - - /************************************ - * built-in additional field types * - * They are not defined in SVr4 * - ************************************/ -FIELDTYPE* TYPE_IPV4; /* Internet IP Version 4 address */ - - /*********************** - * FIELDTYPE routines * - ***********************/ -FIELDTYPE* new_fieldtype( - bool function(FIELD*, void*) field_check, - bool function(int, void*) char_check); -FIELDTYPE* link_fieldtype(FIELDTYPE* type1, FIELDTYPE* type2); - -int free_fieldtype(FIELDTYPE* fieldtype); -int set_fieldtype_arg( - FIELDTYPE* fieldtype, - void* function(va_list*) make_arg, - void* function(void*) copy_arg, - void function(void*) free_arg); -int set_fieldtype_choice( - FIELDTYPE* fieldtype, - bool function(FIELD*, void*) next_choice, - bool function(FIELD*, void*) prev_choice); - - /******************* - * FIELD routines * - *******************/ -FIELD* new_field(int height, int width, int toprow, int leftcol, int offscreen, int nbuffers); -FIELD* dup_field(FIELD* field, int toprow, int leftcol); -FIELD* link_field(FIELD* field, int toprow, int leftcol); - -int free_field(FIELD* field); -int field_info(const FIELD* field, int* rows, int* cols, int* frow, int* fcol, int* nrow, int* nbuf); -int dynamic_field_info(const FIELD* field, int* rows, int* cols, int* max); -int set_max_field(FIELD* field, int max); -int move_field(FIELD* field, int frow, int fcol); -int set_field_type(FIELD* field, FIELDTYPE* type, ...); -int set_new_page(FIELD* field, bool new_page_flag); -int set_field_just(FIELD* field, int justification); -int field_just(const FIELD* field); -int set_field_fore(FIELD* field, chtype attr); -int set_field_back(FIELD* field, chtype attr); -int set_field_pad(FIELD* field, int pad); -int field_pad(const FIELD* field); -int set_field_buffer(FIELD* field, int buf, immutable(char*) value); -int set_field_status(FIELD* field, bool status); -int set_field_userptr(FIELD* field, void* userptr); -int set_field_opts(FIELD* field, Field_Options opts); -int field_opts_on(FIELD* field, Field_Options opts); -int field_opts_off(FIELD* field, Field_Options opts); - -chtype field_fore(const FIELD* field); -chtype field_back(const FIELD* field); - -bool new_page(const FIELD* field); -bool field_status(const FIELD* field); - -void* field_arg(const FIELD* field); - -void* field_userptr(const FIELD* field); - -FIELDTYPE* field_type(const FIELD* field); - -char* field_buffer(const FIELD* field, int buffer); - -Field_Options field_opts(const FIELD* field); - - /****************** - * FORM routines * - ******************/ - -FORM* new_form(FIELD** fields); - -FIELD** form_fields(const FORM* form); -FIELD* current_field(const FORM* form); - -WINDOW* form_win(const FORM* form); -WINDOW* form_sub(const FORM* form); - -FORM* form_init(const FORM* form); -FORM* form_term(const FORM* form); -FORM* field_init(const FORM* form); -FORM* field_term(const FORM* form); - -int free_form(FORM* form); -int set_form_fields(FORM* form, FIELD** fields); -int field_count(const FORM* form); -int set_form_win(FORM* form, WINDOW* win); -int set_form_sub(FORM* form, WINDOW* sub); -int set_current_field(FORM* form, FIELD* field); -int field_index(const FIELD* field); -int set_form_page(FORM* form, int n); -int form_page(const FORM* form); -int scale_form(const FORM* form, int* rows, int* columns); - -int set_form_init(FORM* form, FORM* func); -int set_form_term(FORM* form, FORM* func); -int set_field_init(FORM* form, FORM* func); -int set_field_term(FORM* form, FORM* func); -int post_form(FORM* form); -int unpost_form(FORM* form); -int pos_form_cursor(FORM* form); -int form_driver(FORM* form, int c); -int set_form_userptr(FORM* form, void* userptr); -int set_form_opts(FORM* form, Form_Options opts); -int form_opts_on(FORM* form, Form_Options opts); -int form_opts_off(FORM* form, Form_Options opts); -int form_request_by_name(immutable char* name); - -char* form_request_name(int request); - -void* form_userptr(const FORM* form); - -Form_Options form_opts(const FORM* form); - -bool data_ahead(const FORM* form); -bool data_behind(const FORM* form); -}//end extern (C) diff --git a/source/deimos/ncurses/menu.d b/source/deimos/ncurses/menu.d deleted file mode 100644 index 637e424..0000000 --- a/source/deimos/ncurses/menu.d +++ /dev/null @@ -1,232 +0,0 @@ -/**************************************************************************** - * Copyright (c) 1998-2007,2009 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * - * "Software"), to deal in the Software without restriction, including * - * without limitation the rights to use, copy, modify, merge, publish, * - * distribute, distribute with modifications, sublicense, and/or sell * - * copies of the Software, and to permit persons to whom the Software is * - * furnished to do so, subject to the following conditions: * - * * - * The above copyright notice and this permission notice shall be included * - * in all copies or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * - * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * - * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * * - * Except as contained in this notice, the name(s) of the above copyright * - * holders shall not be used in advertising or otherwise to promote the * - * sale, use or other dealings in this Software without prior written * - * authorization. * - ****************************************************************************/ - -/**************************************************************************** - * Author: Juergen Pfeifer, 1995,1997 * - ****************************************************************************/ -/* $Id: menu.h,v 1.20 2009/04/05 00:28:07 tom Exp $ */ -module deimos.ncurses.menu; - -public import deimos.ncurses.curses, - deimos.ncurses.eti; - -extern(C) @nogc -{ - -alias int Menu_Options; -alias int Item_Options; - - -immutable enum :OPTIONS -{ - /* Menu options: */ - O_ONEVALUE = 0x01, - O_SHOWDESC = 0x02, - O_ROWMAJOR = 0x04, - O_IGNORECASE = 0x08, - O_SHOWMATCH = 0x10, - O_NONCYCLIC = 0x20, - /* Item options: */ - O_SELECTABLE = 0x01, -} - -struct TEXT -{ - immutable(char*) str; - ushort length; -} - -struct ITEM -{ - TEXT name; /* name of menu item */ - TEXT description; /* description of item, optional in display */ - MENU* imenu; /* Pointer to parent menu */ - void* userptr; /* Pointer to user defined per item data */ - Item_Options opt; /* Item options */ - short index; /* Item number if connected to a menu */ - short y; /* y and x location of item in menu */ - short x; - bool value; /* Selection value */ - - ITEM* left; /* neighbor items */ - ITEM* right; - ITEM* up; - ITEM* down; -} - -struct MENU -{ - short height; /* Nr. of chars high */ - short width; /* Nr. of chars wide */ - short rows; /* Nr. of items high */ - short cols; /* Nr. of items wide */ - short frows; /* Nr. of formatted items high */ - short fcols; /* Nr. of formatted items wide */ - short arows; /* Nr. of items high (actual) */ - short namelen; /* Max. name length */ - short desclen; /* Max. description length */ - short marklen; /* Length of mark, if any */ - short itemlen; /* Length of one item */ - short spc_desc; /* Spacing for descriptor */ - short spc_cols; /* Spacing for columns */ - short spc_rows; /* Spacing for rows */ - char* pattern; /* Buffer to store match chars */ - short pindex; /* Index into pattern buffer */ - WINDOW* win; /* Window containing menu */ - WINDOW* sub; /* Subwindow for menu display */ - WINDOW* userwin; /* User's window */ - WINDOW* usersub; /* User's subwindow */ - ITEM** items; /* array of items */ - short nitems; /* Nr. of items in menu */ - ITEM* curitem; /* Current item */ - short toprow; /* Top row of menu */ - chtype fore; /* Selection attribute */ - chtype back; /* Nonselection attribute */ - chtype grey; /* Inactive attribute */ - ubyte pad; /* Pad character */ - - MENU* menuinit; /* User hooks */ - MENU* menuterm; /* User hooks */ - MENU* iteminit; /* User hooks */ - MENU* itemterm; /* User hooks */ - - void* userptr; /* Pointer to menus user data */ - char* mark; /* Pointer to marker string */ - - Menu_Options opt; /* Menu options */ - ushort status; /* Internal state of menu */ -} - -/* Define keys */ -immutable enum -{ - REQ_LEFT_ITEM = (KEY_MAX + 1), - REQ_RIGHT_ITEM = (KEY_MAX + 2), - REQ_UP_ITEM = (KEY_MAX + 3), - REQ_DOWN_ITEM = (KEY_MAX + 4), - REQ_SCR_ULINE = (KEY_MAX + 5), - REQ_SCR_DLINE = (KEY_MAX + 6), - REQ_SCR_DPAGE = (KEY_MAX + 7), - REQ_SCR_UPAGE = (KEY_MAX + 8), - REQ_FIRST_ITEM = (KEY_MAX + 9), - REQ_LAST_ITEM = (KEY_MAX + 10), - REQ_NEXT_ITEM = (KEY_MAX + 11), - REQ_PREV_ITEM = (KEY_MAX + 12), - REQ_TOGGLE_ITEM = (KEY_MAX + 13), - REQ_CLEAR_PATTERN = (KEY_MAX + 14), - REQ_BACK_PATTERN = (KEY_MAX + 15), - REQ_NEXT_MATCH = (KEY_MAX + 16), - REQ_PREV_MATCH = (KEY_MAX + 17), - - MIN_MENU_COMMAND = (KEY_MAX + 1), - MAX_MENU_COMMAND = (KEY_MAX + 17) -} - -/* - * Some AT&T code expects MAX_COMMAND to be out-of-band not - * just for menu commands but for forms ones as well. - */ - -/* --------- prototypes for libmenu functions ----------------------------- */ - -ITEM** menu_items(const MENU* menuVar); -ITEM* current_item(const MENU* menuVar); -ITEM* new_item(immutable char* name, immutable char* description); - -MENU* new_menu(ITEM** items); - -OPTIONS item_opts(const ITEM* item); -OPTIONS menu_opts(const MENU* menuVar); -MENU* item_init(const MENU* menuVar); -MENU* item_term(const MENU* menuVar); -MENU* menu_init(const MENU* menuVar); -MENU* menu_term(const MENU* menuVar); - -WINDOW* menu_sub(const MENU* menuVar); -WINDOW* menu_win(const MENU* menuVar); - -immutable(char*) item_description(const ITEM* item); -immutable(char*) item_name(const ITEM* item); -immutable(char*) menu_mark(const MENU* menuVar); -immutable(char*) menu_request_name(int request); - -immutable(char*) menu_pattern(const MENU* menuVar); - -void* menu_userptr(const MENU* menuVar); -void* item_userptr(const ITEM* item); - -chtype menu_back(const MENU* menuVar); -chtype menu_fore(const MENU* menuVar); -chtype menu_grey(const MENU* menuVar); - -int free_item(ITEM* item); -int free_menu(MENU* menuVar); -int item_count(const MENU* menuVar); -int item_index(const ITEM* item); -int item_opts_off(ITEM* item, Item_Options opts); -int item_opts_on(ITEM* item, Item_Options opts); -int menu_driver(MENU* menuVar, int c); -int menu_opts_off(MENU* menuVar, Menu_Options opts); -int menu_opts_on(MENU* menuVar, Menu_Options opts); -int menu_pad(const MENU* menuVar); -int pos_menu_cursor(const MENU* menuVar); -int post_menu(MENU* menuVar); -int scale_menu(const MENU* menuVar, int* rows, int* columns); -int set_current_item(MENU* menuVar, ITEM* item); -int set_item_init(MENU* menuVar, MENU* func); -int set_item_opts(ITEM* item, Item_Options opts); -int set_item_term(MENU* menuVar, MENU* func); -int set_item_userptr(ITEM* item, void* userptr); -int set_item_value(ITEM* item, bool value); -int set_menu_back(MENU* menuVar, chtype attr); -int set_menu_fore(MENU* menuVar, chtype attr); -int set_menu_format(MENU* menuVar, int rows, int cols); -int set_menu_grey(MENU* menuVar, chtype attr); -int set_menu_init(MENU* menuVar, MENU* func); -int set_menu_items(MENU* menuVar, ITEM** items); -int set_menu_mark(MENU* menuVar, immutable char* mark); -int set_menu_opts(MENU* menuVar, OPTIONS opts); -int set_menu_pad(MENU* menuVar, int pad); -int set_menu_pattern(MENU* menuVar, immutable char* pattern); -int set_menu_sub(MENU* menuVar, WINDOW* sub); -int set_menu_term(MENU* menuVar, MENU* func); -int set_menu_userptr(MENU* menuVar, void* userptr); -int set_menu_win(MENU* menuVar, WINDOW* win); -int set_top_row(MENU* menuVar, int row); -int top_row(const MENU* menuVar); -int unpost_menu(MENU* menuVar); -int menu_request_by_name(immutable char* name); -int set_menu_spacing(MENU* menuVar, int spc_description, int spc_rows, int spc_columns); -int menu_spacing(MENU* menuVar, int* spc_description, int* spc_rows, int* spc_columns); - - -bool item_value(const ITEM* item); -bool item_visible(const ITEM* item); - -void menu_format(const MENU* menuVar, int* rows, int* cols); -}//end extern (C) diff --git a/source/deimos/ncurses/package.d b/source/deimos/ncurses/package.d deleted file mode 100644 index 4806528..0000000 --- a/source/deimos/ncurses/package.d +++ /dev/null @@ -1,3 +0,0 @@ -module deimos.ncurses; - -public import deimos.ncurses.ncurses; diff --git a/source/deimos/ncurses/ncurses.d b/source/deimos/ncurses_dll.di similarity index 67% rename from source/deimos/ncurses/ncurses.d rename to source/deimos/ncurses_dll.di index 82ad6bd..ac6f161 100644 --- a/source/deimos/ncurses/ncurses.d +++ b/source/deimos/ncurses_dll.di @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2009,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -25,11 +26,25 @@ * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ +/* $Id: ncurses_dll.h.in,v 1.17 2020/09/05 17:58:47 juergen Exp $ */ -/**************************************************************************** - * Author: Jude "1100110" Young <10equals2@gmail.com. * - ****************************************************************************/ -module deimos.ncurses.ncurses; +module deimos.ncurses_dll; + +/* + * For reentrant code, we map the various global variables into SCREEN by + * using functions to access them. + */ +auto NCURSES_PUBLIC_VAR(name)(name name) { pragma(inline, true); return "_nc_" ~ name; } + +// D porting note: this replaces NCURSES_WRAPPED_VAR and NCURSES_PUBLIC_VAR. +mixin template NCURSES_D_VAR(type,string name) +{ + mixin(" + extern __gshared /*NCURSES_IMPEXP*/ type " ~ NCURSES_PUBLIC_VAR(name) ~ "(); + @property ref auto " ~ name ~ "() { pragma(inline, true); return " ~ NCURSES_PUBLIC_VAR(name) ~ "(); } + "); +} -public import deimos.ncurses.curses; -alias deimos.ncurses.curses.clear nclear; +// D porting note: "export"/"extern" must be moved to the declaration, it cannot be added here. +alias NCURSES_EXPORT(type) = /*NCURSES_IMPEXP*/ type /*NCURSES_API*/; +alias NCURSES_EXPORT_VAR(type) = /*extern*/ /*NCURSES_IMPEXP*/ type; diff --git a/source/deimos/panel.di b/source/deimos/panel.di new file mode 100644 index 0000000..754f618 --- /dev/null +++ b/source/deimos/panel.di @@ -0,0 +1,93 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + * and: Juergen Pfeifer 1996-1999,2008 * + ****************************************************************************/ + +/* $Id: panel.h,v 1.14 2020/07/04 20:38:43 tom Exp $ */ + +/* panel.h -- interface file for panels library */ + +module deimos.panel; + +extern (C): + +public import deimos.curses; + +struct panel +// #if !NCURSES_OPAQUE_PANEL +{ + WINDOW *win; + panel *below; + panel *above; + NCURSES_CONST!void *user; +} +// #endif /* !NCURSES_OPAQUE_PANEL */ +alias PANEL = panel; + +// D porting note: this replaces PANEL_WRAPPED_VAR and NCURSES_PUBLIC_VAR. +mixin template PANEL_D_VAR(type,string name) +{ + mixin(" + extern /*PANEL_IMPEXP*/ type " ~ NCURSES_PUBLIC_VAR(name) ~ "(); + @property auto " ~ name ~ "() { pragma(inline, true); return " ~ NCURSES_PUBLIC_VAR(name) ~ "(); } + "); +} + +// D porting note: "export"/"extern" must be moved to the declaration, it cannot be added here. +alias PANEL_EXPORT(type) = /*PANEL_IMPEXP*/ type /*NCURSES_API*/; +alias PANEL_EXPORT_VAR(type) = /*PANEL_IMPEXP*/ type; + +extern nothrow @nogc PANEL_EXPORT!(WINDOW*) panel_window (const(PANEL) *); +extern nothrow @nogc PANEL_EXPORT!(void) update_panels (); +extern nothrow @nogc PANEL_EXPORT!(int) hide_panel (PANEL *); +extern nothrow @nogc PANEL_EXPORT!(int) show_panel (PANEL *); +extern nothrow @nogc PANEL_EXPORT!(int) del_panel (PANEL *); +extern nothrow @nogc PANEL_EXPORT!(int) top_panel (PANEL *); +extern nothrow @nogc PANEL_EXPORT!(int) bottom_panel (PANEL *); +extern nothrow @nogc PANEL_EXPORT!(PANEL*) new_panel (WINDOW *); +extern nothrow @nogc PANEL_EXPORT!(PANEL*) panel_above (const(PANEL) *); +extern nothrow @nogc PANEL_EXPORT!(PANEL*) panel_below (const(PANEL) *); +extern nothrow @nogc PANEL_EXPORT!(int) set_panel_userptr (PANEL *, NCURSES_CONST!void *); +extern nothrow @nogc PANEL_EXPORT!(NCURSES_CONST!void*) panel_userptr (const(PANEL) *); +extern nothrow @nogc PANEL_EXPORT!(int) move_panel (PANEL *, int, int); +extern nothrow @nogc PANEL_EXPORT!(int) replace_panel (PANEL *,WINDOW *); +extern nothrow @nogc PANEL_EXPORT!(int) panel_hidden (const(PANEL) *); + +static if (NCURSES_SP_FUNCS) { +extern nothrow @nogc PANEL_EXPORT!(PANEL *) ground_panel(SCREEN *); +extern nothrow @nogc PANEL_EXPORT!(PANEL *) ceiling_panel(SCREEN *); + +extern nothrow @nogc PANEL_EXPORT!(void) NCURSES_SP_NAME(update_panels) (SCREEN*); +} + +/* end of panel.h */ diff --git a/source/deimos/ncurses/unctrl.d b/source/deimos/unctrl.di similarity index 86% rename from source/deimos/ncurses/unctrl.d rename to source/deimos/unctrl.di index f5b736c..97ea399 100644 --- a/source/deimos/ncurses/unctrl.d +++ b/source/deimos/unctrl.di @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2001,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +32,6 @@ * and: Eric S. Raymond * ****************************************************************************/ -module deimos.ncurses.unctrl; - /* * unctrl.h * @@ -41,11 +40,16 @@ module deimos.ncurses.unctrl; * as ^?. Printable characters are displayed as is. */ -/* $Id: unctrl.h.in,v 1.11 2009/04/18 21:00:52 tom Exp $ */ +/* $Id: unctrl.h.in,v 1.12 2020/02/02 23:34:34 tom Exp $ */ + +module deimos.unctrl; + +enum NCURSES_VERSION = "6.3"; -string NCURSES_VERSION = "5.7"; -alias uint chtype; -extern (C) char* unctrl(chtype) @nogc; +import deimos.curses; +NCURSES_EXPORT!(NCURSES_CONST!char *) unctrl (chtype); -/* NCURSES_UNCTRL_H_incl */ +version (all) { +NCURSES_EXPORT!(NCURSES_CONST!char *) unctrl_sp (SCREEN*, chtype); +}