diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml
new file mode 100644
index 0000000..61235ca
--- /dev/null
+++ b/.github/workflows/build-release.yml
@@ -0,0 +1,296 @@
+name: build
+on:
+ push:
+ branches: [ main, devel ]
+ tags:
+ - "*"
+jobs:
+ build-linux:
+ name: 'Build Linux'
+ runs-on: 'ubuntu-latest'
+ steps:
+ - name: Checkout source
+ uses: actions/checkout@v2
+ - name: Build source
+ run: |
+ sudo apt-get -y -qq update && sudo apt-get -y -q upgrade 2>&1 > /dev/null
+ sudo apt-get -y -qq install libc++-12-dev libc++abi-12-dev lld 2>&1 > /dev/null
+ sudo apt-get -y -qq install g++-10-i686-linux-gnu 2>&1 > /dev/null
+ sudo apt-get -y -qq install g++-10-arm-linux-gnueabihf 2>&1 > /dev/null
+ sudo apt-get -y -qq install g++-10-aarch64-linux-gnu 2>&1 > /dev/null
+ sudo apt-get -y -qq install libncurses-dev 2>&1 > /dev/null
+ wget -q http://ftp.de.debian.org/debian/pool/main/l/llvm-toolchain-12/libc++-12-dev_12.0.1-20+b1_i386.deb 2>&1 > /dev/null
+ dpkg-deb -x libc++-12-dev_12.0.1-20+b1_i386.deb clang+llvm-12.0.1-i386-linux-gnu 2>&1 > /dev/null
+ wget -q http://ftp.de.debian.org/debian/pool/main/l/llvm-toolchain-12/libc++abi-12-dev_12.0.1-20+b1_i386.deb 2>&1 > /dev/null
+ dpkg-deb -x libc++abi-12-dev_12.0.1-20+b1_i386.deb clang+llvm-12.0.1-i386-linux-gnu 2>&1 > /dev/null
+ wget -q http://de.archive.ubuntu.com/ubuntu/pool/main/n/ncurses/libncurses-dev_6.2-0ubuntu2_i386.deb 2>&1 > /dev/null
+ dpkg-deb -x libncurses-dev_6.2-0ubuntu2_i386.deb libncurses-dev_6.2-0ubuntu2_i386 2>&1 > /dev/null
+ wget -q https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/clang+llvm-12.0.1-aarch64-linux-gnu.tar.xz 2>&1 > /dev/null
+ tar xf clang+llvm-12.0.1-aarch64-linux-gnu.tar.xz 2>&1 > /dev/null
+ wget -q https://mirrors.ecnu.edu.cn/ubuntu-ports/ubuntu-ports/pool/main/n/ncurses/libncurses-dev_6.2-0ubuntu2_arm64.deb 2>&1 > /dev/null
+ dpkg-deb -x libncurses-dev_6.2-0ubuntu2_arm64.deb libncurses-dev_6.2-0ubuntu2_arm64 2>&1 > /dev/null
+ wget -q https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/clang+llvm-12.0.1-armv7a-linux-gnueabihf.tar.xz 2>&1 > /dev/null
+ tar xf clang+llvm-12.0.1-armv7a-linux-gnueabihf.tar.xz 2>&1 > /dev/null
+ wget -q https://mirrors.ecnu.edu.cn/ubuntu-ports/ubuntu-ports/pool/main/n/ncurses/libncurses-dev_6.2-0ubuntu2_armhf.deb 2>&1 > /dev/null
+ dpkg-deb -x libncurses-dev_6.2-0ubuntu2_armhf.deb libncurses-dev_6.2-0ubuntu2_armhf 2>&1 > /dev/null
+ wget -q https://dl.google.com/android/repository/android-ndk-r23b-linux.zip 2>&1 > /dev/null
+ unzip -qq android-ndk-r23b-linux.zip 2>&1 > /dev/null
+ #
+ clang++-12 --target=i686-linux-gnu --sysroot=/usr/i686-linux-gnu \
+ -L$(pwd)/clang+llvm-12.0.1-i386-linux-gnu/usr/lib/llvm-12/lib \
+ -I$(pwd)/libncurses-dev_6.2-0ubuntu2_i386/usr/include \
+ -L$(pwd)/libncurses-dev_6.2-0ubuntu2_i386/usr/lib/i386-linux-gnu \
+ noso-2m.cpp md5-c.cpp -o noso-2m-linux-i686 \
+ -std=c++20 -Ofast -DNDEBUG \
+ --stdlib=libc++ -fuse-ld=lld \
+ -lpthread -lc++ -lc++abi \
+ -lncurses -lform -ltermcap \
+ -static -s
+ file noso-2m-linux-i686
+ #
+ clang++-12 \
+ noso-2m.cpp md5-c.cpp -o noso-2m-linux-x86_64 \
+ -std=c++20 -Ofast -DNDEBUG \
+ --stdlib=libc++ -fuse-ld=lld \
+ -lpthread -lc++ -lc++abi \
+ -lncurses -lform -ltermcap \
+ -static -s
+ file noso-2m-linux-x86_64
+ #
+ clang++-12 --target=arm-linux-gnueabihf --sysroot=/usr/arm-linux-gnueabihf \
+ -L$(pwd)/clang+llvm-12.0.1-armv7a-linux-gnueabihf/lib \
+ -I$(pwd)/libncurses-dev_6.2-0ubuntu2_armhf/usr/include \
+ -L$(pwd)/libncurses-dev_6.2-0ubuntu2_armhf/usr/lib/arm-linux-gnueabihf \
+ noso-2m.cpp md5-c.cpp -o noso-2m-linux-armv7a \
+ -std=c++20 -Ofast -DNDEBUG \
+ --stdlib=libc++ -fuse-ld=lld \
+ -lpthread -lc++ -lc++abi \
+ -lncurses -lform -ltermcap \
+ -static -s
+ file noso-2m-linux-armv7a
+ #
+ clang++-12 --target=aarch64-linux-gnu --sysroot=/usr/aarch64-linux-gnu \
+ -L$(pwd)/clang+llvm-12.0.1-aarch64-linux-gnu/lib \
+ -I$(pwd)/libncurses-dev_6.2-0ubuntu2_arm64/usr/include \
+ -L$(pwd)/libncurses-dev_6.2-0ubuntu2_arm64/usr/lib/aarch64-linux-gnu \
+ noso-2m.cpp md5-c.cpp -o noso-2m-linux-aarch64 \
+ -std=c++20 -Ofast -DNDEBUG \
+ --stdlib=libc++ -fuse-ld=lld \
+ -lpthread -lc++ -lc++abi \
+ -lncurses -lform -ltermcap \
+ -static -s
+ file noso-2m-linux-aarch64
+ #
+ wget -q https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.2.tar.gz 2>&1 > /dev/null
+ tar xf ncurses-6.2.tar.gz 2>&1 > /dev/null
+ mkdir armv7a-linux-androideabi-ncurses
+ mkdir aarch64-linux-android-ncurses
+ cd ncurses-6.2
+ CC=$(pwd)/../android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi31-clang \
+ STRIP=$(pwd)/../android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip \
+ ./configure \
+ --host=armv7a-linux-androideabi \
+ --prefix=$(pwd)/../armv7a-linux-androideabi-ncurses \
+ --without-manpages --without-progs --without-tack --without-tests 2>&1 > /dev/null
+ make 2>&1 > /dev/null
+ make install 2>&1 > /dev/null
+ CC=$(pwd)/../android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android31-clang \
+ STRIP=$(pwd)/../android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip \
+ ./configure \
+ --host=aarch64-linux-android \
+ --prefix=$(pwd)/../aarch64-linux-android-ncurses \
+ --without-manpages --without-progs --without-tack --without-tests 2>&1 > /dev/null
+ make 2>&1 > /dev/null
+ make install 2>&1 > /dev/null
+ cd ..
+ android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi31-clang++ \
+ -I$(pwd)/armv7a-linux-androideabi-ncurses/include \
+ -I$(pwd)/armv7a-linux-androideabi-ncurses/include/ncurses \
+ -L$(pwd)/armv7a-linux-androideabi-ncurses/lib \
+ noso-2m.cpp md5-c.cpp -o noso-2m-android-armv7a \
+ -std=c++20 -Ofast -DNDEBUG \
+ -lncurses -lform \
+ -static -s
+ file noso-2m-android-armv7a
+ #
+ android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android31-clang++ \
+ -I$(pwd)/aarch64-linux-android-ncurses/include \
+ -I$(pwd)/aarch64-linux-android-ncurses/include/ncurses \
+ -L$(pwd)/aarch64-linux-android-ncurses/lib \
+ noso-2m.cpp md5-c.cpp -o noso-2m-android-aarch64 \
+ -std=c++20 -Ofast -DNDEBUG \
+ -lncurses -lform \
+ -static -s
+ file noso-2m-android-aarch64
+ shell: bash
+ - name: Upload artifacs
+ uses: actions/upload-artifact@v2
+ with:
+ name: 'ubuntu-latest'
+ path: |
+ README.md
+ noso-2m-linux-i686
+ noso-2m-linux-x86_64
+ noso-2m-linux-armv7a
+ noso-2m-linux-aarch64
+ noso-2m-android-armv7a
+ noso-2m-android-aarch64
+ build-windows:
+ name: 'Build Windows'
+ runs-on: 'windows-latest'
+ steps:
+ - name: Checkout source
+ uses: actions/checkout@v2
+ - name: Build source
+ run: |
+ clang++ --target=i686-pc-win32 \
+ -Imingw-w64-clang-i686-ncurses-6_3\\include \
+ -Imingw-w64-clang-i686-ncurses-6_3\\include\\ncurses \
+ mingw-w64-clang-i686-ncurses-6_3\\lib\\libncurses.dll.a \
+ mingw-w64-clang-i686-ncurses-6_3\\lib\\libform.dll.a \
+ noso-2m.cpp md5-c.cpp -o noso-2m-i686.exe \
+ -std=c++20 -Ofast -DNOGDI -DNDEBUG \
+ -Wl,-machine:x86 -nostdlib -lWs2_32.lib -lmsvcrt
+ clang++ --target=x86_64-pc-win32 \
+ -Imingw-w64-clang-x86_64-ncurses-6_3\\include \
+ -Imingw-w64-clang-x86_64-ncurses-6_3\\include\\ncurses \
+ mingw-w64-clang-x86_64-ncurses-6_3\\lib\\libncurses.dll.a \
+ mingw-w64-clang-x86_64-ncurses-6_3\\lib\\libform.dll.a \
+ noso-2m.cpp md5-c.cpp -o noso-2m-x86_64.exe \
+ -std=c++20 -Ofast -DNOGDI -DNDEBUG \
+ -Wl,-machine:x64 -nostdlib -lWs2_32.lib -lmsvcrt
+ shell: bash
+ - name: Upload artifacs
+ uses: actions/upload-artifact@v2
+ with:
+ name: 'windows-latest'
+ path: |
+ README.md
+ mingw-w64-clang-i686-ncurses-6_3\\bin\\libncurses6.dll
+ mingw-w64-clang-i686-ncurses-6_3\\bin\\libform6.dll
+ noso-2m-i686.exe
+ mingw-w64-clang-x86_64-ncurses-6_3\\bin\\libncurses6.dll
+ mingw-w64-clang-x86_64-ncurses-6_3\\bin\\libform6.dll
+ noso-2m-x86_64.exe
+ build-macos:
+ name: 'Build macOS'
+ runs-on: 'macos-latest'
+ steps:
+ - name: Checkout source
+ uses: actions/checkout@v2
+ - name: Build source
+ run: |
+ clang++ \
+ noso-2m.cpp md5-c.cpp -o noso-2m-darwin \
+ -std=c++20 -Ofast -DNDEBUG \
+ -lncurses -lform -ltermcap
+ strip -x noso-2m-darwin
+ file noso-2m-darwin
+ shell: bash
+ - name: Upload artifacs
+ uses: actions/upload-artifact@v2
+ with:
+ name: 'macos-latest'
+ path: |
+ README.md
+ noso-2m-darwin
+ release-linux:
+ if: contains(github.ref, '/tags/')
+ name: 'Release ubuntu-latest'
+ runs-on: 'ubuntu-latest'
+ needs: [build-linux]
+ steps:
+ - name: Download artifacts
+ uses: actions/download-artifact@v2
+ - name: Package artifacts
+ run: |
+ tag=${{ github.event.ref }}
+ tag=${tag#"refs/tags/"}
+ cp ubuntu-latest/README.md README.md
+ #
+ cp ubuntu-latest/noso-2m-linux-i686 noso-2m
+ chmod +x noso-2m
+ tar -zcvf noso-2m-${tag}-linux-i686.tar.gz noso-2m README.md
+ #
+ cp ubuntu-latest/noso-2m-linux-x86_64 noso-2m
+ chmod +x noso-2m
+ tar -zcvf noso-2m-${tag}-linux-x86_64.tar.gz noso-2m README.md
+ #
+ cp ubuntu-latest/noso-2m-linux-armv7a noso-2m
+ chmod +x noso-2m
+ tar -zcvf noso-2m-${tag}-linux-armv7a.tar.gz noso-2m README.md
+ #
+ cp ubuntu-latest/noso-2m-linux-aarch64 noso-2m
+ chmod +x noso-2m
+ tar -zcvf noso-2m-${tag}-linux-aarch64.tar.gz noso-2m README.md
+ #
+ cp ubuntu-latest/noso-2m-android-armv7a noso-2m
+ chmod +x noso-2m
+ tar -zcvf noso-2m-${tag}-android-armv7a.tar.gz noso-2m README.md
+ #
+ cp ubuntu-latest/noso-2m-android-aarch64 noso-2m
+ chmod +x noso-2m
+ tar -zcvf noso-2m-${tag}-android-aarch64.tar.gz noso-2m README.md
+ shell: bash
+ - name: Upload artifacts
+ uses: softprops/action-gh-release@v1
+ with:
+ files: |
+ noso-2m-*.tar.gz
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ release-macos:
+ if: contains(github.ref, '/tags/')
+ name: 'Release macos-latest'
+ runs-on: 'macos-latest'
+ needs: [build-macos]
+ steps:
+ - name: Download artifacts
+ uses: actions/download-artifact@v2
+ - name: Package artifacts
+ run: |
+ tag=${{ github.event.ref }}
+ tag=${tag#"refs/tags/"}
+ cp macos-latest/README.md README.md
+ cp macos-latest/noso-2m-darwin noso-2m
+ chmod +x noso-2m
+ tar -zcvf noso-2m-${tag}-darwin.tar.gz noso-2m README.md
+ shell: bash
+ - name: Upload artifacts
+ uses: softprops/action-gh-release@v1
+ with:
+ files: |
+ noso-2m-*.tar.gz
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ release-windows:
+ if: contains(github.ref, '/tags/')
+ name: 'Release windows-latest'
+ runs-on: 'windows-latest'
+ needs: [build-windows]
+ steps:
+ - name: Download artifacts
+ uses: actions/download-artifact@v2
+ - name: Package artifacts
+ run: |
+ tag=${{ github.event.ref }}
+ tag=${tag#"refs/tags/"}
+ cp windows-latest/README.md README.md
+ #
+ cp windows-latest/noso-2m-x86_64.exe noso-2m.exe
+ cp windows-latest/mingw-w64-clang-x86_64-ncurses-6_3\\bin\\libncurses6.dll libncurses6.dll
+ cp windows-latest/mingw-w64-clang-x86_64-ncurses-6_3\\bin\\libform6.dll libform6.dll
+ 7z a -tzip noso-2m-${tag}-win64-x86_64.zip noso-2m.exe libncurses6.dll libform6.dll README.md
+ #
+ cp windows-latest/noso-2m-i686.exe noso-2m.exe
+ cp windows-latest/mingw-w64-clang-i686-ncurses-6_3\\bin\\libncurses6.dll libncurses6.dll
+ cp windows-latest/mingw-w64-clang-i686-ncurses-6_3\\bin\\libform6.dll libform6.dll
+ 7z a -tzip noso-2m-${tag}-win32-i686.zip noso-2m.exe libncurses6.dll libform6.dll README.md
+ shell: bash
+ - name: Upload artifacts
+ uses: softprops/action-gh-release@v1
+ with:
+ files: |
+ noso-2m-*.zip
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..8ff7dab
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,46 @@
+# Local clang build flags
+noso-2m
+compile_commands.json
+compile_flags.txt
+cache
+*.log
+.DS_Store
+
+# Prerequisites
+*.d
+
+# Compiled Object files
+*.slo
+*.lo
+*.o
+*.obj
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Compiled Dynamic libraries
+*.so
+*.dylib
+#*.dll
+
+# Fortran module files
+*.mod
+*.smod
+
+# Compiled Static libraries
+*.lai
+*.la
+#*.a
+*.lib
+
+# Executables
+*.exe
+*.out
+*.app
+
+## App packaging
+*.ipa
+*.dSYM.zip
+*.dSYM
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..ab00994
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,46 @@
+Version 0.2.3
+
+- Support config file
+- `--pools` option now supports both IP address and domain names
+- Correct summary report of actual hashrate, balance, payment
+- Fixed unexpected exits in Windows.
+- Minor refining
+
+Version 0.2.2
+
+- Quick patch number overflow in block summary
+
+Version 0.2.2
+
+- Protect new target from racing conditions
+- Block summary fixing
+- Update pool protocol for providing miner app's information
+- Update seed nodes
+- Mainnet timestamp check before mininig
+
+Version 0.2.0
+
+- Support pool mining mode, plus pools failover
+- Hashrate improvements
+- Support CI/CD build for Linux, Android(Termux), macOS and Windows on amd64/x86-64, i686, arm64/aarch64, arm(v7a) 64-bits and 32-bits versions
+- Eliminate redundant information in the summary report (will be improved more next versions)
+- Bugfixes and several improvements
+- Pump version series to v0.2.x
+
+Version 0.1.3
+
+- Update mainnet seed nodes
+
+Version 0.1.2
+
+- Consensus only once at beginning each blocks
+- Now buildable with C++14
+- Bug fixed and refining algo
+
+Version 0.1.1
+
+- Windows support
+
+Version 0.1.0
+
+- First release
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..8945d89
--- /dev/null
+++ b/README.md
@@ -0,0 +1,110 @@
+# NOSO-2M
+![Build Status](https://github.com/f04ever/noso-2m/actions/workflows/build-release.yml/badge.svg)
+[![Support Linux](https://img.shields.io/badge/support-Linux-blue?logo=Linux)](https://github.com/f04ever/noso-2m/releases/latest)
+[![Support Windows](https://img.shields.io/badge/support-Windows-blue?logo=Windows)](https://github.com/f04ever/noso-2m/releases/latest)
+[![Support macOs](https://img.shields.io/badge/support-macOS-blue?logo=macOS)](https://github.com/f04ever/noso-2m/releases/latest)
+[![Support Android](https://img.shields.io/badge/support-Android-blue?logo=Android)](https://github.com/f04ever/noso-2m/releases/latest)
+[![Downloads](https://img.shields.io/github/downloads/f04ever/noso-2m/total)](https://github.com/f04ever/noso-2m/releases)
+
+A miner for Nosocryptocurrency Protocol-2.
+
+`noso-2m` supports mining both ***solo*** and ***pool*** modes on mainnet. `noso-2m` supports *_failover_* to other pools in pool mining modes.
+
+`noso-2m` be developed using C/C++, compatible with standards C++17/20. It is expected be buildable and executable on a wide range of hardware architectures (Intel, AMD, arm, aarch64) and operating systems (Linux, macOS, Android (Termux), and Windows).
+
+From version 0.2.4, noso-2m supports a simple text UI that expects to help new users starting with noso-2m easier. A logging file `noso-2m.log` is provided as well for advanced users. A command line provides information during mining. The command `pools` shows information of pools listed in config file or provided when run the `noso-2m` program. Use command `help` for more utilised commands and helps. On Microsoft Windows, don't try to resize the console window since a problematic inherited from the NCURSES library causes text shows weird (but not effect the mining jobs).
+
+![Screenshot](images/textui.png)
+
+## Run `noso-2m` miner
+
+`noso-2m` currently provides executable 64-bits and 32-bits versions for Linux, Android(Termux), macOS, and Windows pre-built on architectures amd64/x86\_64, aarch64/arm64, i686, and arm. Just download the appropriate version, uncompress the archive and run it from command shell as bellow:
+
+### On Linux, MacOS, or Android (Termux)
+
+`./noso-2m -a WALLETADDRESS -t THREADCOUNT 2>errors.txt`
+
+### On Windows
+
+`.\noso-2m.exe -a WALLETADDRESS -t THREADCOUNT 2> errors.txt`
+
+** NODES:
+
+- By default, `noso-2m` does mining using arguments loading from config file `noso-2m.cfg` at the same location of `noso-2m` program if exist.
+
+- Config file formation like below
+
+`address WALLETADDRESS`
+`minerid MINERID****`
+`threads THREADCOUNT`
+`pools POOL-URL-LIST`
+`solo false`
+
+
+- Config file can locate at diffent location and be specified using option `--config="PATH-TO-CONFIG-FILE"`.
+
+- Arguments loading from config file be overwrited by options provided in the running command.
+
+- By default, `noso-2m` does mining using `pool mining mode`, and does failover between two pools `f04ever` pool and `devnoso` pool.
+
+- Provide pool addresses to the running command by using option `--pools="POOL-URL-LIST"` (opening and closing quotation marks (`"`) are mandatory if having more than one pool URLs provided)
+
+- If more than one pool address be provided, `noso-2m` will do failover between provided pools when the current mining pool unreacheable (pool off, network problem, ...).
+
+- Formation of `POOL-URL-LIST` as following:
+
+ + `POOL-URL-LIST` is a list of `POOL-URL`s, separate each other pool by a semicolon (`;`), ex.: `POOL-URL-1;POOL-URL-2;POOL-URL-3`
+
+ + `POOL-URL` has formation: `POOL-NAME:POOL-ADDRESS:POOL-PORT`, the colon (`:`) be used to separate parts.
+
+ + `POOL-NAME` is an arbitrary name, ex.: devnoso, my-pool, pool-1, pool-2, ...
+
+ + `POOL-ADDRESS` is either a valid IP address or a domain name of pool.
+
+ + `POOL-PORT` is a valid port number of pool, omitted `POOL-PORT` then the default port `8082` be used instead.
+
+ + Pools `f04ever` and `devnoso` can also be provided to `POOL-URL-LIST` in a short form by their names and omit `POOL-IP-ADDRESS` and `POOL-PORT` as well.
+
+ + An example: `./noso-2m -a N3G1HhkpXvmLcsWFXySdAxX3GZpkMFS -i 1000 -t 8 --pools="f04ever:209.126.80.203:8082;devnoso:45.146.252.103:8082"`
+
+- Use option `--solo` for mainnet solo mining mode instead. Should provide `Miner ID` by option `-i` / `--minerid` if mining from more than one machine using one wallet address in solo mode.
+
+- Use `--help` for the more command detail.
+
+## Build from source
+
+On Linux/macOS/Android(Termux), requires clang, or gcc.
+
+On Windows, requires clang and Build Tools for Visual Studio.
+
+From version 0.2.4, need library NCURSES for the text UI. NCURSES is provided already (or very easy to install) on Linux/macOS/Android platforms, on Windows requires a NCURSES on top of MinGW.
+
+** NOTES:
+
+- Currently `noso-2m` is compatiple with C++14/17/20. So, clang version 3.4 or later, or gcc version 6.1 or later. Recommend to build `noso-2m` with `c++20`.
+
+- Can replace `c++20` in the build commands below by `c++17` for older versions of clang, gcc, or Windows Build Tools
+
+Simple command for download source code and build `noso-2m` as below:
+
+### On Linux, MacOS, or Android (Termux)
+
+`clang++ noso-2m.cpp md5-c.cpp -o noso-2m -std=c++20 -O3 -DNDEBUG --stdlib=libc++ -fuse-ld=lld -lpthread -lc++abi -lncurses -lform -ltermcap`
+
+Or use gcc,
+
+`g++ noso-2m.cpp md5-c.cpp -o noso-2m -std=c++20 -O3 -DNDEBUG -lpthread -lncurses -lform -ltermcap`
+
+### On Windows
+
+`clang++ noso-2m.cpp md5-c.cpp -o noso-2m.exe -std=c++20 -O2 -DNDEBUG -lWs2_32.lib`
+
+Or use clang compatible driver mode for Microsoft Build Tools
+
+`clang-cl noso-2m.cpp md5-c.cpp /o noso-2m.exe /std:c++20 /O2 /EHsc /DNDEBUG /link Ws2_32.lib`
+
+## Donations
+
+Nosocoin: `devteam_donations`
+
+** The donations will go to `devteam_donations` - the wallet address of the [nosocoin's development team](https://www.nosocoin.com/) as they deserve (***it is not my personal address***)
diff --git a/cxxopts.hpp b/cxxopts.hpp
new file mode 100644
index 0000000..2dd4da6
--- /dev/null
+++ b/cxxopts.hpp
@@ -0,0 +1,2714 @@
+/*
+
+Copyright (c) 2014, 2015, 2016, 2017 Jarryd Beck
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+*/
+
+#ifndef CXXOPTS_HPP_INCLUDED
+#define CXXOPTS_HPP_INCLUDED
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#if defined(__GNUC__) && !defined(__clang__)
+# if (__GNUC__ * 10 + __GNUC_MINOR__) < 49
+# define CXXOPTS_NO_REGEX true
+# endif
+#endif
+
+#ifndef CXXOPTS_NO_REGEX
+# include
+#endif // CXXOPTS_NO_REGEX
+
+// Nonstandard before C++17, which is coincidentally what we also need for
+#ifdef __has_include
+# if __has_include()
+# include
+# ifdef __cpp_lib_optional
+# define CXXOPTS_HAS_OPTIONAL
+# endif
+# endif
+#endif
+
+#if __cplusplus >= 201603L
+#define CXXOPTS_NODISCARD [[nodiscard]]
+#else
+#define CXXOPTS_NODISCARD
+#endif
+
+#ifndef CXXOPTS_VECTOR_DELIMITER
+#define CXXOPTS_VECTOR_DELIMITER ','
+#endif
+
+#define CXXOPTS__VERSION_MAJOR 3
+#define CXXOPTS__VERSION_MINOR 0
+#define CXXOPTS__VERSION_PATCH 0
+
+#if (__GNUC__ < 10 || (__GNUC__ == 10 && __GNUC_MINOR__ < 1)) && __GNUC__ >= 6
+ #define CXXOPTS_NULL_DEREF_IGNORE
+#endif
+
+namespace cxxopts
+{
+ static constexpr struct {
+ uint8_t major, minor, patch;
+ } version = {
+ CXXOPTS__VERSION_MAJOR,
+ CXXOPTS__VERSION_MINOR,
+ CXXOPTS__VERSION_PATCH
+ };
+} // namespace cxxopts
+
+//when we ask cxxopts to use Unicode, help strings are processed using ICU,
+//which results in the correct lengths being computed for strings when they
+//are formatted for the help output
+//it is necessary to make sure that can be found by the
+//compiler, and that icu-uc is linked in to the binary.
+
+#ifdef CXXOPTS_USE_UNICODE
+#include
+
+namespace cxxopts
+{
+ using String = icu::UnicodeString;
+
+ inline
+ String
+ toLocalString(std::string s)
+ {
+ return icu::UnicodeString::fromUTF8(std::move(s));
+ }
+
+#if defined(__GNUC__)
+// GNU GCC with -Weffc++ will issue a warning regarding the upcoming class, we want to silence it:
+// warning: base class 'class std::enable_shared_from_this' has accessible non-virtual destructor
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
+#pragma GCC diagnostic ignored "-Weffc++"
+// This will be ignored under other compilers like LLVM clang.
+#endif
+ class UnicodeStringIterator : public
+ std::iterator
+ {
+ public:
+
+ UnicodeStringIterator(const icu::UnicodeString* string, int32_t pos)
+ : s(string)
+ , i(pos)
+ {
+ }
+
+ value_type
+ operator*() const
+ {
+ return s->char32At(i);
+ }
+
+ bool
+ operator==(const UnicodeStringIterator& rhs) const
+ {
+ return s == rhs.s && i == rhs.i;
+ }
+
+ bool
+ operator!=(const UnicodeStringIterator& rhs) const
+ {
+ return !(*this == rhs);
+ }
+
+ UnicodeStringIterator&
+ operator++()
+ {
+ ++i;
+ return *this;
+ }
+
+ UnicodeStringIterator
+ operator+(int32_t v)
+ {
+ return UnicodeStringIterator(s, i + v);
+ }
+
+ private:
+ const icu::UnicodeString* s;
+ int32_t i;
+ };
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
+
+ inline
+ String&
+ stringAppend(String&s, String a)
+ {
+ return s.append(std::move(a));
+ }
+
+ inline
+ String&
+ stringAppend(String& s, size_t n, UChar32 c)
+ {
+ for (size_t i = 0; i != n; ++i)
+ {
+ s.append(c);
+ }
+
+ return s;
+ }
+
+ template
+ String&
+ stringAppend(String& s, Iterator begin, Iterator end)
+ {
+ while (begin != end)
+ {
+ s.append(*begin);
+ ++begin;
+ }
+
+ return s;
+ }
+
+ inline
+ size_t
+ stringLength(const String& s)
+ {
+ return s.length();
+ }
+
+ inline
+ std::string
+ toUTF8String(const String& s)
+ {
+ std::string result;
+ s.toUTF8String(result);
+
+ return result;
+ }
+
+ inline
+ bool
+ empty(const String& s)
+ {
+ return s.isEmpty();
+ }
+}
+
+namespace std
+{
+ inline
+ cxxopts::UnicodeStringIterator
+ begin(const icu::UnicodeString& s)
+ {
+ return cxxopts::UnicodeStringIterator(&s, 0);
+ }
+
+ inline
+ cxxopts::UnicodeStringIterator
+ end(const icu::UnicodeString& s)
+ {
+ return cxxopts::UnicodeStringIterator(&s, s.length());
+ }
+}
+
+//ifdef CXXOPTS_USE_UNICODE
+#else
+
+namespace cxxopts
+{
+ using String = std::string;
+
+ template
+ T
+ toLocalString(T&& t)
+ {
+ return std::forward(t);
+ }
+
+ inline
+ size_t
+ stringLength(const String& s)
+ {
+ return s.length();
+ }
+
+ inline
+ String&
+ stringAppend(String&s, const String& a)
+ {
+ return s.append(a);
+ }
+
+ inline
+ String&
+ stringAppend(String& s, size_t n, char c)
+ {
+ return s.append(n, c);
+ }
+
+ template
+ String&
+ stringAppend(String& s, Iterator begin, Iterator end)
+ {
+ return s.append(begin, end);
+ }
+
+ template
+ std::string
+ toUTF8String(T&& t)
+ {
+ return std::forward(t);
+ }
+
+ inline
+ bool
+ empty(const std::string& s)
+ {
+ return s.empty();
+ }
+} // namespace cxxopts
+
+//ifdef CXXOPTS_USE_UNICODE
+#endif
+
+namespace cxxopts
+{
+ namespace
+ {
+#ifdef _WIN32
+ const std::string LQUOTE("\'");
+ const std::string RQUOTE("\'");
+#else
+ const std::string LQUOTE("‘");
+ const std::string RQUOTE("’");
+#endif
+ } // namespace
+
+#if defined(__GNUC__)
+// GNU GCC with -Weffc++ will issue a warning regarding the upcoming class, we want to silence it:
+// warning: base class 'class std::enable_shared_from_this' has accessible non-virtual destructor
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
+#pragma GCC diagnostic ignored "-Weffc++"
+// This will be ignored under other compilers like LLVM clang.
+#endif
+ class Value : public std::enable_shared_from_this
+ {
+ public:
+
+ virtual ~Value() = default;
+
+ virtual
+ std::shared_ptr
+ clone() const = 0;
+
+ virtual void
+ parse(const std::string& text) const = 0;
+
+ virtual void
+ parse() const = 0;
+
+ virtual bool
+ has_default() const = 0;
+
+ virtual bool
+ is_container() const = 0;
+
+ virtual bool
+ has_implicit() const = 0;
+
+ virtual std::string
+ get_default_value() const = 0;
+
+ virtual std::string
+ get_implicit_value() const = 0;
+
+ virtual std::shared_ptr
+ default_value(const std::string& value) = 0;
+
+ virtual std::shared_ptr
+ implicit_value(const std::string& value) = 0;
+
+ virtual std::shared_ptr
+ no_implicit_value() = 0;
+
+ virtual bool
+ is_boolean() const = 0;
+ };
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
+ class OptionException : public std::exception
+ {
+ public:
+ explicit OptionException(std::string message)
+ : m_message(std::move(message))
+ {
+ }
+
+ CXXOPTS_NODISCARD
+ const char*
+ what() const noexcept override
+ {
+ return m_message.c_str();
+ }
+
+ private:
+ std::string m_message;
+ };
+
+ class OptionSpecException : public OptionException
+ {
+ public:
+
+ explicit OptionSpecException(const std::string& message)
+ : OptionException(message)
+ {
+ }
+ };
+
+ class OptionParseException : public OptionException
+ {
+ public:
+ explicit OptionParseException(const std::string& message)
+ : OptionException(message)
+ {
+ }
+ };
+
+ class option_exists_error : public OptionSpecException
+ {
+ public:
+ explicit option_exists_error(const std::string& option)
+ : OptionSpecException("Option " + LQUOTE + option + RQUOTE + " already exists")
+ {
+ }
+ };
+
+ class invalid_option_format_error : public OptionSpecException
+ {
+ public:
+ explicit invalid_option_format_error(const std::string& format)
+ : OptionSpecException("Invalid option format " + LQUOTE + format + RQUOTE)
+ {
+ }
+ };
+
+ class option_syntax_exception : public OptionParseException {
+ public:
+ explicit option_syntax_exception(const std::string& text)
+ : OptionParseException("Argument " + LQUOTE + text + RQUOTE +
+ " starts with a - but has incorrect syntax")
+ {
+ }
+ };
+
+ class option_not_exists_exception : public OptionParseException
+ {
+ public:
+ explicit option_not_exists_exception(const std::string& option)
+ : OptionParseException("Option " + LQUOTE + option + RQUOTE + " does not exist")
+ {
+ }
+ };
+
+ class missing_argument_exception : public OptionParseException
+ {
+ public:
+ explicit missing_argument_exception(const std::string& option)
+ : OptionParseException(
+ "Option " + LQUOTE + option + RQUOTE + " is missing an argument"
+ )
+ {
+ }
+ };
+
+ class option_requires_argument_exception : public OptionParseException
+ {
+ public:
+ explicit option_requires_argument_exception(const std::string& option)
+ : OptionParseException(
+ "Option " + LQUOTE + option + RQUOTE + " requires an argument"
+ )
+ {
+ }
+ };
+
+ class option_not_has_argument_exception : public OptionParseException
+ {
+ public:
+ option_not_has_argument_exception
+ (
+ const std::string& option,
+ const std::string& arg
+ )
+ : OptionParseException(
+ "Option " + LQUOTE + option + RQUOTE +
+ " does not take an argument, but argument " +
+ LQUOTE + arg + RQUOTE + " given"
+ )
+ {
+ }
+ };
+
+ class option_not_present_exception : public OptionParseException
+ {
+ public:
+ explicit option_not_present_exception(const std::string& option)
+ : OptionParseException("Option " + LQUOTE + option + RQUOTE + " not present")
+ {
+ }
+ };
+
+ class option_has_no_value_exception : public OptionException
+ {
+ public:
+ explicit option_has_no_value_exception(const std::string& option)
+ : OptionException(
+ !option.empty() ?
+ ("Option " + LQUOTE + option + RQUOTE + " has no value") :
+ "Option has no value")
+ {
+ }
+ };
+
+ class argument_incorrect_type : public OptionParseException
+ {
+ public:
+ explicit argument_incorrect_type
+ (
+ const std::string& arg
+ )
+ : OptionParseException(
+ "Argument " + LQUOTE + arg + RQUOTE + " failed to parse"
+ )
+ {
+ }
+ };
+
+ class option_required_exception : public OptionParseException
+ {
+ public:
+ explicit option_required_exception(const std::string& option)
+ : OptionParseException(
+ "Option " + LQUOTE + option + RQUOTE + " is required but not present"
+ )
+ {
+ }
+ };
+
+ template
+ void throw_or_mimic(const std::string& text)
+ {
+ static_assert(std::is_base_of::value,
+ "throw_or_mimic only works on std::exception and "
+ "deriving classes");
+
+#ifndef CXXOPTS_NO_EXCEPTIONS
+ // If CXXOPTS_NO_EXCEPTIONS is not defined, just throw
+ throw T{text};
+#else
+ // Otherwise manually instantiate the exception, print what() to stderr,
+ // and exit
+ T exception{text};
+ std::cerr << exception.what() << std::endl;
+ std::exit(EXIT_FAILURE);
+#endif
+ }
+
+ namespace values
+ {
+ namespace parser_tool
+ {
+ struct IntegerDesc
+ {
+ std::string negative = "";
+ std::string base = "";
+ std::string value = "";
+ };
+ struct ArguDesc {
+ std::string arg_name = "";
+ bool grouping = false;
+ bool set_value = false;
+ std::string value = "";
+ };
+#ifdef CXXOPTS_NO_REGEX
+ inline IntegerDesc SplitInteger(const std::string &text)
+ {
+ if (text.empty())
+ {
+ throw_or_mimic(text);
+ }
+ IntegerDesc desc;
+ const char *pdata = text.c_str();
+ if (*pdata == '-')
+ {
+ pdata += 1;
+ desc.negative = "-";
+ }
+ if (strncmp(pdata, "0x", 2) == 0)
+ {
+ pdata += 2;
+ desc.base = "0x";
+ }
+ if (*pdata != '\0')
+ {
+ desc.value = std::string(pdata);
+ }
+ else
+ {
+ throw_or_mimic(text);
+ }
+ return desc;
+ }
+
+ inline bool IsTrueText(const std::string &text)
+ {
+ const char *pdata = text.c_str();
+ if (*pdata == 't' || *pdata == 'T')
+ {
+ pdata += 1;
+ if (strncmp(pdata, "rue\0", 4) == 0)
+ {
+ return true;
+ }
+ }
+ else if (strncmp(pdata, "1\0", 2) == 0)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ inline bool IsFalseText(const std::string &text)
+ {
+ const char *pdata = text.c_str();
+ if (*pdata == 'f' || *pdata == 'F')
+ {
+ pdata += 1;
+ if (strncmp(pdata, "alse\0", 5) == 0)
+ {
+ return true;
+ }
+ }
+ else if (strncmp(pdata, "0\0", 2) == 0)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ inline std::pair SplitSwitchDef(const std::string &text)
+ {
+ std::string short_sw, long_sw;
+ const char *pdata = text.c_str();
+ if (isalnum(*pdata) && *(pdata + 1) == ',') {
+ short_sw = std::string(1, *pdata);
+ pdata += 2;
+ }
+ while (*pdata == ' ') { pdata += 1; }
+ if (isalnum(*pdata)) {
+ const char *store = pdata;
+ pdata += 1;
+ while (isalnum(*pdata) || *pdata == '-' || *pdata == '_') {
+ pdata += 1;
+ }
+ if (*pdata == '\0') {
+ long_sw = std::string(store, pdata - store);
+ } else {
+ throw_or_mimic(text);
+ }
+ }
+ return std::pair(short_sw, long_sw);
+ }
+
+ inline ArguDesc ParseArgument(const char *arg, bool &matched)
+ {
+ ArguDesc argu_desc;
+ const char *pdata = arg;
+ matched = false;
+ if (strncmp(pdata, "--", 2) == 0)
+ {
+ pdata += 2;
+ if (isalnum(*pdata))
+ {
+ argu_desc.arg_name.push_back(*pdata);
+ pdata += 1;
+ while (isalnum(*pdata) || *pdata == '-' || *pdata == '_')
+ {
+ argu_desc.arg_name.push_back(*pdata);
+ pdata += 1;
+ }
+ if (argu_desc.arg_name.length() > 1)
+ {
+ if (*pdata == '=')
+ {
+ argu_desc.set_value = true;
+ pdata += 1;
+ if (*pdata != '\0')
+ {
+ argu_desc.value = std::string(pdata);
+ }
+ matched = true;
+ }
+ else if (*pdata == '\0')
+ {
+ matched = true;
+ }
+ }
+ }
+ }
+ else if (strncmp(pdata, "-", 1) == 0)
+ {
+ pdata += 1;
+ argu_desc.grouping = true;
+ while (isalnum(*pdata))
+ {
+ argu_desc.arg_name.push_back(*pdata);
+ pdata += 1;
+ }
+ matched = !argu_desc.arg_name.empty() && *pdata == '\0';
+ }
+ return argu_desc;
+ }
+
+#else // CXXOPTS_NO_REGEX
+
+ namespace
+ {
+
+ std::basic_regex integer_pattern
+ ("(-)?(0x)?([0-9a-zA-Z]+)|((0x)?0)");
+ std::basic_regex truthy_pattern
+ ("(t|T)(rue)?|1");
+ std::basic_regex falsy_pattern
+ ("(f|F)(alse)?|0");
+
+ std::basic_regex option_matcher
+ ("--([[:alnum:]][-_[:alnum:]]+)(=(.*))?|-([[:alnum:]]+)");
+ std::basic_regex option_specifier
+ ("(([[:alnum:]]),)?[ ]*([[:alnum:]][-_[:alnum:]]*)?");
+
+ } // namespace
+
+ inline IntegerDesc SplitInteger(const std::string &text)
+ {
+ std::smatch match;
+ std::regex_match(text, match, integer_pattern);
+
+ if (match.length() == 0)
+ {
+ throw_or_mimic(text);
+ }
+
+ IntegerDesc desc;
+ desc.negative = match[1];
+ desc.base = match[2];
+ desc.value = match[3];
+
+ if (match.length(4) > 0)
+ {
+ desc.base = match[5];
+ desc.value = "0";
+ return desc;
+ }
+
+ return desc;
+ }
+
+ inline bool IsTrueText(const std::string &text)
+ {
+ std::smatch result;
+ std::regex_match(text, result, truthy_pattern);
+ return !result.empty();
+ }
+
+ inline bool IsFalseText(const std::string &text)
+ {
+ std::smatch result;
+ std::regex_match(text, result, falsy_pattern);
+ return !result.empty();
+ }
+
+ inline std::pair SplitSwitchDef(const std::string &text)
+ {
+ std::match_results result;
+ std::regex_match(text.c_str(), result, option_specifier);
+ if (result.empty())
+ {
+ throw_or_mimic(text);
+ }
+
+ const std::string& short_sw = result[2];
+ const std::string& long_sw = result[3];
+
+ return std::pair(short_sw, long_sw);
+ }
+
+ inline ArguDesc ParseArgument(const char *arg, bool &matched)
+ {
+ std::match_results result;
+ std::regex_match(arg, result, option_matcher);
+ matched = !result.empty();
+
+ ArguDesc argu_desc;
+ if (matched) {
+ argu_desc.arg_name = result[1].str();
+ argu_desc.set_value = result[2].length() > 0;
+ argu_desc.value = result[3].str();
+ if (result[4].length() > 0)
+ {
+ argu_desc.grouping = true;
+ argu_desc.arg_name = result[4].str();
+ }
+ }
+
+ return argu_desc;
+ }
+
+#endif // CXXOPTS_NO_REGEX
+#undef CXXOPTS_NO_REGEX
+ }
+
+ namespace detail
+ {
+ template
+ struct SignedCheck;
+
+ template
+ struct SignedCheck
+ {
+ template
+ void
+ operator()(bool negative, U u, const std::string& text)
+ {
+ if (negative)
+ {
+ if (u > static_cast((std::numeric_limits::min)()))
+ {
+ throw_or_mimic(text);
+ }
+ }
+ else
+ {
+ if (u > static_cast((std::numeric_limits::max)()))
+ {
+ throw_or_mimic(text);
+ }
+ }
+ }
+ };
+
+ template
+ struct SignedCheck
+ {
+ template
+ void
+ operator()(bool, U, const std::string&) const {}
+ };
+
+ template
+ void
+ check_signed_range(bool negative, U value, const std::string& text)
+ {
+ SignedCheck::is_signed>()(negative, value, text);
+ }
+ } // namespace detail
+
+ template
+ void
+ checked_negate(R& r, T&& t, const std::string&, std::true_type)
+ {
+ // if we got to here, then `t` is a positive number that fits into
+ // `R`. So to avoid MSVC C4146, we first cast it to `R`.
+ // See https://github.com/jarro2783/cxxopts/issues/62 for more details.
+ r = static_cast(-static_cast(t-1)-1);
+ }
+
+ template
+ void
+ checked_negate(R&, T&&, const std::string& text, std::false_type)
+ {
+ throw_or_mimic(text);
+ }
+
+ template
+ void
+ integer_parser(const std::string& text, T& value)
+ {
+ parser_tool::IntegerDesc int_desc = parser_tool::SplitInteger(text);
+
+ using US = typename std::make_unsigned::type;
+ constexpr bool is_signed = std::numeric_limits::is_signed;
+
+ const bool negative = int_desc.negative.length() > 0;
+ const uint8_t base = int_desc.base.length() > 0 ? 16 : 10;
+ const std::string & value_match = int_desc.value;
+
+ US result = 0;
+
+ for (char ch : value_match)
+ {
+ US digit = 0;
+
+ if (ch >= '0' && ch <= '9')
+ {
+ digit = static_cast(ch - '0');
+ }
+ else if (base == 16 && ch >= 'a' && ch <= 'f')
+ {
+ digit = static_cast(ch - 'a' + 10);
+ }
+ else if (base == 16 && ch >= 'A' && ch <= 'F')
+ {
+ digit = static_cast(ch - 'A' + 10);
+ }
+ else
+ {
+ throw_or_mimic(text);
+ }
+
+ const US next = static_cast(result * base + digit);
+ if (result > next)
+ {
+ throw_or_mimic(text);
+ }
+
+ result = next;
+ }
+
+ detail::check_signed_range(negative, result, text);
+
+ if (negative)
+ {
+ checked_negate(value, result, text, std::integral_constant());
+ }
+ else
+ {
+ value = static_cast(result);
+ }
+ }
+
+ template
+ void stringstream_parser(const std::string& text, T& value)
+ {
+ std::stringstream in(text);
+ in >> value;
+ if (!in) {
+ throw_or_mimic(text);
+ }
+ }
+
+ template ::value>::type* = nullptr
+ >
+ void parse_value(const std::string& text, T& value)
+ {
+ integer_parser(text, value);
+ }
+
+ inline
+ void
+ parse_value(const std::string& text, bool& value)
+ {
+ if (parser_tool::IsTrueText(text))
+ {
+ value = true;
+ return;
+ }
+
+ if (parser_tool::IsFalseText(text))
+ {
+ value = false;
+ return;
+ }
+
+ throw_or_mimic(text);
+ }
+
+ inline
+ void
+ parse_value(const std::string& text, std::string& value)
+ {
+ value = text;
+ }
+
+ // The fallback parser. It uses the stringstream parser to parse all types
+ // that have not been overloaded explicitly. It has to be placed in the
+ // source code before all other more specialized templates.
+ template ::value>::type* = nullptr
+ >
+ void
+ parse_value(const std::string& text, T& value) {
+ stringstream_parser(text, value);
+ }
+
+ template
+ void
+ parse_value(const std::string& text, std::vector& value)
+ {
+ if (text.empty()) {
+ T v;
+ parse_value(text, v);
+ value.emplace_back(std::move(v));
+ return;
+ }
+ std::stringstream in(text);
+ std::string token;
+ while(!in.eof() && std::getline(in, token, CXXOPTS_VECTOR_DELIMITER)) {
+ T v;
+ parse_value(token, v);
+ value.emplace_back(std::move(v));
+ }
+ }
+
+#ifdef CXXOPTS_HAS_OPTIONAL
+ template
+ void
+ parse_value(const std::string& text, std::optional& value)
+ {
+ T result;
+ parse_value(text, result);
+ value = std::move(result);
+ }
+#endif
+
+ inline
+ void parse_value(const std::string& text, char& c)
+ {
+ if (text.length() != 1)
+ {
+ throw_or_mimic(text);
+ }
+
+ c = text[0];
+ }
+
+ template
+ struct type_is_container
+ {
+ static constexpr bool value = false;
+ };
+
+ template
+ struct type_is_container>
+ {
+ static constexpr bool value = true;
+ };
+
+ template
+ class abstract_value : public Value
+ {
+ using Self = abstract_value;
+
+ public:
+ abstract_value()
+ : m_result(std::make_shared())
+ , m_store(m_result.get())
+ {
+ }
+
+ explicit abstract_value(T* t)
+ : m_store(t)
+ {
+ }
+
+ ~abstract_value() override = default;
+
+ abstract_value& operator=(const abstract_value&) = default;
+
+ abstract_value(const abstract_value& rhs)
+ {
+ if (rhs.m_result)
+ {
+ m_result = std::make_shared();
+ m_store = m_result.get();
+ }
+ else
+ {
+ m_store = rhs.m_store;
+ }
+
+ m_default = rhs.m_default;
+ m_implicit = rhs.m_implicit;
+ m_default_value = rhs.m_default_value;
+ m_implicit_value = rhs.m_implicit_value;
+ }
+
+ void
+ parse(const std::string& text) const override
+ {
+ parse_value(text, *m_store);
+ }
+
+ bool
+ is_container() const override
+ {
+ return type_is_container::value;
+ }
+
+ void
+ parse() const override
+ {
+ parse_value(m_default_value, *m_store);
+ }
+
+ bool
+ has_default() const override
+ {
+ return m_default;
+ }
+
+ bool
+ has_implicit() const override
+ {
+ return m_implicit;
+ }
+
+ std::shared_ptr
+ default_value(const std::string& value) override
+ {
+ m_default = true;
+ m_default_value = value;
+ return shared_from_this();
+ }
+
+ std::shared_ptr
+ implicit_value(const std::string& value) override
+ {
+ m_implicit = true;
+ m_implicit_value = value;
+ return shared_from_this();
+ }
+
+ std::shared_ptr
+ no_implicit_value() override
+ {
+ m_implicit = false;
+ return shared_from_this();
+ }
+
+ std::string
+ get_default_value() const override
+ {
+ return m_default_value;
+ }
+
+ std::string
+ get_implicit_value() const override
+ {
+ return m_implicit_value;
+ }
+
+ bool
+ is_boolean() const override
+ {
+ return std::is_same::value;
+ }
+
+ const T&
+ get() const
+ {
+ if (m_store == nullptr)
+ {
+ return *m_result;
+ }
+ return *m_store;
+ }
+
+ protected:
+ std::shared_ptr m_result{};
+ T* m_store{};
+
+ bool m_default = false;
+ bool m_implicit = false;
+
+ std::string m_default_value{};
+ std::string m_implicit_value{};
+ };
+
+ template
+ class standard_value : public abstract_value
+ {
+ public:
+ using abstract_value::abstract_value;
+
+ CXXOPTS_NODISCARD
+ std::shared_ptr
+ clone() const override
+ {
+ return std::make_shared>(*this);
+ }
+ };
+
+ template <>
+ class standard_value : public abstract_value
+ {
+ public:
+ ~standard_value() override = default;
+
+ standard_value()
+ {
+ set_default_and_implicit();
+ }
+
+ explicit standard_value(bool* b)
+ : abstract_value(b)
+ {
+ set_default_and_implicit();
+ }
+
+ std::shared_ptr
+ clone() const override
+ {
+ return std::make_shared>(*this);
+ }
+
+ private:
+
+ void
+ set_default_and_implicit()
+ {
+ m_default = true;
+ m_default_value = "false";
+ m_implicit = true;
+ m_implicit_value = "true";
+ }
+ };
+ } // namespace values
+
+ template
+ std::shared_ptr
+ value()
+ {
+ return std::make_shared>();
+ }
+
+ template
+ std::shared_ptr
+ value(T& t)
+ {
+ return std::make_shared>(&t);
+ }
+
+ class OptionAdder;
+
+ class OptionDetails
+ {
+ public:
+ OptionDetails
+ (
+ std::string short_,
+ std::string long_,
+ String desc,
+ std::shared_ptr val
+ )
+ : m_short(std::move(short_))
+ , m_long(std::move(long_))
+ , m_desc(std::move(desc))
+ , m_value(std::move(val))
+ , m_count(0)
+ {
+ m_hash = std::hash{}(m_long + m_short);
+ }
+
+ OptionDetails(const OptionDetails& rhs)
+ : m_desc(rhs.m_desc)
+ , m_value(rhs.m_value->clone())
+ , m_count(rhs.m_count)
+ {
+ }
+
+ OptionDetails(OptionDetails&& rhs) = default;
+
+ CXXOPTS_NODISCARD
+ const String&
+ description() const
+ {
+ return m_desc;
+ }
+
+ CXXOPTS_NODISCARD
+ const Value&
+ value() const {
+ return *m_value;
+ }
+
+ CXXOPTS_NODISCARD
+ std::shared_ptr
+ make_storage() const
+ {
+ return m_value->clone();
+ }
+
+ CXXOPTS_NODISCARD
+ const std::string&
+ short_name() const
+ {
+ return m_short;
+ }
+
+ CXXOPTS_NODISCARD
+ const std::string&
+ long_name() const
+ {
+ return m_long;
+ }
+
+ size_t
+ hash() const
+ {
+ return m_hash;
+ }
+
+ private:
+ std::string m_short{};
+ std::string m_long{};
+ String m_desc{};
+ std::shared_ptr m_value{};
+ int m_count;
+
+ size_t m_hash{};
+ };
+
+ struct HelpOptionDetails
+ {
+ std::string s;
+ std::string l;
+ String desc;
+ bool has_default;
+ std::string default_value;
+ bool has_implicit;
+ std::string implicit_value;
+ std::string arg_help;
+ bool is_container;
+ bool is_boolean;
+ };
+
+ struct HelpGroupDetails
+ {
+ std::string name{};
+ std::string description{};
+ std::vector options{};
+ };
+
+ class OptionValue
+ {
+ public:
+ void
+ parse
+ (
+ const std::shared_ptr& details,
+ const std::string& text
+ )
+ {
+ ensure_value(details);
+ ++m_count;
+ m_value->parse(text);
+ m_long_name = &details->long_name();
+ }
+
+ void
+ parse_default(const std::shared_ptr& details)
+ {
+ ensure_value(details);
+ m_default = true;
+ m_long_name = &details->long_name();
+ m_value->parse();
+ }
+
+ void
+ parse_no_value(const std::shared_ptr& details)
+ {
+ m_long_name = &details->long_name();
+ }
+
+#if defined(CXXOPTS_NULL_DEREF_IGNORE)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wnull-dereference"
+#endif
+
+ CXXOPTS_NODISCARD
+ size_t
+ count() const noexcept
+ {
+ return m_count;
+ }
+
+#if defined(CXXOPTS_NULL_DEREF_IGNORE)
+#pragma GCC diagnostic pop
+#endif
+
+ // TODO: maybe default options should count towards the number of arguments
+ CXXOPTS_NODISCARD
+ bool
+ has_default() const noexcept
+ {
+ return m_default;
+ }
+
+ template
+ const T&
+ as() const
+ {
+ if (m_value == nullptr) {
+ throw_or_mimic(
+ m_long_name == nullptr ? "" : *m_long_name);
+ }
+
+#ifdef CXXOPTS_NO_RTTI
+ return static_cast&>(*m_value).get();
+#else
+ return dynamic_cast&>(*m_value).get();
+#endif
+ }
+
+ private:
+ void
+ ensure_value(const std::shared_ptr& details)
+ {
+ if (m_value == nullptr)
+ {
+ m_value = details->make_storage();
+ }
+ }
+
+
+ const std::string* m_long_name = nullptr;
+ // Holding this pointer is safe, since OptionValue's only exist in key-value pairs,
+ // where the key has the string we point to.
+ std::shared_ptr m_value{};
+ size_t m_count = 0;
+ bool m_default = false;
+ };
+
+ class KeyValue
+ {
+ public:
+ KeyValue(std::string key_, std::string value_)
+ : m_key(std::move(key_))
+ , m_value(std::move(value_))
+ {
+ }
+
+ CXXOPTS_NODISCARD
+ const std::string&
+ key() const
+ {
+ return m_key;
+ }
+
+ CXXOPTS_NODISCARD
+ const std::string&
+ value() const
+ {
+ return m_value;
+ }
+
+ template
+ T
+ as() const
+ {
+ T result;
+ values::parse_value(m_value, result);
+ return result;
+ }
+
+ private:
+ std::string m_key;
+ std::string m_value;
+ };
+
+ using ParsedHashMap = std::unordered_map;
+ using NameHashMap = std::unordered_map;
+
+ class ParseResult
+ {
+ public:
+ class Iterator
+ {
+ public:
+ using iterator_category = std::forward_iterator_tag;
+ using value_type = KeyValue;
+ using difference_type = void;
+ using pointer = const KeyValue*;
+ using reference = const KeyValue&;
+
+ Iterator() = default;
+ Iterator(const Iterator&) = default;
+
+ Iterator(const ParseResult *pr, bool end=false)
+ : m_pr(pr)
+ , m_iter(end? pr->m_defaults.end(): pr->m_sequential.begin())
+ {
+ }
+
+ Iterator& operator++()
+ {
+ ++m_iter;
+ if(m_iter == m_pr->m_sequential.end())
+ {
+ m_iter = m_pr->m_defaults.begin();
+ return *this;
+ }
+ return *this;
+ }
+
+ Iterator operator++(int)
+ {
+ Iterator retval = *this;
+ ++(*this);
+ return retval;
+ }
+
+ bool operator==(const Iterator& other) const
+ {
+ return m_iter == other.m_iter;
+ }
+
+ bool operator!=(const Iterator& other) const
+ {
+ return !(*this == other);
+ }
+
+ const KeyValue& operator*()
+ {
+ return *m_iter;
+ }
+
+ const KeyValue* operator->()
+ {
+ return m_iter.operator->();
+ }
+
+ private:
+ const ParseResult* m_pr;
+ std::vector::const_iterator m_iter;
+ };
+
+ ParseResult() = default;
+ ParseResult(const ParseResult&) = default;
+
+ ParseResult(NameHashMap&& keys, ParsedHashMap&& values, std::vector sequential,
+ std::vector default_opts, std::vector&& unmatched_args)
+ : m_keys(std::move(keys))
+ , m_values(std::move(values))
+ , m_sequential(std::move(sequential))
+ , m_defaults(std::move(default_opts))
+ , m_unmatched(std::move(unmatched_args))
+ {
+ }
+
+ ParseResult& operator=(ParseResult&&) = default;
+ ParseResult& operator=(const ParseResult&) = default;
+
+ Iterator
+ begin() const
+ {
+ return Iterator(this);
+ }
+
+ Iterator
+ end() const
+ {
+ return Iterator(this, true);
+ }
+
+ size_t
+ count(const std::string& o) const
+ {
+ auto iter = m_keys.find(o);
+ if (iter == m_keys.end())
+ {
+ return 0;
+ }
+
+ auto viter = m_values.find(iter->second);
+
+ if (viter == m_values.end())
+ {
+ return 0;
+ }
+
+ return viter->second.count();
+ }
+
+ const OptionValue&
+ operator[](const std::string& option) const
+ {
+ auto iter = m_keys.find(option);
+
+ if (iter == m_keys.end())
+ {
+ throw_or_mimic(option);
+ }
+
+ auto viter = m_values.find(iter->second);
+
+ if (viter == m_values.end())
+ {
+ throw_or_mimic(option);
+ }
+
+ return viter->second;
+ }
+
+ const std::vector&
+ arguments() const
+ {
+ return m_sequential;
+ }
+
+ const std::vector&
+ unmatched() const
+ {
+ return m_unmatched;
+ }
+
+ const std::vector&
+ defaults() const
+ {
+ return m_defaults;
+ }
+
+ const std::string
+ arguments_string() const
+ {
+ std::string result;
+ for(const auto& kv: m_sequential)
+ {
+ result += kv.key() + " = " + kv.value() + "\n";
+ }
+ for(const auto& kv: m_defaults)
+ {
+ result += kv.key() + " = " + kv.value() + " " + "(default)" + "\n";
+ }
+ return result;
+ }
+
+ private:
+ NameHashMap m_keys{};
+ ParsedHashMap m_values{};
+ std::vector m_sequential{};
+ std::vector m_defaults{};
+ std::vector m_unmatched{};
+ };
+
+ struct Option
+ {
+ Option
+ (
+ std::string opts,
+ std::string desc,
+ std::shared_ptr value = ::cxxopts::value(),
+ std::string arg_help = ""
+ )
+ : opts_(std::move(opts))
+ , desc_(std::move(desc))
+ , value_(std::move(value))
+ , arg_help_(std::move(arg_help))
+ {
+ }
+
+ std::string opts_;
+ std::string desc_;
+ std::shared_ptr value_;
+ std::string arg_help_;
+ };
+
+ using OptionMap = std::unordered_map>;
+ using PositionalList = std::vector;
+ using PositionalListIterator = PositionalList::const_iterator;
+
+ class OptionParser
+ {
+ public:
+ OptionParser(const OptionMap& options, const PositionalList& positional, bool allow_unrecognised)
+ : m_options(options)
+ , m_positional(positional)
+ , m_allow_unrecognised(allow_unrecognised)
+ {
+ }
+
+ ParseResult
+ parse(int argc, const char* const* argv);
+
+ bool
+ consume_positional(const std::string& a, PositionalListIterator& next);
+
+ void
+ checked_parse_arg
+ (
+ int argc,
+ const char* const* argv,
+ int& current,
+ const std::shared_ptr& value,
+ const std::string& name
+ );
+
+ void
+ add_to_option(OptionMap::const_iterator iter, const std::string& option, const std::string& arg);
+
+ void
+ parse_option
+ (
+ const std::shared_ptr& value,
+ const std::string& name,
+ const std::string& arg = ""
+ );
+
+ void
+ parse_default(const std::shared_ptr& details);
+
+ void
+ parse_no_value(const std::shared_ptr& details);
+
+ private:
+
+ void finalise_aliases();
+
+ const OptionMap& m_options;
+ const PositionalList& m_positional;
+
+ std::vector m_sequential{};
+ std::vector m_defaults{};
+ bool m_allow_unrecognised;
+
+ ParsedHashMap m_parsed{};
+ NameHashMap m_keys{};
+ };
+
+ class Options
+ {
+ public:
+
+ explicit Options(std::string program, std::string help_string = "")
+ : m_program(std::move(program))
+ , m_help_string(toLocalString(std::move(help_string)))
+ , m_custom_help("[OPTION...]")
+ , m_positional_help("positional parameters")
+ , m_show_positional(false)
+ , m_allow_unrecognised(false)
+ , m_width(76)
+ , m_tab_expansion(false)
+ , m_options(std::make_shared())
+ {
+ }
+
+ Options&
+ positional_help(std::string help_text)
+ {
+ m_positional_help = std::move(help_text);
+ return *this;
+ }
+
+ Options&
+ custom_help(std::string help_text)
+ {
+ m_custom_help = std::move(help_text);
+ return *this;
+ }
+
+ Options&
+ show_positional_help()
+ {
+ m_show_positional = true;
+ return *this;
+ }
+
+ Options&
+ allow_unrecognised_options()
+ {
+ m_allow_unrecognised = true;
+ return *this;
+ }
+
+ Options&
+ set_width(size_t width)
+ {
+ m_width = width;
+ return *this;
+ }
+
+ Options&
+ set_tab_expansion(bool expansion=true)
+ {
+ m_tab_expansion = expansion;
+ return *this;
+ }
+
+ ParseResult
+ parse(int argc, const char* const* argv);
+
+ OptionAdder
+ add_options(std::string group = "");
+
+ void
+ add_options
+ (
+ const std::string& group,
+ std::initializer_list options
+ );
+
+ void
+ add_option
+ (
+ const std::string& group,
+ const Option& option
+ );
+
+ void
+ add_option
+ (
+ const std::string& group,
+ const std::string& s,
+ const std::string& l,
+ std::string desc,
+ const std::shared_ptr& value,
+ std::string arg_help
+ );
+
+ //parse positional arguments into the given option
+ void
+ parse_positional(std::string option);
+
+ void
+ parse_positional(std::vector options);
+
+ void
+ parse_positional(std::initializer_list options);
+
+ template
+ void
+ parse_positional(Iterator begin, Iterator end) {
+ parse_positional(std::vector{begin, end});
+ }
+
+ std::string
+ help(const std::vector& groups = {}) const;
+
+ std::vector
+ groups() const;
+
+ const HelpGroupDetails&
+ group_help(const std::string& group) const;
+
+ const std::string& program() const
+ {
+ return m_program;
+ }
+
+ private:
+
+ void
+ add_one_option
+ (
+ const std::string& option,
+ const std::shared_ptr& details
+ );
+
+ String
+ help_one_group(const std::string& group) const;
+
+ void
+ generate_group_help
+ (
+ String& result,
+ const std::vector& groups
+ ) const;
+
+ void
+ generate_all_groups_help(String& result) const;
+
+ std::string m_program{};
+ String m_help_string{};
+ std::string m_custom_help{};
+ std::string m_positional_help{};
+ bool m_show_positional;
+ bool m_allow_unrecognised;
+ size_t m_width;
+ bool m_tab_expansion;
+
+ std::shared_ptr m_options;
+ std::vector m_positional{};
+ std::unordered_set m_positional_set{};
+
+ //mapping from groups to help options
+ std::map m_help{};
+
+ std::list m_option_list{};
+ std::unordered_map m_option_map{};
+ };
+
+ class OptionAdder
+ {
+ public:
+
+ OptionAdder(Options& options, std::string group)
+ : m_options(options), m_group(std::move(group))
+ {
+ }
+
+ OptionAdder&
+ operator()
+ (
+ const std::string& opts,
+ const std::string& desc,
+ const std::shared_ptr& value
+ = ::cxxopts::value(),
+ std::string arg_help = ""
+ );
+
+ private:
+ Options& m_options;
+ std::string m_group;
+ };
+
+ namespace
+ {
+ constexpr size_t OPTION_LONGEST = 30;
+ constexpr size_t OPTION_DESC_GAP = 2;
+
+ String
+ format_option
+ (
+ const HelpOptionDetails& o
+ )
+ {
+ const auto& s = o.s;
+ const auto& l = o.l;
+
+ String result = " ";
+
+ if (!s.empty())
+ {
+ result += "-" + toLocalString(s);
+ if (!l.empty())
+ {
+ result += ",";
+ }
+ }
+ else
+ {
+ result += " ";
+ }
+
+ if (!l.empty())
+ {
+ result += " --" + toLocalString(l);
+ }
+
+ auto arg = !o.arg_help.empty() ? toLocalString(o.arg_help) : "arg";
+
+ if (!o.is_boolean)
+ {
+ if (o.has_implicit)
+ {
+ result += " [=" + arg + "(=" + toLocalString(o.implicit_value) + ")]";
+ }
+ else
+ {
+ result += " " + arg;
+ }
+ }
+
+ return result;
+ }
+
+ String
+ format_description
+ (
+ const HelpOptionDetails& o,
+ size_t start,
+ size_t allowed,
+ bool tab_expansion
+ )
+ {
+ auto desc = o.desc;
+
+ if (o.has_default && (!o.is_boolean || o.default_value != "false"))
+ {
+ if(!o.default_value.empty())
+ {
+ desc += toLocalString(" (default: " + o.default_value + ")");
+ }
+ else
+ {
+ desc += toLocalString(" (default: \"\")");
+ }
+ }
+
+ String result;
+
+ if (tab_expansion)
+ {
+ String desc2;
+ auto size = size_t{ 0 };
+ for (auto c = std::begin(desc); c != std::end(desc); ++c)
+ {
+ if (*c == '\n')
+ {
+ desc2 += *c;
+ size = 0;
+ }
+ else if (*c == '\t')
+ {
+ auto skip = 8 - size % 8;
+ stringAppend(desc2, skip, ' ');
+ size += skip;
+ }
+ else
+ {
+ desc2 += *c;
+ ++size;
+ }
+ }
+ desc = desc2;
+ }
+
+ desc += " ";
+
+ auto current = std::begin(desc);
+ auto previous = current;
+ auto startLine = current;
+ auto lastSpace = current;
+
+ auto size = size_t{};
+
+ bool appendNewLine;
+ bool onlyWhiteSpace = true;
+
+ while (current != std::end(desc))
+ {
+ appendNewLine = false;
+
+ if (std::isblank(*previous))
+ {
+ lastSpace = current;
+ }
+
+ if (!std::isblank(*current))
+ {
+ onlyWhiteSpace = false;
+ }
+
+ while (*current == '\n')
+ {
+ previous = current;
+ ++current;
+ appendNewLine = true;
+ }
+
+ if (!appendNewLine && size >= allowed)
+ {
+ if (lastSpace != startLine)
+ {
+ current = lastSpace;
+ previous = current;
+ }
+ appendNewLine = true;
+ }
+
+ if (appendNewLine)
+ {
+ stringAppend(result, startLine, current);
+ startLine = current;
+ lastSpace = current;
+
+ if (*previous != '\n')
+ {
+ stringAppend(result, "\n");
+ }
+
+ stringAppend(result, start, ' ');
+
+ if (*previous != '\n')
+ {
+ stringAppend(result, lastSpace, current);
+ }
+
+ onlyWhiteSpace = true;
+ size = 0;
+ }
+
+ previous = current;
+ ++current;
+ ++size;
+ }
+
+ //append whatever is left but ignore whitespace
+ if (!onlyWhiteSpace)
+ {
+ stringAppend(result, startLine, previous);
+ }
+
+ return result;
+ }
+ } // namespace
+
+inline
+void
+Options::add_options
+(
+ const std::string &group,
+ std::initializer_list options
+)
+{
+ OptionAdder option_adder(*this, group);
+ for (const auto &option: options)
+ {
+ option_adder(option.opts_, option.desc_, option.value_, option.arg_help_);
+ }
+}
+
+inline
+OptionAdder
+Options::add_options(std::string group)
+{
+ return OptionAdder(*this, std::move(group));
+}
+
+inline
+OptionAdder&
+OptionAdder::operator()
+(
+ const std::string& opts,
+ const std::string& desc,
+ const std::shared_ptr& value,
+ std::string arg_help
+)
+{
+ std::string short_sw, long_sw;
+ std::tie(short_sw, long_sw) = values::parser_tool::SplitSwitchDef(opts);
+
+ if (!short_sw.length() && !long_sw.length())
+ {
+ throw_or_mimic(opts);
+ }
+ else if (long_sw.length() == 1 && short_sw.length())
+ {
+ throw_or_mimic(opts);
+ }
+
+ auto option_names = []
+ (
+ const std::string &short_,
+ const std::string &long_
+ )
+ {
+ if (long_.length() == 1)
+ {
+ return std::make_tuple(long_, short_);
+ }
+ return std::make_tuple(short_, long_);
+ }(short_sw, long_sw);
+
+ m_options.add_option
+ (
+ m_group,
+ std::get<0>(option_names),
+ std::get<1>(option_names),
+ desc,
+ value,
+ std::move(arg_help)
+ );
+
+ return *this;
+}
+
+inline
+void
+OptionParser::parse_default(const std::shared_ptr& details)
+{
+ // TODO: remove the duplicate code here
+ auto& store = m_parsed[details->hash()];
+ store.parse_default(details);
+ m_defaults.emplace_back(details->long_name(), details->value().get_default_value());
+}
+
+inline
+void
+OptionParser::parse_no_value(const std::shared_ptr& details)
+{
+ auto& store = m_parsed[details->hash()];
+ store.parse_no_value(details);
+}
+
+inline
+void
+OptionParser::parse_option
+(
+ const std::shared_ptr& value,
+ const std::string& /*name*/,
+ const std::string& arg
+)
+{
+ auto hash = value->hash();
+ auto& result = m_parsed[hash];
+ result.parse(value, arg);
+
+ m_sequential.emplace_back(value->long_name(), arg);
+}
+
+inline
+void
+OptionParser::checked_parse_arg
+(
+ int argc,
+ const char* const* argv,
+ int& current,
+ const std::shared_ptr& value,
+ const std::string& name
+)
+{
+ if (current + 1 >= argc)
+ {
+ if (value->value().has_implicit())
+ {
+ parse_option(value, name, value->value().get_implicit_value());
+ }
+ else
+ {
+ throw_or_mimic(name);
+ }
+ }
+ else
+ {
+ if (value->value().has_implicit())
+ {
+ parse_option(value, name, value->value().get_implicit_value());
+ }
+ else
+ {
+ parse_option(value, name, argv[current + 1]);
+ ++current;
+ }
+ }
+}
+
+inline
+void
+OptionParser::add_to_option(OptionMap::const_iterator iter, const std::string& option, const std::string& arg)
+{
+ parse_option(iter->second, option, arg);
+}
+
+inline
+bool
+OptionParser::consume_positional(const std::string& a, PositionalListIterator& next)
+{
+ while (next != m_positional.end())
+ {
+ auto iter = m_options.find(*next);
+ if (iter != m_options.end())
+ {
+ if (!iter->second->value().is_container())
+ {
+ auto& result = m_parsed[iter->second->hash()];
+ if (result.count() == 0)
+ {
+ add_to_option(iter, *next, a);
+ ++next;
+ return true;
+ }
+ ++next;
+ continue;
+ }
+ add_to_option(iter, *next, a);
+ return true;
+ }
+ throw_or_mimic(*next);
+ }
+
+ return false;
+}
+
+inline
+void
+Options::parse_positional(std::string option)
+{
+ parse_positional(std::vector{std::move(option)});
+}
+
+inline
+void
+Options::parse_positional(std::vector options)
+{
+ m_positional = std::move(options);
+
+ m_positional_set.insert(m_positional.begin(), m_positional.end());
+}
+
+inline
+void
+Options::parse_positional(std::initializer_list options)
+{
+ parse_positional(std::vector(options));
+}
+
+inline
+ParseResult
+Options::parse(int argc, const char* const* argv)
+{
+ OptionParser parser(*m_options, m_positional, m_allow_unrecognised);
+
+ return parser.parse(argc, argv);
+}
+
+inline ParseResult
+OptionParser::parse(int argc, const char* const* argv)
+{
+ int current = 1;
+ bool consume_remaining = false;
+ auto next_positional = m_positional.begin();
+
+ std::vector unmatched;
+
+ while (current != argc)
+ {
+ if (strcmp(argv[current], "--") == 0)
+ {
+ consume_remaining = true;
+ ++current;
+ break;
+ }
+ bool matched = false;
+ values::parser_tool::ArguDesc argu_desc =
+ values::parser_tool::ParseArgument(argv[current], matched);
+
+ if (!matched)
+ {
+ //not a flag
+
+ // but if it starts with a `-`, then it's an error
+ if (argv[current][0] == '-' && argv[current][1] != '\0') {
+ if (!m_allow_unrecognised) {
+ throw_or_mimic(argv[current]);
+ }
+ }
+
+ //if true is returned here then it was consumed, otherwise it is
+ //ignored
+ if (consume_positional(argv[current], next_positional))
+ {
+ }
+ else
+ {
+ unmatched.emplace_back(argv[current]);
+ }
+ //if we return from here then it was parsed successfully, so continue
+ }
+ else
+ {
+ //short or long option?
+ if (argu_desc.grouping)
+ {
+ const std::string& s = argu_desc.arg_name;
+
+ for (std::size_t i = 0; i != s.size(); ++i)
+ {
+ std::string name(1, s[i]);
+ auto iter = m_options.find(name);
+
+ if (iter == m_options.end())
+ {
+ if (m_allow_unrecognised)
+ {
+ unmatched.push_back(std::string("-") + s[i]);
+ continue;
+ }
+ //error
+ throw_or_mimic(name);
+ }
+
+ auto value = iter->second;
+
+ if (i + 1 == s.size())
+ {
+ //it must be the last argument
+ checked_parse_arg(argc, argv, current, value, name);
+ }
+ else if (value->value().has_implicit())
+ {
+ parse_option(value, name, value->value().get_implicit_value());
+ }
+ else if (i + 1 < s.size())
+ {
+ std::string arg_value = s.substr(i + 1);
+ parse_option(value, name, arg_value);
+ break;
+ }
+ else
+ {
+ //error
+ throw_or_mimic(name);
+ }
+ }
+ }
+ else if (argu_desc.arg_name.length() != 0)
+ {
+ const std::string& name = argu_desc.arg_name;
+
+ auto iter = m_options.find(name);
+
+ if (iter == m_options.end())
+ {
+ if (m_allow_unrecognised)
+ {
+ // keep unrecognised options in argument list, skip to next argument
+ unmatched.emplace_back(argv[current]);
+ ++current;
+ continue;
+ }
+ //error
+ throw_or_mimic(name);
+ }
+
+ auto opt = iter->second;
+
+ //equals provided for long option?
+ if (argu_desc.set_value)
+ {
+ //parse the option given
+
+ parse_option(opt, name, argu_desc.value);
+ }
+ else
+ {
+ //parse the next argument
+ checked_parse_arg(argc, argv, current, opt, name);
+ }
+ }
+
+ }
+
+ ++current;
+ }
+
+ for (auto& opt : m_options)
+ {
+ auto& detail = opt.second;
+ const auto& value = detail->value();
+
+ auto& store = m_parsed[detail->hash()];
+
+ if (value.has_default()) {
+ if (!store.count() && !store.has_default()) {
+ parse_default(detail);
+ }
+ }
+ else {
+ parse_no_value(detail);
+ }
+ }
+
+ if (consume_remaining)
+ {
+ while (current < argc)
+ {
+ if (!consume_positional(argv[current], next_positional)) {
+ break;
+ }
+ ++current;
+ }
+
+ //adjust argv for any that couldn't be swallowed
+ while (current != argc) {
+ unmatched.emplace_back(argv[current]);
+ ++current;
+ }
+ }
+
+ finalise_aliases();
+
+ ParseResult parsed(std::move(m_keys), std::move(m_parsed), std::move(m_sequential), std::move(m_defaults), std::move(unmatched));
+ return parsed;
+}
+
+inline
+void
+OptionParser::finalise_aliases()
+{
+ for (auto& option: m_options)
+ {
+ auto& detail = *option.second;
+ auto hash = detail.hash();
+ m_keys[detail.short_name()] = hash;
+ m_keys[detail.long_name()] = hash;
+
+ m_parsed.emplace(hash, OptionValue());
+ }
+}
+
+inline
+void
+Options::add_option
+(
+ const std::string& group,
+ const Option& option
+)
+{
+ add_options(group, {option});
+}
+
+inline
+void
+Options::add_option
+(
+ const std::string& group,
+ const std::string& s,
+ const std::string& l,
+ std::string desc,
+ const std::shared_ptr& value,
+ std::string arg_help
+)
+{
+ auto stringDesc = toLocalString(std::move(desc));
+ auto option = std::make_shared(s, l, stringDesc, value);
+
+ if (!s.empty())
+ {
+ add_one_option(s, option);
+ }
+
+ if (!l.empty())
+ {
+ add_one_option(l, option);
+ }
+
+ m_option_list.push_front(*option.get());
+ auto iter = m_option_list.begin();
+ m_option_map[s] = iter;
+ m_option_map[l] = iter;
+
+ //add the help details
+ auto& options = m_help[group];
+
+ options.options.emplace_back(HelpOptionDetails{s, l, stringDesc,
+ value->has_default(), value->get_default_value(),
+ value->has_implicit(), value->get_implicit_value(),
+ std::move(arg_help),
+ value->is_container(),
+ value->is_boolean()});
+}
+
+inline
+void
+Options::add_one_option
+(
+ const std::string& option,
+ const std::shared_ptr& details
+)
+{
+ auto in = m_options->emplace(option, details);
+
+ if (!in.second)
+ {
+ throw_or_mimic(option);
+ }
+}
+
+inline
+String
+Options::help_one_group(const std::string& g) const
+{
+ using OptionHelp = std::vector>;
+
+ auto group = m_help.find(g);
+ if (group == m_help.end())
+ {
+ return "";
+ }
+
+ OptionHelp format;
+
+ size_t longest = 0;
+
+ String result;
+
+ if (!g.empty())
+ {
+ result += toLocalString(" " + g + " options:\n");
+ }
+
+ for (const auto& o : group->second.options)
+ {
+ if (m_positional_set.find(o.l) != m_positional_set.end() &&
+ !m_show_positional)
+ {
+ continue;
+ }
+
+ auto s = format_option(o);
+ longest = (std::max)(longest, stringLength(s));
+ format.push_back(std::make_pair(s, String()));
+ }
+ longest = (std::min)(longest, OPTION_LONGEST);
+
+ //widest allowed description -- min 10 chars for helptext/line
+ size_t allowed = 10;
+ if (m_width > allowed + longest + OPTION_DESC_GAP)
+ {
+ allowed = m_width - longest - OPTION_DESC_GAP;
+ }
+
+ auto fiter = format.begin();
+ for (const auto& o : group->second.options)
+ {
+ if (m_positional_set.find(o.l) != m_positional_set.end() &&
+ !m_show_positional)
+ {
+ continue;
+ }
+
+ auto d = format_description(o, longest + OPTION_DESC_GAP, allowed, m_tab_expansion);
+
+ result += fiter->first;
+ if (stringLength(fiter->first) > longest)
+ {
+ result += '\n';
+ result += toLocalString(std::string(longest + OPTION_DESC_GAP, ' '));
+ }
+ else
+ {
+ result += toLocalString(std::string(longest + OPTION_DESC_GAP -
+ stringLength(fiter->first),
+ ' '));
+ }
+ result += d;
+ result += '\n';
+
+ ++fiter;
+ }
+
+ return result;
+}
+
+inline
+void
+Options::generate_group_help
+(
+ String& result,
+ const std::vector& print_groups
+) const
+{
+ for (size_t i = 0; i != print_groups.size(); ++i)
+ {
+ const String& group_help_text = help_one_group(print_groups[i]);
+ if (empty(group_help_text))
+ {
+ continue;
+ }
+ result += group_help_text;
+ if (i < print_groups.size() - 1)
+ {
+ result += '\n';
+ }
+ }
+}
+
+inline
+void
+Options::generate_all_groups_help(String& result) const
+{
+ std::vector all_groups;
+
+ std::transform(
+ m_help.begin(),
+ m_help.end(),
+ std::back_inserter(all_groups),
+ [] (const std::map::value_type& group)
+ {
+ return group.first;
+ }
+ );
+
+ generate_group_help(result, all_groups);
+}
+
+inline
+std::string
+Options::help(const std::vector& help_groups) const
+{
+ String result = m_help_string + "\nUsage:\n " +
+ toLocalString(m_program) + " " + toLocalString(m_custom_help);
+
+ if (!m_positional.empty() && !m_positional_help.empty()) {
+ result += " " + toLocalString(m_positional_help);
+ }
+
+ result += "\n\n";
+
+ if (help_groups.empty())
+ {
+ generate_all_groups_help(result);
+ }
+ else
+ {
+ generate_group_help(result, help_groups);
+ }
+
+ return toUTF8String(result);
+}
+
+inline
+std::vector
+Options::groups() const
+{
+ std::vector g;
+
+ std::transform(
+ m_help.begin(),
+ m_help.end(),
+ std::back_inserter(g),
+ [] (const std::map::value_type& pair)
+ {
+ return pair.first;
+ }
+ );
+
+ return g;
+}
+
+inline
+const HelpGroupDetails&
+Options::group_help(const std::string& group) const
+{
+ return m_help.at(group);
+}
+
+} // namespace cxxopts
+
+#endif //CXXOPTS_HPP_INCLUDED
diff --git a/images/textui.png b/images/textui.png
new file mode 100644
index 0000000..47dcfe8
Binary files /dev/null and b/images/textui.png differ
diff --git a/md5-c.cpp b/md5-c.cpp
new file mode 100644
index 0000000..b137953
--- /dev/null
+++ b/md5-c.cpp
@@ -0,0 +1,229 @@
+//https://github.com/Zunawe/md5-c
+//commit 1525b0db1fb608afed8948f3a972d55486e8cb31
+//committed on 20 Nov 2021
+//with modified
+/*
+ * Derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm
+ * and modified slightly to be functionally identical but condensed into control structures.
+ */
+
+#include "md5-c.hpp"
+
+/*
+ * Constants defined by the MD5 algorithm
+ */
+#define A 0x67452301
+#define B 0xefcdab89
+#define C 0x98badcfe
+#define D 0x10325476
+
+static uint32_t S[] = {7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
+ 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
+ 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,
+ 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21};
+
+static uint32_t K[] = {0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
+ 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
+ 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
+ 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,
+ 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,
+ 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,
+ 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,
+ 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,
+ 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,
+ 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
+ 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05,
+ 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
+ 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,
+ 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
+ 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
+ 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391};
+
+/*
+ * Bit-manipulation functions defined by the MD5 algorithm
+ */
+#define F(X, Y, Z) ((X & Y) | (~X & Z))
+#define G(X, Y, Z) ((X & Z) | (Y & ~Z))
+#define H(X, Y, Z) (X ^ Y ^ Z)
+#define I(X, Y, Z) (Y ^ (X | ~Z))
+
+/*
+ * Padding used to make the size (in bits) of the input congruent to 448 mod 512
+ */
+static uint8_t PADDING[] = {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+/*
+ * Initialize a context
+ */
+void md5Init(MD5Context *ctx){
+ ctx->size = (uint64_t)0;
+
+ ctx->buffer[0] = (uint32_t)A;
+ ctx->buffer[1] = (uint32_t)B;
+ ctx->buffer[2] = (uint32_t)C;
+ ctx->buffer[3] = (uint32_t)D;
+}
+
+/*
+ * Add some amount of input to the context
+ *
+ * If the input fills out a block of 512 bits, apply the algorithm (md5Step)
+ * and save the result in the buffer. Also updates the overall size.
+ */
+void md5Update(MD5Context *ctx, uint8_t *input_buffer, size_t input_len){
+ uint32_t input[16];
+ unsigned int offset = ctx->size % 64;
+ ctx->size += (uint64_t)input_len;
+
+ // Copy each byte in input_buffer into the next space in our context input
+ for(unsigned int i = 0; i < input_len; ++i){
+ ctx->input[offset++] = (uint8_t)*(input_buffer + i);
+
+ // If we've filled our context input, copy it into our local array input
+ // then reset the offset to 0 and fill in a new buffer.
+ // Every time we fill out a chunk, we run it through the algorithm
+ // to enable some back and forth between cpu and i/o
+ if(offset % 64 == 0){
+ for(unsigned int j = 0; j < 16; ++j){
+ // Convert to little-endian
+ // The local variable `input` our 512-bit chunk separated into 32-bit words
+ // we can use in calculations
+ input[j] = (uint32_t)(ctx->input[(j * 4) + 3]) << 24 |
+ (uint32_t)(ctx->input[(j * 4) + 2]) << 16 |
+ (uint32_t)(ctx->input[(j * 4) + 1]) << 8 |
+ (uint32_t)(ctx->input[(j * 4)]);
+ }
+ md5Step(ctx->buffer, input);
+ offset = 0;
+ }
+ }
+}
+
+/*
+ * Pad the current input to get to 448 bytes, append the size in bits to the very end,
+ * and save the result of the final iteration into digest.
+ */
+void md5Finalize(MD5Context *ctx){
+ uint32_t input[16];
+ unsigned int offset = ctx->size % 64;
+ unsigned int padding_length = offset < 56 ? 56 - offset : (56 + 64) - offset;
+
+ // Fill in the padding andndo the changes to size that resulted from the update
+ md5Update(ctx, PADDING, padding_length);
+ ctx->size -= (uint64_t)padding_length;
+
+ // Do a final update (internal to this function)
+ // Last two 32-bit words are the two halves of the size (converted from bytes to bits)
+ for(unsigned int j = 0; j < 14; ++j){
+ input[j] = (uint32_t)(ctx->input[(j * 4) + 3]) << 24 |
+ (uint32_t)(ctx->input[(j * 4) + 2]) << 16 |
+ (uint32_t)(ctx->input[(j * 4) + 1]) << 8 |
+ (uint32_t)(ctx->input[(j * 4)]);
+ }
+ input[14] = (uint32_t)(ctx->size * 8);
+ input[15] = (uint32_t)((ctx->size * 8) >> 32);
+
+ md5Step(ctx->buffer, input);
+
+ // Move the result into digest (convert from little-endian)
+ for(unsigned int i = 0; i < 4; ++i){
+ ctx->digest[(i * 4) + 0] = (uint8_t)((ctx->buffer[i] & 0x000000FF));
+ ctx->digest[(i * 4) + 1] = (uint8_t)((ctx->buffer[i] & 0x0000FF00) >> 8);
+ ctx->digest[(i * 4) + 2] = (uint8_t)((ctx->buffer[i] & 0x00FF0000) >> 16);
+ ctx->digest[(i * 4) + 3] = (uint8_t)((ctx->buffer[i] & 0xFF000000) >> 24);
+ }
+}
+
+/*
+ * Step on 512 bits of input with the main MD5 algorithm.
+ */
+void md5Step(uint32_t *buffer, uint32_t *input){
+ uint32_t AA = buffer[0];
+ uint32_t BB = buffer[1];
+ uint32_t CC = buffer[2];
+ uint32_t DD = buffer[3];
+
+ uint32_t E;
+
+ unsigned int j;
+
+ for(unsigned int i = 0; i < 64; ++i){
+ switch(i / 16){
+ case 0:
+ E = F(BB, CC, DD);
+ j = i;
+ break;
+ case 1:
+ E = G(BB, CC, DD);
+ j = ((i * 5) + 1) % 16;
+ break;
+ case 2:
+ E = H(BB, CC, DD);
+ j = ((i * 3) + 5) % 16;
+ break;
+ default:
+ E = I(BB, CC, DD);
+ j = (i * 7) % 16;
+ break;
+ }
+
+ uint32_t temp = DD;
+ DD = CC;
+ CC = BB;
+ BB = BB + rotateLeft(AA + E + K[i] + input[j], S[i]);
+ AA = temp;
+ }
+
+ buffer[0] += AA;
+ buffer[1] += BB;
+ buffer[2] += CC;
+ buffer[3] += DD;
+}
+
+/*
+ * Functions that will return a pointer to the hash of the provided input
+ */
+// uint8_t* md5String(char *input){
+// MD5Context ctx;
+// md5Init(&ctx);
+// md5Update(&ctx, (uint8_t *)input, strlen(input));
+// md5Finalize(&ctx);
+//
+// uint8_t *result = (uint8_t *)malloc(16);
+// memcpy(result, ctx.digest, 16);
+// return result;
+// }
+//
+// uint8_t* md5File(FILE *file){
+// char *input_buffer = malloc(1024);
+// size_t input_size = 0;
+//
+// MD5Context ctx;
+// md5Init(&ctx);
+//
+// while((input_size = fread(input_buffer, 1, 1024, file)) > 0){
+// md5Update(&ctx, (uint8_t *)input_buffer, input_size);
+// }
+//
+// md5Finalize(&ctx);
+//
+// free(input_buffer);
+//
+// uint8_t *result = malloc(16);
+// memcpy(result, ctx.digest, 16);
+// return result;
+// }
+
+/*
+ * Rotates a 32-bit word left by n bits
+ */
+uint32_t rotateLeft(uint32_t x, uint32_t n){
+ return (x << n) | (x >> (32 - n));
+}
diff --git a/md5-c.hpp b/md5-c.hpp
new file mode 100644
index 0000000..a948e37
--- /dev/null
+++ b/md5-c.hpp
@@ -0,0 +1,34 @@
+//https://github.com/Zunawe/md5-c
+//commit 1525b0db1fb608afed8948f3a972d55486e8cb31
+//committed on 20 Nov 2021
+//with modified
+#ifndef ___MD5_C__HPP___
+#define ___MD5_C__HPP___
+#include
+#include
+#include
+#include
+
+typedef struct{
+ uint64_t size; // Size of input in bytes
+ uint32_t buffer[4]; // Current accumulation of hash
+ uint8_t input[64]; // Input to be used in the next step
+ uint8_t digest[16]; // Result of algorithm
+}MD5Context;
+
+void md5Init(MD5Context *ctx);
+void md5Update(MD5Context *ctx, uint8_t *input, size_t input_len);
+void md5Finalize(MD5Context *ctx);
+void md5Step(uint32_t *buffer, uint32_t *input);
+
+// uint8_t* md5String(char *input);
+// uint8_t* md5File(FILE *file);
+
+uint32_t F(uint32_t X, uint32_t Y, uint32_t Z);
+uint32_t G(uint32_t X, uint32_t Y, uint32_t Z);
+uint32_t H(uint32_t X, uint32_t Y, uint32_t Z);
+uint32_t I(uint32_t X, uint32_t Y, uint32_t Z);
+
+uint32_t rotateLeft(uint32_t x, uint32_t n);
+
+#endif // ___MD5_C__HPP___
diff --git a/mingw-w64-clang-i686-ncurses-6_3/bin/libform6.dll b/mingw-w64-clang-i686-ncurses-6_3/bin/libform6.dll
new file mode 100755
index 0000000..5dfd70c
Binary files /dev/null and b/mingw-w64-clang-i686-ncurses-6_3/bin/libform6.dll differ
diff --git a/mingw-w64-clang-i686-ncurses-6_3/bin/libmenu6.dll b/mingw-w64-clang-i686-ncurses-6_3/bin/libmenu6.dll
new file mode 100755
index 0000000..a89d873
Binary files /dev/null and b/mingw-w64-clang-i686-ncurses-6_3/bin/libmenu6.dll differ
diff --git a/mingw-w64-clang-i686-ncurses-6_3/bin/libncurses6.dll b/mingw-w64-clang-i686-ncurses-6_3/bin/libncurses6.dll
new file mode 100755
index 0000000..f15e8e4
Binary files /dev/null and b/mingw-w64-clang-i686-ncurses-6_3/bin/libncurses6.dll differ
diff --git a/mingw-w64-clang-i686-ncurses-6_3/bin/libpanel6.dll b/mingw-w64-clang-i686-ncurses-6_3/bin/libpanel6.dll
new file mode 100755
index 0000000..31c8a46
Binary files /dev/null and b/mingw-w64-clang-i686-ncurses-6_3/bin/libpanel6.dll differ
diff --git a/mingw-w64-clang-i686-ncurses-6_3/bin/ncurses6-config b/mingw-w64-clang-i686-ncurses-6_3/bin/ncurses6-config
new file mode 100755
index 0000000..069b0a5
--- /dev/null
+++ b/mingw-w64-clang-i686-ncurses-6_3/bin/ncurses6-config
@@ -0,0 +1,328 @@
+#!/bin/sh
+# $Id: ncurses-config.in,v 1.50 2021/08/07 21:36:14 tom Exp $
+##############################################################################
+# Copyright 2018-2020,2021 Thomas E. Dickey #
+# Copyright 2006-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: Thomas E. Dickey, 2006-on
+
+LANG=C; export LANG
+LANGUAGE=C; export LANGUAGE
+LC_ALL=C; export LC_ALL
+LC_CTYPE=C; export LC_CTYPE
+
+prefix="/home/HOA/mingw-w64-clang-i686-ncurses-6_3"
+exec_prefix="${prefix}"
+
+bindir="${exec_prefix}/bin"
+includedir="${prefix}/include"
+libdir="${exec_prefix}/lib"
+datarootdir="${prefix}/share"
+datadir="${datarootdir}"
+mandir="${datarootdir}/man"
+
+THIS="ncurses"
+TINFO_LIB="ncurses"
+RPATH_LIST="${libdir}"
+
+includesubdir="${prefix}/include/${THIS}"
+
+# Ensure that RPATH_LIST contains only absolute pathnames, if it is nonempty.
+# We cannot filter it out within the build-process since the variable is used
+# in some special cases of installation using a relative path.
+if [ -n "$RPATH_LIST" ]
+then
+ save_IFS="$IFS"
+ IFS=':'
+ filtered=
+ for item in $RPATH_LIST
+ do
+ case "$item" in
+ ./*|../*|*/..|*/../*)
+ ;;
+ *)
+ [ -n "$filtered" ] && filtered="${filtered}:"
+ filtered="${filtered}${item}"
+ ;;
+ esac
+ done
+ IFS="$save_IFS"
+ # if the result is empty, there is little we can do to fix it
+ RPATH_LIST="$filtered"
+fi
+
+# with --disable-overwrite, we installed into a subdirectory, but transformed
+# the headers to include like this:
+#
+if [ xno = xno ]; then
+ case $includedir in
+ $prefix/include/ncurses)
+ includedir=`echo "$includedir" | sed -e 's,/[^/]*$,,'`
+ ;;
+ esac
+fi
+
+LIBS=""
+if [ "ncurses" = "ncurses" ]; then
+ LIBS="-l${THIS} $LIBS"
+else
+ LIBS="-l${THIS} -l${TINFO_LIB} $LIBS"
+fi
+
+# Ignore -L options which do not correspond to an actual directory, or which
+# are standard library directories (i.e., the linker is supposed to search
+# those directories).
+#
+# There is no portable way to find the list of standard library directories.
+# Require a POSIX shell anyway, to keep this simple.
+lib_flags=
+for opt in -L$libdir -Wl,--enable-auto-import $LIBS
+do
+ case $opt in
+ -specs*) # ignore linker specs-files which were used to build library
+ continue
+ ;;
+ -Wl,-z,*) # ignore flags used to manipulate shared image
+ continue
+ ;;
+ -Wl,--dynamic-linker*) # ignore ELF interpreter
+ continue
+ ;;
+ -L*)
+ lib_check=`echo "x$opt" | sed -e 's/^.-L//'`
+ [ -d "$lib_check" ] || continue
+ case "$lib_check" in
+ /usr/lib) # skip standard libdir
+ if [ "$lib_check" = "$libdir" ]
+ then
+ lib_first=yes
+ IFS_save="$IFS"
+ IFS='|'
+ LIBDIRS="/usr/lib"
+ for lib_check in $LIBDIRS
+ do
+ if [ -d "$lib_check" ]
+ then
+ if [ "$lib_check" != "$libdir" ]
+ then
+ lib_first=no
+ fi
+ break
+ fi
+ done
+ IFS="$IFS_save"
+ [ $lib_first = yes ] && continue
+ found=no
+ for check in $lib_flags
+ do
+ if [ "x$check" = "x$opt" ]
+ then
+ found=yes
+ break
+ fi
+ done
+ [ $found = yes ] && continue
+ :
+ else
+ continue
+ fi
+ ;;
+ *)
+ found=no
+ for check in $lib_flags
+ do
+ if [ "x$check" = "x$opt" ]
+ then
+ found=yes
+ break
+ fi
+ done
+ [ $found = yes ] && continue
+ ;;
+ esac
+ ;;
+ esac
+ lib_flags="$lib_flags $opt"
+done
+
+[ $# = 0 ] && exec /bin/sh $0 --error
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ # basic configuration
+ --prefix)
+ echo "$prefix"
+ ;;
+ --exec-prefix)
+ echo "$exec_prefix"
+ ;;
+ # compile/link
+ --cflags)
+ INCS=" -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L"
+ if [ "xno" = xno ]; then
+ INCS="$INCS -I${includesubdir}"
+ fi
+ if [ "${includedir}" != /usr/include ]; then
+ INCS="$INCS -I${includedir}"
+ fi
+ sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
+ $INCS
+ENDECHO
+ ;;
+ --libs)
+ OPTS=
+ for opt in $lib_flags
+ do
+ [ -n "$OPTS" ] && OPTS="$OPTS "
+ OPTS="${OPTS}${opt}"
+ done
+ printf "%s\n" "$OPTS"
+ ;;
+ --libs-only-L)
+ OPTS=
+ for opt in $lib_flags
+ do
+ case "x$opt" in
+ x-L*)
+ [ -n "$OPTS" ] && OPTS="$OPTS "
+ OPTS="${OPTS}${opt}"
+ ;;
+ esac
+ done
+ printf "%s\n" "$OPTS"
+ ;;
+ --libs-only-l)
+ OPTS=
+ for opt in $lib_flags
+ do
+ case "x$opt" in
+ x-l*)
+ [ -n "$OPTS" ] && OPTS="$OPTS "
+ OPTS="${OPTS}${opt}"
+ ;;
+ esac
+ done
+ printf "%s\n" "$OPTS"
+ ;;
+ --libs-only-other)
+ OPTS=
+ for opt in $lib_flags
+ do
+ case "x$opt" in
+ x-[lL]*)
+ ;;
+ *)
+ [ -n "$OPTS" ] && OPTS="$OPTS "
+ OPTS="${OPTS}${opt}"
+ ;;
+ esac
+ done
+ printf "%s\n" "$OPTS"
+ ;;
+ # identification
+ --version)
+ echo "6.3.20211021"
+ ;;
+ --abi-version)
+ echo "6"
+ ;;
+ --mouse-version)
+ echo "2"
+ ;;
+ # locations
+ --bindir)
+ echo "${bindir}"
+ ;;
+ --datadir)
+ echo "${datadir}"
+ ;;
+ --includedir)
+ INCS=
+ if [ "xno" = xno ]; then
+ INCS="${includesubdir}"
+ elif [ "${includedir}" != /usr/include ]; then
+ INCS="${includedir}"
+ fi
+ echo $INCS
+ ;;
+ --libdir)
+ echo "${libdir}"
+ ;;
+ --mandir)
+ echo "${mandir}"
+ ;;
+ --terminfo)
+ echo "${datarootdir}/terminfo"
+ ;;
+ --terminfo-dirs)
+ echo ""
+ ;;
+ --termpath)
+ echo ""
+ ;;
+ # general info
+ --help)
+ cat <&2
+ exit 1
+ ;;
+ esac
+ shift
+done
+# vi:ts=4 sw=4
+# vile:shmode
diff --git a/mingw-w64-clang-i686-ncurses-6_3/include/ncurses/curses.h b/mingw-w64-clang-i686-ncurses-6_3/include/ncurses/curses.h
new file mode 100755
index 0000000..d01da4c
--- /dev/null
+++ b/mingw-w64-clang-i686-ncurses-6_3/include/ncurses/curses.h
@@ -0,0 +1,1800 @@
+/****************************************************************************
+ * 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 $ */
+
+#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 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 "6.3"
+
+/*
+ * Identify the mouse encoding version.
+ */
+#define NCURSES_MOUSE_VERSION 2
+
+/*
+ * Definitions to facilitate DLL's.
+ */
+#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 .
+ */
+#ifndef NCURSES_ENABLE_STDBOOL_H
+#define NCURSES_ENABLE_STDBOOL_H 1
+#endif
+
+/*
+ * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses
+ * configured using --disable-macros.
+ */
+#ifndef NCURSES_ATTR_T
+#define NCURSES_ATTR_T int
+#endif
+
+/*
+ * 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
+#define NCURSES_CONST const
+
+#undef NCURSES_INLINE
+#define NCURSES_INLINE inline
+
+/*
+ * 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.
+ */
+#ifndef NCURSES_INTERNALS
+#define NCURSES_OPAQUE 1
+#define NCURSES_OPAQUE_FORM 1
+#define NCURSES_OPAQUE_MENU 1
+#define NCURSES_OPAQUE_PANEL 1
+#endif
+
+/*
+ * 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_WATTR_MACROS
+#define NCURSES_WATTR_MACROS 0
+#endif
+
+/*
+ * The reentrant code relies on the opaque setting, but adds features.
+ */
+#ifndef NCURSES_REENTRANT
+#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 1
+
+/*
+ * The internal type used for window dimensions.
+ */
+#undef NCURSES_SIZE_T
+#define NCURSES_SIZE_T short
+
+/*
+ * Control whether tparm() supports varargs or fixed-parameter list.
+ */
+#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
+#define NCURSES_CH_T chtype
+
+#if 1 && defined(_LP64)
+typedef unsigned chtype;
+typedef unsigned mmask_t;
+#else
+typedef uint32_t chtype;
+typedef uint32_t mmask_t;
+#endif
+
+/*
+ * We need FILE, etc. Include this before checking any feature symbols.
+ */
+#include
+
+/*
+ * 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.
+ */
+#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 */
+#if NCURSES_WIDECHAR
+#include /* we want wchar_t */
+#endif
+
+/* 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++.
+ */
+
+#undef TRUE
+#define TRUE 1
+
+#undef FALSE
+#define FALSE 0
+
+typedef unsigned char NCURSES_BOOL;
+
+#if defined(__cplusplus) /* __cplusplus, etc. */
+
+/* use the C++ compiler's bool type */
+#define NCURSES_BOOL bool
+
+#else /* c89, c99, etc. */
+
+#if NCURSES_ENABLE_STDBOOL_H
+#include
+/* use whatever the C compiler decides bool really is */
+#define NCURSES_BOOL bool
+#else
+/* there is no predefined bool - use our own */
+#undef bool
+#define bool NCURSES_BOOL
+#endif
+
+#endif /* !__cplusplus, etc. */
+
+#ifdef __cplusplus
+extern "C" {
+#define NCURSES_CAST(type,value) static_cast(value)
+#else
+#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
+
+#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
+
+/* line graphics */
+
+#if 0 || NCURSES_REENTRANT
+NCURSES_WRAPPED_VAR(chtype*, acs_map);
+#define acs_map NCURSES_PUBLIC_VAR(acs_map())
+#else
+extern NCURSES_EXPORT_VAR(chtype) acs_map[];
+#endif
+
+#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 */
+/* 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 */
+/*
+ * 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 */
+
+/*
+ * 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.
+ */
+#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
+#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 */
+
+/*
+ * this value is used in the firstchar and lastchar fields to mark
+ * unchanged lines
+ */
+#define _NOCHANGE -1
+
+/*
+ * this value is used in the oldindex field to mark lines created by insertions
+ * and scrolls.
+ */
+#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 */
+
+#if NCURSES_WIDECHAR
+
+#if 0
+#ifdef mblen /* libutf8.h defines it w/o undefining first */
+#undef mblen
+#endif
+#include
+#endif
+
+#if 0
+#include /* ...to get mbstate_t, etc. */
+#endif
+
+#if 0
+typedef unsigned short wchar_t;
+#endif
+
+#if 0
+typedef unsigned int wint_t;
+#endif
+
+/*
+ * 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().
+ */
+#define CCHARW_MAX 5
+typedef struct
+{
+ attr_t attr;
+ wchar_t chars[CCHARW_MAX];
+#if 0
+#undef NCURSES_EXT_COLORS
+#define NCURSES_EXT_COLORS 20211021
+ int ext_color; /* color pair, must be more than 16-bits */
+#endif
+}
+cchar_t;
+
+#endif /* NCURSES_WIDECHAR */
+
+#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 */
+
+ 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 0
+ int _color; /* current color-pair for non-space character */
+#endif
+#endif
+};
+#endif /* NCURSES_OPAQUE */
+
+/*
+ * GCC (and some other compilers) define '__attribute__'; we're using this
+ * macro to alert the compiler to flag inconsistencies in printf/scanf-like
+ * function calls. Just in case '__attribute__' isn't defined, make a dummy.
+ * Old versions of G++ do not accept it anyway, at least not consistently with
+ * GCC.
+ */
+#if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__))
+#define __attribute__(p) /* nothing */
+#endif
+
+/*
+ * We cannot define these in ncurses_cfg.h, since they require parameters to be
+ * passed (that is non-portable).
+ */
+#ifndef GCC_PRINTFLIKE
+#ifndef printf
+#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
+#else
+#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
+#endif
+#endif
+
+#ifndef GCC_SCANFLIKE
+#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 */
+#endif
+
+#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
+
+/*
+ * Curses uses a helper function. Define our type for this to simplify
+ * extending it for the sp-funcs feature.
+ */
+typedef int (*NCURSES_OUTC)(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 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, 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 (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 :
+ */
+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 (const char *, ...); /* special */
+#else
+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 */
+
+/*
+ * These functions are not in X/Open, but we use them in macro definitions:
+ */
+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.
+ */
+#if !NCURSES_WIDECHAR
+#define vid_attr(a,pair,opts) vidattr(a)
+#endif
+
+/*
+ * These functions are extensions - not in X/Open Curses.
+ */
+#if 1
+#undef NCURSES_EXT_FUNCS
+#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);
+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);
+extern NCURSES_EXPORT(int) use_default_colors (void);
+extern NCURSES_EXPORT(int) use_extended_names (bool);
+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 *);
+extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int);
+extern NCURSES_EXPORT(void) nofilter(void);
+
+/*
+ * These extensions provide access to information stored in the WINDOW even
+ * when NCURSES_OPAQUE is set:
+ */
+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 */
+
+#else
+#define curses_version() NCURSES_VERSION
+#endif
+
+/*
+ * Extra extension-functions, which pass a SCREEN pointer rather than using
+ * a global variable SP.
+ */
+#if 1
+#undef NCURSES_SP_FUNCS
+#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*, 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 */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(doupdate) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(echo) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(endwin) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(char) NCURSES_SP_NAME(erasechar) (SCREEN*);/* implemented:SP_FUNC */
+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(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*, 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 */
+extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(longname) (SCREEN*); /* implemented:SP_FUNC */
+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*, 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 */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noecho) (SCREEN*); /* implemented:SP_FUNC */
+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*, 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(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 */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_set) (SCREEN*, const char *); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attroff) (SCREEN*, const chtype); /* implemented:SP_FUNC */
+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, 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*, 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 */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_refresh) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_restore) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_set) (SCREEN*, int, const char *, int); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_touch) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(start_color) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(chtype) NCURSES_SP_NAME(termattrs) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(termname) (SCREEN*); /* implemented:SP_FUNC */
+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(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(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
+#define NCURSES_SP_FUNCS 0
+#define NCURSES_SP_NAME(name) name
+#define NCURSES_SP_OUTC NCURSES_OUTC
+#endif
+
+/* attributes */
+
+#define NCURSES_ATTR_SHIFT 8
+#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
+ * with older versions of curses, or provide inline functionality to improve
+ * performance.
+ */
+
+/*
+ * 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 getsyx(y,x) do { if (newscr) { \
+ 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)
+
+#ifndef NCURSES_NOMACROS
+
+/*
+ * These miscellaneous pseudo functions are provided for compatibility:
+ */
+
+#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 gettmode()
+
+/* It seems older SYSV curses versions define these */
+#if !NCURSES_OPAQUE
+#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 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 NCURSES_WATTR_MACROS
+#if NCURSES_WIDECHAR && 0
+#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) \
+ (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 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 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, (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)
+
+/*
+ * These apply to the first 256 color pairs.
+ */
+#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 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 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) (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))
+
+#if !NCURSES_OPAQUE
+#if NCURSES_WATTR_MACROS
+#if NCURSES_WIDECHAR && 0
+#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 */
+
+/*
+ * 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.
+ */
+#if !1
+#define vsscanf(a,b,c) _nc_vsscanf(a,b,c)
+NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list);
+#endif
+
+/*
+ * These macros are extensions - not in X/Open Curses.
+ */
+#if 1
+#if !NCURSES_OPAQUE
+#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
+ */
+#if NCURSES_REENTRANT
+
+NCURSES_WRAPPED_VAR(WINDOW *, curscr);
+NCURSES_WRAPPED_VAR(WINDOW *, newscr);
+NCURSES_WRAPPED_VAR(WINDOW *, stdscr);
+NCURSES_WRAPPED_VAR(char *, ttytype);
+NCURSES_WRAPPED_VAR(int, COLORS);
+NCURSES_WRAPPED_VAR(int, COLOR_PAIRS);
+NCURSES_WRAPPED_VAR(int, COLS);
+NCURSES_WRAPPED_VAR(int, ESCDELAY);
+NCURSES_WRAPPED_VAR(int, LINES);
+NCURSES_WRAPPED_VAR(int, TABSIZE);
+
+#define curscr NCURSES_PUBLIC_VAR(curscr())
+#define newscr NCURSES_PUBLIC_VAR(newscr())
+#define stdscr NCURSES_PUBLIC_VAR(stdscr())
+#define ttytype NCURSES_PUBLIC_VAR(ttytype())
+#define COLORS NCURSES_PUBLIC_VAR(COLORS())
+#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS())
+#define COLS NCURSES_PUBLIC_VAR(COLS())
+#define ESCDELAY NCURSES_PUBLIC_VAR(ESCDELAY())
+#define LINES NCURSES_PUBLIC_VAR(LINES())
+#define TABSIZE NCURSES_PUBLIC_VAR(TABSIZE())
+
+#else
+
+extern NCURSES_EXPORT_VAR(WINDOW *) curscr;
+extern NCURSES_EXPORT_VAR(WINDOW *) newscr;
+extern NCURSES_EXPORT_VAR(WINDOW *) stdscr;
+extern NCURSES_EXPORT_VAR(char) ttytype[];
+extern NCURSES_EXPORT_VAR(int) COLORS;
+extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS;
+extern NCURSES_EXPORT_VAR(int) COLS;
+extern NCURSES_EXPORT_VAR(int) ESCDELAY;
+extern NCURSES_EXPORT_VAR(int) LINES;
+extern NCURSES_EXPORT_VAR(int) TABSIZE;
+
+#endif
+
+/*
+ * 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.
+ */
+#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 ./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 */
+
+#ifdef NCURSES_EXT_FUNCS
+#define KEY_RESIZE 0632 /* Terminal resize event */
+#endif
+
+#define KEY_MAX 0777 /* Maximum key value is 0632 */
+/* $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 */
+
+#if NCURSES_MOUSE_VERSION > 1
+#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 5))
+#else
+#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 6))
+#endif
+
+#define NCURSES_BUTTON_RELEASED 001L
+#define NCURSES_BUTTON_PRESSED 002L
+#define NCURSES_BUTTON_CLICKED 004L
+#define NCURSES_DOUBLE_CLICKED 010L
+#define NCURSES_TRIPLE_CLICKED 020L
+#define NCURSES_RESERVED_EVENT 040L
+
+/* event masks */
+#define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED)
+#define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED)
+#define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED)
+#define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED)
+#define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED)
+
+#define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED)
+#define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED)
+#define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED)
+#define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED)
+#define BUTTON2_TRIPLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED)
+
+#define BUTTON3_RELEASED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED)
+#define BUTTON3_PRESSED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED)
+#define BUTTON3_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED)
+#define BUTTON3_DOUBLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED)
+#define BUTTON3_TRIPLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED)
+
+#define BUTTON4_RELEASED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED)
+#define BUTTON4_PRESSED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED)
+#define BUTTON4_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED)
+#define BUTTON4_DOUBLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED)
+#define BUTTON4_TRIPLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED)
+
+/*
+ * In 32 bits the version-1 scheme does not provide enough space for a 5th
+ * button, unless we choose to change the ABI by omitting the reserved-events.
+ */
+#if NCURSES_MOUSE_VERSION > 1
+
+#define BUTTON5_RELEASED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED)
+#define BUTTON5_PRESSED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED)
+#define BUTTON5_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED)
+#define BUTTON5_DOUBLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED)
+#define BUTTON5_TRIPLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED)
+
+#define BUTTON_CTRL NCURSES_MOUSE_MASK(6, 0001L)
+#define BUTTON_SHIFT NCURSES_MOUSE_MASK(6, 0002L)
+#define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L)
+#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L)
+
+#else
+
+#define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT)
+#define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT)
+#define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT)
+#define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT)
+
+#define BUTTON_CTRL NCURSES_MOUSE_MASK(5, 0001L)
+#define BUTTON_SHIFT NCURSES_MOUSE_MASK(5, 0002L)
+#define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L)
+#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L)
+
+#endif
+
+#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1)
+
+/* macros to extract single event-bits from masks */
+#define BUTTON_RELEASE(e, x) ((e) & 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 */
+}
+MEVENT;
+
+extern NCURSES_EXPORT(bool) has_mouse(void);
+extern NCURSES_EXPORT(int) getmouse (MEVENT *);
+extern NCURSES_EXPORT(int) ungetmouse (MEVENT *);
+extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *);
+extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int);
+extern NCURSES_EXPORT(int) mouseinterval (int);
+extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW*, int*, int*, bool);
+extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */
+
+#if NCURSES_SP_FUNCS
+extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_mouse) (SCREEN*);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(getmouse) (SCREEN*, MEVENT *);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetmouse) (SCREEN*,MEVENT *);
+extern NCURSES_EXPORT(mmask_t) NCURSES_SP_NAME(mousemask) (SCREEN*, mmask_t, mmask_t *);
+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? */
+
+#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 */
+#endif
+
+/* Debugging : use with libncurses_g.a */
+
+extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2);
+extern NCURSES_EXPORT(char *) _traceattr (attr_t);
+extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype);
+extern NCURSES_EXPORT(char *) _tracechar (int);
+extern NCURSES_EXPORT(char *) _tracechtype (chtype);
+extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype);
+#if NCURSES_WIDECHAR
+#define _tracech_t _tracecchar_t
+extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *);
+#define _tracech_t2 _tracecchar_t2
+extern NCURSES_EXPORT(char *) _tracecchar_t2 (int, const cchar_t *);
+#else
+#define _tracech_t _tracechtype
+#define _tracech_t2 _tracechtype2
+#endif
+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 */
+
+#if defined(TRACE) || defined(NCURSES_TEST)
+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) */
+#endif
+
+extern 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 */
+
+}
+#endif
+
+#endif /* __NCURSES_H */
diff --git a/mingw-w64-clang-i686-ncurses-6_3/include/ncurses/eti.h b/mingw-w64-clang-i686-ncurses-6_3/include/ncurses/eti.h
new file mode 100755
index 0000000..3c3302d
--- /dev/null
+++ b/mingw-w64-clang-i686-ncurses-6_3/include/ncurses/eti.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+ * 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 *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders 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: eti.h,v 1.9 2020/02/02 23:34:34 tom Exp $ */
+
+#ifndef NCURSES_ETI_H_incl
+#define NCURSES_ETI_H_incl 1
+
+#define E_OK (0)
+#define E_SYSTEM_ERROR (-1)
+#define E_BAD_ARGUMENT (-2)
+#define E_POSTED (-3)
+#define E_CONNECTED (-4)
+#define E_BAD_STATE (-5)
+#define E_NO_ROOM (-6)
+#define E_NOT_POSTED (-7)
+#define E_UNKNOWN_COMMAND (-8)
+#define E_NO_MATCH (-9)
+#define E_NOT_SELECTABLE (-10)
+#define E_NOT_CONNECTED (-11)
+#define E_REQUEST_DENIED (-12)
+#define E_INVALID_FIELD (-13)
+#define E_CURRENT (-14)
+
+#endif
diff --git a/mingw-w64-clang-i686-ncurses-6_3/include/ncurses/form.h b/mingw-w64-clang-i686-ncurses-6_3/include/ncurses/form.h
new file mode 100755
index 0000000..18725e8
--- /dev/null
+++ b/mingw-w64-clang-i686-ncurses-6_3/include/ncurses/form.h
@@ -0,0 +1,460 @@
+/****************************************************************************
+ * 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 $ */
+
+#ifndef FORM_H
+#define FORM_H
+/* *INDENT-OFF*/
+
+#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
+
+#ifndef NCURSES_FIELD_INTERNALS
+#define NCURSES_FIELD_INTERNALS /* nothing */
+#endif
+
+typedef int Form_Options;
+typedef int Field_Options;
+
+ /**********
+ * _PAGE *
+ **********/
+
+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 */
+}
+#endif /* !NCURSES_OPAQUE_FORM */
+_PAGE;
+
+ /**********
+ * FIELD *
+ **********/
+
+typedef struct fieldnode
+#if 1 /* not yet: !NCURSES_OPAQUE_FORM */
+{
+ unsigned short status; /* flags */
+ short rows; /* size in rows */
+ short cols; /* size in cols */
+ short frow; /* first row */
+ short fcol; /* first col */
+ int drows; /* dynamic rows */
+ int dcols; /* dynamic cols */
+ int maxgrow; /* maximum field growth */
+ int nrow; /* off-screen rows */
+ short nbuf; /* additional buffers */
+ short just; /* justification */
+ short page; /* page on form */
+ short index; /* into form -> field */
+ int pad; /* pad character */
+ chtype fore; /* foreground attribute */
+ chtype back; /* background attribute */
+ Field_Options opts; /* options */
+ struct fieldnode * snext; /* sorted order pointer */
+ struct fieldnode * sprev; /* sorted order pointer */
+ struct fieldnode * link; /* linked field chain */
+ struct formnode * form; /* containing form */
+ struct typenode * type; /* field type */
+ void * arg; /* argument for type */
+ FIELD_CELL * buf; /* field buffers */
+ void * usrptr; /* user pointer */
+ /*
+ * The wide-character configuration requires extra information. Because
+ * there are existing applications that manipulate the members of FIELD
+ * directly, we cannot make the struct opaque, 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
+}
+#endif /* NCURSES_OPAQUE_FORM */
+FIELD;
+
+
+ /*********
+ * FORM *
+ *********/
+
+typedef struct formnode
+#if 1 /* not yet: !NCURSES_OPAQUE_FORM */
+{
+ unsigned short status; /* flags */
+ short rows; /* size in rows */
+ short cols; /* size in cols */
+ int currow; /* current row in field window */
+ int curcol; /* current col in field window */
+ int toprow; /* in scrollable field window */
+ int begincol; /* in horiz. scrollable field */
+ short maxfield; /* number of fields */
+ short maxpage; /* number of pages */
+ short curpage; /* index into page */
+ Form_Options opts; /* options */
+ WINDOW * win; /* window */
+ WINDOW * sub; /* subwindow */
+ WINDOW * w; /* window for current field */
+ FIELD ** field; /* field [maxfield] */
+ FIELD * current; /* current field */
+ _PAGE * page; /* page [maxpage] */
+ void * usrptr; /* user pointer */
+
+ void (*forminit)(struct formnode *);
+ void (*formterm)(struct formnode *);
+ void (*fieldinit)(struct formnode *);
+ void (*fieldterm)(struct formnode *);
+
+}
+#endif /* !NCURSES_OPAQUE_FORM */
+FORM;
+
+
+ /**************
+ * FIELDTYPE *
+ **************/
+
+typedef struct typenode
+#if !NCURSES_OPAQUE_FORM
+{
+ unsigned short status; /* flags */
+ long ref; /* reference count */
+ struct typenode * left; /* ptr to operand for | */
+ struct typenode * right; /* ptr to operand for | */
+
+ void* (*makearg)(va_list *); /* make fieldtype arg */
+ void* (*copyarg)(const void *); /* copy fieldtype arg */
+ void (*freearg)(void *); /* free fieldtype arg */
+
+#if NCURSES_INTEROP_FUNCS
+ union {
+ bool (*ofcheck)(FIELD *,const void *); /* field validation */
+ bool (*gfcheck)(FORM*,FIELD *,const void*); /* generic field validation */
+ } fieldcheck;
+ union {
+ bool (*occheck)(int,const void *); /* character validation */
+ bool (*gccheck)(int,FORM*,
+ FIELD*,const void*); /* generic char validation */
+ } charcheck;
+ union {
+ bool (*onext)(FIELD *,const void *); /* enumerate next value */
+ bool (*gnext)(FORM*,FIELD*,const void*); /* generic enumerate next */
+ } enum_next;
+ union {
+ bool (*oprev)(FIELD *,const void *); /* enumerate prev value */
+ bool (*gprev)(FORM*,FIELD*,const void*); /* generic enumerate prev */
+ } enum_prev;
+ void* (*genericarg)(void*); /* Alternate Arg method */
+#else
+ bool (*fcheck)(FIELD *,const void *); /* field validation */
+ bool (*ccheck)(int,const void *); /* character validation */
+
+ bool (*next)(FIELD *,const void *); /* enumerate next value */
+ bool (*prev)(FIELD *,const void *); /* enumerate prev value */
+#endif
+}
+#endif /* !NCURSES_OPAQUE_FORM */
+FIELDTYPE;
+
+typedef void (*Form_Hook)(FORM *);
+
+ /***************************
+ * miscellaneous #defines *
+ ***************************/
+
+/* field justification */
+#define NO_JUSTIFICATION (0)
+#define JUSTIFY_LEFT (1)
+#define JUSTIFY_CENTER (2)
+#define JUSTIFY_RIGHT (3)
+
+/* field options */
+#define O_VISIBLE (0x0001U)
+#define O_ACTIVE (0x0002U)
+#define O_PUBLIC (0x0004U)
+#define O_EDIT (0x0008U)
+#define O_WRAP (0x0010U)
+#define O_BLANK (0x0020U)
+#define O_AUTOSKIP (0x0040U)
+#define O_NULLOK (0x0080U)
+#define O_PASSOK (0x0100U)
+#define O_STATIC (0x0200U)
+#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)
+#define O_BS_OVERLOAD (0x0002U)
+
+/* form driver commands */
+#define REQ_NEXT_PAGE (KEY_MAX + 1) /* move to next page */
+#define REQ_PREV_PAGE (KEY_MAX + 2) /* move to previous page */
+#define REQ_FIRST_PAGE (KEY_MAX + 3) /* move to first page */
+#define REQ_LAST_PAGE (KEY_MAX + 4) /* move to last page */
+
+#define REQ_NEXT_FIELD (KEY_MAX + 5) /* move to next field */
+#define REQ_PREV_FIELD (KEY_MAX + 6) /* move to previous field */
+#define REQ_FIRST_FIELD (KEY_MAX + 7) /* move to first field */
+#define REQ_LAST_FIELD (KEY_MAX + 8) /* move to last field */
+#define REQ_SNEXT_FIELD (KEY_MAX + 9) /* move to sorted next field */
+#define REQ_SPREV_FIELD (KEY_MAX + 10) /* move to sorted prev field */
+#define REQ_SFIRST_FIELD (KEY_MAX + 11) /* move to sorted first field */
+#define REQ_SLAST_FIELD (KEY_MAX + 12) /* move to sorted last field */
+#define REQ_LEFT_FIELD (KEY_MAX + 13) /* move to left to field */
+#define REQ_RIGHT_FIELD (KEY_MAX + 14) /* move to right to field */
+#define REQ_UP_FIELD (KEY_MAX + 15) /* move to up to field */
+#define REQ_DOWN_FIELD (KEY_MAX + 16) /* move to down to field */
+
+#define REQ_NEXT_CHAR (KEY_MAX + 17) /* move to next char in field */
+#define REQ_PREV_CHAR (KEY_MAX + 18) /* move to prev char in field */
+#define REQ_NEXT_LINE (KEY_MAX + 19) /* move to next line in field */
+#define REQ_PREV_LINE (KEY_MAX + 20) /* move to prev line in field */
+#define REQ_NEXT_WORD (KEY_MAX + 21) /* move to next word in field */
+#define REQ_PREV_WORD (KEY_MAX + 22) /* move to prev word in field */
+#define REQ_BEG_FIELD (KEY_MAX + 23) /* move to first char in field */
+#define REQ_END_FIELD (KEY_MAX + 24) /* move after last char in fld */
+#define REQ_BEG_LINE (KEY_MAX + 25) /* move to beginning of line */
+#define REQ_END_LINE (KEY_MAX + 26) /* move after last char in line */
+#define REQ_LEFT_CHAR (KEY_MAX + 27) /* move left in field */
+#define REQ_RIGHT_CHAR (KEY_MAX + 28) /* move right in field */
+#define REQ_UP_CHAR (KEY_MAX + 29) /* move up in field */
+#define REQ_DOWN_CHAR (KEY_MAX + 30) /* move down in field */
+
+#define REQ_NEW_LINE (KEY_MAX + 31) /* insert/overlay new line */
+#define REQ_INS_CHAR (KEY_MAX + 32) /* insert blank char at cursor */
+#define REQ_INS_LINE (KEY_MAX + 33) /* insert blank line at cursor */
+#define REQ_DEL_CHAR (KEY_MAX + 34) /* delete char at cursor */
+#define REQ_DEL_PREV (KEY_MAX + 35) /* delete char before cursor */
+#define REQ_DEL_LINE (KEY_MAX + 36) /* delete line at cursor */
+#define REQ_DEL_WORD (KEY_MAX + 37) /* delete word at cursor */
+#define REQ_CLR_EOL (KEY_MAX + 38) /* clear to end of line */
+#define REQ_CLR_EOF (KEY_MAX + 39) /* clear to end of field */
+#define REQ_CLR_FIELD (KEY_MAX + 40) /* clear entire field */
+#define REQ_OVL_MODE (KEY_MAX + 41) /* begin overlay mode */
+#define REQ_INS_MODE (KEY_MAX + 42) /* begin insert mode */
+#define REQ_SCR_FLINE (KEY_MAX + 43) /* scroll field forward a line */
+#define REQ_SCR_BLINE (KEY_MAX + 44) /* scroll field backward a line */
+#define REQ_SCR_FPAGE (KEY_MAX + 45) /* scroll field forward a page */
+#define REQ_SCR_BPAGE (KEY_MAX + 46) /* scroll field backward a page */
+#define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */
+#define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */
+#define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */
+#define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */
+#define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */
+#define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */
+#define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */
+#define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */
+
+#define REQ_VALIDATION (KEY_MAX + 55) /* validate field */
+#define REQ_NEXT_CHOICE (KEY_MAX + 56) /* display next field choice */
+#define REQ_PREV_CHOICE (KEY_MAX + 57) /* display prev field choice */
+
+#define MIN_FORM_COMMAND (KEY_MAX + 1) /* used by form_driver */
+#define 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
+# define MAX_COMMAND (KEY_MAX + 128)
+#endif
+
+ /*************************
+ * standard field types *
+ *************************/
+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 FORM_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */
+
+ /***********************
+ * FIELDTYPE routines *
+ ***********************/
+extern FORM_EXPORT(FIELDTYPE *) new_fieldtype (
+ bool (* const field_check)(FIELD *,const void *),
+ bool (* const char_check)(int,const void *));
+extern FORM_EXPORT(FIELDTYPE *) link_fieldtype(
+ FIELDTYPE *, 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 FORM_EXPORT(int) set_fieldtype_choice (FIELDTYPE *,
+ bool (* const next_choice)(FIELD *,const void *),
+ bool (* const prev_choice)(FIELD *,const void *));
+
+ /*******************
+ * FIELD routines *
+ *******************/
+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 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 FORM_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **);
+#endif
+
+#ifdef __cplusplus
+ }
+#endif
+/* *INDENT-ON*/
+
+#endif /* FORM_H */
diff --git a/mingw-w64-clang-i686-ncurses-6_3/include/ncurses/menu.h b/mingw-w64-clang-i686-ncurses-6_3/include/ncurses/menu.h
new file mode 100755
index 0000000..285edff
--- /dev/null
+++ b/mingw-w64-clang-i686-ncurses-6_3/include/ncurses/menu.h
@@ -0,0 +1,281 @@
+/****************************************************************************
+ * 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 $ */
+
+#ifndef ETI_MENU
+#define ETI_MENU
+
+#ifdef AMIGA
+#define TEXT TEXT_ncurses
+#endif
+
+#include
+#include
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#if defined(BUILDING_MENU)
+# define MENU_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
+#else
+# define MENU_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
+#endif
+
+#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)
+#define O_SHOWDESC (0x02)
+#define O_ROWMAJOR (0x04)
+#define O_IGNORECASE (0x08)
+#define O_SHOWMATCH (0x10)
+#define O_NONCYCLIC (0x20)
+#define O_MOUSE_MENU (0x40)
+
+/* Item options: */
+#define O_SELECTABLE (0x01)
+
+#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 */
+
+#define REQ_LEFT_ITEM (KEY_MAX + 1)
+#define REQ_RIGHT_ITEM (KEY_MAX + 2)
+#define REQ_UP_ITEM (KEY_MAX + 3)
+#define REQ_DOWN_ITEM (KEY_MAX + 4)
+#define REQ_SCR_ULINE (KEY_MAX + 5)
+#define REQ_SCR_DLINE (KEY_MAX + 6)
+#define REQ_SCR_DPAGE (KEY_MAX + 7)
+#define REQ_SCR_UPAGE (KEY_MAX + 8)
+#define REQ_FIRST_ITEM (KEY_MAX + 9)
+#define REQ_LAST_ITEM (KEY_MAX + 10)
+#define REQ_NEXT_ITEM (KEY_MAX + 11)
+#define REQ_PREV_ITEM (KEY_MAX + 12)
+#define REQ_TOGGLE_ITEM (KEY_MAX + 13)
+#define REQ_CLEAR_PATTERN (KEY_MAX + 14)
+#define REQ_BACK_PATTERN (KEY_MAX + 15)
+#define REQ_NEXT_MATCH (KEY_MAX + 16)
+#define REQ_PREV_MATCH (KEY_MAX + 17)
+
+#define MIN_MENU_COMMAND (KEY_MAX + 1)
+#define 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
+# define MAX_COMMAND (KEY_MAX + 128)
+#endif
+
+/* --------- prototypes for libmenu functions ----------------------------- */
+
+ 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 MENU_EXPORT(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN *, ITEM **);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ETI_MENU */
diff --git a/mingw-w64-clang-i686-ncurses-6_3/include/ncurses/ncurses.h b/mingw-w64-clang-i686-ncurses-6_3/include/ncurses/ncurses.h
new file mode 100755
index 0000000..d01da4c
--- /dev/null
+++ b/mingw-w64-clang-i686-ncurses-6_3/include/ncurses/ncurses.h
@@ -0,0 +1,1800 @@
+/****************************************************************************
+ * 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 $ */
+
+#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 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 "6.3"
+
+/*
+ * Identify the mouse encoding version.
+ */
+#define NCURSES_MOUSE_VERSION 2
+
+/*
+ * Definitions to facilitate DLL's.
+ */
+#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 .
+ */
+#ifndef NCURSES_ENABLE_STDBOOL_H
+#define NCURSES_ENABLE_STDBOOL_H 1
+#endif
+
+/*
+ * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses
+ * configured using --disable-macros.
+ */
+#ifndef NCURSES_ATTR_T
+#define NCURSES_ATTR_T int
+#endif
+
+/*
+ * 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
+#define NCURSES_CONST const
+
+#undef NCURSES_INLINE
+#define NCURSES_INLINE inline
+
+/*
+ * 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.
+ */
+#ifndef NCURSES_INTERNALS
+#define NCURSES_OPAQUE 1
+#define NCURSES_OPAQUE_FORM 1
+#define NCURSES_OPAQUE_MENU 1
+#define NCURSES_OPAQUE_PANEL 1
+#endif
+
+/*
+ * 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_WATTR_MACROS
+#define NCURSES_WATTR_MACROS 0
+#endif
+
+/*
+ * The reentrant code relies on the opaque setting, but adds features.
+ */
+#ifndef NCURSES_REENTRANT
+#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 1
+
+/*
+ * The internal type used for window dimensions.
+ */
+#undef NCURSES_SIZE_T
+#define NCURSES_SIZE_T short
+
+/*
+ * Control whether tparm() supports varargs or fixed-parameter list.
+ */
+#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
+#define NCURSES_CH_T chtype
+
+#if 1 && defined(_LP64)
+typedef unsigned chtype;
+typedef unsigned mmask_t;
+#else
+typedef uint32_t chtype;
+typedef uint32_t mmask_t;
+#endif
+
+/*
+ * We need FILE, etc. Include this before checking any feature symbols.
+ */
+#include
+
+/*
+ * 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.
+ */
+#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 */
+#if NCURSES_WIDECHAR
+#include /* we want wchar_t */
+#endif
+
+/* 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++.
+ */
+
+#undef TRUE
+#define TRUE 1
+
+#undef FALSE
+#define FALSE 0
+
+typedef unsigned char NCURSES_BOOL;
+
+#if defined(__cplusplus) /* __cplusplus, etc. */
+
+/* use the C++ compiler's bool type */
+#define NCURSES_BOOL bool
+
+#else /* c89, c99, etc. */
+
+#if NCURSES_ENABLE_STDBOOL_H
+#include
+/* use whatever the C compiler decides bool really is */
+#define NCURSES_BOOL bool
+#else
+/* there is no predefined bool - use our own */
+#undef bool
+#define bool NCURSES_BOOL
+#endif
+
+#endif /* !__cplusplus, etc. */
+
+#ifdef __cplusplus
+extern "C" {
+#define NCURSES_CAST(type,value) static_cast