curses-1.4.4/0000755000004100000410000000000014201713275013056 5ustar www-datawww-datacurses-1.4.4/COPYING0000644000004100000410000000471014201713275014113 0ustar www-datawww-dataRuby is copyrighted free software by Yukihiro Matsumoto . You can redistribute it and/or modify it under either the terms of the 2-clause BSDL (see the file BSDL), or the conditions below: 1. You may make and give away verbatim copies of the source form of the software without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may modify your copy of the software in any way, provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or by allowing the author to include your modifications in the software. b) use the modified software only within your corporation or organization. c) give non-standard binaries non-standard names, with instructions on where to get the original software distribution. d) make other distribution arrangements with the author. 3. You may distribute the software in object code or binary form, provided that you do at least ONE of the following: a) distribute the binaries and library files of the software, together with instructions (in the manual page or equivalent) on where to get the original distribution. b) accompany the distribution with the machine-readable source of the software. c) give non-standard binaries non-standard names, with instructions on where to get the original software distribution. d) make other distribution arrangements with the author. 4. You may modify and include the part of the software into any other software (possibly commercial). But some files in the distribution are not written by the author, so that they are not under these terms. For the list of those files and their copying conditions, see the file LEGAL. 5. The scripts and library files supplied as input to or produced as output from the software do not automatically fall under the copyright of the software, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this software. 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. curses-1.4.4/README.md0000644000004100000410000000452114201713275014337 0ustar www-datawww-data# curses [![Gem Version](https://badge.fury.io/rb/curses.svg)](https://badge.fury.io/rb/curses) [![ubuntu](https://github.com/ruby/curses/workflows/ubuntu/badge.svg)](https://github.com/ruby/curses/actions?query=workflow%3Aubuntu) [![windows](https://github.com/ruby/curses/workflows/windows/badge.svg)](https://github.com/ruby/curses/actions?query=workflow%3Awindows) [![macos](https://github.com/ruby/curses/workflows/macos/badge.svg)](https://github.com/ruby/curses/actions?query=workflow%3Amacos) * https://github.com/ruby/curses * https://github.com/ruby/curses/issues ## Description A Ruby binding for curses, ncurses, and PDCurses. curses is an extension library for text UI applications. Formerly part of the Ruby standard library, [curses was removed and placed in this gem][1] with the release of Ruby 2.1.0. (see [ruby/ruby@9c5b2fd][2]) ## Install $ gem install curses Requires ncurses or ncursesw (with wide character support). On Debian based distributions, you can install it with apt: $ apt install libncurses5-dev Or $ apt install libncursesw5-dev On Windows, `gem install curses` will build bundled PDCurses, so you don't need to install extra libraries. However, if you prefer ncurses to PDCurses, specify the following option: > gem install curses -- --use-system-libraries On mingw, you need DevKit to compile the extension library. ## Documentation See [https://www.rubydoc.info/gems/curses](https://www.rubydoc.info/gems/curses). ## Developers After checking out the repo, run `bundle install` to install dependencies. To compile the extension library, run `bundle exec rake compile`. To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `curses.gemspec`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). ## License curses is released under the Ruby and 2-clause BSD licenses. See COPYING for details. It includes a forked version of PDCurses, which is in the public domain: https://github.com/Bill-Gray/PDCurses The version for Win32 console mode in the wincon subdirectory is used. [1]: https://bugs.ruby-lang.org/issues/8584 [2]: https://github.com/ruby/ruby/commit/9c5b2fd8aa0fd343ad094d47a638cfd3f6ae0a81 curses-1.4.4/.gitignore0000644000004100000410000000030114201713275015040 0ustar www-datawww-data*.rbc *.swp /TAGS /doc /lib/curses.bundle /lib/curses.so /lib/curses.dll /pkg /tmp /Gemfile.lock /vendor/x86-mingw32 /vendor/x64-mingw32 /vendor/x64-mswin64* /ext/curses/Makefile .ruby-version curses-1.4.4/Rakefile0000644000004100000410000000006414201713275014523 0ustar www-datawww-datarequire "bundler" Bundler::GemHelper.install_tasks curses-1.4.4/lib/0000755000004100000410000000000014201713275013624 5ustar www-datawww-datacurses-1.4.4/lib/curses.rb0000644000004100000410000000314514201713275015460 0ustar www-datawww-datapdcurses_dll = File.expand_path("../vendor/PDCurses/pdcurses.dll", __dir__) if File.exist?(pdcurses_dll) path = ENV["PATH"] dir = File::ALT_SEPARATOR ? File.dirname(pdcurses_dll).tr("/", File::ALT_SEPARATOR) : dir dirs = path.split(File::PATH_SEPARATOR) if !dirs.include?(dir) ENV["PATH"] = [dir, *dirs].join(File::PATH_SEPARATOR) end end require "curses.so" if /mingw|mswin/ =~ RUBY_PLATFORM Curses.keyboard_encoding = Encoding::UTF_8 end if defined?(Curses::Menu) class Curses::Menu def left_item driver(Curses::REQ_LEFT_ITEM) end def right_item driver(Curses::REQ_RIGHT_ITEM) end def up_item driver(Curses::REQ_UP_ITEM) end def down_item driver(Curses::REQ_DOWN_ITEM) end def scroll_up_line driver(Curses::REQ_SCR_ULINE) end def scroll_down_line driver(Curses::REQ_SCR_DLINE) end def scroll_up_page driver(Curses::REQ_SCR_UPAGE) end def scroll_down_page driver(Curses::REQ_SCR_DPAGE) end def first_item driver(Curses::REQ_FIRST_ITEM) end def last_item driver(Curses::REQ_LAST_ITEM) end def next_item driver(Curses::REQ_NEXT_ITEM) end def prev_item driver(Curses::REQ_PREV_ITEM) end def toggle_item driver(Curses::REQ_TOGGLE_ITEM) end def clear_pattern driver(Curses::REQ_CLEAR_PATTERN) end def back_pattern driver(Curses::REQ_BACK_PATTERN) end def next_match driver(Curses::REQ_NEXT_MATCH) end def prev_match driver(Curses::REQ_PREV_MATCH) end end end curses-1.4.4/vendor/0000755000004100000410000000000014201713275014353 5ustar www-datawww-datacurses-1.4.4/vendor/PDCurses/0000755000004100000410000000000014201713275016043 5ustar www-datawww-datacurses-1.4.4/vendor/PDCurses/cmake/0000755000004100000410000000000014201713275017123 5ustar www-datawww-datacurses-1.4.4/vendor/PDCurses/cmake/version.in.cmake0000644000004100000410000000373514201713275022227 0ustar www-datawww-data// Microsoft Visual C++ generated resource script. // #include #include "resource.h" ///////////////////////////////////////////////////////////////////////////// // English (United States) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) ///////////////////////////////////////////////////////////////////////////// // // Version // VS_VERSION_INFO VERSIONINFO FILEVERSION FILE_VERSION_RESOURCE PRODUCTVERSION PRODUCT_VERSION_RESOURCE FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x0L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040004b0" BEGIN VALUE "FileDescription", PRODUCT_FILE_DESCRIPTION VALUE "FileVersion", FILE_VERSION_RESOURCE_STR VALUE "InternalName", PRODUCT_INTERNAL_NAME VALUE "LegalCopyright", PRODUCT_COMPANY_COPYRIGHT VALUE "OriginalFilename", PRODUCT_ORIGINAL_FILENAME VALUE "ProductName", PRODUCT_NAME VALUE "ProductVersion", PRODUCT_VERSION_RESOURCE_STR END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x400, 1200, 0x409, 1200 END END ///////////////////////////////////////////////////////////////////////////// // // Icon // // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. 1 ICON PRODUCT_ICON #endif // English (United States) resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED curses-1.4.4/vendor/PDCurses/cmake/resource.in.cmake0000644000004100000410000000525614201713275022371 0ustar www-datawww-data//{{NO_DEPENDENCIES}} // Used by version.rc // #define PRODUCT_VERSION_MAJOR @PRODUCT_VERSION_MAJOR@ #define PRODUCT_VERSION_MINOR @PRODUCT_VERSION_MINOR@ #define PRODUCT_VERSION_PATCH @PRODUCT_VERSION_PATCH@ #define PRODUCT_VERSION_BUILD @PRODUCT_VERSION_BUILD@ #define FILE_VERSION_MAJOR @FILE_VERSION_MAJOR@ #define FILE_VERSION_MINOR @FILE_VERSION_MINOR@ #define FILE_VERSION_PATCH @FILE_VERSION_PATCH@ #define FILE_VERSION_BUILD @FILE_VERSION_BUILD@ #ifndef __TO_STRING #define __TO_STRING_IMPL(x) #x #define __TO_STRING(x) __TO_STRING_IMPL(x) #endif #define PRODUCT_VERSION_MAJOR_MINOR_STR __TO_STRING(PRODUCT_VERSION_MAJOR) "." __TO_STRING(PRODUCT_VERSION_MINOR) #define PRODUCT_VERSION_MAJOR_MINOR_PATCH_STR PRODUCT_VERSION_MAJOR_MINOR_STR "." __TO_STRING(PRODUCT_VERSION_PATCH) #define PRODUCT_VERSION_FULL_STR PRODUCT_VERSION_MAJOR_MINOR_PATCH_STR "." __TO_STRING(PRODUCT_VERSION_BUILD) #define PRODUCT_VERSION_RESOURCE PRODUCT_VERSION_MAJOR,PRODUCT_VERSION_MINOR,PRODUCT_VERSION_PATCH,PRODUCT_VERSION_BUILD #define PRODUCT_VERSION_RESOURCE_STR PRODUCT_VERSION_FULL_STR "\0" #define FILE_VERSION_MAJOR_MINOR_STR __TO_STRING(FILE_VERSION_MAJOR) "." __TO_STRING(FILE_VERSION_MINOR) #define FILE_VERSION_MAJOR_MINOR_PATCH_STR FILE_VERSION_MAJOR_MINOR_STR "." __TO_STRING(FILE_VERSION_PATCH) #define FILE_VERSION_FULL_STR FILE_VERSION_MAJOR_MINOR_PATCH_STR "." __TO_STRING(FILE_VERSION_BUILD) #define FILE_VERSION_RESOURCE FILE_VERSION_MAJOR,FILE_VERSION_MINOR,FILE_VERSION_PATCH,FILE_VERSION_BUILD #define FILE_VERSION_RESOURCE_STR FILE_VERSION_FULL_STR "\0" #define PRODUCT_FILE_DESCRIPTION "@PRODUCT_FILE_DESCRIPTION@\0" #define PRODUCT_INTERNAL_NAME "@PRODUCT_INTERNAL_NAME@\0" #define PRODUCT_COMPANY_COPYRIGHT "@PRODUCT_COMPANY_COPYRIGHT@\0" #define PRODUCT_ORIGINAL_FILENAME "@PRODUCT_ORIGINAL_FILENAME@\0" #define PRODUCT_NAME "@PRODUCT_NAME@\0" #define PRODUCT_ICON "@PRODUCT_ICON@" #define VS_VERSION_INFO 1 #define IDC_STATIC -1 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 101 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1000 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif curses-1.4.4/vendor/PDCurses/cmake/dll_version.cmake0000644000004100000410000000217114201713275022446 0ustar www-datawww-dataset(PRODUCT_FILE_DESCRIPTION "Public Domain Curses ") set(PRODUCT_INTERNAL_NAME "PDCurses - ${PROJECT_NAME}") set(PRODUCT_COMPANY_COPYRIGHT "Public Domain") set(PRODUCT_NAME "Public Domain Curses Library") set(PRODUCT_ORIGINAL_FILENAME "PDCURSES.DLL") set(PRODUCT_ICON "pdcurses.ico") set(PRODUCT_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) set(PRODUCT_VERSION_MINOR ${PROJECT_VERSION_MINOR}) set(PRODUCT_VERSION_PATCH ${PROJECT_VERSION_PATCH}) set(PRODUCT_VERSION_BUILD ${PROJECT_VERSION_TWEAK}) set(FILE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) set(FILE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) set(FILE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) set(FILE_VERSION_BUILD ${PROJECT_VERSION_TWEAK}) if(MSVC) set(TOOL_NAME MS) endif() set(PRODUCT_FILE_DESCRIPTION "${PRODUCT_FILE_DESCRIPTION} ${TOOL_NAME} ${TARGET_ARCH}") configure_file ( ${CMAKE_SOURCE_DIR}/cmake/version.in.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY ) configure_file ( ${CMAKE_SOURCE_DIR}/cmake/resource.in.cmake ${CMAKE_CURRENT_BINARY_DIR}/resource.h @ONLY ) configure_file ( ${CMAKE_SOURCE_DIR}/wincon/pdcurses.ico ${CMAKE_CURRENT_BINARY_DIR}/pdcurses.ico COPYONLY ) curses-1.4.4/vendor/PDCurses/cmake/README.md0000644000004100000410000000470114201713275020404 0ustar www-datawww-data CMake Options ------------- option(PDC_BUILD_SHARED "Build dynamic libs for pdcurses" ON) option(PDC_UTF8 "Force to UTF8" OFF) option(PDC_WIDE "Wide - pulls in sdl-ttf" OFF) option(PDCDEBUG "Debug tracing" OFF) option(PDC_CHTYPE_32 "CHTYPE_32" OFF) option(PDC_CHTYPE_16 "CHTYPE_16" OFF) option(PDC_DOS_BUILD "Build DOS Project" OFF) option(PDC_SDL2_BUILD "Build SDL2 Project" ON) option(PDC_SDL2_DEPS_BUILD "Build SDL2 and dependencies" ON) To override the default option value, use the "-DBUILD_SDL2=ON" scheme. If you set it once, CMake caches the value. When using pre-built SDL2 bits, simply set these two variables when invoking cmake the first time. -DSDL2_INCLUDE_DIR=/my/path/to/sdl2/include/SDL2 -DSDL2_LIBRARY_DIR=/my/path/to/sdl2/lib/folder Appveyor -------- Upon cmake branch check-ins, Appveyor will build the following variants: wide/utf8 - Release/Debug, Visual Studio 2015 - amd64_x86/amd64/amd64_arm wide/utf8 - Release/Debug, Visual Studio 2017 - amd64_x86/amd64/amd64_arm/amd64_arm64 ^There is currently a SDL2 bug preventing MinSizeRel builds: https://bugzilla.libsdl.org/show_bug.cgi?id=4233 Native Windows Building ----------------------- Win32 (pdcurses.sln) mkdir build32 & pushd build32 cmake -G"Visual Studio 15" -DPDC_WIDE=ON -DCMAKE_INSTALL_PREFIX=c:\tmp\pdcurses\Win32 -DCMAKE_BUILD_TYPE=Debug -DPDCDEBUG=ON .. popd cmake --build build32 --config Debug --target install Win64 (pdcurses.sln) mkdir build64 & pushd build64 cmake -G"Visual Studio 15 Win64" -DPDC_WIDE=ON -DCMAKE_INSTALL_PREFIX=c:\tmp\pdcurses\Win64 -DCMAKE_BUILD_TYPE=Debug -DPDCDEBUG=ON .. popd cmake --build build64 --config Debug --target install Cygwin ------ mkdir build && pushd build cmake .. -G"Unix Makefiles" -DPDC_SDL2_BUILD=OFF -DCMAKE_INSTALL_PREFIX=/cygdrive/c/tmp/pdcurses/Cyg64 -DCMAKE_BUILD_TYPE=Debug -DPDCDEBUG=ON -DWINDOWS_KIT_LIBRARY_DIR=/cygdrive/c/Program\ Files\ \(x86\)/Windows\ Kits/10/Lib/10.0.14393.0/um/x64 .. popd cmake --build build --config Debug --target install Note: The demo apps will all build, only version.exe works. All other apps print "Redirection is not supported." Linux Building -------------- SDL2 (Currently the only project supported with CMake) cmake .. -DPDC_WIDE=ON -DCMAKE_INSTALL_PREFIX=/home/joel/pdcurses/out -DCMAKE_BUILD_TYPE=Debug -GNinja autoninja install curses-1.4.4/vendor/PDCurses/cmake/sdl2_ttf/0000755000004100000410000000000014201713275020644 5ustar www-datawww-datacurses-1.4.4/vendor/PDCurses/cmake/sdl2_ttf/CMakeLists.txt0000644000004100000410000000512514201713275023407 0ustar www-datawww-dataCMAKE_MINIMUM_REQUIRED (VERSION 3.11) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING "Choose the type of build, options are: Debug, Release, or MinSizeRel." FORCE) message(STATUS "CMAKE_BUILD_TYPE not set, defaulting to MinSizeRel.") endif() PROJECT (sdl2_ttf VERSION ${SDL2_TTF_RELEASE} LANGUAGES C) if(MSVC) SET(CMAKE_DEBUG_POSTFIX d) endif() INCLUDE_DIRECTORIES( ${ZLIB_INCLUDE_DIR} ${FT2_INCLUDE_DIR} ${SDL2_INCLUDE_DIR}) LINK_DIRECTORIES( ${ZLIB_LIBRARY_DIR} ${FT2_LIBRARY_DIR} ${SDL2_LIBRARY_DIR}) INSTALL (FILES SDL_ttf.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/SDL2_ttf) set(SDL2_ttf_source_files SDL_ttf.c) IF(WIN32) LIST(INSERT SDL2_ttf_source_files 0 Version.rc) ENDIF() if (APPLE) find_library(COREVIDEO CoreVideo) list(APPEND EXTRA_LIBS ${COREVIDEO}) find_library(COCOA_LIBRARY Cocoa) list(APPEND EXTRA_LIBS ${COCOA_LIBRARY}) find_library(IOKIT IOKit) list(APPEND EXTRA_LIBS ${IOKIT}) find_library(FORCEFEEDBACK ForceFeedback) list(APPEND EXTRA_LIBS ${FORCEFEEDBACK}) find_library(CARBON_LIBRARY Carbon) list(APPEND EXTRA_LIBS ${CARBON_LIBRARY}) find_library(COREAUDIO CoreAudio) list(APPEND EXTRA_LIBS ${COREAUDIO}) find_library(AUDIOTOOLBOX AudioToolbox) list(APPEND EXTRA_LIBS ${AUDIOTOOLBOX}) include(CheckLibraryExists) check_library_exists(iconv iconv_open "" HAVE_LIBICONV) if(HAVE_LIBICONV) list(APPEND EXTRA_LIBS iconv) endif() endif() ADD_LIBRARY(SDL2_ttf-static STATIC ${SDL2_ttf_source_files} SDL_ttf.h) INSTALL (TARGETS SDL2_ttf-static ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib COMPONENT libraries) ADD_LIBRARY(SDL2_ttf SHARED ${SDL2_ttf_source_files} SDL_ttf.h) TARGET_LINK_LIBRARIES (SDL2_ttf ${SDL2_LIBRARY} ${FT2_LIBRARY} ${ZLIB_LIBRARY} ${EXTRA_LIBS}) INSTALL (TARGETS SDL2_ttf ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib COMPONENT libraries) ADD_EXECUTABLE (showfont ${CMAKE_SOURCE_DIR}/showfont.c) TARGET_LINK_LIBRARIES (showfont SDL2_ttf ${SDL2_LIBRARIES} ${FT2_LIBRARY} ${ZLIB_LIBRARY} ${EXTRA_LIBS}) INSTALL (TARGETS showfont RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin COMPONENT applications) ADD_EXECUTABLE (glfont ${CMAKE_SOURCE_DIR}/glfont.c) TARGET_LINK_LIBRARIES (glfont SDL2_ttf ${SDL2_LIBRARIES} ${FT2_LIBRARY} ${ZLIB_LIBRARY} ${EXTRA_LIBS}) INSTALL (TARGETS glfont RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin COMPONENT applications) set(CPACK_COMPONENTS_ALL libraries applications) curses-1.4.4/vendor/PDCurses/cmake/make_uninstall.cmake0000644000004100000410000000124314201713275023133 0ustar www-datawww-data if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt") message(FATAL_ERROR "Cannot find install manifest: ${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt") endif() file(READ "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt" files) string(REGEX REPLACE "[\r\n]" ";" files "${files}") foreach(file ${files}) message(STATUS "Uninstalling ${file}") if(EXISTS "${file}") file(REMOVE ${file}) if (EXISTS "${file}") message(FATAL_ERROR "Problem when removing ${file}, please check your permissions") endif() else() message(STATUS "File ${file} does not exist.") endif() endforeach() curses-1.4.4/vendor/PDCurses/cmake/watcom_open_os2v2_toolchain.cmake0000644000004100000410000000654614201713275025546 0ustar www-datawww-data# This module is shared by multiple languages; use include blocker. if(__WINDOWS_OPENWATCOM) return() endif() set(__WINDOWS_OPENWATCOM 1) set(CMAKE_LIBRARY_PATH_FLAG "libpath ") set(CMAKE_LINK_LIBRARY_FLAG "library ") set(CMAKE_LINK_LIBRARY_FILE_FLAG "library") if(CMAKE_VERBOSE_MAKEFILE) set(CMAKE_WCL_QUIET) set(CMAKE_WLINK_QUIET) set(CMAKE_LIB_QUIET) else() set(CMAKE_WCL_QUIET "-zq") set(CMAKE_WLINK_QUIET "op q") set(CMAKE_LIB_QUIET "-q") endif() string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ") set(CMAKE_C_COMPILE_OPTIONS_DLL "") set(CMAKE_SHARED_LIBRARY_C_FLAGS "") message(STATUS "Configured for OS/2 v2") set(WATCOM_OS2V2 TRUE) set(CMAKE_C_COMPILER "wcc386") set(SYSTEM_NAME os2v2) # detect folder, add lib386 directory execute_process( COMMAND where ${CMAKE_C_COMPILER} OUTPUT_VARIABLE COMPILER_PATH OUTPUT_STRIP_TRAILING_WHITESPACE ) get_filename_component(COMPILER_DIR ${COMPILER_PATH} PATH) get_filename_component(WATCOM_TOOLCHAIN_DIR "${COMPILER_DIR}/.." ABSOLUTE) string(APPEND LINK_LIBRARIES_PATH "${WATCOM_TOOLCHAIN_DIR}/lib386;${WATCOM_TOOLCHAIN_DIR}/lib386/dos") set(CMAKE_ASM_COMPILER "wasm") set(CMAKE_BUILD_TYPE_INIT Debug) string(APPEND CMAKE_C_FLAGS_INIT " -bt=${SYSTEM_NAME}") foreach(type CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE) set(CMAKE_C_${type}_USE_WATCOM_QUOTE 1) endforeach() set(CMAKE_C_CREATE_IMPORT_LIBRARY "wlib -q -n -b +") set(CMAKE_C_LINK_EXECUTABLE "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} system ${SYSTEM_NAME} name file {} ${CMAKE_END_TEMP_FILE}") # compile a C file into an object file set(CMAKE_C_COMPILE_OBJECT " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo=\"\" \"\"${CMAKE_END_TEMP_FILE}") # preprocess a C source file set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo=\"\" -pl \"\"${CMAKE_END_TEMP_FILE}") string(REPLACE " option implib=" "" CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") # create a C shared library set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) # create a C shared module set(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE}) # create a C static library set(CMAKE_C_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -c -n -b ") if(NOT _CMAKE_WATCOM_VERSION) set(_CMAKE_WATCOM_VERSION 1) if(CMAKE_C_COMPILER_VERSION) set(_compiler_version ${CMAKE_C_COMPILER_VERSION}) set(_compiler_id ${CMAKE_C_COMPILER_ID}) endif() set(WATCOM16) set(WATCOM17) set(WATCOM18) set(WATCOM19) set(WATCOM20) if("${_compiler_id}" STREQUAL "OpenWatcom") if("${_compiler_version}" VERSION_LESS 1.7) set(WATCOM16 1) endif() if("${_compiler_version}" VERSION_EQUAL 1.7) set(WATCOM17 1) endif() if("${_compiler_version}" VERSION_EQUAL 1.8) set(WATCOM18 1) endif() if("${_compiler_version}" VERSION_EQUAL 1.9) set(WATCOM19 1) endif() if("${_compiler_version}" VERSION_EQUAL 2.0) set(WATCOM20 1) endif() endif() endif() curses-1.4.4/vendor/PDCurses/cmake/target_arch.cmake0000644000004100000410000000177614201713275022423 0ustar www-datawww-data set(TARGET_ARCH_DETECT_CODE " #if defined(_M_ARM) || defined(__arm__) #error cmake_arch ARM #elif defined(_M_ARM64) || defined(__aarch64__) #error cmake_arch ARM64 #elif defined(_M_AMD64) || defined(__x86_64__) #error cmake_arch x86_64 #elif defined(_M_X64) #error cmake_arch x64 #elif defined(_M_IX86) || defined(__i386__) #error cmake_arch x86 #else #error cmake_arch unknown #endif ") function(get_target_arch out) file(WRITE "${CMAKE_BINARY_DIR}/target_arch_detect.c" "${TARGET_ARCH_DETECT_CODE}") try_run( run_result_unused compile_result_unused "${CMAKE_BINARY_DIR}" "${CMAKE_BINARY_DIR}/target_arch_detect.c" COMPILE_OUTPUT_VARIABLE TARGET_ARCH) # parse compiler output string(REGEX MATCH "cmake_arch ([a-zA-Z0-9_]+)" TARGET_ARCH "${TARGET_ARCH}") string(REPLACE "cmake_arch " "" TARGET_ARCH "${TARGET_ARCH}") set(${out} "${TARGET_ARCH}" PARENT_SCOPE) endfunction() curses-1.4.4/vendor/PDCurses/cmake/build_dependencies.cmake0000644000004100000410000001546014201713275023740 0ustar www-datawww-data IF (PDC_SDL2_DEPS_BUILD) INCLUDE(ExternalProject) IF(NOT WIN32) set(FLAGS_FOR_DYNAMIC_LINK -fPIC) ENDIF() SET(SDL2_RELEASE 2.0.8) ExternalProject_Add(sdl2_ext URL https://www.libsdl.org/release/SDL2-${SDL2_RELEASE}.zip URL_HASH "SHA256=e6a7c71154c3001e318ba7ed4b98582de72ff970aca05abc9f45f7cbdc9088cb" UPDATE_COMMAND "" DOWNLOAD_DIR ${CMAKE_BINARY_DIR} SOURCE_DIR ${CMAKE_BINARY_DIR}/SDL2-${SDL2_RELEASE} BUILD_IN_SOURCE 0 CMAKE_ARGS ${SDL_CMAKE_BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_C_FLAGS=${FLAGS_FOR_DYNAMIC_LINK} ${EXTERNAL_C_FLAGS} ) MESSAGE(STATUS "SDL2 Installing to: ${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}") SET(SDL2_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}/include/SDL2) SET(SDL2_LIBRARY_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}/lib) IF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") IF(WIN32) set(SDL2_LIBRARIES "SDL2maind.lib;SDL2d.lib") set(SDL2_LIBRARY "SDL2d.lib") ELSEIF(APPLE) set(SDL2_LIBRARIES "SDL2maind;SDL2d") set(SDL2_LIBRARY "SDL2d") ELSE() set(SDL2_LIBRARIES "SDL2maind;SDL2-2.0d") set(SDL2_LIBRARY "SDL2-2.0d") ENDIF() ELSE() IF(WIN32) set(SDL2_LIBRARIES "SDL2main.lib;SDL2.lib") set(SDL2_LIBRARY "SDL2.lib") ELSEIF(APPLE) set(SDL2_LIBRARIES "SDL2main;SDL2") set(SDL2_LIBRARY "SDL2") ELSE() set(SDL2_LIBRARIES "SDL2main;SDL2-2.0") set(SDL2_LIBRARY "SDL2-2.0") ENDIF() ENDIF() IF (PDC_WIDE) ExternalProject_Add(zlib_ext GIT_REPOSITORY "https://github.com/madler/zlib.git" GIT_TAG "v1.2.11" UPDATE_COMMAND "" DOWNLOAD_DIR ${CMAKE_BINARY_DIR} SOURCE_DIR ${CMAKE_BINARY_DIR}/zlib BUILD_IN_SOURCE 1 CMAKE_ARGS ${ZLIB_CMAKE_BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE} -DCMAKE_C_FLAGS=${EXTERNAL_C_FLAGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS=${BUILD_SHARED} -DAMD64=${ZLIB_AMD64} -DASM686=${ZLIB_ASM686} ) MESSAGE(STATUS "zlib Installing to: ${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}") SET(ZLIB_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}/include) SET(ZLIB_LIBRARY_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}/lib) IF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") IF(WIN32) set(ZLIB_LIBRARY zlibd.lib) ELSE() set(ZLIB_LIBRARY z) ENDIF() ELSE() IF(WIN32) set(ZLIB_LIBRARY zlib.lib) ELSE() set(ZLIB_LIBRARY z) ENDIF() ENDIF() ExternalProject_Add(freetype2_ext GIT_REPOSITORY "https://git.savannah.gnu.org/git/freetype/freetype2.git" GIT_TAG "VER-2-8-1" UPDATE_COMMAND "" DOWNLOAD_DIR ${CMAKE_BINARY_DIR} SOURCE_DIR ${CMAKE_BINARY_DIR}/freetype2 BUILD_IN_SOURCE 0 CMAKE_ARGS ${FT2_CMAKE_BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE} -DCMAKE_C_FLAGS=${FLAGS_FOR_DYNAMIC_LINK} ${EXTERNAL_C_FLAGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DWITH_HarfBuzz=OFF -DWITH_BZip2=OFF -DWITH_PNG=OFF -DWITH_ZLIB=ON -DZLIB_FOUND=ON -DZLIB_LIBRARY=${ZLIB_LIBRARY} -DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIR} -DZLIB_LIBRARY_DIR=${ZLIB_LIBRARY_DIR} ) ADD_DEPENDENCIES(freetype2_ext zlib_ext) MESSAGE(STATUS "freetype2 Installing to: ${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}") SET(FT2_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}/include/freetype2) SET(FT2_LIBRARY_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}/lib) IF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") IF(WIN32) set(FT2_LIBRARY freetyped.lib) ELSE() set(FT2_LIBRARY freetyped) ENDIF() ELSE() IF(WIN32) set(FT2_LIBRARY freetype.lib) ELSE() set(FT2_LIBRARY freetype) ENDIF() ENDIF() SET(SDL2_TTF_RELEASE 2.0.14) ExternalProject_Add(sdl2_ttf_ext URL https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-${SDL2_TTF_RELEASE}.zip URL_HASH "SHA256=ad7a7d2562c19ad2b71fa4ab2e76f9f52b3ee98096c0a7d7efbafc2617073c27" PATCH_COMMAND cmake -E copy ${CMAKE_SOURCE_DIR}/cmake/sdl2_ttf/CMakeLists.txt ${CMAKE_BINARY_DIR}/sdl2_ttf/CMakeLists.txt UPDATE_COMMAND "" DOWNLOAD_DIR ${CMAKE_BINARY_DIR} SOURCE_DIR ${CMAKE_BINARY_DIR}/sdl2_ttf BUILD_IN_SOURCE 0 CMAKE_ARGS ${SDL2_TTF_CMAKE_BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE} -DCMAKE_C_FLAGS=${EXTERNAL_C_FLAGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DSDL2_TTF_RELEASE=${SDL2_TTF_RELEASE} -DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIR} -DZLIB_LIBRARY_DIR=${ZLIB_LIB_DIR} -DZLIB_LIBRARY=${ZLIB_LIBRARY} -DFT2_INCLUDE_DIR=${FT2_INCLUDE_DIR} -DFT2_LIBRARY_DIR=${FT2_LIBRARY_DIR} -DFT2_LIBRARY=${FT2_LIBRARY} -DSDL2_INCLUDE_DIR=${SDL2_INCLUDE_DIR} -DSDL2_LIBRARY_DIR=${SDL2_LIBRARY_DIR} -DSDL2_LIBRARY=${SDL2_LIBRARY} -DSDL2_LIBRARIES=${SDL2_LIBRARIES} ) ADD_DEPENDENCIES(sdl2_ttf_ext sdl2_ext freetype2_ext) MESSAGE(STATUS "SDL2_ttf Installing to: ${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}") SET(SDL2_TTF_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}/include/SDL2_ttf) SET(SDL2_TTF_LIBRARY_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}/lib) IF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") IF(WIN32) set(SDL2_TTF_LIBRARY "SDL2_ttfd.lib") ELSE() set(SDL2_TTF_LIBRARY "SDL2_ttf") ENDIF() ELSE() IF(WIN32) set(SDL2_TTF_LIBRARY "SDL2_ttf.lib") ELSE() set(SDL2_TTF_LIBRARY "SDL2_ttf") ENDIF() ENDIF() ENDIF (PDC_WIDE) ENDIF() curses-1.4.4/vendor/PDCurses/cmake/gen_config_header.cmake0000644000004100000410000000210414201713275023530 0ustar www-datawww-dataINCLUDE(CheckFunctionExists) CHECK_FUNCTION_EXISTS(vsnprintf PDC_HAVE_VSNPRINTF) CHECK_FUNCTION_EXISTS(vsscanf PDC_HAVE_VSSCANF) IF(PDC_HAVE_VSNPRINTF) ADD_DEFINITIONS(-DHAVE_VSNPRINTF) ENDIF(PDC_HAVE_VSNPRINTF) IF(PDC_HAVE_VSSCANF) ADD_DEFINITIONS(-DHAVE_VSSCANF) ENDIF(PDC_HAVE_VSSCANF) if (PDC_BUILD_SHARED) if(MSVC) add_definitions(-DPDC_DLL_BUILD) endif() endif (PDC_BUILD_SHARED) IF (PDC_WIDE) ADD_DEFINITIONS(-DPDC_WIDE) ENDIF(PDC_WIDE) IF (PDC_UTF8) ADD_DEFINITIONS(-DPDC_FORCE_UTF8) ENDIF (PDC_UTF8) IF (PDC_CHTYPE_16) ADD_DEFINITIONS(-DCHTYPE_16) ENDIF (PDC_CHTYPE_16) IF (PDC_CHTYPE_32) ADD_DEFINITIONS(-DCHTYPE_32) ENDIF (PDC_CHTYPE_32) IF(PDCDEBUG) ADD_DEFINITIONS(-DPDCDEBUG) ENDIF(PDCDEBUG) IF ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") ADD_DEFINITIONS(-D_DEBUG) ENDIF () ################################# # Target Arch # ################################# include (target_arch) get_target_arch(TARGET_ARCH) message(STATUS "Target ................. ${TARGET_ARCH}") curses-1.4.4/vendor/PDCurses/cmake/build_options.cmake0000644000004100000410000000220014201713275022771 0ustar www-datawww-data option(PDC_BUILD_SHARED "Build dynamic libs for pdcurses" ON) option(PDC_UTF8 "Force to UTF8" OFF) option(PDC_WIDE "Wide - pulls in sdl-ttf" OFF) option(PDCDEBUG "Debug tracing" OFF) option(PDC_CHTYPE_32 "CHTYPE_32" OFF) option(PDC_CHTYPE_16 "CHTYPE_16" OFF) option(PDC_OS2_BUILD "Build OS/2 Project" OFF) option(PDC_DOS_BUILD "Build DOS Project" OFF) option(PDC_SDL2_BUILD "Build SDL2 Project" ON) option(PDC_SDL2_DEPS_BUILD "Build SDL2 and dependencies" ON) message(STATUS "PDC_BUILD_SHARED ....... ${PDC_BUILD_SHARED}") message(STATUS "PDC_UTF8 ............... ${PDC_UTF8}") message(STATUS "PDC_WIDE ............... ${PDC_WIDE}") message(STATUS "PDCDEBUG ............... ${PDCDEBUG}") message(STATUS "PDC_CHTYPE_32 .......... ${PDC_CHTYPE_32}") message(STATUS "PDC_CHTYPE_16 .......... ${PDC_CHTYPE_16}") message(STATUS "PDC_OS/2_BUILD ......... ${PDC_OS2_BUILD}") message(STATUS "PDC_DOS_BUILD .......... ${PDC_DOS_BUILD}") message(STATUS "PDC_SDL2_BUILD ......... ${PDC_SDL2_BUILD}") message(STATUS "PDC_SDL2_DEPS_BUILD .... ${PDC_SDL2_DEPS_BUILD}") # normalize a windows path file(TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_INSTALL_PREFIX) curses-1.4.4/vendor/PDCurses/cmake/get_version.cmake0000644000004100000410000000146014201713275022452 0ustar www-datawww-data file(READ ${CMAKE_SOURCE_DIR}/curses.h _CURSES_H_CONTENTS) string(REGEX MATCH "#define PDC_VER_MAJOR ([a-zA-Z0-9_]+)" PDC_VER_MAJOR "${_CURSES_H_CONTENTS}") string(REPLACE "#define PDC_VER_MAJOR " "" PDC_VER_MAJOR "${PDC_VER_MAJOR}") string(REGEX MATCH "#define PDC_VER_MINOR ([a-zA-Z0-9_]+)" PDC_VER_MINOR "${_CURSES_H_CONTENTS}") string(REPLACE "#define PDC_VER_MINOR " "" PDC_VER_MINOR "${PDC_VER_MINOR}") string(REGEX MATCH "#define PDC_VER_CHANGE ([a-zA-Z0-9_]+)" PDC_VER_CHANGE "${_CURSES_H_CONTENTS}") string(REPLACE "#define PDC_VER_CHANGE " "" PDC_VER_CHANGE "${PDC_VER_CHANGE}") if(BUILD_NUMBER) set(CURSES_VERSION ${PDC_VER_MAJOR}.${PDC_VER_MINOR}.${PDC_VER_CHANGE}.${BUILD_NUMBER}) else() set(CURSES_VERSION ${PDC_VER_MAJOR}.${PDC_VER_MINOR}.${PDC_VER_CHANGE}.0) endif() curses-1.4.4/vendor/PDCurses/cmake/watcom_open_dos16_toolchain.cmake0000644000004100000410000000557714201713275025532 0ustar www-datawww-data# This module is shared by multiple languages; use include blocker. if(__WINDOWS_OPENWATCOM) return() endif() set(__WINDOWS_OPENWATCOM 1) set(CMAKE_LIBRARY_PATH_FLAG "libpath ") set(CMAKE_LINK_LIBRARY_FLAG "library ") set(CMAKE_LINK_LIBRARY_FILE_FLAG "library") if(CMAKE_VERBOSE_MAKEFILE) set(CMAKE_WCL_QUIET) set(CMAKE_WLINK_QUIET) set(CMAKE_LIB_QUIET) else() set(CMAKE_WCL_QUIET "-zq") set(CMAKE_WLINK_QUIET "op q") set(CMAKE_LIB_QUIET "-q") endif() string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ") set(CMAKE_C_COMPILE_OPTIONS_DLL "") set(CMAKE_SHARED_LIBRARY_C_FLAGS "") message(STATUS "Configured for 16-bit DOS") set(WATCOM_DOS16 TRUE) set(WATCOM_DOS32 FALSE) set(CMAKE_C_COMPILER "wcc") set(SYSTEM_NAME dos) set(CMAKE_ASM_COMPILER "wasm") set(CMAKE_BUILD_TYPE_INIT Debug) string(APPEND CMAKE_C_FLAGS_INIT " -bt=${SYSTEM_NAME}") foreach(type CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE) set(CMAKE_C_${type}_USE_WATCOM_QUOTE 1) endforeach() set(CMAKE_C_CREATE_IMPORT_LIBRARY "wlib -q -n -b +") set(CMAKE_C_LINK_EXECUTABLE "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} system ${SYSTEM_NAME} name file {} ${CMAKE_END_TEMP_FILE}") # compile a C file into an object file set(CMAKE_C_COMPILE_OBJECT " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo=\"\" \"\"${CMAKE_END_TEMP_FILE}") # preprocess a C source file set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo=\"\" -pl \"\"${CMAKE_END_TEMP_FILE}") string(REPLACE " option implib=" "" CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") # create a C shared library set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) # create a C shared module set(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE}) # create a C static library set(CMAKE_C_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -c -n -b ") if(NOT _CMAKE_WATCOM_VERSION) set(_CMAKE_WATCOM_VERSION 1) if(CMAKE_C_COMPILER_VERSION) set(_compiler_version ${CMAKE_C_COMPILER_VERSION}) set(_compiler_id ${CMAKE_C_COMPILER_ID}) endif() set(WATCOM16) set(WATCOM17) set(WATCOM18) set(WATCOM19) set(WATCOM20) if("${_compiler_id}" STREQUAL "OpenWatcom") if("${_compiler_version}" VERSION_LESS 1.7) set(WATCOM16 1) endif() if("${_compiler_version}" VERSION_EQUAL 1.7) set(WATCOM17 1) endif() if("${_compiler_version}" VERSION_EQUAL 1.8) set(WATCOM18 1) endif() if("${_compiler_version}" VERSION_EQUAL 1.9) set(WATCOM19 1) endif() if("${_compiler_version}" VERSION_EQUAL 2.0) set(WATCOM20 1) endif() endif() endif() curses-1.4.4/vendor/PDCurses/cmake/project_common.cmake0000644000004100000410000000756114201713275023154 0ustar www-datawww-datamessage(STATUS "**** ${PROJECT_NAME} ****") set(PDCURSES_SRCDIR ${CMAKE_SOURCE_DIR}) set(PDCURSES_DIST ${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}) set(osdir ${PDCURSES_SRCDIR}/${PROJECT_NAME}) set(demodir ${PDCURSES_SRCDIR}/demos) set(pdc_src_files ${osdir}/pdcclip.c ${osdir}/pdcdisp.c ${osdir}/pdcgetsc.c ${osdir}/pdckbd.c ${osdir}/pdcscrn.c ${osdir}/pdcsetsc.c ${osdir}/pdcutil.c ) include_directories (..) include_directories (${osdir}) if(WIN32 AND NOT WATCOM) include(dll_version) list(APPEND pdc_src_files ${CMAKE_CURRENT_BINARY_DIR}/version.rc) add_definitions(-D_WIN32 -D_CRT_SECURE_NO_WARNINGS) if(${TARGET_ARCH} STREQUAL "ARM" OR ${TARGET_ARCH} STREQUAL "ARM64") add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1) endif() set(EXTRA_LIBS gdi32.lib winspool.lib shell32.lib ole32.lib comdlg32.lib advapi32.lib) set(SDL2_DEP_LIBRARIES version.lib winmm.lib imm32.lib) elseif(APPLE) set(EXTRA_LIBS "") set(SDL2_DEP_LIBRARIES "dl") else() set(EXTRA_LIBS "") set(SDL2_DEP_LIBRARIES "dl") endif() if (APPLE) find_library(COREVIDEO CoreVideo) list(APPEND EXTRA_LIBS ${COREVIDEO}) find_library(COCOA_LIBRARY Cocoa) list(APPEND EXTRA_LIBS ${COCOA_LIBRARY}) find_library(IOKIT IOKit) list(APPEND EXTRA_LIBS ${IOKIT}) find_library(FORCEFEEDBACK ForceFeedback) list(APPEND EXTRA_LIBS ${FORCEFEEDBACK}) find_library(CARBON_LIBRARY Carbon) list(APPEND EXTRA_LIBS ${CARBON_LIBRARY}) find_library(COREAUDIO CoreAudio) list(APPEND EXTRA_LIBS ${COREAUDIO}) find_library(AUDIOTOOLBOX AudioToolbox) list(APPEND EXTRA_LIBS ${AUDIOTOOLBOX}) include(CheckLibraryExists) check_library_exists(iconv iconv_open "" HAVE_LIBICONV) if(HAVE_LIBICONV) list(APPEND EXTRA_LIBS iconv) endif() endif() if(PDC_BUILD_SHARED) set(PDCURSE_PROJ ${PROJECT_NAME}_pdcurses) add_library(${PDCURSE_PROJ} SHARED ${pdc_src_files} ${pdcurses_src_files}) if(APPLE) set_target_properties(${PDCURSE_PROJ} PROPERTIES MACOSX_RPATH 1) endif() if(${PROJECT_NAME} STREQUAL "sdl2") if(PDC_WIDE) target_link_libraries(${PDCURSE_PROJ} ${EXTRA_LIBS} ${SDL2_LIBRARIES} ${SDL2_TTF_LIBRARY} ${FT2_LIBRARY} ${ZLIB_LIBRARY} ${SDL2_DEP_LIBRARIES}) else() target_link_libraries(${PDCURSE_PROJ} ${EXTRA_LIBS} ${SDL2_LIBRARIES} ${SDL2_DEP_LIBRARIES}) endif() else() target_link_libraries(${PDCURSE_PROJ} ${EXTRA_LIBS}) endif() install(TARGETS ${PDCURSE_PROJ} ARCHIVE DESTINATION ${PDCURSES_DIST}/lib/${PROJECT_NAME} LIBRARY DESTINATION ${PDCURSES_DIST}/lib/${PROJECT_NAME} RUNTIME DESTINATION ${PDCURSES_DIST}/bin/${PROJECT_NAME} COMPONENT applications) set_target_properties(${PDCURSE_PROJ} PROPERTIES OUTPUT_NAME "pdcurses") else() set(PDCURSE_PROJ ${PROJECT_NAME}_pdcursesstatic) add_library (${PDCURSE_PROJ} STATIC ${pdc_src_files} ${pdcurses_src_files}) install (TARGETS ${PDCURSE_PROJ} ARCHIVE DESTINATION ${PDCURSES_DIST}/lib/${PROJECT_NAME} COMPONENT applications) set_target_properties(${PDCURSE_PROJ} PROPERTIES OUTPUT_NAME "pdcursesstatic") endif() macro (demo_app dir targ) set(bin_name "${PROJECT_NAME}_${targ}") if(${targ} STREQUAL "tuidemo") set(src_files ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/tuidemo.c ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/tui.c) else() set(src_files ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/${targ}.c) endif() add_executable(${bin_name} ${src_files}) target_link_libraries(${bin_name} ${PDCURSE_PROJ} ${EXTRA_LIBS}) add_dependencies(${bin_name} ${PDCURSE_PROJ}) set_target_properties(${bin_name} PROPERTIES OUTPUT_NAME ${targ}) install(TARGETS ${bin_name} RUNTIME DESTINATION ${PDCURSES_DIST}/bin/${PROJECT_NAME} COMPONENT applications) endmacro () curses-1.4.4/vendor/PDCurses/cmake/watcom_open_dos32_toolchain.cmake0000644000004100000410000000643014201713275025515 0ustar www-datawww-data# This module is shared by multiple languages; use include blocker. if(__WINDOWS_OPENWATCOM) return() endif() set(__WINDOWS_OPENWATCOM 1) set(CMAKE_LIBRARY_PATH_FLAG "libpath ") set(CMAKE_LINK_LIBRARY_FLAG "library ") set(CMAKE_LINK_LIBRARY_FILE_FLAG "library") if(CMAKE_VERBOSE_MAKEFILE) set(CMAKE_WCL_QUIET) set(CMAKE_WLINK_QUIET) set(CMAKE_LIB_QUIET) else() set(CMAKE_WCL_QUIET "-zq") set(CMAKE_WLINK_QUIET "op q") set(CMAKE_LIB_QUIET "-q") endif() string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ") set(CMAKE_C_COMPILE_OPTIONS_DLL "") set(CMAKE_SHARED_LIBRARY_C_FLAGS "") message(STATUS "Configured for 32-bit DOS") set(WATCOM_DOS16 FALSE) set(WATCOM_DOS32 TRUE) set(CMAKE_C_COMPILER "wcc386") set(SYSTEM_NAME dos4g) # detect folder, add lib386 directory execute_process( COMMAND where ${CMAKE_C_COMPILER} OUTPUT_VARIABLE COMPILER_PATH OUTPUT_STRIP_TRAILING_WHITESPACE ) get_filename_component(COMPILER_DIR ${COMPILER_PATH} PATH) get_filename_component(WATCOM_TOOLCHAIN_DIR "${COMPILER_DIR}/.." ABSOLUTE) string(APPEND LINK_LIBRARIES_PATH "${WATCOM_TOOLCHAIN_DIR}/lib386;${WATCOM_TOOLCHAIN_DIR}/lib386/dos") set(CMAKE_ASM_COMPILER "wasm") set(CMAKE_BUILD_TYPE_INIT Debug) string(APPEND CMAKE_C_FLAGS_INIT " -bt=${SYSTEM_NAME}") foreach(type CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE) set(CMAKE_C_${type}_USE_WATCOM_QUOTE 1) endforeach() set(CMAKE_C_CREATE_IMPORT_LIBRARY "wlib -q -n -b +") set(CMAKE_C_LINK_EXECUTABLE "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} system ${SYSTEM_NAME} name file {} ${CMAKE_END_TEMP_FILE}") # compile a C file into an object file set(CMAKE_C_COMPILE_OBJECT " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo=\"\" \"\"${CMAKE_END_TEMP_FILE}") # preprocess a C source file set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo=\"\" -pl \"\"${CMAKE_END_TEMP_FILE}") string(REPLACE " option implib=" "" CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") # create a C shared library set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) # create a C shared module set(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE}) # create a C static library set(CMAKE_C_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -c -n -b ") if(NOT _CMAKE_WATCOM_VERSION) set(_CMAKE_WATCOM_VERSION 1) if(CMAKE_C_COMPILER_VERSION) set(_compiler_version ${CMAKE_C_COMPILER_VERSION}) set(_compiler_id ${CMAKE_C_COMPILER_ID}) endif() set(WATCOM16) set(WATCOM17) set(WATCOM18) set(WATCOM19) set(WATCOM20) if("${_compiler_id}" STREQUAL "OpenWatcom") if("${_compiler_version}" VERSION_LESS 1.7) set(WATCOM16 1) endif() if("${_compiler_version}" VERSION_EQUAL 1.7) set(WATCOM17 1) endif() if("${_compiler_version}" VERSION_EQUAL 1.8) set(WATCOM18 1) endif() if("${_compiler_version}" VERSION_EQUAL 1.9) set(WATCOM19 1) endif() if("${_compiler_version}" VERSION_EQUAL 2.0) set(WATCOM20 1) endif() endif() endif() curses-1.4.4/vendor/PDCurses/wincon/0000755000004100000410000000000014201713275017340 5ustar www-datawww-datacurses-1.4.4/vendor/PDCurses/wincon/pdcurses.ico0000644000004100000410000000206614201713275021670 0ustar www-datawww-data è&(( @€€€€€€€€€€ÀÀÀ€€€ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÎoœçµ¯k[½¯ëû½¯˜ç½¯{_µ¥k[Í«œçÿÿÿÿÿÿÿÿÿÏÿÿÎÿÿÌsÿÿÌóÿÿÌóÿÿÌsÿÿÆ3ÿÿÃÿÿÁƒÿÿÈÃÿÿÌcÿÿÎ3ÿÿÏ3ÿÿÏ3ÿÿÎ3ÿÿÀsÿÿÀóÿÿÿÿÿÿÿÿÿÿÿÿÿ( À€€€€€€€€€ÀÀÀ€€€ÿÿÿÿÿÿÿÿÿÿÿÿ‚kžjjÓˆÿÿûúßúßû_ùŸúßû_û_øßÿÿcurses-1.4.4/vendor/PDCurses/wincon/Makefile.lcc0000644000004100000410000001234014201713275021540 0ustar www-datawww-data# Makefile for PDCurses library - WIN32 LCC-Win32 # # Usage: make -f Makefile.lcc [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] PDCURSES_SRCDIR = .. PDCURSES_CURSES_H = $(PDCURSES_SRCDIR)\curses.h PDCURSES_CURSPRIV_H = $(PDCURSES_SRCDIR)\curspriv.h PDCURSES_HEADERS = $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H) PANEL_HEADER = $(PDCURSES_SRCDIR)\panel.h TERM_HEADER = $(PDCURSES_SRCDIR)\term.h srcdir = $(PDCURSES_SRCDIR)\pdcurses osdir = $(PDCURSES_SRCDIR)\win32 demodir = $(PDCURSES_SRCDIR)\demos PDCURSES_WIN_H = $(osdir)\pdcwin.h CC = lcc #CFLAGS = -c -g3 -A -ansic CFLAGS = -c -O -A -ansic CPPFLAGS = -I$(PDCURSES_SRCDIR) #-DPDC_WIDE -DPDC_FORCE_UTF8 LINK = lcclnk LIBEXE = lcclib LIBCURSES = pdcurses.lib BUILD = $(CC) $(CFLAGS) $(CPPFLAGS) PDCLIBS = $(LIBCURSES) DEMOS = testcurs.exe ozdemo.exe xmas.exe tuidemo.exe \ firework.exe ptest.exe rain.exe worm.exe all: $(PDCLIBS) $(DEMOS) clean: -del *.obj -del *.lib -del *.exe LIBOBJS = addch.obj addchstr.obj addstr.obj attr.obj beep.obj bkgd.obj \ border.obj clear.obj color.obj delch.obj deleteln.obj deprec.obj getch.obj \ getstr.obj getyx.obj inch.obj inchstr.obj initscr.obj inopts.obj \ insch.obj insstr.obj instr.obj kernel.obj keyname.obj mouse.obj move.obj \ outopts.obj overlay.obj pad.obj panel.obj printw.obj refresh.obj \ scanw.obj scr_dump.obj scroll.obj slk.obj termattr.obj terminfo.obj \ touch.obj util.obj window.obj debug.obj PDCOBJS = pdcclip.obj pdcdisp.obj pdcgetsc.obj pdckbd.obj pdcscrn.obj \ pdcsetsc.obj pdcutil.obj DEMOOBJS = testcurs.obj ozdemo.obj xmas.obj tuidemo.obj tui.obj \ firework.obj ptest.obj rain.obj worm.obj $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_WIN_H) panel.obj ptest.obj: $(PANEL_HEADER) terminfo.obj: $(TERM_HEADER) $(DEMOOBJS) : $(PDCURSES_CURSES_H) $(DEMOS) : $(LIBCURSES) $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) /out:$@ $(LIBOBJS) $(PDCOBJS) -copy $(LIBCURSES) panel.lib SRCBUILD = $(BUILD) $(srcdir)\$*.c OSBUILD = $(BUILD) $(osdir)\$*.c addch.obj: $(srcdir)\addch.c $(SRCBUILD) addchstr.obj: $(srcdir)\addchstr.c $(SRCBUILD) addstr.obj: $(srcdir)\addstr.c $(SRCBUILD) attr.obj: $(srcdir)\attr.c $(SRCBUILD) beep.obj: $(srcdir)\beep.c $(SRCBUILD) bkgd.obj: $(srcdir)\bkgd.c $(SRCBUILD) border.obj: $(srcdir)\border.c $(SRCBUILD) clear.obj: $(srcdir)\clear.c $(SRCBUILD) color.obj: $(srcdir)\color.c $(SRCBUILD) delch.obj: $(srcdir)\delch.c $(SRCBUILD) deleteln.obj: $(srcdir)\deleteln.c $(SRCBUILD) deprec.obj: $(srcdir)\deprec.c $(SRCBUILD) getch.obj: $(srcdir)\getch.c $(SRCBUILD) getstr.obj: $(srcdir)\getstr.c $(SRCBUILD) getyx.obj: $(srcdir)\getyx.c $(SRCBUILD) inch.obj: $(srcdir)\inch.c $(SRCBUILD) inchstr.obj: $(srcdir)\inchstr.c $(SRCBUILD) initscr.obj: $(srcdir)\initscr.c $(SRCBUILD) inopts.obj: $(srcdir)\inopts.c $(SRCBUILD) insch.obj: $(srcdir)\insch.c $(SRCBUILD) insstr.obj: $(srcdir)\insstr.c $(SRCBUILD) instr.obj: $(srcdir)\instr.c $(SRCBUILD) kernel.obj: $(srcdir)\kernel.c $(SRCBUILD) keyname.obj: $(srcdir)\keyname.c $(SRCBUILD) mouse.obj: $(srcdir)\mouse.c $(SRCBUILD) move.obj: $(srcdir)\move.c $(SRCBUILD) outopts.obj: $(srcdir)\outopts.c $(SRCBUILD) overlay.obj: $(srcdir)\overlay.c $(SRCBUILD) pad.obj: $(srcdir)\pad.c $(SRCBUILD) panel.obj: $(srcdir)\panel.c $(SRCBUILD) printw.obj: $(srcdir)\printw.c $(SRCBUILD) refresh.obj: $(srcdir)\refresh.c $(SRCBUILD) scanw.obj: $(srcdir)\scanw.c $(SRCBUILD) scr_dump.obj: $(srcdir)\scr_dump.c $(SRCBUILD) scroll.obj: $(srcdir)\scroll.c $(SRCBUILD) slk.obj: $(srcdir)\slk.c $(SRCBUILD) termattr.obj: $(srcdir)\termattr.c $(SRCBUILD) terminfo.obj: $(srcdir)\terminfo.c $(SRCBUILD) touch.obj: $(srcdir)\touch.c $(SRCBUILD) util.obj: $(srcdir)\util.c $(SRCBUILD) window.obj: $(srcdir)\window.c $(SRCBUILD) debug.obj: $(srcdir)\debug.c $(SRCBUILD) pdcclip.obj: $(osdir)\pdcclip.c $(OSBUILD) pdcdisp.obj: $(osdir)\pdcdisp.c $(OSBUILD) pdcgetsc.obj: $(osdir)\pdcgetsc.c $(OSBUILD) pdckbd.obj: $(osdir)\pdckbd.c $(OSBUILD) pdcscrn.obj: $(osdir)\pdcscrn.c $(OSBUILD) pdcsetsc.obj: $(osdir)\pdcsetsc.c $(OSBUILD) pdcutil.obj: $(osdir)\pdcutil.c $(OSBUILD) firework.exe: firework.obj $(LINK) -o $@ firework.obj $(LIBCURSES) ozdemo.exe: ozdemo.obj $(LINK) -o $@ ozdemo.obj $(LIBCURSES) ptest.exe: ptest.obj $(LINK) -o $@ ptest.obj $(LIBCURSES) rain.exe: rain.obj $(LINK) -o $@ rain.obj $(LIBCURSES) testcurs.exe: testcurs.obj $(LINK) -o $@ testcurs.obj $(LIBCURSES) tuidemo.exe: tuidemo.obj tui.obj $(LINK) -o $@ tuidemo.obj tui.obj $(LIBCURSES) worm.exe: worm.obj $(LINK) -o $@ worm.obj $(LIBCURSES) xmas.exe: xmas.obj $(LINK) -o $@ xmas.obj $(LIBCURSES) firework.obj: $(demodir)\firework.c $(BUILD) $(demodir)\$*.c ozdemo.obj: $(demodir)\ozdemo.c $(BUILD) $(demodir)\$*.c ptest.obj: $(demodir)\ptest.c $(BUILD) $(demodir)\$*.c rain.obj: $(demodir)\rain.c $(BUILD) $(demodir)\$*.c testcurs.obj: $(demodir)\testcurs.c $(BUILD) $(demodir)\$*.c tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(BUILD) -I$(demodir) $(demodir)\$*.c tuidemo.obj: $(demodir)\tuidemo.c $(BUILD) -I$(demodir) $(demodir)\$*.c worm.obj: $(demodir)\worm.c $(BUILD) $(demodir)\$*.c xmas.obj: $(demodir)\xmas.c $(BUILD) $(demodir)\$*.c curses-1.4.4/vendor/PDCurses/wincon/Makefile.wcc0000644000004100000410000000201014201713275021544 0ustar www-datawww-data# Watcom WMAKE Makefile for PDCurses library - Windows console Watcom C/C++ 10.6+ # # Usage: wmake -f [wincon\]Makefile.wcc [DEBUG=Y] [WIDE=Y] [UTF8=Y] [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] !ifdef %PDCURSES_SRCDIR PDCURSES_SRCDIR = $(%PDCURSES_SRCDIR) !else PDCURSES_SRCDIR = .. !endif !include $(PDCURSES_SRCDIR)\version.mif osdir = $(PDCURSES_SRCDIR)\wincon CC = wcc386 TARGET = nt CFLAGS = /ei /zq /wx /i=$(PDCURSES_SRCDIR) !ifeq DEBUG Y CFLAGS += /d2 /DPDCDEBUG LDFLAGS = D W A op q sys $(TARGET) !else CFLAGS += /oneatx LDFLAGS = op q sys $(TARGET) !endif !ifeq WIDE Y CFLAGS += /DPDC_WIDE !endif !ifeq UTF8 Y CFLAGS += /DPDC_FORCE_UTF8 !endif LIBEXE = wlib /q /n /t !include $(PDCURSES_SRCDIR)\watcom.mif $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) $@ $(LIBOBJS) $(PDCOBJS) -copy $(LIBCURSES) panel.lib PLATFORM1 = Watcom C++ WinCon PLATFORM2 = Open Watcom 1.6 for Windows console ARCNAME = pdc$(VER)_wcc_w32 !include $(PDCURSES_SRCDIR)\makedist.mif curses-1.4.4/vendor/PDCurses/wincon/README.md0000644000004100000410000000557014201713275020626 0ustar www-datawww-dataPDCurses for Win32 ================== This directory contains PDCurses source code files specific to Win32 console mode (Win95 and all subsequent forks of Windows). Building -------- (Note that the following is almost identical to the instructions for the Win32a GUI flavor of PDCurses.) - Choose the appropriate makefile for your compiler: Makefile.bcc - Borland C++ 4.0.2+ Makefile.dmc - Digital Mars Makefile.lcc - LCC-Win32 Makefile.mng - MinGW, Cygnus GNU Compiler Makefile.vc - Microsoft Visual C++ 2.0+ or later & Intel(R) compiler Makefile.wcc - Open Watcom 1.8+ - Optionally, you can build in a different directory than the platform directory by setting PDCURSES_SRCDIR to point to the directory where you unpacked PDCurses, and changing to your target directory: set PDCURSES_SRCDIR=c:\pdcurses This won't work with the LCC or Digital Mars makefiles, nor will the options described below. - Build it: make -f makefilename (For Watcom, use "wmake" instead of "make"; for MSVC, "nmake".) You'll get the libraries (pdcurses.lib or .a, depending on your compiler; and panel.lib or .a), the demos (*.exe), and a lot of object files. Note that the panel library is just a copy of the main library, provided for convenience; both panel and curses functions are in the main library. You can also give the optional parameter "WIDE=Y", to build the library with wide-character (Unicode) support: make -f Makefile.mng WIDE=Y When built this way, the library is not compatible with Windows 9x, unless you also link with the Microsoft Layer for Unicode (not tested). For the Intel(R) compiler, use Makefile.vc and add ICC=Y. By default, Makefile.vc results in 64-bit code for both VC and Intel(R). Add IX86=Y to generate 32-bit code. (Other builds are 32-bit only.) Another option, "UTF8=Y", makes PDCurses ignore the system locale, and treat all narrow-character strings as UTF-8. This option has no effect unless WIDE=Y is also set. Use it to get around the poor support for UTF-8 in the Win32 console: make -f Makefile.mng WIDE=Y UTF8=Y You can also use the optional parameter "DLL=Y" with Visual C++, MinGW or Cygwin, to build the library as a DLL: nmake -f Makefile.vc WIDE=Y DLL=Y When you build the library as a Windows DLL, you must always define PDC_DLL_BUILD when linking against it. (Or, if you only want to use the DLL, you could add this definition to your curses.h.) If cross-compiling from Linux, add the parameter `_w64=1` to get 64-bit code (default will be 32-bit). make -f Makefile.mng _w64=1 [WIDE=Y UTF8=Y DLL=Y] Distribution Status ------------------- The files in this directory are released to the Public Domain. Acknowledgements ---------------- Generic Win32 port was provided by Chris Szurgot curses-1.4.4/vendor/PDCurses/wincon/pdckbd.c0000644000004100000410000007465114201713275020750 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcwin.h" /*man-start************************************************************** pdckbd ------ ### Synopsis unsigned long PDC_get_input_fd(void); ### Description PDC_get_input_fd() returns the file descriptor that PDCurses reads its input from. It can be used for select(). ### Portability X/Open BSD SYS V PDC_get_input_fd - - - **man-end****************************************************************/ unsigned long pdc_key_modifiers = 0L; /* These variables are used to store information about the next Input Event. */ static INPUT_RECORD save_ip; static MOUSE_STATUS old_mouse_status; static DWORD event_count = 0; static SHORT left_key; static int key_count = 0; static int save_press = 0; #define KEV save_ip.Event.KeyEvent #define MEV save_ip.Event.MouseEvent #define REV save_ip.Event.WindowBufferSizeEvent /************************************************************************ * Table for key code translation of function keys in keypad mode * * These values are for strict IBM keyboard compatibles only * ************************************************************************/ typedef struct { unsigned short normal; unsigned short shift; unsigned short control; unsigned short alt; unsigned short extended; } KPTAB; static KPTAB kptab[] = { {0, 0, 0, 0, 0 }, /* 0 */ {0, 0, 0, 0, 0 }, /* 1 VK_LBUTTON */ {0, 0, 0, 0, 0 }, /* 2 VK_RBUTTON */ {CTL_PAUSE, 0, 0, 0, 0 }, /* 3 VK_CANCEL */ {0, 0, 0, 0, 0 }, /* 4 VK_MBUTTON */ {0, 0, 0, 0, 0 }, /* 5 */ {0, 0, 0, 0, 0 }, /* 6 */ {0, 0, 0, 0, 0 }, /* 7 */ {0x08, 0x08, 0x7F, ALT_BKSP, 0 }, /* 8 VK_BACK */ {0x09, KEY_BTAB, CTL_TAB, ALT_TAB, 999 }, /* 9 VK_TAB */ {0, 0, 0, 0, 0 }, /* 10 */ {0, 0, 0, 0, 0 }, /* 11 */ {KEY_B2, 0x35, CTL_PAD5, ALT_PAD5, 0 }, /* 12 VK_CLEAR */ {0x0D, 0x0D, CTL_ENTER, ALT_ENTER, 1 }, /* 13 VK_RETURN */ {0, 0, 0, 0, 0 }, /* 14 */ {0, 0, 0, 0, 0 }, /* 15 */ {0, 0, 0, 0, 0 }, /* 16 VK_SHIFT HANDLED SEPARATELY */ {0, 0, 0, 0, 0 }, /* 17 VK_CONTROL HANDLED SEPARATELY */ {0, 0, 0, 0, 0 }, /* 18 VK_MENU HANDLED SEPARATELY */ {KEY_PAUSE, KEY_SPAUSE,CTL_PAUSE, 0, 0 }, /* 19 VK_PAUSE */ {0, 0, 0, 0, 0 }, /* 20 VK_CAPITAL HANDLED SEPARATELY */ {0, 0, 0, 0, 0 }, /* 21 VK_HANGUL */ {0, 0, 0, 0, 0 }, /* 22 */ {0, 0, 0, 0, 0 }, /* 23 VK_JUNJA */ {0, 0, 0, 0, 0 }, /* 24 VK_FINAL */ {0, 0, 0, 0, 0 }, /* 25 VK_HANJA */ {0, 0, 0, 0, 0 }, /* 26 */ {0x1B, 0x1B, 0x1B, ALT_ESC, 0 }, /* 27 VK_ESCAPE */ {0, 0, 0, 0, 0 }, /* 28 VK_CONVERT */ {0, 0, 0, 0, 0 }, /* 29 VK_NONCONVERT */ {0, 0, 0, 0, 0 }, /* 30 VK_ACCEPT */ {0, 0, 0, 0, 0 }, /* 31 VK_MODECHANGE */ {0x20, 0x20, 0x20, 0x20, 0 }, /* 32 VK_SPACE */ {KEY_A3, 0x39, CTL_PAD9, ALT_PAD9, 3 }, /* 33 VK_PRIOR */ {KEY_C3, 0x33, CTL_PAD3, ALT_PAD3, 4 }, /* 34 VK_NEXT */ {KEY_C1, 0x31, CTL_PAD1, ALT_PAD1, 5 }, /* 35 VK_END */ {KEY_A1, 0x37, CTL_PAD7, ALT_PAD7, 6 }, /* 36 VK_HOME */ {KEY_B1, 0x34, CTL_PAD4, ALT_PAD4, 7 }, /* 37 VK_LEFT */ {KEY_A2, 0x38, CTL_PAD8, ALT_PAD8, 8 }, /* 38 VK_UP */ {KEY_B3, 0x36, CTL_PAD6, ALT_PAD6, 9 }, /* 39 VK_RIGHT */ {KEY_C2, 0x32, CTL_PAD2, ALT_PAD2, 10 }, /* 40 VK_DOWN */ {0, 0, 0, 0, 0 }, /* 41 VK_SELECT */ {0, 0, 0, 0, 0 }, /* 42 VK_PRINT */ {0, 0, 0, 0, 0 }, /* 43 VK_EXECUTE */ {KEY_PRINTSCREEN, 0, 0, ALT_PRINTSCREEN, 0 }, /* 44 VK_SNAPSHOT*/ {PAD0, 0x30, CTL_PAD0, ALT_PAD0, 11 }, /* 45 VK_INSERT */ {PADSTOP, 0x2E, CTL_PADSTOP, ALT_PADSTOP,12 }, /* 46 VK_DELETE */ {0, 0, 0, 0, 0 }, /* 47 VK_HELP */ {0x30, 0x29, CTL_0, ALT_0, 0 }, /* 48 */ {0x31, 0x21, CTL_1, ALT_1, 0 }, /* 49 */ {0x32, 0x40, CTL_2, ALT_2, 0 }, /* 50 */ {0x33, 0x23, CTL_3, ALT_3, 0 }, /* 51 */ {0x34, 0x24, CTL_4, ALT_4, 0 }, /* 52 */ {0x35, 0x25, CTL_5, ALT_5, 0 }, /* 53 */ {0x36, 0x5E, CTL_6, ALT_6, 0 }, /* 54 */ {0x37, 0x26, CTL_7, ALT_7, 0 }, /* 55 */ {0x38, 0x2A, CTL_8, ALT_8, 0 }, /* 56 */ {0x39, 0x28, CTL_9, ALT_9, 0 }, /* 57 */ {0, 0, 0, 0, 0 }, /* 58 */ {0, 0, 0, 0, 0 }, /* 59 */ {0, 0, 0, 0, 0 }, /* 60 */ {0, 0, 0, 0, 0 }, /* 61 */ {0, 0, 0, 0, 0 }, /* 62 */ {0, 0, 0, 0, 0 }, /* 63 */ {0, 0, 0, 0, 0 }, /* 64 */ {0x61, 0x41, 0x01, ALT_A, 0 }, /* 65 */ {0x62, 0x42, 0x02, ALT_B, 0 }, /* 66 */ {0x63, 0x43, 0x03, ALT_C, 0 }, /* 67 */ {0x64, 0x44, 0x04, ALT_D, 0 }, /* 68 */ {0x65, 0x45, 0x05, ALT_E, 0 }, /* 69 */ {0x66, 0x46, 0x06, ALT_F, 0 }, /* 70 */ {0x67, 0x47, 0x07, ALT_G, 0 }, /* 71 */ {0x68, 0x48, 0x08, ALT_H, 0 }, /* 72 */ {0x69, 0x49, 0x09, ALT_I, 0 }, /* 73 */ {0x6A, 0x4A, 0x0A, ALT_J, 0 }, /* 74 */ {0x6B, 0x4B, 0x0B, ALT_K, 0 }, /* 75 */ {0x6C, 0x4C, 0x0C, ALT_L, 0 }, /* 76 */ {0x6D, 0x4D, 0x0D, ALT_M, 0 }, /* 77 */ {0x6E, 0x4E, 0x0E, ALT_N, 0 }, /* 78 */ {0x6F, 0x4F, 0x0F, ALT_O, 0 }, /* 79 */ {0x70, 0x50, 0x10, ALT_P, 0 }, /* 80 */ {0x71, 0x51, 0x11, ALT_Q, 0 }, /* 81 */ {0x72, 0x52, 0x12, ALT_R, 0 }, /* 82 */ {0x73, 0x53, 0x13, ALT_S, 0 }, /* 83 */ {0x74, 0x54, 0x14, ALT_T, 0 }, /* 84 */ {0x75, 0x55, 0x15, ALT_U, 0 }, /* 85 */ {0x76, 0x56, 0x16, ALT_V, 0 }, /* 86 */ {0x77, 0x57, 0x17, ALT_W, 0 }, /* 87 */ {0x78, 0x58, 0x18, ALT_X, 0 }, /* 88 */ {0x79, 0x59, 0x19, ALT_Y, 0 }, /* 89 */ {0x7A, 0x5A, 0x1A, ALT_Z, 0 }, /* 90 */ {0, 0, 0, 0, 0 }, /* 91 VK_LWIN */ {0, 0, 0, 0, 0 }, /* 92 VK_RWIN */ {KEY_APPS, KEY_SAPPS, CTL_APPS, ALT_APPS, 13 }, /* 93 VK_APPS */ {0, 0, 0, 0, 0 }, /* 94 */ {0, 0, 0, 0, 0 }, /* 95 */ {0x30, 0, CTL_PAD0, ALT_PAD0, 0 }, /* 96 VK_NUMPAD0 */ {0x31, 0, CTL_PAD1, ALT_PAD1, 0 }, /* 97 VK_NUMPAD1 */ {0x32, 0, CTL_PAD2, ALT_PAD2, 0 }, /* 98 VK_NUMPAD2 */ {0x33, 0, CTL_PAD3, ALT_PAD3, 0 }, /* 99 VK_NUMPAD3 */ {0x34, 0, CTL_PAD4, ALT_PAD4, 0 }, /* 100 VK_NUMPAD4 */ {0x35, 0, CTL_PAD5, ALT_PAD5, 0 }, /* 101 VK_NUMPAD5 */ {0x36, 0, CTL_PAD6, ALT_PAD6, 0 }, /* 102 VK_NUMPAD6 */ {0x37, 0, CTL_PAD7, ALT_PAD7, 0 }, /* 103 VK_NUMPAD7 */ {0x38, 0, CTL_PAD8, ALT_PAD8, 0 }, /* 104 VK_NUMPAD8 */ {0x39, 0, CTL_PAD9, ALT_PAD9, 0 }, /* 105 VK_NUMPAD9 */ {PADSTAR, SHF_PADSTAR,CTL_PADSTAR, ALT_PADSTAR,999 }, /* 106 VK_MULTIPLY*/ {PADPLUS, SHF_PADPLUS,CTL_PADPLUS, ALT_PADPLUS,999 }, /* 107 VK_ADD */ {0, 0, 0, 0, 0 }, /* 108 VK_SEPARATOR */ {PADMINUS, SHF_PADMINUS,CTL_PADMINUS,ALT_PADMINUS,999}, /* 109 VK_SUBTRACT*/ {0x2E, 0, CTL_PADSTOP, ALT_PADSTOP,0 }, /* 110 VK_DECIMAL */ {PADSLASH, SHF_PADSLASH,CTL_PADSLASH,ALT_PADSLASH,2 }, /* 111 VK_DIVIDE */ {KEY_F(1), KEY_F(13), KEY_F(25), KEY_F(37), 0 }, /* 112 VK_F1 */ {KEY_F(2), KEY_F(14), KEY_F(26), KEY_F(38), 0 }, /* 113 VK_F2 */ {KEY_F(3), KEY_F(15), KEY_F(27), KEY_F(39), 0 }, /* 114 VK_F3 */ {KEY_F(4), KEY_F(16), KEY_F(28), KEY_F(40), 0 }, /* 115 VK_F4 */ {KEY_F(5), KEY_F(17), KEY_F(29), KEY_F(41), 0 }, /* 116 VK_F5 */ {KEY_F(6), KEY_F(18), KEY_F(30), KEY_F(42), 0 }, /* 117 VK_F6 */ {KEY_F(7), KEY_F(19), KEY_F(31), KEY_F(43), 0 }, /* 118 VK_F7 */ {KEY_F(8), KEY_F(20), KEY_F(32), KEY_F(44), 0 }, /* 119 VK_F8 */ {KEY_F(9), KEY_F(21), KEY_F(33), KEY_F(45), 0 }, /* 120 VK_F9 */ {KEY_F(10), KEY_F(22), KEY_F(34), KEY_F(46), 0 }, /* 121 VK_F10 */ {KEY_F(11), KEY_F(23), KEY_F(35), KEY_F(47), 0 }, /* 122 VK_F11 */ {KEY_F(12), KEY_F(24), KEY_F(36), KEY_F(48), 0 }, /* 123 VK_F12 */ /* 124 through 218 */ {0, 0, 0, 0, 0}, /* 124 VK_F13 */ {0, 0, 0, 0, 0}, /* 125 VK_F14 */ {0, 0, 0, 0, 0}, /* 126 VK_F15 */ {0, 0, 0, 0, 0}, /* 127 VK_F16 */ {0, 0, 0, 0, 0}, /* 128 VK_F17 */ {0, 0, 0, 0, 0}, /* 129 VK_F18 */ {0, 0, 0, 0, 0}, /* 130 VK_F19 */ {0, 0, 0, 0, 0}, /* 131 VK_F20 */ {0, 0, 0, 0, 0}, /* 132 VK_F21 */ {0, 0, 0, 0, 0}, /* 133 VK_F22 */ {0, 0, 0, 0, 0}, /* 134 VK_F23 */ {0, 0, 0, 0, 0}, /* 135 VK_F24 */ {0, 0, 0, 0, 0}, /* 136 unassigned */ {0, 0, 0, 0, 0}, /* 137 unassigned */ {0, 0, 0, 0, 0}, /* 138 unassigned */ {0, 0, 0, 0, 0}, /* 139 unassigned */ {0, 0, 0, 0, 0}, /* 140 unassigned */ {0, 0, 0, 0, 0}, /* 141 unassigned */ {0, 0, 0, 0, 0}, /* 142 unassigned */ {0, 0, 0, 0, 0}, /* 143 unassigned */ {0, 0, 0, 0, 0}, /* 144 VK_NUMLOCK */ {KEY_SCROLLLOCK, 0, 0, ALT_SCROLLLOCK, 0}, /* 145 VKSCROLL */ {0, 0, 0, 0, 0}, /* 146 OEM specific */ {0, 0, 0, 0, 0}, /* 147 OEM specific */ {0, 0, 0, 0, 0}, /* 148 OEM specific */ {0, 0, 0, 0, 0}, /* 149 OEM specific */ {0, 0, 0, 0, 0}, /* 150 OEM specific */ {0, 0, 0, 0, 0}, /* 151 Unassigned */ {0, 0, 0, 0, 0}, /* 152 Unassigned */ {0, 0, 0, 0, 0}, /* 153 Unassigned */ {0, 0, 0, 0, 0}, /* 154 Unassigned */ {0, 0, 0, 0, 0}, /* 155 Unassigned */ {0, 0, 0, 0, 0}, /* 156 Unassigned */ {0, 0, 0, 0, 0}, /* 157 Unassigned */ {0, 0, 0, 0, 0}, /* 158 Unassigned */ {0, 0, 0, 0, 0}, /* 159 Unassigned */ {0, 0, 0, 0, 0}, /* 160 VK_LSHIFT */ {0, 0, 0, 0, 0}, /* 161 VK_RSHIFT */ {0, 0, 0, 0, 0}, /* 162 VK_LCONTROL */ {0, 0, 0, 0, 0}, /* 163 VK_RCONTROL */ {0, 0, 0, 0, 0}, /* 164 VK_LMENU */ {0, 0, 0, 0, 0}, /* 165 VK_RMENU */ {0, 0, 0, 0, 14}, /* 166 VK_BROWSER_BACK */ {0, 0, 0, 0, 15}, /* 167 VK_BROWSER_FORWARD */ {0, 0, 0, 0, 16}, /* 168 VK_BROWSER_REFRESH */ {0, 0, 0, 0, 17}, /* 169 VK_BROWSER_STOP */ {0, 0, 0, 0, 18}, /* 170 VK_BROWSER_SEARCH */ {0, 0, 0, 0, 19}, /* 171 VK_BROWSER_FAVORITES */ {0, 0, 0, 0, 20}, /* 172 VK_BROWSER_HOME */ {0, 0, 0, 0, 21}, /* 173 VK_VOLUME_MUTE */ {0, 0, 0, 0, 22}, /* 174 VK_VOLUME_DOWN */ {0, 0, 0, 0, 23}, /* 175 VK_VOLUME_UP */ {0, 0, 0, 0, 24}, /* 176 VK_MEDIA_NEXT_TRACK */ {0, 0, 0, 0, 25}, /* 177 VK_MEDIA_PREV_TRACK */ {0, 0, 0, 0, 26}, /* 178 VK_MEDIA_STOP */ {0, 0, 0, 0, 27}, /* 179 VK_MEDIA_PLAY_PAUSE */ {0, 0, 0, 0, 28}, /* 180 VK_LAUNCH_MAIL */ {0, 0, 0, 0, 29}, /* 181 VK_LAUNCH_MEDIA_SELECT */ {0, 0, 0, 0, 30}, /* 182 VK_LAUNCH_APP1 */ {0, 0, 0, 0, 31}, /* 183 VK_LAUNCH_APP2 */ {0, 0, 0, 0, 0}, /* 184 Reserved */ {0, 0, 0, 0, 0}, /* 185 Reserved */ {';', ':', CTL_SEMICOLON, ALT_SEMICOLON, 0}, /* 186 VK_OEM_1 */ {'=', '+', CTL_EQUAL, ALT_EQUAL, 0}, /* 187 VK_OEM_PLUS */ {',', '<', CTL_COMMA, ALT_COMMA, 0}, /* 188 VK_OEM_COMMA */ {'-', '_', CTL_MINUS, ALT_MINUS, 0}, /* 189 VK_OEM_MINUS */ {'.', '>', CTL_STOP, ALT_STOP, 0}, /* 190 VK_OEM_PERIOD */ {'/', '?', CTL_FSLASH, ALT_FSLASH, 0}, /* 191 VK_OEM_2 */ {'`', '~', CTL_BQUOTE, ALT_BQUOTE, 0}, /* 192 VK_OEM_3 */ {0, 0, 0, 0, 0}, /* 193 */ {0, 0, 0, 0, 0}, /* 194 */ {0, 0, 0, 0, 0}, /* 195 */ {0, 0, 0, 0, 0}, /* 196 */ {0, 0, 0, 0, 0}, /* 197 */ {0, 0, 0, 0, 0}, /* 198 */ {0, 0, 0, 0, 0}, /* 199 */ {0, 0, 0, 0, 0}, /* 200 */ {0, 0, 0, 0, 0}, /* 201 */ {0, 0, 0, 0, 0}, /* 202 */ {0, 0, 0, 0, 0}, /* 203 */ {0, 0, 0, 0, 0}, /* 204 */ {0, 0, 0, 0, 0}, /* 205 */ {0, 0, 0, 0, 0}, /* 206 */ {0, 0, 0, 0, 0}, /* 207 */ {0, 0, 0, 0, 0}, /* 208 */ {0, 0, 0, 0, 0}, /* 209 */ {0, 0, 0, 0, 0}, /* 210 */ {0, 0, 0, 0, 0}, /* 211 */ {0, 0, 0, 0, 0}, /* 212 */ {0, 0, 0, 0, 0}, /* 213 */ {0, 0, 0, 0, 0}, /* 214 */ {0, 0, 0, 0, 0}, /* 215 */ {0, 0, 0, 0, 0}, /* 216 */ {0, 0, 0, 0, 0}, /* 217 */ {0, 0, 0, 0, 0}, /* 218 */ {0x5B, 0x7B, 0x1B, ALT_LBRACKET,0 }, /* 219 VK_OEM_4 */ {0x5C, 0x7C, 0x1C, ALT_BSLASH, 0 }, /* 220 VK_OEM_5 */ {0x5D, 0x7D, 0x1D, ALT_RBRACKET,0 }, /* 221 VK_OEM_6 */ {'\'', '"', 0x27, ALT_FQUOTE, 0 }, /* 222 VK_OEM_7 */ {0, 0, 0, 0, 0 }, /* 223 VK_OEM_8 */ {0, 0, 0, 0, 0 }, /* 224 */ {0, 0, 0, 0, 0 } /* 225 */ }; static const KPTAB ext_kptab[] = { {0, 0, 0, 0, }, /* 0 MUST BE EMPTY */ {PADENTER, SHF_PADENTER, CTL_PADENTER, ALT_PADENTER}, /* 1 13 */ {PADSLASH, SHF_PADSLASH, CTL_PADSLASH, ALT_PADSLASH}, /* 2 111 */ {KEY_PPAGE, KEY_SPREVIOUS, CTL_PGUP, ALT_PGUP }, /* 3 33 */ {KEY_NPAGE, KEY_SNEXT, CTL_PGDN, ALT_PGDN }, /* 4 34 */ {KEY_END, KEY_SEND, CTL_END, ALT_END }, /* 5 35 */ {KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME }, /* 6 36 */ {KEY_LEFT, KEY_SLEFT, CTL_LEFT, ALT_LEFT }, /* 7 37 */ {KEY_UP, KEY_SUP, CTL_UP, ALT_UP }, /* 8 38 */ {KEY_RIGHT, KEY_SRIGHT, CTL_RIGHT, ALT_RIGHT }, /* 9 39 */ {KEY_DOWN, KEY_SDOWN, CTL_DOWN, ALT_DOWN }, /* 10 40 */ {KEY_IC, KEY_SIC, CTL_INS, ALT_INS }, /* 11 45 */ {KEY_DC, KEY_SDC, CTL_DEL, ALT_DEL }, /* 12 46 */ {KEY_APPS, KEY_SAPPS , CTL_APPS, ALT_APPS }, /* 13 93 VK_APPS */ {KEY_BROWSER_BACK, KEY_SBROWSER_BACK, KEY_CBROWSER_BACK, KEY_ABROWSER_BACK, }, /* 14 166 VK_BROWSER_BACK */ {KEY_BROWSER_FWD, KEY_SBROWSER_FWD, KEY_CBROWSER_FWD, KEY_ABROWSER_FWD, }, /* 15 167 VK_BROWSER_FORWARD */ {KEY_BROWSER_REF, KEY_SBROWSER_REF, KEY_CBROWSER_REF, KEY_ABROWSER_REF, }, /* 16 168 VK_BROWSER_REFRESH */ {KEY_BROWSER_STOP, KEY_SBROWSER_STOP, KEY_CBROWSER_STOP, KEY_ABROWSER_STOP, }, /* 17 169 VK_BROWSER_STOP */ {KEY_SEARCH, KEY_SSEARCH, KEY_CSEARCH, KEY_ASEARCH, }, /* 18 170 VK_BROWSER_SEARCH */ {KEY_FAVORITES, KEY_SFAVORITES, KEY_CFAVORITES, KEY_AFAVORITES, }, /* 19 171 VK_BROWSER_FAVORITES */ {KEY_BROWSER_HOME, KEY_SBROWSER_HOME, KEY_CBROWSER_HOME, KEY_ABROWSER_HOME, }, /* 20 172 VK_BROWSER_HOME */ {KEY_VOLUME_MUTE, KEY_SVOLUME_MUTE, KEY_CVOLUME_MUTE, KEY_AVOLUME_MUTE, }, /* 21 173 VK_VOLUME_MUTE */ {KEY_VOLUME_DOWN, KEY_SVOLUME_DOWN, KEY_CVOLUME_DOWN, KEY_AVOLUME_DOWN, }, /* 22 174 VK_VOLUME_DOWN */ {KEY_VOLUME_UP, KEY_SVOLUME_UP, KEY_CVOLUME_UP, KEY_AVOLUME_UP, }, /* 23 175 VK_VOLUME_UP */ {KEY_NEXT_TRACK, KEY_SNEXT_TRACK, KEY_CNEXT_TRACK, KEY_ANEXT_TRACK, }, /* 24 176 VK_MEDIA_NEXT_TRACK */ {KEY_PREV_TRACK, KEY_SPREV_TRACK, KEY_CPREV_TRACK, KEY_APREV_TRACK, }, /* 25 177 VK_MEDIA_PREV_TRACK */ {KEY_MEDIA_STOP, KEY_SMEDIA_STOP, KEY_CMEDIA_STOP, KEY_AMEDIA_STOP, }, /* 26 178 VK_MEDIA_STOP */ {KEY_PLAY_PAUSE, KEY_SPLAY_PAUSE, KEY_CPLAY_PAUSE, KEY_APLAY_PAUSE, }, /* 27 179 VK_MEDIA_PLAY_PAUSE */ {KEY_LAUNCH_MAIL, KEY_SLAUNCH_MAIL, KEY_CLAUNCH_MAIL, KEY_ALAUNCH_MAIL, }, /* 28 180 VK_LAUNCH_MAIL */ {KEY_MEDIA_SELECT, KEY_SMEDIA_SELECT, KEY_CMEDIA_SELECT, KEY_AMEDIA_SELECT, }, /* 29 181 VK_LAUNCH_MEDIA_SELECT */ {KEY_LAUNCH_APP1, KEY_SLAUNCH_APP1, KEY_CLAUNCH_APP1, KEY_ALAUNCH_APP1, }, /* 30 182 VK_LAUNCH_APP1 */ {KEY_LAUNCH_APP2, KEY_SLAUNCH_APP2, KEY_CLAUNCH_APP2, KEY_ALAUNCH_APP2, }, /* 31 183 VK_LAUNCH_APP2 */ }; /* End of kptab[] */ unsigned long PDC_get_input_fd(void) { PDC_LOG(("PDC_get_input_fd() - called\n")); return 0L; } void PDC_set_keyboard_binary(bool on) { PDC_LOG(("PDC_set_keyboard_binary() - called\n")); } /* check if a key or mouse event is waiting */ bool PDC_check_key(void) { if (key_count > 0) return TRUE; GetNumberOfConsoleInputEvents(pdc_con_in, &event_count); return (event_count != 0); } /* _get_key_count returns 0 if save_ip doesn't contain an event which should be passed back to the user. This function filters "useless" events. The function returns the number of keys waiting. This may be > 1 if the repetition of real keys pressed so far are > 1. Returns 0 on NUMLOCK, CAPSLOCK, SCROLLLOCK. Returns 1 for SHIFT, ALT, CTRL only if no other key has been pressed in between, and SP->return_key_modifiers is set; these are returned on keyup. Normal keys are returned on keydown only. The number of repetitions are returned. Dead keys (diacritics) are omitted. See below for a description. */ static int repeat_count = 0; static int _get_key_count(void) { int num_keys = 0, vk; static int prev_vk = 0; PDC_LOG(("_get_key_count() - called\n")); vk = KEV.wVirtualKeyCode; if (KEV.bKeyDown) { /* key down */ save_press = 0; if (vk == VK_CAPITAL || vk == VK_NUMLOCK || vk == VK_SCROLL) { /* throw away these modifiers */ } else if (vk == VK_SHIFT || vk == VK_CONTROL || vk == VK_MENU) { /* These keys are returned on keyup only. */ save_press = vk; switch (vk) { case VK_SHIFT: left_key = GetKeyState(VK_LSHIFT); break; case VK_CONTROL: left_key = GetKeyState(VK_LCONTROL); break; case VK_MENU: left_key = GetKeyState(VK_LMENU); } } else { /* Check for diacritics. These are dead keys. Some locales have modified characters like umlaut-a, which is an "a" with two dots on it. In some locales you have to press a special key (the dead key) immediately followed by the "a" to get a composed umlaut-a. The special key may have a normal meaning with different modifiers. */ if (KEV.uChar.UnicodeChar || !(MapVirtualKey(vk, 2) & 0x80000000)) num_keys = KEV.wRepeatCount; } if( vk == prev_vk) repeat_count++; else repeat_count = 0; prev_vk = vk; } else { /* key up */ /* Only modifier keys or the results of ALT-numpad entry are returned on keyup */ if ((vk == VK_MENU && KEV.uChar.UnicodeChar) || ((vk == VK_SHIFT || vk == VK_CONTROL || vk == VK_MENU) && vk == save_press)) { save_press = 0; num_keys = 1; } repeat_count = prev_vk = 0; } PDC_LOG(("_get_key_count() - returning: num_keys %d\n", num_keys)); return num_keys; } /* _process_key_event returns -1 if the key in save_ip should be ignored. Otherwise it returns the keycode which should be returned by PDC_get_key(). save_ip must be a key event. CTRL-ALT support has been disabled, when is it emitted plainly? */ static int _process_key_event(void) { int key = (unsigned short)KEV.uChar.UnicodeChar; WORD vk = KEV.wVirtualKeyCode; DWORD state = KEV.dwControlKeyState; int idx; BOOL enhanced; SP->key_code = TRUE; /* Save the key modifiers if required. Do this first to allow to detect e.g. a pressed CTRL key after a hit of NUMLOCK. */ if (SP->save_key_modifiers) { if (state & (LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED)) pdc_key_modifiers |= PDC_KEY_MODIFIER_ALT; if (state & SHIFT_PRESSED) pdc_key_modifiers |= PDC_KEY_MODIFIER_SHIFT; if (state & (LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED)) pdc_key_modifiers |= PDC_KEY_MODIFIER_CONTROL; if (state & NUMLOCK_ON) pdc_key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; if( repeat_count) pdc_key_modifiers |= PDC_KEY_MODIFIER_REPEAT; } /* Handle modifier keys hit by themselves */ switch (vk) { case VK_SHIFT: /* shift */ if (!SP->return_key_modifiers) return -1; return (left_key & 0x8000) ? KEY_SHIFT_L : KEY_SHIFT_R; case VK_CONTROL: /* control */ if (!SP->return_key_modifiers) return -1; return (left_key & 0x8000) ? KEY_CONTROL_L : KEY_CONTROL_R; case VK_MENU: /* alt */ if (!key) { if (!SP->return_key_modifiers) return -1; return (left_key & 0x8000) ? KEY_ALT_L : KEY_ALT_R; } } /* The system may emit Ascii or Unicode characters depending on whether ReadConsoleInputA or ReadConsoleInputW is used. Normally, if key != 0 then the system did the translation successfully. But this is not true for LEFT_ALT (different to RIGHT_ALT). In case of LEFT_ALT we can get key != 0. So check for this first. */ if (key && ( !(state & LEFT_ALT_PRESSED) || (state & RIGHT_ALT_PRESSED) )) { /* This code should catch all keys returning a printable character. Characters above 0x7F should be returned as positive codes. */ if (kptab[vk].extended == 0) { SP->key_code = FALSE; return key; } } /* This case happens if a functional key has been entered. */ if ((state & ENHANCED_KEY) && (kptab[vk].extended != 999)) { enhanced = TRUE; idx = kptab[vk].extended; } else { enhanced = FALSE; idx = vk; } if (state & SHIFT_PRESSED) key = enhanced ? ext_kptab[idx].shift : kptab[idx].shift; else if (state & (LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED)) key = enhanced ? ext_kptab[idx].control : kptab[idx].control; else if (state & (LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED)) key = enhanced ? ext_kptab[idx].alt : kptab[idx].alt; else key = enhanced ? ext_kptab[idx].normal : kptab[idx].normal; if (key < KEY_CODE_YES) SP->key_code = FALSE; return key; } static int _process_mouse_event(void) { static const DWORD button_mask[] = {1, 4, 2}; short action, shift_flags = 0; int i; save_press = 0; SP->key_code = TRUE; memset(&pdc_mouse_status, 0, sizeof(MOUSE_STATUS)); /* Handle scroll wheel */ if (MEV.dwEventFlags == 4) { pdc_mouse_status.changes = (MEV.dwButtonState & 0xFF000000) ? PDC_MOUSE_WHEEL_DOWN : PDC_MOUSE_WHEEL_UP; pdc_mouse_status.x = -1; pdc_mouse_status.y = -1; memset(&old_mouse_status, 0, sizeof(old_mouse_status)); return KEY_MOUSE; } if (MEV.dwEventFlags == 8) { pdc_mouse_status.changes = (MEV.dwButtonState & 0xFF000000) ? PDC_MOUSE_WHEEL_RIGHT : PDC_MOUSE_WHEEL_LEFT; pdc_mouse_status.x = -1; pdc_mouse_status.y = -1; memset(&old_mouse_status, 0, sizeof(old_mouse_status)); return KEY_MOUSE; } action = (MEV.dwEventFlags == 2) ? BUTTON_DOUBLE_CLICKED : ((MEV.dwEventFlags == 1) ? BUTTON_MOVED : BUTTON_PRESSED); for (i = 0; i < 3; i++) pdc_mouse_status.button[i] = (MEV.dwButtonState & button_mask[i]) ? action : 0; if (action == BUTTON_PRESSED && MEV.dwButtonState & 7 && SP->mouse_wait) { /* Check for a click -- a PRESS followed immediately by a release */ if (!event_count) { napms(SP->mouse_wait); GetNumberOfConsoleInputEvents(pdc_con_in, &event_count); } if (event_count) { INPUT_RECORD ip; DWORD count; bool have_click = FALSE; PeekConsoleInput(pdc_con_in, &ip, 1, &count); for (i = 0; i < 3; i++) { if (pdc_mouse_status.button[i] == BUTTON_PRESSED && !(ip.Event.MouseEvent.dwButtonState & button_mask[i])) { pdc_mouse_status.button[i] = BUTTON_CLICKED; have_click = TRUE; } } /* If a click was found, throw out the event */ if (have_click) ReadConsoleInput(pdc_con_in, &ip, 1, &count); } } pdc_mouse_status.x = MEV.dwMousePosition.X; pdc_mouse_status.y = MEV.dwMousePosition.Y; pdc_mouse_status.changes = 0; for (i = 0; i < 3; i++) { if (old_mouse_status.button[i] != pdc_mouse_status.button[i]) pdc_mouse_status.changes |= (1 << i); if (pdc_mouse_status.button[i] == BUTTON_MOVED) { /* Discard non-moved "moves" */ if (pdc_mouse_status.x == old_mouse_status.x && pdc_mouse_status.y == old_mouse_status.y) return -1; /* Motion events always flag the button as changed */ pdc_mouse_status.changes |= (1 << i); pdc_mouse_status.changes |= PDC_MOUSE_MOVED; break; } } old_mouse_status = pdc_mouse_status; /* Treat click events as release events for comparison purposes */ for (i = 0; i < 3; i++) { if (old_mouse_status.button[i] == BUTTON_CLICKED || old_mouse_status.button[i] == BUTTON_DOUBLE_CLICKED) old_mouse_status.button[i] = BUTTON_RELEASED; } /* Check for SHIFT/CONTROL/ALT */ if (MEV.dwControlKeyState & (LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED)) shift_flags |= BUTTON_ALT; if (MEV.dwControlKeyState & (LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED)) shift_flags |= BUTTON_CONTROL; if (MEV.dwControlKeyState & SHIFT_PRESSED) shift_flags |= BUTTON_SHIFT; if (shift_flags) { for (i = 0; i < 3; i++) { if (pdc_mouse_status.changes & (1 << i)) pdc_mouse_status.button[i] |= shift_flags; } } return KEY_MOUSE; } int pdc_resizeX, pdc_resizeY; /* return the next available key or mouse event */ int PDC_get_key(void) { pdc_key_modifiers = 0L; if (!key_count) { DWORD count; ReadConsoleInput(pdc_con_in, &save_ip, 1, &count); event_count--; if (save_ip.EventType == MOUSE_EVENT || save_ip.EventType == WINDOW_BUFFER_SIZE_EVENT) key_count = 1; else if (save_ip.EventType == KEY_EVENT) key_count = _get_key_count(); else if (save_ip.EventType == WINDOW_BUFFER_SIZE_EVENT) key_count = 1; } if (key_count) { key_count--; switch (save_ip.EventType) { case KEY_EVENT: return _process_key_event(); case MOUSE_EVENT: return _process_mouse_event(); case WINDOW_BUFFER_SIZE_EVENT: if (REV.dwSize.Y != LINES || REV.dwSize.X != COLS) { if (!SP->resized) { SP->resized = TRUE; SP->key_code = TRUE; return KEY_RESIZE; } } } } return -1; } /* discard any pending keyboard or mouse input -- this is the core routine for flushinp() */ void PDC_flushinp(void) { PDC_LOG(("PDC_flushinp() - called\n")); FlushConsoleInputBuffer(pdc_con_in); } int PDC_mouse_set(void) { /* If turning on mouse input: Set ENABLE_MOUSE_INPUT, and clear all other flags, including the extended flags; If turning off the mouse: Set QuickEdit Mode to the status it had on startup, and clear all other flags */ SetConsoleMode(pdc_con_in, SP->_trap_mbe ? (ENABLE_MOUSE_INPUT|0x0088) : (pdc_quick_edit|0x0088)); memset(&old_mouse_status, 0, sizeof(old_mouse_status)); return OK; } int PDC_modifiers_set(void) { return OK; } curses-1.4.4/vendor/PDCurses/wincon/pdcsetsc.c0000644000004100000410000000433114201713275021315 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcwin.h" /*man-start************************************************************** pdcsetsc -------- ### Synopsis int PDC_set_blink(bool blinkon); void PDC_set_title(const char *title); ### Description PDC_set_blink() toggles whether the A_BLINK attribute sets an actual blink mode (TRUE), or sets the background color to high intensity (FALSE). The default is platform-dependent (FALSE in most cases). It returns OK if it could set the state to match the given parameter, ERR otherwise. Current platforms also adjust the value of COLORS according to this function -- 16 for FALSE, and 8 for TRUE. PDC_set_title() sets the title of the window in which the curses program is running. This function may not do anything on some platforms. (Currently it only works in Win32 and X11.) ### Portability X/Open BSD SYS V PDC_set_blink - - - PDC_set_title - - - **man-end****************************************************************/ int PDC_curs_set(int visibility) { CONSOLE_CURSOR_INFO cci; int ret_vis; PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); ret_vis = SP->visibility; if (GetConsoleCursorInfo(pdc_con_out, &cci) == FALSE) return ERR; switch(visibility) { case 0: /* invisible */ cci.bVisible = FALSE; break; case 2: /* highly visible */ cci.bVisible = TRUE; cci.dwSize = 95; break; default: /* normal visibility */ cci.bVisible = TRUE; cci.dwSize = SP->orig_cursor; break; } if (SetConsoleCursorInfo(pdc_con_out, &cci) == FALSE) return ERR; SP->visibility = visibility; return ret_vis; } void PDC_set_title(const char *title) { #ifdef PDC_WIDE wchar_t wtitle[512]; #endif PDC_LOG(("PDC_set_title() - called:<%s>\n", title)); #ifdef PDC_WIDE PDC_mbstowcs(wtitle, title, 511); SetConsoleTitleW(wtitle); #else SetConsoleTitleA(title); #endif } int PDC_set_blink(bool blinkon) { if (pdc_color_started) COLORS = 16; return blinkon ? ERR : OK; } curses-1.4.4/vendor/PDCurses/wincon/Makefile.vc0000644000004100000410000000620314201713275021410 0ustar www-datawww-data# Visual C++ & Intel(R) NMakefile for PDCurses library - Windows console VC++ 2.0+ # # Usage: nmake -f [path\]Makefile.vc [DEBUG=] [DLL=] [WIDE=] [UTF8=] # [ICC=] [CHTYPE_32=] [IX86=] [CHTYPE_16=] [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] # CHTYPE_## is used to override the default 64-bit chtypes in favor # of "traditional" 32- or 16-bit chtypes. (Untested for Windows console) # IX86 is used to build 32-bit code instead of 64-bit # ICC is used to invoke Intel (R) tools icl.exe and xilink.exe, instead of # MS tools cl.exe and link.exe O = obj !ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. !endif !ifdef IX86 PLATFORM=IX86 !else PLATFORM=X64 !endif !include $(PDCURSES_SRCDIR)\version.mif !include $(PDCURSES_SRCDIR)\libobjs.mif osdir = $(PDCURSES_SRCDIR)\wincon PDCURSES_WIN_H = $(osdir)\pdcwin.h !ifdef ICC CC = icl.exe -nologo LINK = xilink.exe -nologo !else CC = cl.exe -nologo LINK = link.exe -nologo !endif !ifdef DEBUG CFLAGS = -Z7 -DPDCDEBUG LDFLAGS = -debug -pdb:none !else CFLAGS = -O1 LDFLAGS = !endif !ifdef WIDE WIDEOPT = -DPDC_WIDE !endif !ifdef UTF8 UTF8OPT = -DPDC_FORCE_UTF8 !endif !ifdef CHTYPE_32 CHTYPE_FLAGS= -DCHTYPE_32 !endif !ifdef CHTYPE_16 CHTYPE_FLAGS= -DCHTYPE_16 !endif SHL_LD = link $(LDFLAGS) /NOLOGO /DLL /MACHINE:$(PLATFORM) /OUT:pdcurses.dll CCLIBS = user32.lib advapi32.lib # may need to add msvcrt.lib for VC 2.x, VC 5.0 doesn't want it #CCLIBS = msvcrt.lib user32.lib advapi32.lib LIBEXE = lib -nologo LIBCURSES = pdcurses.lib CURSESDLL = pdcurses.dll !ifdef DLL DLLOPT = -DPDC_DLL_BUILD PDCLIBS = $(CURSESDLL) !else PDCLIBS = $(LIBCURSES) !endif BUILD = $(CC) -I$(PDCURSES_SRCDIR) -c $(CFLAGS) $(CHTYPE_FLAGS) $(DLLOPT) \ $(WIDEOPT) $(UTF8OPT) all: $(PDCLIBS) clean: -del *.obj -del *.lib -del *.exe -del *.dll -del *.exp -del *.res demos: $(DEMOS) DEMOOBJS = $(DEMOS:.exe=.obj) tui.obj $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_WIN_H) $(DEMOOBJS) : $(PDCURSES_CURSES_H) $(DEMOS) : $(LIBCURSES) panel.obj : $(PANEL_HEADER) terminfo.obj: $(TERM_HEADER) !ifndef DLL $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) -out:$@ $(LIBOBJS) $(PDCOBJS) !endif $(CURSESDLL) : $(LIBOBJS) $(PDCOBJS) pdcurses.obj $(SHL_LD) $(LIBOBJS) $(PDCOBJS) pdcurses.obj $(CCLIBS) pdcurses.res pdcurses.obj: $(osdir)\pdcurses.rc $(osdir)\pdcurses.ico rc /r /fopdcurses.res $(osdir)\pdcurses.rc cvtres /MACHINE:$(PLATFORM) /NOLOGO /OUT:pdcurses.obj pdcurses.res {$(srcdir)\}.c{}.obj:: $(BUILD) $< {$(osdir)\}.c{}.obj:: $(BUILD) $< {$(demodir)\}.c{}.obj:: $(BUILD) $< .obj.exe: $(LINK) $(LDFLAGS) $< $(LIBCURSES) $(CCLIBS) tuidemo.exe: tuidemo.obj tui.obj $(LINK) $(LDFLAGS) $*.obj tui.obj $(LIBCURSES) $(CCLIBS) tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(BUILD) -I$(demodir) $(demodir)\tui.c tuidemo.obj: $(demodir)\tuidemo.c $(BUILD) -I$(demodir) $(demodir)\tuidemo.c PLATFORM1 = Visual C++ PLATFORM2 = Microsoft Visual C/C++ for Windows console ARCNAME = pdc$(VER)_vc_wincon !include $(PDCURSES_SRCDIR)\makedist.mif curses-1.4.4/vendor/PDCurses/wincon/pdcgetsc.c0000644000004100000410000000177414201713275021311 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcwin.h" /* get the cursor size/shape */ int PDC_get_cursor_mode(void) { CONSOLE_CURSOR_INFO ci; PDC_LOG(("PDC_get_cursor_mode() - called\n")); GetConsoleCursorInfo(pdc_con_out, &ci); return ci.dwSize; } /* return number of screen rows */ int PDC_get_rows(void) { CONSOLE_SCREEN_BUFFER_INFO scr; PDC_LOG(("PDC_get_rows() - called\n")); GetConsoleScreenBufferInfo(pdc_con_out, &scr); return scr.srWindow.Bottom - scr.srWindow.Top + 1; } /* return number of buffer rows */ int PDC_get_buffer_rows(void) { CONSOLE_SCREEN_BUFFER_INFO scr; PDC_LOG(("PDC_get_buffer_rows() - called\n")); GetConsoleScreenBufferInfo(pdc_con_out, &scr); return scr.dwSize.Y; } /* return width of screen/viewport */ int PDC_get_columns(void) { CONSOLE_SCREEN_BUFFER_INFO scr; PDC_LOG(("PDC_get_columns() - called\n")); GetConsoleScreenBufferInfo(pdc_con_out, &scr); return scr.srWindow.Right - scr.srWindow.Left + 1; } curses-1.4.4/vendor/PDCurses/wincon/pdcdisp.c0000644000004100000410000001004114201713275021126 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcwin.h" #include #include #ifdef CHTYPE_LONG #ifdef PDC_WIDE #define USE_UNICODE_ACS_CHARS 1 #else #define USE_UNICODE_ACS_CHARS 0 #endif #include "acs_defs.h" #endif /* position hardware cursor at (y, x) */ void PDC_gotoyx(int row, int col) { COORD coord; PDC_LOG(("PDC_gotoyx() - called: row %d col %d from row %d col %d\n", row, col, SP->cursrow, SP->curscol)); coord.X = col; coord.Y = row; SetConsoleCursorPosition(pdc_con_out, coord); } /* update the given physical line to look like the corresponding line in curscr */ /* NOTE: the original indexing into pdc_atrtab[] relied on three or five attribute bits in 'chtype' being adjacent to the color bits. Such is not the case for 64-bit chtypes (CHTYPE_LONG == 2), so we have to do additional bit-fiddling for that situation. Code is similar in Win32 and DOS flavors. (BJG) */ #define MAX_UNICODE 0x10ffff #define DUMMY_CHAR_NEXT_TO_FULLWIDTH (MAX_UNICODE + 1) /* see 'addch.c' for an explanation of how combining chars are handled. */ #if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2 && defined( PDC_WIDE) #define USING_COMBINING_CHARACTER_SCHEME int PDC_expand_combined_characters( const cchar_t c, cchar_t *added); /* addch.c */ #endif #define PDC_NEW_WINCON_WORKAROUND 1 void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) { CHAR_INFO ci[512]; int src, dst; COORD bufSize, bufPos; SMALL_RECT sr; PDC_LOG(("PDC_transform_line() - called: lineno=%d\n", lineno)); bufPos.X = bufPos.Y = 0; sr.Top = lineno; sr.Bottom = lineno; sr.Left = x; sr.Right = x + len - 1; for (src = dst = 0; src < len; src++) if( (srcp[src] & A_CHARTEXT) != DUMMY_CHAR_NEXT_TO_FULLWIDTH) { const chtype ch = srcp[src]; chtype char_out = ch & A_CHARTEXT; #if defined( CHTYPE_LONG) && (CHTYPE_LONG >= 2) ci[dst].Attributes = pdc_atrtab[((ch >> PDC_ATTR_SHIFT) & 0x1f) | (((ch >> PDC_COLOR_SHIFT) & 0xff) << 5)]; #else ci[dst].Attributes = pdc_atrtab[ch >> PDC_ATTR_SHIFT]; #endif #ifdef CHTYPE_LONG if (ch & A_ALTCHARSET && !(ch & 0xff80)) char_out = acs_map[ch & 0x7f]; #ifdef USING_COMBINING_CHARACTER_SCHEME /* We can't actually display combining characters in cmd.exe. So show the 'base' character and throw away the modifying marks. */ if( char_out > MAX_UNICODE) { cchar_t added; int n_combined = 0; while( (char_out = PDC_expand_combined_characters( char_out, &added)) > MAX_UNICODE) { n_combined++; } } #endif if( char_out > 0xffff) /* SMP chars: use surrogates */ { ci[dst].Char.UnicodeChar = (WCHAR)( 0xd800 | (char_out>>10)); ci[dst + 1] = ci[dst]; dst++; char_out = (chtype)( 0xdc00 | (char_out & 0x3ff)); } #endif ci[dst].Char.UnicodeChar = (WCHAR)char_out; #ifdef PDC_NEW_WINCON_WORKAROUND sr.Left = x + src; if( src < len - 1 && (srcp[src + 1] & A_CHARTEXT) == DUMMY_CHAR_NEXT_TO_FULLWIDTH) { /* necessary to erase garbage */ ci[dst + 1].Char.UnicodeChar = (WCHAR)' '; ci[dst + 1].Attributes = ci[dst].Attributes; bufSize.X = 2; bufSize.Y = 1; sr.Right = sr.Left + 2; } else { bufSize.X = 1; bufSize.Y = 1; sr.Right = sr.Left + 1; } WriteConsoleOutput(pdc_con_out, ci, bufSize, bufPos, &sr); #else dst++; #endif } #ifndef PDC_NEW_WINCON_WORKAROUND bufSize.X = dst; bufSize.Y = 1; WriteConsoleOutput(pdc_con_out, ci, bufSize, bufPos, &sr); #endif } curses-1.4.4/vendor/PDCurses/wincon/pdcwin.h0000644000004100000410000000141214201713275020773 0ustar www-datawww-data/* Public Domain Curses */ #ifdef PDC_WIDE # define UNICODE #endif #include #undef MOUSE_MOVED #include # if(CHTYPE_LONG >= 2) /* 64-bit chtypes */ # define PDC_ATTR_SHIFT 23 # else #ifdef CHTYPE_LONG /* 32-bit chtypes */ # define PDC_ATTR_SHIFT 19 #else /* 16-bit chtypes */ # define PDC_ATTR_SHIFT 8 #endif #endif #if (defined(__CYGWIN__) || defined(__MINGW32__) || defined(__WATCOMC__) \ || (defined(_MSC_VER) && _WIN32_WINNT >= _WIN32_WINNT_VISTA)) #if !defined(HAVE_INFOEX) && !defined(HAVE_NO_INFOEX) # define HAVE_INFOEX #endif #endif extern unsigned char *pdc_atrtab; extern HANDLE pdc_con_out, pdc_con_in; extern DWORD pdc_quick_edit; extern int PDC_get_buffer_rows(void); curses-1.4.4/vendor/PDCurses/wincon/pdcclip.c0000644000004100000410000001025214201713275021122 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcwin.h" /*man-start************************************************************** clipboard --------- ### Synopsis int PDC_getclipboard(char **contents, long *length); int PDC_setclipboard(const char *contents, long length); int PDC_freeclipboard(char *contents); int PDC_clearclipboard(void); ### Description PDC_getclipboard() gets the textual contents of the system's clipboard. This function returns the contents of the clipboard in the contents argument. It is the responsibility of the caller to free the memory returned, via PDC_freeclipboard(). The length of the clipboard contents is returned in the length argument. PDC_setclipboard copies the supplied text into the system's clipboard, emptying the clipboard prior to the copy. PDC_clearclipboard() clears the internal clipboard. ### Return Values indicator of success/failure of call. PDC_CLIP_SUCCESS the call was successful PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for the clipboard contents PDC_CLIP_EMPTY the clipboard contains no text PDC_CLIP_ACCESS_ERROR no clipboard support ### Portability X/Open BSD SYS V PDC_getclipboard - - - PDC_setclipboard - - - PDC_freeclipboard - - - PDC_clearclipboard - - - **man-end****************************************************************/ #ifdef PDC_WIDE # define PDC_TEXT CF_UNICODETEXT #else # define PDC_TEXT CF_OEMTEXT #endif int PDC_getclipboard_handle( HANDLE *handle) { PDC_LOG(("PDC_getclipboard() - called\n")); if (!OpenClipboard(NULL)) { return PDC_CLIP_ACCESS_ERROR; } if ((*handle = GetClipboardData(PDC_TEXT)) == NULL) { CloseClipboard(); return PDC_CLIP_EMPTY; } return PDC_CLIP_SUCCESS; } int PDC_getclipboard(char **contents, long *length) { HANDLE handle; int rval = PDC_getclipboard_handle( &handle); if( rval == PDC_CLIP_SUCCESS) { void *tptr = GlobalLock( handle); if( tptr) { #ifdef PDC_WIDE size_t len = wcslen((wchar_t *)tptr) * 3; #else size_t len = strlen( tptr); #endif *contents = (char *)GlobalAlloc( GMEM_FIXED, len + 1); if( !*contents) rval = PDC_CLIP_MEMORY_ERROR; else { #ifdef PDC_WIDE len = PDC_wcstombs( (char *)*contents, tptr, len); #else strcpy((char *)*contents, tptr); #endif } *length = (long)len; GlobalUnlock( handle); } else rval = PDC_CLIP_MEMORY_ERROR; CloseClipboard(); } return rval; } int PDC_setclipboard_raw( const char *contents, long length, const bool translate_multibyte_to_wide_char) { HGLOBAL handle; LPTSTR buff; PDC_LOG(("PDC_setclipboard() - called\n")); if (!OpenClipboard(NULL)) return PDC_CLIP_ACCESS_ERROR; handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, (length + 1) * sizeof(TCHAR)); if (!handle) return PDC_CLIP_MEMORY_ERROR; buff = GlobalLock(handle); #ifdef PDC_WIDE if( translate_multibyte_to_wide_char) PDC_mbstowcs((wchar_t *)buff, contents, length); else memcpy((char *)buff, contents, (length + 1) * sizeof( wchar_t)); #else memcpy((char *)buff, contents, length); buff[length] = 0; /* ensure null termination */ #endif GlobalUnlock(handle); EmptyClipboard(); if( !SetClipboardData(PDC_TEXT, handle)) { GlobalFree(handle); return PDC_CLIP_ACCESS_ERROR; } CloseClipboard(); return PDC_CLIP_SUCCESS; } int PDC_setclipboard(const char *contents, long length) { return( PDC_setclipboard_raw( contents, length, TRUE)); } int PDC_freeclipboard(char *contents) { PDC_LOG(("PDC_freeclipboard() - called\n")); GlobalFree(contents); return PDC_CLIP_SUCCESS; } int PDC_clearclipboard(void) { PDC_LOG(("PDC_clearclipboard() - called\n")); EmptyClipboard(); return PDC_CLIP_SUCCESS; } curses-1.4.4/vendor/PDCurses/wincon/Makefile.dmc0000644000004100000410000001145314201713275021546 0ustar www-datawww-data# Makefile for PDCurses library - WIN32 Digital Mars # # Usage: make -f Makefile.dmc [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] PDCURSES_SRCDIR = .. PDCURSES_CURSES_H = $(PDCURSES_SRCDIR)\curses.h PDCURSES_CURSPRIV_H = $(PDCURSES_SRCDIR)\curspriv.h PDCURSES_HEADERS = $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H) PANEL_HEADER = $(PDCURSES_SRCDIR)\panel.h TERM_HEADER = $(PDCURSES_SRCDIR)\term.h srcdir = $(PDCURSES_SRCDIR)\pdcurses osdir = $(PDCURSES_SRCDIR)\wincon demodir = $(PDCURSES_SRCDIR)\demos PDCURSES_WIN_H = $(osdir)\pdcwin.h CC = dmc CFLAGS = -c -o+space -Nc CPPFLAGS = -I$(PDCURSES_SRCDIR) -DPDC_WIDE -DPDC_FORCE_UTF8 LINK = dmc LIBEXE = lib LIBCURSES = pdcurses.lib BUILD = $(CC) $(CFLAGS) $(CPPFLAGS) DEMOS = testcurs.exe ozdemo.exe newtest.exe xmas.exe tuidemo.exe \ firework.exe ptest.exe rain.exe worm.exe all: $(LIBCURSES) $(DEMOS) clean: -del *.obj -del *.lib -del *.exe -del *.map -del advapi32.def LIBOBJS = addch.obj addchstr.obj addstr.obj attr.obj beep.obj bkgd.obj \ border.obj clear.obj color.obj delch.obj deleteln.obj deprec.obj getch.obj \ getstr.obj getyx.obj inch.obj inchstr.obj initscr.obj inopts.obj \ insch.obj insstr.obj instr.obj kernel.obj keyname.obj mouse.obj move.obj \ outopts.obj overlay.obj pad.obj panel.obj printw.obj refresh.obj \ scanw.obj scr_dump.obj scroll.obj slk.obj termattr.obj terminfo.obj \ touch.obj util.obj window.obj debug.obj PDCOBJS = pdcclip.obj pdcdisp.obj pdcgetsc.obj pdckbd.obj pdcscrn.obj \ pdcsetsc.obj pdcutil.obj DEMOOBJS = testcurs.obj ozdemo.obj newtest.obj xmas.obj tuidemo.obj tui.obj \ firework.obj ptest.obj rain.obj worm.obj $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_WIN_H) panel.obj ptest.obj: $(PANEL_HEADER) terminfo.obj: $(TERM_HEADER) $(DEMOOBJS) : $(PDCURSES_CURSES_H) $(DEMOS) : $(LIBCURSES) $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) -c $@ $(LIBOBJS) $(PDCOBJS) -copy $(LIBCURSES) panel.lib SRCBUILD = $(BUILD) $(srcdir)\$*.c OSBUILD = $(BUILD) $(osdir)\$*.c DEMOBUILD = $(LINK) $(CPPFLAGS) -o+space $@ $** addch.obj: $(srcdir)\addch.c $(SRCBUILD) addchstr.obj: $(srcdir)\addchstr.c $(SRCBUILD) addstr.obj: $(srcdir)\addstr.c $(SRCBUILD) attr.obj: $(srcdir)\attr.c $(SRCBUILD) beep.obj: $(srcdir)\beep.c $(SRCBUILD) bkgd.obj: $(srcdir)\bkgd.c $(SRCBUILD) border.obj: $(srcdir)\border.c $(SRCBUILD) clear.obj: $(srcdir)\clear.c $(SRCBUILD) color.obj: $(srcdir)\color.c $(SRCBUILD) delch.obj: $(srcdir)\delch.c $(SRCBUILD) deleteln.obj: $(srcdir)\deleteln.c $(SRCBUILD) deprec.obj: $(srcdir)\deprec.c $(SRCBUILD) getch.obj: $(srcdir)\getch.c $(SRCBUILD) getstr.obj: $(srcdir)\getstr.c $(SRCBUILD) getyx.obj: $(srcdir)\getyx.c $(SRCBUILD) inch.obj: $(srcdir)\inch.c $(SRCBUILD) inchstr.obj: $(srcdir)\inchstr.c $(SRCBUILD) initscr.obj: $(srcdir)\initscr.c $(SRCBUILD) inopts.obj: $(srcdir)\inopts.c $(SRCBUILD) insch.obj: $(srcdir)\insch.c $(SRCBUILD) insstr.obj: $(srcdir)\insstr.c $(SRCBUILD) instr.obj: $(srcdir)\instr.c $(SRCBUILD) kernel.obj: $(srcdir)\kernel.c $(SRCBUILD) keyname.obj: $(srcdir)\keyname.c $(SRCBUILD) mouse.obj: $(srcdir)\mouse.c $(SRCBUILD) move.obj: $(srcdir)\move.c $(SRCBUILD) outopts.obj: $(srcdir)\outopts.c $(SRCBUILD) overlay.obj: $(srcdir)\overlay.c $(SRCBUILD) pad.obj: $(srcdir)\pad.c $(SRCBUILD) panel.obj: $(srcdir)\panel.c $(SRCBUILD) printw.obj: $(srcdir)\printw.c $(SRCBUILD) refresh.obj: $(srcdir)\refresh.c $(SRCBUILD) scanw.obj: $(srcdir)\scanw.c $(SRCBUILD) scr_dump.obj: $(srcdir)\scr_dump.c $(SRCBUILD) scroll.obj: $(srcdir)\scroll.c $(SRCBUILD) slk.obj: $(srcdir)\slk.c $(SRCBUILD) termattr.obj: $(srcdir)\termattr.c $(SRCBUILD) terminfo.obj: $(srcdir)\terminfo.c $(SRCBUILD) touch.obj: $(srcdir)\touch.c $(SRCBUILD) util.obj: $(srcdir)\util.c $(SRCBUILD) window.obj: $(srcdir)\window.c $(SRCBUILD) debug.obj: $(srcdir)\debug.c $(SRCBUILD) pdcclip.obj: $(osdir)\pdcclip.c $(OSBUILD) pdcdisp.obj: $(osdir)\pdcdisp.c $(OSBUILD) pdcgetsc.obj: $(osdir)\pdcgetsc.c $(OSBUILD) pdckbd.obj: $(osdir)\pdckbd.c $(OSBUILD) pdcscrn.obj: $(osdir)\pdcscrn.c $(OSBUILD) pdcsetsc.obj: $(osdir)\pdcsetsc.c $(OSBUILD) pdcutil.obj: $(osdir)\pdcutil.c $(OSBUILD) firework.exe: $(demodir)\firework.c $(DEMOBUILD) ozdemo.exe: $(demodir)\ozdemo.c $(DEMOBUILD) newtest.exe: $(demodir)\newtest.c $(DEMOBUILD) ptest.exe: $(demodir)\ptest.c $(DEMOBUILD) rain.exe: $(demodir)\rain.c $(DEMOBUILD) testcurs.exe: $(demodir)\testcurs.c $(DEMOBUILD) advapi32.lib tuidemo.exe: tuidemo.obj tui.obj $(DEMOBUILD) worm.exe: $(demodir)\worm.c $(DEMOBUILD) xmas.exe: $(demodir)\xmas.c $(DEMOBUILD) tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(BUILD) -I$(demodir) $(demodir)\$*.c tuidemo.obj: $(demodir)\tuidemo.c $(BUILD) -I$(demodir) $(demodir)\$*.c curses-1.4.4/vendor/PDCurses/wincon/Makefile.bcc0000644000004100000410000000301714201713275021527 0ustar www-datawww-data# Borland MAKE Makefile for PDCurses library - Windows console BC++ 7.0+ # # Usage: make -f [path\]Makefile.bcc [DEBUG=] [WIDE=] [UTF8=] [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] O = obj E = .exe RM = del !ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. !endif !include $(PDCURSES_SRCDIR)\version.mif !include $(PDCURSES_SRCDIR)\libobjs.mif osdir = $(PDCURSES_SRCDIR)\wincon CC = bcc32c -q -Xdriver -Wno-deprecated-declarations !ifdef DEBUG CFLAGS = -N -v -y -DPDCDEBUG !else CFLAGS = -O !endif !ifdef WIDE WIDEOPT = -DPDC_WIDE !endif !ifdef UTF8 UTF8OPT = -DPDC_FORCE_UTF8 !endif BUILD = $(CC) -I$(PDCURSES_SRCDIR) -c -Tpe $(CFLAGS) \ $(WIDEOPT) $(UTF8OPT) LIBEXE = tlib /C /E /0 /a LIBCURSES = pdcurses.lib all: $(LIBCURSES) clean: -$(RM) *.obj -$(RM) *.lib -$(RM) *.tds -$(RM) *.exe demos: $(DEMOS) $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) -$(RM) $@ $(LIBEXE) $@ $(LIBOBJS) $(PDCOBJS) .autodepend {$(srcdir)\}.c.obj: $(BUILD) $< {$(osdir)\}.c.obj: $(BUILD) $< {$(demodir)\}.c.obj: $(BUILD) $< .c.obj: $(BUILD) $< .obj.exe: $(CC) -e$@ $** $(LIBCURSES) tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES) $(CC) -e$@ $** tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(PDCURSES_CURSES_H) $(BUILD) -I$(demodir) $(demodir)\tui.c tuidemo.obj: $(demodir)\tuidemo.c $(PDCURSES_CURSES_H) $(BUILD) -I$(demodir) $(demodir)\tuidemo.c PLATFORM1 = Borland C++ Wincon PLATFORM2 = Borland C/C++ 7.2 for Windows console ARCNAME = pdc$(VER)_bcc_wincon !include $(PDCURSES_SRCDIR)\makedist.mif curses-1.4.4/vendor/PDCurses/wincon/CMakeLists.txt0000644000004100000410000000144314201713275022102 0ustar www-datawww-datacmake_minimum_required(VERSION 3.11) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING "Choose the type of build, options are: Debug, Release, or MinSizeRel." FORCE) message(STATUS "No build type specified, defaulting to MinSizeRel.") endif() PROJECT(wincon VERSION "${PROJECT_VERSION}" LANGUAGES C) INCLUDE(project_common) demo_app(../demos version) demo_app(../demos firework) demo_app(../demos ozdemo) demo_app(../demos newtest) demo_app(../demos ptest) demo_app(../demos rain) demo_app(../demos testcurs) demo_app(../demos tuidemo) demo_app(../demos worm) demo_app(../demos xmas) IF(WIN32) SET_TARGET_PROPERTIES(${PROJECT_NAME}_newtest PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS") ENDIF(WIN32) SET(CPACK_COMPONENTS_ALL applications) curses-1.4.4/vendor/PDCurses/wincon/pdcutil.c0000644000004100000410000000142314201713275021150 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcwin.h" void PDC_beep(void) { PDC_LOG(("PDC_beep() - called\n")); /* MessageBeep(MB_OK); */ MessageBeep(0XFFFFFFFF); } void PDC_napms(int ms) { PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); Sleep(ms); } const char *PDC_sysname(void) { return "Win32"; } PDC_version_info PDC_version = { PDC_PORT_WIN32, PDC_VER_MAJOR, PDC_VER_MINOR, PDC_VER_CHANGE, sizeof( chtype), /* note that thus far, 'wide' and 'UTF8' versions exist */ /* only for SDL2, X11, Win32, and Win32a; elsewhere, */ /* these will be FALSE */ #ifdef PDC_WIDE TRUE, #else FALSE, #endif #ifdef PDC_FORCE_UTF8 TRUE, #else FALSE, #endif }; curses-1.4.4/vendor/PDCurses/wincon/pdcurses.rc0000644000004100000410000000135214201713275021517 0ustar www-datawww-data#include "winver.h" 1 VERSIONINFO FILEVERSION 4,0,2,0 PRODUCTVERSION 4,0,2,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS VOS_UNKNOWN FILETYPE VFT_DLL FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "Maintainer", "William McBrine\0" VALUE "FileDescription", "Public Domain Curses\0" VALUE "FileVersion", "4.0.2\0" VALUE "InternalName", "PDCurses\0" VALUE "LegalCopyright", "Public Domain\0" VALUE "OriginalFilename", "PDCURSES.DLL\0" VALUE "ProductName", "Public Domain Curses Library\0" VALUE "ProductVersion", "4.0.2\0" END END END 1 ICON DISCARDABLE "PDCURSES.ico" curses-1.4.4/vendor/PDCurses/wincon/pdcscrn.c0000644000004100000410000004501514201713275021145 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcwin.h" #ifdef CHTYPE_LONG # define PDC_OFFSET 32 #else # define PDC_OFFSET 8 #endif #ifndef ENABLE_EXTENDED_FLAGS # define ENABLE_EXTENDED_FLAGS 0x80 #endif /* special purpose function keys */ static int PDC_shutdown_key[PDC_MAX_FUNCTION_KEYS] = { 0, 0, 0, 0, 0 }; /* COLOR_PAIR to attribute encoding table. */ unsigned char *pdc_atrtab = (unsigned char *)NULL; HANDLE std_con_out = INVALID_HANDLE_VALUE; HANDLE pdc_con_out = INVALID_HANDLE_VALUE; HANDLE pdc_con_in = INVALID_HANDLE_VALUE; DWORD pdc_quick_edit; static short curstoreal[16], realtocurs[16] = { COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN, COLOR_RED, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE, COLOR_BLACK + 8, COLOR_BLUE + 8, COLOR_GREEN + 8, COLOR_CYAN + 8, COLOR_RED + 8, COLOR_MAGENTA + 8, COLOR_YELLOW + 8, COLOR_WHITE + 8 }; enum { PDC_RESTORE_NONE, PDC_RESTORE_BUFFER }; /* Struct for storing console registry keys, and for use with the undocumented WM_SETCONSOLEINFO message. Originally by James Brown, www.catch22.net. */ static struct { ULONG Length; COORD ScreenBufferSize; COORD WindowSize; ULONG WindowPosX; ULONG WindowPosY; COORD FontSize; ULONG FontFamily; ULONG FontWeight; WCHAR FaceName[32]; ULONG CursorSize; ULONG FullScreen; ULONG QuickEdit; ULONG AutoPosition; ULONG InsertMode; USHORT ScreenColors; USHORT PopupColors; ULONG HistoryNoDup; ULONG HistoryBufferSize; ULONG NumberOfHistoryBuffers; COLORREF ColorTable[16]; ULONG CodePage; HWND Hwnd; WCHAR ConsoleTitle[0x100]; } console_info; #ifndef HAVE_INFOEX /* Console screen buffer information (extended version) */ typedef struct _CONSOLE_SCREEN_BUFFER_INFOEX { ULONG cbSize; COORD dwSize; COORD dwCursorPosition; WORD wAttributes; SMALL_RECT srWindow; COORD dwMaximumWindowSize; WORD wPopupAttributes; BOOL bFullscreenSupported; COLORREF ColorTable[16]; } CONSOLE_SCREEN_BUFFER_INFOEX; typedef CONSOLE_SCREEN_BUFFER_INFOEX *PCONSOLE_SCREEN_BUFFER_INFOEX; #endif typedef BOOL (WINAPI *SetConsoleScreenBufferInfoExFn)(HANDLE hConsoleOutput, PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx); typedef BOOL (WINAPI *GetConsoleScreenBufferInfoExFn)(HANDLE hConsoleOutput, PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx); static SetConsoleScreenBufferInfoExFn pSetConsoleScreenBufferInfoEx = NULL; static GetConsoleScreenBufferInfoExFn pGetConsoleScreenBufferInfoEx = NULL; static CONSOLE_SCREEN_BUFFER_INFO orig_scr; static CONSOLE_SCREEN_BUFFER_INFOEX console_infoex; static LPTOP_LEVEL_EXCEPTION_FILTER xcpt_filter; static DWORD old_console_mode = 0; static bool is_nt; static HWND _find_console_handle(void) { TCHAR orgtitle[1024], temptitle[1024]; HWND wnd; GetConsoleTitle(orgtitle, 1024); wsprintf(temptitle, TEXT("%d/%d"), GetTickCount(), GetCurrentProcessId()); SetConsoleTitle(temptitle); Sleep(40); wnd = FindWindow(NULL, temptitle); SetConsoleTitle(orgtitle); return wnd; } /* Undocumented console message */ #define WM_SETCONSOLEINFO (WM_USER + 201) /* Wrapper around WM_SETCONSOLEINFO. We need to create the necessary section (file-mapping) object in the context of the process which owns the console, before posting the message. Originally by JB. */ static void _set_console_info(void) { CONSOLE_SCREEN_BUFFER_INFO csbi; CONSOLE_CURSOR_INFO cci; DWORD dwConsoleOwnerPid; HANDLE hProcess; HANDLE hSection, hDupSection; PVOID ptrView; /* Each-time initialization for console_info */ GetConsoleCursorInfo(pdc_con_out, &cci); console_info.CursorSize = cci.dwSize; GetConsoleScreenBufferInfo(pdc_con_out, &csbi); console_info.ScreenBufferSize = csbi.dwSize; console_info.WindowSize.X = csbi.srWindow.Right - csbi.srWindow.Left + 1; console_info.WindowSize.Y = csbi.srWindow.Bottom - csbi.srWindow.Top + 1; console_info.WindowPosX = csbi.srWindow.Left; console_info.WindowPosY = csbi.srWindow.Top; /* Open the process which "owns" the console */ GetWindowThreadProcessId(console_info.Hwnd, &dwConsoleOwnerPid); hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwConsoleOwnerPid); /* Create a SECTION object backed by page-file, then map a view of this section into the owner process so we can write the contents of the CONSOLE_INFO buffer into it */ hSection = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, sizeof(console_info), 0); /* Copy our console structure into the section-object */ ptrView = MapViewOfFile(hSection, FILE_MAP_WRITE|FILE_MAP_READ, 0, 0, sizeof(console_info)); memcpy(ptrView, &console_info, sizeof(console_info)); UnmapViewOfFile(ptrView); /* Map the memory into owner process */ DuplicateHandle(GetCurrentProcess(), hSection, hProcess, &hDupSection, 0, FALSE, DUPLICATE_SAME_ACCESS); /* Send console window the "update" message */ SendMessage(console_info.Hwnd, WM_SETCONSOLEINFO, (WPARAM)hDupSection, 0); CloseHandle(hSection); CloseHandle(hProcess); } static int _set_console_infoex(void) { if (!pSetConsoleScreenBufferInfoEx(pdc_con_out, &console_infoex)) return ERR; return OK; } static int _set_colors(void) { if (pSetConsoleScreenBufferInfoEx) return _set_console_infoex(); else { _set_console_info(); return OK; } } /* One-time initialization for console_info -- color table and font info from the registry; other values from functions. */ static void _init_console_info(void) { DWORD scrnmode, len; HKEY reghnd; int i; console_info.Hwnd = _find_console_handle(); console_info.Length = sizeof(console_info); GetConsoleMode(pdc_con_in, &scrnmode); console_info.QuickEdit = !!(scrnmode & 0x0040); console_info.InsertMode = !!(scrnmode & 0x0020); console_info.FullScreen = FALSE; console_info.AutoPosition = 0x10000; console_info.ScreenColors = SP->orig_back << 4 | SP->orig_fore; console_info.PopupColors = 0xf5; console_info.HistoryNoDup = FALSE; console_info.HistoryBufferSize = 50; console_info.NumberOfHistoryBuffers = 4; console_info.CodePage = GetConsoleOutputCP(); RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Console"), 0, KEY_QUERY_VALUE, ®hnd); len = sizeof(DWORD); /* Default color table */ for (i = 0; i < 16; i++) { char tname[13]; sprintf(tname, "ColorTable%02d", i); RegQueryValueExA(reghnd, tname, NULL, NULL, (LPBYTE)(&(console_info.ColorTable[i])), &len); } /* Font info */ RegQueryValueEx(reghnd, TEXT("FontSize"), NULL, NULL, (LPBYTE)(&console_info.FontSize), &len); RegQueryValueEx(reghnd, TEXT("FontFamily"), NULL, NULL, (LPBYTE)(&console_info.FontFamily), &len); RegQueryValueEx(reghnd, TEXT("FontWeight"), NULL, NULL, (LPBYTE)(&console_info.FontWeight), &len); len = sizeof(WCHAR) * 32; RegQueryValueExW(reghnd, L"FaceName", NULL, NULL, (LPBYTE)(console_info.FaceName), &len); RegCloseKey(reghnd); } static int _init_console_infoex(void) { console_infoex.cbSize = sizeof(console_infoex); if (!pGetConsoleScreenBufferInfoEx(pdc_con_out, &console_infoex)) return ERR; console_infoex.srWindow.Right++; console_infoex.srWindow.Bottom++; return OK; } static COLORREF *_get_colors(void) { if (pGetConsoleScreenBufferInfoEx) { int status = OK; if (!console_infoex.cbSize) status = _init_console_infoex(); return (status == ERR) ? NULL : (COLORREF *)(&(console_infoex.ColorTable)); } else { if (!console_info.Hwnd) _init_console_info(); return (COLORREF *)(&(console_info.ColorTable)); } } /* restore the original console buffer in the event of a crash */ static LONG WINAPI _restore_console(LPEXCEPTION_POINTERS ep) { PDC_scr_close(); return EXCEPTION_CONTINUE_SEARCH; } /* restore the original console buffer on Ctrl+Break (or Ctrl+C, if it gets re-enabled) */ static BOOL WINAPI _ctrl_break(DWORD dwCtrlType) { if (dwCtrlType == CTRL_BREAK_EVENT || dwCtrlType == CTRL_C_EVENT) PDC_scr_close(); return FALSE; } /* close the physical screen -- may restore the screen to its state before PDC_scr_open(); miscellaneous cleanup */ void PDC_scr_close(void) { PDC_LOG(("PDC_scr_close() - called\n")); if (SP->visibility != 1) curs_set(1); PDC_reset_shell_mode(); /* Position cursor to the bottom left of the screen. */ if (SP->_restore == PDC_RESTORE_NONE) { SMALL_RECT win; win.Left = orig_scr.srWindow.Left; win.Right = orig_scr.srWindow.Right; win.Top = 0; win.Bottom = orig_scr.srWindow.Bottom - orig_scr.srWindow.Top; SetConsoleWindowInfo(pdc_con_out, TRUE, &win); PDC_gotoyx(win.Bottom, 0); } } void PDC_scr_free(void) { if (SP) free(SP); if (pdc_atrtab) free(pdc_atrtab); pdc_atrtab = (unsigned char *)NULL; if (pdc_con_out != std_con_out) { CloseHandle(pdc_con_out); pdc_con_out = std_con_out; } SetUnhandledExceptionFilter(xcpt_filter); SetConsoleCtrlHandler(_ctrl_break, FALSE); } /* open the physical screen -- allocate SP, miscellaneous intialization, and may save the existing screen for later restoration */ int PDC_scr_open(int argc, char **argv) { const char *str; CONSOLE_SCREEN_BUFFER_INFO csbi; HMODULE h_kernel; int i; PDC_LOG(("PDC_scr_open() - called\n")); SP = calloc(1, sizeof(SCREEN)); pdc_atrtab = calloc(PDC_COLOR_PAIRS * PDC_OFFSET, 1); if (!SP || !pdc_atrtab) return ERR; for (i = 0; i < 16; i++) curstoreal[realtocurs[i]] = i; std_con_out = pdc_con_out = GetStdHandle(STD_OUTPUT_HANDLE); pdc_con_in = GetStdHandle(STD_INPUT_HANDLE); if (GetFileType(pdc_con_in) != FILE_TYPE_CHAR) { fprintf(stderr, "\nRedirection is not supported.\n"); exit(1); } #if defined(_MSC_VER) && _MSC_VER >= 1800 /* VS2013 and above can't build */ is_nt = TRUE; /* non-NT (Win9x/3.1/ME) targets anyway, so always true */ #else is_nt = !(GetVersion() & 0x80000000); #endif GetConsoleScreenBufferInfo(pdc_con_out, &csbi); GetConsoleScreenBufferInfo(pdc_con_out, &orig_scr); GetConsoleMode(pdc_con_in, &old_console_mode); /* preserve QuickEdit Mode setting for use in PDC_mouse_set() when the mouse is not enabled -- other console input settings are cleared */ pdc_quick_edit = old_console_mode & 0x0040; SP->lines = (str = getenv("LINES")) ? atoi(str) : PDC_get_rows(); SP->cols = (str = getenv("COLS")) ? atoi(str) : PDC_get_columns(); SP->mouse_wait = PDC_CLICK_PERIOD; SP->audible = TRUE; if (SP->lines < 2 || SP->lines > csbi.dwMaximumWindowSize.Y) { fprintf(stderr, "LINES value must be >= 2 and <= %d: got %d\n", csbi.dwMaximumWindowSize.Y, SP->lines); return ERR; } if (SP->cols < 2 || SP->cols > csbi.dwMaximumWindowSize.X) { fprintf(stderr, "COLS value must be >= 2 and <= %d: got %d\n", csbi.dwMaximumWindowSize.X, SP->cols); return ERR; } SP->orig_fore = csbi.wAttributes & 0x0f; SP->orig_back = (csbi.wAttributes & 0xf0) >> 4; SP->orig_attr = TRUE; SP->_restore = PDC_RESTORE_NONE; if ((str = getenv("PDC_RESTORE_SCREEN")) == NULL || *str != '0') { /* Create a new console buffer */ pdc_con_out = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CONSOLE_TEXTMODE_BUFFER, NULL); if (pdc_con_out == INVALID_HANDLE_VALUE) { PDC_LOG(("PDC_scr_open() - screen buffer failure\n")); pdc_con_out = std_con_out; } else SP->_restore = PDC_RESTORE_BUFFER; } xcpt_filter = SetUnhandledExceptionFilter(_restore_console); SetConsoleCtrlHandler(_ctrl_break, TRUE); SP->_preserve = (getenv("PDC_PRESERVE_SCREEN") != NULL); PDC_reset_prog_mode(); SP->mono = FALSE; h_kernel = GetModuleHandleA("kernel32.dll"); pGetConsoleScreenBufferInfoEx = (GetConsoleScreenBufferInfoExFn)GetProcAddress(h_kernel, "GetConsoleScreenBufferInfoEx"); pSetConsoleScreenBufferInfoEx = (SetConsoleScreenBufferInfoExFn)GetProcAddress(h_kernel, "SetConsoleScreenBufferInfoEx"); return OK; } /* Calls SetConsoleWindowInfo with the given parameters, but fits them if a scoll bar shrinks the maximum possible value. The rectangle must at least fit in a half-sized window. */ static BOOL _fit_console_window(HANDLE con_out, CONST SMALL_RECT *rect) { SMALL_RECT run; SHORT mx, my; if (SetConsoleWindowInfo(con_out, TRUE, rect)) return TRUE; run = *rect; run.Right /= 2; run.Bottom /= 2; mx = run.Right; my = run.Bottom; if (!SetConsoleWindowInfo(con_out, TRUE, &run)) return FALSE; for (run.Right = rect->Right; run.Right >= mx; run.Right--) if (SetConsoleWindowInfo(con_out, TRUE, &run)) break; if (run.Right < mx) return FALSE; for (run.Bottom = rect->Bottom; run.Bottom >= my; run.Bottom--) if (SetConsoleWindowInfo(con_out, TRUE, &run)) return TRUE; return FALSE; } /* the core of resize_term() */ int PDC_resize_screen(int nlines, int ncols) { SMALL_RECT rect; COORD size, max; if( nlines || ncols) { if (nlines < 2 || ncols < 2) return ERR; if( !stdscr) /* window hasn't been created yet; we're */ { /* specifying its size before doing so */ return OK; /* ...which doesn't work (yet) on Win32 */ } max = GetLargestConsoleWindowSize(pdc_con_out); rect.Left = rect.Top = 0; rect.Right = ncols - 1; if (rect.Right > max.X) rect.Right = max.X; rect.Bottom = nlines - 1; if (rect.Bottom > max.Y) rect.Bottom = max.Y; size.X = rect.Right + 1; size.Y = rect.Bottom + 1; _fit_console_window(pdc_con_out, &rect); SetConsoleScreenBufferSize(pdc_con_out, size); _fit_console_window(pdc_con_out, &rect); SetConsoleScreenBufferSize(pdc_con_out, size); SetConsoleActiveScreenBuffer(pdc_con_out); } PDC_flushinp(); SP->resized = FALSE; SP->cursrow = SP->curscol = 0; return OK; } void PDC_reset_prog_mode(void) { PDC_LOG(("PDC_reset_prog_mode() - called.\n")); if (pdc_con_out != std_con_out) SetConsoleActiveScreenBuffer(pdc_con_out); else if (is_nt) { COORD bufsize; SMALL_RECT rect; bufsize.X = orig_scr.srWindow.Right - orig_scr.srWindow.Left + 1; bufsize.Y = orig_scr.srWindow.Bottom - orig_scr.srWindow.Top + 1; rect.Top = rect.Left = 0; rect.Bottom = bufsize.Y - 1; rect.Right = bufsize.X - 1; SetConsoleScreenBufferSize(pdc_con_out, bufsize); SetConsoleWindowInfo(pdc_con_out, TRUE, &rect); SetConsoleScreenBufferSize(pdc_con_out, bufsize); SetConsoleActiveScreenBuffer(pdc_con_out); } PDC_mouse_set(); } void PDC_reset_shell_mode(void) { PDC_LOG(("PDC_reset_shell_mode() - called.\n")); if (pdc_con_out != std_con_out) SetConsoleActiveScreenBuffer(std_con_out); else if (is_nt) { SetConsoleScreenBufferSize(pdc_con_out, orig_scr.dwSize); SetConsoleWindowInfo(pdc_con_out, TRUE, &orig_scr.srWindow); SetConsoleScreenBufferSize(pdc_con_out, orig_scr.dwSize); SetConsoleWindowInfo(pdc_con_out, TRUE, &orig_scr.srWindow); SetConsoleActiveScreenBuffer(pdc_con_out); } SetConsoleMode(pdc_con_in, old_console_mode | ENABLE_EXTENDED_FLAGS); } void PDC_restore_screen_mode(int i) { } void PDC_save_screen_mode(int i) { } void PDC_init_pair(short pair, short fg, short bg) { unsigned char att, temp_bg; chtype i; fg = curstoreal[fg]; bg = curstoreal[bg]; for (i = 0; i < PDC_OFFSET; i++) { att = fg | (bg << 4); if (i & (A_REVERSE >> PDC_ATTR_SHIFT)) att = bg | (fg << 4); if (i & (A_UNDERLINE >> PDC_ATTR_SHIFT)) att = 1; if (i & (A_INVIS >> PDC_ATTR_SHIFT)) { temp_bg = att >> 4; att = temp_bg << 4 | temp_bg; } if (i & (A_BOLD >> PDC_ATTR_SHIFT)) att |= 8; if (i & (A_BLINK >> PDC_ATTR_SHIFT)) att |= 128; pdc_atrtab[pair * PDC_OFFSET + i] = att; } } int PDC_pair_content(short pair, short *fg, short *bg) { *fg = realtocurs[pdc_atrtab[pair * PDC_OFFSET] & 0x0F]; *bg = realtocurs[(pdc_atrtab[pair * PDC_OFFSET] & 0xF0) >> 4]; return OK; } bool PDC_can_change_color(void) { return is_nt; } int PDC_color_content(short color, short *red, short *green, short *blue) { COLORREF *color_table = _get_colors(); if (color_table) { DWORD col = color_table[curstoreal[color]]; *red = DIVROUND(GetRValue(col) * 1000, 255); *green = DIVROUND(GetGValue(col) * 1000, 255); *blue = DIVROUND(GetBValue(col) * 1000, 255); return OK; } return ERR; } int PDC_init_color(short color, short red, short green, short blue) { COLORREF *color_table = _get_colors(); if (color_table) { color_table[curstoreal[color]] = RGB(DIVROUND(red * 255, 1000), DIVROUND(green * 255, 1000), DIVROUND(blue * 255, 1000)); return _set_colors(); } return ERR; } /* Does nothing in the Win32 flavor of PDCurses. Included solely because without this, we get an unresolved external... */ void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines, const int new_min_cols, const int new_max_cols) { } /* PDC_set_function_key() does nothing on this platform */ int PDC_set_function_key( const unsigned function, const int new_key) { int old_key = -1; if( function < PDC_MAX_FUNCTION_KEYS) { old_key = PDC_shutdown_key[function]; PDC_shutdown_key[function] = new_key; } return( old_key); } curses-1.4.4/vendor/PDCurses/wincon/Makefile.mng0000644000004100000410000000666214201713275021572 0ustar www-datawww-data# GNU MAKE Makefile for PDCurses library - Windows console MinGW GCC # # Usage: make -f [path\]Makefile.mng [DEBUG=Y] [DLL=Y] [WIDE=Y] [UTF8=Y] [target] # # where target can be any of: # [all|demos|pdcurses.a|testcurs.exe...] O = o ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. endif include $(PDCURSES_SRCDIR)/version.mif include $(PDCURSES_SRCDIR)/libobjs.mif uname_S := $(shell uname -s 2>/dev/null) CAT = cat PREFIX = PATH_SEP = / CP = cp DELETE = rm -f # It appears we have three cases: we're running in Cygwin/MSYS; or we're # running in command.com on Windows with MinGW; or we're on Linux or BSD # or similar system, cross-compiling with MinGW. ifneq (,$(findstring CYGWIN,$(uname_S))) # Insert Cygwin-specific changes here ON_WINDOWS = 1 endif ifneq (,$(findstring MINGW32_NT,$(uname_S))) # Insert MINGW32-specific changes here ON_WINDOWS = 1 endif ifneq (,$(findstring MINGW64_NT,$(uname_S))) # Insert MINGW64-specific changes here ON_WINDOWS = 1 endif ifeq ($(uname_S),) CAT = type PATH_SEP = \\ CP = -copy DELETE = -del ON_WINDOWS = 1 endif # If we aren't on Windows, assume MinGW on a Linux-like host # Only decision is: are we doing a 64-bit compile (_w64 defined)? ifndef ON_WINDOWS ifdef _w64 PREFIX = x86_64-w64-mingw32- else PREFIX = i686-w64-mingw32- endif endif osdir = $(PDCURSES_SRCDIR)/wincon PDCURSES_WIN_H = $(osdir)/pdcwin.h CC = $(PREFIX)gcc ifeq ($(DEBUG),Y) CFLAGS = -g -Wall -DPDCDEBUG LDFLAGS = -g else CFLAGS = -O4 -Wall -pedantic LDFLAGS = endif CFLAGS += -I$(PDCURSES_SRCDIR) ifdef CHTYPE_32 CFLAGS += -DCHTYPE_32 endif ifdef CHTYPE_16 CFLAGS += -DCHTYPE_16 endif ifeq ($(WIDE),Y) CFLAGS += -DPDC_WIDE endif ifeq ($(UTF8),Y) CFLAGS += -DPDC_FORCE_UTF8 endif ifeq ($(INFOEX),N) PDCCFLAGS += -DHAVE_NO_INFOEX else ifeq ($(INFOEX),Y) PDCCFLAGS += -DHAVE_INFOEX endif endif LINK = $(PREFIX)gcc ifeq ($(DLL),Y) CFLAGS += -DPDC_DLL_BUILD LIBEXE = $(PREFIX)gcc LIBFLAGS = -Wl,--out-implib,pdcurses.a -shared -o LIBCURSES = pdcurses.dll LIBDEPS = $(LIBOBJS) $(PDCOBJS) LIBSADDED = EXELIBS = CLEAN = $(LIBCURSES) *.a else LIBEXE = $(PREFIX)ar ifeq ($(PREFIX),) LIBFLAGS = rcv else LIBFLAGS = rv endif LIBCURSES = pdcurses.a LIBDEPS = $(LIBOBJS) $(PDCOBJS) LIBSADDED = EXELIBS = CLEAN = *.a endif .PHONY: all libs clean demos dist all: libs demos libs: $(LIBCURSES) clean: $(DELETE) *.o $(DELETE) *.exe $(DELETE) *.dll $(DELETE) $(CLEAN) demos: $(DEMOS) ifneq ($(DEBUG),Y) strip *.exe endif $(LIBCURSES) : $(LIBDEPS) $(LIBEXE) $(LIBFLAGS) $@ $? $(LIBSADDED) $(CP) pdcurses.a panel.a $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_WIN_H) $(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) panel.o : $(PANEL_HEADER) terminfo.o: $(TERM_HEADER) $(LIBOBJS) : %.o: $(srcdir)/%.c $(CC) -c $(CFLAGS) $< $(PDCOBJS) : %.o: $(osdir)/%.c $(CC) -c $(CFLAGS) $(PDCCFLAGS) $< firework.exe ozdemo.exe newtest.exe ptest.exe rain.exe testcurs.exe \ version.exe worm.exe xmas.exe: %.exe: $(demodir)/%.c $(CC) $(CFLAGS) -o$@ $< $(LIBCURSES) $(EXELIBS) tuidemo.exe: tuidemo.o tui.o $(LINK) $(LDFLAGS) -o$@ tuidemo.o tui.o $(LIBCURSES) $(EXELIBS) tui.o: $(demodir)/tui.c $(demodir)/tui.h $(PDCURSES_CURSES_H) $(CC) -c $(CFLAGS) -I$(demodir) -o$@ $< tuidemo.o: $(demodir)/tuidemo.c $(PDCURSES_CURSES_H) $(CC) -c $(CFLAGS) -I$(demodir) -o$@ $< PLATFORM1 = MinGW WinCon PLATFORM2 = MinGW for WinCon ARCNAME = pdc$(VER)_ming_wcon include $(PDCURSES_SRCDIR)/makedist.mif curses-1.4.4/vendor/PDCurses/.travis.yml0000644000004100000410000000402514201713275020155 0ustar www-datawww-datalanguage: c os: - linux - osx compiler: - gcc - clang env: - BUILD_TYPE=Debug CMAKE_ARGS="-DPDC_WIDE=OFF -DPDC_UTF8=OFF -DPDCDEBUG=ON" - BUILD_TYPE=Debug CMAKE_ARGS="-DPDC_WIDE=OFF -DPDC_UTF8=ON -DPDCDEBUG=ON" - BUILD_TYPE=Debug CMAKE_ARGS="-DPDC_WIDE=ON -DPDC_UTF8=OFF -DPDCDEBUG=ON" - BUILD_TYPE=Release CMAKE_ARGS="-DPDC_WIDE=OFF -DPDC_UTF8=OFF" - BUILD_TYPE=Release CMAKE_ARGS="-DPDC_WIDE=OFF -DPDC_UTF8=ON" - BUILD_TYPE=Release CMAKE_ARGS="-DPDC_WIDE=ON -DPDC_UTF8=OFF" - BUILD_TYPE=MinSizeRel CMAKE_ARGS="-DPDC_WIDE=OFF -DPDC_UTF8=OFF" - BUILD_TYPE=MinSizeRel CMAKE_ARGS="-DPDC_WIDE=OFF -DPDC_UTF8=ON" - BUILD_TYPE=MinSizeRel CMAKE_ARGS="-DPDC_WIDE=ON -DPDC_UTF8=OFF" addons: apt: packages: - libncurses5-dev - libncursesw5-dev - libxaw7-dev install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mkdir ${DEPS_DIR} && cd ${DEPS_DIR} && pwd; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then travis_retry wget --no-check-certificate https://cmake.org/files/v3.11/cmake-3.11.0-Linux-x86_64.tar.gz; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo "96d67e21f0983ebf0fffc5b106ec338c *cmake-3.11.0-Linux-x86_64.tar.gz" > cmake_md5.txt; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then md5sum -c cmake_md5.txt; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar -xvf cmake-3.11.0-Linux-x86_64.tar.gz > /dev/null; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mv cmake-3.11.0-Linux-x86_64 cmake-install; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then PATH=${DEPS_DIR}/cmake-install:${DEPS_DIR}/cmake-install/bin:$PATH; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ncurses; fi before_script: - cd ${TRAVIS_BUILD_DIR} - mkdir build && cd build - cmake -DCMAKE_VERBOSE_MAKEFILE=FALSE -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/build/dist ${CMAKE_ARGS} .. script: - cmake --build . --config ${BUILD_TYPE} --target install curses-1.4.4/vendor/PDCurses/Makefile0000644000004100000410000000067714201713275017515 0ustar www-datawww-data# Make archives for distribution include version.mif PDC_DIR=PDCurses-$(VERDOT) ZIPFILE = pdcurs$(VER).zip TARBALL = $(PDC_DIR).tar.gz all: @echo Look in folders for platform-specific build instructions. manual: cd man; $(MAKE) $(MFLAGS) $@ $(ZIPFILE): zip -9ory $(ZIPFILE) * zip: $(ZIPFILE) ../$(TARBALL): (cd ..; tar cvf - $(PDC_DIR)/* | gzip -9 > $(TARBALL)) dist: ../$(TARBALL) rpm: ../$(TARBALL) rpmbuild -ba x11/PDCurses.spec curses-1.4.4/vendor/PDCurses/README.md0000644000004100000410000000563714201713275017335 0ustar www-datawww-dataWelcome to PDCurses! ==================== Public Domain Curses, aka PDCurses, is an implementation of X/Open curses for multiple platforms. Relative to the 'official' PDCurses project, this has a variety of improvements, adding a Windows GUI and a VT-like console "flavor" of Curses and expanding the capabilities of the other flavors (SDL1, SDL2, X11, Win32 console, OS/2, and DOS). Some details and screen shots at https://www.projectpluto.com/win32a.htm Much of this was done during a long period in which 'official' PDCurses was inactive. It is hoped that the changes in this fork can be merged into the 'official' PDCurses, and a pull request has been made. But the split is looking increasingly permanent. Legal Stuff ----------- The core package is in the public domain, but small portions of PDCurses are subject to copyright under various licenses. Each directory contains a README file, with a section titled "Distribution Status" which describes the status of the files in that directory. If you use PDCurses in an application, an acknowledgement would be appreciated, but is not mandatory. If you make corrections or enhancements to PDCurses, please forward them to the current maintainer for the benefit of other users. This software is provided AS IS with NO WARRANTY whatsoever. Ports ----- PDCurses has been ported to DOS, OS/2, Win32, X11 and SDL1 and SDL2, and this version adds a Windows graphical and VT-like console flavor. A directory containing the port-specific source files exists for each of these platforms. Build instructions are in the README file for each platform: - [DOS](dos/README.md) for use on DOS - [OS/2](os2/README.md) for use on OS/2 - [SDL 1.x](sdl1/README.md) for use as separate SDL version 1 window - [SDL 2.x](sdl2/README.md) for use as separate SDL version 2 window - [wincon](wincon/README.md) (formerly win32) for use on Windows Console - [WinGUI](wingui/README.md) for use on Windows Graphics Mode - [X11](x11/README.md) (also called XCurses) for use as separate X11 window - [VT](vt/README.md) for use on terminal Distribution Status ------------------- All files in this directory except configure, config.guess and config.sub are released to the Public Domain. config.guess and config.sub are under the GPL; configure is under a free license described within it. Build Status ------------------- PDCurses is automatically build in multiple environments: [![Build status Travis-CI](https://api.travis-ci.com/Bill-Gray/PDCurses.svg?branch=master)](https://travis-ci.com/Bill-Gray/PDCurses) , also providing artifacts: [![Build status Appveyor](https://ci.appveyor.com/api/projects/status/github/Bill-Gray/PDCurses?branch=master&svg=true)](https://ci.appveyor.com/project/Bill-Gray/PDCurses) Maintainer ---------- William McBrine ("official" PDCurses) Bill Gray p‮ôç.ötulpťcéjôřp@otúl‬m (this fork) curses-1.4.4/vendor/PDCurses/x11/0000755000004100000410000000000014201713275016454 5ustar www-datawww-datacurses-1.4.4/vendor/PDCurses/x11/pdcx11.h0000644000004100000410000001065014201713275017727 0ustar www-datawww-data/* Public Domain Curses */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #ifdef HAVE_UNISTD_H # include #endif #include #include #include #include #include #ifdef HAVE_FCNTL_H # include #endif #ifdef HAVE_SYS_SELECT_H # include /* AIX needs this for FD_ZERO etc macros */ #endif #include #include #ifdef TIME_WITH_SYS_TIME # include # include #else # ifdef HAVE_SYS_TIME_H # include # else # include # endif #endif #include #include #include #ifdef USE_XAW3D # include # include #elif defined(USE_NEXTAW) # include # include #else # include # include #endif #include "x11/ScrollBox.h" #include "Xmu/StdSel.h" #include "Xmu/Atoms.h" #include #include #define XCURSCR_Y_SIZE (XCursesLINES * XCursesCOLS * sizeof(chtype)) #define XCURSCR_FLAG_SIZE (XCursesLINES * sizeof(int)) #define XCURSCR_START_SIZE (XCursesLINES * sizeof(int)) #define XCURSCR_LENGTH_SIZE (XCursesLINES * sizeof(int)) #define XCURSCR_ATRTAB_SIZE (PDC_COLOR_PAIRS * 2 * sizeof(short)) #define XCURSCR_SIZE (XCURSCR_FLAG_SIZE + XCURSCR_START_SIZE + \ XCURSCR_LENGTH_SIZE + XCURSCR_Y_SIZE + XCURSCR_ATRTAB_SIZE + \ sizeof(XColor)) #define XCURSCR_Y_OFF(y) ((y) * XCursesCOLS * sizeof(chtype)) #define XCURSCR_FLAG_OFF (XCURSCR_Y_OFF(0) + XCURSCR_Y_SIZE) #define XCURSCR_START_OFF (XCURSCR_FLAG_OFF + XCURSCR_FLAG_SIZE) #define XCURSCR_LENGTH_OFF (XCURSCR_START_OFF + XCURSCR_START_SIZE) #define XCURSCR_ATRTAB_OFF (XCURSCR_LENGTH_OFF + XCURSCR_LENGTH_SIZE) #define XCURSCR_XCOLOR_OFF (XCURSCR_ATRTAB_OFF + XCURSCR_ATRTAB_SIZE) typedef struct { int lines; int cols; Pixel cursorColor; Pixel colorBlack; Pixel colorRed; Pixel colorGreen; Pixel colorYellow; Pixel colorBlue; Pixel colorMagenta; Pixel colorCyan; Pixel colorWhite; Pixel colorBoldBlack; Pixel colorBoldRed; Pixel colorBoldGreen; Pixel colorBoldYellow; Pixel colorBoldBlue; Pixel colorBoldMagenta; Pixel colorBoldCyan; Pixel colorBoldWhite; Pixel pointerForeColor; Pixel pointerBackColor; XFontStruct *normalFont; XFontStruct *italicFont; XFontStruct *boldFont; char *bitmap; #ifdef HAVE_XPM_H char *pixmap; #endif char *composeKey; Cursor pointer; int shmmin; int borderWidth; int borderColor; int clickPeriod; int doubleClickPeriod; int scrollbarWidth; int cursorBlinkRate; char *textCursor; } XCursesAppData; extern XCursesAppData xc_app_data; #define XCURSESSHMMIN xc_app_data.shmmin #define XCLOGMSG (XCursesProcess ? " X" : "CURSES") void XC_get_line_lock(int); void XC_release_line_lock(int); int PDC_display_cursor(int, int, int, int, int); void XCursesExitCursesProcess(int, char *); int XCursesInstruct(int); int XCursesInstructAndWait(int); int XCursesInitscr(int, char **); int XC_write_socket(int, const void *, int); int XC_read_socket(int, void *, int); int XC_write_display_socket_int(int); int XCursesSetupX(int argc, char *argv[]); RETSIGTYPE XCursesSigwinchHandler(int signo); #ifdef _HPUX_SOURCE # define FD_SET_CAST int * #else # define FD_SET_CAST fd_set * #endif extern fd_set xc_readfds; extern unsigned char *Xcurscr; extern int XCursesProcess; extern int shmidSP; extern int shmid_Xcurscr; extern int shmkeySP; extern int shmkey_Xcurscr; extern int xc_otherpid; extern int XCursesLINES; extern int XCursesCOLS; extern int xc_display_sock; extern int xc_key_sock; extern int xc_display_sockets[2]; extern int xc_key_sockets[2]; extern int xc_exit_sock; typedef RETSIGTYPE (*signal_handler)(); signal_handler XCursesSetSignal(int, signal_handler); #ifdef PDCDEBUG void XC_say(const char *msg); # define XC_LOG(x) XC_say x #else # define XC_LOG(x) #endif #ifdef MOUSE_DEBUG # define MOUSE_LOG(x) printf x #else # define MOUSE_LOG(x) #endif enum { CURSES_CLEAR_SELECTION, CURSES_DISPLAY_CURSOR, CURSES_SET_SELECTION, CURSES_GET_SELECTION, CURSES_TITLE, CURSES_REFRESH_SCROLLBAR, CURSES_RESIZE, CURSES_BELL, CURSES_CONTINUE, CURSES_CURSOR, CURSES_CHILD, CURSES_REFRESH, CURSES_GET_COLOR, CURSES_SET_COLOR, CURSES_BLINK_ON, CURSES_BLINK_OFF, CURSES_EXIT }; extern short *xc_atrtab; curses-1.4.4/vendor/PDCurses/x11/install-sh0000755000004100000410000001457314201713275020472 0ustar www-datawww-data#! /bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. # # Modified 1 Feb 2000 MHES to cater for mkdir -p # doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" mkdircmd="$mkdirprog -p" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdircmd "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 curses-1.4.4/vendor/PDCurses/x11/x11.c0000644000004100000410000033055514201713275017244 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcx11.h" #ifdef HAVE_DECKEYSYM_H # include #endif #ifdef HAVE_SUNKEYSYM_H # include #endif #ifdef HAVE_XPM_H # include #endif #if defined PDC_XIM # include #endif #ifdef HAVE_XF86KEYSYM_H # include #endif #include #include #ifndef XPOINTER_TYPEDEFED typedef char * XPointer; #endif #ifndef MAX_PATH # define MAX_PATH 256 #endif XCursesAppData xc_app_data; #if NeedWidePrototypes # define PDC_SCROLLBAR_TYPE double #else # define PDC_SCROLLBAR_TYPE float #endif #define MAX_COLORS 256 /* maximum of "normal" colors */ #define COLOR_CURSOR MAX_COLORS /* color of cursor */ #define COLOR_BORDER MAX_COLORS + 1 /* color of border */ #define XCURSESDISPLAY (XtDisplay(drawing)) #define XCURSESWIN (XtWindow(drawing)) /* Default icons for XCurses applications. */ #include "big_icon.xbm" #include "little_icon.xbm" #define CURSOR_BLINK_RATE 500 /* Used to be set in xc_app_data.cursorBlinkRate */ static void _selection_off(void); static void _display_cursor(int, int, int, int); static void _redraw_cursor(void); static void _exit_process(int, int, char *); static void _send_key_to_curses(unsigned long, MOUSE_STATUS *, bool); static void XCursesButton(Widget, XEvent *, String *, Cardinal *); static void XCursesHandleString(Widget, XEvent *, String *, Cardinal *); static void XCursesKeyPress(Widget, XEvent *, String *, Cardinal *); static void XCursesPasteSelection(Widget, XButtonEvent *); static struct { KeySym keycode; bool numkeypad; unsigned short normal; unsigned short shifted; unsigned short control; unsigned short alt; } key_table[] = { /* keycode keypad normal shifted control alt*/ {';', FALSE, ';', ':', CTL_SEMICOLON, ALT_SEMICOLON }, {'=', FALSE, '=', '+', CTL_EQUAL, ALT_EQUAL }, {',', FALSE, ',', '<', CTL_COMMA, ALT_COMMA }, {'-', FALSE, '-', '_', CTL_MINUS, ALT_MINUS }, {'.', FALSE, '.', '>', CTL_STOP, ALT_STOP }, {'/', FALSE, '/', '?', CTL_FSLASH, ALT_FSLASH }, {'`', FALSE, '`', '~', CTL_BQUOTE, ALT_BQUOTE }, /* keycode keypad normal shifted control alt*/ {XK_Left, FALSE, KEY_LEFT, KEY_SLEFT, CTL_LEFT, ALT_LEFT}, {XK_Right, FALSE, KEY_RIGHT, KEY_SRIGHT, CTL_RIGHT, ALT_RIGHT}, {XK_Up, FALSE, KEY_UP, KEY_SUP, CTL_UP, ALT_UP}, {XK_Down, FALSE, KEY_DOWN, KEY_SDOWN, CTL_DOWN, ALT_DOWN}, {XK_Home, FALSE, KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME}, /* Sun Type 4 keyboard */ {XK_R7, FALSE, KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME}, {XK_End, FALSE, KEY_END, KEY_SEND, CTL_END, ALT_END}, /* Sun Type 4 keyboard */ {XK_R13, FALSE, KEY_END, KEY_SEND, CTL_END, ALT_END}, {XK_Prior, FALSE, KEY_PPAGE, KEY_SPREVIOUS,CTL_PGUP, ALT_PGUP}, /* Sun Type 4 keyboard */ {XK_R9, FALSE, KEY_PPAGE, KEY_SPREVIOUS,CTL_PGUP, ALT_PGUP}, {XK_Next, FALSE, KEY_NPAGE, KEY_SNEXT, CTL_PGDN, ALT_PGDN}, /* Sun Type 4 keyboard */ {XK_R15, FALSE, KEY_NPAGE, KEY_SNEXT, CTL_PGDN, ALT_PGDN}, {XK_Insert, FALSE, KEY_IC, KEY_SIC, CTL_INS, ALT_INS}, {XK_Delete, FALSE, KEY_DC, KEY_SDC, CTL_DEL, ALT_DEL}, {XK_F1, FALSE, KEY_F(1), KEY_F(13), KEY_F(25), KEY_F(37)}, {XK_F2, FALSE, KEY_F(2), KEY_F(14), KEY_F(26), KEY_F(38)}, {XK_F3, FALSE, KEY_F(3), KEY_F(15), KEY_F(27), KEY_F(39)}, {XK_F4, FALSE, KEY_F(4), KEY_F(16), KEY_F(28), KEY_F(40)}, {XK_F5, FALSE, KEY_F(5), KEY_F(17), KEY_F(29), KEY_F(41)}, {XK_F6, FALSE, KEY_F(6), KEY_F(18), KEY_F(30), KEY_F(42)}, {XK_F7, FALSE, KEY_F(7), KEY_F(19), KEY_F(31), KEY_F(43)}, {XK_F8, FALSE, KEY_F(8), KEY_F(20), KEY_F(32), KEY_F(44)}, {XK_F9, FALSE, KEY_F(9), KEY_F(21), KEY_F(33), KEY_F(45)}, {XK_F10, FALSE, KEY_F(10), KEY_F(22), KEY_F(34), KEY_F(46)}, {XK_F11, FALSE, KEY_F(11), KEY_F(23), KEY_F(35), KEY_F(47)}, {XK_F12, FALSE, KEY_F(12), KEY_F(24), KEY_F(36), KEY_F(48)}, {XK_F13, FALSE, KEY_F(13), KEY_F(25), KEY_F(37), KEY_F(49)}, {XK_F14, FALSE, KEY_F(14), KEY_F(26), KEY_F(38), KEY_F(50)}, {XK_F15, FALSE, KEY_F(15), KEY_F(27), KEY_F(39), KEY_F(51)}, {XK_F16, FALSE, KEY_F(16), KEY_F(28), KEY_F(40), KEY_F(52)}, {XK_F17, FALSE, KEY_F(17), KEY_F(29), KEY_F(41), KEY_F(53)}, {XK_F18, FALSE, KEY_F(18), KEY_F(30), KEY_F(42), KEY_F(54)}, {XK_F19, FALSE, KEY_F(19), KEY_F(31), KEY_F(43), KEY_F(55)}, {XK_F20, FALSE, KEY_F(20), KEY_F(32), KEY_F(44), KEY_F(56)}, {XK_BackSpace, FALSE, 0x08, 0x08, CTL_BKSP, ALT_BKSP}, {XK_Tab, FALSE, 0x09, KEY_BTAB, CTL_TAB, ALT_TAB}, #if defined(XK_ISO_Left_Tab) {XK_ISO_Left_Tab, FALSE, 0x09, KEY_BTAB, CTL_TAB, ALT_TAB}, #endif {XK_Select, FALSE, KEY_SELECT, KEY_SELECT, KEY_SELECT, KEY_SELECT}, {XK_Print, FALSE, KEY_PRINT, KEY_SPRINT, KEY_PRINT, KEY_PRINT}, {XK_Find, FALSE, KEY_FIND, KEY_SFIND, KEY_FIND, KEY_FIND}, {XK_Pause, FALSE, KEY_SUSPEND, KEY_SSUSPEND, KEY_SUSPEND, KEY_SUSPEND}, {XK_Clear, FALSE, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR}, {XK_Cancel, FALSE, KEY_CANCEL, KEY_SCANCEL, KEY_CANCEL, KEY_CANCEL}, {XK_Break, FALSE, KEY_BREAK, KEY_BREAK, KEY_BREAK, KEY_BREAK}, {XK_Help, FALSE, KEY_HELP, KEY_SHELP, KEY_LHELP, KEY_HELP}, {XK_L4, FALSE, KEY_UNDO, KEY_SUNDO, KEY_UNDO, KEY_UNDO}, {XK_L6, FALSE, KEY_COPY, KEY_SCOPY, KEY_COPY, KEY_COPY}, {XK_L9, FALSE, KEY_FIND, KEY_SFIND, KEY_FIND, KEY_FIND}, {XK_Menu, FALSE, KEY_OPTIONS, KEY_SOPTIONS, KEY_OPTIONS, KEY_OPTIONS}, {XK_Super_R, FALSE, KEY_COMMAND, KEY_SCOMMAND, KEY_COMMAND, KEY_COMMAND}, {XK_Super_L, FALSE, KEY_COMMAND, KEY_SCOMMAND, KEY_COMMAND, KEY_COMMAND}, #ifdef HAVE_SUNKEYSYM_H {SunXK_F36, FALSE, KEY_F(41), KEY_F(43), KEY_F(45), KEY_F(47)}, {SunXK_F37, FALSE, KEY_F(42), KEY_F(44), KEY_F(46), KEY_F(48)}, #endif #ifdef HAVE_DECKEYSYM_H {DXK_Remove, FALSE, KEY_DC, KEY_SDC, CTL_DEL, ALT_DEL}, #endif {XK_Escape, FALSE, 0x1B, 0x1B, 0x1B, ALT_ESC}, {XK_KP_Enter, TRUE, PADENTER, PADENTER, CTL_PADENTER,ALT_PADENTER}, {XK_KP_Add, TRUE, PADPLUS, '+', CTL_PADPLUS, ALT_PADPLUS}, {XK_KP_Subtract,TRUE, PADMINUS, '-', CTL_PADMINUS,ALT_PADMINUS}, {XK_KP_Multiply,TRUE, PADSTAR, '*', CTL_PADSTAR, ALT_PADSTAR}, /* Sun Type 4 keyboard */ {XK_R6, TRUE, PADSTAR, '*', CTL_PADSTAR, ALT_PADSTAR}, {XK_KP_Divide, TRUE, PADSLASH, '/', CTL_PADSLASH,ALT_PADSLASH}, /* Sun Type 4 keyboard */ {XK_R5, TRUE, PADSLASH, '/', CTL_PADSLASH,ALT_PADSLASH}, {XK_KP_Decimal,TRUE, PADSTOP, '.', CTL_PADSTOP, ALT_PADSTOP}, {XK_KP_0, TRUE, PAD0, '0', CTL_PAD0, ALT_PAD0}, {XK_KP_1, TRUE, KEY_C1, '1', CTL_PAD1, ALT_PAD1}, {XK_KP_2, TRUE, KEY_C2, '2', CTL_PAD2, ALT_PAD2}, {XK_KP_3, TRUE, KEY_C3, '3', CTL_PAD3, ALT_PAD3}, {XK_KP_4, TRUE, KEY_B1, '4', CTL_PAD4, ALT_PAD4}, {XK_KP_5, TRUE, KEY_B2, '5', CTL_PAD5, ALT_PAD5}, /* Sun Type 4 keyboard */ {XK_R11, TRUE, KEY_B2, '5', CTL_PAD5, ALT_PAD5}, {XK_KP_6, TRUE, KEY_B3, '6', CTL_PAD6, ALT_PAD6}, {XK_KP_7, TRUE, KEY_A1, '7', CTL_PAD7, ALT_PAD7}, {XK_KP_8, TRUE, KEY_A2, '8', CTL_PAD8, ALT_PAD8}, {XK_KP_9, TRUE, KEY_A3, '9', CTL_PAD9, ALT_PAD9}, /* the following added to support Sun Type 5 keyboards */ {XK_F21, FALSE, KEY_SUSPEND, KEY_SSUSPEND, KEY_SUSPEND, KEY_SUSPEND}, {XK_F22, FALSE, KEY_PRINT, KEY_SPRINT, KEY_PRINT, KEY_PRINT}, {XK_F24, TRUE, PADMINUS, '-', CTL_PADMINUS,ALT_PADMINUS}, /* Sun Type 4 keyboard */ {XK_F25, TRUE, PADSLASH, '/', CTL_PADSLASH,ALT_PADSLASH}, /* Sun Type 4 keyboard */ {XK_F26, TRUE, PADSTAR, '*', CTL_PADSTAR, ALT_PADSTAR}, {XK_F27, TRUE, KEY_A1, '7', CTL_PAD7, ALT_PAD7}, {XK_F29, TRUE, KEY_A3, '9', CTL_PAD9, ALT_PAD9}, {XK_F31, TRUE, KEY_B2, '5', CTL_PAD5, ALT_PAD5}, {XK_F35, TRUE, KEY_C3, '3', CTL_PAD3, ALT_PAD3}, #ifdef HAVE_XK_KP_DELETE {XK_KP_Delete, TRUE, PADSTOP, '.', CTL_PADSTOP, ALT_PADSTOP}, #endif #ifdef HAVE_XK_KP_INSERT {XK_KP_Insert, TRUE, PAD0, '0', CTL_PAD0, ALT_PAD0}, #endif #ifdef HAVE_XK_KP_END {XK_KP_End, TRUE, KEY_C1, '1', CTL_PAD1, ALT_PAD1}, #endif #ifdef HAVE_XK_KP_DOWN {XK_KP_Down, TRUE, KEY_C2, '2', CTL_PAD2, ALT_PAD2}, #endif #ifdef HAVE_XK_KP_NEXT {XK_KP_Next, TRUE, KEY_C3, '3', CTL_PAD3, ALT_PAD3}, #endif #ifdef HAVE_XK_KP_LEFT {XK_KP_Left, TRUE, KEY_B1, '4', CTL_PAD4, ALT_PAD4}, #endif #ifdef HAVE_XK_KP_BEGIN {XK_KP_Begin, TRUE, KEY_B2, '5', CTL_PAD5, ALT_PAD5}, #endif #ifdef HAVE_XK_KP_RIGHT {XK_KP_Right, TRUE, KEY_B3, '6', CTL_PAD6, ALT_PAD6}, #endif #ifdef HAVE_XK_KP_HOME {XK_KP_Home, TRUE, KEY_A1, '7', CTL_PAD7, ALT_PAD7}, #endif #ifdef HAVE_XK_KP_UP {XK_KP_Up, TRUE, KEY_A2, '8', CTL_PAD8, ALT_PAD8}, #endif #ifdef HAVE_XK_KP_PRIOR {XK_KP_Prior, TRUE, KEY_A3, '9', CTL_PAD9, ALT_PAD9}, #endif #ifdef XF86XK_Back {XF86XK_Back, FALSE, KEY_BROWSER_BACK, KEY_SBROWSER_BACK, KEY_CBROWSER_BACK, KEY_ABROWSER_BACK }, #endif #ifdef XF86XK_Forward {XF86XK_Forward, FALSE, KEY_BROWSER_FWD, KEY_SBROWSER_FWD, KEY_CBROWSER_FWD, KEY_ABROWSER_FWD }, #endif #ifdef XF86XK_Reload {XF86XK_Reload, FALSE, KEY_BROWSER_REF, KEY_SBROWSER_REF, KEY_CBROWSER_REF, KEY_ABROWSER_REF }, #endif #ifdef XF86XK_Search {XF86XK_Search, FALSE, KEY_SEARCH, KEY_SSEARCH, KEY_CSEARCH, KEY_ASEARCH }, #endif #ifdef XF86XK_Favorites {XF86XK_Favorites, FALSE, KEY_FAVORITES, KEY_SFAVORITES, KEY_CFAVORITES, KEY_AFAVORITES }, #endif #ifdef XF86XK_AudioPlay {XF86XK_AudioPlay, FALSE, KEY_PLAY_PAUSE, KEY_SPLAY_PAUSE, KEY_CPLAY_PAUSE, KEY_APLAY_PAUSE }, #endif #ifdef XF86XK_AudioStop {XF86XK_AudioStop, FALSE, KEY_MEDIA_STOP, KEY_SMEDIA_STOP, KEY_CMEDIA_STOP, KEY_AMEDIA_STOP }, #endif #ifdef XF86XK_AudioPrev {XF86XK_AudioPrev, FALSE, KEY_PREV_TRACK, KEY_SPREV_TRACK, KEY_CPREV_TRACK, KEY_APREV_TRACK }, #endif #ifdef XF86XK_AudioNext {XF86XK_AudioNext, FALSE, KEY_NEXT_TRACK, KEY_SNEXT_TRACK, KEY_CNEXT_TRACK, KEY_ANEXT_TRACK }, #endif #ifdef XF86XK_Tools {XF86XK_Tools, FALSE, KEY_MEDIA_SELECT, KEY_SMEDIA_SELECT, KEY_CMEDIA_SELECT, KEY_AMEDIA_SELECT }, #endif {0, 0, 0, 0, 0, 0} }; #ifndef PDC_XIM # include "compose.h" #endif #define BITMAPDEPTH 1 unsigned long pdc_key_modifiers = 0L; static GC normal_gc, bold_gc, block_cursor_gc, rect_cursor_gc, italic_gc, border_gc; static int font_height, font_width, font_ascent, font_descent, window_width, window_height; static int resize_window_width = 0, resize_window_height = 0; static char *bitmap_file = NULL; #ifdef HAVE_XPM_H static char *pixmap_file = NULL; #endif static KeySym keysym = 0; static int PDC_blink_state = 1; static int PDC_really_blinking = FALSE; /* see 'pdcsetsc.c' */ #ifndef PDC_XIM static int state_mask[8] = { ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask }; #endif static Atom wm_atom[2]; static String class_name = "XCurses"; static XtAppContext app_context; static Widget topLevel, drawing, scrollBox, scrollVert, scrollHoriz; static int received_map_notify = 0; static bool mouse_selection = FALSE; static chtype *tmpsel = NULL; static unsigned long tmpsel_length = 0; static int selection_start_x = 0, selection_start_y = 0, selection_end_x = 0, selection_end_y = 0; static Pixmap icon_bitmap; #ifdef HAVE_XPM_H static Pixmap icon_pixmap; static Pixmap icon_pixmap_mask; #endif static bool window_entered = TRUE; static char *program_name; /* Macros just for app_resources */ #ifdef PDC_WIDE # define DEFFONT "-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso10646-1" # define DEFBOLDFONT "-misc-fixed-bold-r-normal--13-120-75-75-c-70-iso10646-1" # define DEFITALICFONT "-misc-fixed-medium-o-normal--13-120-75-75-c-70-iso10646-1" #else # define DEFFONT "-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1" # define DEFBOLDFONT "-misc-fixed-bold-r-normal--13-120-75-75-c-70-iso8859-1" # define DEFITALICFONT "-misc-fixed-medium-o-normal--13-120-75-75-c-70-iso8859-1" #endif #define APPDATAOFF(n) XtOffsetOf(XCursesAppData, n) #define RINT(name1, name2, value) { \ #name1, #name2, XtRInt, \ sizeof(int), APPDATAOFF(name1), XtRImmediate, \ (XtPointer)value \ } #define RPIXEL(name1, name2, value) { \ #name1, #name2, XtRPixel, \ sizeof(Pixel), APPDATAOFF(name1), XtRString, \ (XtPointer)#value \ } #define RCOLOR(name, value) RPIXEL(color##name, Color##name, value) #define RSTRINGP(name1, name2, param) { \ #name1, #name2, XtRString, \ MAX_PATH, APPDATAOFF(name1), XtRString, (XtPointer)param \ } #define RSTRING(name1, name2) RSTRINGP(name1, name2, "") #define RFONT(name1, name2, value) { \ #name1, #name2, XtRFontStruct, \ sizeof(XFontStruct), APPDATAOFF(name1), XtRString, \ (XtPointer)value \ } #define RCURSOR(name1, name2, value) { \ #name1, #name2, XtRCursor, \ sizeof(Cursor), APPDATAOFF(name1), XtRString, \ (XtPointer)#value \ } static XtResource app_resources[] = { RINT(lines, Lines, 24), RINT(cols, Cols, 80), RPIXEL(cursorColor, CursorColor, Red), RCOLOR(Black, Black), RCOLOR(Red, red3), RCOLOR(Green, green3), RCOLOR(Yellow, yellow3), RCOLOR(Blue, blue3), RCOLOR(Magenta, magenta3), RCOLOR(Cyan, cyan3), RCOLOR(White, Grey), RCOLOR(BoldBlack, grey40), RCOLOR(BoldRed, red1), RCOLOR(BoldGreen, green1), RCOLOR(BoldYellow, yellow1), RCOLOR(BoldBlue, blue1), RCOLOR(BoldMagenta, magenta1), RCOLOR(BoldCyan, cyan1), RCOLOR(BoldWhite, White), RFONT(normalFont, NormalFont, DEFFONT), RFONT(italicFont, ItalicFont, DEFITALICFONT), RFONT(boldFont, BoldFont, DEFBOLDFONT), RSTRING(bitmap, Bitmap), #ifdef HAVE_XPM_H RSTRING(pixmap, Pixmap), #endif RSTRINGP(composeKey, ComposeKey, "Multi_key"), RCURSOR(pointer, Pointer, xterm), RPIXEL(pointerForeColor, PointerForeColor, Black), RPIXEL(pointerBackColor, PointerBackColor, White), RINT(shmmin, Shmmin, 0), RINT(borderWidth, BorderWidth, 0), RPIXEL(borderColor, BorderColor, Black), RINT(doubleClickPeriod, DoubleClickPeriod, (PDC_CLICK_PERIOD * 2)), RINT(clickPeriod, ClickPeriod, PDC_CLICK_PERIOD), RINT(scrollbarWidth, ScrollbarWidth, 15), RINT(cursorBlinkRate, CursorBlinkRate, 0), RSTRING(textCursor, TextCursor) }; #undef RCURSOR #undef RFONT #undef RSTRING #undef RCOLOR #undef RPIXEL /* #undef RINT */ /* #undef APPDATAOFF */ #undef DEFFONT #undef DEFBOLDFONT #undef DEFITALICFONT /* Macros for options */ #define COPT(name) {"-" #name, "*" #name, XrmoptionSepArg, NULL} #define CCOLOR(name) COPT(color##name) static XrmOptionDescRec options[] = { COPT(lines), COPT(cols), COPT(normalFont), COPT(italicFont), COPT(bitmap), COPT(boldFont), #ifdef HAVE_XPM_H COPT(pixmap), #endif COPT(pointer), COPT(shmmin), COPT(composeKey), COPT(clickPeriod), COPT(doubleClickPeriod), COPT(scrollbarWidth), COPT(pointerForeColor), COPT(pointerBackColor), COPT(cursorBlinkRate), COPT(cursorColor), COPT(textCursor), CCOLOR(Black), CCOLOR(Red), CCOLOR(Green), CCOLOR(Yellow), CCOLOR(Blue), CCOLOR(Magenta), CCOLOR(Cyan), CCOLOR(White), CCOLOR(BoldBlack), CCOLOR(BoldRed), CCOLOR(BoldGreen), CCOLOR(BoldYellow), CCOLOR(BoldBlue), CCOLOR(BoldMagenta), CCOLOR(BoldCyan), CCOLOR(BoldWhite) }; #undef CCOLOR #undef COPT static XtActionsRec action_table[] = { {"XCursesButton", (XtActionProc)XCursesButton}, {"XCursesKeyPress", (XtActionProc)XCursesKeyPress}, {"XCursesPasteSelection", (XtActionProc)XCursesPasteSelection}, {"string", (XtActionProc)XCursesHandleString} }; static bool after_first_curses_request = FALSE; static Pixel colors[MAX_COLORS + 2]; #ifdef PDC_XIM static XIM Xim = NULL; static XIC Xic = NULL; #endif static const char *default_translations = { ": XCursesKeyPress() \n" \ ": XCursesKeyPress() \n" \ ": XCursesButton() \n" \ ": XCursesButton() \n" \ ": XCursesButton()" }; static int _to_utf8(char *outcode, chtype code) { #ifdef PDC_WIDE if (code & A_ALTCHARSET && !(code & 0xff80)) code = acs_map[code & 0x7f]; #endif code &= A_CHARTEXT; if (code < 0x80) { outcode[0] = code; return 1; } else if (code < 0x800) { outcode[0] = ((code & 0x07c0) >> 6) | 0xc0; outcode[1] = (code & 0x003f) | 0x80; return 2; } else if( code < 0x10000) { outcode[0] = ((code & 0xf000) >> 12) | 0xe0; outcode[1] = ((code & 0x0fc0) >> 6) | 0x80; outcode[2] = (code & 0x003f) | 0x80; return 3; } else /* SMP: Unicode past 64K */ { outcode[0] = (code >> 18) | 0xf0; outcode[1] = ((code >> 12) & 0x3f) | 0x80; outcode[2] = ((code >> 6) & 0x3f) | 0x80; outcode[3] = ( code & 0x3f) | 0x80; return 4; } } static int _from_utf8(wchar_t *pwc, const char *s, size_t n) { wchar_t key; int i = -1; const unsigned char *string; if (!s || (n < 1)) return -1; if (!*s) return 0; string = (const unsigned char *)s; key = string[0]; /* Simplistic UTF-8 decoder -- minimal validation */ if (key & 0x80) { if ((key & 0xe0) == 0xc0) { if (1 < n) { key = ((key & 0x1f) << 6) | (string[1] & 0x3f); i = 2; } } else if ((key & 0xf0) == 0xe0) /* Unicode from 0x800 to 0xffff */ { if (2 < n) { key = ((key & 0x0f) << 12) | ((string[1] & 0x3f) << 6) | (string[2] & 0x3f); i = 3; } } else if ((key & 0xf8) == 0xf0) /* SMP: Unicode past 64K */ { if (3 < n) { key = ((key & 0x07) << 18) | ((string[1] & 0x3f) << 12) | ((string[2] & 0x3f) << 6) | (string[3] & 0x3f); i = 4; } } else fprintf(stderr, "Invalid UTF8\n"); } else i = 1; if (i) *pwc = key; return i; } #ifndef X_HAVE_UTF8_STRING static Atom XA_UTF8_STRING(Display *dpy) { static AtomPtr p = NULL; if (!p) p = XmuMakeAtom("UTF8_STRING"); return XmuInternAtom(dpy, p); } #endif signal_handler XCursesSetSignal(int signo, signal_handler action) { #if defined(SA_INTERRUPT) || defined(SA_RESTART) struct sigaction sigact, osigact; sigact.sa_handler = action; sigact.sa_flags = # ifdef SA_INTERRUPT # ifdef SA_RESTART SA_INTERRUPT | SA_RESTART; # else SA_INTERRUPT; # endif # else /* must be SA_RESTART */ SA_RESTART; # endif sigemptyset(&sigact.sa_mask); if (sigaction(signo, &sigact, &osigact)) return SIG_ERR; return osigact.sa_handler; #else /* not SA_INTERRUPT or SA_RESTART, use plain signal */ return signal(signo, action); #endif } RETSIGTYPE XCursesSigwinchHandler(int signo) { PDC_LOG(("%s:XCursesSigwinchHandler() - called: SIGNO: %d\n", XCLOGMSG, signo)); /* Patch by: Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 */ SP->resized += 1; /* Always trap SIGWINCH if the C library supports SIGWINCH */ #ifdef SIGWINCH XCursesSetSignal(SIGWINCH, XCursesSigwinchHandler); #endif } /* Convert character positions x and y to pixel positions, stored in xpos and ypos */ static void _make_xy(int x, int y, int *xpos, int *ypos) { *xpos = (x * font_width) + xc_app_data.borderWidth; *ypos = xc_app_data.normalFont->ascent + (y * font_height) + xc_app_data.borderWidth; } /* This function 'intensifies' a color by shifting it toward white. */ /* It used to average the input color with white. Then it did a */ /* weighted average: 2/3 of the input color, 1/3 white, for a */ /* lower "intensification" level. */ /* Then Mark Hessling suggested that the output level should */ /* remap zero to 85 (= 255 / 3, so one-third intensity), and input */ /* of 192 or greater should be remapped to 255 (full intensity). */ /* Assuming we want a linear response between zero and 192, that */ /* leads to output = 85 + input * (255-85)/192. */ /* This should lead to proper handling of bold text in legacy */ /* apps, where "bold" means "high intensity". */ /* NOTE that this is basically a clone of code in wingui/pdcdisp.c. */ /* The same basic logic should eventually be used in SDL, I think. */ static Pixel intensified_color( Pixel ival) { int rgb, i; Pixel oval = 0; for( i = 0; i < 3; i++, ival >>= 8) { rgb = (int)( ival & 0xff); if( rgb >= 192) rgb = 255; else rgb = 85 + rgb * (255 - 85) / 192; oval |= ((Pixel)rgb << (i * 8)); } return( oval); } /* For use in adjusting colors for A_DIMmed characters. Just */ /* knocks down the intensity of R, G, and B by 1/3. */ static Pixel dimmed_color( Pixel ival) { unsigned i; Pixel oval = 0; for( i = 0; i < 3; i++, ival >>= 8) { unsigned rgb = (unsigned)( ival & 0xff); rgb -= (rgb / 3); oval |= ((Pixel)rgb << (i * 8)); } return( oval); } /* see 'addch.c' for an explanation of how combining chars are handled. */ /* Though note that right now, it doesn't work at all; we'll have to */ /* arrange shared memory or communication between the X process and the */ /* "host" process... to be done later. */ #if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2 #ifdef PDC_WIDE #define USING_COMBINING_CHARACTER_SCHEME int PDC_expand_combined_characters( const cchar_t c, cchar_t *added); /* addch.c */ #endif /* PDC_get_rgb_values(), extract_packed_rgb(), intensified_component(), */ /* intensified_color(), and dimmed_color() each exist in x11/x11.c, */ /* wingui/pdcdisp.c, and sdl2/pdcdisp.c in forms slightly modified for */ /* each platform. But they all look pretty much alike. */ /* PDCurses stores RGBs in fifteen bits, five bits each */ /* for red, green, blue. A Pixel uses eight bits per */ /* channel. Hence the following. */ static Pixel extract_packed_rgb( const chtype color) { const int red = (int)( (color << 3) & 0xf8); const int green = (int)( (color >> 2) & 0xf8); const int blue = (int)( (color >> 7) & 0xf8); return( ((Pixel)red << 16) | ((Pixel)green << 8) | (Pixel)blue); } #endif void PDC_get_rgb_values( const chtype srcp, Pixel *foreground_rgb, Pixel *background_rgb) { bool reverse_colors = ((srcp & A_REVERSE) ? TRUE : FALSE); bool intensify_backgnd = FALSE; #if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2 if( srcp & A_RGB_COLOR) { /* Extract RGB from 30 bits of the color field */ *background_rgb = extract_packed_rgb( srcp >> PDC_COLOR_SHIFT); *foreground_rgb = extract_packed_rgb( srcp >> (PDC_COLOR_SHIFT + 15)); } else #endif { short foreground_index, background_index; PDC_pair_content( PAIR_NUMBER( srcp), &foreground_index, &background_index); *foreground_rgb = colors[foreground_index]; *background_rgb = colors[background_index]; } if( srcp & A_BLINK) { if( !PDC_really_blinking) /* convert 'blinking' to 'bold' */ intensify_backgnd = TRUE; else if( PDC_blink_state) reverse_colors = !reverse_colors; } if( reverse_colors) { const Pixel temp = *foreground_rgb; *foreground_rgb = *background_rgb; *background_rgb = temp; } if( srcp & A_BOLD) *foreground_rgb = intensified_color( *foreground_rgb); if( intensify_backgnd) *background_rgb = intensified_color( *background_rgb); if( srcp & A_DIM) *foreground_rgb = dimmed_color( *foreground_rgb); if( srcp & A_DIM) *background_rgb = dimmed_color( *background_rgb); } /* Output a block of characters with common attributes */ static int _new_packet( const chtype attr, const bool rev, const int len, const int col, const int row, #ifdef PDC_WIDE XChar2b *text) #else char *text) #endif { XRectangle bounds; GC gc; int xpos, ypos; Pixel foreground_rgb, background_rgb; #ifdef PDC_WIDE text[len].byte1 = text[len].byte2 = 0; #else text[len] = '\0'; #endif /* Determine which GC to use - normal or italic */ if ( attr & A_ITALIC ) { gc = italic_gc; } else if ( attr & A_BOLD ) { gc = bold_gc; } else { gc = normal_gc; } /* Draw it */ PDC_get_rgb_values( attr, &foreground_rgb, &background_rgb); if( rev) { const Pixel swap_val = foreground_rgb; foreground_rgb = background_rgb; background_rgb = swap_val; } XSetForeground(XCURSESDISPLAY, gc, foreground_rgb); XSetBackground(XCURSESDISPLAY, gc, background_rgb); _make_xy(col, row, &xpos, &ypos); bounds.x = xpos; bounds.y = ypos - font_ascent; bounds.width = font_width * len; bounds.height = font_height; XSetClipRectangles(XCURSESDISPLAY, gc, 0, 0, &bounds, 1, Unsorted); #ifdef PDC_WIDE XDrawImageString16( #else XDrawImageString( #endif XCURSESDISPLAY, XCURSESWIN, gc, xpos, ypos, text, len); /* Underline, etc. */ if (attr & (A_LEFTLINE|A_RIGHTLINE|A_UNDERLINE|A_OVERLINE|A_STRIKEOUT)) { int k; if (SP->line_color != -1) XSetForeground(XCURSESDISPLAY, gc, colors[SP->line_color]); if (attr & A_UNDERLINE) /* UNDER */ XDrawLine(XCURSESDISPLAY, XCURSESWIN, gc, xpos, ypos + xc_app_data.normalFont->descent-1, xpos + font_width * len, ypos + xc_app_data.normalFont->descent-1); /* xpos, ypos + 1, xpos + font_width * len, ypos + 1);*/ if (attr & A_OVERLINE) XDrawLine(XCURSESDISPLAY, XCURSESWIN, gc, xpos, ypos - font_ascent, xpos + font_width * len, ypos - font_ascent); if (attr & A_STRIKEOUT) XDrawLine(XCURSESDISPLAY, XCURSESWIN, gc, xpos, ypos + (font_descent - font_ascent) / 2, xpos + font_width * len, ypos + (font_descent - font_ascent) / 2); if (attr & A_LEFTLINE) /* LEFT */ for (k = 0; k < len; k++) { int x = xpos + font_width * k; XDrawLine(XCURSESDISPLAY, XCURSESWIN, gc, x, ypos - font_ascent, x, ypos + font_descent); } if (attr & A_RIGHTLINE) /* RIGHT */ for (k = 0; k < len; k++) { int x = xpos + font_width * (k + 1) - 1; XDrawLine(XCURSESDISPLAY, XCURSESWIN, gc, x, ypos - font_ascent, x, ypos + font_descent); } } PDC_LOG(("%s:_new_packet() - row: %d col: %d " "num_cols: %d fore: %d back: %d text:<%s>\n", XCLOGMSG, row, col, len, foreground_rgb, background_rgb, text)); return OK; } /* The core display routine -- update one line of text */ static int _display_text(const chtype *ch, int row, int col, int num_cols, bool highlight) { #ifdef PDC_WIDE XChar2b text[513]; #else char text[513]; #endif chtype old_attr, attr; int i, j; PDC_LOG(("%s:_display_text() - called: row: %d col: %d " "num_cols: %d\n", XCLOGMSG, row, col, num_cols)); if (!num_cols) return OK; old_attr = *ch & A_ATTRIBUTES; for (i = 0, j = 0; j < num_cols; j++) { chtype curr = ch[j]; attr = curr & A_ATTRIBUTES; #ifdef CHTYPE_LONG if (attr & A_ALTCHARSET && !(curr & 0xff80)) { attr ^= A_ALTCHARSET; curr = acs_map[curr & 0x7f]; } #endif #ifndef PDC_WIDE /* Special handling for ACS_BLOCK */ if (!(curr & A_CHARTEXT)) { curr |= ' '; attr ^= A_REVERSE; } #endif if (attr != old_attr || i > 100) { if (_new_packet(old_attr, highlight, i, col, row, text) == ERR) return ERR; old_attr = attr; col += i; i = 0; } #ifdef PDC_WIDE curr &= A_CHARTEXT; if( curr <= 0xffff) /* BMP Unicode */ { if( !curr) curr = ' '; text[i].byte1 = (curr & 0xff00) >> 8; text[i++].byte2 = curr & 0x00ff; } else /* SMP & combining chars */ { const chtype MAX_UNICODE = 0x110000; if( curr < MAX_UNICODE) /* Supplemental Multilingual Plane */ { /* (SMP); store w/surrogates */ const unsigned short part1 = (unsigned short) (0xd800 | ((curr - 0x10000) >> 10)); const unsigned short part2 = (unsigned short) (0xdc00 | (curr & 0x3ff)); text[i].byte1 = part1 >> 8; text[i++].byte2 = part1 & 0xff; text[i].byte1 = part2 >> 8; text[i++].byte2 = part2 & 0xff; } #ifdef USING_COMBINING_CHARACTER_SCHEME else if( curr > MAX_UNICODE) { #ifdef GOT_COMBINING_CHARS_IN_X cchar_t added[10]; int n_combined = 0; while( (curr = PDC_expand_combined_characters( curr, &added[n_combined])) > MAX_UNICODE) n_combined++; while( n_combined >= 0) { text[i].byte1 = added[n_combined] >> 8; text[i++].byte2 = added[n_combined] & 0xff; n_combined--; } #else text[i].byte1 = 0; text[i++].byte2 = '?'; #endif } #endif } #else /* non-wide case */ text[i++] = curr & 0xff; #endif } return _new_packet(old_attr, highlight, i, col, row, text); } static void _get_gc(GC *gc, XFontStruct *font_info, int fore, int back) { XGCValues values; /* Create default Graphics Context */ *gc = XCreateGC(XCURSESDISPLAY, XCURSESWIN, 0L, &values); /* specify font */ XSetFont(XCURSESDISPLAY, *gc, font_info->fid); #ifdef WHY_IS_THIS_HERE XSetForeground(XCURSESDISPLAY, *gc, colors[fore]); XSetBackground(XCURSESDISPLAY, *gc, colors[back]); #endif } #define RGB( R, G, B) (((unsigned long)(R)) << 16 \ | ((unsigned long)(G) << 8) | (unsigned long)(B)) static void _initialize_colors(void) { int i, r, g, b; colors[COLOR_BLACK] = xc_app_data.colorBlack; colors[COLOR_RED] = xc_app_data.colorRed; colors[COLOR_GREEN] = xc_app_data.colorGreen; colors[COLOR_YELLOW] = xc_app_data.colorYellow; colors[COLOR_BLUE] = xc_app_data.colorBlue; colors[COLOR_MAGENTA] = xc_app_data.colorMagenta; colors[COLOR_CYAN] = xc_app_data.colorCyan; colors[COLOR_WHITE] = xc_app_data.colorWhite; colors[COLOR_BLACK + 8] = xc_app_data.colorBoldBlack; colors[COLOR_RED + 8] = xc_app_data.colorBoldRed; colors[COLOR_GREEN + 8] = xc_app_data.colorBoldGreen; colors[COLOR_YELLOW + 8] = xc_app_data.colorBoldYellow; colors[COLOR_BLUE + 8] = xc_app_data.colorBoldBlue; colors[COLOR_MAGENTA + 8] = xc_app_data.colorBoldMagenta; colors[COLOR_CYAN + 8] = xc_app_data.colorBoldCyan; colors[COLOR_WHITE + 8] = xc_app_data.colorBoldWhite; i = 16; /* 256-color xterm extended palette: 216 colors in a 6x6x6 color cube, plus 24 (not 50) shades of gray */ for( r = 0; r < 6; r++) for( g = 0; g < 6; g++) for( b = 0; b < 6; b++) colors[i++] = RGB( r ? r * 40 + 55 : 0, g ? g * 40 + 55 : 0, b ? b * 40 + 55 : 0); for( i = 0; i < 24; i++) colors[i + 232] = RGB( i * 10 + 8, i * 10 + 8, i * 10 + 8); colors[COLOR_CURSOR] = xc_app_data.cursorColor; colors[COLOR_BORDER] = xc_app_data.borderColor; } static void _refresh_scrollbar(void) { XC_LOG(("_refresh_scrollbar() - called\n")); if (SP->sb_on) { PDC_SCROLLBAR_TYPE total_y = SP->sb_total_y; PDC_SCROLLBAR_TYPE total_x = SP->sb_total_x; if (total_y) XawScrollbarSetThumb(scrollVert, (PDC_SCROLLBAR_TYPE)(SP->sb_cur_y) / total_y, (PDC_SCROLLBAR_TYPE)(SP->sb_viewport_y) / total_y); if (total_x) XawScrollbarSetThumb(scrollHoriz, (PDC_SCROLLBAR_TYPE)(SP->sb_cur_x) / total_x, (PDC_SCROLLBAR_TYPE)(SP->sb_viewport_x) / total_x); } } static void _set_cursor_color(chtype *ch, short *fore, short *back) { int attr; short f, b; attr = PAIR_NUMBER(*ch); if (attr) { PDC_pair_content(attr, &f, &b); *fore = 7 - (f % 8); *back = 7 - (b % 8); } else { if (*ch & A_REVERSE) { *back = COLOR_BLACK; *fore = COLOR_WHITE; } else { *back = COLOR_WHITE; *fore = COLOR_BLACK; } } } static void _get_icon(void) { XIconSize *icon_size; int size_count = 0; Status rc; unsigned char *bitmap_bits = NULL; unsigned icon_bitmap_width = 0, icon_bitmap_height = 0, file_bitmap_width = 0, file_bitmap_height = 0; XC_LOG(("_get_icon() - called\n")); icon_size = XAllocIconSize(); rc = XGetIconSizes(XtDisplay(topLevel), RootWindowOfScreen(XtScreen(topLevel)), &icon_size, &size_count); /* if the WM can advise on icon sizes... */ if (rc && size_count) { int i, max_height = 0, max_width = 0; PDC_LOG(("%s:size_count: %d rc: %d\n", XCLOGMSG, size_count, rc)); for (i = 0; i < size_count; i++) { if (icon_size[i].max_width > max_width) max_width = icon_size[i].max_width; if (icon_size[i].max_height > max_height) max_height = icon_size[i].max_height; PDC_LOG(("%s:min: %d %d\n", XCLOGMSG, icon_size[i].min_width, icon_size[i].min_height)); PDC_LOG(("%s:max: %d %d\n", XCLOGMSG, icon_size[i].max_width, icon_size[i].max_height)); PDC_LOG(("%s:inc: %d %d\n", XCLOGMSG, icon_size[i].width_inc, icon_size[i].height_inc)); } if (max_width >= big_icon_width && max_height >= big_icon_height) { icon_bitmap_width = big_icon_width; icon_bitmap_height = big_icon_height; bitmap_bits = (unsigned char *)big_icon_bits; } else { icon_bitmap_width = little_icon_width; icon_bitmap_height = little_icon_height; bitmap_bits = (unsigned char *)little_icon_bits; } } else /* use small icon */ { icon_bitmap_width = little_icon_width; icon_bitmap_height = little_icon_height; bitmap_bits = (unsigned char *)little_icon_bits; } XFree(icon_size); #ifdef HAVE_XPM_H if (xc_app_data.pixmap && xc_app_data.pixmap[0]) /* supplied pixmap */ { XpmReadFileToPixmap(XtDisplay(topLevel), RootWindowOfScreen(XtScreen(topLevel)), (char *)xc_app_data.pixmap, &icon_pixmap, &icon_pixmap_mask, NULL); return; } #endif if (xc_app_data.bitmap && xc_app_data.bitmap[0]) /* supplied bitmap */ { int x_hot = 0, y_hot = 0; rc = XReadBitmapFile(XtDisplay(topLevel), RootWindowOfScreen(XtScreen(topLevel)), (char *)xc_app_data.bitmap, &file_bitmap_width, &file_bitmap_height, &icon_bitmap, &x_hot, &y_hot); switch(rc) { case BitmapOpenFailed: fprintf(stderr, "bitmap file %s: not found\n", xc_app_data.bitmap); break; case BitmapFileInvalid: fprintf(stderr, "bitmap file %s: contents invalid\n", xc_app_data.bitmap); break; default: return; } } icon_bitmap = XCreateBitmapFromData(XtDisplay(topLevel), RootWindowOfScreen(XtScreen(topLevel)), (char *)bitmap_bits, icon_bitmap_width, icon_bitmap_height); } static void _draw_border(void) { /* Draw the border if required */ if (xc_app_data.borderWidth) XDrawRectangle(XCURSESDISPLAY, XCURSESWIN, border_gc, xc_app_data.borderWidth / 2, xc_app_data.borderWidth / 2, window_width - xc_app_data.borderWidth, window_height - xc_app_data.borderWidth); } /* Redraw the entire screen */ static void _display_screen(void) { int row; XC_LOG(("_display_screen() - called\n")); for (row = 0; row < XCursesLINES; row++) { XC_get_line_lock(row); _display_text((const chtype *)(Xcurscr + XCURSCR_Y_OFF(row)), row, 0, COLS, FALSE); XC_release_line_lock(row); if( row == SP->cursrow && SP->visibility) _redraw_cursor(); } _draw_border(); } /* Draw changed portions of the screen */ static void _refresh_screen(void) { int row, start_col, num_cols; XC_LOG(("_refresh_screen() - called\n")); for (row = 0; row < XCursesLINES; row++) { num_cols = (int)*(Xcurscr + XCURSCR_LENGTH_OFF + row); if (num_cols) { XC_get_line_lock(row); start_col = (int)*(Xcurscr + XCURSCR_START_OFF + row); _display_text((const chtype *)(Xcurscr + XCURSCR_Y_OFF(row) + (start_col * sizeof(chtype))), row, start_col, num_cols, FALSE); *(Xcurscr + XCURSCR_LENGTH_OFF + row) = 0; XC_release_line_lock(row); if( row == SP->cursrow && SP->visibility) _redraw_cursor(); } } _selection_off(); } static void _handle_expose(Widget w, XtPointer client_data, XEvent *event, Boolean *unused) { XC_LOG(("_handle_expose() - called\n")); /* ignore all Exposes except last */ if (event->xexpose.count) return; if (after_first_curses_request && received_map_notify) _display_screen(); } static void _handle_nonmaskable(Widget w, XtPointer client_data, XEvent *event, Boolean *unused) { XClientMessageEvent *client_event = (XClientMessageEvent *)event; PDC_LOG(("%s:_handle_nonmaskable called: xc_otherpid %d event %d\n", XCLOGMSG, xc_otherpid, event->type)); if (event->type == ClientMessage) { XC_LOG(("ClientMessage received\n")); /* This code used to include handling of WM_SAVE_YOURSELF, but it resulted in continual failure of THE on my Toshiba laptop. Removed on 3-3-2001. Now only exits on WM_DELETE_WINDOW. */ if ((Atom)client_event->data.s[0] == wm_atom[0]) { /* if we specified an exit key return it, otherwise exit the process */ if ( SP->exit_key ) _send_key_to_curses(SP->exit_key, NULL, TRUE); else _exit_process(0, SIGKILL, ""); } } } static int override_cursor = -1; #define CURSOR_UNBLINKING_RECTANGLE 0x303 static void XCursesKeyPress(Widget w, XEvent *event, String *params, Cardinal *nparams) { enum { STATE_NORMAL, STATE_COMPOSE, STATE_CHAR }; #ifdef PDC_XIM Status status; wchar_t buffer[120]; #else unsigned char buffer[120]; XComposeStatus compose; static int compose_state = STATE_NORMAL; static int compose_index = 0; int char_idx = 0; #endif unsigned long key = 0; int buflen = 40; int i, count; unsigned long modifier = 0; bool key_code = FALSE; static XEvent prev_event; static int repeat_count = 0; XC_LOG(("XCursesKeyPress() - called\n")); /* Handle modifier keys first; ignore other KeyReleases */ if( event->type == KeyPress && prev_event.type == KeyRelease && event->xkey.time == prev_event.xkey.time && event->xkey.keycode == prev_event.xkey.keycode) { repeat_count++; } else if( event->type == KeyPress) repeat_count = 0; prev_event = *event; if (event->type == KeyRelease) { /* The keysym value was set by a previous call to this function with a KeyPress event (or reset by the mouse event handler) */ if (SP->return_key_modifiers && #ifndef PDC_XIM keysym != compose_key && #endif IsModifierKey(keysym)) { switch (keysym) { case XK_Shift_L: key = KEY_SHIFT_L; break; case XK_Shift_R: key = KEY_SHIFT_R; break; case XK_Control_L: key = KEY_CONTROL_L; break; case XK_Control_R: key = KEY_CONTROL_R; break; case XK_Alt_L: key = KEY_ALT_L; break; case XK_Alt_R: key = KEY_ALT_R; } if (key) _send_key_to_curses(key, NULL, TRUE); } return; } buffer[0] = '\0'; #ifdef PDC_XIM count = XwcLookupString(Xic, &(event->xkey), buffer, buflen, &keysym, &status); #else count = XLookupString(&(event->xkey), (char *)buffer, buflen, &keysym, &compose); #endif /* translate keysym into curses key code */ PDC_LOG(("%s:Key mask: %x\n", XCLOGMSG, event->xkey.state)); #ifdef PDCDEBUG for (i = 0; i < 4; i++) PDC_debug("%s:Keysym %x %d\n", XCLOGMSG, XKeycodeToKeysym(XCURSESDISPLAY, event->xkey.keycode, i), i); #endif #ifndef PDC_XIM /* Check if the key just pressed is the user-specified compose key; if it is, set the compose state and exit. */ if (keysym == compose_key) { /* Change the shape of the cursor to an outline rectangle to indicate we are in "compose" status */ override_cursor = CURSOR_UNBLINKING_RECTANGLE; compose_state = STATE_COMPOSE; return; } switch (compose_state) { case STATE_COMPOSE: if (IsModifierKey(keysym)) return; if (event->xkey.state & compose_mask) { compose_state = STATE_NORMAL; override_cursor = -1; break; } if (buffer[0] && count == 1) key = buffer[0]; compose_index = -1; for (i = 0; i < (int)strlen(compose_chars); i++) if (compose_chars[i] == key) { compose_index = i; break; } if (compose_index == -1) { compose_state = STATE_NORMAL; compose_index = 0; override_cursor = -1; break; } compose_state = STATE_CHAR; return; case STATE_CHAR: if (IsModifierKey(keysym)) return; if (event->xkey.state & compose_mask) { compose_state = STATE_NORMAL; override_cursor = -1; break; } if (buffer[0] && count == 1) key = buffer[0]; char_idx = -1; for (i = 0; i < MAX_COMPOSE_CHARS; i++) if (compose_lookups[compose_index][i] == key) { char_idx = i; break; } if (char_idx == -1) { compose_state = STATE_NORMAL; compose_index = 0; override_cursor = -1; break; } _send_key_to_curses(compose_keys[compose_index][char_idx], NULL, FALSE); compose_state = STATE_NORMAL; compose_index = 0; override_cursor = -1; return; } #endif /* PDC_XIM */ /* To get here we are procesing "normal" keys */ PDC_LOG(("%s:Keysym %x %d\n", XCLOGMSG, XKeycodeToKeysym(XCURSESDISPLAY, event->xkey.keycode, key), key)); /* 0x10: usually, numlock modifier */ if (event->xkey.state & Mod2Mask) modifier |= PDC_KEY_MODIFIER_NUMLOCK; /* 0x01: shift modifier */ if (event->xkey.state & ShiftMask) modifier |= PDC_KEY_MODIFIER_SHIFT; /* 0x04: control modifier */ if (event->xkey.state & ControlMask) modifier |= PDC_KEY_MODIFIER_CONTROL; /* 0x08: usually, alt modifier */ if (event->xkey.state & Mod1Mask) modifier |= PDC_KEY_MODIFIER_ALT; if( repeat_count) modifier |= PDC_KEY_MODIFIER_REPEAT; for (i = 0; key_table[i].keycode; i++) { if (key_table[i].keycode == keysym) { PDC_LOG(("%s:State %x\n", XCLOGMSG, event->xkey.state)); /* ControlMask: 0x04: control modifier Mod1Mask: 0x08: usually, alt modifier Mod2Mask: 0x10: usually, numlock modifier ShiftMask: 0x01: shift modifier */ if ((event->xkey.state & ShiftMask) || (key_table[i].numkeypad && (event->xkey.state & Mod2Mask))) { key = key_table[i].shifted; } else if (event->xkey.state & ControlMask) { key = key_table[i].control; } else if (event->xkey.state & Mod1Mask) { key = key_table[i].alt; } /* To get here, we ignore all other modifiers */ else key = key_table[i].normal; key_code = (key > 0x100); break; } } if (!key && buffer[0] && count == 1) key = buffer[0]; PDC_LOG(("%s:Key: %s (%lx) pressed - %lx Mod: %x\n", XCLOGMSG, XKeysymToString(keysym), keysym, key, event->xkey.state)); /* Handle ALT letters and numbers */ /* enable Alt key without numlock on */ if (event->xkey.state & Mod1Mask) { if (key >= 'A' && key <= 'Z') { key += ALT_A - 'A'; key_code = TRUE; } if (key >= 'a' && key <= 'z') { key += ALT_A - 'a'; key_code = TRUE; } if (key >= '0' && key <= '9') { key += ALT_0 - '0'; key_code = TRUE; } } /* After all that, send the key back to the application if is NOT zero. */ if (key) { static long unicode_value = -1L; if( key == 21 && modifier == /* Ctrl-Shift-U hit: Unicode entry */ (PDC_KEY_MODIFIER_SHIFT | PDC_KEY_MODIFIER_CONTROL)) unicode_value = 0L; if( unicode_value >= 0L) { int offset = 0; override_cursor = CURSOR_UNBLINKING_RECTANGLE; if( key >= '0' && key <= '9') offset = '0'; if( key >= 'a' && key <= 'f') offset = 'a' - 10; if( key >= 'A' && key <= 'F') offset = 'A' - 10; if( offset) { unicode_value <<= 4; unicode_value |= (long)( key - offset); } if( key == 13 || key == PADENTER) { key = unicode_value; unicode_value = -1L; modifier = 0; key_code = FALSE; override_cursor = -1; } else /* still in unicode entry mode */ return; } if (SP->save_key_modifiers) key |= (modifier << 24); _send_key_to_curses(key, NULL, key_code); } } static void XCursesHandleString(Widget w, XEvent *event, String *params, Cardinal *nparams) { unsigned char *ptr; if (*nparams != 1) return; ptr = (unsigned char *)*params; if (ptr[0] == '0' && ptr[1] == 'x' && ptr[2] != '\0') { unsigned char c; unsigned long total = 0; for (ptr += 2; (c = tolower(*ptr)); ptr++) { total <<= 4; if (c >= '0' && c <= '9') total += c - '0'; else if (c >= 'a' && c <= 'f') total += c - ('a' - 10); else break; } if (c == '\0') _send_key_to_curses(total, NULL, FALSE); } else for (; *ptr; ptr++) _send_key_to_curses((unsigned long)*ptr, NULL, FALSE); } static void _paste_string(Widget w, XtPointer data, Atom *selection, Atom *type, XtPointer value, unsigned long *length, int *format) { unsigned long i, key; unsigned char *string = value; XC_LOG(("_paste_string() - called\n")); if (!*type || !*length || !string) return; for (i = 0; string[i] && (i < (*length)); i++) { key = string[i]; if (key == 10) /* new line - convert to ^M */ key = 13; _send_key_to_curses(key, NULL, FALSE); } XtFree(value); } static void _paste_utf8(Widget w, XtPointer event, Atom *selection, Atom *type, XtPointer value, unsigned long *length, int *format) { wchar_t key; size_t i = 0, len; char *string = value; XC_LOG(("_paste_utf8() - called\n")); if (!*type || !*length) { XtGetSelectionValue(w, XA_PRIMARY, XA_STRING, _paste_string, event, ((XButtonEvent *)event)->time); return; } len = *length; if (!string) return; while (string[i] && (i < len)) { int retval = _from_utf8(&key, string + i, len - i); if (retval < 1) return; if (key == 10) /* new line - convert to ^M */ key = 13; _send_key_to_curses(key, NULL, FALSE); i += retval; } XtFree(value); } static void XCursesPasteSelection(Widget w, XButtonEvent *button_event) { XC_LOG(("XCursesPasteSelection() - called\n")); XtGetSelectionValue(w, XA_PRIMARY, XA_UTF8_STRING(XtDisplay(w)), _paste_utf8, (XtPointer)button_event, button_event->time); } static Boolean _convert_proc(Widget w, Atom *selection, Atom *target, Atom *type_return, XtPointer *value_return, unsigned long *length_return, int *format_return) { XC_LOG(("_convert_proc() - called\n")); if (*target == XA_TARGETS(XtDisplay(topLevel))) { XSelectionRequestEvent *req = XtGetSelectionRequest(w, *selection, (XtRequestId)NULL); Atom *targetP; XPointer std_targets; unsigned long std_length; XmuConvertStandardSelection(topLevel, req->time, selection, target, type_return, &std_targets, &std_length, format_return); *length_return = std_length + 2; *value_return = XtMalloc(sizeof(Atom) * (*length_return)); targetP = *(Atom**)value_return; *targetP++ = XA_STRING; *targetP++ = XA_UTF8_STRING(XtDisplay(topLevel)); memmove((void *)targetP, (const void *)std_targets, sizeof(Atom) * std_length); XtFree((char *)std_targets); *type_return = XA_ATOM; *format_return = sizeof(Atom) * 8; return True; } else if (*target == XA_UTF8_STRING(XtDisplay(topLevel)) || *target == XA_STRING) { bool utf8 = !(*target == XA_STRING); char *data = XtMalloc(tmpsel_length * 3 + 1); chtype *tmp = tmpsel; int ret_length = 0; if (utf8) { while (*tmp) ret_length += _to_utf8(data + ret_length, *tmp++); } else while (*tmp) data[ret_length++] = *tmp++ & 0xff; data[ret_length++] = '\0'; *value_return = data; *length_return = ret_length; *format_return = 8; *type_return = *target; return True; } else { return XmuConvertStandardSelection(topLevel, CurrentTime, selection, target, type_return, (XPointer*)value_return, length_return, format_return); } } static void _lose_ownership(Widget w, Atom *type) { XC_LOG(("_lose_ownership() - called\n")); if (tmpsel) free(tmpsel); tmpsel = NULL; tmpsel_length = 0; _selection_off(); } static void _show_selection(int start_x, int start_y, int end_x, int end_y, bool highlight) { int i, num_cols, start_col, row; PDC_LOG(("%s:_show_selection() - called StartX: %d StartY: %d " "EndX: %d EndY: %d Highlight: %d\n", XCLOGMSG, start_x, start_y, end_x, end_y, highlight)); for (i = 0; i < end_y - start_y + 1; i++) { if (start_y == end_y) /* only one line */ { start_col = start_x; num_cols = end_x - start_x + 1; row = start_y; } else if (!i) /* first line */ { start_col = start_x; num_cols = COLS - start_x; row = start_y; } else if (start_y + i == end_y) /* last line */ { start_col = 0; num_cols = end_x + 1; row = end_y; } else /* full line */ { start_col = 0; num_cols = COLS; row = start_y + i; } XC_get_line_lock(row); _display_text((const chtype *)(Xcurscr + XCURSCR_Y_OFF(row) + (start_col * sizeof(chtype))), row, start_col, num_cols, highlight); XC_release_line_lock(row); } } static void _selection_off(void) { XC_LOG(("_selection_off() - called\n")); if( mouse_selection) { _display_screen(); selection_start_x = selection_start_y = selection_end_x = selection_end_y = 0; mouse_selection = FALSE; } } static void _selection_on(int x, int y) { XC_LOG(("_selection_on() - called\n")); selection_start_x = selection_end_x = x; selection_start_y = selection_end_y = y; } static void _selection_extend(int x, int y) { int temp, current_start, current_end, current_start_x, current_end_x, current_start_y, current_end_y, new_start, new_end, new_start_x, new_end_x, new_start_y, new_end_y; XC_LOG(("_selection_extend() - called\n")); mouse_selection = TRUE; /* convert x/y coordinates into start/stop */ current_start = (selection_start_y * COLS) + selection_start_x; current_end = (selection_end_y * COLS) + selection_end_x; if (current_start > current_end) { current_start_x = selection_end_x; current_start_y = selection_end_y; current_end_x = selection_start_x; current_end_y = selection_start_y; temp = current_start; current_start = current_end; current_end = temp; } else { current_end_x = selection_end_x; current_end_y = selection_end_y; current_start_x = selection_start_x; current_start_y = selection_start_y; } /* Now we have the current selection as a linear expression. Convert the new position to a linear expression. */ selection_end_x = x; selection_end_y = y; /* convert x/y coordinates into start/stop */ new_start = (selection_start_y * COLS) + selection_start_x; new_end = (selection_end_y * COLS) + selection_end_x; if (new_start > new_end) { new_start_x = selection_end_x; new_start_y = selection_end_y; new_end_x = selection_start_x; new_end_y = selection_start_y; temp = new_start; new_start = new_end; new_end = temp; } else { new_end_x = selection_end_x; new_end_y = selection_end_y; new_start_x = selection_start_x; new_start_y = selection_start_y; } if (new_end > current_end) _show_selection(current_end_x, current_end_y, new_end_x, new_end_y, TRUE); else if (new_end < current_end) _show_selection(new_end_x, new_end_y, current_end_x, current_end_y, FALSE); else if (new_start < current_start) _show_selection(new_start_x, new_start_y, current_start_x, current_start_y, TRUE); else if (new_start > current_start) _show_selection(current_start_x, current_start_y, new_start_x, new_start_y, FALSE); else _show_selection(current_start_x, current_start_y, new_start_x, new_start_y, TRUE); } static void _selection_set(void) { int i, j, start, end, start_x, end_x, start_y, end_y, num_cols, start_col, row, num_chars, ch, last_nonblank, length, newlen; chtype *ptr = NULL; XC_LOG(("_selection_set() - called\n")); /* convert x/y coordinates into start/stop */ start = (selection_start_y * COLS) + selection_start_x; end = (selection_end_y * COLS) + selection_end_x; if (start == end) { if (tmpsel) free(tmpsel); tmpsel = NULL; tmpsel_length = 0; return; } if (start > end) { start_x = selection_end_x; start_y = selection_end_y; end_x = selection_start_x; end_y = selection_start_y; length = start - end + 1; } else { end_x = selection_end_x; end_y = selection_end_y; start_x = selection_start_x; start_y = selection_start_y; length = end - start + 1; } newlen = length + end_y - start_y + 2; if (length > (int)tmpsel_length) { if (!tmpsel_length) tmpsel = malloc(newlen * sizeof(chtype)); else tmpsel = realloc(tmpsel, newlen * sizeof(chtype)); } if (!tmpsel) { tmpsel_length = 0; return; } tmpsel_length = length; num_chars = 0; for (i = 0; i < end_y - start_y + 1; i++) { if (start_y == end_y) /* only one line */ { start_col = start_x; num_cols = end_x - start_x + 1; row = start_y; } else if (!i) /* first line */ { start_col = start_x; num_cols = COLS - start_x; row = start_y; } else if (start_y + i == end_y) /* last line */ { start_col = 0; num_cols = end_x + 1; row = end_y; } else /* full line */ { start_col = 0; num_cols = COLS; row = start_y + i; } XC_get_line_lock(row); ptr = (chtype *)(Xcurscr + XCURSCR_Y_OFF(row) + start_col * sizeof(chtype)); if (i < end_y - start_y) { last_nonblank = 0; for (j = 0; j < num_cols; j++) { ch = (int)(ptr[j] & A_CHARTEXT); if (ch != (int)' ') last_nonblank = j; } } else last_nonblank = num_cols - 1; for (j = 0; j <= last_nonblank; j++) tmpsel[num_chars++] = ptr[j]; XC_release_line_lock(row); if (i < end_y - start_y) tmpsel[num_chars++] = '\n'; } tmpsel[num_chars] = '\0'; tmpsel_length = num_chars; } #define CURSOR_INVISIBLE 0 #define CURSOR_NORMAL 1 #define CURSOR_BLOCK 2 #define CURSOR_RECTANGLE 3 #define CURSOR_VLINE 4 #define CURSOR_HALF_BLOCK 5 static void _display_cursor(int old_row, int old_x, int new_row, int new_x) { int xpos, ypos, i, cursor_to_show; chtype *ch; short fore = 0, back = 0; PDC_LOG(("%s:_display_cursor() - draw char at row: %d col %d\n", XCLOGMSG, old_row, old_x)); /* if the cursor position is outside the boundary of the screen, ignore the request */ if (old_row >= XCursesLINES || old_x >= COLS || new_row >= XCursesLINES || new_x >= COLS) return; /* display the character at the current cursor position */ PDC_LOG(("%s:_display_cursor() - draw char at row: %d col %d\n", XCLOGMSG, old_row, old_x)); _display_text((const chtype *)(Xcurscr + (XCURSCR_Y_OFF(old_row) + (old_x * sizeof(chtype)))), old_row, old_x, 1, FALSE); /* display the cursor at the new cursor position */ /* use lower 8 bits for 1/2 cycle (or if not in window) */ if( PDC_blink_state || !window_entered) cursor_to_show = (SP->visibility & 0xff); else /* ...& upper 8 bits on other 1/2 cycle */ cursor_to_show = (SP->visibility >> 8); if( override_cursor >= 0) cursor_to_show = (PDC_blink_state ? override_cursor & 0xff : override_cursor >> 8); if( !cursor_to_show) return; /* cursor not displayed, no more to do */ _make_xy(new_x, new_row, &xpos, &ypos); ch = (chtype *)(Xcurscr + XCURSCR_Y_OFF(new_row) + new_x * sizeof(chtype)); _set_cursor_color(ch, &fore, &back); XSetForeground(XCURSESDISPLAY, rect_cursor_gc, colors[back]); switch( cursor_to_show) { case CURSOR_VLINE: for (i = 1; i <= 2; i++) XDrawLine(XCURSESDISPLAY, XCURSESWIN, rect_cursor_gc, xpos + i, ypos - xc_app_data.normalFont->ascent, xpos + i, ypos - xc_app_data.normalFont->ascent + font_height - 1); break; case CURSOR_NORMAL: case CURSOR_HALF_BLOCK: { int n_lines = xc_app_data.normalFont->descent; ypos += n_lines - 1; if( cursor_to_show == CURSOR_HALF_BLOCK) n_lines += xc_app_data.normalFont->ascent / 2; else n_lines += 2; for( i = 0; i < n_lines; i++, ypos--) XDrawLine(XCURSESDISPLAY, XCURSESWIN, rect_cursor_gc, xpos, ypos, xpos + font_width, ypos); break; } case CURSOR_RECTANGLE: XDrawRectangle(XCURSESDISPLAY, XCURSESWIN, rect_cursor_gc, xpos + 1, ypos - font_height + xc_app_data.normalFont->descent + 1, font_width - 2, font_height - 2); break; case CURSOR_BLOCK: default: { /* cursor visibility high */ #ifdef PDC_WIDE XChar2b buf[2]; buf[0].byte1 = (*ch & 0xff00) >> 8; buf[0].byte2 = *ch & 0x00ff; buf[1].byte1 = buf[1].byte2 = 0; #else char buf[2]; buf[0] = *ch & 0xff; buf[1] = '\0'; #endif XSetForeground(XCURSESDISPLAY, block_cursor_gc, colors[fore]); XSetBackground(XCURSESDISPLAY, block_cursor_gc, colors[back]); #ifdef PDC_WIDE XDrawImageString16( #else XDrawImageString( #endif XCURSESDISPLAY, XCURSESWIN, block_cursor_gc, xpos, ypos, buf, 1); } break; } PDC_LOG(("%s:_display_cursor() - draw cursor at row %d col %d\n", XCLOGMSG, new_row, new_x)); } static void _redraw_cursor(void) { _display_cursor(SP->cursrow, SP->curscol, SP->cursrow, SP->curscol); } static void _handle_enter_leave(Widget w, XtPointer client_data, XEvent *event, Boolean *unused) { XC_LOG(("_handle_enter_leave called\n")); switch(event->type) { case EnterNotify: XC_LOG(("EnterNotify received\n")); window_entered = TRUE; break; case LeaveNotify: XC_LOG(("LeaveNotify received\n")); window_entered = FALSE; /* Display the cursor so it stays on while the window is not current */ // _redraw_cursor(); break; default: PDC_LOG(("%s:_handle_enter_leave - unknown event %d\n", XCLOGMSG, event->type)); } } static void _send_key_to_curses(unsigned long key, MOUSE_STATUS *ms, bool key_code) { PDC_LOG(("%s:_send_key_to_curses() - called: sending %d\n", XCLOGMSG, key)); SP->key_code = key_code; if (XC_write_socket(xc_key_sock, &key, sizeof(unsigned long)) < 0) _exit_process(1, SIGKILL, "exiting from _send_key_to_curses"); if (ms) { MOUSE_LOG(("%s:writing mouse stuff\n", XCLOGMSG)); if (XC_write_socket(xc_key_sock, ms, sizeof(MOUSE_STATUS)) < 0) _exit_process(1, SIGKILL, "exiting from _send_key_to_curses"); } } #ifdef A_OVERLINE #define A_ALL_LINES (A_UNDERLINE | A_LEFTLINE | A_RIGHTLINE | A_OVERLINE | A_STRIKEOUT) #else #define A_ALL_LINES (A_UNDERLINE | A_LEFTLINE | A_RIGHTLINE) #endif /* Note that the logic used to avoid unnecessary drawing is heavily borrowed from the HandleTimer function in wingui/pdcscrn.c. The comments there may be helpful. */ static void _blink_cursor(XtPointer unused, XtIntervalId *id) { XC_LOG(("_blink_cursor() - called:\n")); int i; static int previously_really_blinking = 0; static int prev_line_color = -1; chtype attr_to_seek = 0; if( prev_line_color != SP->line_color) attr_to_seek = A_ALL_LINES; if( PDC_really_blinking || previously_really_blinking) attr_to_seek |= A_BLINK; prev_line_color = SP->line_color; previously_really_blinking = PDC_really_blinking; PDC_blink_state ^= 1; if( attr_to_seek) for( i = 0; i < SP->lines; i++) { const chtype *line; int j = 0, n_chars; XC_get_line_lock( i); line = (const chtype *)(Xcurscr + XCURSCR_Y_OFF( i)); /* skip over starting text that isn't blinking: */ while( j < SP->cols && !(*line & attr_to_seek)) { j++; line++; } n_chars = SP->cols - j; /* then skip over text at the end that's not blinking: */ while( n_chars && !(line[n_chars - 1] & attr_to_seek)) n_chars--; if( n_chars) _display_text( line, i, j, n_chars, 0); XC_release_line_lock( i); } _redraw_cursor(); XtAppAddTimeOut(app_context, CURSOR_BLINK_RATE, _blink_cursor, NULL); } static void XCursesButton(Widget w, XEvent *event, String *params, Cardinal *nparams) { int button_no; static int last_button_no = 0; static Time last_button_press_time = 0; MOUSE_STATUS save_mouse_status; bool send_key = TRUE; static bool remove_release; static bool handle_real_release; XC_LOG(("XCursesButton() - called\n")); keysym = 0; /* suppress any modifier key return */ save_mouse_status = Mouse_status; button_no = event->xbutton.button; /* It appears that under X11R6 (at least on Linux), that an event_type of ButtonMotion does not include the mouse button in the event. The following code is designed to cater for this situation. */ if (!button_no) button_no = last_button_no; last_button_no = button_no; Mouse_status.changes = 0; switch(event->type) { case ButtonPress: /* Handle button 4 and 5, which are normally mapped to the wheel mouse scroll up and down, and button 6 and 7, which are normally mapped to the wheel mouse scroll left and right */ if (button_no >= 4 && button_no <= 7) { /* Send the KEY_MOUSE to curses program */ memset(&Mouse_status, 0, sizeof(Mouse_status)); switch(button_no) { case 4: Mouse_status.changes = PDC_MOUSE_WHEEL_UP; break; case 5: Mouse_status.changes = PDC_MOUSE_WHEEL_DOWN; break; case 6: Mouse_status.changes = PDC_MOUSE_WHEEL_LEFT; break; case 7: Mouse_status.changes = PDC_MOUSE_WHEEL_RIGHT; } MOUSE_X_POS = MOUSE_Y_POS = -1; _send_key_to_curses(KEY_MOUSE, &Mouse_status, TRUE); remove_release = TRUE; return; } if (button_no == 2 && (!SP->_trap_mbe || (event->xbutton.state & ShiftMask))) { XCursesPasteSelection(drawing, (XButtonEvent *)event); remove_release = TRUE; return; } remove_release = False; handle_real_release = False; MOUSE_LOG(("\nButtonPress\n")); if ((event->xbutton.time - last_button_press_time) < xc_app_data.doubleClickPeriod) { const short curr_status = BUTTON_STATUS( button_no); MOUSE_X_POS = save_mouse_status.x; MOUSE_Y_POS = save_mouse_status.y; if( curr_status == BUTTON_DOUBLE_CLICKED || curr_status == BUTTON_TRIPLE_CLICKED) BUTTON_STATUS(button_no) = BUTTON_TRIPLE_CLICKED; else BUTTON_STATUS(button_no) = BUTTON_DOUBLE_CLICKED; _selection_off(); remove_release = True; } else { napms(SP->mouse_wait); event->type = ButtonRelease; XSendEvent(event->xbutton.display, event->xbutton.window, True, 0, event); last_button_press_time = event->xbutton.time; return; } last_button_press_time = event->xbutton.time; break; case MotionNotify: MOUSE_LOG(("\nMotionNotify: y: %d x: %d Width: %d " "Height: %d\n", event->xbutton.y, event->xbutton.x, font_width, font_height)); MOUSE_X_POS = (event->xbutton.x - xc_app_data.borderWidth) / font_width; MOUSE_Y_POS = (event->xbutton.y - xc_app_data.borderWidth) / font_height; if (button_no == 1 && (!SP->_trap_mbe || (event->xbutton.state & ShiftMask))) { _selection_extend(MOUSE_X_POS, MOUSE_Y_POS); send_key = FALSE; } else _selection_off(); /* Throw away mouse movements if they are in the same character position as the last mouse event, or if we are currently in the middle of a double click event. */ if ((MOUSE_X_POS == save_mouse_status.x && MOUSE_Y_POS == save_mouse_status.y) || save_mouse_status.button[button_no - 1] == BUTTON_DOUBLE_CLICKED) { send_key = FALSE; break; } Mouse_status.changes |= PDC_MOUSE_MOVED; break; case ButtonRelease: if (remove_release) { MOUSE_LOG(("Release at: %ld - removed\n", event->xbutton.time)); return; } else { MOUSE_X_POS = (event->xbutton.x - xc_app_data.borderWidth) / font_width; MOUSE_Y_POS = (event->xbutton.y - xc_app_data.borderWidth) / font_height; if (!handle_real_release) { if ((event->xbutton.time - last_button_press_time) < SP->mouse_wait && (event->xbutton.time != last_button_press_time)) { /* The "real" release was shorter than usleep() time; therefore generate a click event */ MOUSE_LOG(("Release at: %ld - click\n", event->xbutton.time)); BUTTON_STATUS(button_no) = BUTTON_CLICKED; if (button_no == 1 && mouse_selection && (!SP->_trap_mbe || (event->xbutton.state & ShiftMask))) { send_key = FALSE; if (XtOwnSelection(topLevel, XA_PRIMARY, event->xbutton.time, _convert_proc, _lose_ownership, NULL) == False) _selection_off(); } else _selection_off(); /* Ensure the "pseudo" release event is ignored */ remove_release = True; handle_real_release = False; break; } else { /* Button release longer than usleep() time; therefore generate a press and wait for the real release to occur later. */ MOUSE_LOG(("Generated Release at: %ld - " "press & release\n", event->xbutton.time)); BUTTON_STATUS(button_no) = BUTTON_PRESSED; if (button_no == 1 && (!SP->_trap_mbe || (event->xbutton.state & ShiftMask))) { _selection_off(); _selection_on(MOUSE_X_POS, MOUSE_Y_POS); } handle_real_release = True; break; } } else { MOUSE_LOG(("Release at: %ld - released\n", event->xbutton.time)); } } MOUSE_LOG(("\nButtonRelease\n")); BUTTON_STATUS(button_no) = BUTTON_RELEASED; if (button_no == 1 && mouse_selection && (!SP->_trap_mbe || (event->xbutton.state & ShiftMask))) { send_key = FALSE; if (XtOwnSelection(topLevel, XA_PRIMARY, event->xbutton.time, _convert_proc, _lose_ownership, NULL) == False) _selection_off(); _selection_set(); } else _selection_off(); break; } /* Set up the mouse status fields in preparation for sending */ Mouse_status.changes |= 1 << (button_no - 1); if (Mouse_status.changes & PDC_MOUSE_MOVED && BUTTON_STATUS(button_no) == BUTTON_PRESSED) BUTTON_STATUS(button_no) = BUTTON_MOVED; if (event->xbutton.state & ShiftMask) BUTTON_STATUS(button_no) |= BUTTON_SHIFT; if (event->xbutton.state & ControlMask) BUTTON_STATUS(button_no) |= BUTTON_CONTROL; if (event->xbutton.state & Mod1Mask) BUTTON_STATUS(button_no) |= BUTTON_ALT; /* If we are ignoring the event, or the mouse position is outside the bounds of the screen (because of the border), return here */ MOUSE_LOG(("Button: %d x: %d y: %d Button status: %x " "Mouse status: %x\n", button_no, MOUSE_X_POS, MOUSE_Y_POS, BUTTON_STATUS(button_no), Mouse_status.changes)); MOUSE_LOG(("Send: %d Button1: %x Button2: %x Button3: %x %d %d\n", send_key, BUTTON_STATUS(1), BUTTON_STATUS(2), BUTTON_STATUS(3), XCursesLINES, XCursesCOLS)); if (!send_key || MOUSE_X_POS < 0 || MOUSE_X_POS >= XCursesCOLS || MOUSE_Y_POS < 0 || MOUSE_Y_POS >= XCursesLINES) return; /* Send the KEY_MOUSE to curses program */ _send_key_to_curses(KEY_MOUSE, &Mouse_status, TRUE); } static void _scroll_up_down(Widget w, XtPointer client_data, XtPointer call_data) { int pixels = (long) call_data; int total_y = SP->sb_total_y * font_height; int viewport_y = SP->sb_viewport_y * font_height; int cur_y = SP->sb_cur_y * font_height; /* When pixels is negative, right button pressed, move data down, thumb moves up. Otherwise, left button pressed, pixels positive, move data up, thumb down. */ cur_y += pixels; /* limit panning to size of overall */ if (cur_y < 0) cur_y = 0; else if (cur_y > (total_y - viewport_y)) cur_y = total_y - viewport_y; SP->sb_cur_y = cur_y / font_height; XawScrollbarSetThumb(w, (double)((double)cur_y / (double)total_y), (double)((double)viewport_y / (double)total_y)); /* Send a key: if pixels negative, send KEY_SCROLL_DOWN */ _send_key_to_curses(KEY_SF, NULL, TRUE); } static void _scroll_left_right(Widget w, XtPointer client_data, XtPointer call_data) { int pixels = (long) call_data; int total_x = SP->sb_total_x * font_width; int viewport_x = SP->sb_viewport_x * font_width; int cur_x = SP->sb_cur_x * font_width; cur_x += pixels; /* limit panning to size of overall */ if (cur_x < 0) cur_x = 0; else if (cur_x > (total_x - viewport_x)) cur_x = total_x - viewport_x; SP->sb_cur_x = cur_x / font_width; XawScrollbarSetThumb(w, (double)((double)cur_x / (double)total_x), (double)((double)viewport_x / (double)total_x)); _send_key_to_curses(KEY_SR, NULL, TRUE); } static void _thumb_up_down(Widget w, XtPointer client_data, XtPointer call_data) { double percent = *(double *) call_data; double total_y = (double)SP->sb_total_y; double viewport_y = (double)SP->sb_viewport_y; int cur_y = SP->sb_cur_y; /* If the size of the viewport is > overall area simply return, as no scrolling is permitted. */ if (SP->sb_viewport_y >= SP->sb_total_y) return; if ((SP->sb_cur_y = (int)((double)total_y * percent)) >= (total_y - viewport_y)) SP->sb_cur_y = total_y - viewport_y; XawScrollbarSetThumb(w, (double)(cur_y / total_y), (double)(viewport_y / total_y)); _send_key_to_curses(KEY_SF, NULL, TRUE); } static void _thumb_left_right(Widget w, XtPointer client_data, XtPointer call_data) { double percent = *(double *) call_data; double total_x = (double)SP->sb_total_x; double viewport_x = (double)SP->sb_viewport_x; int cur_x = SP->sb_cur_x; if (SP->sb_viewport_x >= SP->sb_total_x) return; if ((SP->sb_cur_x = (int)((float)total_x * percent)) >= (total_x - viewport_x)) SP->sb_cur_x = total_x - viewport_x; XawScrollbarSetThumb(w, (double)(cur_x / total_x), (double)(viewport_x / total_x)); _send_key_to_curses(KEY_SR, NULL, TRUE); } static void _exit_process(int rc, int sig, char *msg) { if (rc || sig) fprintf(stderr, "%s:_exit_process() - called: rc:%d sig:%d <%s>\n", XCLOGMSG, rc, sig, msg); shmdt((char *)SP); shmdt((char *)Xcurscr); shmctl(shmidSP, IPC_RMID, 0); shmctl(shmid_Xcurscr, IPC_RMID, 0); if (bitmap_file) { XFreePixmap(XCURSESDISPLAY, icon_bitmap); free(bitmap_file); } #ifdef HAVE_XPM_H if (pixmap_file) { XFreePixmap(XCURSESDISPLAY, icon_pixmap); XFreePixmap(XCURSESDISPLAY, icon_pixmap_mask); free(pixmap_file); } #endif XFreeGC(XCURSESDISPLAY, normal_gc); XFreeGC(XCURSESDISPLAY, italic_gc); XFreeGC(XCURSESDISPLAY, bold_gc); XFreeGC(XCURSESDISPLAY, block_cursor_gc); XFreeGC(XCURSESDISPLAY, rect_cursor_gc); XFreeGC(XCURSESDISPLAY, border_gc); #ifdef PDC_XIM XDestroyIC(Xic); #endif shutdown(xc_display_sock, 2); close(xc_display_sock); shutdown(xc_exit_sock, 2); close(xc_exit_sock); shutdown(xc_key_sock, 2); close(xc_key_sock); if (sig) kill(xc_otherpid, sig); /* to kill parent process */ _exit(rc); } static void _resize(void) { short save_atrtab[PDC_COLOR_PAIRS * 2]; after_first_curses_request = FALSE; SP->lines = XCursesLINES = ((resize_window_height - (2 * xc_app_data.borderWidth)) / font_height); LINES = XCursesLINES - SP->linesrippedoff - SP->slklines; SP->cols = COLS = XCursesCOLS = ((resize_window_width - (2 * xc_app_data.borderWidth)) / font_width); window_width = resize_window_width; window_height = resize_window_height; _draw_border(); /* Detach and drop the current shared memory segment and create and attach to a new segment */ memcpy(save_atrtab, xc_atrtab, sizeof(save_atrtab)); SP->XcurscrSize = XCURSCR_SIZE; shmdt((char *)Xcurscr); shmctl(shmid_Xcurscr, IPC_RMID, 0); if ((shmid_Xcurscr = shmget(shmkey_Xcurscr, SP->XcurscrSize + XCURSESSHMMIN, 0700 | IPC_CREAT)) < 0) { perror("Cannot allocate shared memory for curscr"); _exit_process(4, SIGKILL, "exiting from _process_curses_requests"); } Xcurscr = (unsigned char*)shmat(shmid_Xcurscr, 0, 0); memset(Xcurscr, 0, SP->XcurscrSize); xc_atrtab = (short *)(Xcurscr + XCURSCR_ATRTAB_OFF); memcpy(xc_atrtab, save_atrtab, sizeof(save_atrtab)); } /* For PDC_set_title() */ static void _set_title(void) { char title[1024]; /* big enough for window title */ int pos; if ((XC_read_socket(xc_display_sock, &pos, sizeof(int)) < 0) || (XC_read_socket(xc_display_sock, title, pos) < 0)) { _exit_process(5, SIGKILL, "exiting from _set_title"); } XtVaSetValues(topLevel, XtNtitle, title, NULL); } /* For color_content() */ static void _get_color(void) { XColor *tmp = (XColor *)(Xcurscr + XCURSCR_XCOLOR_OFF); int index = tmp->pixel; Colormap cmap = DefaultColormap(XCURSESDISPLAY, DefaultScreen(XCURSESDISPLAY)); if (index < 0 || index >= MAX_COLORS) _exit_process(4, SIGKILL, "exiting from _get_color"); tmp->pixel = colors[index]; XQueryColor(XCURSESDISPLAY, cmap, tmp); } /* For init_color() */ static void _set_color(void) { XColor *tmp = (XColor *)(Xcurscr + XCURSCR_XCOLOR_OFF); int index = tmp->pixel; Colormap cmap = DefaultColormap(XCURSESDISPLAY, DefaultScreen(XCURSESDISPLAY)); if (index < 0 || index >= MAX_COLORS) _exit_process(4, SIGKILL, "exiting from _set_color"); if (XAllocColor(XCURSESDISPLAY, cmap, tmp)) { colors[index] = tmp->pixel; _display_screen(); } } /* For PDC_getclipboard() */ static void _get_selection(Widget w, XtPointer data, Atom *selection, Atom *type, XtPointer value, unsigned long *length, int *format) { unsigned char *src = value; int pos, len = *length; XC_LOG(("_get_selection() - called\n")); if (!value && !len) { if (XC_write_display_socket_int(PDC_CLIP_EMPTY) < 0) _exit_process(4, SIGKILL, "exiting from _get_selection"); } else { /* Here all is OK, send PDC_CLIP_SUCCESS, then length, then contents */ if (XC_write_display_socket_int(PDC_CLIP_SUCCESS) < 0) _exit_process(4, SIGKILL, "exiting from _get_selection"); if (XC_write_display_socket_int(len) < 0) _exit_process(4, SIGKILL, "exiting from _get_selection"); for (pos = 0; pos < len; pos++) { #ifdef PDC_WIDE wchar_t c; #else unsigned char c; #endif c = *src++; if (XC_write_socket(xc_display_sock, &c, sizeof(c)) < 0) _exit_process(4, SIGKILL, "exiting from _get_selection"); } } } #ifdef PDC_WIDE static void _get_selection_utf8(Widget w, XtPointer data, Atom *selection, Atom *type, XtPointer value, unsigned long *length, int *format) { int len = *length; XC_LOG(("_get_selection_utf8() - called\n")); if (!*type || !*length) { XtGetSelectionValue(w, XA_PRIMARY, XA_STRING, _get_selection, (XtPointer)NULL, 0); return; } if (!value && !len) { if (XC_write_display_socket_int(PDC_CLIP_EMPTY) >= 0) return; } else { wchar_t *wcontents = malloc((len + 1) * sizeof(wchar_t)); char *src = value; int i = 0; while (*src && i < (*length)) { int retval = _from_utf8(wcontents + i, src, len); src += retval; len -= retval; i++; } wcontents[i] = 0; len = i; /* Here all is OK, send PDC_CLIP_SUCCESS, then length, then contents */ if (XC_write_display_socket_int(PDC_CLIP_SUCCESS) >= 0) if (XC_write_display_socket_int(len) >= 0) if (XC_write_socket(xc_display_sock, wcontents, len * sizeof(wchar_t)) >= 0) { free(wcontents); return; } } _exit_process(4, SIGKILL, "exiting from _get_selection_utf8"); } #endif /* For PDC_setclipboard() */ static void _set_selection(void) { long length, pos; int status; if (XC_read_socket(xc_display_sock, &length, sizeof(long)) < 0) _exit_process(5, SIGKILL, "exiting from _set_selection"); if (length > (long)tmpsel_length) { if (!tmpsel_length) tmpsel = malloc((length + 1) * sizeof(chtype)); else tmpsel = realloc(tmpsel, (length + 1) * sizeof(chtype)); } if (!tmpsel) if (XC_write_display_socket_int(PDC_CLIP_MEMORY_ERROR) < 0) _exit_process(4, SIGKILL, "exiting from _set_selection"); for (pos = 0; pos < length; pos++) { #ifdef PDC_WIDE wchar_t c; #else unsigned char c; #endif if (XC_read_socket(xc_display_sock, &c, sizeof(c)) < 0) _exit_process(5, SIGKILL, "exiting from _set_selection"); tmpsel[pos] = c; } tmpsel_length = length; tmpsel[length] = 0; if (XtOwnSelection(topLevel, XA_PRIMARY, CurrentTime, _convert_proc, _lose_ownership, NULL) == False) { status = PDC_CLIP_ACCESS_ERROR; free(tmpsel); tmpsel = NULL; tmpsel_length = 0; } else status = PDC_CLIP_SUCCESS; _selection_off(); if (XC_write_display_socket_int(status) < 0) _exit_process(4, SIGKILL, "exiting from _set_selection"); } /* The curses process is waiting; tell it to continue */ static void _resume_curses(void) { if (XC_write_display_socket_int(CURSES_CONTINUE) < 0) _exit_process(4, SIGKILL, "exiting from _process_curses_requests"); } /* The curses process sent us a message */ static void _process_curses_requests(XtPointer client_data, int *fid, XtInputId *id) { struct timeval socket_timeout = {0}; int s; int old_row, new_row; int old_x, new_x; int pos, num_cols; char buf[12]; /* big enough for 2 integers */ XC_LOG(("_process_curses_requests() - called\n")); if (!received_map_notify) return; FD_ZERO(&xc_readfds); FD_SET(xc_display_sock, &xc_readfds); if ((s = select(FD_SETSIZE, (FD_SET_CAST)&xc_readfds, NULL, NULL, &socket_timeout)) < 0) _exit_process(2, SIGKILL, "exiting from _process_curses_requests" " - select failed"); if (!s) /* no requests pending - should never happen! */ return; if (FD_ISSET(xc_display_sock, &xc_readfds)) { /* read first integer to determine total message has been received */ XC_LOG(("_process_curses_requests() - before XC_read_socket()\n")); if (XC_read_socket(xc_display_sock, &num_cols, sizeof(int)) < 0) _exit_process(3, SIGKILL, "exiting from _process_curses_requests" " - first read"); XC_LOG(("_process_curses_requests() - after XC_read_socket()\n")); after_first_curses_request = TRUE; switch(num_cols) { case CURSES_EXIT: /* request from curses to stop */ XC_LOG(("CURSES_EXIT received from child\n")); _exit_process(0, 0, "XCursesProcess requested to exit by child"); break; case CURSES_BELL: XC_LOG(("CURSES_BELL received from child\n")); XBell(XCURSESDISPLAY, 50); break; /* request from curses to confirm completion of display */ case CURSES_REFRESH: XC_LOG(("CURSES_REFRESH received from child\n")); _refresh_screen(); _resume_curses(); break; case CURSES_REFRESH_SCROLLBAR: _refresh_scrollbar(); break; case CURSES_BLINK_ON: PDC_really_blinking = TRUE; break; case CURSES_BLINK_OFF: PDC_really_blinking = FALSE; break; case CURSES_CURSOR: XC_LOG(("CURSES_CURSOR received from child\n")); if (XC_read_socket(xc_display_sock, buf, sizeof(int) * 2) < 0) _exit_process(5, SIGKILL, "exiting from CURSES_CURSOR " "_process_curses_requests"); memcpy(&pos, buf, sizeof(int)); old_row = pos & 0xFF; old_x = pos >> 8; memcpy(&pos, buf + sizeof(int), sizeof(int)); new_row = pos & 0xFF; new_x = pos >> 8; /* Only redraw the cursor if it's actually moved. */ /* Otherwise, it'll get refreshed at the next cycle. */ if( old_row != new_row || old_x != new_x) _display_cursor(old_row, old_x, new_row, new_x); break; case CURSES_DISPLAY_CURSOR: if(PDC_blink_state) { XC_LOG(("CURSES_DISPLAY_CURSOR received from child. Vis. now: 1\n")); } else { XC_LOG(("CURSES_DISPLAY_CURSOR received from child. Vis. now: 0\n")); } break; case CURSES_TITLE: XC_LOG(("CURSES_TITLE received from child\n")); _set_title(); break; case CURSES_RESIZE: XC_LOG(("CURSES_RESIZE received from child\n")); _resize(); _resume_curses(); break; case CURSES_GET_SELECTION: XC_LOG(("CURSES_GET_SELECTION received from child\n")); _resume_curses(); XtGetSelectionValue(topLevel, XA_PRIMARY, #ifdef PDC_WIDE XA_UTF8_STRING(XtDisplay(topLevel)), _get_selection_utf8, #else XA_STRING, _get_selection, #endif (XtPointer)NULL, 0); break; case CURSES_SET_SELECTION: XC_LOG(("CURSES_SET_SELECTION received from child\n")); _set_selection(); break; case CURSES_CLEAR_SELECTION: XC_LOG(("CURSES_CLEAR_SELECTION received from child\n")); _resume_curses(); _selection_off(); break; case CURSES_GET_COLOR: XC_LOG(("CURSES_GET_COLOR recieved from child\n")); _get_color(); _resume_curses(); break; case CURSES_SET_COLOR: XC_LOG(("CURSES_SET_COLOR recieved from child\n")); _set_color(); _resume_curses(); break; default: PDC_LOG(("%s:Unknown request %d\n", XCLOGMSG, num_cols)); } } } static void _handle_structure_notify(Widget w, XtPointer client_data, XEvent *event, Boolean *unused) { XC_LOG(("_handle_structure_notify() - called\n")); switch(event->type) { case ConfigureNotify: XC_LOG(("ConfigureNotify received\n")); /* Window has been resized, change width and height to send to place_text and place_graphics in next Expose. Also will need to kill (SIGWINCH) curses process if screen size changes. */ resize_window_width = event->xconfigure.width; resize_window_height = event->xconfigure.height; after_first_curses_request = FALSE; #ifdef SIGWINCH SP->resized = 1; kill(xc_otherpid, SIGWINCH); #endif _send_key_to_curses(KEY_RESIZE, NULL, TRUE); break; case MapNotify: XC_LOG(("MapNotify received\n")); received_map_notify = 1; _draw_border(); break; default: PDC_LOG(("%s:_handle_structure_notify - unknown event %d\n", XCLOGMSG, event->type)); } } static RETSIGTYPE _handle_signals(int signo) { int flag = CURSES_EXIT; PDC_LOG(("%s:_handle_signals() - called: %d\n", XCLOGMSG, signo)); /* Patch by: Georg Fuchs */ XCursesSetSignal(signo, _handle_signals); #ifdef SIGTSTP if (signo == SIGTSTP) { pause(); return; } #endif #ifdef SIGCONT if (signo == SIGCONT) return; #endif #ifdef SIGCLD if (signo == SIGCLD) return; #endif #ifdef SIGTTIN if (signo == SIGTTIN) return; #endif #ifdef SIGWINCH if (signo == SIGWINCH) return; #endif /* End of patch by: Georg Fuchs */ XCursesSetSignal(signo, SIG_IGN); /* Send a CURSES_EXIT to myself */ if (XC_write_socket(xc_exit_sock, &flag, sizeof(int)) < 0) _exit_process(7, signo, "exiting from _handle_signals"); } #ifdef PDC_XIM static void _dummy_handler(Widget w, XtPointer client_data, XEvent *event, Boolean *unused) { } #endif int XCursesSetupX(int argc, char *argv[]) { char *myargv[] = {"PDCurses", NULL}; char override_text[2][10]; char **new_argv = NULL; extern bool sb_started; int italic_font_valid, bold_font_valid; int italic_font_width, italic_font_height; int bold_font_width, bold_font_height; XColor pointerforecolor, pointerbackcolor; XrmValue rmfrom, rmto; int i; int minwidth, minheight; XC_LOG(("XCursesSetupX called\n")); if (!argv) { argv = myargv; argc = 1; } program_name = argv[0]; if( XCursesLINES != 24 || XCursesCOLS != 80) { /* a call to resize() was made before initscr() */ int pass; new_argv = (char **)calloc( argc + 5, sizeof( char *)); for( i = 0; i < argc; i++) new_argv[i] = argv[i]; argv = new_argv; for( pass = 0; pass < 2; pass++) { const char *override = (pass ? "-cols" : "-lines"); i = 0; while( i < argc && strcmp( argv[i], override)) i++; argv[i] = (char *)override; argv[i + 1] = override_text[pass]; sprintf( override_text[pass], "%d", (pass ? XCursesCOLS : XCursesLINES)); if( i == argc) /* this is new (usual case) */ argc += 2; } } /* Keep open the 'write' end of the socket so the XCurses process can send a CURSES_EXIT to itself from within the signal handler */ xc_exit_sock = xc_display_sockets[0]; xc_display_sock = xc_display_sockets[1]; close(xc_key_sockets[0]); xc_key_sock = xc_key_sockets[1]; /* Trap all signals when XCurses is the child process, but only if they haven't already been ignored by the application. */ for (i = 0; i < PDC_MAX_SIGNALS; i++) if (XCursesSetSignal(i, _handle_signals) == SIG_IGN) XCursesSetSignal(i, SIG_IGN); /* Start defining X Toolkit things */ #if XtSpecificationRelease > 4 XtSetLanguageProc(NULL, (XtLanguageProc)NULL, NULL); #endif /* Exit if no DISPLAY variable set */ if (!getenv("DISPLAY")) { fprintf(stderr, "Error: no DISPLAY variable set\n"); kill(xc_otherpid, SIGKILL); return ERR; } /* Initialise the top level widget */ topLevel = XtVaAppInitialize(&app_context, class_name, options, XtNumber(options), &argc, argv, NULL, NULL); if( new_argv) free( new_argv); XtVaGetApplicationResources(topLevel, &xc_app_data, app_resources, XtNumber(app_resources), NULL); /* Check application resource values here */ font_width = xc_app_data.normalFont->max_bounds.rbearing - xc_app_data.normalFont->min_bounds.lbearing; font_height = xc_app_data.normalFont->max_bounds.ascent + xc_app_data.normalFont->max_bounds.descent; font_ascent = xc_app_data.normalFont->max_bounds.ascent; font_descent = xc_app_data.normalFont->max_bounds.descent; /* Check that the italic font and normal fonts are the same size */ /* italic fonts can have negative lbearings! */ if ( xc_app_data.italicFont->min_bounds.lbearing < 0 ) italic_font_width = xc_app_data.italicFont->max_bounds.rbearing + xc_app_data.italicFont->min_bounds.lbearing; else italic_font_width = xc_app_data.italicFont->max_bounds.rbearing - xc_app_data.italicFont->min_bounds.lbearing; italic_font_height = xc_app_data.italicFont->max_bounds.ascent + xc_app_data.italicFont->max_bounds.descent; italic_font_valid = (font_width == italic_font_width) && (font_height == italic_font_height); /* Check that the bold font and normal fonts are the same size */ if ( xc_app_data.boldFont->min_bounds.lbearing < 0 ) bold_font_width = xc_app_data.boldFont->max_bounds.rbearing + xc_app_data.boldFont->min_bounds.lbearing; else bold_font_width = xc_app_data.boldFont->max_bounds.rbearing - xc_app_data.boldFont->min_bounds.lbearing; bold_font_height = xc_app_data.boldFont->max_bounds.ascent + xc_app_data.boldFont->max_bounds.descent; bold_font_valid = (font_width == bold_font_width) && (font_height == bold_font_height); /* Calculate size of display window */ XCursesCOLS = xc_app_data.cols; XCursesLINES = xc_app_data.lines; window_width = font_width * XCursesCOLS + 2 * xc_app_data.borderWidth; window_height = font_height * XCursesLINES + 2 * xc_app_data.borderWidth; minwidth = font_width * 2 + xc_app_data.borderWidth * 2; minheight = font_height * 2 + xc_app_data.borderWidth * 2; /* Set up the icon for the application; the default is an internal one for PDCurses. Then set various application level resources. */ _get_icon(); #ifdef HAVE_XPM_H if (xc_app_data.pixmap && xc_app_data.pixmap[0]) XtVaSetValues(topLevel, XtNminWidth, minwidth, XtNminHeight, minheight, XtNbaseWidth, xc_app_data.borderWidth * 2, XtNbaseHeight, xc_app_data.borderWidth * 2, XtNiconPixmap, icon_pixmap, XtNiconMask, icon_pixmap_mask, NULL); else #endif XtVaSetValues(topLevel, XtNminWidth, minwidth, XtNminHeight, minheight, XtNbaseWidth, xc_app_data.borderWidth * 2, XtNbaseHeight, xc_app_data.borderWidth * 2, XtNiconPixmap, icon_bitmap, NULL); /* Create a BOX widget in which to draw */ if (xc_app_data.scrollbarWidth && sb_started) { scrollBox = XtVaCreateManagedWidget(program_name, scrollBoxWidgetClass, topLevel, XtNwidth, window_width + xc_app_data.scrollbarWidth, XtNheight, window_height + xc_app_data.scrollbarWidth, XtNwidthInc, font_width, XtNheightInc, font_height, NULL); drawing = XtVaCreateManagedWidget(program_name, boxWidgetClass, scrollBox, XtNwidth, window_width, XtNheight, window_height, XtNwidthInc, font_width, XtNheightInc, font_height, NULL); scrollVert = XtVaCreateManagedWidget("scrollVert", scrollbarWidgetClass, scrollBox, XtNorientation, XtorientVertical, XtNheight, window_height, XtNwidth, xc_app_data.scrollbarWidth, NULL); XtAddCallback(scrollVert, XtNscrollProc, _scroll_up_down, drawing); XtAddCallback(scrollVert, XtNjumpProc, _thumb_up_down, drawing); scrollHoriz = XtVaCreateManagedWidget("scrollHoriz", scrollbarWidgetClass, scrollBox, XtNorientation, XtorientHorizontal, XtNwidth, window_width, XtNheight, xc_app_data.scrollbarWidth, NULL); XtAddCallback(scrollHoriz, XtNscrollProc, _scroll_left_right, drawing); XtAddCallback(scrollHoriz, XtNjumpProc, _thumb_left_right, drawing); } else { drawing = XtVaCreateManagedWidget(program_name, boxWidgetClass, topLevel, XtNwidth, window_width, XtNheight, window_height, XtNwidthInc, font_width, XtNheightInc, font_height, NULL); XtVaSetValues(topLevel, XtNwidthInc, font_width, XtNheightInc, font_height, NULL); } /* Process any default translations */ XtAugmentTranslations(drawing, XtParseTranslationTable(default_translations)); XtAppAddActions(app_context, action_table, XtNumber(action_table)); /* Process the supplied colors */ _initialize_colors(); /* Now have LINES and COLS. Set these in the shared SP so the curses program can find them. */ LINES = XCursesLINES; COLS = XCursesCOLS; if ((shmidSP = shmget(shmkeySP, sizeof(SCREEN) + XCURSESSHMMIN, 0700 | IPC_CREAT)) < 0) { perror("Cannot allocate shared memory for SCREEN"); kill(xc_otherpid, SIGKILL); return ERR; } SP = (SCREEN*)shmat(shmidSP, 0, 0); memset(SP, 0, sizeof(SCREEN)); SP->XcurscrSize = XCURSCR_SIZE; SP->lines = XCursesLINES; SP->cols = XCursesCOLS; SP->mouse_wait = xc_app_data.clickPeriod; SP->audible = TRUE; PDC_LOG(("%s:SHM size for curscr %d\n", XCLOGMSG, SP->XcurscrSize)); if ((shmid_Xcurscr = shmget(shmkey_Xcurscr, SP->XcurscrSize + XCURSESSHMMIN, 0700 | IPC_CREAT)) < 0) { perror("Cannot allocate shared memory for curscr"); kill(xc_otherpid, SIGKILL); shmdt((char *)SP); shmctl(shmidSP, IPC_RMID, 0); return ERR; } Xcurscr = (unsigned char *)shmat(shmid_Xcurscr, 0, 0); memset(Xcurscr, 0, SP->XcurscrSize); xc_atrtab = (short *)(Xcurscr + XCURSCR_ATRTAB_OFF); PDC_LOG(("%s:shmid_Xcurscr %d shmkey_Xcurscr %d LINES %d COLS %d\n", XCLOGMSG, shmid_Xcurscr, shmkey_Xcurscr, LINES, COLS)); /* Add Event handlers to the drawing widget */ XtAddEventHandler(drawing, ExposureMask, False, _handle_expose, NULL); XtAddEventHandler(drawing, StructureNotifyMask, False, _handle_structure_notify, NULL); XtAddEventHandler(drawing, EnterWindowMask | LeaveWindowMask, False, _handle_enter_leave, NULL); XtAddEventHandler(topLevel, 0, True, _handle_nonmaskable, NULL); /* Add input handler from xc_display_sock (requests from curses program) */ XtAppAddInput(app_context, xc_display_sock, (XtPointer)XtInputReadMask, _process_curses_requests, NULL); /* start the Timeout event for blinking the cursor (and blinking text) */ XtAppAddTimeOut(app_context, CURSOR_BLINK_RATE, _blink_cursor, NULL); /* Leave telling the curses process that it can start to here so that when the curses process makes a request, the Xcurses process can service the request. */ XC_write_display_socket_int(CURSES_CHILD); XtRealizeWidget(topLevel); /* Handle trapping of the WM_DELETE_WINDOW property */ wm_atom[0] = XInternAtom(XtDisplay(topLevel), "WM_DELETE_WINDOW", False); XSetWMProtocols(XtDisplay(topLevel), XtWindow(topLevel), wm_atom, 1); /* Create the Graphics Context for drawing. This MUST be done AFTER the associated widget has been realized. */ XC_LOG(("before _get_gc\n")); _get_gc(&normal_gc, xc_app_data.normalFont, COLOR_WHITE, COLOR_BLACK); _get_gc(&italic_gc, italic_font_valid ? xc_app_data.italicFont : xc_app_data.normalFont, COLOR_WHITE, COLOR_BLACK); _get_gc(&bold_gc, bold_font_valid ? xc_app_data.boldFont : xc_app_data.normalFont, COLOR_WHITE, COLOR_BLACK); _get_gc(&block_cursor_gc, xc_app_data.normalFont, COLOR_BLACK, COLOR_CURSOR); _get_gc(&rect_cursor_gc, xc_app_data.normalFont, COLOR_CURSOR, COLOR_BLACK); _get_gc(&border_gc, xc_app_data.normalFont, COLOR_BORDER, COLOR_BLACK); XSetLineAttributes(XCURSESDISPLAY, rect_cursor_gc, 2, LineSolid, CapButt, JoinMiter); XSetLineAttributes(XCURSESDISPLAY, border_gc, xc_app_data.borderWidth, LineSolid, CapButt, JoinMiter); /* Set the cursor for the application */ XDefineCursor(XCURSESDISPLAY, XCURSESWIN, xc_app_data.pointer); rmfrom.size = sizeof(Pixel); rmto.size = sizeof(XColor); rmto.addr = (XPointer)&pointerforecolor; rmfrom.addr = (XPointer)&(xc_app_data.pointerForeColor); XtConvertAndStore(drawing, XtRPixel, &rmfrom, XtRColor, &rmto); rmfrom.size = sizeof(Pixel); rmto.size = sizeof(XColor); rmfrom.addr = (XPointer)&(xc_app_data.pointerBackColor); rmto.addr = (XPointer)&pointerbackcolor; XtConvertAndStore(drawing, XtRPixel, &rmfrom, XtRColor, &rmto); XRecolorCursor(XCURSESDISPLAY, xc_app_data.pointer, &pointerforecolor, &pointerbackcolor); #ifndef PDC_XIM /* Convert the supplied compose key to a Keysym */ compose_key = XStringToKeysym(xc_app_data.composeKey); if (compose_key && IsModifierKey(compose_key)) { int i, j; KeyCode *kcp; XModifierKeymap *map; KeyCode compose_keycode = XKeysymToKeycode(XCURSESDISPLAY, compose_key); map = XGetModifierMapping(XCURSESDISPLAY); kcp = map->modifiermap; for (i = 0; i < 8; i++) { for (j = 0; j < map->max_keypermod; j++, kcp++) { if (!*kcp) continue; if (compose_keycode == *kcp) { compose_mask = state_mask[i]; break; } } if (compose_mask) break; } XFreeModifiermap(map); } #else Xim = XOpenIM(XCURSESDISPLAY, NULL, NULL, NULL); if (Xim) { Xic = XCreateIC(Xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, XCURSESWIN, NULL); } if (Xic) { long im_event_mask; XGetICValues(Xic, XNFilterEvents, &im_event_mask, NULL); if (im_event_mask) XtAddEventHandler(drawing, im_event_mask, False, _dummy_handler, NULL); XSetICFocus(Xic); } else { perror("ERROR: Cannot create input context"); kill(xc_otherpid, SIGKILL); shmdt((char *)SP); shmdt((char *)Xcurscr); shmctl(shmidSP, IPC_RMID, 0); shmctl(shmid_Xcurscr, IPC_RMID, 0); return ERR; } #endif /* Wait for events */ { XEvent event; for (;;) /* forever */ { XtAppNextEvent(app_context, &event); XtDispatchEvent(&event); } } return OK; /* won't get here */ } curses-1.4.4/vendor/PDCurses/x11/compose.h0000644000004100000410000002322114201713275020272 0ustar www-datawww-data/* Public Domain Curses */ /* Tables and variables for the built-in compose key system. This file is not included when PDCurses is built with XIM support. */ #define MAX_COMPOSE_CHARS 14 #define MAX_COMPOSE_PRE 60 static const char *compose_chars = "`'~^,/\"AaPpSs!?0123CcRr-_<>Xx.=Yy |EeIiOoUu+NnLlgDd:*TtMmVv"; /* ` : À È ÃŒ Ã’ Ù à è ì ò ù ' : ´ à É à Ó Ú à á é í ó ú ý ´ ~ : Ã Ñ Õ ã ñ õ ^ : Â Ê ÃŽ Ô Û â ê î ô û ° ¹ ² ³ , : ¸ Ç ç ¸ / : Ø ø µ µ " : ¨ Ä Ë à Ö Ü ä ë ï ö ü ÿ ¨ A : Æ À à à  Å Ã… à  ª a : æ à á ã â Ã¥ Ã¥ ã â ª P : Þ ¶ ¶ p : þ ¶ ¶ S : § § § º ª s : ß § ª ¹ ² ³ º § ! : ¡ ¡ ? : ¿ ¿ 0 : ° ° 1 : ¹ ½ ¼ ¹ 2 : ² ² 3 : ³ ¾ ³ C : © Ç ¢ ¢ c : ¢ © ç ¢ ¢ R : ® r : ® - : ­ ± ¬ ­ ¯ ÷ _ : ¯ ¯ < : « > : « X : ¤ × x : × ¤ × . : · · · = : Â¥ Â¥ Y : Â¥ à ¥ y : Â¥ ý ÿ Â¥ Â¥ : | : ¦ ¢ ¦ Þ þ ¦ £ E : È É Ê Ë Ê e : è é ê ë ê I : ÃŒ à Î à Î i : ì í î ï î O : Ã’ Ó Ô Õ Ö Ø © ® Õ Ô Ã… Ã¥ o : ° Ã… Ã¥ ¤ õ ò ó ô õ ö ø ô º U : Ù Ú Û Ü Û u : ù ú û ü µ û + : ± N : Ñ Ñ ¬ n : ñ ñ ¬ L : £ £ £ l : £ £ £ g : ¤ D : ° à d : ° ð : : ÷ * : µ µ Ã¥ Ã… T : Þ t : þ M : × m : × V : ¦ v : ¦ */ static const char compose_lookups[MAX_COMPOSE_PRE][MAX_COMPOSE_CHARS] = { /* ` */ {'A','E','I','O','U','a','e','i','o','u', 0, 0, 0, 0}, /* ' */ {' ','A','E','I','O','U','Y','a','e','i','o','u','y', 39}, /* ~ */ {'A','N','O','a','n','o', 0, 0, 0, 0, 0, 0, 0, 0}, /* ^ */ {'A','E','I','O','U','a','e','i','o','u','0','1','2','3'}, /* , */ {' ','C','c',',', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* / */ {'O','o','u','U', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* " */ {' ','A','E','I','O','U','a','e','i','o','u','y','\"', 0}, /* A */ {'E','`', 39,'~','^','"','o','*','-','>','_', 0, 0, 0}, /* a */ {'e','`', 39,'~','^','"','o','*','-','>','_', 0, 0, 0}, /* P */ {' ','G','!', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* p */ {' ','g','!', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* S */ {'S','!','O','0','A', 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* s */ {'s','!','a','1','2','3','0','o', 0, 0, 0, 0, 0, 0}, /* ! */ {' ','!', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* ? */ {' ','?', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* 0 */ {'^','*', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1 */ {' ','2','4','^', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* 2 */ {' ','^', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* 3 */ {' ','4','^', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* C */ {'O',',','$','|', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* c */ {'|','o',',','/','$', 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* R */ {'O', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* r */ {'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* - */ {' ','+',',','-','^',':', 0, 0, 0, 0, 0, 0, 0, 0}, /* _ */ {'_','^', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* < */ {'<', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* > */ {'>', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* X */ {'O','X', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* x */ {' ','o','x', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* . */ {' ','^','.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* = */ {'Y','y', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* Y */ {'=', 39,'-', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* y */ {'=', 39,'"','$','-', 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* */ {' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* | */ {' ','c','|','P','p','^','-', 0, 0, 0, 0, 0, 0, 0}, /* E */ {'`', 39,'^','"','>', 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* e */ {'`', 39,'^','"','>', 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* I */ {'`', 39,'^','"','>', 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* i */ {'`', 39,'^','"','>', 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* O */ {'`', 39,'^','~','"','/','C','R','-','>','A','a', 0, 0}, /* o */ {' ','A','a','x','-','`', 39,'^','~','"','/','>','_', 0}, /* U */ {'`', 39,'^','"','>', 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* u */ {'`', 39,'^','"',' ','>', 0, 0, 0, 0, 0, 0, 0, 0}, /* + */ {'-', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* N */ {'~','-','O', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* n */ {'~','-','o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* L */ {'$','=','-', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* l */ {'$','=','-', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* g */ {'$', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* D */ {'E','-', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* d */ {'e','-', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* : */ {'-', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* * */ {'m','M','a','A', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* T */ {'H', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* t */ {'h', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* M */ {'U', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* m */ {'u', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* V */ {'B', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* v */ {'b', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, }; static const unsigned char compose_keys[MAX_COMPOSE_PRE][MAX_COMPOSE_CHARS] = { /* ` */ {192,200,204,210,217,224,232,236,242,249, 0, 0, 0, 0}, /* ' */ {180,193,201,205,211,218,221,225,233,237,243,250,253,180}, /* ~ */ {195,209,213,227,241,245, 0, 0, 0, 0, 0, 0, 0, 0}, /* ^ */ {194,202,206,212,219,226,234,238,244,251,176,185,178,179}, /* , */ {184,199,231,184, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* / */ {216,248,181,181, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* " */ {168,196,203,207,214,220,228,235,239,246,252,255,168, 0}, /* A */ {198,192,193,195,194,196,197,197,195,194,170, 0, 0, 0}, /* a */ {230,224,225,227,226,228,229,229,227,226,170, 0, 0, 0}, /* P */ {222,182,182, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* p */ {254,182,182, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* S */ {167,167,167,186,170, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* s */ {223,167,170,185,178,179,186,167, 0, 0, 0, 0, 0, 0}, /* ! */ {161,161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* ? */ {191,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* 0 */ {176,176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1 */ {185,189,188,185, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* 2 */ {178,178, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* 3 */ {179,190,179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* C */ {169,199,162,162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* c */ {162,169,231,162,162, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* R */ {174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* r */ {174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* - */ {173,177,172,173,175,247, 0, 0, 0, 0, 0, 0, 0, 0}, /* _ */ {175,175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* < */ {171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* > */ {187, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* X */ {164,215, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* x */ {215,164,215, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* . */ {183,183,183, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* = */ {165,165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* Y */ {165,221,165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* y */ {165,253,255,165,165, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* */ {160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* | */ {166,162,166,222,254,166,163, 0, 0, 0, 0, 0, 0, 0}, /* E */ {200,201,202,203,202, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* e */ {232,233,234,235,234, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* I */ {204,205,206,207,206, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* i */ {236,237,238,239,238, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* O */ {210,211,212,213,214,216,169,174,213,212,197,229, 0, 0}, /* o */ {176,197,229,164,245,242,243,244,245,246,248,244,186, 0}, /* U */ {217,218,219,220,219, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* u */ {249,250,251,252,181,251, 0, 0, 0, 0, 0, 0, 0, 0}, /* + */ {177, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* N */ {209,209,172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* n */ {241,241,172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* L */ {163,163,163, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* l */ {163,163,163, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* g */ {164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* D */ {176,208, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* d */ {176,240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* : */ {247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* * */ {181,181,229,197, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* T */ {222, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* t */ {254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* M */ {215, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* u */ {215, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* V */ {166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* v */ {166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, }; static KeySym compose_key = 0; static int compose_mask = 0; curses-1.4.4/vendor/PDCurses/x11/README.md0000644000004100000410000000403114201713275017731 0ustar www-datawww-dataPDCurses for X11 ================ This is a port of PDCurses for X11, aka XCurses. It is designed to allow existing curses programs to be re-compiled with PDCurses, resulting in native X11 programs. Building -------- - Run "./configure". To build the wide-character version of the library, specify "--enable-widec" as a parameter. To use X Input Methods, add "--enable-xim". I recommend these options, but I haven't yet made them the defaults, for the sake of backwards compatibility and due to their new and relatively untested status. If your system is lacking in UTF-8 support, you can force the use of UTF-8 instead of the system locale via "--enable-force-utf8". This is generally more useful in Windows. If configure can't find your X include files or X libraries, you can specify the paths with the arguments "--x-includes=inc_path" and/or "--x-libraries=lib_path". By default, the library and demo programs are built with the optimizer switch -O2. You can turn this off, and turn on debugging (-g), by adding "--enable-debug" to the configure command. - Run "make". This should build libXCurses and all the demo programs. - Optionally, run "make install". curses.h and panel.h will be renamed when installed (to xcurses.h and xpanel.h), to avoid conflicts with any existing curses installations. Unrenamed copies of curses.h and panel.h are installed in (by default) /usr/local/include/xcurses. libXpanel is just a symlink to libXCurses. Both curses and panel functions are in the main library. Distribution Status ------------------- As of April 13, 2006, the files in this directory are released to the Public Domain, except for ScrollBox*, which are under essentially the MIT X License. To be Done ---------- - have newterm() create a new X window - provide a command line parsing function to enable X command line arguments to be parsed and stripped from the arguments passed back to the calling procedure. Acknowledgements ---------------- X11 port was provided by Mark Hessling curses-1.4.4/vendor/PDCurses/x11/pdckbd.c0000644000004100000410000000443114201713275020051 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcx11.h" /*man-start************************************************************** pdckbd ------ ### Synopsis unsigned long PDC_get_input_fd(void); ### Description PDC_get_input_fd() returns the file descriptor that PDCurses reads its input from. It can be used for select(). ### Portability X/Open BSD SYS V PDC_get_input_fd - - - **man-end****************************************************************/ /* check if a key or mouse event is waiting */ bool PDC_check_key(void) { struct timeval socket_timeout = {0}; int s; /* Is something ready to be read on the socket ? Must be a key. */ FD_ZERO(&xc_readfds); FD_SET(xc_key_sock, &xc_readfds); if ((s = select(FD_SETSIZE, (FD_SET_CAST)&xc_readfds, NULL, NULL, &socket_timeout)) < 0) XCursesExitCursesProcess(3, "child - exiting from " "PDC_check_key select failed"); PDC_LOG(("%s:PDC_check_key() - returning %s\n", XCLOGMSG, s ? "TRUE" : "FALSE")); return !!s; } /* return the next available key or mouse event */ int PDC_get_key(void) { unsigned long newkey = 0; int key = 0; if (XC_read_socket(xc_key_sock, &newkey, sizeof(unsigned long)) < 0) XCursesExitCursesProcess(2, "exiting from PDC_get_key"); pdc_key_modifiers = (newkey >> 24) & 0xFF; key = (int)(newkey & 0x00FFFFFF); if (key == KEY_MOUSE && SP->key_code) { if (XC_read_socket(xc_key_sock, &pdc_mouse_status, sizeof(MOUSE_STATUS)) < 0) XCursesExitCursesProcess(2, "exiting from PDC_get_key"); } PDC_LOG(("%s:PDC_get_key() - key %d returned\n", XCLOGMSG, key)); return key; } unsigned long PDC_get_input_fd(void) { PDC_LOG(("PDC_get_input_fd() - called\n")); return xc_key_sock; } void PDC_set_keyboard_binary(bool on) { PDC_LOG(("PDC_set_keyboard_binary() - called\n")); } /* discard any pending keyboard or mouse input -- this is the core routine for flushinp() */ void PDC_flushinp(void) { PDC_LOG(("PDC_flushinp() - called\n")); while (PDC_check_key()) PDC_get_key(); } int PDC_mouse_set(void) { return OK; } int PDC_modifiers_set(void) { return OK; } curses-1.4.4/vendor/PDCurses/x11/config.sub0000755000004100000410000007746014201713275020455 0ustar www-datawww-data#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2006-09-20' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: curses-1.4.4/vendor/PDCurses/x11/debian/0000755000004100000410000000000014201713275017676 5ustar www-datawww-datacurses-1.4.4/vendor/PDCurses/x11/debian/compat0000644000004100000410000000000214201713275021074 0ustar www-datawww-data5 curses-1.4.4/vendor/PDCurses/x11/debian/rules0000755000004100000410000000461614201713275020765 0ustar www-datawww-data#!/usr/bin/make -f # -*- makefile -*- # Sample debian/rules that uses debhelper. # This file was originally written by Joey Hess and Craig Small. # As a special exception, when this file is copied by dh-make into a # dh-make output file, you may use that output file without restriction. # This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) config.status: configure dh_testdir # Add here commands to configure the package. ifneq "$(wildcard /usr/share/misc/config.sub)" "" cp -f /usr/share/misc/config.sub config.sub endif ifneq "$(wildcard /usr/share/misc/config.guess)" "" cp -f /usr/share/misc/config.guess config.guess endif ./configure --enable-libdir-change=no --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs" --enable-force-utf8 --enable-widec build: build-stamp build-stamp: config.status dh_testdir # Add here commands to compile the package. $(MAKE) touch $@ clean: dh_testdir dh_testroot rm -f build-stamp # Add here commands to clean up after the build process. -$(MAKE) distclean rm -f config.sub config.guess dh_clean install: build dh_testdir dh_testroot dh_clean -k dh_installdirs # Add here commands to install the package into debian/pdcurses $(MAKE) prefix=$(CURDIR)/debian/pdcurses/usr install # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot dh_installchangelogs dh_installdocs dh_installexamples # dh_install # dh_installmenu # dh_installdebconf # dh_installlogrotate # dh_installemacsen # dh_installpam # dh_installmime # dh_python # dh_installinit # dh_installcron # dh_installinfo dh_installman dh_link dh_strip dh_compress dh_fixperms # dh_perl dh_makeshlibs dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install curses-1.4.4/vendor/PDCurses/x11/debian/control0000644000004100000410000000044714201713275021306 0ustar www-datawww-dataSource: pdcurses Section: devel Priority: optional Maintainer: Mark Hessling Build-Depends: debhelper (>= 5), autotools-dev Standards-Version: 3.7.2 Package: pdcurses Architecture: any Depends: ${shlibs:Depends} Description: Public Domand CUrses library for multiple platforms. curses-1.4.4/vendor/PDCurses/x11/debian/copyright0000644000004100000410000000150714201713275021634 0ustar www-datawww-dataThis package was debianized by Mark Hessling on Mon, 22 Jul 2013 13:18:35 +1000. Upstream Author: William Mcbrine Copyright: Public Domain License: The core package is in the public domain, but small portions of PDCurses are subject to copyright under various licenses. Each directory contains a README file, with a section titled "Distribution Status" which describes the status of the files in that directory. If you use PDCurses in an application, an acknowledgement would be appreciated, but is not mandatory. If you make corrections or enhancements to PDCurses, please forward them to the current maintainer for the benefit of other users. This software is provided AS IS with NO WARRANTY whatsoever. The Debian packaging is Public Domain curses-1.4.4/vendor/PDCurses/x11/debian/changelog0000644000004100000410000000025414201713275021551 0ustar www-datawww-datapdcurses (3.4-1) unstable; urgency=low * Initial deb package * See HISTORY file for full changelog -- Mark Hessling Mon, 22 Jul 2013 12:00:00 +1000 curses-1.4.4/vendor/PDCurses/x11/pdcx11.c0000644000004100000410000001546014201713275017726 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcx11.h" #include #include /*** Functions that are called by both processes ***/ unsigned char *Xcurscr; int XCursesProcess = 1; int shmidSP; int shmid_Xcurscr; int shmkeySP; int shmkey_Xcurscr; int xc_otherpid; int XCursesLINES = 24; int XCursesCOLS = 80; int xc_display_sock; int xc_key_sock; int xc_display_sockets[2]; int xc_key_sockets[2]; int xc_exit_sock; fd_set xc_readfds; static void _dummy_function(void) { PDC_napms( 1); } void XC_get_line_lock(int row) { /* loop until we can write to the line -- Patch by: Georg Fuchs, georg.fuchs@rz.uni-regensburg.de */ while (*(Xcurscr + XCURSCR_FLAG_OFF + row)) _dummy_function(); *(Xcurscr + XCURSCR_FLAG_OFF + row) = 1; } void XC_release_line_lock(int row) { *(Xcurscr + XCURSCR_FLAG_OFF + row) = 0; } int XC_write_socket(int sock_num, const void *buf, int len) { int start = 0, rc; PDC_LOG(("%s:XC_write_socket called: sock_num %d len %d\n", XCLOGMSG, sock_num, len)); #ifdef MOUSE_DEBUG if (sock_num == xc_key_sock) printf("%s:XC_write_socket(key) len: %d\n", XCLOGMSG, len); #endif while (1) { rc = write(sock_num, (const char *)buf + start, len); if (rc < 0 || rc == len) return rc; len -= rc; start = rc; } } int XC_read_socket(int sock_num, void *buf, int len) { int start = 0, length = len, rc; PDC_LOG(("%s:XC_read_socket called: sock_num %d len %d\n", XCLOGMSG, sock_num, len)); while (1) { rc = read(sock_num, (char *)buf + start, length); #ifdef MOUSE_DEBUG if (sock_num == xc_key_sock) printf("%s:XC_read_socket(key) rc %d errno %d " "resized: %d\n", XCLOGMSG, rc, errno, SP->resized); #endif if (rc < 0 && sock_num == xc_key_sock && errno == EINTR && SP->resized != FALSE) { MOUSE_LOG(("%s:continuing\n", XCLOGMSG)); rc = 0; if (SP->resized > 1) SP->resized = TRUE; else SP->resized = FALSE; memcpy(buf, &rc, sizeof(int)); return 0; } if (rc <= 0 || rc == length) return rc; length -= rc; start = rc; } } int XC_write_display_socket_int(int x) { return XC_write_socket(xc_display_sock, &x, sizeof(int)); } #ifdef PDCDEBUG void XC_say(const char *msg) { PDC_LOG(("%s:%s", XCLOGMSG, msg)); } #endif /*** Functions that are called by the "curses" process ***/ int XCursesInstruct(int flag) { PDC_LOG(("%s:XCursesInstruct() - called flag %d\n", XCLOGMSG, flag)); /* Send a request to X */ if (XC_write_display_socket_int(flag) < 0) XCursesExitCursesProcess(4, "exiting from XCursesInstruct"); return OK; } int XCursesInstructAndWait(int flag) { int result; XC_LOG(("XCursesInstructAndWait() - called\n")); /* tell X we want to do something */ XCursesInstruct(flag); /* wait for X to say the refresh has occurred*/ if (XC_read_socket(xc_display_sock, &result, sizeof(int)) < 0) XCursesExitCursesProcess(5, "exiting from XCursesInstructAndWait"); if (result != CURSES_CONTINUE) XCursesExitCursesProcess(6, "exiting from XCursesInstructAndWait" " - synchronization error"); return OK; } static int _setup_curses(void) { int wait_value; XC_LOG(("_setup_curses called\n")); close(xc_display_sockets[1]); close(xc_key_sockets[1]); xc_display_sock = xc_display_sockets[0]; xc_key_sock = xc_key_sockets[0]; FD_ZERO(&xc_readfds); XC_read_socket(xc_display_sock, &wait_value, sizeof(int)); if (wait_value != CURSES_CHILD) return ERR; /* Set LINES and COLS now so that the size of the shared memory segment can be allocated */ if ((shmidSP = shmget(shmkeySP, sizeof(SCREEN) + XCURSESSHMMIN, 0700)) < 0) { perror("Cannot allocate shared memory for SCREEN"); kill(xc_otherpid, SIGKILL); return ERR; } SP = (SCREEN*)shmat(shmidSP, 0, 0); XCursesLINES = SP->lines; LINES = XCursesLINES - SP->linesrippedoff - SP->slklines; XCursesCOLS = COLS = SP->cols; if ((shmid_Xcurscr = shmget(shmkey_Xcurscr, SP->XcurscrSize + XCURSESSHMMIN, 0700)) < 0) { perror("Cannot allocate shared memory for curscr"); kill(xc_otherpid, SIGKILL); return ERR; } PDC_LOG(("%s:shmid_Xcurscr %d shmkey_Xcurscr %d LINES %d COLS %d\n", XCLOGMSG, shmid_Xcurscr, shmkey_Xcurscr, LINES, COLS)); Xcurscr = (unsigned char *)shmat(shmid_Xcurscr, 0, 0); xc_atrtab = (short *)(Xcurscr + XCURSCR_ATRTAB_OFF); XC_LOG(("cursesprocess exiting from Xinitscr\n")); /* Always trap SIGWINCH if the C library supports SIGWINCH */ XCursesSetSignal(SIGWINCH, XCursesSigwinchHandler); atexit(XCursesExit); return OK; } int XCursesInitscr(int argc, char *argv[]) { int pid, rc; XC_LOG(("XCursesInitscr() - called\n")); shmkeySP = getpid(); if (socketpair(AF_UNIX, SOCK_STREAM, 0, xc_display_sockets) < 0) { fprintf(stderr, "ERROR: cannot create display socketpair\n"); return ERR; } if (socketpair(AF_UNIX, SOCK_STREAM, 0, xc_key_sockets) < 0) { fprintf(stderr, "ERROR: cannot create key socketpair\n"); return ERR; } pid = fork(); switch(pid) { case -1: fprintf(stderr, "ERROR: cannot fork()\n"); return ERR; break; case 0: /* child */ shmkey_Xcurscr = getpid(); #ifdef XISPARENT XCursesProcess = 0; rc = _setup_curses(); #else XCursesProcess = 1; xc_otherpid = getppid(); rc = XCursesSetupX(argc, argv); #endif break; default: /* parent */ shmkey_Xcurscr = pid; #ifdef XISPARENT XCursesProcess = 1; xc_otherpid = pid; rc = XCursesSetupX(argc, argv); #else XCursesProcess = 0; rc = _setup_curses(); #endif } return rc; } static void _cleanup_curses_process(int rc) { PDC_LOG(("%s:_cleanup_curses_process() - called: %d\n", XCLOGMSG, rc)); shutdown(xc_display_sock, 2); close(xc_display_sock); shutdown(xc_key_sock, 2); close(xc_key_sock); shmdt((char *)SP); shmdt((char *)Xcurscr); if (rc) _exit(rc); } void XCursesExitCursesProcess(int rc, char *msg) { PDC_LOG(("%s:XCursesExitCursesProcess() - called: %d %s\n", XCLOGMSG, rc, msg)); endwin(); _cleanup_curses_process(rc); } void XCursesExit(void) { static bool called = FALSE; XC_LOG(("XCursesExit() - called\n")); if (FALSE == called) { XCursesInstruct(CURSES_EXIT); _cleanup_curses_process(0); called = TRUE; } } curses-1.4.4/vendor/PDCurses/x11/pdcsetsc.c0000644000004100000410000000647714201713275020446 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcx11.h" #include /*man-start************************************************************** pdcsetsc -------- ### Synopsis int PDC_set_blink(bool blinkon); void PDC_set_title(const char *title); ### Description PDC_set_blink() toggles whether the A_BLINK attribute sets an actual blink mode (TRUE), or sets the background color to high intensity (FALSE). The default is platform-dependent (FALSE in most cases). It returns OK if it could set the state to match the given parameter, ERR otherwise. Current platforms also adjust the value of COLORS according to this function -- 16 for FALSE, and 8 for TRUE. PDC_set_title() sets the title of the window in which the curses program is running. This function may not do anything on some platforms. (Currently it only works in Win32 and X11.) ### Portability X/Open BSD SYS V PDC_set_blink - - - PDC_set_title - - - **man-end****************************************************************/ int PDC_curs_set(int visibility) { int ret_vis = SP->visibility; PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); if (visibility != -1) SP->visibility = visibility; PDC_display_cursor(SP->cursrow, SP->curscol, SP->cursrow, SP->curscol, visibility); return ret_vis; } void PDC_set_title(const char *title) { int len; PDC_LOG(("PDC_set_title() - called:<%s>\n", title)); len = strlen(title) + 1; /* write nul character */ XCursesInstruct(CURSES_TITLE); if (XC_write_display_socket_int(len) >= 0) if (XC_write_socket(xc_display_sock, title, len) >= 0) return; XCursesExitCursesProcess(1, "exiting from PDC_set_title"); } /* If PDC_really_blinking is TRUE, then text with the A_BLINK */ /* attribute will actually blink. Otherwise, such text will */ /* be shown with higher color intensity (the R, G, and B values */ /* are averaged with pure white). See pdcdisp.c for details of */ /* how this is done. */ /* Unlike on other PDCurses platforms, this doesn't require */ /* decreasing the number of colors by half. Also, the choice */ /* indicated by 'blinkon' will actually be respected, so OK is */ /* always returned (most platforms don't actually support */ /* blinking). */ /* The default behavior is to not show A_BLINK text as */ /* blinking, i.e., PDC_really_blinking = FALSE. Blinking text */ /* can be pretty annoying to some people. You should probably */ /* call PDC_set_blink( TRUE) only if there is something to which */ /* the user _must_ pay attention; say, "the nuclear reactor */ /* is about to melt down". Otherwise, the bolder, brighter */ /* text should be attention-getting enough. */ int PDC_set_blink(bool blinkon) { if (pdc_color_started) /* We've got 256 colors in this version */ COLORS = 256; XCursesInstruct( blinkon ? CURSES_BLINK_ON : CURSES_BLINK_OFF); return OK; } curses-1.4.4/vendor/PDCurses/x11/configure.ac0000644000004100000410000001540314201713275020745 0ustar www-datawww-datadnl Process this file with autoconf to produce a configure script. AC_INIT([PDCurses], [3.4], [wmcbrine@gmail.com], [PDCurses]) AC_CONFIG_SRCDIR([pdcx11.h]) AC_SUBST(prefix) AC_PROG_CC AC_CONFIG_HEADER(config.h) dnl Checks for system first AC_CANONICAL_SYSTEM([]) on_qnx=no on_osx=no case "$target" in *hp-hpux*) SYS_DEFS="-D_HPUX_SOURCE" ;; *ibm-aix*) SYS_DEFS="-D_ALL_SOURCE" ;; *dec-osf*) SYS_DEFS="-D_XOPEN_SOURCE_EXTENDED" ;; *pc-sco*) SYS_DEFS="-UM_XENIX -b elf" ;; *qnx*) on_qnx=yes SYS_DEFS="-Q" ;; *apple-darwin*) on_osx=yes MH_CHECK_OSX_ARCH() SYS_DEFS="$valid_arch_flags" EEXTRA="$valid_arch_flags" ;; *) ;; esac AC_SUBST(SYS_DEFS) AC_SUBST(EEXTRA) MH_CHECK_MAX_SIGNALS(NSIG __sys_nsig) dnl Check for other programs. AC_PROG_LN_S AC_PROG_RANLIB AC_PROG_INSTALL AC_PROG_MAKE_SET dnl ensure that the system has System V IPC support MH_IPC if test $ac_cv_header_stdc != yes; then AC_MSG_ERROR([Need ANSI C headers]) fi dnl Checks for libraries. dnl we check for dlfcn.h or dl.h so we know if we can build shared objects AC_CHECK_HEADERS(fcntl.h \ sys/time.h \ sys/select.h \ dlfcn.h \ dl.h ) dnl Checks for typedefs, structures, and compiler characteristics. AC_HEADER_TIME MH_CHECK_LIB(socket nls) AC_SUBST(MH_EXTRA_LIBS) MH_CHECK_CC_O dnl Checks for library functions. AC_TYPE_SIGNAL AC_CHECK_FUNCS(vsscanf usleep poll vsnprintf) dnl Check for X includes and X libraries AC_PATH_X MH_CHECK_X_INC MH_CHECK_X_LIB MH_CHECK_X_HEADERS(DECkeysym.h Sunkeysym.h xpm.h XF86keysym.h) MH_CHECK_X_KEYDEFS(XK_KP_Delete XK_KP_Insert XK_KP_End XK_KP_Down XK_KP_Next \ XK_KP_Left XK_KP_Right XK_KP_Home XK_KP_Up XK_KP_Prior XK_KP_Begin) MH_CHECK_X_TYPEDEF(XPointer) dnl dnl extra for xpm library if test $ac_cv_header_xpm_h = yes; then MH_XLIBS="$MH_XLIBS -lXpm" fi dnl ---------- allow --enable-debug to compile in debug mode --------- AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging], [with_debug=$enableval], [with_debug=no], ) cflags_g="`echo $CFLAGS | grep -c '\-g'`" cflags_O="`echo $CFLAGS | grep -c '\-O'`" if test "$with_debug" = yes; then if test "$cflags_g" = "0"; then CFLAGS="${CFLAGS} -g" fi if test "$cflags_O" != "0"; then CFLAGS="`echo ${CFLAGS} | sed -e s/-O.//`" fi CFLAGS="${CFLAGS} -DPDCDEBUG" else if test "$cflags_O" = "0"; then CFLAGS="${CFLAGS} -O" fi if test "$cflags_g" != "0"; then CFLAGS="`echo ${CFLAGS} | sed -e s/-g//`" fi fi if test "$ac_cv_prog_CC" = "gcc"; then if test "$with_debug" = yes; then CFLAGS="${CFLAGS} -Wall" else CFLAGS="-O2 -Wall -fomit-frame-pointer" fi fi if test "$on_qnx" = yes; then if test "$with_debug" = yes; then CFLAGS="-g" else CFLAGS="-Otax" fi fi dnl --------------- check for wide character support ----------------- dnl allow --enable-widec to include wide character support AC_ARG_ENABLE(widec, [ --enable-widec include support for wide characters], [with_widec=$enableval], [with_widec=no], ) PDC_WIDE="" if test "$with_widec" = yes; then PDC_WIDE="-DPDC_WIDE" SYS_DEFS="$SYS_DEFS $PDC_WIDE" fi AC_SUBST(PDC_WIDE) dnl -------------------- check for XIM support ----------------------- dnl allow --enable-xim to include XIM support AC_ARG_ENABLE(xim, [ --enable-xim include support for XIM], [with_xim=$enableval], [with_xim=no], ) if test "$with_xim" = yes; then SYS_DEFS="$SYS_DEFS -DPDC_XIM" fi dnl ------------------------ force UTF-8? ---------------------------- dnl allow --enable-force-utf8 to override locale settings AC_ARG_ENABLE(force-utf8, [ --enable-force-utf8 override locale settings; use UTF-8], [force_utf8=$enableval], [force_utf8=no], ) if test "$force_utf8" = yes; then SYS_DEFS="$SYS_DEFS -DPDC_FORCE_UTF8" fi dnl ----------------- check for Purify support ----------------------- dnl allow --enable-purify to enable linking with Purify AC_ARG_ENABLE(purify, [ --enable-purify link with Purify (TM)], [with_purify=$enableval], [with_purify=no], ) if test "$with_purify" = yes; then PURIFY="purify" else PURIFY="" fi AC_SUBST(PURIFY) dnl --------------------- check for Xaw3d library -------------------- dnl allow --with-xaw3d to link with PDCurses AC_ARG_WITH(xaw3d, [ --with-xaw3d link with Xaw3d], [with_xaw3d=$withval], [with_xaw3d=no], ) if test "$with_xaw3d" = yes; then AC_DEFINE([USE_XAW3D], [1], [Define if you want to use Xaw3d library] ) fi dnl --------------------- check for neXtaw library ------------------- dnl allow --with-nextaw to link with PDCurses AC_ARG_WITH(nextaw, [ --with-nextaw link with neXtaw], [with_nextaw=$withval], [with_nextaw=no], ) if test "$with_nextaw" = yes; then AC_DEFINE([USE_NEXTAW], [1], [Define if you want to use neXtaw library] ) fi dnl -------------- check how to make shared libraries ---------------- dnl Force the ability of shared library usage USE_ABI=yes MH_SHARED_LIBRARY(XCurses) MH_CHECK_RPM() MH_GET_DISTRO_NAME() MH_CHECK_ARCH AC_CONFIG_FILES([Makefile xcurses-config]) AC_OUTPUT AC_DEFINE([PDC_MAX_SIGNALS], [], [Define as the system defined limit for number of signals] ) AC_DEFINE([HAVE_DECKEYSYM_H], [], [Define if you have the header file] ) AC_DEFINE([HAVE_SUNKEYSYM_H], [], [Define if you have the header file] ) AC_DEFINE([HAVE_XF86KEYSYM_H], [], [Define if you have the header file] ) AC_DEFINE([HAVE_XPM_H], [], [Define if you have the header file] ) AC_DEFINE([HAVE_XK_KP_DELETE], [], [Define if you have this defined in ] ) AC_DEFINE([HAVE_XK_KP_INSERT], [], [Define if you have this defined in ] ) AC_DEFINE([HAVE_XK_KP_END], [], [Define if you have this defined in ] ) AC_DEFINE([HAVE_XK_KP_DOWN], [], [Define if you have this defined in ] ) AC_DEFINE([HAVE_XK_KP_NEXT], [], [Define if you have this defined in ] ) AC_DEFINE([HAVE_XK_KP_LEFT], [], [Define if you have this defined in ] ) AC_DEFINE([HAVE_XK_KP_RIGHT], [], [Define if you have this defined in ] ) AC_DEFINE([HAVE_XK_KP_HOME], [], [Define if you have this defined in ] ) AC_DEFINE([HAVE_XK_KP_UP], [], [Define if you have this defined in ] ) AC_DEFINE([HAVE_XK_KP_PRIOR], [], [Define if you have this defined in ] ) AC_DEFINE([HAVE_XK_KP_BEGIN], [], [Define if you have this defined in ] ) AC_DEFINE([USE_XAW3D], [], [Define if you want to use Xaw3d library] ) AC_DEFINE([USE_NEXTAW], [], [Define if you want to use neXtaw library] ) AC_DEFINE([XPOINTER_TYPEDEFED], [], [Define XPointer is typedefed in X11/Xlib.h] ) curses-1.4.4/vendor/PDCurses/x11/ScrollBoxP.h0000644000004100000410000000475414201713275020666 0ustar www-datawww-data/* * Copyright 1989 O'Reilly and Associates, Inc. The X Consortium, and any party obtaining a copy of these files from the X Consortium, directly or indirectly, is granted, free of charge, a full and unrestricted irrevocable, world-wide, paid up, royalty-free, nonexclusive right and license to deal in this software and documentation files (the "Software"), including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons who receive copies from any such party to do so. This license includes without limitation a license to do the foregoing actions under any patents of the party supplying this software to the X Consortium. */ /* * scrollBoxP.h - Private definitions for scrollBox widget * */ #ifndef _XORAscrollBoxP_h #define _XORAscrollBoxP_h /************************************************************************ * * * scrollBox Widget Private Data * * * ************************************************************************/ #include "x11/ScrollBox.h" #include /* New fields for the scrollBox widget class record */ typedef struct _ScrollBoxClass { int empty; } ScrollBoxClassPart; /* Full class record declaration */ typedef struct _ScrollBoxClassRec { CoreClassPart core_class; CompositeClassPart composite_class; ScrollBoxClassPart scrollBox_class; } ScrollBoxClassRec; extern ScrollBoxClassRec scrollBoxClassRec; /* New fields for the scrollBox widget record */ typedef struct { Dimension h_space, v_space; Dimension preferred_width, preferred_height; Dimension last_query_width, last_query_height; Dimension increment_width, increment_height; XtGeometryMask last_query_mode; } ScrollBoxPart; /************************************************************************ * * * Full instance record declaration * * * ************************************************************************/ typedef struct _ScrollBoxRec { CorePart core; CompositePart composite; ScrollBoxPart scrollBox; } ScrollBoxRec; #endif /* _XORAscrollBoxP_h */ curses-1.4.4/vendor/PDCurses/x11/ScrollBox.c0000644000004100000410000002572514201713275020542 0ustar www-datawww-data/* * Copyright 1989 O'Reilly and Associates, Inc. The X Consortium, and any party obtaining a copy of these files from the X Consortium, directly or indirectly, is granted, free of charge, a full and unrestricted irrevocable, world-wide, paid up, royalty-free, nonexclusive right and license to deal in this software and documentation files (the "Software"), including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons who receive copies from any such party to do so. This license includes without limitation a license to do the foregoing actions under any patents of the party supplying this software to the X Consortium. */ /* ScrollBox.c - scrollBox composite widget */ #include #include #include #include "x11/ScrollBoxP.h" #include #define INITIAL_WIDTH 300 #define INITIAL_HEIGHT 300 /************************************************************************ * * * scrollBox Resources * * * ************************************************************************/ static XtResource resources[] = { { XtNhSpace, XtCHSpace, XtRDimension, sizeof(Dimension), XtOffset(ScrollBoxWidget, scrollBox.h_space), XtRImmediate, (XtPointer)4 }, { XtNvSpace, XtCVSpace, XtRDimension, sizeof(Dimension), XtOffset(ScrollBoxWidget, scrollBox.v_space), XtRImmediate, (XtPointer)4 }, { XtNheightInc, XtCHeightInc, XtRDimension, sizeof(Dimension), XtOffset(ScrollBoxWidget, scrollBox.increment_height), XtRImmediate, (XtPointer)13 }, { XtNwidthInc, XtCWidthInc, XtRDimension, sizeof(Dimension), XtOffset(ScrollBoxWidget, scrollBox.increment_width), XtRImmediate, (XtPointer)7 }, }; /************************************************************************ * * * Full class record constant * * * ************************************************************************/ static void Initialize(Widget, Widget, ArgList, Cardinal *); static void Resize(Widget); static Boolean SetValues(Widget, Widget, Widget, ArgList, Cardinal *); static void ChangeManaged(Widget); static XtGeometryResult QueryGeometry(Widget, XtWidgetGeometry *, XtWidgetGeometry *); static XtGeometryResult GeometryManager(Widget, XtWidgetGeometry *, XtWidgetGeometry *); static void RefigureLocations(Widget); ScrollBoxClassRec scrollBoxClassRec = { { /* core_class fields */ /* superclass */ (WidgetClass) &compositeClassRec, /* class_name */ "scrollBox", /* widget_size */ sizeof(ScrollBoxRec), /* class_initialize */ NULL, /* class_part_init */ NULL, /* class_inited */ FALSE, /* initialize */ Initialize, /* initialize_hook */ NULL, /* realize */ XtInheritRealize, /* actions */ NULL, /* num_actions */ 0, /* resources */ resources, /* num_resources */ XtNumber(resources), /* xrm_class */ NULLQUARK, /* compress_motion */ TRUE, /* compress_exposure */ TRUE, /* compress_enterleave */ TRUE, /* visible_interest */ FALSE, /* destroy */ NULL, /* resize */ Resize, /* expose */ NULL, /* set_values */ SetValues, /* set_values_hook */ NULL, /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ NULL, /* query_geometry */ QueryGeometry, /* display_accelerator */ XtInheritDisplayAccelerator, /* extension */ NULL },{ /* composite_class fields */ /* geometry_manager */ GeometryManager, /* change_managed */ ChangeManaged, /* insert_child */ XtInheritInsertChild, /* delete_child */ XtInheritDeleteChild, /* extension */ NULL },{ /* scrollBox class fields */ /* empty */ 0, } }; WidgetClass scrollBoxWidgetClass = (WidgetClass)&scrollBoxClassRec; /************************************************************************ * * * Private Routines * * * ************************************************************************/ /* Do a layout, either actually assigning positions, or just calculating size. */ static void DoLayout(Widget w, Boolean doit) { ScrollBoxWidget sbw = (ScrollBoxWidget)w; Widget wmain, vscroll, hscroll, child; Dimension mw, mh; /* main window */ Dimension vh; /* vertical scrollbar length (height) */ Dimension hw; /* horizontal scrollbar length (width) */ Position vx; Position hy; Cardinal i; if (sbw->composite.num_children != 3) XtAppError(XtWidgetToApplicationContext(w), "ScrollBox: must manage exactly three widgets."); for (i = 0; i < sbw->composite.num_children; i++) { child = sbw->composite.children[i]; if (!XtIsManaged(child)) XtAppError(XtWidgetToApplicationContext(w), "ScrollBox: all three widgets must be managed."); } /* Child one is the main window, two is the vertical scrollbar, and three is the horizontal scrollbar. */ wmain = sbw->composite.children[0]; vscroll = sbw->composite.children[1]; hscroll = sbw->composite.children[2]; /* Size all three widgets so that space is fully utilized. */ mw = sbw->core.width - (2 * sbw->scrollBox.h_space) - vscroll->core.width - (2 * vscroll->core.border_width) - (2 * wmain->core.border_width); mh = sbw->core.height - (2 * sbw->scrollBox.v_space) - hscroll->core.height - (2 * hscroll->core.border_width) - (2 * wmain->core.border_width); /* Force the main window to be sized to the appropriate increment. */ mw = (mw / sbw->scrollBox.increment_width) * sbw->scrollBox.increment_width; mh = ((mh / sbw->scrollBox.increment_height) * sbw->scrollBox.increment_height) + sbw->scrollBox.increment_height; vx = wmain->core.x + mw + sbw->scrollBox.h_space + wmain->core.border_width + vscroll->core.border_width; hy = wmain->core.y + mh + sbw->scrollBox.v_space + wmain->core.border_width + hscroll->core.border_width; vh = mh; /* scrollbars are always same length as main window */ hw = mw; if (doit) { XtResizeWidget(wmain, mw, mh, 1); XtResizeWidget(vscroll, vscroll->core.width, vh, 1); XtMoveWidget(vscroll, vx, vscroll->core.y); XtResizeWidget(hscroll, hw, hscroll->core.height, 1); XtMoveWidget(hscroll, hscroll->core.x, hy); } } static XtGeometryResult GeometryManager(Widget w, XtWidgetGeometry *request, XtWidgetGeometry *reply) { XtWidgetGeometry allowed; if (request->request_mode & ~(XtCWQueryOnly | CWWidth | CWHeight)) return XtGeometryNo; if (request->request_mode & CWWidth) allowed.width = request->width; else allowed.width = w->core.width; if (request->request_mode & CWHeight) allowed.height = request->height; else allowed.height = w->core.height; if (allowed.width == w->core.width && allowed.height == w->core.height) return XtGeometryNo; if (!(request->request_mode & XtCWQueryOnly)) RefigureLocations(w); return XtGeometryYes; } static void RefigureLocations(Widget w) { DoLayout(w, False); } /* Calculate preferred size. We can't just use the current sizes of the children, because that calculation would always end up with our current size. Could query each child, and use that size to recalculate a size for us, then if it ends up being larger than width and height passed in, accept bounding box. However, we know our children and they don't have any particular preferred geometry, except the bigger the better. Therefore, if the parent suggested a size, we'll take it. */ static XtGeometryResult QueryGeometry(Widget w, XtWidgetGeometry *request, XtWidgetGeometry *reply_return) { XtGeometryResult result=XtGeometryNo; request->request_mode &= CWWidth | CWHeight; /* parent isn't going to change w or h, so nothing to re-compute */ if (request->request_mode == 0) return XtGeometryYes; /* if proposed size is large enough, accept it. Otherwise, suggest our arbitrary initial size. */ if (request->request_mode & CWHeight) { if (request->height < INITIAL_HEIGHT) { result = XtGeometryAlmost; reply_return->height = INITIAL_HEIGHT; reply_return->request_mode &= CWHeight; } else result = XtGeometryYes; } if (request->request_mode & CWWidth) { if (request->width < INITIAL_WIDTH) { result = XtGeometryAlmost; reply_return->width = INITIAL_WIDTH; reply_return->request_mode &= CWWidth; } else result = XtGeometryYes; } return result; } /* Actually layout the scrollBox */ static void Resize(Widget w) { DoLayout(w, True); } static void ChangeManaged(Widget w) { DoLayout(w, True); } static void Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args) { ScrollBoxWidget newsbw = (ScrollBoxWidget)new; if (newsbw->core.width == 0) newsbw->core.width = INITIAL_WIDTH; if (newsbw->core.height == 0) newsbw->core.height = INITIAL_HEIGHT; } static Boolean SetValues(Widget current, Widget request, Widget new, ArgList args, Cardinal *num_args) { ScrollBoxWidget sbwcurrent = (ScrollBoxWidget)current; ScrollBoxWidget sbwnew = (ScrollBoxWidget)new; /* need to relayout if h_space or v_space change */ if ((sbwnew->scrollBox.h_space != sbwcurrent->scrollBox.h_space) || (sbwnew->scrollBox.v_space != sbwcurrent->scrollBox.v_space)) DoLayout(new, True); return False; } curses-1.4.4/vendor/PDCurses/x11/aclocal.m40000644000004100000410000006654714201713275020336 0ustar www-datawww-datadnl --------------------------------------------------------------------------- dnl This file offers the following macros... dnl --------------------------------------------------------------------------- dnl MH_IPC dnl MH_CHECK_X_INC dnl MH_CHECK_X_LIB dnl MH_CHECK_X_HEADERS dnl MH_CHECK_X_KEYDEFS dnl MH_CHECK_X_TYPEDEF dnl MH_CHECK_LIB dnl MH_SHARED_LIBRARY dnl MH_HOWTO_DYN_LINK dnl MH_CHECK_CC_O dnl MH_SHLPST dnl MH_CHECK_MAX_SIGNALS dnl MH_CHECK_OSX_ARCH dnl MH_GET_DISTRO_NAME dnl MH_CHECK_RPM dnl MH_CHECK_ARCH dnl AC_DEFINE_DIR dnl --------------------------------------------------------------------------- dnl Determine if the system has System V IPC. ie sys/ipc.h and sys/shm.h dnl headers. dnl --------------------------------------------------------------------------- AC_DEFUN([MH_IPC], [ AC_CHECK_HEADER(sys/ipc.h) if test $ac_cv_header_sys_ipc_h = no; then AC_MSG_ERROR(Cannot find required header file sys/ipc.h; PDCurses cannot be configured) fi ])dnl dnl --------------------------------------------------------------------------- dnl Set up the correct X header file location dnl --------------------------------------------------------------------------- AC_DEFUN([MH_CHECK_X_INC], [ mh_x11_dir="" mh_x11_xaw_dir="" mh_inc_dirs="$ac_x_header_dirs" dnl Provide for user supplying directory if test "x$x_includes" != xNONE ; then mh_inc_dirs="$x_includes $mh_inc_dirs" fi dnl Try to determine the directory containing X headers dnl We will append X11 to all the paths above as an extra check for ac_dir in $mh_inc_dirs ; do if test -r $ac_dir/Intrinsic.h; then mh_x11_dir=$ac_dir break fi if test -r $ac_dir/X11/Intrinsic.h; then mh_x11_dir="$ac_dir/X11" break fi done dnl Try to determine the directory containing Xaw headers dnl We will append X11 to all the paths above as an extra check if test "$with_xaw3d" = yes; then mh_xaw_dir="Xaw3d" else if test "$with_nextaw" = yes; then mh_xaw_dir="neXtaw" else mh_xaw_dir="Xaw" fi fi for ac_dir in $mh_inc_dirs ; do if test -r $ac_dir/$mh_xaw_dir/Box.h; then mh_x11_xaw_dir=$ac_dir break fi if test -r $ac_dir/X11/$mh_xaw_dir/Box.h; then mh_x11_xaw_dir="$ac_dir/X11" break fi done if test "x$mh_x11_dir" != "x" ; then mh_x11_dir_no_x11=`echo $mh_x11_dir | sed 's/\/X11$//'` if test "$mh_x11_dir_no_x11" != "$mh_x11_dir" ; then MH_XINC_DIR="-I$mh_x11_dir -I$mh_x11_dir_no_x11" else MH_XINC_DIR="-I$mh_x11_dir" fi else AC_MSG_ERROR(Cannot find required header file Intrinsic.h; PDCurses cannot be configured) fi if test "x$mh_x11_xaw_dir" != "x"; then if test "$mh_x11_xaw_dir" != "$mh_x11_dir" ; then MH_XINC_DIR="-I$mh_x11_xaw_dir $MH_XINC_DIR" fi else AC_MSG_ERROR(Cannot find required Xaw header file Box.h; PDCurses cannot be configured) fi AC_SUBST(MH_XINC_DIR) ])dnl dnl --------------------------------------------------------------------------- dnl Set up the correct X library file location dnl --------------------------------------------------------------------------- AC_DEFUN([MH_CHECK_X_LIB], [ dnl Some systems require extra libraries... mh_solaris_flag=no mh_hpux9_flag=no AC_REQUIRE([AC_CANONICAL_SYSTEM]) case "$target" in *solaris*) mh_solaris_flag=yes ;; *pc-sco*) extra_x_libs="Xext" ;; sparc*sunos*) extra_x_libs="Xext" if test "$ac_cv_prog_CC" = "gcc" ; then extra_ld_flags="-Wl,-Bstatic" extra_ld_flags2="-Wl,-Bdynamic" else extra_ld_flags="-Bstatic" extra_ld_flags2="-Bdynamic" fi ;; *hpux9*) mh_hpux9_flag=yes ;; esac if test "$with_xaw3d" = yes; then MH_X11_LIBS="Xaw3d Xmu Xt X11" else if test "$with_nextaw" = yes; then MH_X11_LIBS="neXtaw Xmu Xt X11" else MH_X11_LIBS="Xaw Xmu Xt X11" fi fi MH_X11R6_LIBS="SM ICE Xext" mh_x11r6=no which dpkg-architecture > /dev/null if test $? -eq 0; then multiarch_libdir="/usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`" else multiarch_libdir="" fi mh_lib_dirs="$multiarch_libdir /usr/lib64 /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu $x_libraries `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`" dnl try to find libSM.[a,sl,so,dylib]. If we find it we are using X11R6 for ac_dir in $mh_lib_dirs ; do for mh_xsm in libSM.a libSM.so libSM.sl libSM.dylib; do if test -r $ac_dir/$mh_xsm; then mh_x11r6=yes break 2 fi done done if test "$mh_x11r6" = yes ; then mh_libs="$MH_X11_LIBS $MH_X11R6_LIBS" else mh_libs="$MH_X11_LIBS $extra_x_libs" fi dnl Ensure that all required X libraries are found mh_prev_dir="" mh_where_found="" mh_where_found_dirs="" mh_solaris_path="" for mh_lib in $mh_libs; do mh_lib_found=no for ac_dir in $mh_lib_dirs ; do for mh_ext in a so sl dll.a dylib; do if test -r $ac_dir/lib$mh_lib.$mh_ext; then if test "x$mh_prev_dir" != "x$ac_dir" ; then if test "x$mh_prev_dir" = "x" ; then mh_where_found="$mh_where_found found in $ac_dir" else mh_where_found="$mh_where_found and in $ac_dir" fi mh_prev_dir=$ac_dir mh_where_found_dirs="$mh_where_found_dirs $ac_dir" MH_XLIBS="$MH_XLIBS -L$ac_dir" mh_solaris_path="${mh_solaris_path}:$ac_dir" fi MH_XLIBS="$MH_XLIBS -l$mh_lib" mh_lib_found=yes break 2 fi done done if test "$mh_lib_found" = no; then AC_MSG_ERROR(Cannot find required X library; lib$mh_lib. PDCurses cannot be configured) fi done mh_solaris_path=`echo $mh_solaris_path | sed 's/^://'` if test "$mh_solaris_flag" = yes ; then MH_XLIBS="-R$mh_solaris_path $extra_ld_flags $MH_XLIBS $extra_libs $extra_ld_flags2" else MH_XLIBS="$extra_ld_flags $MH_XLIBS $extra_libs $extra_ld_flags2" fi if test "$mh_hpux9_flag" = yes ; then grep -q XtSetLanguageProc $mh_x11_dir/Intrinsic.h if test $? -eq 0 ; then mh_found_xtshellstrings=no for mh_acdir in $mh_where_found_dirs ; do for mh_xaw in `ls $mh_acdir/libXaw.*` ; do nm $mh_xaw | grep XtShellStrings | grep -qv extern if test $? -eq 0 ; then mh_found_xtshellstrings=yes fi done done if test "$mh_found_xtshellstrings" = no ; then AC_MSG_WARN(The X11 development environment has not been installed correctly.) AC_MSG_WARN(The header file; Intrinsic.h, is for X11R5 while the Athena Widget) AC_MSG_WARN(Set library; libXaw is for X11R4. This is a common problem with) AC_MSG_WARN(HP-UX 9.x.) AC_MSG_ERROR(X11 installation incomplete; cannot continue) fi fi fi AC_SUBST(MH_XLIBS) ])dnl dnl --------------------------------------------------------------------------- dnl Determine if the supplied X headers exist. dnl --------------------------------------------------------------------------- AC_DEFUN([MH_CHECK_X_HEADERS], [ save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $MH_XINC_DIR" for mh_header in $1; do AC_CHECK_HEADERS($mh_header) done CPPFLAGS="$save_CPPFLAGS" ])dnl dnl --------------------------------------------------------------------------- dnl Determine if various key definitions exist in keysym.h dnl --------------------------------------------------------------------------- AC_DEFUN([MH_CHECK_X_KEYDEFS], [ save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $MH_XINC_DIR" for mh_keydef in $1; do AC_MSG_CHECKING(for $mh_keydef in keysym.h) mh_upper_name="HAVE_`echo $mh_keydef | tr '[a-z]' '[A-Z]'`" AC_TRY_COMPILE([#include ], [int i = $mh_keydef;], mh_have_key=yes; AC_DEFINE_UNQUOTED($mh_upper_name,1), mh_have_key=no ) AC_MSG_RESULT($mh_have_key) done CPPFLAGS="$save_CPPFLAGS" ])dnl dnl --------------------------------------------------------------------------- dnl Determine if supplied types have been typedefed dnl --------------------------------------------------------------------------- AC_DEFUN([MH_CHECK_X_TYPEDEF], [ save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $SYS_DEFS $MH_XINC_DIR" for td in $1 ; do AC_MSG_CHECKING(if $td is typedefed:) AC_TRY_COMPILE( [#include "X11/Xlib.h"], [$td fred], [mh_td=yes], [mh_td=no] ) if test "$mh_td" = yes ; then TD_upper=`echo $td | tr a-z A-Z` AC_DEFINE_UNQUOTED(${TD_upper}_TYPEDEFED, 1) fi AC_MSG_RESULT($mh_td) done CPPFLAGS="$save_CPPFLAGS" ])dnl dnl --------------------------------------------------------------------------- dnl Check for presence of various libraries dnl --------------------------------------------------------------------------- AC_DEFUN([MH_CHECK_LIB], [ MH_EXTRA_LIBS='' for mh_lib in $1; do if test "$on_qnx" = yes; then AC_MSG_CHECKING(for library -l${mh_lib}) if test -r /usr/lib/${mh_lib}3r.lib; then AC_MSG_RESULT(found) MH_EXTRA_LIBS="${MH_EXTRA_LIBS} -l${mh_lib}" else AC_MSG_RESULT(not found) fi else AC_CHECK_LIB($mh_lib,main,mh_lib_found=yes,mh_lib_found=no) if test "$mh_lib_found" = yes; then MH_EXTRA_LIBS="${MH_EXTRA_LIBS} -l${mh_lib}" fi fi done ])dnl dnl --------------------------------------------------------------------------- dnl Work out how to create a dynamically loaded module dnl --------------------------------------------------------------------------- AC_DEFUN([MH_HOWTO_DYN_LINK], [ mh_compile='${CC-cc} -c $DYN_COMP conftest.$ac_ext 1>&AC_FD_CC' cat > conftest.$ac_ext < conftest.$ac_ext < $aix_exports fi if test "$ac_cv_header_dl_h" = "yes" -o "$ac_cv_header_dlfcn_h" = "yes" -o "$AIX_DYN" = "yes" -o "$BEOS_DYN" = "yes" -o "$DLFCNINCDIR" != "" -o "$DLFCNLIBDIR" != ""; then EXPS="1,2,3,4,5,6,7,8,9" for a in $SHLFILES do if test "$USE_ABI" = "yes" -a "$CAN_USE_ABI" = "yes"; then SHL_TARGETS="${SHL_TARGETS} ${SHLPRE}${a}${SHLPST}.\$(ABI)" else SHL_TARGETS="${SHL_TARGETS} ${SHLPRE}${a}${SHLPST}" fi this=`echo $EXPS | cut -d, -f1` EXPS=`echo $EXPS | cut -d, -f2-` if test "$AIX_DYN" = "yes"; then echo "RXPACKEXP$this=$a.exp" >> $aix_exports echo "RXPACKEXPORTS$this=-bE:$a.exp" >> $aix_exports fi done fi AC_SUBST(DYN_COMP) AC_SUBST(LIBS) AC_SUBST(LD_RXLIB1) AC_SUBST(SHLPRE) AC_SUBST(SHLPST) AC_SUBST(SHL_TARGETS) AC_SUBST(O2SAVE) AC_SUBST(CC2O) AC_SUBST(SAVE2O) AC_SUBST(RXPACKEXPORTS) AC_SUBST(BASE_INSTALL) AC_SUBST(OTHER_INSTALLS) AC_SUBST(BASE_BINARY) AC_SUBST(CAN_USE_ABI) ])dnl dnl --------------------------------------------------------------------------- dnl Check if C compiler supports -c -o file.ooo dnl --------------------------------------------------------------------------- AC_DEFUN([MH_CHECK_CC_O], [ AC_MSG_CHECKING(whether $CC understand -c and -o together) set dummy $CC; ac_cc="`echo [$]2 | changequote(, )dnl sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" changequote([, ])dnl AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o, [echo 'foo(){}' > conftest.c # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. eval ac_cv_prog_cc_${ac_cc}_c_o=no ac_try='${CC-cc} -c conftest.c -o conftest.ooo 1>&AC_FD_CC' if AC_TRY_EVAL(ac_try) && test -f conftest.ooo && AC_TRY_EVAL(ac_try); then ac_try='${CC-cc} -c conftest.c -o conftest.ooo 1>&AC_FD_CC' if AC_TRY_EVAL(ac_try) && test -f conftest.ooo && AC_TRY_EVAL(ac_try); then eval ac_cv_prog_cc_${ac_cc}_c_o=yes fi fi rm -f conftest* ])dnl if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then O2SAVE="" SAVE2O="" CC2O="-o $"'@' AC_MSG_RESULT(yes) else O2SAVE="-mv \`basename "$'@'" .sho\`.o \`basename "$'@'" .sho\`.o.save;" SAVE2O="-mv \`basename "$'@'" .sho\`.o "$'@'"; mv \`basename "$'@'" .sho\`.o.save \`basename "$'@'" .sho\`.o" CC2O="" AC_MSG_RESULT(no) fi ]) dnl --------------------------------------------------------------------------- dnl Determines the file extension for shared libraries dnl --------------------------------------------------------------------------- AC_DEFUN([MH_SHLPST], [ AC_MSG_CHECKING(shared library extension) SHLPST=".so" AC_REQUIRE([AC_CANONICAL_SYSTEM]) case "$target" in *hp-hpux*) SHLPST=".sl" ;; *ibm-aix*) SHLPST=".a" ;; *qnx*) SHLPST="" ;; *cygwin*) SHLPST=".dll" ;; *darwin*) SHLPST=".dylib" ;; esac AC_SUBST(SHLPST) AC_MSG_RESULT($SHLPST) ]) dnl --------------------------------------------------------------------------- dnl Determine the system limit for number of signals dnl --------------------------------------------------------------------------- AC_DEFUN([MH_CHECK_MAX_SIGNALS], [ save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $SYS_DEFS" AC_MSG_CHECKING(for maximum signal specifier:) AC_CACHE_VAL(mh_cv_max_signals, mh_found="no" for mh_sigs in $1; do AC_TRY_COMPILE([#include ], [return $mh_sigs;], mh_found="yes"; mh_cv_max_signals="$mh_sigs" ) if test "$mh_found" = "yes"; then break; fi done) CPPFLAGS="$save_CPPFLAGS" if test "$mh_found" = "no"; then AC_MSG_ERROR(Cannot find a system limit for number of signals. PDCurses cannot be configured on this machine.) else AC_DEFINE_UNQUOTED(PDC_MAX_SIGNALS,$mh_cv_max_signals) AC_MSG_RESULT($mh_cv_max_signals) fi ])dnl dnl --------------------------------------------------------------------------- dnl Determines which -arch flags valid on Mac OSX with gcc dnl --------------------------------------------------------------------------- AC_DEFUN([MH_CHECK_OSX_ARCH], [ valid_arch_flags="" found_arch_flags="" AC_ARG_WITH(arch, [ --with-arch=option build universal binaries on OS X, option: one of "all 32bit 64bit intel ppc ppc64 x86_64 i386"], [with_arch=$withval], [with_arch=none], ) case "$with_arch" in none) arch_flags="" ;; all) arch_flags="-arch ppc -arch ppc64 -arch x86_64 -arch i386" ;; 32bit) arch_flags="-arch ppc -arch i386" ;; 64bit) arch_flags="-arch ppc64 -arch x86_64" ;; intel) arch_flags="-arch i386 -arch x86_64" ;; *) arch_flags="-arch $with_arch" ;; esac valid_arch_flags="" found_arch_flags="" if test $on_osx = "yes"; then AC_MSG_CHECKING(for which Mac OSX -arch flags are supported for universal binaries) for a in $arch_flags; do save_ldflags="$LDFLAGS" LDFLAGS="$LDFLAGS -arch $a" AC_LINK_IFELSE( [AC_LANG_PROGRAM([#include ], [exit(0)])], [valid_arch_flags="$valid_arch_flags -arch $a";found_arch_flags="$found_arch_flags $a"], [a="$a"] ) LDFLAGS="$save_ldflags" done AC_MSG_RESULT($found_arch_flags) AC_SUBST(valid_arch_flags) fi ]) dnl --------------------------------------------------------------------------- dnl Determines the Linux distribution name dnl --------------------------------------------------------------------------- AC_DEFUN([MH_GET_DISTRO_NAME], [ AC_CHECK_PROG(lsb_release, [lsb_release], yes, no) if test "$ac_cv_prog_lsb_release" = yes; then AC_MSG_CHECKING(OS distribution name) MYDISTRO="`lsb_release -i | cut -f 2`-`lsb_release -r | cut -f 2`" MYDISTRO="`echo $MYDISTRO | sed \"s/ /_/g\"`" AC_MSG_RESULT($MYDISTRO) else case "$target" in *freebsd* | *openbsd*) MYDISTRO="`echo $target | cut -f3 -d-`" ;; *darwin*) MYDISTRO="`echo $target | cut -f2-3 -d-`" ;; *pc-solaris2*) MYDISTRO="`echo $target | cut -f2- -d-`" ;; *cygwin*) MYDISTRO="`echo $target | cut -f2- -d-`" ;; *) MYDISTRO="$target" ;; esac fi AC_SUBST(MYDISTRO) ]) dnl --------------------------------------------------------------------------- dnl Determines where rpm build files are located dnl --------------------------------------------------------------------------- AC_DEFUN([MH_CHECK_RPM], [ AC_CHECK_PROG(mh_rpm_exists, rpm, yes, no ) if test "$mh_rpm_exists" = yes; then AC_MSG_CHECKING(where rpms are built) RPMTOPDIR=`rpm --eval "%{_topdir}"` AC_MSG_RESULT($RPMTOPDIR) AC_SUBST(RPMTOPDIR) fi ]) dnl dnl Determine if the platform can handle 64 bit binaries dnl dnl Assumes AC_CANONICAL_SYSTEM has already been called dnl assumes we are on a 32bit system AC_DEFUN([MH_CHECK_ARCH], [ dnl ---------------------- check 32/64 bit ----------------------- dnl allow --with-32bit to ensure that 32bit libraries are used AC_ARG_ENABLE(32bit, [ --enable-32bit specify if 32bit libraries are to be used], [bitflag32=yes], [bitflag32=no], ) dnl allow --with-64bit to ensure that 64bit libraries are used AC_ARG_ENABLE(64bit, [ --enable-64bit specify if 64bit libraries are to be used], [bitflag64=yes], [bitflag64=no], ) # # Now do platform specific tests # gcc_64bit="-m64" gcc_32bit="-m32" on_osx="no" osis64bit=no bitflag="" case "$target" in *hp-hpux*) ;; *ibm-aix*) rc=`lsconf -k | grep -c 64-bit` if test $rc -eq 1; then bitflag="64" osis64bit=yes fi # # AIX gcc has its own special bit switches :-( # gcc_64bit="-maix64" gcc_32bit="-maix32" ;; *dec-osf4*) ;; *dec-osf*) ;; *sequent-dynix*) ;; i*86*solaris*) ;; *solaris*) rc=`isainfo -v | grep -c 64-bit` if test $rc -eq 1; then bitflag="64" osis64bit=yes fi ;; sparc*sunos*) ;; *linux*|*kfreebsd*-gnu*) mach="`uname -m`" if test "$mach" = "x86_64" -o "$mach" = "ia86" -o "$mach" = "alpha" -o "$mach" = "ppc64" -o "$mach" = "s390x"; then bitflag="64" osis64bit=yes fi ;; *-freebsd*) mach="`uname -m`" if test "$mach" = "amd64"; then bitflag="64" osis64bit=yes fi ;; *nto-qnx*) ;; *qnx*) ;; *beos*) ;; *cygwin*) ;; *apple-darwin*) on_osx="yes" osx_64bit=`sysctl hw.cpu64bit_capable | cut -f2 -d' '` if test $osx_64bit -eq 1; then bitflag="64" osis64bit=yes fi ;; esac if test "x$bitflag32" = "xyes" -a "x$bitflag64" = "xyes"; then AC_MSG_ERROR(--enable-32bit and --enable-64bit flags cannot both be specified.) fi if test "x$bitflag64" = "xyes" -a "$osis64bit" = "no"; then AC_MSG_ERROR(--enable-64bit cannot be specified on non-64bit OS.) fi binarybitprefix="" if test "x$bitflag32" = "xyes"; then bitflag="32" if test "$osis64bit" = "yes"; then binarybitprefix="32" fi elif test "x$bitflag64" = "xyes"; then bitflag="64" fi MACH_ARCH=`$ac_config_guess | cut -f1 -d-` AC_SUBST(MACH_ARCH) dnl dnl following variable used to name 32bit binaries on a 64bit system dnl allows 32bit and 64bit binaries t co-exist on a 64bit system AC_SUBST(binarybitprefix) dnl --------------- allow --with-arch to specify which architectures to build universal binaries dnl if test "$on_osx" = "yes"; then MH_CHECK_OSX_ARCH() else dnl dnl Now set the correct compiler flags dnl if test "$ac_cv_prog_CC" = "gcc" -o "$ac_cv_prog_CC" = "g++"; then if test "$bitflag" = "32"; then CFLAGS="${CFLAGS} $gcc_32bit" LDFLAGS="${LDFLAGS} $gcc_32bit" elif test "$bitflag" = "64"; then CFLAGS="${CFLAGS} $gcc_64bit" LDFLAGS="${LDFLAGS} $gcc_64bit" else bitflag="32" fi elif test "$ac_cv_prog_CC" = "xlc" -o "$ac_cv_prog_CC" = "xlC"; then if test "$bitflag" = "32"; then CFLAGS="${CFLAGS} -q32" LDFLAGS="${LDFLAGS} -q32" elif test "$bitflag" = "64"; then CFLAGS="${CFLAGS} -q64" LDFLAGS="${LDFLAGS} -q64" else bitflag="32" fi fi fi dnl allow --disable-libdir-change to ensure that building a .deb works #libdir_change=yes AC_ARG_ENABLE(libdir-change, [ --enable-libdir-change specify --disable-libdir-change if building a .deb], [libdir_change=$enableval], [libdir_change=yes], ) echo "libdir: $libdir_change" if test "$libdir_change" = yes; then dnl dnl If the user hasn't specified libdir, check for specific lib dirs dnl if test "${libdir}" = '${exec_prefix}/lib'; then dnl dnl expand the active $prefix dnl myprefix=$prefix AC_DEFINE_DIR(MY_PREFIX,"$myprefix") if test "${myprefix}" = "NONE"; then myprefix="$ac_default_prefix" fi dnl dnl check for 64bit libdir dnl if test -d "${myprefix}/lib/x86_64-linux-gnu"; then libdir64="${myprefix}/lib/x86_64-linux-gnu" elif test -d "${myprefix}/lib64"; then libdir64="${myprefix}/lib64" else libdir64="${myprefix}/lib" fi dnl dnl check for 32bit libdir dnl if test -d "${myprefix}/lib/i386-linux-gnu"; then libdir32="${myprefix}/lib/i386-linux-gnu" elif test -d "${myprefix}/lib32"; then libdir32="${myprefix}/lib32" else libdir32="${myprefix}/lib" fi dnl dnl Depending on the build type, set the default libdir dnl if test "$bitflag" = "64"; then libdir="$libdir64" else libdir="$libdir32" fi else libdir64="$libdir" libdir32="$libdir" fi else libdir64="$libdir" libdir32="$libdir" fi AC_SUBST(libdir64) AC_SUBST(libdir32) AC_SUBST(bitflag) ]) dnl @synopsis AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION]) dnl dnl This macro sets VARNAME to the expansion of the DIR variable, dnl taking care of fixing up ${prefix} and such. dnl dnl VARNAME is then offered as both an output variable and a C dnl preprocessor symbol. dnl dnl Modified by Mark Hessling to fix eval bug dnl dnl Example: dnl dnl AC_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.]) dnl dnl @category Misc dnl @author Stepan Kasal dnl @author Andreas Schwab dnl @author Guido U. Draheim dnl @author Alexandre Oliva dnl @version 2006-10-13 dnl @license AllPermissive AC_DEFUN([AC_DEFINE_DIR], [ prefix_NONE= exec_prefix_NONE= test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn dnl refers to ${prefix}. Thus we have to use `eval' twice. eval ac_define_dir="\"$2\"" eval ac_define_dir="\"$ac_define_dir\"" AC_SUBST($1, "$ac_define_dir") AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3]) test "$prefix_NONE" && prefix=NONE test "$exec_prefix_NONE" && exec_prefix=NONE ]) curses-1.4.4/vendor/PDCurses/x11/config.guess0000755000004100000410000012626014201713275021003 0ustar www-datawww-data#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2006-07-02' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; x86:Interix*:[3456]*) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T:Interix*:[3456]*) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: curses-1.4.4/vendor/PDCurses/x11/sb.c0000644000004100000410000000640014201713275017224 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcx11.h" /*man-start************************************************************** sb -- ### Synopsis int sb_init(void) int sb_set_horz(int total, int viewport, int cur) int sb_set_vert(int total, int viewport, int cur) int sb_get_horz(int *total, int *viewport, int *cur) int sb_get_vert(int *total, int *viewport, int *cur) int sb_refresh(void); ### Description These functions manipulate the scrollbar. ### Return Value All functions return OK on success and ERR on error. ### Portability X/Open BSD SYS V sb_init - - - sb_set_horz - - - sb_set_vert - - - sb_get_horz - - - sb_get_vert - - - sb_refresh - - - **man-end****************************************************************/ bool sb_started = FALSE; /* sb_init() is the sb initialization routine. This must be called before initscr(). */ int sb_init(void) { PDC_LOG(("sb_init() - called\n")); if (SP) return ERR; sb_started = TRUE; return OK; } /* sb_set_horz() - Used to set horizontal scrollbar. total = total number of columns viewport = size of viewport in columns cur = current column in total */ int sb_set_horz(int total, int viewport, int cur) { PDC_LOG(("sb_set_horz() - called: total %d viewport %d cur %d\n", total, viewport, cur)); if (!SP) return ERR; SP->sb_total_x = total; SP->sb_viewport_x = viewport; SP->sb_cur_x = cur; return OK; } /* sb_set_vert() - Used to set vertical scrollbar. total = total number of columns on line viewport = size of viewport in columns cur = current column in total */ int sb_set_vert(int total, int viewport, int cur) { PDC_LOG(("sb_set_vert() - called: total %d viewport %d cur %d\n", total, viewport, cur)); if (!SP) return ERR; SP->sb_total_y = total; SP->sb_viewport_y = viewport; SP->sb_cur_y = cur; return OK; } /* sb_get_horz() - Used to get horizontal scrollbar. total = total number of lines viewport = size of viewport in lines cur = current line in total */ int sb_get_horz(int *total, int *viewport, int *cur) { PDC_LOG(("sb_get_horz() - called\n")); if (!SP) return ERR; if (total) *total = SP->sb_total_x; if (viewport) *viewport = SP->sb_viewport_x; if (cur) *cur = SP->sb_cur_x; return OK; } /* sb_get_vert() - Used to get vertical scrollbar. total = total number of lines viewport = size of viewport in lines cur = current line in total */ int sb_get_vert(int *total, int *viewport, int *cur) { PDC_LOG(("sb_get_vert() - called\n")); if (!SP) return ERR; if (total) *total = SP->sb_total_y; if (viewport) *viewport = SP->sb_viewport_y; if (cur) *cur = SP->sb_cur_y; return OK; } /* sb_refresh() - Used to draw the scrollbars. */ int sb_refresh(void) { PDC_LOG(("sb_refresh() - called\n")); if (!SP) return ERR; XCursesInstruct(CURSES_REFRESH_SCROLLBAR); return OK; } curses-1.4.4/vendor/PDCurses/x11/pdcgetsc.c0000644000004100000410000000062614201713275020420 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcx11.h" /* return width of screen/viewport */ int PDC_get_columns(void) { PDC_LOG(("PDC_get_columns() - called\n")); return XCursesCOLS; } /* get the cursor size/shape */ int PDC_get_cursor_mode(void) { return 0; } /* return number of screen rows */ int PDC_get_rows(void) { PDC_LOG(("PDC_get_rows() - called\n")); return XCursesLINES; } curses-1.4.4/vendor/PDCurses/x11/configure0000755000004100000410000056204214201713275020374 0ustar www-datawww-data#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for PDCurses 3.4. # # Report bugs to . # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and wmcbrine@gmail.com $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='PDCurses' PACKAGE_TARNAME='PDCurses' PACKAGE_VERSION='3.4' PACKAGE_STRING='PDCurses 3.4' PACKAGE_BUGREPORT='wmcbrine@gmail.com' PACKAGE_URL='' ac_unique_file="pdcx11.h" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS bitflag libdir32 libdir64 MY_PREFIX binarybitprefix MACH_ARCH MYDISTRO lsb_release RPMTOPDIR mh_rpm_exists CAN_USE_ABI BASE_BINARY OTHER_INSTALLS BASE_INSTALL RXPACKEXPORTS SAVE2O CC2O O2SAVE SHL_TARGETS SHLPRE LD_RXLIB1 DYN_COMP SHLPST PURIFY PDC_WIDE MH_XLIBS MH_XINC_DIR XMKMF MH_EXTRA_LIBS EGREP GREP CPP SET_MAKE INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM RANLIB LN_S EEXTRA SYS_DEFS valid_arch_flags target_os target_vendor target_cpu target host_os host_vendor host_cpu host build_os build_vendor build_cpu build OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_arch with_x enable_debug enable_widec enable_xim enable_force_utf8 enable_purify with_xaw3d with_nextaw enable_32bit enable_64bit enable_libdir_change ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP XMKMF' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures PDCurses 3.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PDCurses] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of PDCurses 3.4:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-debug turn on debugging --enable-widec include support for wide characters --enable-xim include support for XIM --enable-force-utf8 override locale settings; use UTF-8 --enable-purify link with Purify (TM) --enable-32bit specify if 32bit libraries are to be used --enable-64bit specify if 64bit libraries are to be used --enable-libdir-change specify --disable-libdir-change if building a .deb Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-arch=option build universal binaries on OS X, option: one of "all 32bit 64bit intel ppc ppc64 x86_64 i386" --with-x use the X Window System --with-xaw3d link with Xaw3d --with-nextaw link with neXtaw Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor XMKMF Path to xmkmf, Makefile generator for X Window System Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF PDCurses configure 3.4 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## --------------------------------- ## ## Report this to wmcbrine@gmail.com ## ## --------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by PDCurses $as_me 3.4, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- on_qnx=no on_osx=no case "$target" in *hp-hpux*) SYS_DEFS="-D_HPUX_SOURCE" ;; *ibm-aix*) SYS_DEFS="-D_ALL_SOURCE" ;; *dec-osf*) SYS_DEFS="-D_XOPEN_SOURCE_EXTENDED" ;; *pc-sco*) SYS_DEFS="-UM_XENIX -b elf" ;; *qnx*) on_qnx=yes SYS_DEFS="-Q" ;; *apple-darwin*) on_osx=yes valid_arch_flags="" found_arch_flags="" # Check whether --with-arch was given. if test "${with_arch+set}" = set; then : withval=$with_arch; with_arch=$withval else with_arch=none fi case "$with_arch" in none) arch_flags="" ;; all) arch_flags="-arch ppc -arch ppc64 -arch x86_64 -arch i386" ;; 32bit) arch_flags="-arch ppc -arch i386" ;; 64bit) arch_flags="-arch ppc64 -arch x86_64" ;; intel) arch_flags="-arch i386 -arch x86_64" ;; *) arch_flags="-arch $with_arch" ;; esac valid_arch_flags="" found_arch_flags="" if test $on_osx = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for which Mac OSX -arch flags are supported for universal binaries" >&5 $as_echo_n "checking for which Mac OSX -arch flags are supported for universal binaries... " >&6; } for a in $arch_flags; do save_ldflags="$LDFLAGS" LDFLAGS="$LDFLAGS -arch $a" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { exit(0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : valid_arch_flags="$valid_arch_flags -arch $a";found_arch_flags="$found_arch_flags $a" else a="$a" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_ldflags" done { $as_echo "$as_me:${as_lineno-$LINENO}: result: $found_arch_flags" >&5 $as_echo "$found_arch_flags" >&6; } fi SYS_DEFS="$valid_arch_flags" EEXTRA="$valid_arch_flags" ;; *) ;; esac save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $SYS_DEFS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for maximum signal specifier:" >&5 $as_echo_n "checking for maximum signal specifier:... " >&6; } if ${mh_cv_max_signals+:} false; then : $as_echo_n "(cached) " >&6 else mh_found="no" for mh_sigs in NSIG __sys_nsig; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { return $mh_sigs; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : mh_found="yes"; mh_cv_max_signals="$mh_sigs" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test "$mh_found" = "yes"; then break; fi done fi CPPFLAGS="$save_CPPFLAGS" if test "$mh_found" = "no"; then as_fn_error $? "Cannot find a system limit for number of signals. PDCurses cannot be configured on this machine." "$LINENO" 5 else cat >>confdefs.h <<_ACEOF #define PDC_MAX_SIGNALS $mh_cv_max_signals _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mh_cv_max_signals" >&5 $as_echo "$mh_cv_max_signals" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "sys/ipc.h" "ac_cv_header_sys_ipc_h" "$ac_includes_default" if test "x$ac_cv_header_sys_ipc_h" = xyes; then : fi if test $ac_cv_header_sys_ipc_h = no; then as_fn_error $? "Cannot find required header file sys/ipc.h; PDCurses cannot be configured" "$LINENO" 5 fi if test $ac_cv_header_stdc != yes; then as_fn_error $? "Need ANSI C headers" "$LINENO" 5 fi for ac_header in fcntl.h \ sys/time.h \ sys/select.h \ dlfcn.h \ dl.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi MH_EXTRA_LIBS='' for mh_lib in socket nls; do if test "$on_qnx" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library -l${mh_lib}" >&5 $as_echo_n "checking for library -l${mh_lib}... " >&6; } if test -r /usr/lib/${mh_lib}3r.lib; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 $as_echo "found" >&6; } MH_EXTRA_LIBS="${MH_EXTRA_LIBS} -l${mh_lib}" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } fi else as_ac_Lib=`$as_echo "ac_cv_lib_$mh_lib''_main" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -l$mh_lib" >&5 $as_echo_n "checking for main in -l$mh_lib... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-l$mh_lib $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : mh_lib_found=yes else mh_lib_found=no fi if test "$mh_lib_found" = yes; then MH_EXTRA_LIBS="${MH_EXTRA_LIBS} -l${mh_lib}" fi fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understand -c and -o together" >&5 $as_echo_n "checking whether $CC understand -c and -o together... " >&6; } set dummy $CC; ac_cc="`echo $2 | sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : $as_echo_n "(cached) " >&6 else echo 'foo(){}' > conftest.c # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. eval ac_cv_prog_cc_${ac_cc}_c_o=no ac_try='${CC-cc} -c conftest.c -o conftest.ooo 1>&5' if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest.ooo && { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then ac_try='${CC-cc} -c conftest.c -o conftest.ooo 1>&5' if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest.ooo && { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes fi fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then O2SAVE="" SAVE2O="" CC2O="-o $"'@' { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else O2SAVE="-mv \`basename "$'@'" .sho\`.o \`basename "$'@'" .sho\`.o.save;" SAVE2O="-mv \`basename "$'@'" .sho\`.o "$'@'"; mv \`basename "$'@'" .sho\`.o.save \`basename "$'@'" .sho\`.o" CC2O="" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } if ${ac_cv_type_signal+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_signal=int else ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF for ac_func in vsscanf usleep poll vsnprintf do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 $as_echo_n "checking for X... " >&6; } # Check whether --with-x was given. if test "${with_x+set}" = set; then : withval=$with_x; fi # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else case $x_includes,$x_libraries in #( *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then : $as_echo_n "(cached) " >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir cat >Imakefile <<'_ACEOF' incroot: @echo incroot='${INCROOT}' usrlibdir: @echo usrlibdir='${USRLIBDIR}' libdir: @echo libdir='${LIBDIR}' _ACEOF if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. for ac_var in incroot usrlibdir libdir; do eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" done # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl dylib la dll; do if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && test -f "$ac_im_libdir/libX11.$ac_extension"; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ac_x_includes= ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /usr/lib64 | /lib | /lib64) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -f -r conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R7/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R7 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R7/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R7 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Xlib.h. # First, try using that file with no special directory specified. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # We can compile using X headers with no special include directory. ac_x_includes= else for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.i conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { XrmInitialize () ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else LIBS=$ac_save_LIBS for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl dylib la dll; do if test -r "$ac_dir/libX11.$ac_extension"; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no case $ac_x_includes,$ac_x_libraries in #( no,* | *,no | *\'*) # Didn't find X, or a directory has "'" in its name. ac_cv_have_x="have_x=no";; #( *) # Record where we found X for the cache. ac_cv_have_x="have_x=yes\ ac_x_includes='$ac_x_includes'\ ac_x_libraries='$ac_x_libraries'" esac fi ;; #( *) have_x=yes;; esac eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 $as_echo "$have_x" >&6; } no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes\ ac_x_includes='$x_includes'\ ac_x_libraries='$x_libraries'" { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 $as_echo "libraries $x_libraries, headers $x_includes" >&6; } fi mh_x11_dir="" mh_x11_xaw_dir="" mh_inc_dirs="$ac_x_header_dirs" if test "x$x_includes" != xNONE ; then mh_inc_dirs="$x_includes $mh_inc_dirs" fi for ac_dir in $mh_inc_dirs ; do if test -r $ac_dir/Intrinsic.h; then mh_x11_dir=$ac_dir break fi if test -r $ac_dir/X11/Intrinsic.h; then mh_x11_dir="$ac_dir/X11" break fi done if test "$with_xaw3d" = yes; then mh_xaw_dir="Xaw3d" else if test "$with_nextaw" = yes; then mh_xaw_dir="neXtaw" else mh_xaw_dir="Xaw" fi fi for ac_dir in $mh_inc_dirs ; do if test -r $ac_dir/$mh_xaw_dir/Box.h; then mh_x11_xaw_dir=$ac_dir break fi if test -r $ac_dir/X11/$mh_xaw_dir/Box.h; then mh_x11_xaw_dir="$ac_dir/X11" break fi done if test "x$mh_x11_dir" != "x" ; then mh_x11_dir_no_x11=`echo $mh_x11_dir | sed 's/\/X11$//'` if test "$mh_x11_dir_no_x11" != "$mh_x11_dir" ; then MH_XINC_DIR="-I$mh_x11_dir -I$mh_x11_dir_no_x11" else MH_XINC_DIR="-I$mh_x11_dir" fi else as_fn_error $? "Cannot find required header file Intrinsic.h; PDCurses cannot be configured" "$LINENO" 5 fi if test "x$mh_x11_xaw_dir" != "x"; then if test "$mh_x11_xaw_dir" != "$mh_x11_dir" ; then MH_XINC_DIR="-I$mh_x11_xaw_dir $MH_XINC_DIR" fi else as_fn_error $? "Cannot find required Xaw header file Box.h; PDCurses cannot be configured" "$LINENO" 5 fi mh_solaris_flag=no mh_hpux9_flag=no case "$target" in *solaris*) mh_solaris_flag=yes ;; *pc-sco*) extra_x_libs="Xext" ;; sparc*sunos*) extra_x_libs="Xext" if test "$ac_cv_prog_CC" = "gcc" ; then extra_ld_flags="-Wl,-Bstatic" extra_ld_flags2="-Wl,-Bdynamic" else extra_ld_flags="-Bstatic" extra_ld_flags2="-Bdynamic" fi ;; *hpux9*) mh_hpux9_flag=yes ;; esac if test "$with_xaw3d" = yes; then MH_X11_LIBS="Xaw3d Xmu Xt X11" else if test "$with_nextaw" = yes; then MH_X11_LIBS="neXtaw Xmu Xt X11" else MH_X11_LIBS="Xaw Xmu Xt X11" fi fi MH_X11R6_LIBS="SM ICE Xext" mh_x11r6=no which dpkg-architecture > /dev/null if test $? -eq 0; then multiarch_libdir="/usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`" else multiarch_libdir="" fi mh_lib_dirs="$multiarch_libdir /usr/lib64 /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu $x_libraries `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`" for ac_dir in $mh_lib_dirs ; do for mh_xsm in libSM.a libSM.so libSM.sl libSM.dylib; do if test -r $ac_dir/$mh_xsm; then mh_x11r6=yes break 2 fi done done if test "$mh_x11r6" = yes ; then mh_libs="$MH_X11_LIBS $MH_X11R6_LIBS" else mh_libs="$MH_X11_LIBS $extra_x_libs" fi mh_prev_dir="" mh_where_found="" mh_where_found_dirs="" mh_solaris_path="" for mh_lib in $mh_libs; do mh_lib_found=no for ac_dir in $mh_lib_dirs ; do for mh_ext in a so sl dll.a dylib; do if test -r $ac_dir/lib$mh_lib.$mh_ext; then if test "x$mh_prev_dir" != "x$ac_dir" ; then if test "x$mh_prev_dir" = "x" ; then mh_where_found="$mh_where_found found in $ac_dir" else mh_where_found="$mh_where_found and in $ac_dir" fi mh_prev_dir=$ac_dir mh_where_found_dirs="$mh_where_found_dirs $ac_dir" MH_XLIBS="$MH_XLIBS -L$ac_dir" mh_solaris_path="${mh_solaris_path}:$ac_dir" fi MH_XLIBS="$MH_XLIBS -l$mh_lib" mh_lib_found=yes break 2 fi done done if test "$mh_lib_found" = no; then as_fn_error $? "Cannot find required X library; lib$mh_lib. PDCurses cannot be configured" "$LINENO" 5 fi done mh_solaris_path=`echo $mh_solaris_path | sed 's/^://'` if test "$mh_solaris_flag" = yes ; then MH_XLIBS="-R$mh_solaris_path $extra_ld_flags $MH_XLIBS $extra_libs $extra_ld_flags2" else MH_XLIBS="$extra_ld_flags $MH_XLIBS $extra_libs $extra_ld_flags2" fi if test "$mh_hpux9_flag" = yes ; then grep -q XtSetLanguageProc $mh_x11_dir/Intrinsic.h if test $? -eq 0 ; then mh_found_xtshellstrings=no for mh_acdir in $mh_where_found_dirs ; do for mh_xaw in `ls $mh_acdir/libXaw.*` ; do nm $mh_xaw | grep XtShellStrings | grep -qv extern if test $? -eq 0 ; then mh_found_xtshellstrings=yes fi done done if test "$mh_found_xtshellstrings" = no ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The X11 development environment has not been installed correctly." >&5 $as_echo "$as_me: WARNING: The X11 development environment has not been installed correctly." >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The header file; Intrinsic.h" >&5 $as_echo "$as_me: WARNING: The header file; Intrinsic.h" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Set library; libXaw is for X11R4. This is a common problem with" >&5 $as_echo "$as_me: WARNING: Set library; libXaw is for X11R4. This is a common problem with" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: HP-UX 9.x." >&5 $as_echo "$as_me: WARNING: HP-UX 9.x." >&2;} as_fn_error $? "X11 installation incomplete; cannot continue" "$LINENO" 5 fi fi fi save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $MH_XINC_DIR" for mh_header in DECkeysym.h Sunkeysym.h xpm.h XF86keysym.h; do for ac_header in $mh_header do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done done CPPFLAGS="$save_CPPFLAGS" save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $MH_XINC_DIR" for mh_keydef in XK_KP_Delete XK_KP_Insert XK_KP_End XK_KP_Down XK_KP_Next \ XK_KP_Left XK_KP_Right XK_KP_Home XK_KP_Up XK_KP_Prior XK_KP_Begin; do { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $mh_keydef in keysym.h" >&5 $as_echo_n "checking for $mh_keydef in keysym.h... " >&6; } mh_upper_name="HAVE_`echo $mh_keydef | tr 'a-z' 'A-Z'`" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int i = $mh_keydef; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : mh_have_key=yes; cat >>confdefs.h <<_ACEOF #define $mh_upper_name 1 _ACEOF else mh_have_key=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mh_have_key" >&5 $as_echo "$mh_have_key" >&6; } done CPPFLAGS="$save_CPPFLAGS" save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $SYS_DEFS $MH_XINC_DIR" for td in XPointer ; do { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $td is typedefed:" >&5 $as_echo_n "checking if $td is typedefed:... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "X11/Xlib.h" int main () { $td fred ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : mh_td=yes else mh_td=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test "$mh_td" = yes ; then TD_upper=`echo $td | tr a-z A-Z` cat >>confdefs.h <<_ACEOF #define ${TD_upper}_TYPEDEFED 1 _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mh_td" >&5 $as_echo "$mh_td" >&6; } done CPPFLAGS="$save_CPPFLAGS" if test $ac_cv_header_xpm_h = yes; then MH_XLIBS="$MH_XLIBS -lXpm" fi # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; with_debug=$enableval else with_debug=no fi cflags_g="`echo $CFLAGS | grep -c '\-g'`" cflags_O="`echo $CFLAGS | grep -c '\-O'`" if test "$with_debug" = yes; then if test "$cflags_g" = "0"; then CFLAGS="${CFLAGS} -g" fi if test "$cflags_O" != "0"; then CFLAGS="`echo ${CFLAGS} | sed -e s/-O.//`" fi CFLAGS="${CFLAGS} -DPDCDEBUG" else if test "$cflags_O" = "0"; then CFLAGS="${CFLAGS} -O" fi if test "$cflags_g" != "0"; then CFLAGS="`echo ${CFLAGS} | sed -e s/-g//`" fi fi if test "$ac_cv_prog_CC" = "gcc"; then if test "$with_debug" = yes; then CFLAGS="${CFLAGS} -Wall" else CFLAGS="-O2 -Wall -fomit-frame-pointer" fi fi if test "$on_qnx" = yes; then if test "$with_debug" = yes; then CFLAGS="-g" else CFLAGS="-Otax" fi fi # Check whether --enable-widec was given. if test "${enable_widec+set}" = set; then : enableval=$enable_widec; with_widec=$enableval else with_widec=no fi PDC_WIDE="" if test "$with_widec" = yes; then PDC_WIDE="-DPDC_WIDE" SYS_DEFS="$SYS_DEFS $PDC_WIDE" fi # Check whether --enable-xim was given. if test "${enable_xim+set}" = set; then : enableval=$enable_xim; with_xim=$enableval else with_xim=no fi if test "$with_xim" = yes; then SYS_DEFS="$SYS_DEFS -DPDC_XIM" fi # Check whether --enable-force-utf8 was given. if test "${enable_force_utf8+set}" = set; then : enableval=$enable_force_utf8; force_utf8=$enableval else force_utf8=no fi if test "$force_utf8" = yes; then SYS_DEFS="$SYS_DEFS -DPDC_FORCE_UTF8" fi # Check whether --enable-purify was given. if test "${enable_purify+set}" = set; then : enableval=$enable_purify; with_purify=$enableval else with_purify=no fi if test "$with_purify" = yes; then PURIFY="purify" else PURIFY="" fi # Check whether --with-xaw3d was given. if test "${with_xaw3d+set}" = set; then : withval=$with_xaw3d; with_xaw3d=$withval else with_xaw3d=no fi if test "$with_xaw3d" = yes; then $as_echo "#define USE_XAW3D 1" >>confdefs.h fi # Check whether --with-nextaw was given. if test "${with_nextaw+set}" = set; then : withval=$with_nextaw; with_nextaw=$withval else with_nextaw=no fi if test "$with_nextaw" = yes; then $as_echo "#define USE_NEXTAW 1" >>confdefs.h fi USE_ABI=yes { $as_echo "$as_me:${as_lineno-$LINENO}: checking shared library extension" >&5 $as_echo_n "checking shared library extension... " >&6; } SHLPST=".so" case "$target" in *hp-hpux*) SHLPST=".sl" ;; *ibm-aix*) SHLPST=".a" ;; *qnx*) SHLPST="" ;; *cygwin*) SHLPST=".dll" ;; *darwin*) SHLPST=".dylib" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHLPST" >&5 $as_echo "$SHLPST" >&6; } AIX_DYN="no" BEOS_DYN="no" SHLFILE="XCurses" SHLFILES="XCurses" RXPACKEXPORTS="" SHLPRE="lib" LD_RXLIB1="" BASE_INSTALL="installbase" BASE_BINARY="binarybase" # OTHER_INSTALLS is set to install a non-version numbered shared library # by default; ie. no .\$(ABI) suffix. Set OTHER_INSTALLS="installabilib" if you # are building a version numbered shared library. OTHER_INSTALLS="installlib" case "$target" in *hp-hpux*) SYS_DEFS="-D_HPUX_SOURCE" LD_RXLIB1="ld -b -q -n" ;; *ibm-aix*) SYS_DEFS="-D_ALL_SOURCE -DAIX" AIX_DYN="yes" DYN_COMP="-DDYNAMIC" LD_RXLIB1="ld -bnoentry -bM:SRE" RXPACKEXPORTS="-bE:$SHLFILE.exp" RXPACKEXP="$SHLFILE.exp" ;; *dec-osf*) if test "$ac_cv_prog_CC" = "gcc"; then SYS_DEFS="-D_POSIX_SOURCE -D_XOPEN_SOURCE" else SYS_DEFS="-D_POSIX_SOURCE -D_XOPEN_SOURCE -Olimit 800" fi LD_RXLIB1="ld -shared" ;; *sequent-dynix*|*esix*|*dgux*) LD_RXLIB1="ld -G" ;; *solaris*) if test "$ac_cv_prog_CC" = "gcc"; then LD_RXLIB1="gcc -shared" else LD_RXLIB1="ld -G" fi ;; sparc*sunos*) SYS_DEFS="-DSUNOS -DSUNOS_STRTOD_BUG" LD_RXLIB1="ld" ;; *atheos*|*nto-qnx*) LD_RXLIB1="${CC} -shared" ;; *linux*|*kfreebsd*-gnu*) LD_RXLIB1="${CC} -shared -Wl,-soname,\$(@)" CAN_USE_ABI="yes" if test "$USE_ABI" = "yes"; then OTHER_INSTALLS="installabilib" fi ;; *freebsd*) LD_RXLIB1="ld -Bdynamic -Bshareable" ;; *pc-sco*) LD_RXLIB1="ld -dy -G" ;; *beos*) LD_RXLIB1="${CC} -Wl,-shared -nostart -Xlinker -soname=\$(@)" BEOS_DYN="yes" ;; *qnx*) SHLPRE="" DYN_COMP="-Q" # force no check for dynamic loading SHLFILE="" ;; *cygwin) SHLPRE="" DYN_COMP="-DDYNAMIC" LD_RXLIB1="dllwrap --def \$(srcdir)/../win32/pdcurses.def --target i386-cygwin32 --dllname \$(@)" # cygwininstall target MUST install the shared library itself because # it puts it into $(bindir) not $(libdir) as all other platforms ;; *darwin*) DYN_COMP="-fno-common" LD_RXLIB1="${CC} -flat_namespace -undefined suppress -dynamiclib -install_name=\$(@)" ;; *) ;; esac if test "$DYN_COMP" = ""; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler flags for a dynamic object" >&5 $as_echo_n "checking compiler flags for a dynamic object... " >&6; } cat > conftest.$ac_ext <&5 (eval $mh_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then DYN_COMP="" else slash="\\" mh_dyncomp="`egrep -c $slash$a conftest.tmp`" if test "$mh_dyncomp" = "0"; then DYN_COMP="$a -DDYNAMIC" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $a" >&5 $as_echo "$a" >&6; } break else DYN_COMP="" fi fi done if test "$DYN_COMP" = ""; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: none of $mh_cv_flags supported" >&5 $as_echo "none of $mh_cv_flags supported" >&6; } fi if test "$LD_RXLIB1" = ""; then mh_compile='${CC-cc} -c $DYN_COMP conftest.$ac_ext 1>&5' cat > conftest.$ac_ext <&5 (eval $mh_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest.o; then mh_dyn_link='ld -shared -o conftest.rxlib conftest.o -lc 1>&5' # mh_dyn_link='${CC} -Wl,-shared -o conftest.rxlib conftest.o -lc 1>&AC_FD_CC' if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$mh_dyn_link\""; } >&5 (eval $mh_dyn_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest.rxlib; then LD_RXLIB1="ld -shared" # LD_RXLIB1="${CC} -Wl,-shared" SHLPRE="lib" SHLPST=".so" else mh_dyn_link='ld -G -o conftest.rxlib conftest.o 1>&5' # mh_dyn_link='${CC} -Wl,-G -o conftest.rxlib conftest.o 1>&AC_FD_CC' if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$mh_dyn_link\""; } >&5 (eval $mh_dyn_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest.rxlib; then LD_RXLIB1="ld -G" # LD_RXLIB1="${CC} -Wl,-G" SHLPRE="lib" SHLPST=".so" else LD_RXLIB1="" SHLPRE="" SHLPST="" fi fi fi rm -f conftest* fi CFLAGS=$save_cflags rm -f conftest.* fi SHL_TARGETS="" if test "$AIX_DYN" = "yes"; then aix_exports="config.exports.aix" echo "" > $aix_exports fi if test "$ac_cv_header_dl_h" = "yes" -o "$ac_cv_header_dlfcn_h" = "yes" -o "$AIX_DYN" = "yes" -o "$BEOS_DYN" = "yes" -o "$DLFCNINCDIR" != "" -o "$DLFCNLIBDIR" != ""; then EXPS="1,2,3,4,5,6,7,8,9" for a in $SHLFILES do if test "$USE_ABI" = "yes" -a "$CAN_USE_ABI" = "yes"; then SHL_TARGETS="${SHL_TARGETS} ${SHLPRE}${a}${SHLPST}.\$(ABI)" else SHL_TARGETS="${SHL_TARGETS} ${SHLPRE}${a}${SHLPST}" fi this=`echo $EXPS | cut -d, -f1` EXPS=`echo $EXPS | cut -d, -f2-` if test "$AIX_DYN" = "yes"; then echo "RXPACKEXP$this=$a.exp" >> $aix_exports echo "RXPACKEXPORTS$this=-bE:$a.exp" >> $aix_exports fi done fi # Extract the first word of "rpm", so it can be a program name with args. set dummy rpm; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_mh_rpm_exists+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$mh_rpm_exists"; then ac_cv_prog_mh_rpm_exists="$mh_rpm_exists" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_mh_rpm_exists="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_mh_rpm_exists" && ac_cv_prog_mh_rpm_exists="no " fi fi mh_rpm_exists=$ac_cv_prog_mh_rpm_exists if test -n "$mh_rpm_exists"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mh_rpm_exists" >&5 $as_echo "$mh_rpm_exists" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "$mh_rpm_exists" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking where rpms are built" >&5 $as_echo_n "checking where rpms are built... " >&6; } RPMTOPDIR=`rpm --eval "%{_topdir}"` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RPMTOPDIR" >&5 $as_echo "$RPMTOPDIR" >&6; } fi # Extract the first word of "lsb_release", so it can be a program name with args. set dummy lsb_release; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_lsb_release+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$lsb_release"; then ac_cv_prog_lsb_release="$lsb_release" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_lsb_release="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_lsb_release" && ac_cv_prog_lsb_release="no" fi fi lsb_release=$ac_cv_prog_lsb_release if test -n "$lsb_release"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lsb_release" >&5 $as_echo "$lsb_release" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "$ac_cv_prog_lsb_release" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking OS distribution name" >&5 $as_echo_n "checking OS distribution name... " >&6; } MYDISTRO="`lsb_release -i | cut -f 2`-`lsb_release -r | cut -f 2`" MYDISTRO="`echo $MYDISTRO | sed \"s/ /_/g\"`" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MYDISTRO" >&5 $as_echo "$MYDISTRO" >&6; } else case "$target" in *freebsd* | *openbsd*) MYDISTRO="`echo $target | cut -f3 -d-`" ;; *darwin*) MYDISTRO="`echo $target | cut -f2-3 -d-`" ;; *pc-solaris2*) MYDISTRO="`echo $target | cut -f2- -d-`" ;; *cygwin*) MYDISTRO="`echo $target | cut -f2- -d-`" ;; *) MYDISTRO="$target" ;; esac fi # Check whether --enable-32bit was given. if test "${enable_32bit+set}" = set; then : enableval=$enable_32bit; bitflag32=yes else bitflag32=no fi # Check whether --enable-64bit was given. if test "${enable_64bit+set}" = set; then : enableval=$enable_64bit; bitflag64=yes else bitflag64=no fi # # Now do platform specific tests # gcc_64bit="-m64" gcc_32bit="-m32" on_osx="no" osis64bit=no bitflag="" case "$target" in *hp-hpux*) ;; *ibm-aix*) rc=`lsconf -k | grep -c 64-bit` if test $rc -eq 1; then bitflag="64" osis64bit=yes fi # # AIX gcc has its own special bit switches :-( # gcc_64bit="-maix64" gcc_32bit="-maix32" ;; *dec-osf4*) ;; *dec-osf*) ;; *sequent-dynix*) ;; i*86*solaris*) ;; *solaris*) rc=`isainfo -v | grep -c 64-bit` if test $rc -eq 1; then bitflag="64" osis64bit=yes fi ;; sparc*sunos*) ;; *linux*|*kfreebsd*-gnu*) mach="`uname -m`" if test "$mach" = "x86_64" -o "$mach" = "ia86" -o "$mach" = "alpha" -o "$mach" = "ppc64" -o "$mach" = "s390x"; then bitflag="64" osis64bit=yes fi ;; *-freebsd*) mach="`uname -m`" if test "$mach" = "amd64"; then bitflag="64" osis64bit=yes fi ;; *nto-qnx*) ;; *qnx*) ;; *beos*) ;; *cygwin*) ;; *apple-darwin*) on_osx="yes" osx_64bit=`sysctl hw.cpu64bit_capable | cut -f2 -d' '` if test $osx_64bit -eq 1; then bitflag="64" osis64bit=yes fi ;; esac if test "x$bitflag32" = "xyes" -a "x$bitflag64" = "xyes"; then as_fn_error $? "--enable-32bit and --enable-64bit flags cannot both be specified." "$LINENO" 5 fi if test "x$bitflag64" = "xyes" -a "$osis64bit" = "no"; then as_fn_error $? "--enable-64bit cannot be specified on non-64bit OS." "$LINENO" 5 fi binarybitprefix="" if test "x$bitflag32" = "xyes"; then bitflag="32" if test "$osis64bit" = "yes"; then binarybitprefix="32" fi elif test "x$bitflag64" = "xyes"; then bitflag="64" fi MACH_ARCH=`$ac_config_guess | cut -f1 -d-` if test "$on_osx" = "yes"; then valid_arch_flags="" found_arch_flags="" # Check whether --with-arch was given. if test "${with_arch+set}" = set; then : withval=$with_arch; with_arch=$withval else with_arch=none fi case "$with_arch" in none) arch_flags="" ;; all) arch_flags="-arch ppc -arch ppc64 -arch x86_64 -arch i386" ;; 32bit) arch_flags="-arch ppc -arch i386" ;; 64bit) arch_flags="-arch ppc64 -arch x86_64" ;; intel) arch_flags="-arch i386 -arch x86_64" ;; *) arch_flags="-arch $with_arch" ;; esac valid_arch_flags="" found_arch_flags="" if test $on_osx = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for which Mac OSX -arch flags are supported for universal binaries" >&5 $as_echo_n "checking for which Mac OSX -arch flags are supported for universal binaries... " >&6; } for a in $arch_flags; do save_ldflags="$LDFLAGS" LDFLAGS="$LDFLAGS -arch $a" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { exit(0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : valid_arch_flags="$valid_arch_flags -arch $a";found_arch_flags="$found_arch_flags $a" else a="$a" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_ldflags" done { $as_echo "$as_me:${as_lineno-$LINENO}: result: $found_arch_flags" >&5 $as_echo "$found_arch_flags" >&6; } fi else if test "$ac_cv_prog_CC" = "gcc" -o "$ac_cv_prog_CC" = "g++"; then if test "$bitflag" = "32"; then CFLAGS="${CFLAGS} $gcc_32bit" LDFLAGS="${LDFLAGS} $gcc_32bit" elif test "$bitflag" = "64"; then CFLAGS="${CFLAGS} $gcc_64bit" LDFLAGS="${LDFLAGS} $gcc_64bit" else bitflag="32" fi elif test "$ac_cv_prog_CC" = "xlc" -o "$ac_cv_prog_CC" = "xlC"; then if test "$bitflag" = "32"; then CFLAGS="${CFLAGS} -q32" LDFLAGS="${LDFLAGS} -q32" elif test "$bitflag" = "64"; then CFLAGS="${CFLAGS} -q64" LDFLAGS="${LDFLAGS} -q64" else bitflag="32" fi fi fi #libdir_change=yes # Check whether --enable-libdir-change was given. if test "${enable_libdir_change+set}" = set; then : enableval=$enable_libdir_change; libdir_change=$enableval else libdir_change=yes fi echo "libdir: $libdir_change" if test "$libdir_change" = yes; then if test "${libdir}" = '${exec_prefix}/lib'; then myprefix=$prefix prefix_NONE= exec_prefix_NONE= test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix eval ac_define_dir="\""$myprefix"\"" eval ac_define_dir="\"$ac_define_dir\"" MY_PREFIX="$ac_define_dir" cat >>confdefs.h <<_ACEOF #define MY_PREFIX "$ac_define_dir" _ACEOF test "$prefix_NONE" && prefix=NONE test "$exec_prefix_NONE" && exec_prefix=NONE if test "${myprefix}" = "NONE"; then myprefix="$ac_default_prefix" fi if test -d "${myprefix}/lib/x86_64-linux-gnu"; then libdir64="${myprefix}/lib/x86_64-linux-gnu" elif test -d "${myprefix}/lib64"; then libdir64="${myprefix}/lib64" else libdir64="${myprefix}/lib" fi if test -d "${myprefix}/lib/i386-linux-gnu"; then libdir32="${myprefix}/lib/i386-linux-gnu" elif test -d "${myprefix}/lib32"; then libdir32="${myprefix}/lib32" else libdir32="${myprefix}/lib" fi if test "$bitflag" = "64"; then libdir="$libdir64" else libdir="$libdir32" fi else libdir64="$libdir" libdir32="$libdir" fi else libdir64="$libdir" libdir32="$libdir" fi ac_config_files="$ac_config_files Makefile xcurses-config" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by PDCurses $as_me 3.4, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ PDCurses config.status 3.4 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "xcurses-config") CONFIG_FILES="$CONFIG_FILES xcurses-config" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi $as_echo "#define PDC_MAX_SIGNALS /**/" >>confdefs.h $as_echo "#define HAVE_DECKEYSYM_H /**/" >>confdefs.h $as_echo "#define HAVE_SUNKEYSYM_H /**/" >>confdefs.h $as_echo "#define HAVE_XF86KEYSYM_H /**/" >>confdefs.h $as_echo "#define HAVE_XPM_H /**/" >>confdefs.h $as_echo "#define HAVE_XK_KP_DELETE /**/" >>confdefs.h $as_echo "#define HAVE_XK_KP_INSERT /**/" >>confdefs.h $as_echo "#define HAVE_XK_KP_END /**/" >>confdefs.h $as_echo "#define HAVE_XK_KP_DOWN /**/" >>confdefs.h $as_echo "#define HAVE_XK_KP_NEXT /**/" >>confdefs.h $as_echo "#define HAVE_XK_KP_LEFT /**/" >>confdefs.h $as_echo "#define HAVE_XK_KP_RIGHT /**/" >>confdefs.h $as_echo "#define HAVE_XK_KP_HOME /**/" >>confdefs.h $as_echo "#define HAVE_XK_KP_UP /**/" >>confdefs.h $as_echo "#define HAVE_XK_KP_PRIOR /**/" >>confdefs.h $as_echo "#define HAVE_XK_KP_BEGIN /**/" >>confdefs.h $as_echo "#define USE_XAW3D /**/" >>confdefs.h $as_echo "#define USE_NEXTAW /**/" >>confdefs.h $as_echo "#define XPOINTER_TYPEDEFED /**/" >>confdefs.h curses-1.4.4/vendor/PDCurses/x11/pdcdisp.c0000644000004100000410000000367014201713275020254 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcx11.h" #include #ifdef CHTYPE_LONG #ifdef PDC_WIDE #define USE_UNICODE_ACS_CHARS 1 #else #define USE_ISO8859_CHARSET #endif #include "acs_defs.h" #endif int PDC_display_cursor(int oldrow, int oldcol, int newrow, int newcol, int visibility) { char buf[30]; int idx, pos; PDC_LOG(("%s:PDC_display_cursor() - called: NEW row %d col %d, vis %d\n", XCLOGMSG, newrow, newcol, visibility)); if (visibility == -1) { /* Only send the CURSES_DISPLAY_CURSOR message, no data */ idx = CURSES_DISPLAY_CURSOR; memcpy(buf, &idx, sizeof(int)); idx = sizeof(int); } else { idx = CURSES_CURSOR; memcpy(buf, &idx, sizeof(int)); idx = sizeof(int); pos = oldrow + (oldcol << 8); memcpy(buf + idx, &pos, sizeof(int)); idx += sizeof(int); pos = newrow + (newcol << 8); memcpy(buf + idx, &pos, sizeof(int)); idx += sizeof(int); } if (XC_write_socket(xc_display_sock, buf, idx) < 0) XCursesExitCursesProcess(1, "exiting from PDC_display_cursor"); return OK; } /* position hardware cursor at (y, x) */ void PDC_gotoyx(int row, int col) { PDC_LOG(("PDC_gotoyx() - called: row %d col %d\n", row, col)); PDC_display_cursor(SP->cursrow, SP->curscol, row, col, SP->visibility); } /* update the given physical line to look like the corresponding line in curscr */ void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) { PDC_LOG(("PDC_transform_line() - called: line %d\n", lineno)); XC_get_line_lock(lineno); memcpy(Xcurscr + XCURSCR_Y_OFF(lineno) + (x * sizeof(chtype)), srcp, len * sizeof(chtype)); *(Xcurscr + XCURSCR_START_OFF + lineno) = x; *(Xcurscr + XCURSCR_LENGTH_OFF + lineno) = len; XC_release_line_lock(lineno); XCursesInstructAndWait(CURSES_REFRESH); } curses-1.4.4/vendor/PDCurses/x11/big_icon.xbm0000644000004100000410000000634014201713275020740 0ustar www-datawww-data#define big_icon_width 64 #define big_icon_height 64 static unsigned char big_icon_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xc1, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xc3, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xc3, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc0, 0xc7, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x80, 0xc7, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x80, 0xc7, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x80, 0xc7, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x80, 0xc7, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc0, 0xc7, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc3, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xe3, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf8, 0xf1, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xfc, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7e, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0xfe, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x8f, 0xdf, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc7, 0xcf, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe3, 0xc7, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf1, 0xc3, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xc1, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf8, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x78, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x78, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x78, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x78, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf8, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc0, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x23, 0x50, 0x1e, 0x7c, 0xf0, 0xe0, 0x03, 0x60, 0x26, 0x50, 0x33, 0xc6, 0x98, 0x31, 0x06, 0x30, 0x2c, 0xd0, 0x61, 0x83, 0x0d, 0x1b, 0x0c, 0x10, 0x28, 0xd0, 0x40, 0x01, 0x05, 0x0a, 0x08, 0x10, 0x20, 0x50, 0x00, 0x01, 0x05, 0x0a, 0x08, 0x10, 0x20, 0x50, 0x00, 0x03, 0x04, 0x1a, 0x00, 0x10, 0x20, 0x50, 0x00, 0x06, 0x04, 0x32, 0x00, 0x10, 0x20, 0x50, 0x00, 0x7c, 0xfc, 0xe3, 0x03, 0x10, 0x20, 0x50, 0x00, 0xc0, 0x04, 0x00, 0x06, 0x10, 0x20, 0x50, 0x00, 0x80, 0x05, 0x00, 0x0c, 0x10, 0x20, 0x50, 0x00, 0x01, 0x05, 0x0a, 0x08, 0x10, 0x28, 0x50, 0x00, 0x01, 0x05, 0x0a, 0x08, 0x30, 0x6c, 0x58, 0x00, 0x83, 0x0d, 0x1b, 0x0c, 0x60, 0xc6, 0x4c, 0x00, 0xc6, 0x98, 0x31, 0x06, 0xc0, 0x83, 0x47, 0x00, 0x7c, 0xf0, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; curses-1.4.4/vendor/PDCurses/x11/little_icon.xbm0000644000004100000410000000161214201713275021471 0ustar www-datawww-data#define little_icon_width 32 #define little_icon_height 32 static unsigned char little_icon_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x30, 0x00, 0x00, 0xfc, 0x31, 0x00, 0x00, 0x8c, 0x33, 0x00, 0x00, 0x0c, 0x33, 0x00, 0x00, 0x0c, 0x33, 0x00, 0x00, 0x8c, 0x33, 0x00, 0x00, 0xcc, 0x39, 0x00, 0x00, 0xec, 0x3c, 0x00, 0x00, 0x7c, 0x3e, 0x00, 0x00, 0x3c, 0x37, 0x00, 0x00, 0x9c, 0x33, 0x00, 0x00, 0xcc, 0x31, 0x00, 0x00, 0xcc, 0x30, 0x00, 0x00, 0xcc, 0x30, 0x00, 0x00, 0xcc, 0x31, 0x00, 0x00, 0x8c, 0x3f, 0x00, 0x00, 0x0c, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x2a, 0xc6, 0x18, 0x52, 0x5a, 0x29, 0x25, 0x42, 0x0a, 0x21, 0x05, 0x42, 0x0a, 0xe6, 0x18, 0x42, 0x0a, 0x28, 0x20, 0x52, 0x0a, 0x29, 0x25, 0x8c, 0x09, 0xc6, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; curses-1.4.4/vendor/PDCurses/x11/pdcclip.c0000644000004100000410000001110414201713275020233 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcx11.h" #include /*man-start************************************************************** clipboard --------- ### Synopsis int PDC_getclipboard(char **contents, long *length); int PDC_setclipboard(const char *contents, long length); int PDC_freeclipboard(char *contents); int PDC_clearclipboard(void); ### Description PDC_getclipboard() gets the textual contents of the system's clipboard. This function returns the contents of the clipboard in the contents argument. It is the responsibilitiy of the caller to free the memory returned, via PDC_freeclipboard(). The length of the clipboard contents is returned in the length argument. PDC_setclipboard copies the supplied text into the system's clipboard, emptying the clipboard prior to the copy. PDC_clearclipboard() clears the internal clipboard. ### Return Values indicator of success/failure of call. PDC_CLIP_SUCCESS the call was successful PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for the clipboard contents PDC_CLIP_EMPTY the clipboard contains no text PDC_CLIP_ACCESS_ERROR no clipboard support ### Portability X/Open BSD SYS V PDC_getclipboard - - - PDC_setclipboard - - - PDC_freeclipboard - - - PDC_clearclipboard - - - **man-end****************************************************************/ int PDC_getclipboard(char **contents, long *length) { #ifdef PDC_WIDE wchar_t *wcontents; #endif int result = 0; int len; PDC_LOG(("PDC_getclipboard() - called\n")); XCursesInstructAndWait(CURSES_GET_SELECTION); if (XC_read_socket(xc_display_sock, &result, sizeof(int)) < 0) XCursesExitCursesProcess(5, "exiting from PDC_getclipboard"); if (result == PDC_CLIP_SUCCESS) { if (XC_read_socket(xc_display_sock, &len, sizeof(int)) < 0) XCursesExitCursesProcess(5, "exiting from PDC_getclipboard"); #ifdef PDC_WIDE wcontents = malloc((len + 1) * sizeof(wchar_t)); *contents = malloc(len * 3 + 1); if (!wcontents || !*contents) #else *contents = malloc(len + 1); if (!*contents) #endif XCursesExitCursesProcess(6, "exiting from PDC_getclipboard - " "synchronization error"); if (len) { if (XC_read_socket(xc_display_sock, #ifdef PDC_WIDE wcontents, len * sizeof(wchar_t)) < 0) #else *contents, len) < 0) #endif XCursesExitCursesProcess(5, "exiting from PDC_getclipboard"); } #ifdef PDC_WIDE wcontents[len] = 0; len = PDC_wcstombs(*contents, wcontents, len * 3); free(wcontents); #endif (*contents)[len] = '\0'; *length = len; } return result; } int PDC_setclipboard(const char *contents, long length) { #ifdef PDC_WIDE wchar_t *wcontents; #endif int rc; PDC_LOG(("PDC_setclipboard() - called\n")); #ifdef PDC_WIDE wcontents = malloc((length + 1) * sizeof(wchar_t)); if (!wcontents) return PDC_CLIP_MEMORY_ERROR; length = PDC_mbstowcs(wcontents, contents, length); #endif XCursesInstruct(CURSES_SET_SELECTION); /* Write, then wait for X to do its stuff; expect return code. */ if (XC_write_socket(xc_display_sock, &length, sizeof(long)) >= 0) { if (XC_write_socket(xc_display_sock, #ifdef PDC_WIDE wcontents, length * sizeof(wchar_t)) >= 0) { free(wcontents); #else contents, length) >= 0) { #endif if (XC_read_socket(xc_display_sock, &rc, sizeof(int)) >= 0) return rc; } } XCursesExitCursesProcess(5, "exiting from PDC_setclipboard"); return PDC_CLIP_ACCESS_ERROR; /* not reached */ } int PDC_freeclipboard(char *contents) { PDC_LOG(("PDC_freeclipboard() - called\n")); free(contents); return PDC_CLIP_SUCCESS; } int PDC_clearclipboard(void) { int rc; long len = 0; PDC_LOG(("PDC_clearclipboard() - called\n")); XCursesInstruct(CURSES_CLEAR_SELECTION); /* Write, then wait for X to do its stuff; expect return code. */ if (XC_write_socket(xc_display_sock, &len, sizeof(long)) >= 0) if (XC_read_socket(xc_display_sock, &rc, sizeof(int)) >= 0) return rc; XCursesExitCursesProcess(5, "exiting from PDC_clearclipboard"); return PDC_CLIP_ACCESS_ERROR; /* not reached */ } curses-1.4.4/vendor/PDCurses/x11/Makefile.in0000644000004100000410000005151014201713275020523 0ustar www-datawww-data# Makefile for PDCurses library for X11 SHELL = @SHELL@ @SET_MAKE@ # srcdir is set to .../PDCurses/x11 by configure srcdir = @srcdir@ basedir = $(srcdir)/.. abs_basedir = @abs_srcdir@/.. exec_prefix = @exec_prefix@ prefix = @prefix@ libdir = @libdir@ bindir = @bindir@ includedir = @includedir@ x11dir = $(srcdir) pdcursesdir = $(basedir)/pdcurses demodir = $(basedir)/demos PDCURSES_CONFIG_H =./config.h PDCURSES_CURSES_H =$(basedir)/curses.h PDCURSES_CURSPRIV_H =$(basedir)/curspriv.h PDCURSES_HEADERS =$(PDCURSES_CONFIG_H) $(PDCURSES_CURSES_H) \ $(PDCURSES_CURSPRIV_H) PDCURSES_X11_H =$(x11dir)/pdcx11.h INSTALL = $(x11dir)/install-sh RANLIB = @RANLIB@ SHLPRE = @SHLPRE@ SHLPST = @SHLPST@ SHLFILE = XCurses SHL_TARGETS = @SHL_TARGETS@ OTHER_INSTALLS = @OTHER_INSTALLS@ BASE_INSTALL = @BASE_INSTALL@ BASE_BINARY = @BASE_BINARY@ CAN_USE_ABI = @CAN_USE_ABI@ RPMTOPDIR = @RPMTOPDIR@ MYDISTRO = @MYDISTRO@ MACH_ARCH = @MACH_ARCH@ LN_S = @LN_S@ -f include $(basedir)/version.mif PDC_DIR=PDCurses-$(VERDOT) ZIPFILE = pdcurs$(VER).zip TARBALL = $(PDC_DIR).tar.gz LD_RXLIB1 = @LD_RXLIB1@ LD_RXLIB2 = @MH_XLIBS@ @MH_EXTRA_LIBS@ -lc CFLAGS = @CFLAGS@ CPPFLAGS = @DEFS@ -DXCURSES @SYS_DEFS@ -I$(basedir) -I. BUILD = @CC@ -c $(CFLAGS) $(CPPFLAGS) @MH_XINC_DIR@ DYN_BUILD = @O2SAVE@ $(BUILD) @DYN_COMP@ @CC2O@ LINK = @PURIFY@ @CC@ #LDFLAGS = $(LIB_DEPS) @LDFLAGS@ @LIBS@ @MH_XLIBS@ @MH_EXTRA_LIBS@ LDFLAGS = $(LIBCURSES) @LDFLAGS@ @LIBS@ @MH_XLIBS@ @MH_EXTRA_LIBS@ LIBCURSES = libXCurses.a LIB_DEPS = -L. -lXCurses PDCLIBS = $(LIBCURSES) @SHL_TARGETS@ DEMOS = firework ozdemo newtest ptest rain testcurs tuidemo worm xmas DEMOOBJS = firework.o ozdemo.o newtest.o ptest.o rain.o testcurs.o tui.o \ tuidemo.o worm.o xmas.o SHLFILE = XCurses all: $(PDCLIBS) $(DEMOS) install: $(BASE_INSTALL) $(OTHER_INSTALLS) # base install; for builds with ABI .so or non ABI .so installbase: all $(INSTALL) -d -m 755 $(DESTDIR)$(libdir) $(INSTALL) -d -m 755 $(DESTDIR)$(bindir) $(INSTALL) -d -m 755 $(DESTDIR)$(includedir) $(INSTALL) -d -m 755 $(DESTDIR)$(includedir)/xcurses $(INSTALL) -c -m 644 $(basedir)/curses.h $(DESTDIR)$(includedir)/xcurses.h $(INSTALL) -c -m 644 $(basedir)/curses.h $(DESTDIR)$(includedir)/xcurses/curses.h sed -e 's/#include /#include /' < $(basedir)/panel.h > ./xpanel.h $(INSTALL) -m 644 ./xpanel.h $(DESTDIR)$(includedir)/xpanel.h $(INSTALL) -c -m 644 $(basedir)/panel.h $(DESTDIR)$(includedir)/xcurses/panel.h $(INSTALL) -c -m 644 $(basedir)/term.h $(DESTDIR)$(includedir)/xcurses/term.h $(INSTALL) -c -m 644 ./libXCurses.a $(DESTDIR)$(libdir)/libXCurses.a -$(RANLIB) $(DESTDIR)$(libdir)/libXCurses.a (cd $(DESTDIR)$(libdir); $(LN_S) libXCurses.a libXpanel.a) -$(RANLIB) $(DESTDIR)$(libdir)/libXpanel.a $(INSTALL) -c -m 755 ./xcurses-config $(DESTDIR)$(bindir)/xcurses-config installlib: -$(INSTALL) -c -m 755 ./$(SHLPRE)$(SHLFILE)$(SHLPST) $(DESTDIR)$(libdir)/$(SHLPRE)$(SHLFILE)$(SHLPST) (cd $(DESTDIR)$(libdir); $(LN_S) $(SHLPRE)$(SHLFILE)$(SHLPST) $(libdir)/$(SHLPRE)Xpanel$(SHLPST)) installabilib: -$(INSTALL) -c -m 755 ./$(SHLPRE)$(SHLFILE)$(SHLPST).$(ABI) $(DESTDIR)$(libdir)/$(SHLPRE)$(SHLFILE)$(SHLPST).$(ABI) (cd $(DESTDIR)$(libdir); $(LN_S) $(SHLPRE)$(SHLFILE)$(SHLPST).$(ABI) $(SHLPRE)$(SHLFILE)$(SHLPST).$(ABI_MAJOR)) (cd $(DESTDIR)$(libdir); $(LN_S) $(SHLPRE)$(SHLFILE)$(SHLPST).$(ABI_MAJOR) $(SHLPRE)$(SHLFILE)$(SHLPST)) (cd $(DESTDIR)$(libdir); $(LN_S) $(SHLPRE)$(SHLFILE)$(SHLPST).$(ABI) $(SHLPRE)Xpanel$(SHLPST).$(ABI)) (cd $(DESTDIR)$(libdir); $(LN_S) $(SHLPRE)Xpanel$(SHLPST).$(ABI) $(SHLPRE)Xpanel$(SHLPST).$(ABI_MAJOR)) (cd $(DESTDIR)$(libdir); $(LN_S) $(SHLPRE)Xpanel$(SHLPST).$(ABI_MAJOR) $(SHLPRE)Xpanel$(SHLPST)) uninstall: -rm -f $(DESTDIR)$(includedir)/xcurses.h -rm -f $(DESTDIR)$(includedir)/xpanel.h -rm -fr $(DESTDIR)$(includedir)/xcurses/ -rm -f $(DESTDIR)$(libdir)/libXCurses.a -rm -f $(DESTDIR)$(libdir)/libXpanel.a -rm -f $(DESTDIR)$(bindir)/xcurses-config -rm -f $(DESTDIR)$(libdir)/$(SHLPRE)$(SHLFILE)$(SHLPST) -rm -f $(DESTDIR)$(libdir)/$(SHLPRE)$(SHLFILE)$(SHLPST).$(ABI) -rm -f $(DESTDIR)$(libdir)/$(SHLPRE)$(SHLFILE)$(SHLPST).$(ABI_MAJOR) -rm -f $(DESTDIR)$(libdir)/$(SHLPRE)Xpanel$(SHLPST) -rm -f $(DESTDIR)$(libdir)/$(SHLPRE)Xpanel$(SHLPST).$(ABI) -rm -f $(DESTDIR)$(libdir)/$(SHLPRE)Xpanel$(SHLPST).$(ABI_MAJOR) oldinstall: $(INSTALL) -d -m 755 $(libdir) $(INSTALL) -d -m 755 $(bindir) $(INSTALL) -d -m 755 $(includedir) $(INSTALL) -d -m 755 $(includedir)/xcurses $(INSTALL) -c -m 644 $(basedir)/curses.h $(includedir)/xcurses.h $(INSTALL) -c -m 644 $(basedir)/curses.h $(includedir)/xcurses/curses.h sed -e 's/#include /#include /' \ < $(basedir)/panel.h > ./xpanel.h $(INSTALL) -m 644 ./xpanel.h $(includedir)/xpanel.h $(INSTALL) -c -m 644 $(basedir)/panel.h $(includedir)/xcurses/panel.h $(INSTALL) -c -m 644 $(basedir)/term.h $(includedir)/xcurses/term.h $(INSTALL) -c -m 644 ./libXCurses.a $(libdir)/libXCurses.a -$(RANLIB) $(libdir)/libXCurses.a -$(INSTALL) -c -m 755 ./$(SHLPRE)$(SHLFILE)$(SHLPST) \ $(libdir)/$(SHLPRE)$(SHLFILE)$(SHLPST) ln -f -s $(libdir)/$(SHLPRE)$(SHLFILE)$(SHLPST) \ $(libdir)/$(SHLPRE)Xpanel$(SHLPST) ln -f -s $(libdir)/libXCurses.a $(libdir)/libXpanel.a -$(RANLIB) $(libdir)/libXpanel.a $(INSTALL) -c -m 755 ./xcurses-config $(bindir)/xcurses-config clean: -rm -rf *.o *.sho trace $(PDCLIBS) $(DEMOS) config.log \ config.cache config.status demos: $(DEMOS) distclean: clean -rm -f Makefile config.h xcurses-config mostlyclean: clean realclean: distclean LIBOBJS = addch.o addchstr.o addstr.o attr.o beep.o bkgd.o border.o \ clear.o color.o delch.o deleteln.o deprec.o getch.o getstr.o getyx.o \ inch.o inchstr.o initscr.o inopts.o insch.o insstr.o instr.o kernel.o \ keyname.o mouse.o move.o outopts.o overlay.o pad.o panel.o printw.o \ refresh.o scanw.o scr_dump.o scroll.o slk.o termattr.o terminfo.o \ touch.o util.o window.o debug.o PDCOBJS = pdcclip.o pdcdisp.o pdcgetsc.o pdckbd.o pdcscrn.o pdcsetsc.o \ pdcutil.o pdcx11.o x11.o sb.o ScrollBox.o LIBSHOBJS = $(LIBOBJS:.o=.sho) PDCSHOBJS = $(PDCOBJS:.o=.sho) SHOFILES = $(LIBSHOBJS) $(PDCSHOBJS) $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) ar rv $@ $? -$(RANLIB) $@ $(SHLPRE)$(SHLFILE)$(SHLPST) : $(SHOFILES) $(LD_RXLIB1) -o $@ $(SHOFILES) $(LD_RXLIB2) $(SHLPRE)$(SHLFILE)$(SHLPST).$(ABI): $(SHOFILES) $(LD_RXLIB1) -o $@ $(SHOFILES) $(LD_RXLIB2) -rm -f $(SHLPRE)$(SHLFILE)$(SHLPST).$(ABI_MAJOR) -rm -f $(SHLPRE)$(SHLFILE)$(SHLPST) -$(LN_S) $(SHLPRE)$(SHLFILE)$(SHLPST).$(ABI) $(SHLPRE)$(SHLFILE)$(SHLPST).$(ABI_MAJOR) -$(LN_S) $(SHLPRE)$(SHLFILE)$(SHLPST).$(ABI_MAJOR) $(SHLPRE)$(SHLFILE)$(SHLPST) $(LIBOBJS) $(PDCOBJS) $(SHOFILES) : $(PDCURSES_HEADERS) $(PDCOBJS) $(PDCSHOBJS) : $(PDCURSES_X11_H) $(DEMOOBJS) : $(PDCURSES_CURSES_H) $(DEMOS) : $(LIBCURSES) terminfo.o terminfo.sho: $(TERM_HEADER) addch.o: $(pdcursesdir)/addch.c $(BUILD) $(pdcursesdir)/addch.c addchstr.o: $(pdcursesdir)/addchstr.c $(BUILD) $(pdcursesdir)/addchstr.c addstr.o: $(pdcursesdir)/addstr.c $(BUILD) $(pdcursesdir)/addstr.c attr.o: $(pdcursesdir)/attr.c $(BUILD) $(pdcursesdir)/attr.c beep.o: $(pdcursesdir)/beep.c $(BUILD) $(pdcursesdir)/beep.c bkgd.o: $(pdcursesdir)/bkgd.c $(BUILD) $(pdcursesdir)/bkgd.c border.o: $(pdcursesdir)/border.c $(BUILD) $(pdcursesdir)/border.c clear.o: $(pdcursesdir)/clear.c $(BUILD) $(pdcursesdir)/clear.c color.o: $(pdcursesdir)/color.c $(BUILD) $(pdcursesdir)/color.c delch.o: $(pdcursesdir)/delch.c $(BUILD) $(pdcursesdir)/delch.c deleteln.o: $(pdcursesdir)/deleteln.c $(BUILD) $(pdcursesdir)/deleteln.c deprec.o: $(pdcursesdir)/deprec.c $(BUILD) $(pdcursesdir)/deprec.c getch.o: $(pdcursesdir)/getch.c $(BUILD) $(pdcursesdir)/getch.c getstr.o: $(pdcursesdir)/getstr.c $(BUILD) $(pdcursesdir)/getstr.c getyx.o: $(pdcursesdir)/getyx.c $(BUILD) $(pdcursesdir)/getyx.c inch.o: $(pdcursesdir)/inch.c $(BUILD) $(pdcursesdir)/inch.c inchstr.o: $(pdcursesdir)/inchstr.c $(BUILD) $(pdcursesdir)/inchstr.c initscr.o: $(pdcursesdir)/initscr.c $(BUILD) $(pdcursesdir)/initscr.c inopts.o: $(pdcursesdir)/inopts.c $(BUILD) $(pdcursesdir)/inopts.c insch.o: $(pdcursesdir)/insch.c $(BUILD) $(pdcursesdir)/insch.c insstr.o: $(pdcursesdir)/insstr.c $(BUILD) $(pdcursesdir)/insstr.c instr.o: $(pdcursesdir)/instr.c $(BUILD) $(pdcursesdir)/instr.c kernel.o: $(pdcursesdir)/kernel.c $(BUILD) $(pdcursesdir)/kernel.c keyname.o: $(pdcursesdir)/keyname.c $(BUILD) $(pdcursesdir)/keyname.c mouse.o: $(pdcursesdir)/mouse.c $(BUILD) $(pdcursesdir)/mouse.c move.o: $(pdcursesdir)/move.c $(BUILD) $(pdcursesdir)/move.c outopts.o: $(pdcursesdir)/outopts.c $(BUILD) $(pdcursesdir)/outopts.c overlay.o: $(pdcursesdir)/overlay.c $(BUILD) $(pdcursesdir)/overlay.c pad.o: $(pdcursesdir)/pad.c $(BUILD) $(pdcursesdir)/pad.c panel.o: $(pdcursesdir)/panel.c $(basedir)/panel.h $(BUILD) $(pdcursesdir)/panel.c printw.o: $(pdcursesdir)/printw.c $(BUILD) $(pdcursesdir)/printw.c refresh.o: $(pdcursesdir)/refresh.c $(BUILD) $(pdcursesdir)/refresh.c scanw.o: $(pdcursesdir)/scanw.c $(BUILD) $(pdcursesdir)/scanw.c scr_dump.o: $(pdcursesdir)/scr_dump.c $(BUILD) $(pdcursesdir)/scr_dump.c scroll.o: $(pdcursesdir)/scroll.c $(BUILD) $(pdcursesdir)/scroll.c slk.o: $(pdcursesdir)/slk.c $(BUILD) $(pdcursesdir)/slk.c termattr.o: $(pdcursesdir)/termattr.c $(BUILD) $(pdcursesdir)/termattr.c terminfo.o: $(pdcursesdir)/terminfo.c $(BUILD) $(pdcursesdir)/terminfo.c touch.o: $(pdcursesdir)/touch.c $(BUILD) $(pdcursesdir)/touch.c util.o: $(pdcursesdir)/util.c $(BUILD) $(pdcursesdir)/util.c window.o: $(pdcursesdir)/window.c $(BUILD) $(pdcursesdir)/window.c debug.o: $(pdcursesdir)/debug.c $(BUILD) $(pdcursesdir)/debug.c pdcclip.o: $(x11dir)/pdcclip.c $(BUILD) $(x11dir)/pdcclip.c pdcdisp.o: $(x11dir)/pdcdisp.c $(BUILD) $(x11dir)/pdcdisp.c pdcgetsc.o: $(x11dir)/pdcgetsc.c $(BUILD) $(x11dir)/pdcgetsc.c pdckbd.o: $(x11dir)/pdckbd.c $(BUILD) $(x11dir)/pdckbd.c pdcscrn.o: $(x11dir)/pdcscrn.c $(BUILD) $(x11dir)/pdcscrn.c pdcsetsc.o: $(x11dir)/pdcsetsc.c $(BUILD) $(x11dir)/pdcsetsc.c pdcutil.o: $(x11dir)/pdcutil.c $(BUILD) $(x11dir)/pdcutil.c pdcx11.o: $(x11dir)/pdcx11.c $(BUILD) $(x11dir)/pdcx11.c ScrollBox.o: $(x11dir)/ScrollBox.c $(BUILD) $(x11dir)/ScrollBox.c sb.o: $(x11dir)/sb.c $(BUILD) $(x11dir)/sb.c x11.o: $(x11dir)/x11.c $(BUILD) $(x11dir)/x11.c addch.sho: $(pdcursesdir)/addch.c $(DYN_BUILD) $(pdcursesdir)/addch.c @SAVE2O@ addchstr.sho: $(pdcursesdir)/addchstr.c $(DYN_BUILD) $(pdcursesdir)/addchstr.c @SAVE2O@ addstr.sho: $(pdcursesdir)/addstr.c $(DYN_BUILD) $(pdcursesdir)/addstr.c @SAVE2O@ attr.sho: $(pdcursesdir)/attr.c $(DYN_BUILD) $(pdcursesdir)/attr.c @SAVE2O@ beep.sho: $(pdcursesdir)/beep.c $(DYN_BUILD) $(pdcursesdir)/beep.c @SAVE2O@ bkgd.sho: $(pdcursesdir)/bkgd.c $(DYN_BUILD) $(pdcursesdir)/bkgd.c @SAVE2O@ border.sho: $(pdcursesdir)/border.c $(DYN_BUILD) $(pdcursesdir)/border.c @SAVE2O@ clear.sho: $(pdcursesdir)/clear.c $(DYN_BUILD) $(pdcursesdir)/clear.c @SAVE2O@ color.sho: $(pdcursesdir)/color.c $(DYN_BUILD) $(pdcursesdir)/color.c @SAVE2O@ delch.sho: $(pdcursesdir)/delch.c $(DYN_BUILD) $(pdcursesdir)/delch.c @SAVE2O@ deleteln.sho: $(pdcursesdir)/deleteln.c $(DYN_BUILD) $(pdcursesdir)/deleteln.c @SAVE2O@ deprec.sho: $(pdcursesdir)/deprec.c $(DYN_BUILD) $(pdcursesdir)/deprec.c @SAVE2O@ getch.sho: $(pdcursesdir)/getch.c $(DYN_BUILD) $(pdcursesdir)/getch.c @SAVE2O@ getstr.sho: $(pdcursesdir)/getstr.c $(DYN_BUILD) $(pdcursesdir)/getstr.c @SAVE2O@ getyx.sho: $(pdcursesdir)/getyx.c $(DYN_BUILD) $(pdcursesdir)/getyx.c @SAVE2O@ inch.sho: $(pdcursesdir)/inch.c $(DYN_BUILD) $(pdcursesdir)/inch.c @SAVE2O@ inchstr.sho: $(pdcursesdir)/inchstr.c $(DYN_BUILD) $(pdcursesdir)/inchstr.c @SAVE2O@ initscr.sho: $(pdcursesdir)/initscr.c $(DYN_BUILD) $(pdcursesdir)/initscr.c @SAVE2O@ inopts.sho: $(pdcursesdir)/inopts.c $(DYN_BUILD) $(pdcursesdir)/inopts.c @SAVE2O@ insch.sho: $(pdcursesdir)/insch.c $(DYN_BUILD) $(pdcursesdir)/insch.c @SAVE2O@ insstr.sho: $(pdcursesdir)/insstr.c $(DYN_BUILD) $(pdcursesdir)/insstr.c @SAVE2O@ instr.sho: $(pdcursesdir)/instr.c $(DYN_BUILD) $(pdcursesdir)/instr.c @SAVE2O@ kernel.sho: $(pdcursesdir)/kernel.c $(DYN_BUILD) $(pdcursesdir)/kernel.c @SAVE2O@ keyname.sho: $(pdcursesdir)/keyname.c $(DYN_BUILD) $(pdcursesdir)/keyname.c @SAVE2O@ mouse.sho: $(pdcursesdir)/mouse.c $(DYN_BUILD) $(pdcursesdir)/mouse.c @SAVE2O@ move.sho: $(pdcursesdir)/move.c $(DYN_BUILD) $(pdcursesdir)/move.c @SAVE2O@ outopts.sho: $(pdcursesdir)/outopts.c $(DYN_BUILD) $(pdcursesdir)/outopts.c @SAVE2O@ overlay.sho: $(pdcursesdir)/overlay.c $(DYN_BUILD) $(pdcursesdir)/overlay.c @SAVE2O@ pad.sho: $(pdcursesdir)/pad.c $(DYN_BUILD) $(pdcursesdir)/pad.c @SAVE2O@ panel.sho: $(pdcursesdir)/panel.c $(basedir)/panel.h $(DYN_BUILD) $(pdcursesdir)/panel.c @SAVE2O@ printw.sho: $(pdcursesdir)/printw.c $(DYN_BUILD) $(pdcursesdir)/printw.c @SAVE2O@ refresh.sho: $(pdcursesdir)/refresh.c $(DYN_BUILD) $(pdcursesdir)/refresh.c @SAVE2O@ scanw.sho: $(pdcursesdir)/scanw.c $(DYN_BUILD) $(pdcursesdir)/scanw.c @SAVE2O@ scr_dump.sho: $(pdcursesdir)/scr_dump.c $(DYN_BUILD) $(pdcursesdir)/scr_dump.c @SAVE2O@ scroll.sho: $(pdcursesdir)/scroll.c $(DYN_BUILD) $(pdcursesdir)/scroll.c @SAVE2O@ slk.sho: $(pdcursesdir)/slk.c $(DYN_BUILD) $(pdcursesdir)/slk.c @SAVE2O@ termattr.sho: $(pdcursesdir)/termattr.c $(DYN_BUILD) $(pdcursesdir)/termattr.c @SAVE2O@ terminfo.sho: $(pdcursesdir)/terminfo.c $(DYN_BUILD) $(pdcursesdir)/terminfo.c @SAVE2O@ touch.sho: $(pdcursesdir)/touch.c $(DYN_BUILD) $(pdcursesdir)/touch.c @SAVE2O@ util.sho: $(pdcursesdir)/util.c $(DYN_BUILD) $(pdcursesdir)/util.c @SAVE2O@ window.sho: $(pdcursesdir)/window.c $(DYN_BUILD) $(pdcursesdir)/window.c @SAVE2O@ debug.sho: $(pdcursesdir)/debug.c $(DYN_BUILD) $(pdcursesdir)/debug.c @SAVE2O@ pdcclip.sho: $(x11dir)/pdcclip.c $(DYN_BUILD) $(x11dir)/pdcclip.c @SAVE2O@ pdcdisp.sho: $(x11dir)/pdcdisp.c $(DYN_BUILD) $(x11dir)/pdcdisp.c @SAVE2O@ pdcgetsc.sho: $(x11dir)/pdcgetsc.c $(DYN_BUILD) $(x11dir)/pdcgetsc.c @SAVE2O@ pdckbd.sho: $(x11dir)/pdckbd.c $(DYN_BUILD) $(x11dir)/pdckbd.c @SAVE2O@ pdcscrn.sho: $(x11dir)/pdcscrn.c $(DYN_BUILD) $(x11dir)/pdcscrn.c @SAVE2O@ pdcsetsc.sho: $(x11dir)/pdcsetsc.c $(DYN_BUILD) $(x11dir)/pdcsetsc.c @SAVE2O@ pdcutil.sho: $(x11dir)/pdcutil.c $(DYN_BUILD) $(x11dir)/pdcutil.c @SAVE2O@ pdcx11.sho: $(x11dir)/pdcx11.c $(DYN_BUILD) $(x11dir)/pdcx11.c @SAVE2O@ ScrollBox.sho: $(x11dir)/ScrollBox.c $(DYN_BUILD) $(x11dir)/ScrollBox.c @SAVE2O@ sb.sho: $(x11dir)/sb.c $(DYN_BUILD) $(x11dir)/sb.c @SAVE2O@ x11.sho: $(x11dir)/x11.c $(DYN_BUILD) $(x11dir)/x11.c @SAVE2O@ firework: firework.o $(LINK) firework.o -o $@ $(LDFLAGS) ozdemo: ozdemo.o $(LINK) ozdemo.o -o $@ $(LDFLAGS) newtest: newtest.o $(LINK) newtest.o -o $@ $(LDFLAGS) ptest: ptest.o $(LINK) ptest.o -o $@ $(LDFLAGS) rain: rain.o $(LINK) rain.o -o $@ $(LDFLAGS) testcurs: testcurs.o $(LINK) testcurs.o -o $@ $(LDFLAGS) tuidemo: tuidemo.o tui.o $(LINK) tui.o tuidemo.o -o $@ $(LDFLAGS) worm: worm.o $(LINK) worm.o -o $@ $(LDFLAGS) xmas: xmas.o $(LINK) xmas.o -o $@ $(LDFLAGS) firework.o: $(demodir)/firework.c $(BUILD) $(demodir)/firework.c ozdemo.o: $(demodir)/ozdemo.c $(BUILD) $(demodir)/ozdemo.c newtest.o: $(demodir)/newtest.c $(BUILD) $(demodir)/newtest.c ptest.o: $(demodir)/ptest.c $(basedir)/panel.h $(BUILD) $(demodir)/ptest.c rain.o: $(demodir)/rain.c $(BUILD) $(demodir)/rain.c testcurs.o: $(demodir)/testcurs.c $(BUILD) $(demodir)/testcurs.c tui.o: $(demodir)/tui.c $(demodir)/tui.h $(BUILD) $(demodir)/tui.c tuidemo.o: $(demodir)/tuidemo.c $(BUILD) $(demodir)/tuidemo.c worm.o: $(demodir)/worm.c $(BUILD) $(demodir)/worm.c xmas.o: $(demodir)/xmas.c $(BUILD) $(demodir)/xmas.c # This section provides for compiling and linking the # ncurses test programs. ncurses_testdir = $(HOME)/ncurses-5.6/test NCURSES_TESTS= bs gdc hanoi knight tclock ncurses ncurses_tests: $(NCURSES_TESTS) ncurses_clean: -rm -f *.o trace $(NCURSES_TESTS) NCFLAGS = -I. -I$(ncurses_testdir) bs: bs.o $(LIBCURSES) $(LINK) bs.o -o $@ $(LDFLAGS) gdc: gdc.o $(LIBCURSES) $(LINK) gdc.o -o $@ $(LDFLAGS) hanoi: hanoi.o $(LIBCURSES) $(LINK) hanoi.o -o $@ $(LDFLAGS) knight: knight.o $(LIBCURSES) $(LINK) knight.o -o $@ $(LDFLAGS) tclock: tclock.o $(LIBCURSES) $(LINK) tclock.o -o $@ $(LDFLAGS) -lm view: view.o $(LIBCURSES) $(LINK) view.o -o $@ $(LDFLAGS) ncurses: ncurses.o $(LIBCURSES) $(LINK) ncurses.o -o $@ $(LDFLAGS) bs.o: $(ncurses_testdir)/bs.c $(PDCURSES_CURSES_H) $(BUILD) $(NCFLAGS) $(ncurses_testdir)/bs.c gdc.o: $(ncurses_testdir)/gdc.c $(PDCURSES_CURSES_H) $(BUILD) $(NCFLAGS) $(ncurses_testdir)/gdc.c hanoi.o: $(ncurses_testdir)/hanoi.c $(PDCURSES_CURSES_H) $(BUILD) $(NCFLAGS) $(ncurses_testdir)/hanoi.c knight.o: $(ncurses_testdir)/knight.c $(PDCURSES_CURSES_H) $(BUILD) $(NCFLAGS) $(ncurses_testdir)/knight.c tclock.o: $(ncurses_testdir)/tclock.c $(PDCURSES_CURSES_H) $(BUILD) $(NCFLAGS) $(ncurses_testdir)/tclock.c view.o: $(ncurses_testdir)/view.c $(PDCURSES_CURSES_H) $(BUILD) $(NCFLAGS) $(ncurses_testdir)/view.c ncurses.o: $(ncurses_testdir)/ncurses.c $(PDCURSES_CURSES_H) $(BUILD) $(NCFLAGS) $(ncurses_testdir)/ncurses.c manual: cd doc; $(MAKE) $(MFLAGS) $@ $(ZIPFILE): (cd $(basedir); \ zip -9y $(ZIPFILE) README.md HISTORY.md IMPLEMNT *.spec *.mif *.def \ curses.h curspriv.h panel.h term.h pdcurses/README.md \ pdcurses/*.c \ demos/README.md demos/*.c demos/*.h \ dos/README.md dos/*.c dos/*.h dos/*.mak dos/*.lrf \ os2/README.md os2/*.c os2/*.h os2/*.mak os2/*.lrf \ sdl1/README.md sdl1/*.c sdl1/*.h sdl1/Make* \ win32/README.md win32/*.c win32/*.h win32/*.mak win32/*.ico win32/*.rc \ wingui/README.md wingui/*.c wingui/*.h wingui/*.mak wingui/*.ico wingui/*.rc \ x11/README.md x11/*.c x11/*.h x11/Makefile.* x11/*.xbm \ x11/Makefile.in x11/config.h.in x11/configure x11/configure.ac x11/config.guess \ x11/config.sub x11/xcurses-config.in x11/install-sh x11/aclocal.m4 \ doc/*.txt doc/manext.c doc/Makefile) zip: $(ZIPFILE) tar: (cd $(basedir)/..;rm -f $(PDC_DIR)) (cd $(basedir)/..;ln -sf $(abs_basedir) $(PDC_DIR)) (cd $(basedir)/..; `pwd`;ls -l $(PDC_DIR);tar cvf - \ $(PDC_DIR)/README.md $(PDC_DIR)/HISTORY.md \ $(PDC_DIR)/IMPLEMNT $(PDC_DIR)/*.spec $(PDC_DIR)/*.mif \ $(PDC_DIR)/*.def $(PDC_DIR)/x11/Makefile.in $(PDC_DIR)/x11/aclocal.m4 \ $(PDC_DIR)/x11/config.h.in $(PDC_DIR)/x11/configure \ $(PDC_DIR)/x11/config.guess $(PDC_DIR)/x11/xcurses-config.in \ $(PDC_DIR)/x11/config.sub $(PDC_DIR)/x11/configure.ac \ $(PDC_DIR)/x11/install-sh $(PDC_DIR)/curses.h $(PDC_DIR)/curspriv.h \ $(PDC_DIR)/panel.h $(PDC_DIR)/term.h \ $(PDC_DIR)/pdcurses/README.md $(PDC_DIR)/pdcurses/*.c \ $(PDC_DIR)/demos/README.md $(PDC_DIR)/demos/*.c $(PDC_DIR)/demos/*.h \ $(PDC_DIR)/doc/*.txt $(PDC_DIR)/dos/README.md $(PDC_DIR)/dos/*.c \ $(PDC_DIR)/doc/manext.c $(PDC_DIR)/doc/Makefile \ $(PDC_DIR)/dos/*.h $(PDC_DIR)/dos/*.mak $(PDC_DIR)/dos/*.lrf \ $(PDC_DIR)/os2/README.md $(PDC_DIR)/os2/*.c $(PDC_DIR)/os2/*.h $(PDC_DIR)/os2/*.mak $(PDC_DIR)/os2/*.lrf \ $(PDC_DIR)/sdl1/README.md $(PDC_DIR)/sdl1/*.c $(PDC_DIR)/sdl1/*.h $(PDC_DIR)/sdl1/Make* \ $(PDC_DIR)/win32/README.md $(PDC_DIR)/win32/*.c $(PDC_DIR)/win32/*.h $(PDC_DIR)/win32/*.mak $(PDC_DIR)/win32/*.ico $(PDC_DIR)/win32/*.rc \ $(PDC_DIR)/wingui/README.md $(PDC_DIR)/wingui/*.c $(PDC_DIR)/wingui/*.h $(PDC_DIR)/wingui/*.mak $(PDC_DIR)/wingui/*.ico $(PDC_DIR)/wingui/*.rc \ $(PDC_DIR)/x11/README.md $(PDC_DIR)/x11/*.c $(PDC_DIR)/x11/*.xbm $(PDC_DIR)/x11/*.h $(PDC_DIR)/x11/Makefile.* \ $(PDC_DIR)/x11/debian/rules $(PDC_DIR)/x11/debian/changelog $(PDC_DIR)/x11/debian/compat $(PDC_DIR)/x11/debian/control $(PDC_DIR)/x11/debian/copyright $(PDC_DIR)/x11/debian/rules \ | gzip -9 > $(TARBALL)) (cd $(basedir)/..;rm -f $(PDC_DIR)) dist: tar rpm: tar $(x11dir)/PDCurses.spec cp $(basedir)/../$(PDC_DIR).tar.gz $(RPMTOPDIR)/SOURCES -rm $(RPMTOPDIR)/RPMS/*/PDCurses-$(VERDOT)*.rpm -rm $(RPMTOPDIR)/RPMS/*/PDCurses-devel-$(VERDOT)*.rpm rpmbuild -ba --clean --define "myversion $(VERDOT)" $(x11dir)/PDCurses.spec mv $(RPMTOPDIR)/RPMS/*/PDCurses-$(VERDOT)-[0-9]*.rpm `dirname $(RPMTOPDIR)/RPMS/*/PDCurses-$(VERDOT)-[0-9]*.rpm`/`basename $(RPMTOPDIR)/RPMS/*/PDCurses-$(VERDOT)-[0-9]*.rpm .rpm`-$(MYDISTRO).rpm mv $(RPMTOPDIR)/RPMS/*/PDCurses-devel-$(VERDOT)-[0-9]*.rpm `dirname $(RPMTOPDIR)/RPMS/*/PDCurses-devel-$(VERDOT)-[0-9]*.rpm`/`basename $(RPMTOPDIR)/RPMS/*/PDCurses-devel-$(VERDOT)-[0-9]*.rpm .rpm`-$(MYDISTRO).rpm ls -l $(RPMTOPDIR)/RPMS/*/PDCurses*.rpm rpminstall: rpm -Uv $(RPMTOPDIR)/RPMS/*/PDCurses-$(VERDOT)-[0-9]*-$(MYDISTRO).rpm rpm -Uv $(RPMTOPDIR)/RPMS/*/PDCurses-devel-$(VERDOT)-[0-9]*-$(MYDISTRO).rpm deb: tar -rm -fr tmp -mkdir tmp (cd tmp; \ tar zxvf $(abs_basedir)/../$(PDC_DIR).tar.gz; \ cd $(PDC_DIR)/x11; \ dpkg-buildpackage -rfakeroot; \ cd ..; \ mv pdcurses_$(VERDOT)*.deb `basename pdcurses_$(VERDOT)*.deb .deb`-$(MYDISTRO).deb; \ ls -l ) debinstall: (cd tmp; \ dpkg -i pdcurses_$(VERDOT)*-$(MYDISTRO).deb; ) curses-1.4.4/vendor/PDCurses/x11/pdcutil.c0000644000004100000410000000146714201713275020274 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcx11.h" #if defined(HAVE_POLL) && !defined(HAVE_USLEEP) # include #endif void PDC_beep(void) { PDC_LOG(("PDC_beep() - called\n")); XCursesInstruct(CURSES_BELL); } void PDC_napms(int ms) { PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); #if defined(HAVE_USLEEP) usleep(1000 * ms); #elif defined(HAVE_POLL) { struct pollfd fd; fd.fd = -1; fd.events = 0; poll(&fd, 1, ms); } #endif } const char *PDC_sysname(void) { return "X11"; } PDC_version_info PDC_version = { PDC_PORT_WINGUI, PDC_VER_MAJOR, PDC_VER_MINOR, PDC_VER_CHANGE, sizeof( chtype), #ifdef PDC_WIDE TRUE, #else FALSE, #endif #ifdef PDC_FORCE_UTF8 TRUE, #else FALSE, #endif }; curses-1.4.4/vendor/PDCurses/x11/config.h.in0000644000004100000410000000513214201713275020500 0ustar www-datawww-data/* config.h.in. Generated from configure.ac by autoheader. */ /* Define if you have the header file */ #undef HAVE_DECKEYSYM_H /* Define to 1 if you have the `poll' function. */ #undef HAVE_POLL /* Define if you have the header file */ #undef HAVE_SUNKEYSYM_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `usleep' function. */ #undef HAVE_USLEEP /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF /* Define to 1 if you have the `vsscanf' function. */ #undef HAVE_VSSCANF /* Define if you have this defined in */ #undef HAVE_XK_KP_BEGIN /* Define if you have this defined in */ #undef HAVE_XK_KP_DELETE /* Define if you have this defined in */ #undef HAVE_XK_KP_DOWN /* Define if you have this defined in */ #undef HAVE_XK_KP_END /* Define if you have this defined in */ #undef HAVE_XK_KP_HOME /* Define if you have this defined in */ #undef HAVE_XK_KP_INSERT /* Define if you have this defined in */ #undef HAVE_XK_KP_LEFT /* Define if you have this defined in */ #undef HAVE_XK_KP_NEXT /* Define if you have this defined in */ #undef HAVE_XK_KP_PRIOR /* Define if you have this defined in */ #undef HAVE_XK_KP_RIGHT /* Define if you have this defined in */ #undef HAVE_XK_KP_UP /* Define if you have the header file */ #undef HAVE_XPM_H /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define as the system defined limit for number of signals */ #undef PDC_MAX_SIGNALS /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define if you want to use neXtaw library */ #undef USE_NEXTAW /* Define if you want to use Xaw3d library */ #undef USE_XAW3D /* Define XPointer is typedefed in X11/Xlib.h */ #undef XPOINTER_TYPEDEFED curses-1.4.4/vendor/PDCurses/x11/PDCurses.spec0000644000004100000410000000346714201713275021032 0ustar www-datawww-data# $Id: PDCurses.spec,v 1.6 2013/07/23 01:35:31 mark Exp $ %define debug_package %{nil} %define base /usr Summary: Public Domain Curses for X11 Name: PDCurses Version: %{myversion} Release: 1 License: Public Domain Group: Development/Libraries Source: %{name}-%{version}.tar.gz URL: http://pdcurses.org BuildRoot: %{_tmppath}/%{name}-%{version}-root Prefix: %base BuildRequires: libXaw-devel %package devel Summary: Public Domain Curses for X11 Development Files Group: Development/Libraries Requires: %{name}%{?_isa} = %{version}-%{release} %description PDCurses for X11 is an implementation of the curses library that lets you build text-mode curses programs as native X11 applications. This package contains the runtime library. For more information, visit http://pdcurses.org %description devel PDCurses for X11 is an implementation of the curses library that lets you build text-mode curses programs as native X11 applications. This package contains the development files. For more information, visit http://pdcurses.org %prep %setup -q %build cd x11 ./configure --prefix=%{base} --libdir=%{_libdir} --enable-libdir-change=no make %install cd x11 make DESTDIR=$RPM_BUILD_ROOT install %clean rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_DIR/%{name}-%{version} %files %defattr(-,root,root) %{_libdir}/libXCurses.so.%{version} %{_libdir}/libXpanel.so.%{version} %files devel %defattr(-,root,root) %{_bindir}/xcurses-config %{_libdir}/libXCurses.a %{_libdir}/libXpanel.a %{_libdir}/libXCurses.so %{_libdir}/libXCurses.so.3 %{_libdir}/libXpanel.so %{_libdir}/libXpanel.so.3 %{_includedir}/xcurses.h %{_includedir}/xpanel.h %{_includedir}/xcurses/curses.h %{_includedir}/xcurses/panel.h %{_includedir}/xcurses/term.h %post ldconfig %{_libdir} %postun ldconfig %{_libdir} %post devel ldconfig %{_libdir} %postun devel ldconfig %{_libdir} curses-1.4.4/vendor/PDCurses/x11/ScrollBox.h0000644000004100000410000000423614201713275020541 0ustar www-datawww-data/* * Copyright 1989 O'Reilly and Associates, Inc. The X Consortium, and any party obtaining a copy of these files from the X Consortium, directly or indirectly, is granted, free of charge, a full and unrestricted irrevocable, world-wide, paid up, royalty-free, nonexclusive right and license to deal in this software and documentation files (the "Software"), including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons who receive copies from any such party to do so. This license includes without limitation a license to do the foregoing actions under any patents of the party supplying this software to the X Consortium. */ #ifndef _XORAscrollBox_h #define _XORAscrollBox_h /************************************************************************ * * * scrollBox Widget (subclass of CompositeClass) * * * ************************************************************************/ /* Parameters: Name Class RepType Default Value ---- ----- ------- ------------- background Background Pixel XtDefaultBackground border BorderColor Pixel XtDefaultForeground borderWidth BorderWidth Dimension 1 destroyCallback Callback Pointer NULL hSpace HSpace Dimension 4 height Height Dimension 0 mappedWhenManaged MappedWhenManaged Boolean True vSpace VSpace Dimension 4 width Width Dimension 0 x Position Position 0 y Position Position 0 */ /* Class record constants */ extern WidgetClass scrollBoxWidgetClass; typedef struct _ScrollBoxClassRec *ScrollBoxWidgetClass; typedef struct _ScrollBoxRec *ScrollBoxWidget; #endif /* _XORAscrollBox_h */ curses-1.4.4/vendor/PDCurses/x11/pdcscrn.c0000644000004100000410000001463114201713275020261 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcx11.h" /* special purpose function keys */ static int PDC_shutdown_key[PDC_MAX_FUNCTION_KEYS] = { 0, 0, 0, 0, 0 }; /* COLOR_PAIR to attribute encoding table. */ short *xc_atrtab = (short *)NULL; /* close the physical screen */ void PDC_scr_close(void) { PDC_LOG(("PDC_scr_close() - called\n")); } void PDC_scr_free(void) { XCursesExit(); xc_atrtab = (short *)NULL; } /* open the physical screen -- allocate SP, miscellaneous intialization */ int PDC_scr_open(int argc, char **argv) { extern bool sb_started; PDC_LOG(("PDC_scr_open() - called\n")); if ((XCursesInitscr(argc, argv) == ERR) || !SP) return ERR; SP->cursrow = SP->curscol = 0; SP->orig_attr = FALSE; SP->sb_on = sb_started; SP->sb_total_y = 0; SP->sb_viewport_y = 0; SP->sb_cur_y = 0; SP->sb_total_x = 0; SP->sb_viewport_x = 0; SP->sb_cur_x = 0; return OK; } /* the core of resize_term() */ int PDC_resize_screen(int nlines, int ncols) { PDC_LOG(("PDC_resize_screen() - called. Lines: %d Cols: %d\n", nlines, ncols)); if( !stdscr) /* window hasn't been created yet; we're */ { /* specifying its size before doing so */ XCursesLINES = nlines; XCursesCOLS = ncols; return OK; } if (nlines || ncols || !SP->resized) return ERR; shmdt((char *)Xcurscr); XCursesInstructAndWait(CURSES_RESIZE); if ((shmid_Xcurscr = shmget(shmkey_Xcurscr, SP->XcurscrSize + XCURSESSHMMIN, 0700)) < 0) { perror("Cannot allocate shared memory for curscr"); kill(xc_otherpid, SIGKILL); return ERR; } XCursesLINES = SP->lines; XCursesCOLS = SP->cols; PDC_LOG(("%s:shmid_Xcurscr %d shmkey_Xcurscr %d SP->lines %d " "SP->cols %d\n", XCLOGMSG, shmid_Xcurscr, shmkey_Xcurscr, SP->lines, SP->cols)); Xcurscr = (unsigned char*)shmat(shmid_Xcurscr, 0, 0); xc_atrtab = (short *)(Xcurscr + XCURSCR_ATRTAB_OFF); SP->resized = FALSE; return OK; } void PDC_reset_prog_mode(void) { PDC_LOG(("PDC_reset_prog_mode() - called.\n")); } void PDC_reset_shell_mode(void) { PDC_LOG(("PDC_reset_shell_mode() - called.\n")); } void PDC_restore_screen_mode(int i) { } void PDC_save_screen_mode(int i) { } void PDC_init_pair(short pair, short fg, short bg) { xc_atrtab[pair * 2] = fg; xc_atrtab[pair * 2 + 1] = bg; } int PDC_pair_content(short pair, short *fg, short *bg) { *fg = xc_atrtab[pair * 2]; *bg = xc_atrtab[pair * 2 + 1]; return OK; } bool PDC_can_change_color(void) { return TRUE; } int PDC_color_content(short color, short *red, short *green, short *blue) { XColor *tmp = (XColor *)(Xcurscr + XCURSCR_XCOLOR_OFF); tmp->pixel = color; XCursesInstructAndWait(CURSES_GET_COLOR); *red = ((double)(tmp->red) * 1000 / 65535) + 0.5; *green = ((double)(tmp->green) * 1000 / 65535) + 0.5; *blue = ((double)(tmp->blue) * 1000 / 65535) + 0.5; return OK; } int PDC_init_color(short color, short red, short green, short blue) { XColor *tmp = (XColor *)(Xcurscr + XCURSCR_XCOLOR_OFF); tmp->pixel = color; tmp->red = ((double)red * 65535 / 1000) + 0.5; tmp->green = ((double)green * 65535 / 1000) + 0.5; tmp->blue = ((double)blue * 65535 / 1000) + 0.5; XCursesInstructAndWait(CURSES_SET_COLOR); return OK; } /*man-start************************************************************** Function keys ------------- ### Synopsis int PDC_set_function_key( const unsigned function, const int new_key); ### Description Allows one to set a 'shut down' key, and reassign hotkeys used for pasting from the clipboard and enlarging and decreasing the font size, and for using the font selection dialog (on platforms where these things are possible and implemented). For example, calling PDC_set_function_key( FUNCTION_KEY_SHUT_DOWN, ALT_Q); would reset PDCurses such that, if the user clicks on the 'close' box, Alt-Q would be added to the key queue. This would give the app the opportunity to shut things down gracefully, perhaps asking "are you sure", and/or "save changes or discard or cancel", rather than just having the window close (the default behavior). Similarly, one can set FUNCTION_KEY_ABORT to a key which, when pressed, will cause the program to abort gracelessly (no key returned to the application). One would normally use this to enable/disable Ctrl-C or Ctrl-Break. ### Return Value Returns key code previously set for that function, or -1 if the function does not actually exist. ### Portability PDCurses-only function. **man-end****************************************************************/ int PDC_set_function_key( const unsigned function, const int new_key) { int old_key = -1; if (function < PDC_MAX_FUNCTION_KEYS) { old_key = PDC_shutdown_key[function]; PDC_shutdown_key[function] = new_key; } if (function == FUNCTION_KEY_SHUT_DOWN) { SP->exit_key = new_key; } return(old_key); } /*man-start************************************************************** Resize limits ------------- ### Synopsis void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines, const int new_min_cols, const int new_max_cols); ### Description For platforms supporting resizable windows (SDLx, WinGUI, X11). Some programs may be unprepared for a resize event; for these, calling this function with the max and min limits equal ensures that no user resizing can be done. Other programs may require at least a certain number, and/or no more than a certain number, of columns and/or lines. ### Portability PDCurses-only function. **man-end****************************************************************/ /* Note that at least at present, only WinGUI pays any attention to resize limits. */ int PDC_min_lines = 25, PDC_min_cols = 80; int PDC_max_lines = 25, PDC_max_cols = 80; void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines, const int new_min_cols, const int new_max_cols) { PDC_min_lines = max( new_min_lines, 2); PDC_max_lines = max( new_max_lines, PDC_min_lines); PDC_min_cols = max( new_min_cols, 2); PDC_max_cols = max( new_max_cols, PDC_min_cols); } curses-1.4.4/vendor/PDCurses/x11/ncurses_cfg.h0000644000004100000410000000206614201713275021132 0ustar www-datawww-data/* This file is only used with the ncurses test programs. * * Have ncurses-5.6 unpacked in your $(HOME) (you don't need to build * it), or edit ncurses_testdir appropriately in the Makefile. Configure * and build PDCurses for X11. (Sorry, other ports won't work yet.) * Change to this directory, and: * * "make ncurses_tests" to start. * "make ncurses_clean" when you're done. * * Builds: bs gdc hanoi knight tclock ncurses */ #define NCURSES_MOUSE_VERSION 2 #include "../config.h" #include #define ExitProgram exit #define HAVE_CURSES_VERSION 1 #define HAVE_GETBEGX 1 #define HAVE_GETCURX 1 #define HAVE_GETMAXX 1 #define HAVE_GETNSTR 1 #define HAVE_GETTIMEOFDAY 1 #define HAVE_GETWIN 1 #define HAVE_LIBPANEL 1 #define HAVE_LOCALE_H 1 #define HAVE_NAPMS 1 #define HAVE_PANEL_H 1 #define HAVE_PUTWIN 1 #define HAVE_SLK_COLOR 1 #define HAVE_SLK_INIT 1 #define HAVE_WRESIZE 1 #ifdef PDC_WIDE # define USE_WIDEC_SUPPORT 1 #endif /* Fool ncurses.c so it gives us all the tests, and doesn't redefine ACS_ chars */ #define NCURSES_VERSION PDCURSES curses-1.4.4/vendor/PDCurses/x11/xcurses-config.in0000644000004100000410000000343214201713275021745 0ustar www-datawww-data#! /bin/sh # # The idea to this kind of setup info script was stolen from numerous # other packages, such as neon, libxml and gnome. # verdot=3.4 prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/xcurses usage() { echo "Usage: xcurses-config [OPTION]" echo "" echo "Available values for OPTION include:" echo "" echo " --help display this help and exit" echo " --cflags pre-processor and compiler flags" echo " [-I$includedir @PDC_WIDE@]" echo " --libs library linking information" echo " [-L$libdir -lXCurses @LDFLAGS@ @MH_XLIBS@ @MH_EXTRA_LIBS@" echo " --libs-static static library linking information (libXCurses only)" echo " [$libdir/libXCurses.a @LDFLAGS@ @MH_XLIBS@ @MH_EXTRA_LIBS@" echo " --prefix PDCurses install prefix" echo " [$prefix]" echo " --version output version information" echo " [$verdot]" exit $1 } if test $# -eq 0; then usage 1 fi while test $# -gt 0; do case "$1" in # this deals with options in the style # --option=value and extracts the value part # [not currently used] -*=*) value=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) value= ;; esac case "$1" in --prefix) echo $prefix ;; --version) echo $verdot exit 0 ;; --help) usage 0 ;; --cflags) echo -I$includedir @PDC_WIDE@ ;; --libs) echo -L$libdir -lXCurses @LDFLAGS@ @MH_XLIBS@ @MH_EXTRA_LIBS@ ;; --libs-static) echo $libdir/libXCurses.a @LDFLAGS@ @MH_XLIBS@ @MH_EXTRA_LIBS@ ;; *) usage exit 1 ;; esac shift done exit 0 curses-1.4.4/vendor/PDCurses/ncurses/0000755000004100000410000000000014201713275017525 5ustar www-datawww-datacurses-1.4.4/vendor/PDCurses/ncurses/README.md0000644000004100000410000000110514201713275021001 0ustar www-datawww-datancurses build of PDCurses demos =============================== This directory contains a makefile to compile the PDCurses demos against the ncurses library. This allows us to check for differences between ncurses and PDCurses. Building -------- - Thus far, only GCC on Linux has been tested. Build with either make -f makefile make -f makefile WIDE=Y Several demos will be compiled. Distribution Status ------------------- The files in this directory are released to the Public Domain. Acknowledgments --------------- makefile provided by Bill Gray. curses-1.4.4/vendor/PDCurses/ncurses/makefile0000644000004100000410000000116414201713275021227 0ustar www-datawww-data# GNU MAKE Makefile for PDCurses demos with ncurses # # Usage: make [tgt] [WIDE=Y] # # where tgt can be any of: # [all|demos|testcurs]... ifeq ($(WIDE),Y) CFLAGS = -Wall -O3 -D_XOPEN_SOURCE_EXTENDED -DHAVE_NCURSESW LIBCURSES = -lncursesw else CFLAGS = -Wall -O3 -D_XOPEN_SOURCE_EXTENDED LIBCURSES = -lncurses endif demodir = ../demos DEMOS = firework ozdemo newtest rain testcurs worm xmas all: $(DEMOS) tuidemo $(DEMOS) : %: $(demodir)/%.c $(CC) $(CFLAGS) -o$@ $< $(LIBCURSES) tuidemo : $(demodir)/tuidemo.c $(demodir)/tui.c $(CC) $(CFLAGS) -o$@ $(demodir)/tui.c $< $(LIBCURSES) clean: rm -f $(DEMOS) tuidemo curses-1.4.4/vendor/PDCurses/ncurses/CMakeLists.txt0000644000004100000410000000455014201713275022271 0ustar www-datawww-datacmake_minimum_required(VERSION 3.11) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING "Choose the type of build, options are: Debug, Release, or MinSizeRel." FORCE) message(STATUS "CMAKE_BUILD_TYPE not set, defaulting to MinSizeRel.") endif() if(APPLE) # look for brew version first set(CMAKE_LIBRARY_PATH /usr/local/opt/ncurses/lib) endif() set(CURSES_NEED_WIDE PDC_WIDE) include(FindCurses) if(CURSES_FOUND) # this project is dependent on libncurses5-dev, and libncursesw5-dev. # Apple builds without ncursesw PROJECT(ncurses VERSION "${PROJECT_VERSION}" LANGUAGES C) message(STATUS "**** ${PROJECT_NAME} ****") if(APPLE) if ("/usr/lib/libcurses.dylib" IN_LIST CURSES_LIBRARIES) #MESSAGE(WARNING "Building with old ncurses lib -> Manually defining A_ITALIC to 64-bit...") MESSAGE(WARNING " Use `brew install ncurses` to resolve this warning") add_definitions("-DA_ITALIC=((chtype)0x008 << 21)") #default to 64 bit for now... endif() MESSAGE(STATUS "Linking with ${CURSES_LIBRARIES}") endif() set(PDCURSES_DIST ${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}) macro (unix_app dir targ) set(bin_name "${PROJECT_NAME}_${targ}") if(${targ} STREQUAL "tuidemo") set(src_files ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/tuidemo.c ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/tui.c) else() set(src_files ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/${targ}.c) endif() add_executable(${bin_name} ${src_files}) target_compile_options(${bin_name} PUBLIC -Wall) target_compile_definitions(${bin_name} PUBLIC -D_XOPEN_SOURCE_EXTENDED) if(PDC_WIDE) target_compile_definitions(${bin_name} PUBLIC -DHAVE_NCURSESW) endif() target_include_directories(${bin_name} PUBLIC ${CURSES_INCLUDE_DIR}) target_link_libraries(${bin_name} ${CURSES_LIBRARIES}) set_target_properties(${bin_name} PROPERTIES OUTPUT_NAME ${targ}) install(TARGETS ${bin_name} RUNTIME DESTINATION ${PDCURSES_DIST}/bin/${PROJECT_NAME} COMPONENT applications) endmacro () unix_app(../demos firework) unix_app(../demos ozdemo) unix_app(../demos newtest) unix_app(../demos rain) unix_app(../demos testcurs) unix_app(../demos worm) unix_app(../demos xmas) endif()curses-1.4.4/vendor/PDCurses/sdl2/0000755000004100000410000000000014201713275016707 5ustar www-datawww-datacurses-1.4.4/vendor/PDCurses/sdl2/Makefile0000644000004100000410000000574214201713275020357 0ustar www-datawww-data# Makefile for PDCurses library for SDL # # Usage: [g]make [DEBUG=Y] [WIDE=Y] [UTF8=Y] [target] # # where target can be any of: # [all|demos|libpdcurses.a|testcurs]... O = o ifeq ($(NOPIC),Y) PIC = else PIC = -fPIC endif ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. endif include $(PDCURSES_SRCDIR)/libobjs.mif osdir = $(PDCURSES_SRCDIR)/sdl2 PDCURSES_SDL_H = $(osdir)/pdcsdl.h SFLAGS = $(shell pkg-config --cflags sdl2) SLIBS = $(shell pkg-config --libs sdl2) # If your system doesn't have these, remove the defines here SFLAGS += -DHAVE_VSNPRINTF -DHAVE_VSSCANF ifeq ($(DEBUG),Y) CFLAGS = -g -Wall -DPDCDEBUG $(PIC) else CFLAGS += -O2 -Wall $(PIC) endif ifeq ($(WIDE),Y) CFLAGS += -DPDC_WIDE $(shell pkg-config --cflags SDL2_ttf) SLIBS += $(shell pkg-config --libs SDL2_ttf) endif ifeq ($(UTF8),Y) CFLAGS += -DPDC_FORCE_UTF8 endif ifdef CHTYPE_32 CFLAGS += -DCHTYPE_32 endif ifdef CHTYPE_16 CFLAGS += -DCHTYPE_16 endif BUILD = $(CC) $(CFLAGS) -I$(PDCURSES_SRCDIR) ifeq ($(shell uname),Darwin) DEMOFLAGS = -Dmain=SDL_main endif LINK = $(CC) LDFLAGS = $(LIBCURSES) $(SLIBS) RANLIB = ranlib LIBCURSES = libpdcurses.a DEMOS = firework$(EXE_EXTENSION) ozdemo$(EXE_EXTENSION) newtest$(EXE_EXTENSION) ptest$(EXE_EXTENSION) rain$(EXE_EXTENSION) testcurs$(EXE_EXTENSION) tuidemo$(EXE_EXTENSION) worm$(EXE_EXTENSION) xmas$(EXE_EXTENSION) \ sdltest$(EXE_EXTENSION) .PHONY: all libs clean demos install all: libs demos libs: $(LIBCURSES) clean: -rm -rf *.o trace $(LIBCURSES) $(DEMOS) demos: $(DEMOS) ifneq ($(DEBUG),Y) strip $(DEMOS) endif $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) ar rv $@ $? -$(RANLIB) $@ $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_SDL_H) $(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) tui.o tuidemo.o : $(PDCURSES_CURSES_H) terminfo.o: $(TERM_HEADER) panel.o ptest$(EXE_EXTENSION): $(PANEL_HEADER) $(LIBOBJS) : %.o: $(srcdir)/%.c $(BUILD) $(SFLAGS) -c $< $(PDCOBJS) : %.o: $(osdir)/%.c $(BUILD) $(SFLAGS) -c $< firework$(EXE_EXTENSION): $(demodir)/firework.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) ozdemo$(EXE_EXTENSION): $(demodir)/ozdemo.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) newtest$(EXE_EXTENSION): $(demodir)/newtest.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) ptest$(EXE_EXTENSION): $(demodir)/ptest.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) rain$(EXE_EXTENSION): $(demodir)/rain.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) testcurs$(EXE_EXTENSION): $(demodir)/testcurs.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) tuidemo$(EXE_EXTENSION): tuidemo.o tui.o $(LINK) tui.o tuidemo.o -o $@ $(LDFLAGS) worm$(EXE_EXTENSION): $(demodir)/worm.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) xmas$(EXE_EXTENSION): $(demodir)/xmas.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) sdltest$(EXE_EXTENSION): $(osdir)/sdltest.c $(BUILD) $(SFLAGS) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) tui.o: $(demodir)/tui.c $(demodir)/tui.h $(BUILD) -c $(DEMOFLAGS) $(demodir)/tui.c tuidemo.o: $(demodir)/tuidemo.c $(BUILD) -c $(DEMOFLAGS) $(demodir)/tuidemo.c curses-1.4.4/vendor/PDCurses/sdl2/README.md0000644000004100000410000000163314201713275020171 0ustar www-datawww-dataPDCurses for SDL2 ================= This is a port of PDCurses for SDL2. Building -------- - Choose the appropriate makefile for your compiler: Makefile - General Makefile, tested with GCC Makefile.vc - Microsoft Visual C++ 2.0+ or later & Intel(R) compiler - On *nix (including Linux and Mac OS X), run `make` in the sdl2 directory. It builds the library libpdcurses.a (dynamic lib not implemented). The makefile accepts the optional parameters `DEBUG=Y`, `WIDE=Y` and `UTF8=Y`. It also recognizes the optional `PDCURSES_SRCDIR` environment variable. Distribution Status ------------------- The files in this directory are released to the Public Domain. Acknowledgements ---------------- The original SDL port was provided by William McBrine. The initial SDL2 support patch was created by Laura Michaels. The SDL2 port was put together and further developed by Robin Gustafsson. curses-1.4.4/vendor/PDCurses/sdl2/pdckbd.c0000644000004100000410000003472514201713275020315 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcsdl.h" #include #include /*man-start************************************************************** pdckbd ------ ### Synopsis unsigned long PDC_get_input_fd(void); ### Description PDC_get_input_fd() returns the file descriptor that PDCurses reads its input from. It can be used for select(). ### Portability X/Open BSD SYS V PDC_get_input_fd - - - **man-end****************************************************************/ #include unsigned long pdc_key_modifiers = 0L; static SDL_Event event; static SDL_Keycode oldkey; static MOUSE_STATUS old_mouse_status; static struct { SDL_Keycode keycode; bool numkeypad; unsigned short normal; unsigned short shifted; unsigned short control; unsigned short alt; } key_table[] = { /* keycode keypad normal shifted control alt*/ {SDLK_LEFT, FALSE, KEY_LEFT, KEY_SLEFT, CTL_LEFT, ALT_LEFT}, {SDLK_RIGHT, FALSE, KEY_RIGHT, KEY_SRIGHT, CTL_RIGHT, ALT_RIGHT}, {SDLK_UP, FALSE, KEY_UP, KEY_SUP, CTL_UP, ALT_UP}, {SDLK_DOWN, FALSE, KEY_DOWN, KEY_SDOWN, CTL_DOWN, ALT_DOWN}, {SDLK_HOME, FALSE, KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME}, {SDLK_END, FALSE, KEY_END, KEY_SEND, CTL_END, ALT_END}, {SDLK_PAGEUP, FALSE, KEY_PPAGE, KEY_SPREVIOUS, CTL_PGUP, ALT_PGUP}, {SDLK_PAGEDOWN, FALSE, KEY_NPAGE, KEY_SNEXT, CTL_PGDN, ALT_PGDN}, {SDLK_INSERT, FALSE, KEY_IC, KEY_SIC, CTL_INS, ALT_INS}, {SDLK_DELETE, FALSE, KEY_DC, KEY_SDC, CTL_DEL, ALT_DEL}, {SDLK_F1, FALSE, KEY_F(1), KEY_F(13), KEY_F(25), KEY_F(37)}, {SDLK_F2, FALSE, KEY_F(2), KEY_F(14), KEY_F(26), KEY_F(38)}, {SDLK_F3, FALSE, KEY_F(3), KEY_F(15), KEY_F(27), KEY_F(39)}, {SDLK_F4, FALSE, KEY_F(4), KEY_F(16), KEY_F(28), KEY_F(40)}, {SDLK_F5, FALSE, KEY_F(5), KEY_F(17), KEY_F(29), KEY_F(41)}, {SDLK_F6, FALSE, KEY_F(6), KEY_F(18), KEY_F(30), KEY_F(42)}, {SDLK_F7, FALSE, KEY_F(7), KEY_F(19), KEY_F(31), KEY_F(43)}, {SDLK_F8, FALSE, KEY_F(8), KEY_F(20), KEY_F(32), KEY_F(44)}, {SDLK_F9, FALSE, KEY_F(9), KEY_F(21), KEY_F(33), KEY_F(45)}, {SDLK_F10, FALSE, KEY_F(10), KEY_F(22), KEY_F(34), KEY_F(46)}, {SDLK_F11, FALSE, KEY_F(11), KEY_F(23), KEY_F(35), KEY_F(47)}, {SDLK_F12, FALSE, KEY_F(12), KEY_F(24), KEY_F(36), KEY_F(48)}, {SDLK_F13, FALSE, KEY_F(13), KEY_F(25), KEY_F(37), KEY_F(49)}, {SDLK_F14, FALSE, KEY_F(14), KEY_F(26), KEY_F(38), KEY_F(50)}, {SDLK_F15, FALSE, KEY_F(15), KEY_F(27), KEY_F(39), KEY_F(51)}, {SDLK_BACKSPACE, FALSE, 0x08, 0x08, CTL_BKSP, ALT_BKSP}, {SDLK_TAB, FALSE, 0x09, KEY_BTAB, CTL_TAB, ALT_TAB}, {SDLK_PRINTSCREEN, FALSE, KEY_PRINT, KEY_SPRINT, KEY_PRINT, KEY_PRINT}, {SDLK_PAUSE, FALSE, KEY_SUSPEND, KEY_SSUSPEND, KEY_SUSPEND, KEY_SUSPEND}, {SDLK_CLEAR, FALSE, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR}, {SDLK_PAUSE, FALSE, KEY_BREAK, KEY_BREAK, KEY_BREAK, KEY_BREAK}, {SDLK_HELP, FALSE, KEY_HELP, KEY_SHELP, KEY_LHELP, KEY_HELP}, {SDLK_MENU, FALSE, KEY_OPTIONS, KEY_SOPTIONS, KEY_OPTIONS, KEY_OPTIONS}, {SDLK_ESCAPE, FALSE, 0x1B, 0x1B, 0x1B, ALT_ESC}, {SDLK_KP_ENTER, TRUE, PADENTER, PADENTER, CTL_PADENTER, ALT_PADENTER}, {SDLK_KP_PLUS, TRUE, PADPLUS, '+', CTL_PADPLUS, ALT_PADPLUS}, {SDLK_KP_MINUS, TRUE, PADMINUS, '-', CTL_PADMINUS, ALT_PADMINUS}, {SDLK_KP_MULTIPLY, TRUE, PADSTAR, '*', CTL_PADSTAR, ALT_PADSTAR}, {SDLK_KP_DIVIDE, TRUE, PADSLASH, '/', CTL_PADSLASH, ALT_PADSLASH}, {SDLK_KP_PERIOD, TRUE, PADSTOP, '.', CTL_PADSTOP, ALT_PADSTOP}, {SDLK_KP_0, TRUE, PAD0, '0', CTL_PAD0, ALT_PAD0}, {SDLK_KP_1, TRUE, KEY_C1, '1', CTL_PAD1, ALT_PAD1}, {SDLK_KP_2, TRUE, KEY_C2, '2', CTL_PAD2, ALT_PAD2}, {SDLK_KP_3, TRUE, KEY_C3, '3', CTL_PAD3, ALT_PAD3}, {SDLK_KP_4, TRUE, KEY_B1, '4', CTL_PAD4, ALT_PAD4}, {SDLK_KP_5, TRUE, KEY_B2, '5', CTL_PAD5, ALT_PAD5}, {SDLK_KP_6, TRUE, KEY_B3, '6', CTL_PAD6, ALT_PAD6}, {SDLK_KP_7, TRUE, KEY_A1, '7', CTL_PAD7, ALT_PAD7}, {SDLK_KP_8, TRUE, KEY_A2, '8', CTL_PAD8, ALT_PAD8}, {SDLK_KP_9, TRUE, KEY_A3, '9', CTL_PAD9, ALT_PAD9}, {0, 0, 0, 0, 0, 0} }; unsigned long PDC_get_input_fd(void) { PDC_LOG(("PDC_get_input_fd() - called\n")); return 0L; /* test this */ } void PDC_set_keyboard_binary(bool on) { PDC_LOG(("PDC_set_keyboard_binary() - called\n")); } /* check if a key or mouse event is waiting */ bool PDC_check_key(void) { Uint32 current = SDL_GetTicks(); int haveevent = SDL_PollEvent(&event); /* if we have an event, or 30 ms have passed without a screen update, or the timer has wrapped, update now */ if (haveevent || current < pdc_lastupdate || ((current - pdc_lastupdate) > 30)) PDC_update_rects(); return haveevent; } #ifdef PDC_WIDE static int _utf8_to_unicode(char *chstr) { int i, bytes, unicode; unsigned char byte = chstr[0]; if (byte > 0xf0) { bytes = 4; unicode = byte & 0x7; } else if (byte > 0xe0) { bytes = 3; unicode = byte & 0xf; } else if (byte > 0xc0) { bytes = 2; unicode = byte & 0x1f; } else if (byte > 0x80) { /* starts with a continuation byte; invalid character */ return -1; } else { bytes = 1; unicode = byte; } for (i = 1; i < bytes; i++) unicode = (unicode << 6) + (chstr[i] & 0x3f); return unicode; } #endif static int _process_key_event(void) { int i, key = 0; unsigned long old_modifiers = pdc_key_modifiers; static int repeat_count; pdc_key_modifiers = 0L; SP->key_code = FALSE; if( event.key.repeat && event.type == SDL_KEYDOWN) repeat_count++; else repeat_count = 0; if (event.type == SDL_KEYUP) { if (SP->return_key_modifiers && event.key.keysym.sym == oldkey) { switch (oldkey) { case SDLK_RSHIFT: return KEY_SHIFT_R; case SDLK_LSHIFT: return KEY_SHIFT_L; case SDLK_RCTRL: return KEY_CONTROL_R; case SDLK_LCTRL: return KEY_CONTROL_L; case SDLK_RALT: return KEY_ALT_R; case SDLK_LALT: return KEY_ALT_L; default: break; } } return -1; } else if (event.type == SDL_TEXTINPUT) { pdc_key_modifiers = old_modifiers; #ifdef PDC_WIDE return _utf8_to_unicode(event.text.text); #else key = (unsigned char)event.text.text[0]; return key > 0x7f ? -1 : key; #endif } oldkey = event.key.keysym.sym; if (SP->save_key_modifiers) { if (event.key.keysym.mod & KMOD_NUM) pdc_key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; if (event.key.keysym.mod & KMOD_SHIFT) pdc_key_modifiers |= PDC_KEY_MODIFIER_SHIFT; if (event.key.keysym.mod & KMOD_CTRL) pdc_key_modifiers |= PDC_KEY_MODIFIER_CONTROL; if (event.key.keysym.mod & KMOD_ALT) pdc_key_modifiers |= PDC_KEY_MODIFIER_ALT; if( repeat_count) pdc_key_modifiers |= PDC_KEY_MODIFIER_REPEAT; } for (i = 0; key_table[i].keycode; i++) { if (key_table[i].keycode == event.key.keysym.sym) { if ((event.key.keysym.mod & KMOD_SHIFT) || (key_table[i].numkeypad && (event.key.keysym.mod & KMOD_NUM))) { key = key_table[i].shifted; } else if (event.key.keysym.mod & KMOD_CTRL) { key = key_table[i].control; } else if (event.key.keysym.mod & KMOD_ALT) { key = key_table[i].alt; } else { /* To get here, we ignore all other modifiers */ key = key_table[i].normal; } SP->key_code = (key > 0x100); break; } } if (!key) { key = (int) event.key.keysym.sym; if (key >= 'a' && key <= 'z') if (event.key.keysym.mod & KMOD_SHIFT) key = toupper(key); if (key > 0x7f) key = 0; } /* Handle ALT letters and numbers */ if (event.key.keysym.mod & KMOD_ALT) { if (key >= 'A' && key <= 'Z') { key += ALT_A - 'A'; SP->key_code = TRUE; } if (key >= 'a' && key <= 'z') { key += ALT_A - 'a'; SP->key_code = TRUE; } if (key >= '0' && key <= '9') { key += ALT_0 - '0'; SP->key_code = TRUE; } } /* Textual input is handled by the SDL_TEXTINPUT event */ if (' ' <= key && key <= '~') { return -1; } return key ? key : -1; } static int _process_mouse_event(void) { SDL_Keymod keymods; short shift_flags = 0; memset(&pdc_mouse_status, 0, sizeof(MOUSE_STATUS)); keymods = SDL_GetModState(); if (keymods & KMOD_SHIFT) shift_flags |= BUTTON_SHIFT; if (keymods & KMOD_CTRL) shift_flags |= BUTTON_CONTROL; if (keymods & KMOD_ALT) shift_flags |= BUTTON_ALT; if (event.type == SDL_MOUSEMOTION) { int i; pdc_mouse_status.x = event.motion.x / pdc_fwidth; pdc_mouse_status.y = event.motion.y / pdc_fheight; if (!event.motion.state || (pdc_mouse_status.x == old_mouse_status.x && pdc_mouse_status.y == old_mouse_status.y)) return -1; pdc_mouse_status.changes = PDC_MOUSE_MOVED; for (i = 0; i < 3; i++) { if (event.motion.state & SDL_BUTTON(i + 1)) { pdc_mouse_status.button[i] = BUTTON_MOVED | shift_flags; pdc_mouse_status.changes |= (1 << i); } } } else if (event.type == SDL_MOUSEWHEEL) { pdc_mouse_status.x = pdc_mouse_status.y = -1; if (event.wheel.y > 0) pdc_mouse_status.changes = PDC_MOUSE_WHEEL_UP; else if (event.wheel.y < 0) pdc_mouse_status.changes = PDC_MOUSE_WHEEL_DOWN; else if (event.wheel.x > 0) pdc_mouse_status.changes = PDC_MOUSE_WHEEL_RIGHT; else if (event.wheel.x < 0) pdc_mouse_status.changes = PDC_MOUSE_WHEEL_LEFT; else return -1; return KEY_MOUSE; } else { short action = (event.button.state == SDL_PRESSED) ? BUTTON_PRESSED : BUTTON_RELEASED; Uint8 btn = event.button.button; if (btn < 1 || btn > 3) return -1; /* check for a click -- a press followed immediately by a release */ if (action == BUTTON_PRESSED && SP->mouse_wait) { SDL_Event rel; napms(SP->mouse_wait); if (SDL_PollEvent(&rel)) { if (rel.type == SDL_MOUSEBUTTONUP && rel.button.button == btn) action = BUTTON_CLICKED; else SDL_PushEvent(&rel); } } pdc_mouse_status.x = event.button.x / pdc_fwidth; pdc_mouse_status.y = event.button.y / pdc_fheight; btn--; pdc_mouse_status.button[btn] = action | shift_flags; pdc_mouse_status.changes = (1 << btn); } old_mouse_status = pdc_mouse_status; SP->key_code = TRUE; return KEY_MOUSE; } void PDC_twice_a_second( void); /* pdcdisp.c */ /* return the next available key or mouse event */ int PDC_get_key(void) { switch (event.type) { case SDL_QUIT: exit(1); case SDL_WINDOWEVENT: switch (event.window.event) { case SDL_WINDOWEVENT_SIZE_CHANGED: case SDL_WINDOWEVENT_RESIZED: if (pdc_own_window && (pdc_sheight != event.window.data2 || pdc_swidth != event.window.data1)) { pdc_sheight = event.window.data2; pdc_swidth = event.window.data1; if (!SP->resized) { SP->resized = TRUE; return KEY_RESIZE; } } break; case SDL_WINDOWEVENT_RESTORED: case SDL_WINDOWEVENT_EXPOSED: SDL_UpdateWindowSurface(pdc_window); break; } break; case SDL_MOUSEMOTION: SDL_ShowCursor(SDL_ENABLE); case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEWHEEL: oldkey = SDLK_SPACE; if (SP->_trap_mbe) return _process_mouse_event(); break; case SDL_KEYUP: case SDL_KEYDOWN: case SDL_TEXTINPUT: PDC_mouse_set(); return _process_key_event(); case SDL_USEREVENT: /* timer event, every 500 millisec */ PDC_twice_a_second( ); break; } return -1; } /* discard any pending keyboard or mouse input -- this is the core routine for flushinp() */ void PDC_flushinp(void) { PDC_LOG(("PDC_flushinp() - called\n")); while (PDC_check_key()); } int PDC_mouse_set(void) { SDL_ShowCursor(SP->_trap_mbe ? SDL_ENABLE : SDL_DISABLE); return OK; } int PDC_modifiers_set(void) { return OK; } curses-1.4.4/vendor/PDCurses/sdl2/pdcsetsc.c0000644000004100000410000000330414201713275020663 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcsdl.h" /*man-start************************************************************** pdcsetsc -------- ### Synopsis int PDC_set_blink(bool blinkon); void PDC_set_title(const char *title); ### Description PDC_set_blink() toggles whether the A_BLINK attribute sets an actual blink mode (TRUE), or sets the background color to high intensity (FALSE). The default is platform-dependent (FALSE in most cases). It returns OK if it could set the state to match the given parameter, ERR otherwise. Current platforms also adjust the value of COLORS according to this function -- 16 for FALSE, and 8 for TRUE. PDC_set_title() sets the title of the window in which the curses program is running. This function may not do anything on some platforms. (Currently it only works in Win32 and X11.) ### Portability X/Open BSD SYS V PDC_set_blink - - - PDC_set_title - - - **man-end****************************************************************/ int PDC_curs_set(int visibility) { int ret_vis; PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); ret_vis = SP->visibility; SP->visibility = visibility; PDC_gotoyx(SP->cursrow, SP->curscol); return ret_vis; } void PDC_set_title(const char *title) { PDC_LOG(("PDC_set_title() - called:<%s>\n", title)); SDL_SetWindowTitle(pdc_window, title); } /* See comments in win32a/pdcsetsc.c or x11/pdcsetsc.c. This does essentially the same thing. */ int PDC_set_blink(bool blinkon) { extern int PDC_really_blinking; PDC_really_blinking = blinkon; return OK; } curses-1.4.4/vendor/PDCurses/sdl2/Makefile.vc0000644000004100000410000000765514201713275020773 0ustar www-datawww-data# Visual C++ & Intel(R) NMakefile for PDCurses library - Win32 VC++ 2.0+ # # Note: currently NOT working (at least not with VC 2015) # # Usage: nmake -f [path\]Makefile.vc [DEBUG=] [DLL=] [WIDE=] [UTF8=] # [ICC=] [CHTYPE_32=] [IX86=] [CHTYPE_16=] [target] # [SDL_INCLUDE_DIR=path\to\SDL\includes] [SDL_LIB_DIR=path\to\SDL\libs] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] # CHTYPE_## is used to override the default 64-bit chtypes in favor # of "traditional" 32- or 16-bit chtypes. # IX86 is used to build 32-bit code instead of 64-bit # ICC is used to invoke Intel (R) tools icl.exe and xilink.exe, instead of # MS tools cl.exe and link.exe O = obj !ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. !endif INCLUDES = !ifdef SDL_INCLUDE_DIR INCLUDES = $(INCLUDES) -I $(SDL_INCLUDE_DIR) !endif !ifndef SDL_LIB_DIR SDL_LIB_DIR = . !endif !include $(PDCURSES_SRCDIR)\version.mif !include $(PDCURSES_SRCDIR)\libobjs.mif osdir = $(PDCURSES_SRCDIR)\sdl2 PDCURSES_WIN_H = $(osdir)\pdcsdl.h !ifdef ICC CC = icl.exe -nologo LINK = xilink.exe -nologo !else CC = cl.exe -nologo LINK = link.exe -nologo !endif !ifdef DEBUG CFLAGS = $(INCLUDES) -Dmain=SDL_main -Z7 -DPDCDEBUG -MT -D_CRT_SECURE_NO_WARNINGS LDFLAGS = -debug -pdb:none !else CFLAGS = $(INCLUDES) -Dmain=SDL_main -Ox -MT -W3 -D_CRT_SECURE_NO_WARNINGS LDFLAGS = !endif LDFLAGS = $(LDFLAGS) /LIBPATH:$(SDL_LIB_DIR) SDL2.lib SDL2main.lib /ENTRY:SDL_main /SUBSYSTEM:Console !ifdef WIDE WIDEOPT = -DPDC_WIDE LDFLAGS = $(LDFLAGS) SDL2_ttf.lib !endif !ifdef UTF8 UTF8OPT = -DPDC_FORCE_UTF8 !endif !ifdef CHTYPE_32 CHTYPE_FLAGS= -DCHTYPE_32 !endif !ifdef CHTYPE_16 CHTYPE_FLAGS= -DCHTYPE_16 !endif SHL_LD = link $(LDFLAGS) /NOLOGO /DLL /OUT:pdcurses.dll CCLIBS = user32.lib gdi32.lib advapi32.lib shell32.lib comdlg32.lib # may need to add msvcrt.lib for VC 2.x, VC 5.0 doesn't want it #CCLIBS = msvcrt.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib !ifdef WIDE WIDEOPT = -DPDC_WIDE !endif LIBEXE = lib -nologo LIBCURSES = pdcurses.lib CURSESDLL = pdcurses.dll !ifdef DLL DLLOPT = -DPDC_DLL_BUILD PDCLIBS = $(CURSESDLL) !else PDCLIBS = $(LIBCURSES) !endif BUILD = $(CC) -I$(PDCURSES_SRCDIR) -c $(CFLAGS) $(CHTYPE_FLAGS) $(DLLOPT) \ $(WIDEOPT) $(UTF8OPT) all: $(PDCLIBS) $(DEMOS) clean: -del *.obj -del *.lib -del *.exe -del *.dll -del *.exp -del *.res DEMOOBJS = $(DEMOS:.exe=.obj) tui.obj $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_WIN_H) $(DEMOOBJS) : $(PDCURSES_CURSES_H) $(DEMOS) : $(LIBCURSES) panel.obj : $(PANEL_HEADER) terminfo.obj: $(TERM_HEADER) !ifndef DLL $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) -out:$@ $(LIBOBJS) $(PDCOBJS) -copy $(LIBCURSES) panel.lib !endif $(CURSESDLL) : $(LIBOBJS) $(PDCOBJS) pdcurses.obj $(SHL_LD) $(LIBOBJS) $(PDCOBJS) pdcurses.obj $(CCLIBS) -copy $(LIBCURSES) panel.lib pdcurses.res pdcurses.obj: $(osdir)\pdcurses.rc $(osdir)\pdcurses.ico rc /r /fopdcurses.res $(osdir)\pdcurses.rc !ifdef IX86 cvtres /MACHINE:IX86 /NOLOGO /OUT:pdcurses.obj pdcurses.res !else cvtres /MACHINE:X64 /NOLOGO /OUT:pdcurses.obj pdcurses.res !endif {$(srcdir)\}.c{}.obj:: $(BUILD) $< {$(osdir)\}.c{}.obj:: $(BUILD) $< {$(demodir)\}.c{}.obj:: $(BUILD) $< .obj.exe: $(LINK) $< $(LDFLAGS) $(LIBCURSES) $(CCLIBS) tuidemo.exe: tuidemo.obj tui.obj $(LINK) $*.obj tui.obj $(LDFLAGS) $(LIBCURSES) $(CCLIBS) tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(BUILD) -I$(demodir) $(demodir)\tui.c tuidemo.obj: $(demodir)\tuidemo.c $(BUILD) -I$(demodir) $(demodir)\tuidemo.c PLATFORM1 = Visual C++ PLATFORM2 = Microsoft Visual C/C++ for Win32 ARCNAME = pdc$(VER)_vc_w32 !include $(PDCURSES_SRCDIR)\makedist.mif curses-1.4.4/vendor/PDCurses/sdl2/pdcgetsc.c0000644000004100000410000000074314201713275020653 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcsdl.h" /* get the cursor size/shape */ int PDC_get_cursor_mode(void) { PDC_LOG(("PDC_get_cursor_mode() - called\n")); return 0; } /* return number of screen rows */ int PDC_get_rows(void) { PDC_LOG(("PDC_get_rows() - called\n")); return pdc_sheight / pdc_fheight; } /* return width of screen/viewport */ int PDC_get_columns(void) { PDC_LOG(("PDC_get_columns() - called\n")); return pdc_swidth / pdc_fwidth; } curses-1.4.4/vendor/PDCurses/sdl2/pdcsdl.h0000644000004100000410000000230414201713275020330 0ustar www-datawww-data/* Public Domain Curses */ #include #include #ifdef PDC_WIDE # include #endif #ifdef PDC_WIDE PDCEX TTF_Font *pdc_ttffont; PDCEX int pdc_font_size; #endif PDCEX SDL_Window *pdc_window; PDCEX SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back; PDCEX int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset; extern SDL_Surface *pdc_tileback; /* used to regenerate the background of "transparent" cells */ extern SDL_Color pdc_color[256]; /* colors for font palette */ extern Uint32 pdc_mapped[256]; /* colors for FillRect(), as used in _highlight() */ extern int pdc_fheight, pdc_fwidth; /* font height and width */ extern int pdc_flastc; /* font palette's last color (treated as the foreground) */ extern bool pdc_own_window; /* if pdc_window was not set before initscr(), PDCurses is responsible for (owns) it */ extern Uint32 pdc_lastupdate; /* time of last update, in ticks */ void PDC_update_rects(void); void PDC_retile(void); curses-1.4.4/vendor/PDCurses/sdl2/sdltest.c0000644000004100000410000000342614201713275020542 0ustar www-datawww-data/* Here's a simple example of combining SDL and PDCurses functionality. The top portion of the window is devoted to SDL, with a four-line (assuming the default 8x16 font) stdscr at the bottom. */ #include #include #include #include /* You could #include pdcsdl.h, or just add the relevant declarations here: */ PDCEX SDL_Window *pdc_window; PDCEX SDL_Surface *pdc_screen; PDCEX int pdc_yoffset; int main(int argc, char **argv) { char inp[60]; int i, j, seed; seed = time((time_t *)0); srand(seed); /* Initialize SDL */ if (SDL_Init(SDL_INIT_VIDEO) < 0) exit(1); atexit(SDL_Quit); pdc_window = SDL_CreateWindow("PDCurses for SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0); pdc_screen = SDL_GetWindowSurface(pdc_window); /* Initialize PDCurses */ pdc_yoffset = 416; /* 480 - 4 * 16 */ initscr(); start_color(); scrollok(stdscr, TRUE); PDC_set_title("PDCurses for SDL"); /* Do some SDL stuff */ for (i = 640, j = 416; j; i -= 2, j -= 2) { SDL_Rect dest; dest.x = (640 - i) / 2; dest.y = (416 - j) / 2; dest.w = i; dest.h = j; SDL_FillRect(pdc_screen, &dest, SDL_MapRGB(pdc_screen->format, rand() % 256, rand() % 256, rand() % 256)); } SDL_UpdateWindowSurface(pdc_window); /* Do some curses stuff */ init_pair(1, COLOR_WHITE + 8, COLOR_BLUE); bkgd(COLOR_PAIR(1)); addstr("This is a demo of "); attron(A_UNDERLINE); addstr("PDCurses for SDL"); attroff(A_UNDERLINE); addstr(".\nYour comments here: "); getnstr(inp, 59); addstr("Press any key to exit."); getch(); endwin(); return 0; } curses-1.4.4/vendor/PDCurses/sdl2/pdcdisp.c0000644000004100000410000003566214201713275020515 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcsdl.h" #include #include #include #ifdef CHTYPE_LONG # ifdef PDC_WIDE # define USE_UNICODE_ACS_CHARS 1 # else # define USE_UNICODE_ACS_CHARS 0 # endif # include "acs_defs.h" #endif /* see 'addch.c' for an explanation of how combining chars are handled. */ #if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2 && defined( PDC_WIDE) #define USING_COMBINING_CHARACTER_SCHEME #define MAX_UNICODE 0x10ffff #define DUMMY_CHAR_NEXT_TO_FULLWIDTH (MAX_UNICODE + 1) int PDC_expand_combined_characters( const cchar_t c, cchar_t *added); /* addch.c */ #endif Uint32 pdc_lastupdate = 0; int PDC_really_blinking = FALSE; static bool PDC_blink_state = FALSE; #define MAXRECT 200 /* maximum number of rects to queue up before an update is forced; the number was chosen arbitrarily */ static SDL_Rect uprect[MAXRECT]; /* table of rects to update */ static int rectcount = 0; /* index into uprect */ static SDL_Color foreground_rgb, background_rgb; /* current foreground, background */ /* do the real updates on a delay */ void PDC_update_rects(void) { if (rectcount) { /* if the maximum number of rects has been reached, we're probably better off doing a full screen update */ if (rectcount == MAXRECT) SDL_UpdateWindowSurface(pdc_window); else SDL_UpdateWindowSurfaceRects(pdc_window, uprect, rectcount); pdc_lastupdate = SDL_GetTicks(); rectcount = 0; } } /* PDC_get_rgb_values(), extract_packed_rgb(), intensified_component(), */ /* intensified_color(), and dimmed_color() each exist in x11/x11.c, */ /* win32a/pdcdisp.c, and sdl2/pdcdisp.c in forms slightly modified for */ /* each platform. But they all look pretty much alike. */ #if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2 /* PDCurses stores RGBs in fifteen bits, five bits each */ /* for red, green, blue. A Pixel uses eight bits per */ /* channel. Hence the following. */ static SDL_Color extract_packed_rgb( const chtype color) { SDL_Color rval; rval.r = (Uint8)( (color << 3) & 0xf8); rval.g = (Uint8)( (color >> 2) & 0xf8); rval.b = (Uint8)( (color >> 7) & 0xf8); rval.a = (Uint8)255; return rval; } #endif /* This function 'intensifies' a color by shifting it toward white. */ /* It used to average the input color with white. Then it did a */ /* weighted average: 2/3 of the input color, 1/3 white, for a */ /* lower "intensification" level. */ /* Then Mark Hessling suggested that the output level should */ /* remap zero to 85 (= 255 / 3, so one-third intensity), and input */ /* of 192 or greater should be remapped to 255 (full intensity). */ /* Assuming we want a linear response between zero and 192, that */ /* leads to output = 85 + input * (255-85)/192. */ /* This should lead to proper handling of bold text in legacy */ /* apps, where "bold" means "high intensity". */ static Uint8 intensified_component( Uint8 component) { if( component >= 192) component = 255; else component = 85 + component * (255 - 85) / 192; return( component); } static SDL_Color intensified_color( SDL_Color ival) { SDL_Color oval; oval.r = intensified_component( ival.r); oval.g = intensified_component( ival.g); oval.b = intensified_component( ival.b); return( oval); } /* For use in adjusting colors for A_DIMmed characters. Just */ /* knocks down the intensity of R, G, and B by 1/3. */ static SDL_Color dimmed_color( SDL_Color ival) { ival.r -= ival.r / 3; ival.g -= ival.g / 3; ival.b -= ival.b / 3; return( ival); } void PDC_get_rgb_values( const chtype srcp, SDL_Color *fore_rgb, SDL_Color *back_rgb) { bool reverse_colors = ((srcp & A_REVERSE) ? TRUE : FALSE); bool intensify_backgnd = FALSE; #if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2 if( srcp & A_RGB_COLOR) { /* Extract RGB from 30 bits of the color field */ *back_rgb = extract_packed_rgb( srcp >> PDC_COLOR_SHIFT); *fore_rgb = extract_packed_rgb( srcp >> (PDC_COLOR_SHIFT + 15)); } else #endif { short foreground_index, background_index; PDC_pair_content( PAIR_NUMBER( srcp), &foreground_index, &background_index); *fore_rgb = pdc_color[foreground_index]; if( background_index >= 0) *back_rgb = pdc_color[background_index]; } if( srcp & A_BLINK) { if( !PDC_really_blinking) /* convert 'blinking' to 'bold' */ intensify_backgnd = TRUE; else if( PDC_blink_state) reverse_colors = !reverse_colors; } if( reverse_colors) { const SDL_Color temp = *fore_rgb; *fore_rgb = *back_rgb; *back_rgb = temp; } if( srcp & A_BOLD) *fore_rgb = intensified_color( *fore_rgb); if( intensify_backgnd) *back_rgb = intensified_color( *back_rgb); if( srcp & A_DIM) { *fore_rgb = dimmed_color( *fore_rgb); *back_rgb = dimmed_color( *back_rgb); } } #define same_colors( A, B) ((A).r==(B).r && (A).g==(B).g && (A).b==(B).b) /* set the font colors to match the chtype's attribute */ static void _set_attr(chtype ch) { static chtype oldch = (chtype)(-1); /* current attribute */ ch &= (A_COLOR|A_BOLD|A_BLINK|A_REVERSE | A_DIM | A_RGB_COLOR); if (oldch != ch) { SDL_Color fore_rgb, back_rgb; if (SP->mono) return; PDC_get_rgb_values( ch, &fore_rgb, &back_rgb); if( !same_colors( fore_rgb, foreground_rgb)) { #ifndef PDC_WIDE SDL_SetPaletteColors(pdc_font->format->palette, &fore_rgb, pdc_flastc, 1); #endif foreground_rgb = fore_rgb; } if( !same_colors( back_rgb, background_rgb)) { #ifndef PDC_WIDE SDL_SetPaletteColors(pdc_font->format->palette, &back_rgb, 0, 1); #endif background_rgb = back_rgb; } oldch = ch; } } #ifdef PDC_WIDE static void set_font_style( const chtype ch) { static int old_font_style = -1; int font_style = ((ch & A_BOLD) ? TTF_STYLE_BOLD : 0); if( ch & A_ITALIC) font_style |= TTF_STYLE_ITALIC; if( font_style != old_font_style) { TTF_SetFontStyle( pdc_ttffont, font_style); old_font_style = font_style; } } #endif /* draw a cursor at (y, x) */ void PDC_gotoyx(int row, int col) { SDL_Rect src, dest; chtype ch; int oldrow, oldcol; const int cursor_style = (SP->visibility >> (PDC_blink_state ? 8 : 0)) & 0xff; #ifdef PDC_WIDE Uint16 chstr[2] = {0, 0}; #endif PDC_LOG(("PDC_gotoyx() - called: row %d col %d from row %d col %d\n", row, col, SP->cursrow, SP->curscol)); if (SP->mono) return; oldrow = SP->cursrow; oldcol = SP->curscol; /* clear the old cursor */ PDC_transform_line(oldrow, oldcol, 1, curscr->_y[oldrow] + oldcol); if (!cursor_style) return; /* draw a new cursor by overprinting the existing character in reverse, either the full cell (when cursor_style == 2) or the lowest quarter of it (when cursor_style == 1) */ ch = curscr->_y[row][col] ^ A_REVERSE; _set_attr(ch); #ifdef CHTYPE_LONG if (ch & A_ALTCHARSET && !(ch & 0xff80)) ch = acs_map[ch & 0x7f]; #endif src.h = (cursor_style == 1) ? pdc_fheight >> 2 : pdc_fheight; src.w = pdc_fwidth; dest.y = (row + 1) * pdc_fheight - src.h + pdc_yoffset; dest.x = col * pdc_fwidth + pdc_xoffset; #ifdef PDC_WIDE chstr[0] = ch & A_CHARTEXT; set_font_style( ch); pdc_font = TTF_RenderUNICODE_Solid( pdc_ttffont, chstr, foreground_rgb); if (pdc_font) { dest.h = src.h; dest.w = src.w; src.x = 0; src.y = 0; SDL_SetColorKey( pdc_font, SDL_FALSE, 0); SDL_SetPaletteColors(pdc_font->format->palette, &background_rgb, 0, 1); SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest); SDL_FreeSurface(pdc_font); pdc_font = NULL; } #else src.x = (ch & 0xff) % 32 * pdc_fwidth; src.y = (ch & 0xff) / 32 * pdc_fheight + (pdc_fheight - src.h); SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest); #endif if (oldrow != row || oldcol != col) { if (rectcount == MAXRECT) PDC_update_rects(); uprect[rectcount++] = dest; } } /* handle the A_*LINE attributes */ static void _highlight( SDL_Rect *dest, chtype ch) { SDL_Color col; Uint32 pixel_value; if (SP->mono) return; if (SP->line_color == -1) col = foreground_rgb; else col = pdc_color[SP->line_color]; pixel_value = SDL_MapRGB( pdc_screen->format, col.r, col.g, col.b); if (ch & (A_UNDERLINE | A_OVERLINE | A_STRIKEOUT)) { dest->h = 1; if (ch & A_OVERLINE) SDL_FillRect(pdc_screen, dest, pixel_value); if (ch & A_UNDERLINE) { dest->y += pdc_fheight - 1; SDL_FillRect(pdc_screen, dest, pixel_value); dest->y -= pdc_fheight - 1; } if (ch & A_STRIKEOUT) { dest->y += pdc_fheight / 2; SDL_FillRect(pdc_screen, dest, pixel_value); dest->y -= pdc_fheight / 2; } dest->h = pdc_fheight; } if (ch & (A_LEFTLINE|A_RIGHTLINE)) { dest->w = 1; if (ch & A_LEFTLINE) SDL_FillRect(pdc_screen, dest, pixel_value); if (ch & A_RIGHTLINE) { dest->x += pdc_fwidth - 1; SDL_FillRect(pdc_screen, dest, pixel_value); dest->x -= pdc_fwidth - 1; } dest->w = pdc_fwidth; } } /* update the given physical line to look like the corresponding line in curscr */ void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) { SDL_Rect src, dest, lastrect; int j; #ifdef PDC_WIDE Uint16 chstr[2] = {0, 0}; #endif PDC_LOG(("PDC_transform_line() - called: lineno=%d\n", lineno)); if (rectcount == MAXRECT) PDC_update_rects(); src.h = pdc_fheight; src.w = pdc_fwidth; dest.y = pdc_fheight * lineno + pdc_yoffset; dest.x = pdc_fwidth * x + pdc_xoffset; dest.h = pdc_fheight; dest.w = pdc_fwidth * len; /* if the previous rect was just above this one, with the same width and horizontal position, then merge the new one with it instead of adding a new entry */ if (rectcount) lastrect = uprect[rectcount - 1]; if (rectcount && lastrect.x == dest.x && lastrect.w == dest.w) { if (lastrect.y + lastrect.h == dest.y) uprect[rectcount - 1].h = lastrect.h + pdc_fheight; else if (lastrect.y != dest.y) uprect[rectcount++] = dest; } else uprect[rectcount++] = dest; dest.w = pdc_fwidth; #ifdef PDC_WIDE src.x = 0; src.y = 0; #endif for (j = 0; j < len; j++) { chtype ch = srcp[j]; #ifdef PDC_WIDE chtype ch1; #endif _set_attr(ch); #ifdef CHTYPE_LONG if (ch & A_ALTCHARSET && !(ch & 0xff80)) ch = (ch & (A_ATTRIBUTES ^ A_ALTCHARSET)) | acs_map[ch & 0x7f]; #endif #ifdef PDC_WIDE ch1 = ch & A_CHARTEXT; #ifdef USING_COMBINING_CHARACTER_SCHEME /* We can't actually display combining characters in cmd.exe. So show the 'base' character and throw away the modifying marks. */ if( ch1 == DUMMY_CHAR_NEXT_TO_FULLWIDTH) ch1 = ' '; else if( ch1 > MAX_UNICODE) { cchar_t added; int n_combined = 0; while( (ch1 = PDC_expand_combined_characters( ch1, &added)) > MAX_UNICODE) { n_combined++; } } #ifdef USE_FOR_SUPPLEMENTAL_MULTILINGUAL_PLANE /* At present, SDL does not (I think) support SMP Unicode */ /* (Unicode past 64K). If it ever does, we'll need the */ /* following breakup of SMP into Unicode surrogates (q.v.) */ if( ch1 > 0xffff) { ch1 -= 0x10000; chstr[0] = (Uint16)( 0xdc00 | (ch1 & 0x3ff)); /* lower 10 bits */ ch1 = (0xd800 | (ch1 >> 10)); /* upper 10 bits */ } #endif #endif chstr[0] = (Uint16)ch1; set_font_style( ch); pdc_font = TTF_RenderUNICODE_Solid(pdc_ttffont, chstr, foreground_rgb); if (pdc_font) { SDL_SetColorKey( pdc_font, SDL_FALSE, 0); SDL_SetPaletteColors(pdc_font->format->palette, &background_rgb, 0, 1); SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest); SDL_FreeSurface(pdc_font); pdc_font = NULL; } #else src.x = (ch & 0xff) % 32 * pdc_fwidth; src.y = (ch & 0xff) / 32 * pdc_fheight; SDL_LowerBlit(pdc_font, &src, pdc_screen, &dest); #endif if (ch & (A_UNDERLINE|A_LEFTLINE|A_RIGHTLINE|A_OVERLINE|A_STRIKEOUT)) _highlight( &dest, ch); dest.x += pdc_fwidth; } } /* If PDC_really_blinking is 'true', we need to redraw all text with the A_BLINK attribute set every 500 milliseconds. (We also need to redraw it when blinking is turned off.) If the line-drawing color changes, we need to redraw all under/over/left/right-lined text, and strikeout text. This function, therefore, redraws all text of a specified attribute. */ static void redraw_text_with_attribute( const chtype attribute) { int i, j, k; for( i = 0; i < SP->lines; i++) { const chtype *srcp = curscr->_y[i]; for( j = 0; j < SP->cols; j++) if( srcp[j] & attribute) { k = j + 1; while( k < SP->cols && (srcp[k] & attribute)) k++; PDC_transform_line( i, j, k - j, srcp + j); j = k; } } } /* Twice a second, we blink the cursor, blink text if it's "really" blinking (or draw it as 'standout' if it was previously blinking), and if the line color has changed, we redraw all the lined text. */ void PDC_twice_a_second( void) { static int previously_really_blinking; static int prev_line_color = -1; PDC_blink_state = !PDC_blink_state; PDC_gotoyx(SP->cursrow, SP->curscol); if( PDC_really_blinking || previously_really_blinking) redraw_text_with_attribute( A_BLINK); previously_really_blinking = PDC_really_blinking; if( prev_line_color != SP->line_color) { redraw_text_with_attribute( A_UNDERLINE | A_OVERLINE | A_STRIKEOUT | A_LEFTLINE | A_RIGHTLINE); prev_line_color = SP->line_color; } } curses-1.4.4/vendor/PDCurses/sdl2/deficon.h0000644000004100000410000000244614201713275020475 0ustar www-datawww-data/* The PDCurses logo as #include'able BMP (from ../x11/little_icon.xbm) */ unsigned char deficon[] = { 0x42, 0x4d, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xce, 0x6f, 0x9c, 0xe7, 0xb5, 0xaf, 0x6b, 0x5b, 0xbd, 0xaf, 0xeb, 0xfb, 0xbd, 0xaf, 0x98, 0xe7, 0xbd, 0xaf, 0x7b, 0x5f, 0xb5, 0xa5, 0x6b, 0x5b, 0xcd, 0xab, 0x9c, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0x03, 0xff, 0xff, 0xce, 0x03, 0xff, 0xff, 0xcc, 0x73, 0xff, 0xff, 0xcc, 0xf3, 0xff, 0xff, 0xcc, 0xf3, 0xff, 0xff, 0xcc, 0x73, 0xff, 0xff, 0xc6, 0x33, 0xff, 0xff, 0xc3, 0x13, 0xff, 0xff, 0xc1, 0x83, 0xff, 0xff, 0xc8, 0xc3, 0xff, 0xff, 0xcc, 0x63, 0xff, 0xff, 0xce, 0x33, 0xff, 0xff, 0xcf, 0x33, 0xff, 0xff, 0xcf, 0x33, 0xff, 0xff, 0xce, 0x33, 0xff, 0xff, 0xc0, 0x73, 0xff, 0xff, 0xc0, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; curses-1.4.4/vendor/PDCurses/sdl2/pdcclip.c0000644000004100000410000000464314201713275020500 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcsdl.h" #include #include /*man-start************************************************************** clipboard --------- ### Synopsis int PDC_getclipboard(char **contents, long *length); int PDC_setclipboard(const char *contents, long length); int PDC_freeclipboard(char *contents); int PDC_clearclipboard(void); ### Description PDC_getclipboard() gets the textual contents of the system's clipboard. This function returns the contents of the clipboard in the contents argument. It is the responsibilitiy of the caller to free the memory returned, via PDC_freeclipboard(). The length of the clipboard contents is returned in the length argument. PDC_setclipboard copies the supplied text into the system's clipboard, emptying the clipboard prior to the copy. PDC_clearclipboard() clears the internal clipboard. ### Return Values indicator of success/failure of call. PDC_CLIP_SUCCESS the call was successful PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for the clipboard contents PDC_CLIP_EMPTY the clipboard contains no text PDC_CLIP_ACCESS_ERROR no clipboard support ### Portability X/Open BSD SYS V PDC_getclipboard - - - PDC_setclipboard - - - PDC_freeclipboard - - - PDC_clearclipboard - - - **man-end****************************************************************/ int PDC_getclipboard(char **contents, long *length) { PDC_LOG(("PDC_getclipboard() - called\n")); if (SDL_HasClipboardText() == SDL_FALSE) return PDC_CLIP_EMPTY; *contents = SDL_GetClipboardText(); *length = strlen(*contents); return PDC_CLIP_SUCCESS; } int PDC_setclipboard(const char *contents, long length) { PDC_LOG(("PDC_setclipboard() - called\n")); if (SDL_SetClipboardText(contents) != 0) return PDC_CLIP_ACCESS_ERROR; return PDC_CLIP_SUCCESS; } int PDC_freeclipboard(char *contents) { PDC_LOG(("PDC_freeclipboard() - called\n")); SDL_free(contents); return PDC_CLIP_SUCCESS; } int PDC_clearclipboard(void) { PDC_LOG(("PDC_clearclipboard() - called\n")); if (SDL_HasClipboardText() == SDL_TRUE) { SDL_SetClipboardText(NULL); } return PDC_CLIP_SUCCESS; } curses-1.4.4/vendor/PDCurses/sdl2/CMakeLists.txt0000644000004100000410000000506314201713275021453 0ustar www-datawww-datacmake_minimum_required(VERSION 3.11) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING "Choose the type of build, options are: Debug, Release, or MinSizeRel." FORCE) message(STATUS "No build type specified, defaulting to MinSizeRel.") endif() project(sdl2 VERSION "${PROJECT_VERSION}" LANGUAGES C) message(STATUS "${PROJECT_NAME} version: ${PROJECT_VERSION}") message(STATUS "SDL2_LIBRARIES = ${SDL2_LIBRARIES}") message(STATUS "SDL2_INCLUDE_DIR = ${SDL2_INCLUDE_DIR}") message(STATUS "SDL2_LIBRARY_DIR = ${SDL2_LIBRARY_DIR}") if(PDC_WIDE) message(STATUS "SDL2_TTF_LIBRARY = ${SDL2_TTF_LIBRARY}") message(STATUS "SDL2_TTF_INCLUDE_DIR = ${SDL2_TTF_INCLUDE_DIR}") message(STATUS "SDL2_TTF_LIBRARY_DIR = ${SDL2_TTF_LIBRARY_DIR}") endif() include_directories(${SDL2_INCLUDE_DIR} ${SDL2_TTF_INCLUDE_DIR}) link_directories(${SDL2_LIBRARY_DIR} ${SDL2_TTF_LIBRARY_DIR}) include(project_common) macro (sdl2_app dir targ) set(bin_name "${PROJECT_NAME}_${targ}") if(${targ} STREQUAL "tuidemo") set(src_files ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/tuidemo.c ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/tui.c) else() set(src_files ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/${targ}.c) endif() add_executable(${bin_name} ${src_files}) if(PDC_WIDE) target_link_libraries(${bin_name} ${PDCURSE_PROJ} ${EXTRA_LIBS} "${SDL2_LIBRARIES};${SDL2_TTF_LIBRARY};${FT2_LIBRARY};${ZLIB_LIBRARY};${SDL2_DEP_LIBRARIES}") else() target_link_libraries(${bin_name} ${PDCURSE_PROJ} ${EXTRA_LIBS} "${SDL2_LIBRARIES};${SDL2_TTF_DEP_LIBRARIES};${SDL2_DEP_LIBRARIES}") endif() add_dependencies(${bin_name} ${PDCURSE_PROJ}) set_target_properties(${bin_name} PROPERTIES OUTPUT_NAME ${targ}) install(TARGETS ${bin_name} RUNTIME DESTINATION ${PDCURSES_DIST}/bin/${PROJECT_NAME} COMPONENT applications) endmacro () sdl2_app(../demos version) sdl2_app(../demos firework) sdl2_app(../demos ozdemo) sdl2_app(../demos newtest) sdl2_app(../demos ptest) sdl2_app(../demos rain) sdl2_app(../demos testcurs) sdl2_app(../demos tuidemo) sdl2_app(../demos worm) sdl2_app(../demos xmas) sdl2_app(./ sdltest) if(WIN32) set_target_properties(${PROJECT_NAME}_newtest PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS") endif(WIN32) if(PDC_SDL2_DEPS_BUILD) if(PDC_WIDE) add_dependencies(${PDCURSE_PROJ} sdl2_ext sdl2_ttf_ext) else() add_dependencies(${PDCURSE_PROJ} sdl2_ext) endif() endif() set(CPACK_COMPONENTS_ALL applications) curses-1.4.4/vendor/PDCurses/sdl2/pdcutil.c0000644000004100000410000000136414201713275020523 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcsdl.h" void PDC_beep(void) { PDC_LOG(("PDC_beep() - called\n")); } void PDC_napms(int ms) { PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); PDC_update_rects(); SDL_Delay(ms); } const char *PDC_sysname(void) { return "SDL2"; } PDC_version_info PDC_version = { PDC_PORT_SDL2, PDC_VER_MAJOR, PDC_VER_MINOR, PDC_VER_CHANGE, sizeof( chtype), /* note that thus far, 'wide' and 'UTF8' versions exist */ /* only for SDL2, X11, Win32, and Win32a; elsewhere, */ /* these will be FALSE */ #ifdef PDC_WIDE TRUE, #else FALSE, #endif #ifdef PDC_FORCE_UTF8 TRUE, #else FALSE, #endif }; curses-1.4.4/vendor/PDCurses/sdl2/deffont.h0000644000004100000410000006410314201713275020511 0ustar www-datawww-data/* Default font -- this is simply a 256x128x1 BMP, in #include'able form. The font is 8x16, code page 437, and is based on the pc8x16s.bdf font from the vgafonts.tar.gz package, by "Myrlin". */ unsigned char deffont[] = { 0x42, 0x4d, 0x3e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xf8, 0xc0, 0x6c, 0xfe, 0x70, 0x7c, 0x18, 0x7e, 0x38, 0xee, 0x3c, 0x00, 0xc0, 0x1c, 0xc6, 0x00, 0x7e, 0x7e, 0x7e, 0x18, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0xdc, 0xcc, 0xc0, 0x6c, 0xc6, 0xd8, 0x66, 0x18, 0x18, 0x6c, 0x6c, 0x66, 0x00, 0x60, 0x30, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x18, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x7e, 0x00, 0xd8, 0xcc, 0xc0, 0x6c, 0x60, 0xd8, 0x66, 0x18, 0x3c, 0xc6, 0x6c, 0x66, 0x7e, 0x7e, 0x60, 0xc6, 0x00, 0x00, 0x30, 0x0c, 0x18, 0xd8, 0x18, 0xdc, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x7e, 0x00, 0xd8, 0xcc, 0xc0, 0x6c, 0x30, 0xd8, 0x66, 0x18, 0x66, 0xc6, 0x6c, 0x66, 0xdb, 0xf3, 0x60, 0xc6, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x76, 0x00, 0x18, 0x00, 0x6c, 0x00, 0x00, 0x7e, 0x00, 0xd8, 0xc8, 0xc0, 0x6c, 0x18, 0xd8, 0x66, 0x18, 0x66, 0xc6, 0x6c, 0x66, 0xdb, 0xdb, 0x60, 0xc6, 0xfe, 0x18, 0x0c, 0x30, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x18, 0x18, 0xec, 0x00, 0x00, 0x7e, 0x00, 0xdc, 0xdc, 0xc0, 0x6c, 0x18, 0xd8, 0x66, 0x18, 0x66, 0xfe, 0xc6, 0x3e, 0xdb, 0xdb, 0x7c, 0xc6, 0x00, 0x7e, 0x06, 0x60, 0x18, 0x18, 0x00, 0xdc, 0x00, 0x00, 0x00, 0x0c, 0x36, 0x7e, 0x7e, 0x00, 0x76, 0xce, 0xc0, 0xfe, 0x30, 0x7e, 0x66, 0xdc, 0x66, 0xc6, 0xc6, 0x0c, 0x7e, 0x7e, 0x60, 0xc6, 0x00, 0x18, 0x0c, 0x30, 0x18, 0x18, 0x18, 0x76, 0x00, 0x00, 0x00, 0x0c, 0x36, 0x32, 0x7e, 0x00, 0x00, 0xc6, 0xc6, 0x00, 0x60, 0x00, 0x00, 0x76, 0x3c, 0xc6, 0xc6, 0x18, 0x00, 0x06, 0x60, 0xc6, 0xfe, 0x18, 0x18, 0x18, 0x1b, 0x18, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0c, 0x36, 0x18, 0x7e, 0x00, 0x00, 0xce, 0xc6, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x18, 0x6c, 0x6c, 0x30, 0x00, 0x03, 0x30, 0x7c, 0x00, 0x00, 0x30, 0x0c, 0x1b, 0x18, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x0c, 0x36, 0x0c, 0x00, 0x00, 0x00, 0x7c, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x7e, 0x38, 0x38, 0x1e, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x18, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x0c, 0x36, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0f, 0x6c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x1f, 0xff, 0xff, 0x1f, 0xff, 0xff, 0x1f, 0x37, 0x3f, 0x37, 0xff, 0xf7, 0x37, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x1f, 0x1f, 0x3f, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x30, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x36, 0x18, 0x18, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x1f, 0x36, 0x37, 0x3f, 0xf7, 0xff, 0x37, 0xff, 0xf7, 0xff, 0x36, 0xff, 0x00, 0x36, 0x1f, 0x1f, 0x00, 0x36, 0xff, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18, 0x00, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18, 0x00, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18, 0x00, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18, 0x00, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18, 0x00, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x06, 0x00, 0x00, 0x00, 0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x06, 0x00, 0x00, 0x00, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0x76, 0x18, 0x7c, 0x78, 0x66, 0xc6, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x0c, 0x3f, 0x18, 0x00, 0x00, 0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0xcc, 0x18, 0xc6, 0xcc, 0x66, 0xc6, 0x00, 0x00, 0xc6, 0xc0, 0x06, 0x86, 0x9a, 0x3c, 0x00, 0x00, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0xcc, 0x18, 0xc6, 0xcc, 0x66, 0xc6, 0x00, 0x00, 0xc6, 0xc0, 0x06, 0xdc, 0xce, 0x3c, 0x36, 0xd8, 0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0xcc, 0x18, 0xc6, 0xcc, 0x66, 0xce, 0x00, 0x00, 0xc0, 0xc0, 0x06, 0x60, 0x66, 0x3c, 0x6c, 0x6c, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0x7c, 0x18, 0xc6, 0xcc, 0x66, 0xde, 0x7e, 0x7c, 0x60, 0xc0, 0x06, 0x30, 0x30, 0x18, 0xd8, 0x36, 0x44, 0xaa, 0x77, 0x18, 0xf8, 0xf8, 0xf6, 0xfe, 0xf8, 0xf6, 0x36, 0xf6, 0xfe, 0xfe, 0xf8, 0xf8, 0x0c, 0x18, 0xc6, 0xcc, 0x66, 0xfe, 0x00, 0x00, 0x30, 0xfe, 0xfe, 0x18, 0x18, 0x18, 0x6c, 0x6c, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x00, 0x18, 0x06, 0x36, 0x06, 0x06, 0x36, 0x18, 0x00, 0x78, 0x38, 0x7c, 0xcc, 0x5c, 0xf6, 0x3e, 0x38, 0x30, 0x00, 0x00, 0x6c, 0x6c, 0x18, 0x36, 0xd8, 0x44, 0xaa, 0x77, 0x18, 0x18, 0xf8, 0x36, 0x00, 0xf8, 0xf6, 0x36, 0xfe, 0xf6, 0x36, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36, 0x36, 0x00, 0x36, 0x36, 0x18, 0x00, 0x60, 0x30, 0x60, 0x60, 0xdc, 0xc6, 0x6c, 0x6c, 0x30, 0x00, 0x00, 0x62, 0x62, 0x18, 0x00, 0x00, 0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36, 0x36, 0x00, 0x36, 0x36, 0x18, 0x00, 0x30, 0x18, 0x30, 0x30, 0x76, 0x00, 0x3c, 0x38, 0x30, 0x00, 0x00, 0xe0, 0xe0, 0x18, 0x00, 0x00, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36, 0x36, 0x00, 0x36, 0x36, 0x18, 0x00, 0x18, 0x0c, 0x18, 0x18, 0x00, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36, 0x36, 0x00, 0x36, 0x36, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36, 0x36, 0x00, 0x36, 0x36, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x78, 0x7c, 0x76, 0x76, 0x76, 0x76, 0x7c, 0x7c, 0x7c, 0x7c, 0x18, 0x18, 0x18, 0xc6, 0xc6, 0xfc, 0x6e, 0xce, 0x7c, 0x7c, 0x7c, 0x78, 0x78, 0x76, 0x7c, 0x7c, 0x18, 0xfe, 0x18, 0xc6, 0x70, 0x3c, 0xcc, 0xc2, 0xcc, 0xcc, 0xcc, 0xcc, 0xc6, 0xc2, 0xc2, 0xc2, 0x18, 0x18, 0x18, 0xc6, 0xc6, 0xc0, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, 0xce, 0xc6, 0xc6, 0x18, 0x60, 0x7e, 0xcc, 0xd8, 0x66, 0xcc, 0xc0, 0xcc, 0xcc, 0xcc, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0x18, 0x18, 0x18, 0xc6, 0xc6, 0xc0, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6, 0x7c, 0x60, 0x18, 0xcc, 0x18, 0xc6, 0xcc, 0xc0, 0xcc, 0xcc, 0xcc, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0x18, 0x18, 0x18, 0xfe, 0xc6, 0xc0, 0x7e, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0x60, 0x7e, 0xcc, 0x18, 0xc0, 0xcc, 0xfe, 0x7c, 0x7c, 0x7c, 0x7c, 0xc0, 0xfe, 0xfe, 0xfe, 0x18, 0x18, 0x18, 0xc6, 0xfe, 0xf0, 0x36, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6, 0xc0, 0x60, 0x18, 0xde, 0x18, 0xc0, 0xcc, 0xc6, 0x0c, 0x0c, 0x0c, 0x0c, 0xc6, 0xc6, 0xc6, 0xc6, 0x18, 0x18, 0x18, 0xc6, 0xc6, 0xc0, 0x36, 0xfe, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6, 0xc0, 0xf8, 0x3c, 0xcc, 0x7e, 0xc0, 0xcc, 0x7c, 0x78, 0x78, 0x78, 0x78, 0x7c, 0x7c, 0x7c, 0x7c, 0x38, 0x38, 0x38, 0x6c, 0x6c, 0xc0, 0xec, 0xcc, 0x7c, 0x7c, 0x7c, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6, 0xc0, 0x60, 0x66, 0xc4, 0x18, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0xc0, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x60, 0x66, 0xf8, 0x18, 0x3c, 0xcc, 0x30, 0x6c, 0x00, 0x18, 0x38, 0x00, 0x6c, 0x00, 0x18, 0x00, 0x66, 0x18, 0x10, 0x10, 0xfc, 0x00, 0x6c, 0x6c, 0x00, 0x18, 0xcc, 0x18, 0x00, 0x7c, 0xc6, 0x7c, 0x62, 0x66, 0xcc, 0x18, 0x00, 0xcc, 0x18, 0x38, 0xcc, 0x30, 0x6c, 0x00, 0x38, 0xc6, 0x30, 0x66, 0x3c, 0x30, 0x00, 0x38, 0x00, 0x00, 0x3e, 0x38, 0xc6, 0x30, 0x78, 0x30, 0xc6, 0x00, 0x00, 0x18, 0x3c, 0x66, 0xcc, 0x1b, 0x00, 0x00, 0x0c, 0x10, 0x00, 0x60, 0x38, 0x00, 0x10, 0x00, 0x60, 0x00, 0x18, 0x60, 0xc6, 0x6c, 0x30, 0x00, 0x00, 0x10, 0x00, 0x60, 0x30, 0x60, 0x00, 0xc6, 0xc6, 0x18, 0x00, 0x00, 0xf8, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xf8, 0x78, 0x7c, 0x7c, 0x30, 0x7c, 0xcc, 0x18, 0x0c, 0xcc, 0x18, 0xc6, 0xcc, 0x78, 0xf8, 0x7c, 0xc0, 0x7c, 0x30, 0x78, 0x10, 0x6c, 0xc6, 0x76, 0xfe, 0x0e, 0x18, 0x70, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xc4, 0xcc, 0xc2, 0x30, 0xcc, 0xcc, 0x18, 0x0c, 0xcc, 0x18, 0xd6, 0xcc, 0xcc, 0xcc, 0xcc, 0xc0, 0x86, 0x30, 0xcc, 0x6c, 0xfe, 0x6c, 0xce, 0xc0, 0x18, 0x18, 0x18, 0x00, 0xfe, 0x00, 0xcc, 0xcc, 0xc0, 0xcc, 0xc0, 0x30, 0xcc, 0xcc, 0x18, 0x0c, 0xd8, 0x18, 0xd6, 0xcc, 0xcc, 0xcc, 0xcc, 0xc0, 0x06, 0x30, 0xcc, 0xc6, 0xd6, 0x38, 0xc6, 0x60, 0x18, 0x18, 0x18, 0x00, 0xc6, 0x00, 0xcc, 0xcc, 0xc0, 0xcc, 0xc0, 0x30, 0xcc, 0xcc, 0x18, 0x0c, 0xf0, 0x18, 0xd6, 0xcc, 0xcc, 0xcc, 0xcc, 0xc0, 0x1c, 0x30, 0xcc, 0xc6, 0xd6, 0x38, 0xc6, 0x30, 0x18, 0x18, 0x18, 0x00, 0xc6, 0x00, 0x7c, 0xcc, 0xc0, 0xcc, 0xfe, 0x30, 0xcc, 0xcc, 0x18, 0x0c, 0xf0, 0x18, 0xd6, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x70, 0x30, 0xcc, 0xc6, 0xd6, 0x38, 0xc6, 0x18, 0x18, 0x18, 0x18, 0x00, 0xc6, 0x00, 0x0c, 0xcc, 0xc4, 0xcc, 0xc6, 0x78, 0xcc, 0xec, 0x18, 0x0c, 0xd8, 0x18, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xec, 0xc2, 0x30, 0xcc, 0xc6, 0xc6, 0x6c, 0xc6, 0x0c, 0x70, 0x18, 0x0e, 0x00, 0x6c, 0x00, 0x78, 0xf8, 0x78, 0x7c, 0x7c, 0x30, 0x7c, 0xd8, 0x38, 0x0c, 0xcc, 0x18, 0xec, 0xb8, 0x78, 0xf8, 0x7c, 0xb8, 0x7c, 0xfc, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0x18, 0x18, 0x18, 0x00, 0x38, 0x00, 0x00, 0xc0, 0x00, 0x0c, 0x00, 0x32, 0x00, 0xc0, 0x00, 0x00, 0xc0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x00, 0x10, 0x0c, 0x00, 0xc0, 0x00, 0x0c, 0x00, 0x36, 0x00, 0xc0, 0x18, 0x0c, 0xc0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x00, 0xc0, 0x00, 0x0c, 0x00, 0x1c, 0x00, 0xc0, 0x18, 0x0c, 0xc0, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x18, 0x70, 0xdc, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfc, 0x3c, 0xf8, 0xfc, 0xc0, 0x3e, 0xc6, 0x18, 0x78, 0xc2, 0xfc, 0xc6, 0xc6, 0x7c, 0xc0, 0x7c, 0xc6, 0x7c, 0x18, 0x7c, 0x10, 0x6c, 0xc6, 0x18, 0xfe, 0x3c, 0x02, 0x3c, 0x00, 0x00, 0xc0, 0xc6, 0xc6, 0x66, 0xdc, 0xc0, 0xc0, 0x66, 0xc6, 0x18, 0xcc, 0xc6, 0xc0, 0xc6, 0xc6, 0xc6, 0xc0, 0xde, 0xc6, 0x86, 0x18, 0xc6, 0x38, 0xee, 0xc6, 0x18, 0xc0, 0x30, 0x06, 0x0c, 0x00, 0x00, 0xdc, 0xc6, 0xc6, 0xc2, 0xce, 0xc0, 0xc0, 0xc6, 0xc6, 0x18, 0xcc, 0xcc, 0xc0, 0xc6, 0xc6, 0xc6, 0xc0, 0xd6, 0xcc, 0x06, 0x18, 0xc6, 0x6c, 0xfe, 0x6c, 0x18, 0xc0, 0x30, 0x0e, 0x0c, 0x00, 0x00, 0xde, 0xc6, 0xc6, 0xc0, 0xc6, 0xc0, 0xc0, 0xc6, 0xc6, 0x18, 0xcc, 0xd8, 0xc0, 0xc6, 0xc6, 0xc6, 0xc0, 0xc6, 0xcc, 0x06, 0x18, 0xc6, 0xc6, 0xd6, 0x7c, 0x18, 0x60, 0x30, 0x1c, 0x0c, 0x00, 0x00, 0xde, 0xfe, 0xc6, 0xc0, 0xc6, 0xc0, 0xc0, 0xde, 0xc6, 0x18, 0x0c, 0xf0, 0xc0, 0xc6, 0xce, 0xc6, 0xc0, 0xc6, 0xd8, 0x0c, 0x18, 0xc6, 0xc6, 0xd6, 0x38, 0x18, 0x30, 0x30, 0x38, 0x0c, 0x00, 0x00, 0xde, 0xc6, 0xfc, 0xc0, 0xc6, 0xf8, 0xf8, 0xc0, 0xfe, 0x18, 0x0c, 0xf0, 0xc0, 0xd6, 0xde, 0xc6, 0xfc, 0xc6, 0xfc, 0x38, 0x18, 0xc6, 0xc6, 0xd6, 0x38, 0x3c, 0x18, 0x30, 0x70, 0x0c, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc0, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x18, 0x0c, 0xd8, 0xc0, 0xfe, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x60, 0x18, 0xc6, 0xc6, 0xc6, 0x7c, 0x66, 0x0c, 0x30, 0xe0, 0x0c, 0x00, 0x00, 0xc6, 0x6c, 0xc6, 0xc2, 0xce, 0xc0, 0xc0, 0xc0, 0xc6, 0x18, 0x0c, 0xcc, 0xc0, 0xfe, 0xf6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc0, 0x18, 0xc6, 0xc6, 0xc6, 0x6c, 0x66, 0x06, 0x30, 0xc0, 0x0c, 0x00, 0x00, 0x7c, 0x38, 0xc6, 0x66, 0xdc, 0xc0, 0xc0, 0x62, 0xc6, 0x18, 0x0c, 0xc6, 0xc0, 0xee, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc2, 0x7e, 0xc6, 0xc6, 0xc6, 0xc6, 0x66, 0x06, 0x30, 0x80, 0x0c, 0xc6, 0x00, 0x00, 0x10, 0xfc, 0x3c, 0xf8, 0xfc, 0xfc, 0x3c, 0xc6, 0x18, 0x1e, 0xc2, 0xc0, 0xc6, 0xc6, 0x7c, 0xfc, 0x7c, 0xfc, 0x7c, 0x7e, 0xc6, 0xc6, 0xc6, 0xc6, 0x66, 0xfe, 0x3c, 0x00, 0x3c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6c, 0x7c, 0x86, 0x76, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x18, 0x00, 0x18, 0x80, 0x38, 0x18, 0xfe, 0x7c, 0x0c, 0x7c, 0x7c, 0x30, 0x7c, 0x78, 0x00, 0x30, 0x06, 0x00, 0x60, 0x18, 0x00, 0x18, 0x00, 0x6c, 0xc6, 0xc6, 0xcc, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x00, 0x18, 0xc0, 0x6c, 0x18, 0xc0, 0x86, 0x0c, 0x86, 0xc6, 0x30, 0xc6, 0x8c, 0x18, 0x18, 0x0c, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0xfe, 0x86, 0x60, 0xcc, 0x00, 0x30, 0x0c, 0x66, 0x18, 0x18, 0x00, 0x00, 0x60, 0xc6, 0x18, 0xc0, 0x06, 0x0c, 0x06, 0xc6, 0x30, 0xc6, 0x06, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x6c, 0x06, 0x30, 0xcc, 0x00, 0x30, 0x0c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x30, 0xe6, 0x18, 0x60, 0x06, 0x0c, 0x06, 0xc6, 0x30, 0xc6, 0x06, 0x00, 0x00, 0x30, 0x7e, 0x0c, 0x18, 0x00, 0x18, 0x00, 0x6c, 0x06, 0x18, 0xdc, 0x00, 0x30, 0x0c, 0xff, 0x7e, 0x00, 0xfe, 0x00, 0x18, 0xf6, 0x18, 0x30, 0x06, 0xfe, 0x06, 0xe6, 0x18, 0xc6, 0x06, 0x00, 0x00, 0x60, 0x00, 0x06, 0x18, 0x00, 0x18, 0x00, 0x6c, 0x7c, 0x0c, 0x76, 0x00, 0x30, 0x0c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x0c, 0xde, 0x18, 0x18, 0x3c, 0xcc, 0xfc, 0xdc, 0x0c, 0x7c, 0x7e, 0x00, 0x00, 0x30, 0x00, 0x0c, 0x18, 0x00, 0x3c, 0x00, 0xfe, 0xc0, 0xc6, 0x38, 0x00, 0x30, 0x0c, 0x66, 0x18, 0x00, 0x00, 0x00, 0x06, 0xce, 0x18, 0x0c, 0x06, 0x6c, 0xc0, 0xc0, 0x06, 0xc6, 0xc6, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x0c, 0x00, 0x3c, 0x24, 0x6c, 0xc2, 0xc2, 0x6c, 0x60, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xc6, 0x78, 0x06, 0x06, 0x3c, 0xc0, 0xc0, 0x06, 0xc6, 0xc6, 0x18, 0x18, 0x0c, 0x00, 0x30, 0xc6, 0x00, 0x3c, 0x66, 0x6c, 0xc6, 0x00, 0x6c, 0x30, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x38, 0xc6, 0x86, 0x1c, 0xc0, 0x60, 0x06, 0xc6, 0xc6, 0x00, 0x00, 0x06, 0x00, 0x60, 0xc6, 0x00, 0x18, 0x66, 0x00, 0x7c, 0x00, 0x38, 0x30, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x18, 0x7c, 0x7c, 0x0c, 0xfe, 0x3c, 0xfe, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x66, 0x00, 0x18, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x10, 0x00, 0x3c, 0x3c, 0x00, 0xff, 0x00, 0xff, 0x78, 0x18, 0xe0, 0xe6, 0x18, 0x80, 0x02, 0x00, 0x66, 0x1b, 0xc6, 0xfe, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xff, 0x38, 0x10, 0x18, 0x18, 0x00, 0xff, 0x3c, 0xc3, 0xcc, 0x18, 0xf0, 0xe7, 0x18, 0xc0, 0x06, 0x18, 0x66, 0x1b, 0x0c, 0xfe, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x10, 0x00, 0x81, 0xff, 0x7c, 0x38, 0x18, 0x18, 0x18, 0xe7, 0x66, 0x99, 0xcc, 0x7e, 0x70, 0x67, 0xdb, 0xe0, 0x0e, 0x3c, 0x00, 0x1b, 0x38, 0xfe, 0x3c, 0x18, 0x7e, 0x18, 0x30, 0xfe, 0x28, 0xfe, 0x38, 0x00, 0x99, 0xe7, 0xfe, 0x7c, 0xe7, 0x7e, 0x3c, 0xc3, 0x42, 0xbd, 0xcc, 0x18, 0x30, 0x63, 0x3c, 0xf0, 0x1e, 0x7e, 0x66, 0x1b, 0x6c, 0xfe, 0x7e, 0x18, 0x18, 0x0c, 0x60, 0xc0, 0x6c, 0x7c, 0x38, 0x00, 0xbd, 0xc3, 0xfe, 0xfe, 0xe7, 0xff, 0x3c, 0xc3, 0x42, 0xbd, 0xcc, 0x3c, 0x30, 0x63, 0xe7, 0xf8, 0x3e, 0x18, 0x66, 0x1b, 0xc6, 0x00, 0x18, 0x18, 0x18, 0xfe, 0xfe, 0xc0, 0xfe, 0x7c, 0x7c, 0x00, 0x81, 0xff, 0xfe, 0x7c, 0xe7, 0xff, 0x18, 0xe7, 0x66, 0x99, 0x78, 0x66, 0x30, 0x63, 0x3c, 0xfe, 0xfe, 0x18, 0x66, 0x7b, 0xc6, 0x00, 0x18, 0x18, 0x18, 0x0c, 0x60, 0xc0, 0x6c, 0x38, 0x7c, 0x00, 0x81, 0xff, 0xfe, 0x38, 0x3c, 0x7e, 0x00, 0xff, 0x3c, 0xc3, 0x32, 0x66, 0x30, 0x63, 0xdb, 0xf8, 0x3e, 0x18, 0x66, 0xdb, 0x6c, 0x00, 0x18, 0x18, 0x18, 0x18, 0x30, 0x00, 0x28, 0x38, 0xfe, 0x00, 0xa5, 0xdb, 0x6c, 0x10, 0x3c, 0x3c, 0x00, 0xff, 0x00, 0xff, 0x1a, 0x66, 0x3f, 0x7f, 0x18, 0xf0, 0x1e, 0x7e, 0x66, 0xdb, 0x38, 0x00, 0x7e, 0x7e, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0xfe, 0x00, 0x81, 0xff, 0x00, 0x00, 0x18, 0x18, 0x00, 0xff, 0x00, 0xff, 0x0e, 0x66, 0x33, 0x63, 0x18, 0xe0, 0x0e, 0x3c, 0x66, 0xdb, 0x60, 0x00, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x1e, 0x3c, 0x3f, 0x7f, 0x00, 0xc0, 0x06, 0x18, 0x66, 0x7f, 0xc6, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; curses-1.4.4/vendor/PDCurses/sdl2/pdcscrn.c0000644000004100000410000002537614201713275020524 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcsdl.h" #include #ifndef PDC_WIDE # include "deffont.h" #endif #include "deficon.h" #ifdef PDC_WIDE # ifndef PDC_FONT_PATH # ifdef _WIN32 # define PDC_FONT_PATH "C:/Windows/Fonts/lucon.ttf" # elif defined(__APPLE__) # define PDC_FONT_PATH "/Library/Fonts/Courier New.ttf" # else # define PDC_FONT_PATH "/usr/share/fonts/truetype/freefont/FreeMono.ttf" # endif # endif TTF_Font *pdc_ttffont = NULL; int pdc_font_size = 18; #endif SDL_Window *pdc_window = NULL; SDL_Surface *pdc_screen = NULL, *pdc_font = NULL, *pdc_icon = NULL, *pdc_back = NULL, *pdc_tileback = NULL; int pdc_sheight = 0, pdc_swidth = 0, pdc_yoffset = 0, pdc_xoffset = 0; SDL_Color pdc_color[256]; Uint32 pdc_mapped[256]; int pdc_fheight, pdc_fwidth, pdc_flastc; bool pdc_own_window; /* special purpose function keys */ static int PDC_shutdown_key[PDC_MAX_FUNCTION_KEYS] = { 0, 0, 0, 0, 0 }; /* COLOR_PAIR to attribute encoding table. */ static struct {short f, b;} atrtab[PDC_COLOR_PAIRS]; static void _clean(void) { #ifdef PDC_WIDE if (pdc_ttffont) { TTF_CloseFont(pdc_ttffont); TTF_Quit(); } #endif SDL_FreeSurface(pdc_tileback); SDL_FreeSurface(pdc_back); SDL_FreeSurface(pdc_icon); SDL_FreeSurface(pdc_font); SDL_DestroyWindow(pdc_window); SDL_Quit(); } void PDC_retile(void) { if (pdc_tileback) SDL_FreeSurface(pdc_tileback); pdc_tileback = SDL_ConvertSurface(pdc_screen, pdc_screen->format, 0); if (pdc_tileback == NULL) return; if (pdc_back) { SDL_Rect dest; dest.y = 0; while (dest.y < pdc_tileback->h) { dest.x = 0; while (dest.x < pdc_tileback->w) { SDL_BlitSurface(pdc_back, 0, pdc_tileback, &dest); dest.x += pdc_back->w; } dest.y += pdc_back->h; } SDL_BlitSurface(pdc_tileback, 0, pdc_screen, 0); } } void PDC_scr_close(void) { PDC_LOG(("PDC_scr_close() - called\n")); } void PDC_scr_free(void) { if (SP) free(SP); } /* This is called twice a second, in a separate thread, and 'pushes' an event to the main thread. See https://wiki.libsdl.org/SDL_AddTimer for more info. The result redraws cursor and blinking text every 500 ms. */ Uint32 timer_callback( Uint32 interval, void *param) { SDL_Event event; event.type = SDL_USEREVENT; SDL_PushEvent( &event); return( interval); } static int default_pdc_swidth = 80, default_pdc_sheight = 25; /* open the physical screen -- allocate SP, miscellaneous intialization */ int PDC_scr_open(int argc, char **argv) { int i, r, g, b; PDC_LOG(("PDC_scr_open() - called\n")); SP = calloc(1, sizeof(SCREEN)); if (!SP) return ERR; pdc_own_window = !pdc_window; if (pdc_own_window) { if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_EVENTS) < 0) { fprintf(stderr, "Could not start SDL: %s\n", SDL_GetError()); return ERR; } SDL_AddTimer( 500, timer_callback, NULL); /* 500 millisec blink */ atexit(_clean); } #ifdef PDC_WIDE if (!pdc_ttffont) { const char *ptsz, *fname; if (TTF_Init() == -1) { fprintf(stderr, "Could not start SDL_TTF: %s\n", SDL_GetError()); return ERR; } ptsz = getenv("PDC_FONT_SIZE"); if (ptsz != NULL) pdc_font_size = atoi(ptsz); if (pdc_font_size <= 0) pdc_font_size = 18; fname = getenv("PDC_FONT"); pdc_ttffont = TTF_OpenFont(fname ? fname : PDC_FONT_PATH, pdc_font_size); } if (!pdc_ttffont) { fprintf(stderr, "Could not load font\n"); return ERR; } TTF_SetFontKerning(pdc_ttffont, 0); TTF_SetFontHinting(pdc_ttffont, TTF_HINTING_MONO); SP->mono = FALSE; #else if (!pdc_font) { const char *fname = getenv("PDC_FONT"); pdc_font = SDL_LoadBMP(fname ? fname : "pdcfont.bmp"); } if (!pdc_font) pdc_font = SDL_LoadBMP_RW(SDL_RWFromMem(deffont, sizeof(deffont)), 0); if (!pdc_font) { fprintf(stderr, "Could not load font\n"); return ERR; } SP->mono = !pdc_font->format->palette; #endif if (!SP->mono && !pdc_back) { const char *bname = getenv("PDC_BACKGROUND"); pdc_back = SDL_LoadBMP(bname ? bname : "pdcback.bmp"); } if (!SP->mono && (pdc_back || !pdc_own_window)) { SP->orig_attr = TRUE; SP->orig_fore = COLOR_WHITE; SP->orig_back = -1; } else SP->orig_attr = FALSE; #ifdef PDC_WIDE TTF_SizeText(pdc_ttffont, "W", &pdc_fwidth, &pdc_fheight); #else pdc_fheight = pdc_font->h / 8; pdc_fwidth = pdc_font->w / 32; if (!SP->mono) pdc_flastc = pdc_font->format->palette->ncolors - 1; #endif if (pdc_own_window && !pdc_icon) { const char *iname = getenv("PDC_ICON"); pdc_icon = SDL_LoadBMP(iname ? iname : "pdcicon.bmp"); if (!pdc_icon) pdc_icon = SDL_LoadBMP_RW(SDL_RWFromMem(deficon, sizeof(deficon)), 0); } if (pdc_own_window) { const char *env = getenv("PDC_LINES"); pdc_sheight = (env ? atoi(env) : default_pdc_sheight) * pdc_fheight; env = getenv("PDC_COLS"); pdc_swidth = (env ? atoi(env) : default_pdc_swidth) * pdc_fwidth; pdc_window = SDL_CreateWindow((argc ? argv[0] : "PDCurses"), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, pdc_swidth, pdc_sheight, SDL_WINDOW_RESIZABLE); if (pdc_window == NULL) { fprintf(stderr, "Could not open SDL window: %s\n", SDL_GetError()); return ERR; } SDL_SetWindowIcon(pdc_window, pdc_icon); /* Events must be pumped before calling SDL_GetWindowSurface, or initial modifiers (e.g. numlock) will be ignored and out-of-sync. */ SDL_PumpEvents(); pdc_screen = SDL_GetWindowSurface(pdc_window); if (pdc_screen == NULL) { fprintf(stderr, "Could not open SDL window surface: %s\n", SDL_GetError()); return ERR; } } else { if (!pdc_screen) pdc_screen = SDL_GetWindowSurface(pdc_window); if (!pdc_sheight) pdc_sheight = pdc_screen->h - pdc_yoffset; if (!pdc_swidth) pdc_swidth = pdc_screen->w - pdc_xoffset; } if (!pdc_screen) { fprintf(stderr, "Couldn't create a surface: %s\n", SDL_GetError()); return ERR; } if (SP->orig_attr) PDC_retile(); COLORS = 256; /* we have 256 colors in this flavor of PDCurses */ for (i = 0; i < 8; i++) { pdc_color[i].r = (i & COLOR_RED) ? 0xc0 : 0; pdc_color[i].g = (i & COLOR_GREEN) ? 0xc0 : 0; pdc_color[i].b = (i & COLOR_BLUE) ? 0xc0 : 0; pdc_color[i + 8].r = (i & COLOR_RED) ? 0xff : 0x40; pdc_color[i + 8].g = (i & COLOR_GREEN) ? 0xff : 0x40; pdc_color[i + 8].b = (i & COLOR_BLUE) ? 0xff : 0x40; } /* 256-color xterm extended palette: 216 colors in a 6x6x6 color cube, plus 24 (not 50) shades of gray */ i = 16; for( r = 0; r < 6; r++) for( g = 0; g < 6; g++) for( b = 0; b < 6; b++, i++) { pdc_color[i].r = ( r ? r * 40 + 55 : 0); pdc_color[i].g = ( g ? g * 40 + 55 : 0); pdc_color[i].b = ( b ? b * 40 + 55 : 0); } for( i = 232; i < 256; i++) pdc_color[i].r = pdc_color[i].g = pdc_color[i].b = (i - 232) * 10 + 8; for (i = 0; i < 256; i++) pdc_mapped[i] = SDL_MapRGB(pdc_screen->format, pdc_color[i].r, pdc_color[i].g, pdc_color[i].b); SDL_StartTextInput(); PDC_mouse_set(); if (pdc_own_window) PDC_set_title(argc ? argv[0] : "PDCurses"); SP->lines = PDC_get_rows(); SP->cols = PDC_get_columns(); SP->mouse_wait = PDC_CLICK_PERIOD; SP->audible = FALSE; PDC_reset_prog_mode(); return OK; } /* the core of resize_term() */ int PDC_resize_screen(int nlines, int ncols) { if (!stdscr) /* window hasn't been created yet; we're */ { /* specifying its size before doing so */ default_pdc_swidth = ncols; default_pdc_sheight = nlines; return OK; } if (!pdc_own_window) return ERR; if (nlines && ncols) { pdc_sheight = nlines * pdc_fheight; pdc_swidth = ncols * pdc_fwidth; } SDL_SetWindowSize(pdc_window, pdc_swidth, pdc_sheight); pdc_screen = SDL_GetWindowSurface(pdc_window); if (pdc_tileback) PDC_retile(); SP->resized = FALSE; SP->cursrow = SP->curscol = 0; return OK; } void PDC_reset_prog_mode(void) { PDC_LOG(("PDC_reset_prog_mode() - called.\n")); PDC_flushinp(); } void PDC_reset_shell_mode(void) { PDC_LOG(("PDC_reset_shell_mode() - called.\n")); PDC_flushinp(); } void PDC_restore_screen_mode(int i) { } void PDC_save_screen_mode(int i) { } void PDC_init_pair(short pair, short fg, short bg) { atrtab[pair].f = fg; atrtab[pair].b = bg; } int PDC_pair_content(short pair, short *fg, short *bg) { *fg = atrtab[pair].f; *bg = atrtab[pair].b; return OK; } bool PDC_can_change_color(void) { return TRUE; } int PDC_color_content(short color, short *red, short *green, short *blue) { *red = DIVROUND(pdc_color[color].r * 1000, 255); *green = DIVROUND(pdc_color[color].g * 1000, 255); *blue = DIVROUND(pdc_color[color].b * 1000, 255); return OK; } int PDC_init_color(short color, short red, short green, short blue) { pdc_color[color].r = DIVROUND(red * 255, 1000); pdc_color[color].g = DIVROUND(green * 255, 1000); pdc_color[color].b = DIVROUND(blue * 255, 1000); pdc_mapped[color] = SDL_MapRGB(pdc_screen->format, pdc_color[color].r, pdc_color[color].g, pdc_color[color].b); wrefresh(curscr); return OK; } /* Does nothing in the SDL flavors of PDCurses. That may change, eventually, allowing one to limit the range of user-resizable windows. See X11 or Win32a versions of this function for details. */ void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines, const int new_min_cols, const int new_max_cols) { } /* PDC_set_function_key() does nothing on this platform */ int PDC_set_function_key( const unsigned function, const int new_key) { int old_key = -1; if( function < PDC_MAX_FUNCTION_KEYS) { old_key = PDC_shutdown_key[function]; PDC_shutdown_key[function] = new_key; } return( old_key); } curses-1.4.4/vendor/PDCurses/wingui/0000755000004100000410000000000014201713275017345 5ustar www-datawww-datacurses-1.4.4/vendor/PDCurses/wingui/pdcurses.ico0000644000004100000410000000206614201713275021675 0ustar www-datawww-data è&(( @€€€€€€€€€€ÀÀÀ€€€ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÎoœçµ¯k[½¯ëû½¯˜ç½¯{_µ¥k[Í«œçÿÿÿÿÿÿÿÿÿÏÿÿÎÿÿÌsÿÿÌóÿÿÌóÿÿÌsÿÿÆ3ÿÿÃÿÿÁƒÿÿÈÃÿÿÌcÿÿÎ3ÿÿÏ3ÿÿÏ3ÿÿÎ3ÿÿÀsÿÿÀóÿÿÿÿÿÿÿÿÿÿÿÿÿ( À€€€€€€€€€ÀÀÀ€€€ÿÿÿÿÿÿÿÿÿÿÿÿ‚kžjjÓˆÿÿûúßúßû_ùŸúßû_û_øßÿÿcurses-1.4.4/vendor/PDCurses/wingui/Makefile.lcc0000644000004100000410000001234114201713275021546 0ustar www-datawww-data# Makefile for PDCurses library - WIN32 LCC-Win32 # # Usage: make -f Makefile.lcc [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] PDCURSES_SRCDIR = .. PDCURSES_CURSES_H = $(PDCURSES_SRCDIR)\curses.h PDCURSES_CURSPRIV_H = $(PDCURSES_SRCDIR)\curspriv.h PDCURSES_HEADERS = $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H) PANEL_HEADER = $(PDCURSES_SRCDIR)\panel.h TERM_HEADER = $(PDCURSES_SRCDIR)\term.h srcdir = $(PDCURSES_SRCDIR)\pdcurses osdir = $(PDCURSES_SRCDIR)\wingui demodir = $(PDCURSES_SRCDIR)\demos PDCURSES_WIN_H = $(osdir)\pdcwin.h CC = lcc #CFLAGS = -c -g3 -A -ansic CFLAGS = -c -O -A -ansic CPPFLAGS = -I$(PDCURSES_SRCDIR) #-DPDC_WIDE -DPDC_FORCE_UTF8 LINK = lcclnk LIBEXE = lcclib LIBCURSES = pdcurses.lib BUILD = $(CC) $(CFLAGS) $(CPPFLAGS) PDCLIBS = $(LIBCURSES) DEMOS = testcurs.exe ozdemo.exe xmas.exe tuidemo.exe \ firework.exe ptest.exe rain.exe worm.exe all: $(PDCLIBS) $(DEMOS) clean: -del *.obj -del *.lib -del *.exe LIBOBJS = addch.obj addchstr.obj addstr.obj attr.obj beep.obj bkgd.obj \ border.obj clear.obj color.obj delch.obj deleteln.obj deprec.obj getch.obj \ getstr.obj getyx.obj inch.obj inchstr.obj initscr.obj inopts.obj \ insch.obj insstr.obj instr.obj kernel.obj keyname.obj mouse.obj move.obj \ outopts.obj overlay.obj pad.obj panel.obj printw.obj refresh.obj \ scanw.obj scr_dump.obj scroll.obj slk.obj termattr.obj terminfo.obj \ touch.obj util.obj window.obj debug.obj PDCOBJS = pdcclip.obj pdcdisp.obj pdcgetsc.obj pdckbd.obj pdcscrn.obj \ pdcsetsc.obj pdcutil.obj DEMOOBJS = testcurs.obj ozdemo.obj xmas.obj tuidemo.obj tui.obj \ firework.obj ptest.obj rain.obj worm.obj $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_WIN_H) panel.obj ptest.obj: $(PANEL_HEADER) terminfo.obj: $(TERM_HEADER) $(DEMOOBJS) : $(PDCURSES_CURSES_H) $(DEMOS) : $(LIBCURSES) $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) /out:$@ $(LIBOBJS) $(PDCOBJS) -copy $(LIBCURSES) panel.lib SRCBUILD = $(BUILD) $(srcdir)\$*.c OSBUILD = $(BUILD) $(osdir)\$*.c addch.obj: $(srcdir)\addch.c $(SRCBUILD) addchstr.obj: $(srcdir)\addchstr.c $(SRCBUILD) addstr.obj: $(srcdir)\addstr.c $(SRCBUILD) attr.obj: $(srcdir)\attr.c $(SRCBUILD) beep.obj: $(srcdir)\beep.c $(SRCBUILD) bkgd.obj: $(srcdir)\bkgd.c $(SRCBUILD) border.obj: $(srcdir)\border.c $(SRCBUILD) clear.obj: $(srcdir)\clear.c $(SRCBUILD) color.obj: $(srcdir)\color.c $(SRCBUILD) delch.obj: $(srcdir)\delch.c $(SRCBUILD) deleteln.obj: $(srcdir)\deleteln.c $(SRCBUILD) deprec.obj: $(srcdir)\deprec.c $(SRCBUILD) getch.obj: $(srcdir)\getch.c $(SRCBUILD) getstr.obj: $(srcdir)\getstr.c $(SRCBUILD) getyx.obj: $(srcdir)\getyx.c $(SRCBUILD) inch.obj: $(srcdir)\inch.c $(SRCBUILD) inchstr.obj: $(srcdir)\inchstr.c $(SRCBUILD) initscr.obj: $(srcdir)\initscr.c $(SRCBUILD) inopts.obj: $(srcdir)\inopts.c $(SRCBUILD) insch.obj: $(srcdir)\insch.c $(SRCBUILD) insstr.obj: $(srcdir)\insstr.c $(SRCBUILD) instr.obj: $(srcdir)\instr.c $(SRCBUILD) kernel.obj: $(srcdir)\kernel.c $(SRCBUILD) keyname.obj: $(srcdir)\keyname.c $(SRCBUILD) mouse.obj: $(srcdir)\mouse.c $(SRCBUILD) move.obj: $(srcdir)\move.c $(SRCBUILD) outopts.obj: $(srcdir)\outopts.c $(SRCBUILD) overlay.obj: $(srcdir)\overlay.c $(SRCBUILD) pad.obj: $(srcdir)\pad.c $(SRCBUILD) panel.obj: $(srcdir)\panel.c $(SRCBUILD) printw.obj: $(srcdir)\printw.c $(SRCBUILD) refresh.obj: $(srcdir)\refresh.c $(SRCBUILD) scanw.obj: $(srcdir)\scanw.c $(SRCBUILD) scr_dump.obj: $(srcdir)\scr_dump.c $(SRCBUILD) scroll.obj: $(srcdir)\scroll.c $(SRCBUILD) slk.obj: $(srcdir)\slk.c $(SRCBUILD) termattr.obj: $(srcdir)\termattr.c $(SRCBUILD) terminfo.obj: $(srcdir)\terminfo.c $(SRCBUILD) touch.obj: $(srcdir)\touch.c $(SRCBUILD) util.obj: $(srcdir)\util.c $(SRCBUILD) window.obj: $(srcdir)\window.c $(SRCBUILD) debug.obj: $(srcdir)\debug.c $(SRCBUILD) pdcclip.obj: $(osdir)\pdcclip.c $(OSBUILD) pdcdisp.obj: $(osdir)\pdcdisp.c $(OSBUILD) pdcgetsc.obj: $(osdir)\pdcgetsc.c $(OSBUILD) pdckbd.obj: $(osdir)\pdckbd.c $(OSBUILD) pdcscrn.obj: $(osdir)\pdcscrn.c $(OSBUILD) pdcsetsc.obj: $(osdir)\pdcsetsc.c $(OSBUILD) pdcutil.obj: $(osdir)\pdcutil.c $(OSBUILD) firework.exe: firework.obj $(LINK) -o $@ firework.obj $(LIBCURSES) ozdemo.exe: ozdemo.obj $(LINK) -o $@ ozdemo.obj $(LIBCURSES) ptest.exe: ptest.obj $(LINK) -o $@ ptest.obj $(LIBCURSES) rain.exe: rain.obj $(LINK) -o $@ rain.obj $(LIBCURSES) testcurs.exe: testcurs.obj $(LINK) -o $@ testcurs.obj $(LIBCURSES) tuidemo.exe: tuidemo.obj tui.obj $(LINK) -o $@ tuidemo.obj tui.obj $(LIBCURSES) worm.exe: worm.obj $(LINK) -o $@ worm.obj $(LIBCURSES) xmas.exe: xmas.obj $(LINK) -o $@ xmas.obj $(LIBCURSES) firework.obj: $(demodir)\firework.c $(BUILD) $(demodir)\$*.c ozdemo.obj: $(demodir)\ozdemo.c $(BUILD) $(demodir)\$*.c ptest.obj: $(demodir)\ptest.c $(BUILD) $(demodir)\$*.c rain.obj: $(demodir)\rain.c $(BUILD) $(demodir)\$*.c testcurs.obj: $(demodir)\testcurs.c $(BUILD) $(demodir)\$*.c tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(BUILD) -I$(demodir) $(demodir)\$*.c tuidemo.obj: $(demodir)\tuidemo.c $(BUILD) -I$(demodir) $(demodir)\$*.c worm.obj: $(demodir)\worm.c $(BUILD) $(demodir)\$*.c xmas.obj: $(demodir)\xmas.c $(BUILD) $(demodir)\$*.c curses-1.4.4/vendor/PDCurses/wingui/Makefile.wcc0000644000004100000410000000211014201713275021552 0ustar www-datawww-data# Watcom WMAKE Makefile for PDCurses library - Win32 Watcom C/C++ 10.6+ # # Usage: wmake -f [wingui/]Makefile.wcc [DEBUG=Y] [WIDE=Y] [UTF8=Y] [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] !ifdef %PDCURSES_SRCDIR PDCURSES_SRCDIR = $(%PDCURSES_SRCDIR) !else PDCURSES_SRCDIR = .. !endif !include $(PDCURSES_SRCDIR)/version.mif osdir = $(PDCURSES_SRCDIR)/wingui CC = wcc386 TARGET = nt_win CFLAGS = -ei -zq -wx -i=$(PDCURSES_SRCDIR) !ifeq DEBUG Y CFLAGS += -hd -od -d2 -dDEBUG -DPDCDEBUG LDFLAGS = DEBUG ALL op q sys $(TARGET) !else CFLAGS += -oneatx LDFLAGS = op q sys $(TARGET) !endif !ifeq WIDE Y CFLAGS += -DPDC_WIDE !endif !ifeq UTF8 Y CFLAGS += -DPDC_FORCE_UTF8 !endif LIBEXE = wlib -q -n -t !include $(PDCURSES_SRCDIR)/watcom.mif $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) $@ $(LIBOBJS) $(PDCOBJS) copy $(LIBCURSES) panel.lib PLATFORM1 = Watcom C++ WinGUI PLATFORM2 = Open Watcom 1.6 for WinGUI ARCNAME = pdc$(VER)_wcc_w32 !include $(PDCURSES_SRCDIR)/makedist.mif curses-1.4.4/vendor/PDCurses/wingui/README.md0000644000004100000410000000650514201713275020632 0ustar www-datawww-dataPDCurses for WinGUI ================== This directory contains PDCurses source code files specific to Win32 graphics mode (Win95 and all subsequent forks of Windows). Building -------- (Note that the following is almost identical to the instructions for the Win32 console flavor of PDCurses.) - Choose the appropriate makefile for your compiler: Makefile.bcc - Borland C++ 4.0.2+ Makefile.dmc - Digital Mars Makefile.lcc - LCC-Win32 Makefile.mng - MinGW, Cygnus GNU Compiler Makefile.vc - Microsoft Visual C++ 2.0+ or later & Intel(R) compiler Makefile.wcc - Watcom 10.6+ or OpenWATCOM - Optionally, you can build in a different directory than the platform directory by setting PDCURSES_SRCDIR to point to the directory where you unpacked PDCurses, and changing to your target directory: set PDCURSES_SRCDIR=c:\pdcurses This won't work with the LCC or Digital Mars makefiles, nor will the options described below. - Build it: make -f makefilename (For Watcom, use "wmake" instead of "make"; for MSVC, "nmake".) You'll get the libraries (pdcurses.lib or .a, depending on your compiler; and panel.lib or .a), the demos (*.exe), and a lot of object files. Note that the panel library is just a copy of the main library, provided for convenience; both panel and curses functions are in the main library. You can also give the optional parameter "WIDE=Y", to build the library with wide-character (Unicode) support: make -f Makefile.mng WIDE=Y When built this way, the library is not compatible with Windows 9x, unless you also link with the Microsoft Layer for Unicode (not tested). For the Intel(R) compiler, use Makefile.vc and add ICC=Y. By default, Makefile.vc results in 64-bit code for both VC and Intel(R). Add IX86=Y to generate 32-bit code. (Other builds are 32-bit only.) Another option, "UTF8=Y", makes PDCurses ignore the system locale, and treat all narrow-character strings as UTF-8. This option has no effect unless WIDE=Y is also set. This was originally provided to get around poor support for UTF-8 in the Win32 console: make -f Makefile.mng WIDE=Y UTF8=Y WinGUI doesn't have the same limitations as the Win32 console flavor, but UTF-8 and non-UTF-8 versions are still available. If nothing else, this means that if you've built a Win32 console PDCurses DLL with any configuration, you can build a matching WinGUI DLL and swap between console or GUI PDCurses just by swapping DLLs. You can also use the optional parameter "DLL=Y" with Visual C++, MinGW or Cygwin, to build the library as a DLL: nmake -f Makefile.vc WIDE=Y DLL=Y When you build the library as a Windows DLL, you must always define PDC_DLL_BUILD when linking against it. (Or, if you only want to use the DLL, you could add this definition to your curses.h.) If cross-compiling from Linux, add the parameter `_w64=1` to get 64-bit code (default will be 32-bit). make -f Makefile.mng _w64=1 [WIDE=Y UTF8=Y DLL=Y] Distribution Status ------------------- The files in this directory are released to the Public Domain. Acknowledgements ---------------- Based heavily on the Win32 console flavor of PDCurses by Chris Szurgot , ported to Win32 GUI by Bill Gray . curses-1.4.4/vendor/PDCurses/wingui/pdckbd.c0000644000004100000410000000745314201713275020751 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcwin.h" #include /*man-start************************************************************** Name: pdckbd Synopsis: unsigned long PDC_get_input_fd(void); Description: PDC_get_input_fd() returns the file descriptor that PDCurses reads its input from. It can be used for select(). (For the WinGUI version, it's meaningless and returns zero.) Portability X/Open BSD SYS V PDC_get_input_fd - - - **man-end****************************************************************/ unsigned long PDC_get_input_fd(void) { PDC_LOG(("PDC_get_input_fd() - called\n")); return 0L; } void PDC_set_keyboard_binary(bool on) { PDC_LOG(("PDC_set_keyboard_binary() - called\n")); } /* check if a key or mouse event is waiting */ #define KEY_QUEUE_SIZE 30 extern int PDC_key_queue_low, PDC_key_queue_high; extern int PDC_key_queue[KEY_QUEUE_SIZE]; static TCHAR *clipboard_contents; static long clipboard_len; int PDC_getclipboard_handle( HANDLE *handle); /* pdcclip.c */ /* When copying the clipboard contents for use in the key */ /* queue, we leave out the line feeds. We also don't do */ /* it at all if 'clipboard_contents' is already full. */ void PDC_add_clipboard_to_key_queue( void) { long i, j; HANDLE handle; if( !clipboard_contents) if( PDC_getclipboard_handle( &handle) == PDC_CLIP_SUCCESS) { #ifdef PDC_WIDE const long len = (long)wcslen((wchar_t *)handle); #else const long len = (long)strlen((char *)handle); #endif clipboard_contents = (TCHAR *)calloc( len + 1, sizeof( TCHAR)); memcpy( clipboard_contents, (TCHAR *)handle, (len + 1) * sizeof( TCHAR)); CloseClipboard( ); for( i = j = 0; i < len; i++) if( clipboard_contents[i] != 10) clipboard_contents[j++] = clipboard_contents[i]; clipboard_len = j; } } /* PDCurses message/event callback */ /* Calling PDC_napms for one millisecond ensures that the message loop */ /* is called and messages in general, and keyboard events in particular, */ /* get processed. */ bool PDC_check_key(void) { PDC_napms( 1); if( PDC_key_queue_low != PDC_key_queue_high || clipboard_len) return TRUE; return FALSE; } /* return the next available key or mouse event */ int PDC_get_key(void) { int rval = -1; if( PDC_key_queue_low != PDC_key_queue_high) { rval = PDC_key_queue[PDC_key_queue_low++]; if( PDC_key_queue_low == KEY_QUEUE_SIZE) PDC_key_queue_low = 0; } else if( clipboard_len) { rval = *clipboard_contents; clipboard_len--; memmove( clipboard_contents, clipboard_contents + 1, clipboard_len * sizeof( TCHAR)); if( !clipboard_len) { free( clipboard_contents); clipboard_contents = NULL; } } SP->key_code = (rval >= KEY_MIN && rval <= KEY_MAX); return rval; } /* discard any pending keyboard or mouse input -- this is the core routine for flushinp() */ void PDC_flushinp(void) { PDC_LOG(("PDC_flushinp() - called\n")); PDC_key_queue_low = PDC_key_queue_high = 0; if( clipboard_len) { free( clipboard_contents); clipboard_contents = NULL; clipboard_len = 0; } } int PDC_mouse_set(void) { /* If turning on mouse input: Set ENABLE_MOUSE_INPUT, and clear all other flags, including the extended flags; If turning off the mouse: Set QuickEdit Mode to the status it had on startup, and clear all other flags */ return OK; } int PDC_modifiers_set(void) { return OK; } curses-1.4.4/vendor/PDCurses/wingui/pdcsetsc.c0000644000004100000410000000645514201713275021333 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcwin.h" /*man-start************************************************************** Name: pdcsetsc Synopsis: int PDC_set_blink(bool blinkon); void PDC_set_title(const char *title); Description: PDC_set_blink() toggles whether the A_BLINK attribute sets an actual blink mode (TRUE), or sets the background color to high intensity (FALSE). The default is platform-dependent (FALSE in most cases). It returns OK if it could set the state to match the given parameter, ERR otherwise. Current platforms also adjust the value of COLORS according to this function -- 16 for FALSE, and 8 for TRUE. PDC_set_title() sets the title of the window in which the curses program is running. This function may not do anything on some platforms. (Currently it only works in Win32 and X11.) Portability X/Open BSD SYS V PDC_set_blink - - - PDC_set_title - - - **man-end****************************************************************/ /* Note that the following is a line-for-line */ /* copy of the SDL version of this function. */ int PDC_curs_set(int visibility) { int ret_vis; PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); ret_vis = SP->visibility; SP->visibility = visibility; PDC_gotoyx(SP->cursrow, SP->curscol); return ret_vis; } void PDC_set_title(const char *title) { extern HWND PDC_hWnd; #ifdef PDC_WIDE wchar_t wtitle[512]; #endif PDC_LOG(("PDC_set_title() - called:<%s>\n", title)); #ifdef PDC_WIDE PDC_mbstowcs(wtitle, title, 511); SetWindowTextW( PDC_hWnd, wtitle); #else SetWindowTextA( PDC_hWnd, title); #endif } /* If PDC_really_blinking is TRUE, then text with the A_BLINK */ /* attribute will actually blink. Otherwise, such text will */ /* be shown with higher color intensity (the R, G, and B values */ /* are averaged with pure white). See pdcdisp.c for details of */ /* how this is done. */ /* Unlike on other PDCurses platforms, this doesn't require */ /* decreasing the number of colors by half. Also, the choice */ /* indicated by 'blinkon' will actually be respected, so OK is */ /* always returned (most platforms don't actually support */ /* blinking). */ /* The default behavior is to not show A_BLINK text as */ /* blinking, i.e., PDC_really_blinking = FALSE. Blinking text */ /* can be pretty annoying to some people. You should probably */ /* call PDC_set_blink( TRUE) only if there is something to which */ /* the user _must_ pay attention; say, "the nuclear reactor */ /* is about to melt down". Otherwise, the bolder, brighter */ /* text should be attention-getting enough. */ int PDC_really_blinking = FALSE; int PDC_set_blink(bool blinkon) { PDC_really_blinking = blinkon; return OK; } curses-1.4.4/vendor/PDCurses/wingui/Makefile.vc0000644000004100000410000000630614201713275021421 0ustar www-datawww-data# Visual C++ & Intel(R) NMakefile for PDCurses library - Win32 VC++ 2.0+ # # Usage: nmake -f [path\]Makefile.vc [DEBUG=] [DLL=] [WIDE=] [UTF8=] # [ICC=] [CHTYPE_32=] [IX86=] [CHTYPE_16=] [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] # CHTYPE_## is used to override the default 64-bit chtypes in favor # of "traditional" 32- or 16-bit chtypes. # IX86 is used to build 32-bit code instead of 64-bit # ICC is used to invoke Intel (R) tools icl.exe and xilink.exe, instead of # MS tools cl.exe and link.exe O = obj !ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. !endif !ifdef IX86 PLATFORM=IX86 !else PLATFORM=X64 !endif !include $(PDCURSES_SRCDIR)\version.mif !include $(PDCURSES_SRCDIR)\libobjs.mif osdir = $(PDCURSES_SRCDIR)\wingui PDCURSES_WIN_H = $(osdir)\pdcwin.h !ifdef ICC CC = icl.exe -nologo LINK = xilink.exe -nologo !else CC = cl.exe -nologo LINK = link.exe -nologo !endif !ifdef DEBUG CFLAGS = -Z7 -DPDCDEBUG -MT -D_CRT_SECURE_NO_WARNINGS LDFLAGS = -debug -pdb:none !else CFLAGS = -Ox -MT -W3 -D_CRT_SECURE_NO_WARNINGS LDFLAGS = !endif !ifdef WIDE WIDEOPT = -DPDC_WIDE !endif !ifdef UTF8 UTF8OPT = -DPDC_FORCE_UTF8 !endif !ifdef CHTYPE_32 CHTYPE_FLAGS= -DCHTYPE_32 !endif !ifdef CHTYPE_16 CHTYPE_FLAGS= -DCHTYPE_16 !endif SHL_LD = link $(LDFLAGS) /NOLOGO /DLL /MACHINE:$(PLATFORM) /OUT:pdcurses.dll CCLIBS = user32.lib gdi32.lib advapi32.lib shell32.lib comdlg32.lib # may need to add msvcrt.lib for VC 2.x, VC 5.0 doesn't want it #CCLIBS = msvcrt.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib LIBEXE = lib -nologo LIBCURSES = pdcurses.lib CURSESDLL = pdcurses.dll !ifdef DLL DLLOPT = -DPDC_DLL_BUILD PDCLIBS = $(CURSESDLL) !else PDCLIBS = $(LIBCURSES) !endif BUILD = $(CC) -I$(PDCURSES_SRCDIR) -c $(CFLAGS) $(CHTYPE_FLAGS) $(DLLOPT) \ $(WIDEOPT) $(UTF8OPT) all: $(PDCLIBS) clean: -del *.obj -del *.lib -del *.exe -del *.dll -del *.exp -del *.res demos: $(DEMOS) DEMOOBJS = $(DEMOS:.exe=.obj) tui.obj $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_WIN_H) $(DEMOOBJS) : $(PDCURSES_CURSES_H) $(DEMOS) : $(LIBCURSES) panel.obj : $(PANEL_HEADER) terminfo.obj: $(TERM_HEADER) !ifndef DLL $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) -out:$@ $(LIBOBJS) $(PDCOBJS) !endif $(CURSESDLL) : $(LIBOBJS) $(PDCOBJS) pdcurses.obj $(SHL_LD) $(LIBOBJS) $(PDCOBJS) pdcurses.obj $(CCLIBS) pdcurses.res pdcurses.obj: $(osdir)\pdcurses.rc $(osdir)\pdcurses.ico rc /r /fopdcurses.res $(osdir)\pdcurses.rc cvtres /MACHINE:$(PLATFORM) /NOLOGO /OUT:pdcurses.obj pdcurses.res {$(srcdir)\}.c{}.obj:: $(BUILD) $< {$(osdir)\}.c{}.obj:: $(BUILD) $< {$(demodir)\}.c{}.obj:: $(BUILD) $< .obj.exe: $(LINK) $(LDFLAGS) $< $(LIBCURSES) $(CCLIBS) tuidemo.exe: tuidemo.obj tui.obj $(LINK) $(LDFLAGS) $*.obj tui.obj $(LIBCURSES) $(CCLIBS) tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(BUILD) -I$(demodir) $(demodir)\tui.c tuidemo.obj: $(demodir)\tuidemo.c $(BUILD) -I$(demodir) $(demodir)\tuidemo.c PLATFORM1 = Visual C++ PLATFORM2 = Microsoft Visual C/C++ for Win32 ARCNAME = pdc$(VER)_vc_w32 !include $(PDCURSES_SRCDIR)\makedist.mif curses-1.4.4/vendor/PDCurses/wingui/pdcgetsc.c0000644000004100000410000000074714201713275021315 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcwin.h" /* get the cursor size/shape */ int PDC_get_cursor_mode(void) { PDC_LOG(("PDC_get_cursor_mode() - called\n")); return SP->visibility; } /* return number of screen rows */ int PDC_get_rows(void) { extern int PDC_n_rows; PDC_LOG(("PDC_get_rows() - called\n")); return( PDC_n_rows); } int PDC_get_columns(void) { extern int PDC_n_cols; PDC_LOG(("PDC_get_columns() - called\n")); return( PDC_n_cols); } curses-1.4.4/vendor/PDCurses/wingui/pdcdisp.c0000644000004100000410000006217514201713275021152 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcwin.h" #include #include #include #include /* For this 'real Windows' version, we use all Unicode all the time, including for ACS characters, and even when PDC_WIDE isn't #defined (i.e., when running in 'legacy' 8-bit character mode) See 'acs_defs.h' for details. */ #define USE_UNICODE_ACS_CHARS 1 #include "acs_defs.h" static const unsigned short starting_ascii_to_unicode[32] = { 0, 0x263a, /* 1 smiling face */ 0x263b, /* 2 smiling face inverted */ 0x2665, /* 3 heart */ 0x2666, /* 4 diamond */ 0x2663, /* 5 club */ 0x2660, /* 6 spade */ 0x2024, /* 7 small bullet */ 0x25d8, /* 8 inverted bullet */ 0x25bc, /* 9 hollow bullet */ 0x25d9, /* 10 inverted hollow bullet */ 0x2642, /* 11 male/Mars symbol */ 0x2640, /* 12 female/Venus symbol */ 0x266a, /* 13 eighth note */ 0x266c, /* 14 two sixteenth notes */ 0x263c, /* 15 splat */ 0x25b6, /* 16 right-pointing triangle */ 0x25c0, /* 17 left-pointing triangle */ 0x2195, /* 18 double up/down arrow */ 0x203c, /* 19 double exclamation !! */ 0x00b6, /* 20 pilcrow */ 0xa7, /* 21 */ 0x2582, /* 22 lower 1/3 block */ 0x280d, /* 23 double up/down arrow */ 0x2191, /* 24 up arrow */ 0x2193, /* 25 down arrow */ 0x2192, /* 26 right arrow */ 0x2190, /* 27 left arrow */ 0x2319, /* 28 */ 0x280c, /* 29 left & right arrow */ 0x25b2, /* 30 up triangle */ 0x25bc}; /* 31 down triangle */ /* Cursors may be added to the 'shapes' array. A 'shapes' string defines the cursor as one or more rectangles, separated by semicolons. The coordinates of the upper left and lower right corners are given, usually just as integers from zero to eight. Thus, "0488" means a rectangle running from (0,4), middle of the left side, to (8,8), bottom right corner: a rectangle filling the bottom half of the character cell. "0048" would fill the left half of the cell, and "0082;6088" would fill the top and bottom quarters of the cell. However, a coordinate may be followed by a + or -, and then by a single-digit offset in pixels. So "08-4" refers to a point on the left-hand side of the character cell, four pixels from the bottom. I admit that the cursor descriptions themselves look a little strange! But this way of describing cursors is compact and lends itself to some pretty simple code. The first three lines are standard PDCurses cursors: 0=no cursor, 1=four-pixel thick line at bottom of the cell, 2="high-intensity", i.e., a filled block. The rest are extended cursors, not currently available in other PDCurses flavors. */ #define N_CURSORS 9 static void redraw_cursor_from_index( const HDC hdc, const int idx) { const char *shapes[N_CURSORS] = { "", /* 0: invisible */ "08-488", /* 1: normal: four lines at bottom */ "0088", /* 2: full block */ "0088;0+10+18-18-1", /* 3: outlined block */ "28-368;4-10+34+18-3;2060+3", /* 4: caret */ "0488", /* 5: bottom half block */ "2266", /* 6: central block */ "0385;3053;3558", /* 7: cross */ "0088;0+10+48-18-4" }; /* 8: outlined block: heavy top/bottom*/ const char *sptr = shapes[idx]; LONG left, top; extern int PDC_cxChar, PDC_cyChar; left = SP->curscol * PDC_cxChar; top = SP->cursrow * PDC_cyChar; while( *sptr) { int i; LONG coords[4]; RECT rect; for( i = 0; i < 4; i++) { coords[i] = (( i & 1) ? top + (PDC_cyChar * (*sptr - '0') + 4) / 8 : left + (PDC_cxChar * (*sptr - '0') + 4) / 8); sptr++; if( *sptr == '+' || *sptr == '-') { if( *sptr == '+') coords[i] += sptr[1] - '0'; else coords[i] -= sptr[1] - '0'; sptr += 2; } } rect.left = coords[0]; rect.top = coords[1]; rect.right = coords[2]; rect.bottom = coords[3]; InvertRect( hdc, &rect); if( *sptr == ';') sptr++; } } /* PDC_current_cursor_state( ) determines which cursor, if any, is currently shown. This may depend on the blink state. Also, if the window currently lacks the focus, we show cursor 3 (a hollow box) in place of any visible cursor. */ static int PDC_current_cursor_state( void) { extern int PDC_blink_state; extern HWND PDC_hWnd; const int shift_amount = (PDC_blink_state ? 0 : 8); const int cursor_style_for_unfocussed_window = PDC_CURSOR( PDC_CURSOR_OUTLINE, PDC_CURSOR_OUTLINE); int cursor_style; /* for unfocussed windows, show an hollow box: */ if( SP->visibility && (PDC_hWnd != GetForegroundWindow( ))) cursor_style = cursor_style_for_unfocussed_window; else /* otherwise, just show the cursor "normally" */ cursor_style = SP->visibility; return( (cursor_style >> shift_amount) & 0xff); } static void redraw_cursor( const HDC hdc) { const int cursor_style = PDC_current_cursor_state( ); if( cursor_style > 0 && cursor_style < N_CURSORS) redraw_cursor_from_index( hdc, cursor_style); } /* position "hardware" cursor at (y, x). We don't have a for-real hardware */ /* cursor in this version, of course, but we can fake it. Note that much */ /* of the logic was borrowed from the SDL version. In particular, the */ /* cursor is moved by first overwriting the "original" location. */ void PDC_gotoyx(int row, int col) { PDC_LOG(("PDC_gotoyx() - called: row %d col %d from row %d col %d\n", row, col, SP->cursrow, SP->curscol)); /* clear the old cursor, if it's on-screen: */ if( SP->cursrow >= 0 && SP->curscol >= 0 && SP->cursrow < SP->lines && SP->curscol < SP->cols) { const int temp_visibility = SP->visibility; SP->visibility = 0; PDC_transform_line( SP->cursrow, SP->curscol, 1, curscr->_y[SP->cursrow] + SP->curscol); SP->visibility = temp_visibility; } /* ...then draw the new (assuming it's actually visible). */ /* This used to require some logic. Now the redraw_cursor() */ /* function figures out what cursor should be drawn, if any. */ if( SP->visibility) { extern HWND PDC_hWnd; HDC hdc = GetDC( PDC_hWnd) ; SP->curscol = col; SP->cursrow = row; redraw_cursor( hdc); ReleaseDC( PDC_hWnd, hdc) ; } } int PDC_font_size = 12; TCHAR PDC_font_name[80]; static LOGFONT PDC_get_logical_font( const int font_idx) { LOGFONT lf; memset(&lf, 0, sizeof(LOGFONT)); /* Clear out structure. */ lf.lfHeight = -PDC_font_size; #ifdef PDC_WIDE if( !*PDC_font_name) wcscpy( PDC_font_name, _T("Courier New")); if( font_idx & 4) wcscpy( lf.lfFaceName, _T("Unifont")); else wcscpy( lf.lfFaceName, PDC_font_name ); /* wprintf( L"New font: %s\n", PDC_font_name); */ #else if( !*PDC_font_name) strcpy( PDC_font_name, "Courier New"); if( font_idx & 4) strcpy( lf.lfFaceName, "Unifont"); else strcpy( lf.lfFaceName, PDC_font_name); #endif /* lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN; */ lf.lfPitchAndFamily = FF_MODERN; lf.lfWeight = ((font_idx & 1) ? FW_EXTRABOLD : FW_NORMAL); lf.lfItalic = ((font_idx & 2) ? TRUE : FALSE); lf.lfCharSet = ANSI_CHARSET; lf.lfQuality = PROOF_QUALITY; lf.lfOutPrecision = OUT_RASTER_PRECIS; return( lf); } HFONT PDC_get_font_handle( const int font_idx) { LOGFONT lf = PDC_get_logical_font( font_idx); return( CreateFontIndirect( &lf)); } int debug_printf( const char *format, ...); /* pdcscrn.c */ int PDC_choose_a_new_font( void) { LOGFONT lf = PDC_get_logical_font( 0); CHOOSEFONT cf; int rval; extern HWND PDC_hWnd; lf.lfHeight = -PDC_font_size; debug_printf( "In PDC_choose_a_new_font: %d\n", lf.lfHeight); memset( &cf, 0, sizeof( CHOOSEFONT)); cf.lStructSize = sizeof( CHOOSEFONT); cf.Flags = CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS; cf.hwndOwner = PDC_hWnd; cf.lpLogFont = &lf; cf.rgbColors = RGB( 0, 0, 0); rval = ChooseFont( &cf); if( rval) #ifdef PDC_WIDE wcscpy( PDC_font_name, lf.lfFaceName); #else strcpy( PDC_font_name, lf.lfFaceName); #endif debug_printf( "rval %d; %ld\n", rval, CommDlgExtendedError( )); debug_printf( "output size: %d\n", lf.lfHeight); PDC_font_size = -lf.lfHeight; return( rval); } /* This function 'intensifies' a color by shifting it toward white. */ /* It used to average the input color with white. Then it did a */ /* weighted average: 2/3 of the input color, 1/3 white, for a */ /* lower "intensification" level. */ /* Then Mark Hessling suggested that the output level should */ /* remap zero to 85 (= 255 / 3, so one-third intensity), and input */ /* of 192 or greater should be remapped to 255 (full intensity). */ /* Assuming we want a linear response between zero and 192, that */ /* leads to output = 85 + input * (255-85)/192. */ /* This should lead to proper handling of bold text in legacy */ /* apps, where "bold" means "high intensity". */ static COLORREF intensified_color( COLORREF ival) { int rgb, i; COLORREF oval = 0; for( i = 0; i < 3; i++, ival >>= 8) { rgb = (int)( ival & 0xff); if( rgb >= 192) rgb = 255; else rgb = 85 + rgb * (255 - 85) / 192; oval |= ((COLORREF)rgb << (i * 8)); } return( oval); } /* For use in adjusting colors for A_DIMmed characters. Just */ /* knocks down the intensity of R, G, and B by 1/3. */ static COLORREF dimmed_color( COLORREF ival) { unsigned i; COLORREF oval = 0; for( i = 0; i < 3; i++, ival >>= 8) { unsigned rgb = (unsigned)( ival & 0xff); rgb -= (rgb / 3); oval |= ((COLORREF)rgb << (i * 8)); } return( oval); } /* see 'addch.c' for an explanation of how combining chars are handled. */ #if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2 #ifdef PDC_WIDE #define USING_COMBINING_CHARACTER_SCHEME int PDC_expand_combined_characters( const cchar_t c, cchar_t *added); /* addch.c */ #endif /* PDC_get_rgb_values(), extract_packed_rgb(), intensified_component(), */ /* intensified_color(), and dimmed_color() each exist in x11/x11.c, */ /* wingui/pdcdisp.c, and sdl2/pdcdisp.c in forms slightly modified for */ /* each platform. But they all look pretty much alike. */ /* PDCurses stores RGBs in fifteen bits, five bits each */ /* for red, green, blue. A COLORREF uses eight bits per */ /* channel. Hence the following. */ static COLORREF extract_packed_rgb( const chtype color) { const int red = (int)( (color << 3) & 0xf8); const int green = (int)( (color >> 2) & 0xf8); const int blue = (int)( (color >> 7) & 0xf8); return( RGB( red, green, blue)); } #endif void PDC_get_rgb_values( const chtype srcp, COLORREF *foreground_rgb, COLORREF *background_rgb) { const int color = (int)(( srcp & A_COLOR) >> PDC_COLOR_SHIFT); bool reverse_colors = ((srcp & A_REVERSE) ? TRUE : FALSE); bool intensify_backgnd = FALSE; #if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2 if( srcp & A_RGB_COLOR) { /* Extract RGB from 30 bits of the color field */ *background_rgb = extract_packed_rgb( srcp >> PDC_COLOR_SHIFT); *foreground_rgb = extract_packed_rgb( srcp >> (PDC_COLOR_SHIFT + 15)); } else #endif { extern COLORREF *pdc_rgbs; short foreground_index, background_index; PDC_pair_content( (short)color, &foreground_index, &background_index); *foreground_rgb = pdc_rgbs[foreground_index]; *background_rgb = pdc_rgbs[background_index]; } if( srcp & A_BLINK) { extern int PDC_really_blinking; /* see 'pdcsetsc.c' */ extern int PDC_blink_state; if( !PDC_really_blinking) /* convert 'blinking' to 'bold' */ intensify_backgnd = TRUE; else if( PDC_blink_state) reverse_colors = !reverse_colors; } if( reverse_colors) { const COLORREF temp = *foreground_rgb; *foreground_rgb = *background_rgb; *background_rgb = temp; } if( srcp & A_BOLD) *foreground_rgb = intensified_color( *foreground_rgb); if( intensify_backgnd) *background_rgb = intensified_color( *background_rgb); if( srcp & A_DIM) *foreground_rgb = dimmed_color( *foreground_rgb); if( srcp & A_DIM) *background_rgb = dimmed_color( *background_rgb); } #ifdef PDC_WIDE const chtype MAX_UNICODE = 0x110000; #endif #ifdef USE_FALLBACK_FONT GLYPHSET *PDC_unicode_range_data = NULL; /* Note that in the following, if a character has a Unicode point greater than 64K (i.e., it's not in the Basic Multilingual Plane), we assume it has a glyph in the font. The problem is that, due to the brain-dead implementation of Unicode in Windoze, we can't actually tell if there is a glyph or not; the "range" data is 16-bit. */ static bool character_is_in_font( chtype ichar) { int i; WCRANGE *wptr = PDC_unicode_range_data->ranges; if( (ichar & A_ALTCHARSET) && (ichar & A_CHARTEXT) < 0x80) ichar = acs_map[ichar & 0x7f]; ichar &= A_CHARTEXT; if( ichar > MAX_UNICODE) /* assume combining chars won't be */ return( FALSE); /* supported; they rarely are */ if( ichar > 0xffff) /* see above comments */ return( TRUE); for( i = PDC_unicode_range_data->cRanges; i; i--, wptr++) if( wptr->wcLow > ichar) return( FALSE); else if( wptr->wcLow + wptr->cGlyphs > ichar) return( TRUE); /* Didn't find it in any range; it must not be in the font */ return( FALSE); } #endif /* #ifdef USE_FALLBACK_FONT */ /* update the given physical line to look like the corresponding line in curscr. NOTE that if x > 0, we decrement it and srcp, and increment the length. In other words, we draw the preceding character, too. This is done because, at certain font sizes, characters break out and overwrite the preceding character. That results in debris left on the screen. The code also now increments the length only, drawing one more character (i.e., draws the character following the "text we really want"). Again, this helps to avoid debris left on the screen. The 'ExtTextOut' function takes an lpDx array that specifies the exact placement of each character relative to the previous character. This seems to help avoid most (but not all) stray pixels from being displayed. The problem is that, at certain font sizes, letters may be drawn that don't fit properly in the clip rectangle; and they aren't actually clipped correctly, despite the use of the ETO_CLIPPED flag. But things do seem to be much better than was the case back when plain 'TextOut' was used. */ #define N_CACHED_FONTS 8 static HFONT hFonts[N_CACHED_FONTS]; #define BUFFSIZE 50 int PDC_find_ends_of_selected_text( const int line, const RECT *rect, int *x); /* pdcscrn.c */ void PDC_transform_line_given_hdc( const HDC hdc, const int lineno, int x, int len, const chtype *srcp) { HFONT hOldFont = (HFONT)0; extern int PDC_cxChar, PDC_cyChar; int i, curr_color = -1; attr_t font_attrib = (attr_t)-1; int cursor_overwritten = FALSE; COLORREF foreground_rgb = 0; chtype prev_ch = 0; extern RECT PDC_mouse_rect; /* see 'pdcscrn.c' */ int selection[2]; if( !srcp) /* just freeing up fonts */ { for( i = 0; i < N_CACHED_FONTS; i++) if( hFonts[i]) { DeleteObject( hFonts[i]); hFonts[i] = NULL; } #ifdef USE_FALLBACK_FONT if( PDC_unicode_range_data) { free( PDC_unicode_range_data); PDC_unicode_range_data = NULL; } #endif return; } /* Seems to me as if the input text to this function */ if( x < 0) /* should _never_ be off-screen. But it sometimes is. */ { /* Clipping is therefore necessary. */ len += x; srcp -= x; x = 0; } len++; /* draw an extra char to avoid leaving garbage on screen */ if( len > SP->cols - x) len = SP->cols - x; if( lineno >= SP->lines || len <= 0 || lineno < 0) return; if( x) /* back up by one character to avoid */ { /* leaving garbage on the screen */ x--; len++; srcp--; } if( lineno == SP->cursrow && SP->curscol >= x && SP->curscol < x + len) if( PDC_current_cursor_state( )) cursor_overwritten = TRUE; while( len) { extern int PDC_really_blinking; /* see 'pdcsetsc.c' */ const attr_t attrib = (attr_t)( *srcp >> PDC_REAL_ATTR_SHIFT); const int color = (int)(( *srcp & A_COLOR) >> PDC_COLOR_SHIFT); attr_t new_font_attrib = (*srcp & (A_BOLD | A_ITALIC)); RECT clip_rect; wchar_t buff[BUFFSIZE]; int lpDx[BUFFSIZE + 1]; int olen = 0; #ifdef USE_FALLBACK_FONT const bool in_font = character_is_in_font( *srcp); #endif for( i = 0; i < len && olen < BUFFSIZE - 1 #ifdef USE_FALLBACK_FONT && (in_font == character_is_in_font( srcp[i]) || (srcp[i] & A_CHARTEXT) == MAX_UNICODE) #endif && attrib == (attr_t)( srcp[i] >> PDC_REAL_ATTR_SHIFT); i++) { chtype ch = srcp[i] & A_CHARTEXT; #if( defined( PDC_WIDE) && defined( CHTYPE_LONG)) if( ch > 0xffff && ch < MAX_UNICODE) /* use Unicode surrogates to fit */ { /* >64K values into 16-bit wchar_t: */ ch -= 0x10000; buff[olen] = (wchar_t)( 0xd800 | (ch >> 10)); lpDx[olen] = 0; /* ^ upper 10 bits */ olen++; ch = (wchar_t)( 0xdc00 | (ch & 0x3ff)); /* lower 10 bits */ } #if( CHTYPE_LONG >= 2) /* "non-standard" 64-bit chtypes; combining */ if( ch > MAX_UNICODE) /* chars & fullwidth supported */ { cchar_t added[10], root = ch; int n_combined = 0; while( (root = PDC_expand_combined_characters( root, &added[n_combined])) > MAX_UNICODE) { n_combined++; } buff[olen] = (wchar_t)root; lpDx[olen] = 0; olen++; ch = (wchar_t)added[n_combined]; while( n_combined) { n_combined--; buff[olen] = (wchar_t)added[n_combined]; lpDx[olen] = 0; olen++; } } #endif #endif if( (srcp[i] & A_ALTCHARSET) && ch < 0x80) ch = acs_map[ch & 0x7f]; else if( ch < 32) ch = starting_ascii_to_unicode[ch]; #ifndef PDC_WIDE /* If we're in Unicode, assume */ else if( ch <= 0xff) /* the incoming text doesn't need */ { /* code-page translation */ char c = (char)ch; wchar_t z; mbtowc( &z, &c, 1); ch = (chtype)z; } assert( "We should never get here"); #endif buff[olen] = (wchar_t)ch; lpDx[olen] = PDC_cxChar; #ifdef PDC_WIDE if( ch != MAX_UNICODE) olen++; else if( olen) /* prev char is double-width */ lpDx[olen - 1] = 2 * PDC_cxChar; #else olen++; #endif } lpDx[olen] = PDC_cxChar; if( color != curr_color || ((prev_ch ^ *srcp) & (A_REVERSE | A_BLINK | A_BOLD | A_DIM))) { COLORREF background_rgb; PDC_get_rgb_values( *srcp, &foreground_rgb, &background_rgb); curr_color = color; SetTextColor( hdc, foreground_rgb); SetBkColor( hdc, background_rgb); } if( !PDC_really_blinking && (*srcp & A_BLINK)) new_font_attrib &= ~A_BLINK; #ifdef USE_FALLBACK_FONT if( !in_font) /* flag to indicate use of */ new_font_attrib |= 1; /* fallback font */ #endif if( new_font_attrib != font_attrib) { HFONT hFont; int idx = 0; font_attrib = new_font_attrib; if( font_attrib & A_BOLD) idx |= 1; if( font_attrib & A_ITALIC) idx |= 2; if( font_attrib & 1) /* use Unifont or other fallback font */ idx |= 4; if( !hFonts[idx]) hFonts[idx] = PDC_get_font_handle( idx); hFont = SelectObject( hdc, hFonts[idx]); if( !hOldFont) hOldFont = hFont; } prev_ch = *srcp; clip_rect.left = x * PDC_cxChar; clip_rect.top = lineno * PDC_cyChar; clip_rect.right = clip_rect.left + i * PDC_cxChar; clip_rect.bottom = clip_rect.top + PDC_cyChar; ExtTextOutW( hdc, clip_rect.left, clip_rect.top, ETO_CLIPPED | ETO_OPAQUE, &clip_rect, buff, olen, (olen > 1 ? lpDx : NULL)); #ifdef A_OVERLINE if( *srcp & (A_UNDERLINE | A_RIGHTLINE | A_LEFTLINE | A_OVERLINE | A_STRIKEOUT)) #else if( *srcp & (A_UNDERLINE | A_RIGHTLINE | A_LEFTLINE)) #endif { const int y1 = clip_rect.top; const int y2 = clip_rect.bottom - 1; const int x1 = clip_rect.left; const int x2 = clip_rect.right; int j; extern COLORREF *pdc_rgbs; const HPEN pen = CreatePen( PS_SOLID, 1, (SP->line_color == -1 ? foreground_rgb : pdc_rgbs[SP->line_color])); const HPEN old_pen = SelectObject( hdc, pen); if( *srcp & A_UNDERLINE) { MoveToEx( hdc, x1, y2, NULL); LineTo( hdc, x2, y2); } #ifdef A_OVERLINE if( *srcp & A_OVERLINE) { MoveToEx( hdc, x1, y1, NULL); LineTo( hdc, x2, y1); } if( *srcp & A_STRIKEOUT) { MoveToEx( hdc, x1, (y1 + y2) / 2, NULL); LineTo( hdc, x2, (y1 + y2) / 2); } #endif if( *srcp & A_RIGHTLINE) for( j = 0; j < i; j++) { MoveToEx( hdc, x2 - j * PDC_cxChar - 1, y1, NULL); LineTo( hdc, x2 - j * PDC_cxChar - 1, y2); } if( *srcp & A_LEFTLINE) for( j = 0; j < i; j++) { MoveToEx( hdc, x1 + j * PDC_cxChar, y1, NULL); LineTo( hdc, x1 + j * PDC_cxChar, y2); } SelectObject( hdc, old_pen); DeleteObject( pen); } if( PDC_find_ends_of_selected_text( lineno, &PDC_mouse_rect, selection)) if( x <= selection[1] + 1 && x + i >= selection[0]) { RECT rect; rect.top = lineno * PDC_cyChar; rect.bottom = rect.top + PDC_cyChar; rect.right = max( x, selection[0]); rect.left = min( x + i, selection[1] + 1); rect.right *= PDC_cxChar; rect.left *= PDC_cxChar; InvertRect( hdc, &rect); } len -= i; x += i; srcp += i; } SelectObject( hdc, hOldFont); /* ...did we step on the cursor? If so, redraw it: */ if( cursor_overwritten) redraw_cursor( hdc); } void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) { if( !srcp) /* just freeing up fonts */ PDC_transform_line_given_hdc( 0, 0, 0, 0, NULL); else { extern HWND PDC_hWnd; const HDC hdc = GetDC( PDC_hWnd) ; PDC_transform_line_given_hdc( hdc, lineno, x, len, srcp); ReleaseDC( PDC_hWnd, hdc); } } curses-1.4.4/vendor/PDCurses/wingui/pdcwin.h0000644000004100000410000001202114201713275020776 0ustar www-datawww-data/* Public Domain Curses */ /* $Id: pdcwin.h,v 1.6 2008/07/13 06:36:32 wmcbrine Exp $ */ #ifdef PDC_WIDE # define UNICODE # define _UNICODE #endif #include #if defined( GS_8BIT_INDICES) && defined( PDC_WIDE) /* We only need the 'fallback font' for the wide-char version, */ /* and it'll only work in Win2000 or later (earlier versions */ /* lack the necessary GetFontUnicodeRanges() function.) Comment */ /* out the following line if you're dealing with a really old */ /* system, or just don't want to use a fallback font. */ #define USE_FALLBACK_FONT #endif /* Windows.h will #define MOUSE_MOVED to 0x1, which is what the Windows API expects. In Curses, MOUSE_MOVED is a macro indicating whether the mouse has moved, so we'd get a compiler warning that we're re-defining MOUSE_MOVED. That warning may be a Good Thing in your software, letting you know: "Be careful; in a Curses program, MOUSE_MOVED won't have the same meaning it does in a 'real' Windows program." But in building WinGUI itself, we're expecting the Curses meaning for MOUSE_MOVED, and the compiler warning would just be a nuisance. So we'll #undefine MOUSE_MOVED before getting to the Curses definition : */ #undef MOUSE_MOVED #include extern int PDC_get_buffer_rows(void); /* The following probably ought to go into 'curses.h' at some point. */ /* Or at least, not be here; this is a temporary place for them. */ /* WinGUI has some drastically extended cursor possibilities. The following #defines can be used with curs_set(). For all other flavors of PDCurses, only the invisible, "normal", and "intense" cursor states will be recognized. In Win32, caret, half-block, central block, cross, and outlined block cursors are available. By default, all such cursors will blink. However, in WinGUI, the input value to curs_set() is treated as a two-byte value, with the cursor blinking between those two states. For example, curs_set( 0x0102) would blink between a "normal" (underline) cursor and an "intense" (full-block) cursor. One can see that this behavior is backward-compatible; for example, curs_set( 1) would blink between a "normal" underline cursor and an invisible cursor. (But curs_set( 0x0101) would result in a non-blinking underline cursor.) Note that one can use the PDC_CURSOR macro for this, as in... curs_set( PDC_CURSOR( PDC_CURSOR_OUTLINE, PDC_CURSOR_INTENSE)); */ #define PDC_CURSOR_INVISIBLE 0x00 #define PDC_CURSOR_NORMAL 0x01 #define PDC_CURSOR_INTENSE 0x02 #define PDC_CURSOR_OUTLINE 0x03 #define PDC_CURSOR_CARET 0x04 #define PDC_CURSOR_HALF_BLOCK 0x05 #define PDC_CURSOR_CENTRAL_BLOCK 0x06 #define PDC_CURSOR_CROSS 0x07 #define PDC_CURSOR_OUTLINE_BLOCK 0x08 #define PDC_CURSOR( A, B) ((A)<<8 | (B)) #define PDC_CURSOR_IS_BLINKING \ ((SP->visibility >> 8) != (SP->visibility & 0xff)) /* With 64-bit chtypes, we're allowing 20 bits for the character (thus Unicode values up to 0xffffff) plus one bit to indicate the alternate character set. With 32-bit chtypes, we don't have so many bits to play with and limit ourselves to 16-bit characters (i.e., Unicode past 0xffff can't be shown), plus that one bit for alternate chars. With 16-bit chtypes, there are only eight bits available to the character. PDC_REAL_ATTR_SHIFT gives the number of low bits devoted to storing characters. */ # if(CHTYPE_LONG >= 2) /* 64-bit chtypes */ # define PDC_REAL_ATTR_SHIFT 21 # else #ifdef CHTYPE_LONG /* 32-bit chtypes */ # define PDC_REAL_ATTR_SHIFT 17 #else /* 16-bit chtypes */ # define PDC_REAL_ATTR_SHIFT 8 #endif #endif /* The PDC_set_function_key() function allows one to set a 'shut down' key, and reassign hotkeys used for pasting from the clipboard and enlarging and decreasing the font size, and for using the font selection dialog. For example, calling PDC_set_function_key( FUNCTION_KEY_SHUT_DOWN, ALT_Q); would reset the library so that, if the user clicks on the 'close' box, Alt-Q would be added to the key queue. This would give the app the opportunity to shut things down (and perhaps ask "are you sure", and/or "save changes or discard or cancel"), rather than just having the window close (the default behavior). Also, by default, Ctrl-V "pastes" the clipboard into the key queue, and Ctrl-Equals brings up the font selection dialog. But one could call, for example, PDC_set_function_key( FUNCTION_KEY_PASTE, CTL_Z); to reset the "paste" key to be Ctrl-Z. Or one could call PDC_set_function_key( FUNCTION_KEY_PASTE, 0); to shut off that function. (It would still be accessible from the menu.) Thus far, this is a WinGUI-flavor specific function. But it could, and in my opinion should, be made available in the SDL and XCurses flavors too. The return value is the key previously used for that function. */ curses-1.4.4/vendor/PDCurses/wingui/pdcclip.c0000644000004100000410000001025214201713275021127 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcwin.h" /*man-start************************************************************** clipboard --------- ### Synopsis int PDC_getclipboard(char **contents, long *length); int PDC_setclipboard(const char *contents, long length); int PDC_freeclipboard(char *contents); int PDC_clearclipboard(void); ### Description PDC_getclipboard() gets the textual contents of the system's clipboard. This function returns the contents of the clipboard in the contents argument. It is the responsibility of the caller to free the memory returned, via PDC_freeclipboard(). The length of the clipboard contents is returned in the length argument. PDC_setclipboard copies the supplied text into the system's clipboard, emptying the clipboard prior to the copy. PDC_clearclipboard() clears the internal clipboard. ### Return Values indicator of success/failure of call. PDC_CLIP_SUCCESS the call was successful PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for the clipboard contents PDC_CLIP_EMPTY the clipboard contains no text PDC_CLIP_ACCESS_ERROR no clipboard support ### Portability X/Open BSD SYS V PDC_getclipboard - - - PDC_setclipboard - - - PDC_freeclipboard - - - PDC_clearclipboard - - - **man-end****************************************************************/ #ifdef PDC_WIDE # define PDC_TEXT CF_UNICODETEXT #else # define PDC_TEXT CF_OEMTEXT #endif int PDC_getclipboard_handle( HANDLE *handle) { PDC_LOG(("PDC_getclipboard() - called\n")); if (!OpenClipboard(NULL)) { return PDC_CLIP_ACCESS_ERROR; } if ((*handle = GetClipboardData(PDC_TEXT)) == NULL) { CloseClipboard(); return PDC_CLIP_EMPTY; } return PDC_CLIP_SUCCESS; } int PDC_getclipboard(char **contents, long *length) { HANDLE handle; int rval = PDC_getclipboard_handle( &handle); if( rval == PDC_CLIP_SUCCESS) { void *tptr = GlobalLock( handle); if( tptr) { #ifdef PDC_WIDE size_t len = wcslen((wchar_t *)tptr) * 3; #else size_t len = strlen( tptr); #endif *contents = (char *)GlobalAlloc( GMEM_FIXED, len + 1); if( !*contents) rval = PDC_CLIP_MEMORY_ERROR; else { #ifdef PDC_WIDE len = PDC_wcstombs( (char *)*contents, tptr, len); #else strcpy((char *)*contents, tptr); #endif } *length = (long)len; GlobalUnlock( handle); } else rval = PDC_CLIP_MEMORY_ERROR; CloseClipboard(); } return rval; } int PDC_setclipboard_raw( const char *contents, long length, const bool translate_multibyte_to_wide_char) { HGLOBAL handle; LPTSTR buff; PDC_LOG(("PDC_setclipboard() - called\n")); if (!OpenClipboard(NULL)) return PDC_CLIP_ACCESS_ERROR; handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, (length + 1) * sizeof(TCHAR)); if (!handle) return PDC_CLIP_MEMORY_ERROR; buff = GlobalLock(handle); #ifdef PDC_WIDE if( translate_multibyte_to_wide_char) PDC_mbstowcs((wchar_t *)buff, contents, length); else memcpy((char *)buff, contents, (length + 1) * sizeof( wchar_t)); #else memcpy((char *)buff, contents, length); buff[length] = 0; /* ensure null termination */ #endif GlobalUnlock(handle); EmptyClipboard(); if( !SetClipboardData(PDC_TEXT, handle)) { GlobalFree(handle); return PDC_CLIP_ACCESS_ERROR; } CloseClipboard(); return PDC_CLIP_SUCCESS; } int PDC_setclipboard(const char *contents, long length) { return( PDC_setclipboard_raw( contents, length, TRUE)); } int PDC_freeclipboard(char *contents) { PDC_LOG(("PDC_freeclipboard() - called\n")); GlobalFree(contents); return PDC_CLIP_SUCCESS; } int PDC_clearclipboard(void) { PDC_LOG(("PDC_clearclipboard() - called\n")); EmptyClipboard(); return PDC_CLIP_SUCCESS; } curses-1.4.4/vendor/PDCurses/wingui/Makefile.dmc0000644000004100000410000001217014201713275021550 0ustar www-datawww-data# Makefile for PDCurses library - WIN32 Digital Mars # # Usage: make -f Makefile.dmc [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] PDCURSES_SRCDIR = .. PDCURSES_CURSES_H = $(PDCURSES_SRCDIR)\curses.h PDCURSES_CURSPRIV_H = $(PDCURSES_SRCDIR)\curspriv.h PDCURSES_HEADERS = $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H) PANEL_HEADER = $(PDCURSES_SRCDIR)\panel.h TERM_HEADER = $(PDCURSES_SRCDIR)\term.h srcdir = $(PDCURSES_SRCDIR)\pdcurses osdir = $(PDCURSES_SRCDIR)\wingui demodir = $(PDCURSES_SRCDIR)\demos PDCURSES_WIN_H = $(osdir)\pdcwin.h CC = dmc CFLAGS = -c -o+space -Nc # CPPFLAGS = -I$(PDCURSES_SRCDIR) CPPFLAGS = -I$(PDCURSES_SRCDIR) -DPDC_WIDE LINK = dmc LIBEXE = lib LIBCURSES = pdcurses.lib BUILD = $(CC) $(CFLAGS) $(CPPFLAGS) DEMOS = testcurs.exe ozdemo.exe newtest.exe xmas.exe tuidemo.exe \ firework.exe ptest.exe rain.exe worm.exe all: $(LIBCURSES) $(DEMOS) clean: -del *.obj -del *.lib -del *.exe -del *.map -del advapi32.def LIBOBJS = addch.obj addchstr.obj addstr.obj attr.obj beep.obj bkgd.obj \ border.obj clear.obj color.obj delch.obj deleteln.obj deprec.obj getch.obj \ getstr.obj getyx.obj inch.obj inchstr.obj initscr.obj inopts.obj \ insch.obj insstr.obj instr.obj kernel.obj keyname.obj mouse.obj move.obj \ outopts.obj overlay.obj pad.obj panel.obj printw.obj refresh.obj \ scanw.obj scr_dump.obj scroll.obj slk.obj termattr.obj terminfo.obj \ touch.obj util.obj window.obj debug.obj PDCOBJS = pdcclip.obj pdcdisp.obj pdcgetsc.obj pdckbd.obj pdcscrn.obj \ pdcsetsc.obj pdcutil.obj DEMOOBJS = testcurs.obj ozdemo.obj newtest.obj xmas.obj tuidemo.obj tui.obj \ firework.obj ptest.obj rain.obj worm.obj LIBS = advapi32.lib gdi32.lib user32.lib shell32.lib comdlg32.lib $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_WIN_H) panel.obj ptest.obj: $(PANEL_HEADER) terminfo.obj: $(TERM_HEADER) $(DEMOOBJS) : $(PDCURSES_CURSES_H) $(DEMOS) : $(LIBCURSES) $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) -c $@ $(LIBOBJS) $(PDCOBJS) -copy $(LIBCURSES) panel.lib SRCBUILD = $(BUILD) $(srcdir)\$*.c OSBUILD = $(BUILD) $(osdir)\$*.c DEMOBUILD = $(LINK) $(CPPFLAGS) -o+space $@ $** addch.obj: $(srcdir)\addch.c $(SRCBUILD) addchstr.obj: $(srcdir)\addchstr.c $(SRCBUILD) addstr.obj: $(srcdir)\addstr.c $(SRCBUILD) attr.obj: $(srcdir)\attr.c $(SRCBUILD) beep.obj: $(srcdir)\beep.c $(SRCBUILD) bkgd.obj: $(srcdir)\bkgd.c $(SRCBUILD) border.obj: $(srcdir)\border.c $(SRCBUILD) clear.obj: $(srcdir)\clear.c $(SRCBUILD) color.obj: $(srcdir)\color.c $(SRCBUILD) delch.obj: $(srcdir)\delch.c $(SRCBUILD) deleteln.obj: $(srcdir)\deleteln.c $(SRCBUILD) deprec.obj: $(srcdir)\deprec.c $(SRCBUILD) getch.obj: $(srcdir)\getch.c $(SRCBUILD) getstr.obj: $(srcdir)\getstr.c $(SRCBUILD) getyx.obj: $(srcdir)\getyx.c $(SRCBUILD) inch.obj: $(srcdir)\inch.c $(SRCBUILD) inchstr.obj: $(srcdir)\inchstr.c $(SRCBUILD) initscr.obj: $(srcdir)\initscr.c $(SRCBUILD) inopts.obj: $(srcdir)\inopts.c $(SRCBUILD) insch.obj: $(srcdir)\insch.c $(SRCBUILD) insstr.obj: $(srcdir)\insstr.c $(SRCBUILD) instr.obj: $(srcdir)\instr.c $(SRCBUILD) kernel.obj: $(srcdir)\kernel.c $(SRCBUILD) keyname.obj: $(srcdir)\keyname.c $(SRCBUILD) mouse.obj: $(srcdir)\mouse.c $(SRCBUILD) move.obj: $(srcdir)\move.c $(SRCBUILD) outopts.obj: $(srcdir)\outopts.c $(SRCBUILD) overlay.obj: $(srcdir)\overlay.c $(SRCBUILD) pad.obj: $(srcdir)\pad.c $(SRCBUILD) panel.obj: $(srcdir)\panel.c $(SRCBUILD) printw.obj: $(srcdir)\printw.c $(SRCBUILD) refresh.obj: $(srcdir)\refresh.c $(SRCBUILD) scanw.obj: $(srcdir)\scanw.c $(SRCBUILD) scr_dump.obj: $(srcdir)\scr_dump.c $(SRCBUILD) scroll.obj: $(srcdir)\scroll.c $(SRCBUILD) slk.obj: $(srcdir)\slk.c $(SRCBUILD) termattr.obj: $(srcdir)\termattr.c $(SRCBUILD) terminfo.obj: $(srcdir)\terminfo.c $(SRCBUILD) touch.obj: $(srcdir)\touch.c $(SRCBUILD) util.obj: $(srcdir)\util.c $(SRCBUILD) window.obj: $(srcdir)\window.c $(SRCBUILD) debug.obj: $(srcdir)\debug.c $(SRCBUILD) pdcclip.obj: $(osdir)\pdcclip.c $(OSBUILD) pdcdisp.obj: $(osdir)\pdcdisp.c $(OSBUILD) pdcgetsc.obj: $(osdir)\pdcgetsc.c $(OSBUILD) pdckbd.obj: $(osdir)\pdckbd.c $(OSBUILD) pdcscrn.obj: $(osdir)\pdcscrn.c $(OSBUILD) pdcsetsc.obj: $(osdir)\pdcsetsc.c $(OSBUILD) pdcutil.obj: $(osdir)\pdcutil.c $(OSBUILD) firework.exe: $(demodir)\firework.c $(DEMOBUILD) $(LIBS) ozdemo.exe: $(demodir)\ozdemo.c $(DEMOBUILD) $(LIBS) newtest.exe: $(demodir)\newtest.c $(DEMOBUILD) $(LIBS) ptest.exe: $(demodir)\ptest.c $(DEMOBUILD) $(LIBS) rain.exe: $(demodir)\rain.c $(DEMOBUILD) $(LIBS) testcurs.exe: $(demodir)\testcurs.c $(DEMOBUILD) $(LIBS) tuidemo.exe: tuidemo.obj tui.obj $(DEMOBUILD) $(LIBS) worm.exe: $(demodir)\worm.c $(DEMOBUILD) $(LIBS) xmas.exe: $(demodir)\xmas.c $(DEMOBUILD) $(LIBS) tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(BUILD) -I$(demodir) $(demodir)\$*.c tuidemo.obj: $(demodir)\tuidemo.c $(BUILD) -I$(demodir) $(demodir)\$*.c curses-1.4.4/vendor/PDCurses/wingui/Makefile.bcc0000644000004100000410000000272614201713275021542 0ustar www-datawww-data# Borland MAKE Makefile for PDCurses library - Win32 BC++ 4.0+ # # Usage: make -f [path\]Makefile.bcc [DEBUG=] [WIDE=] [UTF8=] [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] O = obj !ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. !endif !include $(PDCURSES_SRCDIR)\version.mif !include $(PDCURSES_SRCDIR)\libobjs.mif osdir = $(PDCURSES_SRCDIR)\wingui CC = bcc32 -q !ifdef DEBUG CFLAGS = -N -v -y -DPDCDEBUG !else CFLAGS = -O !endif !ifdef WIDE WIDEOPT = -DPDC_WIDE !endif !ifdef UTF8 UTF8OPT = -DPDC_FORCE_UTF8 !endif BUILD = $(CC) -I$(PDCURSES_SRCDIR) -c -Tpe -w32 $(CFLAGS) -w-par \ $(WIDEOPT) $(UTF8OPT) LIBEXE = tlib /C /E /0 /a LIBCURSES = pdcurses.lib all: $(LIBCURSES) $(DEMOS) clean: -del *.obj -del *.lib -del *.tds -del *.exe $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) -del $@ $(LIBEXE) $@ $(LIBOBJS) $(PDCOBJS) -copy $(LIBCURSES) panel.lib .autodepend {$(srcdir)\}.c.obj: $(BUILD) $< {$(osdir)\}.c.obj: $(BUILD) $< {$(demodir)\}.c.obj: $(BUILD) $< .c.obj: $(BUILD) $< .obj.exe: $(CC) -e$@ $** $(LIBCURSES) tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES) $(CC) -e$@ $** tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(PDCURSES_CURSES_H) $(BUILD) -I$(demodir) $(demodir)\tui.c tuidemo.obj: $(demodir)\tuidemo.c $(PDCURSES_CURSES_H) $(BUILD) -I$(demodir) $(demodir)\tuidemo.c PLATFORM1 = Borland C++ Win32 PLATFORM2 = Borland C/C++ 5.5 for Win32 ARCNAME = pdc$(VER)_bcc_w32 !include $(PDCURSES_SRCDIR)\makedist.mif curses-1.4.4/vendor/PDCurses/wingui/CMakeLists.txt0000644000004100000410000000144514201713275022111 0ustar www-datawww-datacmake_minimum_required(VERSION 3.11) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING "Choose the type of build, options are: Debug, Release, or MinSizeRel." FORCE) message(STATUS "No build type specified, defaulting to MinSizeRel.") endif() PROJECT(wingui VERSION "${PROJECT_VERSION}" LANGUAGES C) INCLUDE(project_common) demo_app(../demos version) demo_app(../demos firework) demo_app(../demos ozdemo) demo_app(../demos newtest) demo_app(../demos ptest) demo_app(../demos rain) demo_app(../demos testcurs) demo_app(../demos tuidemo) demo_app(../demos worm) demo_app(../demos xmas) IF(WIN32) SET_TARGET_PROPERTIES(${PROJECT_NAME}_newtest PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS") ENDIF(WIN32) SET(CPACK_COMPONENTS_ALL applications) curses-1.4.4/vendor/PDCurses/wingui/pdcutil.c0000644000004100000410000000270714201713275021163 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcwin.h" void PDC_beep(void) { PDC_LOG(("PDC_beep() - called\n")); /* MessageBeep(MB_OK); */ MessageBeep(0XFFFFFFFF); } void PDC_napms(int ms) /* 'ms' = milli, _not_ microseconds! */ { /* RR: keep GUI window responsive while PDCurses sleeps */ MSG msg; DWORD curr_ms = GetTickCount( ); const DWORD milliseconds_sleep_limit = ms + curr_ms; extern bool PDC_bDone; PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); /* Pump all pending messages from WIN32 to the window handler */ while( !PDC_bDone && curr_ms < milliseconds_sleep_limit ) { const DWORD max_sleep_ms = 50; /* check msgs 20 times/second */ DWORD sleep_millisecs; while( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) { TranslateMessage(&msg); DispatchMessage(&msg); } curr_ms = GetTickCount( ); sleep_millisecs = milliseconds_sleep_limit - curr_ms; if( sleep_millisecs > max_sleep_ms) sleep_millisecs = max_sleep_ms; Sleep( sleep_millisecs); curr_ms += sleep_millisecs; } } const char *PDC_sysname(void) { return "WinGUI"; } PDC_version_info PDC_version = { PDC_PORT_WINGUI, PDC_VER_MAJOR, PDC_VER_MINOR, PDC_VER_CHANGE, sizeof( chtype), #ifdef PDC_WIDE TRUE, #else FALSE, #endif #ifdef PDC_FORCE_UTF8 TRUE, #else FALSE, #endif }; curses-1.4.4/vendor/PDCurses/wingui/pdcurses.rc0000644000004100000410000000135214201713275021524 0ustar www-datawww-data#include "winver.h" 1 VERSIONINFO FILEVERSION 4,0,2,0 PRODUCTVERSION 4,0,2,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS VOS_UNKNOWN FILETYPE VFT_DLL FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "Maintainer", "William McBrine\0" VALUE "FileDescription", "Public Domain Curses\0" VALUE "FileVersion", "4.0.2\0" VALUE "InternalName", "PDCurses\0" VALUE "LegalCopyright", "Public Domain\0" VALUE "OriginalFilename", "PDCURSES.DLL\0" VALUE "ProductName", "Public Domain Curses Library\0" VALUE "ProductVersion", "4.0.2\0" END END END 1 ICON DISCARDABLE "PDCURSES.ico" curses-1.4.4/vendor/PDCurses/wingui/pdcscrn.c0000644000004100000410000032020514201713275021147 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcwin.h" #include #include #include /* COLOR_PAIR to attribute encoding table. */ static short *color_pair_indices = (short *)NULL; COLORREF *pdc_rgbs = (COLORREF *)NULL; static int menu_shown = 1; static int min_lines = 25, max_lines = 25; static int min_cols = 80, max_cols = 80; #if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2 && defined( PDC_WIDE) #define USING_COMBINING_CHARACTER_SCHEME int PDC_expand_combined_characters( const cchar_t c, cchar_t *added); /* addch.c */ #endif /* Some older versions of Microsoft C/C++ don't understand about inlined functions. Until we puzzle out which ones do and which don't, we'll just leave "inlined" functions as plain old static functions. */ #ifdef _MSC_VER #define INLINE static #else #define INLINE static inline #endif static int keep_size_within_bounds( int *lines, int *cols); INLINE int set_default_sizes_from_registry( const int n_cols, const int n_rows, const int xloc, const int yloc, const int menu_shown); void PDC_transform_line_given_hdc( const HDC hdc, const int lineno, int x, int len, const chtype *srcp); #define N_COLORS 256 #ifdef A_OVERLINE #define A_ALL_LINES (A_UNDERLINE | A_LEFTLINE | A_RIGHTLINE | A_OVERLINE | A_STRIKEOUT) #else #define A_ALL_LINES (A_UNDERLINE | A_LEFTLINE | A_RIGHTLINE) #endif /* If PDC_MAX_MOUSE_BUTTONS is undefined, it means the user hasn't */ /* gotten a current 'curses.h' in which five-button mice are supported. */ /* To handle this gracefully, we'll just fall back to three buttons. */ #ifndef PDC_MAX_MOUSE_BUTTONS #define PDC_MAX_MOUSE_BUTTONS 3 #endif #define VERTICAL_WHEEL_EVENT PDC_MAX_MOUSE_BUTTONS #define HORIZONTAL_WHEEL_EVENT (PDC_MAX_MOUSE_BUTTONS + 1) unsigned long pdc_key_modifiers = 0L; int PDC_show_ctrl_alts = 0; /* RR: Removed statis on next line */ bool PDC_bDone = FALSE; static HWND originally_focussed_window; int debug_printf( const char *format, ...) { static bool debugging = TRUE; if( debugging) { const char *output_filename = getenv( "PDC_DEBUG"); if( !output_filename) debugging = FALSE; /* don't bother trying again */ else { FILE *ofile = fopen( output_filename, "a"); if( ofile) { va_list argptr; va_start( argptr, format); vfprintf( ofile, format, argptr); va_end( argptr); fclose( ofile); } else { printf( "Opening '%s' failed\n", output_filename); exit( 0); debugging = FALSE; /* don't bother trying again */ } } } return( 0); } HWND PDC_hWnd; static int PDC_argc = 0; static char **PDC_argv = NULL; static void final_cleanup( void) { debug_printf( "final_cleanup: SP = %p\n", SP); if (SP) { RECT rect; GetWindowRect( PDC_hWnd, &rect); set_default_sizes_from_registry( SP->cols, SP->lines, rect.left, rect.top, menu_shown); } PDC_LOG(( "final_cleanup: freeing fonts\n")); PDC_transform_line( 0, 0, 0, NULL); /* free any fonts */ if( originally_focussed_window) SetForegroundWindow( originally_focussed_window); if( PDC_argc) { int i; for( i = 0; i < PDC_argc; i++) free( PDC_argv[i]); free( PDC_argv); PDC_argc = 0; PDC_argv = NULL; } #ifdef USING_COMBINING_CHARACTER_SCHEME PDC_expand_combined_characters( 0, NULL); /* free internal buffer */ #endif debug_printf( "reset foreground window\n"); } void PDC_scr_close(void) { PDC_LOG(("PDC_scr_close() - called\n")); final_cleanup( ); PDC_bDone = TRUE; } /* NOTE that PDC_scr_free( ) is called only from delscreen( ), */ /* which is rarely called. It appears that most programs simply */ /* rely on the memory getting freed when the program terminates. */ /* It seems conceivable to me that we could get into some trouble */ /* here, if SP is freed and NULLed, but then accessed again, */ /* possibly within the WinGUI window thread. */ void PDC_scr_free(void) { if (SP) free(SP); SP = (SCREEN *)NULL; if (color_pair_indices) free(color_pair_indices); color_pair_indices = (short *)NULL; if (pdc_rgbs) free(pdc_rgbs); pdc_rgbs = (COLORREF *)NULL; } int PDC_choose_a_new_font( void); /* pdcdisp.c */ void PDC_add_clipboard_to_key_queue( void); /* pdckbd.c */ #define KEY_QUEUE_SIZE 30 /* By default, the PDC_shutdown_key[] array contains 0 */ /* (i.e., there's no key that's supposed to be returned for */ /* exit handling), and 22 = Ctrl-V (i.e., hit Ctrl-V to */ /* paste text from the clipboard into the key queue); then */ /* Ctl-= (enlarge font) and Ctl-Minus (decrease font); then */ /* Ctl-, (select font from dialog). */ static int PDC_shutdown_key[PDC_MAX_FUNCTION_KEYS] = { 0, 22, CTL_EQUAL, CTL_MINUS, CTL_COMMA }; int PDC_n_rows, PDC_n_cols; int PDC_cxChar, PDC_cyChar, PDC_key_queue_low = 0, PDC_key_queue_high = 0; int PDC_key_queue[KEY_QUEUE_SIZE]; /* If the following is true, you can enter Unicode values by hitting */ /* Alt and holding it down while typing the value of the character on */ /* the numeric keypad (for decimal entry); _or_ you can hit Alt-Padplus */ /* and then enter a hex value, while holding down the Alt key. In */ /* either case, when you release the Alt key, the Unicode character */ /* is added to the queue. For hex entry, 0-9 can come either from */ /* the numeric keypad or the "usual" keyboard. */ bool PDC_allow_numpad_unicode = TRUE; static int numpad_unicode_value = 0; static void adjust_font_size( const int font_size_change); static void add_key_to_queue( const int new_key) { const int new_idx = ((PDC_key_queue_high + 1) % KEY_QUEUE_SIZE); /* This is usually 10, but is set to 16 if the user */ /* hits ALT_PADPLUS and is about to enter a hex value: */ static int unicode_radix = 10; if( PDC_allow_numpad_unicode) { int digit = -1; if( new_key >= ALT_PAD0 && new_key <= ALT_PAD9) digit = new_key - ALT_PAD0; /* In hex Unicode entry, you can enter digits on both */ /* the numeric and "standard" keyboards : */ if( unicode_radix == 16 && new_key >= ALT_0 && new_key <= ALT_9) digit = new_key - ALT_0; if( unicode_radix == 16 && new_key >= ALT_A && new_key <= ALT_F) digit = new_key - ALT_A + 10; if( digit >= 0) { numpad_unicode_value = numpad_unicode_value * unicode_radix + digit; return; } if( new_key == ALT_PADPLUS) { /* signal to begin hex Unicode entry */ unicode_radix = 16; return; } } unicode_radix = 10; if( new_key && new_key == PDC_shutdown_key[FUNCTION_KEY_PASTE]) PDC_add_clipboard_to_key_queue( ); else if( new_key && new_key == PDC_shutdown_key[FUNCTION_KEY_ABORT]) exit( -1); else if( new_key && new_key == PDC_shutdown_key[FUNCTION_KEY_ENLARGE_FONT]) adjust_font_size( 1); else if( new_key && new_key == PDC_shutdown_key[FUNCTION_KEY_SHRINK_FONT]) adjust_font_size( -1); else if( new_key && new_key == PDC_shutdown_key[FUNCTION_KEY_CHOOSE_FONT]) { if( PDC_choose_a_new_font( )) adjust_font_size( 0); } else if( new_idx != PDC_key_queue_low) { PDC_key_queue[PDC_key_queue_high] = new_key; PDC_key_queue_high = new_idx; } } /************************************************************************ * Table for key code translation of function keys in keypad mode * * These values are for strict IBM keyboard compatibles only * ************************************************************************/ typedef struct { unsigned short normal; unsigned short shift; unsigned short control; unsigned short alt; unsigned short extended; } KPTAB; static const KPTAB kptab[] = { {0, 0, 0, 0, 0 }, /* 0 */ {0, 0, 0, 0, 0 }, /* 1 VK_LBUTTON */ {0, 0, 0, 0, 0 }, /* 2 VK_RBUTTON */ {CTL_PAUSE, 'a', 'b', 'c', 0 }, /* 3 VK_CANCEL */ {0, 0, 0, 0, 0 }, /* 4 VK_MBUTTON */ {0, 0, 0, 0, 0 }, /* 5 */ {0, 0, 0, 0, 0 }, /* 6 */ {0, 0, 0, 0, 0 }, /* 7 */ {0x08, 0x08, 0x7F, ALT_BKSP, 0 }, /* 8 VK_BACK */ {0x09, KEY_BTAB, CTL_TAB, ALT_TAB, 999 }, /* 9 VK_TAB */ {0, 0, 0, 0, 0 }, /* 10 */ {0, 0, 0, 0, 0 }, /* 11 */ {KEY_B2, 0x35, CTL_PAD5, ALT_PAD5, 0 }, /* 12 VK_CLEAR */ {0x0D, 0x0D, CTL_ENTER, ALT_ENTER, 1 }, /* 13 VK_RETURN */ {0, 0, 0, 0, 0 }, /* 14 */ {0, 0, 0, 0, 0 }, /* 15 */ {0, 0, 0, 0, 0 }, /* 16 VK_SHIFT HANDLED SEPARATELY */ {0, 0, 0, 0, 0 }, /* 17 VK_CONTROL HANDLED SEPARATELY */ {0, 0, 0, 0, 0 }, /* 18 VK_MENU HANDLED SEPARATELY */ {KEY_PAUSE, KEY_SPAUSE,CTL_PAUSE, 0, 0 }, /* 19 VK_PAUSE */ {0, 0, 0, 0, 0 }, /* 20 VK_CAPITAL HANDLED SEPARATELY */ {0, 0, 0, 0, 0 }, /* 21 VK_HANGUL */ {0, 0, 0, 0, 0 }, /* 22 */ {0, 0, 0, 0, 0 }, /* 23 VK_JUNJA */ {0, 0, 0, 0, 0 }, /* 24 VK_FINAL */ {0, 0, 0, 0, 0 }, /* 25 VK_HANJA */ {0, 0, 0, 0, 0 }, /* 26 */ {0x1B, 0x1B, 0x1B, ALT_ESC, 0 }, /* 27 VK_ESCAPE */ {0, 0, 0, 0, 0 }, /* 28 VK_CONVERT */ {0, 0, 0, 0, 0 }, /* 29 VK_NONCONVERT */ {0, 0, 0, 0, 0 }, /* 30 VK_ACCEPT */ {0, 0, 0, 0, 0 }, /* 31 VK_MODECHANGE */ {0x20, 0x20, 0x20, 0x20, 0 }, /* 32 VK_SPACE */ {KEY_A3, 0x39, CTL_PAD9, ALT_PAD9, 3 }, /* 33 VK_PRIOR */ {KEY_C3, 0x33, CTL_PAD3, ALT_PAD3, 4 }, /* 34 VK_NEXT */ {KEY_C1, 0x31, CTL_PAD1, ALT_PAD1, 5 }, /* 35 VK_END */ {KEY_A1, 0x37, CTL_PAD7, ALT_PAD7, 6 }, /* 36 VK_HOME */ {KEY_B1, 0x34, CTL_PAD4, ALT_PAD4, 7 }, /* 37 VK_LEFT */ {KEY_A2, 0x38, CTL_PAD8, ALT_PAD8, 8 }, /* 38 VK_UP */ {KEY_B3, 0x36, CTL_PAD6, ALT_PAD6, 9 }, /* 39 VK_RIGHT */ {KEY_C2, 0x32, CTL_PAD2, ALT_PAD2, 10 }, /* 40 VK_DOWN */ {0, 0, 0, 0, 0 }, /* 41 VK_SELECT */ {0, 0, 0, 0, 0 }, /* 42 VK_PRINT */ {0, 0, 0, 0, 0 }, /* 43 VK_EXECUTE */ {KEY_PRINTSCREEN, 0, 0, ALT_PRINTSCREEN, 0 }, /* 44 VK_SNAPSHOT*/ {PAD0, 0x30, CTL_PAD0, ALT_PAD0, 11 }, /* 45 VK_INSERT */ {PADSTOP, 0x2E, CTL_PADSTOP, ALT_PADSTOP,12 }, /* 46 VK_DELETE */ {0, 0, 0, 0, 0 }, /* 47 VK_HELP */ {0x30, 0x29, CTL_0, ALT_0, 0 }, /* 48 */ {0x31, 0x21, CTL_1, ALT_1, 0 }, /* 49 */ {0x32, 0x40, CTL_2, ALT_2, 0 }, /* 50 */ {0x33, 0x23, CTL_3, ALT_3, 0 }, /* 51 */ {0x34, 0x24, CTL_4, ALT_4, 0 }, /* 52 */ {0x35, 0x25, CTL_5, ALT_5, 0 }, /* 53 */ {0x36, 0x5E, CTL_6, ALT_6, 0 }, /* 54 */ {0x37, 0x26, CTL_7, ALT_7, 0 }, /* 55 */ {0x38, 0x2A, CTL_8, ALT_8, 0 }, /* 56 */ {0x39, 0x28, CTL_9, ALT_9, 0 }, /* 57 */ {0, 0, 0, 0, 0 }, /* 58 */ {0, 0, 0, 0, 0 }, /* 59 */ {0, 0, 0, 0, 0 }, /* 60 */ {0, 0, 0, 0, 0 }, /* 61 */ {0, 0, 0, 0, 0 }, /* 62 */ {0, 0, 0, 0, 0 }, /* 63 */ {0, 0, 0, 0, 0 }, /* 64 */ {0x61, 0x41, 0x01, ALT_A, 0 }, /* 65 */ {0x62, 0x42, 0x02, ALT_B, 0 }, /* 66 */ {0x63, 0x43, 0x03, ALT_C, 0 }, /* 67 */ {0x64, 0x44, 0x04, ALT_D, 0 }, /* 68 */ {0x65, 0x45, 0x05, ALT_E, 0 }, /* 69 */ {0x66, 0x46, 0x06, ALT_F, 0 }, /* 70 */ {0x67, 0x47, 0x07, ALT_G, 0 }, /* 71 */ {0x68, 0x48, 0x08, ALT_H, 0 }, /* 72 */ {0x69, 0x49, 0x09, ALT_I, 0 }, /* 73 */ {0x6A, 0x4A, 0x0A, ALT_J, 0 }, /* 74 */ {0x6B, 0x4B, 0x0B, ALT_K, 0 }, /* 75 */ {0x6C, 0x4C, 0x0C, ALT_L, 0 }, /* 76 */ {0x6D, 0x4D, 0x0D, ALT_M, 0 }, /* 77 */ {0x6E, 0x4E, 0x0E, ALT_N, 0 }, /* 78 */ {0x6F, 0x4F, 0x0F, ALT_O, 0 }, /* 79 */ {0x70, 0x50, 0x10, ALT_P, 0 }, /* 80 */ {0x71, 0x51, 0x11, ALT_Q, 0 }, /* 81 */ {0x72, 0x52, 0x12, ALT_R, 0 }, /* 82 */ {0x73, 0x53, 0x13, ALT_S, 0 }, /* 83 */ {0x74, 0x54, 0x14, ALT_T, 0 }, /* 84 */ {0x75, 0x55, 0x15, ALT_U, 0 }, /* 85 */ {0x76, 0x56, 0x16, ALT_V, 0 }, /* 86 */ {0x77, 0x57, 0x17, ALT_W, 0 }, /* 87 */ {0x78, 0x58, 0x18, ALT_X, 0 }, /* 88 */ {0x79, 0x59, 0x19, ALT_Y, 0 }, /* 89 */ {0x7A, 0x5A, 0x1A, ALT_Z, 0 }, /* 90 */ {0, 0, 0, 0, 0 }, /* 91 VK_LWIN */ {0, 0, 0, 0, 0 }, /* 92 VK_RWIN */ {KEY_APPS, KEY_SAPPS, CTL_APPS, ALT_APPS, 13 }, /* 93 VK_APPS */ {0, 0, 0, 0, 0 }, /* 94 */ {0, 0, 0, 0, 0 }, /* 95 */ {0x30, 0, CTL_PAD0, ALT_PAD0, 0 }, /* 96 VK_NUMPAD0 */ {0x31, 0, CTL_PAD1, ALT_PAD1, 0 }, /* 97 VK_NUMPAD1 */ {0x32, 0, CTL_PAD2, ALT_PAD2, 0 }, /* 98 VK_NUMPAD2 */ {0x33, 0, CTL_PAD3, ALT_PAD3, 0 }, /* 99 VK_NUMPAD3 */ {0x34, 0, CTL_PAD4, ALT_PAD4, 0 }, /* 100 VK_NUMPAD4 */ {0x35, 0, CTL_PAD5, ALT_PAD5, 0 }, /* 101 VK_NUMPAD5 */ {0x36, 0, CTL_PAD6, ALT_PAD6, 0 }, /* 102 VK_NUMPAD6 */ {0x37, 0, CTL_PAD7, ALT_PAD7, 0 }, /* 103 VK_NUMPAD7 */ {0x38, 0, CTL_PAD8, ALT_PAD8, 0 }, /* 104 VK_NUMPAD8 */ {0x39, 0, CTL_PAD9, ALT_PAD9, 0 }, /* 105 VK_NUMPAD9 */ {PADSTAR, SHF_PADSTAR,CTL_PADSTAR, ALT_PADSTAR,999 }, /* 106 VK_MULTIPLY*/ {PADPLUS, SHF_PADPLUS,CTL_PADPLUS, ALT_PADPLUS,999 }, /* 107 VK_ADD */ {0, 0, 0, 0, 0 }, /* 108 VK_SEPARATOR */ {PADMINUS, SHF_PADMINUS,CTL_PADMINUS,ALT_PADMINUS,999}, /* 109 VK_SUBTRACT*/ {0x2E, 0, CTL_PADSTOP, ALT_PADSTOP,0 }, /* 110 VK_DECIMAL */ {PADSLASH, SHF_PADSLASH,CTL_PADSLASH,ALT_PADSLASH,2 }, /* 111 VK_DIVIDE */ {KEY_F(1), KEY_F(13), KEY_F(25), KEY_F(37), 0 }, /* 112 VK_F1 */ {KEY_F(2), KEY_F(14), KEY_F(26), KEY_F(38), 0 }, /* 113 VK_F2 */ {KEY_F(3), KEY_F(15), KEY_F(27), KEY_F(39), 0 }, /* 114 VK_F3 */ {KEY_F(4), KEY_F(16), KEY_F(28), KEY_F(40), 0 }, /* 115 VK_F4 */ {KEY_F(5), KEY_F(17), KEY_F(29), KEY_F(41), 0 }, /* 116 VK_F5 */ {KEY_F(6), KEY_F(18), KEY_F(30), KEY_F(42), 0 }, /* 117 VK_F6 */ {KEY_F(7), KEY_F(19), KEY_F(31), KEY_F(43), 0 }, /* 118 VK_F7 */ {KEY_F(8), KEY_F(20), KEY_F(32), KEY_F(44), 0 }, /* 119 VK_F8 */ {KEY_F(9), KEY_F(21), KEY_F(33), KEY_F(45), 0 }, /* 120 VK_F9 */ {KEY_F(10), KEY_F(22), KEY_F(34), KEY_F(46), 0 }, /* 121 VK_F10 */ {KEY_F(11), KEY_F(23), KEY_F(35), KEY_F(47), 0 }, /* 122 VK_F11 */ {KEY_F(12), KEY_F(24), KEY_F(36), KEY_F(48), 0 }, /* 123 VK_F12 */ /* 124 through 218 */ {0, 0, 0, 0, 0}, /* 124 VK_F13 */ {0, 0, 0, 0, 0}, /* 125 VK_F14 */ {0, 0, 0, 0, 0}, /* 126 VK_F15 */ {0, 0, 0, 0, 0}, /* 127 VK_F16 */ {0, 0, 0, 0, 0}, /* 128 VK_F17 */ {0, 0, 0, 0, 0}, /* 129 VK_F18 */ {0, 0, 0, 0, 0}, /* 130 VK_F19 */ {0, 0, 0, 0, 0}, /* 131 VK_F20 */ {0, 0, 0, 0, 0}, /* 132 VK_F21 */ {0, 0, 0, 0, 0}, /* 133 VK_F22 */ {0, 0, 0, 0, 0}, /* 134 VK_F23 */ {0, 0, 0, 0, 0}, /* 135 VK_F24 */ {0, 0, 0, 0, 0}, /* 136 unassigned */ {0, 0, 0, 0, 0}, /* 137 unassigned */ {0, 0, 0, 0, 0}, /* 138 unassigned */ {0, 0, 0, 0, 0}, /* 139 unassigned */ {0, 0, 0, 0, 0}, /* 140 unassigned */ {0, 0, 0, 0, 0}, /* 141 unassigned */ {0, 0, 0, 0, 0}, /* 142 unassigned */ {0, 0, 0, 0, 0}, /* 143 unassigned */ {0, 0, 0, 0, 0}, /* 144 VK_NUMLOCK */ {KEY_SCROLLLOCK, 0, 0, ALT_SCROLLLOCK, 0}, /* 145 VKSCROLL */ {0, 0, 0, 0, 0}, /* 146 OEM specific */ {0, 0, 0, 0, 0}, /* 147 OEM specific */ {0, 0, 0, 0, 0}, /* 148 OEM specific */ {0, 0, 0, 0, 0}, /* 149 OEM specific */ {0, 0, 0, 0, 0}, /* 150 OEM specific */ {0, 0, 0, 0, 0}, /* 151 Unassigned */ {0, 0, 0, 0, 0}, /* 152 Unassigned */ {0, 0, 0, 0, 0}, /* 153 Unassigned */ {0, 0, 0, 0, 0}, /* 154 Unassigned */ {0, 0, 0, 0, 0}, /* 155 Unassigned */ {0, 0, 0, 0, 0}, /* 156 Unassigned */ {0, 0, 0, 0, 0}, /* 157 Unassigned */ {0, 0, 0, 0, 0}, /* 158 Unassigned */ {0, 0, 0, 0, 0}, /* 159 Unassigned */ {0, 0, 0, 0, 0}, /* 160 VK_LSHIFT */ {0, 0, 0, 0, 0}, /* 161 VK_RSHIFT */ {0, 0, 0, 0, 0}, /* 162 VK_LCONTROL */ {0, 0, 0, 0, 0}, /* 163 VK_RCONTROL */ {0, 0, 0, 0, 0}, /* 164 VK_LMENU */ {0, 0, 0, 0, 0}, /* 165 VK_RMENU */ {0, 0, 0, 0, 14}, /* 166 VK_BROWSER_BACK */ {0, 0, 0, 0, 15}, /* 167 VK_BROWSER_FORWARD */ {0, 0, 0, 0, 16}, /* 168 VK_BROWSER_REFRESH */ {0, 0, 0, 0, 17}, /* 169 VK_BROWSER_STOP */ {0, 0, 0, 0, 18}, /* 170 VK_BROWSER_SEARCH */ {0, 0, 0, 0, 19}, /* 171 VK_BROWSER_FAVORITES */ {0, 0, 0, 0, 20}, /* 172 VK_BROWSER_HOME */ {0, 0, 0, 0, 21}, /* 173 VK_VOLUME_MUTE */ {0, 0, 0, 0, 22}, /* 174 VK_VOLUME_DOWN */ {0, 0, 0, 0, 23}, /* 175 VK_VOLUME_UP */ {0, 0, 0, 0, 24}, /* 176 VK_MEDIA_NEXT_TRACK */ {0, 0, 0, 0, 25}, /* 177 VK_MEDIA_PREV_TRACK */ {0, 0, 0, 0, 26}, /* 178 VK_MEDIA_STOP */ {0, 0, 0, 0, 27}, /* 179 VK_MEDIA_PLAY_PAUSE */ {0, 0, 0, 0, 28}, /* 180 VK_LAUNCH_MAIL */ {0, 0, 0, 0, 29}, /* 181 VK_LAUNCH_MEDIA_SELECT */ {0, 0, 0, 0, 30}, /* 182 VK_LAUNCH_APP1 */ {0, 0, 0, 0, 31}, /* 183 VK_LAUNCH_APP2 */ {0, 0, 0, 0, 0}, /* 184 Reserved */ {0, 0, 0, 0, 0}, /* 185 Reserved */ {';', ':', CTL_SEMICOLON, ALT_SEMICOLON, 0}, /* 186 VK_OEM_1 */ {'=', '+', CTL_EQUAL, ALT_EQUAL, 0}, /* 187 VK_OEM_PLUS */ {',', '<', CTL_COMMA, ALT_COMMA, 0}, /* 188 VK_OEM_COMMA */ {'-', '_', CTL_MINUS, ALT_MINUS, 0}, /* 189 VK_OEM_MINUS */ {'.', '>', CTL_STOP, ALT_STOP, 0}, /* 190 VK_OEM_PERIOD */ {'/', '?', CTL_FSLASH, ALT_FSLASH, 0}, /* 191 VK_OEM_2 */ {'`', '~', CTL_BQUOTE, ALT_BQUOTE, 0}, /* 192 VK_OEM_3 */ {0, 0, 0, 0, 0}, /* 193 */ {0, 0, 0, 0, 0}, /* 194 */ {0, 0, 0, 0, 0}, /* 195 */ {0, 0, 0, 0, 0}, /* 196 */ {0, 0, 0, 0, 0}, /* 197 */ {0, 0, 0, 0, 0}, /* 198 */ {0, 0, 0, 0, 0}, /* 199 */ {0, 0, 0, 0, 0}, /* 200 */ {0, 0, 0, 0, 0}, /* 201 */ {0, 0, 0, 0, 0}, /* 202 */ {0, 0, 0, 0, 0}, /* 203 */ {0, 0, 0, 0, 0}, /* 204 */ {0, 0, 0, 0, 0}, /* 205 */ {0, 0, 0, 0, 0}, /* 206 */ {0, 0, 0, 0, 0}, /* 207 */ {0, 0, 0, 0, 0}, /* 208 */ {0, 0, 0, 0, 0}, /* 209 */ {0, 0, 0, 0, 0}, /* 210 */ {0, 0, 0, 0, 0}, /* 211 */ {0, 0, 0, 0, 0}, /* 212 */ {0, 0, 0, 0, 0}, /* 213 */ {0, 0, 0, 0, 0}, /* 214 */ {0, 0, 0, 0, 0}, /* 215 */ {0, 0, 0, 0, 0}, /* 216 */ {0, 0, 0, 0, 0}, /* 217 */ {0, 0, 0, 0, 0}, /* 218 */ {0x5B, 0x7B, 0x1B, ALT_LBRACKET,0 }, /* 219 VK_OEM_4 */ {0x5C, 0x7C, 0x1C, ALT_BSLASH, 0 }, /* 220 VK_OEM_5 */ {0x5D, 0x7D, 0x1D, ALT_RBRACKET,0 }, /* 221 VK_OEM_6 */ {'\'', '"', 0x27, ALT_FQUOTE, 0 }, /* 222 VK_OEM_7 */ {0, 0, 0, 0, 0 }, /* 223 VK_OEM_8 */ {0, 0, 0, 0, 0 }, /* 224 */ {0, 0, 0, 0, 0 } /* 225 */ }; /* End of kptab[] */ static const KPTAB ext_kptab[] = { {0, 0, 0, 0, }, /* 0 MUST BE EMPTY */ {PADENTER, SHF_PADENTER, CTL_PADENTER, ALT_PADENTER}, /* 1 13 */ {PADSLASH, SHF_PADSLASH, CTL_PADSLASH, ALT_PADSLASH}, /* 2 111 */ {KEY_PPAGE, KEY_SPREVIOUS, CTL_PGUP, ALT_PGUP }, /* 3 33 */ {KEY_NPAGE, KEY_SNEXT, CTL_PGDN, ALT_PGDN }, /* 4 34 */ {KEY_END, KEY_SEND, CTL_END, ALT_END }, /* 5 35 */ {KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME }, /* 6 36 */ {KEY_LEFT, KEY_SLEFT, CTL_LEFT, ALT_LEFT }, /* 7 37 */ {KEY_UP, KEY_SUP, CTL_UP, ALT_UP }, /* 8 38 */ {KEY_RIGHT, KEY_SRIGHT, CTL_RIGHT, ALT_RIGHT }, /* 9 39 */ {KEY_DOWN, KEY_SDOWN, CTL_DOWN, ALT_DOWN }, /* 10 40 */ {KEY_IC, KEY_SIC, CTL_INS, ALT_INS }, /* 11 45 */ {KEY_DC, KEY_SDC, CTL_DEL, ALT_DEL }, /* 12 46 */ {KEY_APPS, KEY_SAPPS , CTL_APPS, ALT_APPS }, /* 13 93 VK_APPS */ {KEY_BROWSER_BACK, KEY_SBROWSER_BACK, KEY_CBROWSER_BACK, KEY_ABROWSER_BACK, }, /* 14 166 VK_BROWSER_BACK */ {KEY_BROWSER_FWD, KEY_SBROWSER_FWD, KEY_CBROWSER_FWD, KEY_ABROWSER_FWD, }, /* 15 167 VK_BROWSER_FORWARD */ {KEY_BROWSER_REF, KEY_SBROWSER_REF, KEY_CBROWSER_REF, KEY_ABROWSER_REF, }, /* 16 168 VK_BROWSER_REFRESH */ {KEY_BROWSER_STOP, KEY_SBROWSER_STOP, KEY_CBROWSER_STOP, KEY_ABROWSER_STOP, }, /* 17 169 VK_BROWSER_STOP */ {KEY_SEARCH, KEY_SSEARCH, KEY_CSEARCH, KEY_ASEARCH, }, /* 18 170 VK_BROWSER_SEARCH */ {KEY_FAVORITES, KEY_SFAVORITES, KEY_CFAVORITES, KEY_AFAVORITES, }, /* 19 171 VK_BROWSER_FAVORITES */ {KEY_BROWSER_HOME, KEY_SBROWSER_HOME, KEY_CBROWSER_HOME, KEY_ABROWSER_HOME, }, /* 20 172 VK_BROWSER_HOME */ {KEY_VOLUME_MUTE, KEY_SVOLUME_MUTE, KEY_CVOLUME_MUTE, KEY_AVOLUME_MUTE, }, /* 21 173 VK_VOLUME_MUTE */ {KEY_VOLUME_DOWN, KEY_SVOLUME_DOWN, KEY_CVOLUME_DOWN, KEY_AVOLUME_DOWN, }, /* 22 174 VK_VOLUME_DOWN */ {KEY_VOLUME_UP, KEY_SVOLUME_UP, KEY_CVOLUME_UP, KEY_AVOLUME_UP, }, /* 23 175 VK_VOLUME_UP */ {KEY_NEXT_TRACK, KEY_SNEXT_TRACK, KEY_CNEXT_TRACK, KEY_ANEXT_TRACK, }, /* 24 176 VK_MEDIA_NEXT_TRACK */ {KEY_PREV_TRACK, KEY_SPREV_TRACK, KEY_CPREV_TRACK, KEY_APREV_TRACK, }, /* 25 177 VK_MEDIA_PREV_TRACK */ {KEY_MEDIA_STOP, KEY_SMEDIA_STOP, KEY_CMEDIA_STOP, KEY_AMEDIA_STOP, }, /* 26 178 VK_MEDIA_STOP */ {KEY_PLAY_PAUSE, KEY_SPLAY_PAUSE, KEY_CPLAY_PAUSE, KEY_APLAY_PAUSE, }, /* 27 179 VK_MEDIA_PLAY_PAUSE */ {KEY_LAUNCH_MAIL, KEY_SLAUNCH_MAIL, KEY_CLAUNCH_MAIL, KEY_ALAUNCH_MAIL, }, /* 28 180 VK_LAUNCH_MAIL */ {KEY_MEDIA_SELECT, KEY_SMEDIA_SELECT, KEY_CMEDIA_SELECT, KEY_AMEDIA_SELECT, }, /* 29 181 VK_LAUNCH_MEDIA_SELECT */ {KEY_LAUNCH_APP1, KEY_SLAUNCH_APP1, KEY_CLAUNCH_APP1, KEY_ALAUNCH_APP1, }, /* 30 182 VK_LAUNCH_APP1 */ {KEY_LAUNCH_APP2, KEY_SLAUNCH_APP2, KEY_CLAUNCH_APP2, KEY_ALAUNCH_APP2, }, /* 31 183 VK_LAUNCH_APP2 */ }; HFONT PDC_get_font_handle( const int is_bold); /* pdcdisp.c */ /* Mouse handling is done as follows: What we want is a setup wherein, if the user presses and releases a mouse button within SP->mouse_wait milliseconds, there will be a KEY_MOUSE issued through getch( ) and the "button state" for that button will be set to BUTTON_CLICKED. If the user presses and releases the button, and it takes _longer_ than SP->mouse_wait milliseconds, then there should be a KEY_MOUSE issued with the "button state" set to BUTTON_PRESSED. Then, later, another KEY_MOUSE with a BUTTON_RELEASED. To accomplish this: when a message such as WM_LBUTTONDOWN, WM_RBUTTONDOWN, or WM_MBUTTONDOWN is issued (and more recently WM_XBUTTONDOWN for five-button mice), we set up a timer with a period of SP->mouse_wait milliseconds. There are then two possibilities. The user will release the button quickly (so it's a "click") or they won't (and it's a "press/release"). In the first case, we'll get the WM_xBUTTONUP message before the WM_TIMER one. We'll kill the timer and set up the BUTTON_CLICKED state. (*) In the second case, we'll get the WM_TIMER message first, so we'll set the BUTTON_PRESSED state and kill the timer. Eventually, the user will get around to letting go of the mouse button, and we'll get that WM_xBUTTONUP message. At that time, we'll set the BUTTON_RELEASED state and add the second KEY_MOUSE to the key queue. Also, note that if there is already a KEY_MOUSE to the queue, there's no point in adding another one. At least at present, the actual mouse events aren't queued anyway. So if there was, say, a click and then a release without getch( ) being called in between, you'd then have two KEY_MOUSEs on the queue, but would have lost all information about what the first one actually was. Hence the code near the end of this function to ensure there isn't already a KEY_MOUSE in the queue. Also, a note about wheel handling. Pre-Vista, you could just say "the wheel went up" or "the wheel went down". Vista introduced the possibility that the mouse motion could be a smoothly varying quantity. So on each mouse move, we add in the amount moved, then check to see if that's enough to trigger a wheel up/down event (or possibly several). The idea is that whereas before, each movement would be 120 units (the default), you might now get a series of 40-unit moves and should emit a wheel up/down event on every third move. (*) Things are actually slightly more complicated than this. In general, it'll just be a plain old BUTTON_CLICKED state. But if there was another BUTTON_CLICKED within the last 2 * SP->mouse_wait milliseconds, then this must be a _double_ click, so we set the BUTTON_DOUBLE_CLICKED state. And if, within that time frame, there was a double or triple click, then we set the BUTTON_TRIPLE_CLICKED state. There isn't a "quad" or higher state, so if you quadruple-click the mouse, with each click separated by less than 2 * SP->mouse_wait milliseconds, then the messages sent will be BUTTON_CLICKED, BUTTON_DOUBLE_CLICKED, BUTTON_TRIPLE_CLICKED, and then another BUTTON_TRIPLE_CLICKED. */ static int set_mouse( const int button_index, const int button_state, const LPARAM lParam) { int i, n_key_mouse_to_add = 1; POINT pt; pt.x = LOWORD( lParam); pt.y = HIWORD( lParam); if( button_index == -1) /* mouse moved, no button */ n_key_mouse_to_add = 1; else { memset(&pdc_mouse_status, 0, sizeof(MOUSE_STATUS)); if( button_index < PDC_MAX_MOUSE_BUTTONS) { if( button_index < 3) { pdc_mouse_status.button[button_index] = (short)button_state; pdc_mouse_status.changes = (1 << button_index); } else { pdc_mouse_status.xbutton[button_index - 3] = (short)button_state; pdc_mouse_status.changes = (0x40 << button_index); } } else /* actually a wheel mouse movement */ { /* button_state = number of units moved */ static int mouse_wheel_vertical_loc = 0; static int mouse_wheel_horizontal_loc = 0; const int mouse_wheel_sensitivity = 120; n_key_mouse_to_add = 0; if( button_index == VERTICAL_WHEEL_EVENT) { mouse_wheel_vertical_loc += button_state; while( mouse_wheel_vertical_loc > mouse_wheel_sensitivity / 2) { n_key_mouse_to_add++; mouse_wheel_vertical_loc -= mouse_wheel_sensitivity; pdc_mouse_status.changes |= PDC_MOUSE_WHEEL_UP; } while( mouse_wheel_vertical_loc < -mouse_wheel_sensitivity / 2) { n_key_mouse_to_add++; mouse_wheel_vertical_loc += mouse_wheel_sensitivity; pdc_mouse_status.changes |= PDC_MOUSE_WHEEL_DOWN; } } else /* must be a horizontal event: */ { mouse_wheel_horizontal_loc += button_state; while( mouse_wheel_horizontal_loc > mouse_wheel_sensitivity / 2) { n_key_mouse_to_add++; mouse_wheel_horizontal_loc -= mouse_wheel_sensitivity; pdc_mouse_status.changes |= PDC_MOUSE_WHEEL_RIGHT; } while( mouse_wheel_horizontal_loc < -mouse_wheel_sensitivity / 2) { n_key_mouse_to_add++; mouse_wheel_horizontal_loc += mouse_wheel_sensitivity; pdc_mouse_status.changes |= PDC_MOUSE_WHEEL_LEFT; } } /* I think it may be that for wheel events, we */ /* return x = y = -1, rather than getting the */ /* actual mouse position. I don't like this, but */ /* I like messing up existing apps even less. */ pt.x = -PDC_cxChar; pt.y = -PDC_cyChar; /* ScreenToClient( PDC_hWnd, &pt); Wheel posns are in screen, */ } /* not client, coords; gotta xform them */ } pdc_mouse_status.x = pt.x / PDC_cxChar; pdc_mouse_status.y = pt.y / PDC_cyChar; /* if( SP->save_key_modifiers) */ { int i, button_flags = 0; if( GetKeyState( VK_MENU) & 0x8000) button_flags |= PDC_BUTTON_ALT; if( GetKeyState( VK_SHIFT) & 0x8000) button_flags |= PDC_BUTTON_SHIFT; if( GetKeyState( VK_CONTROL) & 0x8000) button_flags |= PDC_BUTTON_CONTROL; for (i = 0; i < 3; i++) pdc_mouse_status.button[i] |= button_flags; for (i = 0; i < PDC_N_EXTENDED_MOUSE_BUTTONS; i++) pdc_mouse_status.xbutton[i] |= button_flags; } /* If there is already a KEY_MOUSE in the queue, we */ /* don't really want to add another one. See above. */ i = PDC_key_queue_low; while( i != PDC_key_queue_high) { if( PDC_key_queue[i] == KEY_MOUSE) { debug_printf( "Mouse key already in queue\n"); return( 0); } i = (i + 1) % KEY_QUEUE_SIZE; } /* If the window is maximized, the click may occur just */ /* outside the "real" screen area. If so, we again */ /* don't want to add a key to the queue: */ if( pdc_mouse_status.x >= PDC_n_cols || pdc_mouse_status.y >= PDC_n_rows) n_key_mouse_to_add = 0; /* OK, there isn't a KEY_MOUSE already in the queue. */ /* So we'll add one (or zero or more, for wheel mice): */ while( n_key_mouse_to_add--) add_key_to_queue( KEY_MOUSE); return( 0); } /* The following should be #defined in 'winuser.h', but such is */ /* not always the case. The following fixes the exceptions: */ #ifndef WM_MOUSEWHEEL #define WM_MOUSEWHEEL 0x020A #endif #ifndef WM_MOUSEHWHEEL #define WM_MOUSEHWHEEL 0x020E #endif #ifndef WM_XBUTTONDOWN #define WM_XBUTTONDOWN 0x020B #define WM_XBUTTONUP 0x020C #endif #ifndef MK_XBUTTON1 #define MK_XBUTTON1 0x0020 #define MK_XBUTTON2 0x0040 #endif #ifdef USE_FALLBACK_FONT extern GLYPHSET *PDC_unicode_range_data; #endif /* #ifdef USE_FALLBACK_FONT */ int PDC_blink_state = 0; #define TIMER_ID_FOR_BLINKING 0x2000 /* When first loading a font, we use 'get_character_sizes' to briefly load the (non-bold, non-italic flavor of the) font, get its height and width, and call GetFontUnicodeRanges to determine which characters are actually available from that font. That set of ranges is used so that, when we come across characters not in the font, we can switch to a "fallback" font (Unifont, most likely). */ static void get_character_sizes( const HWND hwnd, int *xchar_size, int *ychar_size) { HFONT hFont = PDC_get_font_handle( 0); HFONT prev_font; HDC hdc = GetDC (hwnd) ; TEXTMETRIC tm ; #ifdef USE_FALLBACK_FONT DWORD size; #endif prev_font = SelectObject (hdc, hFont); GetTextMetrics (hdc, &tm) ; #ifdef USE_FALLBACK_FONT assert( !PDC_unicode_range_data); size = GetFontUnicodeRanges( hdc, NULL); PDC_unicode_range_data = (GLYPHSET *)calloc( 1, size); PDC_unicode_range_data->cbThis = size; size = GetFontUnicodeRanges( hdc, PDC_unicode_range_data); #endif /* #ifdef USE_FALLBACK_FONT */ SelectObject( hdc, prev_font); ReleaseDC (hwnd, hdc) ; DeleteObject( hFont); *xchar_size = tm.tmAveCharWidth ; *ychar_size = tm.tmHeight; } INLINE void sort_out_rect( RECT *rect) { int temp; if( rect->left > rect->right) { temp = rect->right; rect->right = rect->left; rect->left = temp; } if( rect->top > rect->bottom) { temp = rect->bottom; rect->bottom = rect->top; rect->top = temp; } } static int rectangle_from_chars_to_pixels( RECT *rect) { int rval = 1; if( rect->right == rect->left && rect->top == rect->bottom) rval = 0; sort_out_rect( rect); if( rect->top < 0) rval = 0; rect->right++; rect->bottom++; rect->left *= PDC_cxChar; rect->right *= PDC_cxChar; rect->top *= PDC_cyChar; rect->bottom *= PDC_cyChar; return( rval); } /* When updating the mouse rectangle, you _could_ just remove the old one and draw the new one. But that sometimes caused flickering if the mouse area was large. In such cases, it's better to determine what areas actually changed, and invert just those. So the following checks to see if two overlapping rectangles are being drawn (this is the norm) and figures out the area that actually needs to be flipped. It does seem to decrease flickering to near-zero. */ static int PDC_selecting_rectangle = 1; int PDC_find_ends_of_selected_text( const int line, const RECT *rect, int *x) { int rval = 0, i; if( (rect->top - line) * (rect->bottom - line) <= 0 && (rect->top != rect->bottom || rect->left != rect->right)) { if( PDC_selecting_rectangle || rect->top == rect->bottom) { x[0] = min( rect->right, rect->left); x[1] = max( rect->right, rect->left); rval = 1; } else if( rect->top <= line && line <= rect->bottom) { x[0] = (line == rect->top ? rect->left : 0); x[1] = (line == rect->bottom ? rect->right : SP->cols - 1); rval = 1; } else if( rect->top >= line && line >= rect->bottom) { x[0] = (line == rect->bottom ? rect->right : 0); x[1] = (line == rect->top ? rect->left : SP->cols - 1); rval = 1; } } if( rval) for( i = 0; i < 2; i++) if( x[i] > SP->cols - 1) x[i] = SP->cols - 1; return( rval); } /* Called in only one place, so let's inline it */ INLINE void show_mouse_rect( const HWND hwnd, RECT before, RECT after) { if( before.top > -1 || after.top > -1) if( memcmp( &after, &before, sizeof( RECT))) { const HDC hdc = GetDC( hwnd) ; if( PDC_selecting_rectangle) { const int show_before = rectangle_from_chars_to_pixels( &before); const int show_after = rectangle_from_chars_to_pixels( &after); if( show_before && show_after) { RECT temp; if( before.top < after.top) { temp = before; before = after; after = temp; } if( before.top < after.bottom && after.right > before.left && before.right > after.left) { const int tval = min( after.bottom, before.bottom); temp = after; temp.bottom = before.top; InvertRect( hdc, &temp); temp.top = temp.bottom; temp.bottom = tval; temp.right = max( after.right, before.right); temp.left = min( after.right, before.right); InvertRect( hdc, &temp); temp.right = max( after.left, before.left); temp.left = min( after.left, before.left); InvertRect( hdc, &temp); temp = (after.bottom > before.bottom ? after : before); temp.top = tval; InvertRect( hdc, &temp); } } else if( show_before) InvertRect( hdc, &before); else if( show_after) InvertRect( hdc, &after); } else /* _not_ selecting rectangle; selecting lines */ { int line; for( line = 0; line < SP->lines; line++) { int x[4], n_rects = 0, i; n_rects = PDC_find_ends_of_selected_text( line, &before, x); n_rects += PDC_find_ends_of_selected_text( line, &after, x + n_rects * 2); if( n_rects == 2) if( x[0] == x[2] && x[1] == x[3]) n_rects = 0; /* Rects are same & will cancel */ for( i = 0; i < n_rects; i++) { RECT trect; trect.left = x[i + i]; trect.right = x[i + i + 1]; trect.top = line; trect.bottom = line; rectangle_from_chars_to_pixels( &trect); InvertRect( hdc, &trect); } } } ReleaseDC( hwnd, hdc) ; } } /* Cygwin lacks _splitpath, _wsplitpath. THE FOLLOWING ARE NOT FULLY TESTED IMPLEMENTATIONS OF THOSE TWO FUNCTIONS, because the only use we make of them is to get fname. (Though I did write a little test program, and they seem to work.) */ #ifdef __CYGWIN__ #ifdef PDC_WIDE static void my_wsplitpath( const wchar_t *path, wchar_t *drive, wchar_t *dir, wchar_t *fname, wchar_t *ext) { size_t i, loc = 0; assert( path); assert( fname); if( path[0] && path[1] == ':') { if( drive) { drive[0] = path[0]; drive[1] = ':'; drive[2] = '\0'; } path += 2; } else if( drive) *drive = '\0'; for( i = 0; path[i]; i++) if( path[i] == '/' || path[i] == '\\') loc = i + 1; if( dir) { memcpy( dir, path, loc * sizeof( wchar_t)); dir[loc] = '\0'; } if( loc) path += loc; loc = 0; while( path[loc] && path[loc] != '.') loc++; if( fname) { memcpy( fname, path, loc * sizeof( wchar_t)); fname[loc] = '\0'; } if( ext) wcscpy( ext, path + loc); } #endif /* #ifdef PDC_WIDE */ static void my_splitpath( const char *path, char *drive, char *dir, char *fname, char *ext) { size_t i, loc = 0; assert( path); assert( fname); if( path[0] && path[1] == ':') { if( drive) { drive[0] = path[0]; drive[1] = ':'; drive[2] = '\0'; } path += 2; } else if( drive) *drive = '\0'; for( i = 0; path[i]; i++) if( path[i] == '/' || path[i] == '\\') loc = i + 1; if( dir) { memcpy( dir, path, loc * sizeof( char)); dir[loc] = '\0'; } if( loc) path += loc; loc = 0; while( path[loc] && path[loc] != '.') loc++; if( fname) { memcpy( fname, path, loc * sizeof( char)); fname[loc] = '\0'; } if( ext) strcpy( ext, path + loc); } #else /* non-Cygwin case : */ #define my_splitpath _splitpath #define my_wsplitpath _wsplitpath #define GOT_ARGV_ARGC #endif /* #ifdef __CYGWIN__ */ /* This function looks at the full command line, which includes a fully specified path to the executable and arguments; and strips out just the name of the app, with the arguments optionally appended. Hence, C:\PDCURSES\WINGUI\TESTCURS.EXE arg1 arg2 would be reduced to 'Testcurs' (if include_args == 0) or 'Testcurs arg1 arg2' (if include_args == 1). The former case is used to create a (hopefully unique) registry key for the app, so that the app's specific settings (screen and font size) will be stored for the next run. The latter case is used to generate a default window title. Unfortunately, this code has to do some pretty strange things. In the Unicode (PDC_WIDE) case, we really should use __wargv; but that pointer may or may not be NULL. If it's NULL, we fall back on __argv. In at least one case, where this code is compiled into a DLL using MinGW and then used in an app compiled with MS Visual C, __argv isn't set either, and we drop back to looking at GetCommandLine( ). Which leads to a real oddity: GetCommandLine( ) may return something such as, say, "C:\PDCurses\WinGUI\testcurs.exe" -lRussian ...which, after being run through _splitpath or _wsplitpath, becomes testcurs.exe" -lRussian The .exe" is removed, and the command-line arguments shifted or removed, depending on the value of include_args. Pretty strange stuff. However, if one calls Xinitscr( ) and passed command-line arguments when starting this library, those arguments will be stored in PDC_argc and PDC_argv, and will be used instead of GetCommandLine. */ #ifdef UNICODE #define my_stprintf wsprintf #define my_tcslen wcslen #ifdef __CYGWIN__ /* Can't lowercase Unicode text in Cygwin */ #define my_tcslwr #elif defined _MSC_VER #define my_tcslwr _wcslwr #else #define my_tcslwr wcslwr #endif /* __CYGWIN__ */ #define my_tcscat wcscat #define my_tcscpy wcscpy #define my_stscanf swscanf #else /* UNICODE */ #define my_stprintf sprintf #define my_tcslen strlen #define my_tcslwr strlwr #ifdef _MSC_VER #define strlwr _strlwr #endif #define my_tcscat strcat #define my_tcscpy strcpy #define my_stscanf sscanf #endif /* UNICODE */ static void get_app_name( TCHAR *buff, const size_t buff_size, const bool include_args) { int i; size_t buff_space; #ifdef GOT_ARGV_ARGC int argc = (PDC_argc ? PDC_argc : __argc); char **argv = (PDC_argc ? PDC_argv : __argv); #else int argc = PDC_argc; char **argv = PDC_argv; #endif #ifdef PDC_WIDE wchar_t **wargv = __wargv; #ifdef GOT_ARGV_ARGC /* in case we can not access the array directly try to get it otherwise */ if( !wargv) { wchar_t *cmd_linew = GetCommandLine( ); if (cmd_linew) { wargv = CommandLineToArgvW (cmd_linew, &argc); } } if( wargv) { my_wsplitpath( wargv[0], NULL, NULL, buff, NULL); if ( include_args) { buff_space = buff_size - my_tcslen( buff) - 1; for ( i = 1; i < argc; i++) { size_t arg_len = my_tcslen( wargv[i]) + 1; if ( buff_space < arg_len) { break; } buff_space -= arg_len; wcscat( buff, L" "); wcscat( buff, wargv[i]); } } } else #endif /* #ifdef GOT_ARGV_ARGC */ if( argv) { char tbuff[MAX_PATH]; my_splitpath( argv[0], NULL, NULL, tbuff, NULL); if ( include_args) { buff_space = buff_size - strlen( tbuff) - 1; for ( i = 1; i < argc; i++) { size_t arg_len = strlen( argv[i]) + 1; if ( buff_space < arg_len) { break; } buff_space -= arg_len; strcat( tbuff, " "); strcat( tbuff, argv[i]); } } mbstowcs( buff, tbuff, strlen( tbuff) + 1); } else /* no __argv or PDC_argv pointer available */ { wchar_t *tptr; my_wsplitpath( GetCommandLine( ), NULL, NULL, buff, NULL); my_tcslwr( buff + 1); tptr = wcsstr( buff, L".exe\""); if( tptr) { if( include_args) memmove( tptr, tptr + 5, wcslen( tptr + 4) * sizeof( wchar_t)); else *tptr = '\0'; } } #else /* non-Unicode case */ if( argv) { my_splitpath( argv[0], NULL, NULL, buff, NULL); debug_printf( "Path: %s; exe: %s\n", argv[0], buff); if ( include_args) { buff_space = buff_size - my_tcslen( buff) - 1; for ( i = 1; i < argc; i++) { size_t arg_len = my_tcslen( argv[i]) + 1; if ( buff_space < arg_len) { break; } buff_space -= arg_len; strcat( buff, " "); strcat( buff, argv[i]); } } } else /* no __argv pointer available */ { char *tptr; my_splitpath( GetCommandLine( ), NULL, NULL, buff, NULL); strlwr( buff + 1); tptr = strstr( buff, ".exe\""); if( tptr) { if( include_args) memmove( tptr, tptr + 5, strlen( tptr + 4)); else *tptr = '\0'; } } #endif my_tcslwr( buff + 1); } /* This function extracts the first icon from the executable that is executing this DLL */ INLINE HICON get_app_icon( ) { #ifdef PDC_WIDE wchar_t filename[MAX_PATH]; #else char filename[MAX_PATH]; #endif HICON icon = NULL; if ( GetModuleFileName( NULL, filename, sizeof(filename) ) != 0 ) icon = ExtractIcon( 0, filename, 0 ); return icon; } extern TCHAR PDC_font_name[]; /* This flavor of Curses tries to store the window and font sizes on an app-by-app basis. To do this, it uses the above get_app_name( ) function, then sets or gets a corresponding value from the Windoze registry. The benefit should be that one can have one screen size/font for, say, Testcurs, while having different settings for, say, Firework or Rain or one's own programs. */ INLINE int set_default_sizes_from_registry( const int n_cols, const int n_rows, const int xloc, const int yloc, const int menu_shown) { DWORD is_new_key; HKEY hNewKey; long rval = RegCreateKeyEx( HKEY_CURRENT_USER, _T( "SOFTWARE\\PDCurses"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hNewKey, &is_new_key); if( rval == ERROR_SUCCESS) { TCHAR buff[180]; TCHAR key_name[MAX_PATH]; extern int PDC_font_size; if( IsZoomed( PDC_hWnd)) /* -1x-1 indicates a maximized window */ my_stprintf( buff, _T( "-1x-1,%d,0,0,%d"), PDC_font_size, menu_shown); else my_stprintf( buff, _T( "%dx%d,%d,%d,%d,%d"), n_cols, n_rows, PDC_font_size, xloc, yloc, menu_shown); my_stprintf( buff + my_tcslen( buff), _T(";%d,%d,%d,%d:"), min_lines, max_lines, min_cols, max_cols); my_tcscat( buff, PDC_font_name); get_app_name( key_name, MAX_PATH, FALSE); rval = RegSetValueEx( hNewKey, key_name, 0, REG_SZ, (BYTE *)buff, (DWORD)( my_tcslen( buff) * sizeof( TCHAR))); RegCloseKey( hNewKey); } debug_printf( "Size: %d %d; %d\n", n_cols, n_rows, rval); return( rval != ERROR_SUCCESS); } /* If the window is maximized, there will usually be a fractional character width at the right and bottom edges. The following code fills that in with a black brush. It takes the "paint rectangle", the area passed with a WM_PAINT message that specifies what chunk of the client area needs to be redrawn. If the window is _not_ maximized, this shouldn't happen; the window width/height should always be an integral multiple of the character width/height, with no slivers at the right and bottom edges. */ static void fix_up_edges( const HDC hdc, const RECT *rect) { const int x = PDC_n_cols * PDC_cxChar; const int y = PDC_n_rows * PDC_cyChar; if( rect->right >= x || rect->bottom >= y) { const HBRUSH hOldBrush = SelectObject( hdc, GetStockObject( BLACK_BRUSH)); SelectObject( hdc, GetStockObject( NULL_PEN)); if( rect->right >= x) Rectangle( hdc, x, rect->top, rect->right + 1, rect->bottom + 1); if( rect->bottom >= y) Rectangle( hdc, rect->left, y, rect->right + 1, rect->bottom + 1); SelectObject( hdc, hOldBrush); } } static void adjust_font_size( const int font_size_change) { extern int PDC_font_size; PDC_font_size += font_size_change; if( PDC_font_size < 2) PDC_font_size = 2; PDC_transform_line( 0, 0, 0, NULL); /* free any fonts */ get_character_sizes( PDC_hWnd, &PDC_cxChar, &PDC_cyChar); /* When the font size changes, do we want to keep */ /* the window the same size (except to remove any */ /* fractional character)? Or do we keep the number */ /* of rows/columns the same? For the nonce, I'm */ /* keeping the window size fixed if the window is */ /* maximized, but keeping the number of rows/lines */ /* fixed if it's windowed. That's my opinion. If */ /* you disagree, I have others. */ if( IsZoomed( PDC_hWnd)) { RECT client_rect; HDC hdc; GetClientRect( PDC_hWnd, &client_rect); PDC_n_rows = client_rect.bottom / PDC_cyChar; PDC_n_cols = client_rect.right / PDC_cxChar; keep_size_within_bounds( &PDC_n_rows, &PDC_n_cols); PDC_resize_screen( PDC_n_rows, PDC_n_cols); add_key_to_queue( KEY_RESIZE); SP->resized = TRUE; hdc = GetDC (PDC_hWnd) ; GetClientRect( PDC_hWnd, &client_rect); fix_up_edges( hdc, &client_rect); ReleaseDC( PDC_hWnd, hdc) ; } else { PDC_resize_screen( PDC_n_rows, PDC_n_cols); InvalidateRect( PDC_hWnd, NULL, FALSE); } } /* PDC_mouse_rect is the area currently highlit by dragging the */ /* mouse. It's global, sadly, because we need to ensure that */ /* the highlighting is respected when the text within that */ /* rectangle is redrawn by PDC_transform_line(). */ RECT PDC_mouse_rect = { -1, -1, -1, -1 }; int PDC_setclipboard_raw( const char *contents, long length, const bool translate_multibyte_to_wide_char); /* Called in only one place (when the left mouse button goes up), */ /* so we should inline it : */ INLINE void HandleBlockCopy( void) { int i, j, len, x[2]; TCHAR *buff, *tptr; /* Make a first pass to determine how much text is blocked: */ for( i = len = 0; i < SP->lines; i++) if( PDC_find_ends_of_selected_text( i, &PDC_mouse_rect, x)) len += x[1] - x[0] + 3; buff = tptr = (TCHAR *)malloc( (len + 1) * sizeof( TCHAR)); /* Make second pass to copy that text to a buffer: */ for( i = len = 0; i < SP->lines; i++) if( PDC_find_ends_of_selected_text( i, &PDC_mouse_rect, x)) { const chtype *cptr = curscr->_y[i]; for( j = 0; j < x[1] - x[0] + 1; j++) tptr[j] = (TCHAR)cptr[j + x[0]]; while( j > 0 && tptr[j - 1] == ' ') j--; /* remove trailing spaces */ tptr += j; *tptr++ = (TCHAR)13; *tptr++ = (TCHAR)10; } if( tptr != buff) /* at least one line read in */ { tptr[-2] = '\0'; /* cut off the last CR/LF */ PDC_setclipboard_raw( (char *)buff, (long)( tptr - buff), FALSE); } free( buff); } #define WM_ENLARGE_FONT (WM_USER + 1) #define WM_SHRINK_FONT (WM_USER + 2) #define WM_MARK_AND_COPY (WM_USER + 3) #define WM_TOGGLE_MENU (WM_USER + 4) #define WM_EXIT_GRACELESSLY (WM_USER + 5) #define WM_CHOOSE_FONT (WM_USER + 6) static int add_resize_key = 1; /*man-start************************************************************** Resize limits ------------- ### Synopsis void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines, const int new_min_cols, const int new_max_cols); ### Description For platforms supporting resizable windows (SDLx, WinGUI, X11). Some programs may be unprepared for a resize event; for these, calling this function with the max and min limits equal ensures that no user resizing can be done. Other programs may require at least a certain number, and/or no more than a certain number, of columns and/or lines. ### Portability PDCurses-only function. **man-end****************************************************************/ void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines, const int new_min_cols, const int new_max_cols) { min_lines = max( new_min_lines, 2); max_lines = max( new_max_lines, min_lines); min_cols = max( new_min_cols, 2); max_cols = max( new_max_cols, min_cols); } /* The screen should hold the characters (PDC_cxChar * n_default_columns */ /* pixels wide, similarly high). In width, we need two frame widths, */ /* one on each side. Vertically, we need two frame heights, plus room */ /* for the application title and the menu. */ static void adjust_window_size( int *xpixels, int *ypixels, int window_style, const int menu_shown) { RECT rect; rect.left = rect.top = 0; rect.right = *xpixels; rect.bottom = *ypixels; /* printf( "Adjusting to %d, %d\n", *xpixels, *ypixels); */ AdjustWindowRect( &rect, window_style, menu_shown); *xpixels = rect.right - rect.left; *ypixels = rect.bottom - rect.top; } static int keep_size_within_bounds( int *lines, int *cols) { int rval = 0; if( *lines < min_lines) { *lines = min_lines; rval = 1; } else if( *lines > max_lines) { *lines = max_lines; rval = 2; } if( *cols < min_cols) { *cols = min_cols; rval |= 4; } else if( *cols > max_cols) { *cols = max_cols; rval |= 8; } return( rval); } INLINE int get_default_sizes_from_registry( int *n_cols, int *n_rows, int *xloc, int *yloc, int *menu_shown) { TCHAR data[100]; DWORD size_out = sizeof( data); HKEY hKey = 0; long rval = RegOpenKeyEx( HKEY_CURRENT_USER, _T( "SOFTWARE\\PDCurses"), 0, KEY_READ, &hKey); if( !hKey) return( 1); if( rval == ERROR_SUCCESS) { TCHAR key_name[MAX_PATH]; get_app_name( key_name, MAX_PATH, FALSE); rval = RegQueryValueEx( hKey, key_name, NULL, NULL, (BYTE *)data, &size_out); if( rval == ERROR_SUCCESS) { extern int PDC_font_size; int x = -1, y = -1, bytes_read = 0; my_stscanf( data, _T( "%dx%d,%d,%d,%d,%d;%d,%d,%d,%d:%n"), &x, &y, &PDC_font_size, xloc, yloc, menu_shown, &min_lines, &max_lines, &min_cols, &max_cols, &bytes_read); if( bytes_read > 0 && data[bytes_read - 1] == ':') my_tcscpy( PDC_font_name, data + bytes_read); if( n_cols) *n_cols = x; if( n_rows) *n_rows = y; if( *n_cols > 0 && *n_rows > 0) /* i.e., not maximized */ keep_size_within_bounds( n_rows, n_cols); } RegCloseKey( hKey); } if( rval != ERROR_SUCCESS) debug_printf( "get_default_sizes_from_registry error: %d\n", rval); return( rval != ERROR_SUCCESS); } /* Ensure that the dragged rectangle */ /* is an even multiple of the char size */ INLINE void HandleSizing( WPARAM wParam, LPARAM lParam ) { RECT *rect = (RECT *)lParam; RECT window_rect, client_rect; int hadd, vadd, width, height; int n_rows, n_cols; int rounded_width, rounded_height; GetWindowRect( PDC_hWnd, &window_rect); GetClientRect( PDC_hWnd, &client_rect); hadd = (window_rect.right - window_rect.left) - client_rect.right; vadd = (window_rect.bottom - window_rect.top) - client_rect.bottom; width = rect->right - rect->left - hadd; height = rect->bottom - rect->top - vadd; n_cols = (width + PDC_cxChar / 2) / PDC_cxChar; n_rows = (height + PDC_cyChar / 2) / PDC_cyChar; keep_size_within_bounds( &n_rows, &n_cols); rounded_width = hadd + n_cols * PDC_cxChar; rounded_height = vadd + n_rows * PDC_cyChar; if( wParam == WMSZ_BOTTOM || wParam == WMSZ_BOTTOMLEFT || wParam == WMSZ_BOTTOMRIGHT) rect->bottom = rect->top + rounded_height; if( wParam == WMSZ_TOP || wParam == WMSZ_TOPLEFT || wParam == WMSZ_TOPRIGHT) rect->top = rect->bottom - rounded_height; if( wParam == WMSZ_RIGHT || wParam == WMSZ_BOTTOMRIGHT || wParam == WMSZ_TOPRIGHT) rect->right = rect->left + rounded_width; if( wParam == WMSZ_LEFT || wParam == WMSZ_BOTTOMLEFT || wParam == WMSZ_TOPLEFT) rect->left = rect->right - rounded_width; } /* Under Wine, it appears that the code to force the window size to be an integral number of columns and rows doesn't work. This is because WM_SIZING messages aren't sent (this is apparently fixed as of Wine 1.7.18, though I've not tried it yet; I'm still on Wine 1.6, the stable branch.) You can therefore end up in a loop where the code keeps trying to resize a window that isn't actually resizing. So, _when running in Wine only_, we want that code not to be executed... which means having to figure out: are we running under Wine? Which means that when PDCurses/WinGUI is initialized, we set the following 'wine_version' pointer. One could actually call wine_version(), if not NULL, to get the current Wine version. */ typedef const char *(CDECL *wine_version_func)(void); static wine_version_func wine_version; static void HandleSize( const WPARAM wParam, const LPARAM lParam) { static WPARAM prev_wParam = (WPARAM)-99; const unsigned n_xpixels = LOWORD (lParam); const unsigned n_ypixels = HIWORD (lParam); unsigned new_n_rows, new_n_cols; debug_printf( "WM_SIZE: wParam %x %d %d %d\n", (unsigned)wParam, n_xpixels, n_ypixels, SP->resized); /* if( wine_version) printf( "Wine version: %s\n", wine_version( )); */ if( wParam == SIZE_MINIMIZED ) { prev_wParam = SIZE_MINIMIZED; return; } new_n_rows = n_ypixels / PDC_cyChar; new_n_cols = n_xpixels / PDC_cxChar; debug_printf( "Size was %d x %d; will be %d x %d\n", PDC_n_rows, PDC_n_cols, new_n_rows, new_n_cols); SP->resized = FALSE; /* If the window will have a different number of rows */ /* or columns, we put KEY_RESIZE in the key queue. */ /* We don't do this if */ /* the resizing is the result of the window being */ /* initialized, or as a result of PDC_resize_screen */ /* being called. In the latter case, the user */ /* presumably already knows the screen's been resized. */ if( PDC_n_rows != (int)new_n_rows || PDC_n_cols != (int)new_n_cols) { PDC_n_cols = new_n_cols; PDC_n_rows = new_n_rows; debug_printf( "prev_wParam = %d; add_resize_key = %d\n", (int)prev_wParam, add_resize_key); if( prev_wParam != (WPARAM)-99 && add_resize_key) { /* don't add a key when the window is initialized */ add_key_to_queue( KEY_RESIZE); SP->resized = TRUE; } } else if( wine_version) return; add_resize_key = 1; if( wParam == SIZE_RESTORED && ( n_xpixels % PDC_cxChar || n_ypixels % PDC_cyChar)) { int new_xpixels = PDC_cxChar * PDC_n_cols; int new_ypixels = PDC_cyChar * PDC_n_rows; adjust_window_size( &new_xpixels, &new_ypixels, GetWindowLong( PDC_hWnd, GWL_STYLE), menu_shown); debug_printf( "Irregular size\n"); SetWindowPos( PDC_hWnd, 0, 0, 0, new_xpixels, new_ypixels, SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW); } /* If the window has been restored from minimized form, */ /* we should repaint. Otherwise, don't. */ prev_wParam = wParam; } static void HandleMouseMove( WPARAM wParam, LPARAM lParam, int* ptr_modified_key_to_return ) { const int mouse_x = LOWORD( lParam) / PDC_cxChar; const int mouse_y = HIWORD( lParam) / PDC_cyChar; static int prev_mouse_x, prev_mouse_y; if( mouse_x != prev_mouse_x || mouse_y != prev_mouse_y) { int report_event = 0; prev_mouse_x = mouse_x; prev_mouse_y = mouse_y; if( wParam & MK_LBUTTON) { PDC_mouse_rect.left = mouse_x; PDC_mouse_rect.top = mouse_y; if( SP->_trap_mbe & BUTTON1_MOVED) report_event |= PDC_MOUSE_MOVED | 1; } if( wParam & MK_MBUTTON) if( SP->_trap_mbe & BUTTON2_MOVED) report_event |= PDC_MOUSE_MOVED | 2; if( wParam & MK_RBUTTON) if( SP->_trap_mbe & BUTTON3_MOVED) report_event |= PDC_MOUSE_MOVED | 4; #ifdef CANT_DO_THINGS_THIS_WAY /* Logic would dictate the following lines. But with PDCurses */ /* as it's currently set up, we've run out of bits and there */ /* is no BUTTON4_MOVED or BUTTON5_MOVED. Perhaps we need to */ /* redefine _trap_mbe to be a 64-bit quantity? */ if( wParam & MK_XBUTTON1) if( SP->_trap_mbe & BUTTON4_MOVED) report_event |= PDC_MOUSE_MOVED | 8; if( wParam & MK_XBUTTON2) if( SP->_trap_mbe & BUTTON5_MOVED) report_event |= PDC_MOUSE_MOVED | 16; #endif if( !report_event) if( SP->_trap_mbe & REPORT_MOUSE_POSITION) report_event = PDC_MOUSE_POSITION; if( report_event) { int i; pdc_mouse_status.changes = report_event; for( i = 0; i < 3; i++) { pdc_mouse_status.button[i] = (((report_event >> i) & 1) ? BUTTON_MOVED : 0); } *ptr_modified_key_to_return = 0; set_mouse( -1, 0, lParam ); } /* -1 to 'set_mouse' signals mouse move; 0 is ignored */ } } static void HandlePaint( HWND hwnd ) { PAINTSTRUCT ps; HDC hdc; RECT rect; GetUpdateRect( hwnd, &rect, FALSE); /* printf( "In HandlePaint: %ld %ld, %ld %ld\n", rect.left, rect.top, rect.right, rect.bottom); */ hdc = BeginPaint( hwnd, &ps); fix_up_edges( hdc, &rect); if( curscr && curscr->_y) { int i, x1, n_chars; x1 = rect.left / PDC_cxChar; n_chars = rect.right / PDC_cxChar - x1 + 1; if( n_chars > SP->cols - x1) n_chars = SP->cols - x1; if( n_chars > 0) for( i = rect.top / PDC_cyChar; i <= rect.bottom / PDC_cyChar; i++) if( i < SP->lines && curscr->_y[i]) PDC_transform_line_given_hdc( hdc, i, x1, n_chars, curscr->_y[i] + x1); } EndPaint( hwnd, &ps ); } static bool key_already_handled = FALSE; static void HandleSyskeyDown( const WPARAM wParam, const LPARAM lParam, int *ptr_modified_key_to_return ) { const int shift_pressed = (GetKeyState( VK_SHIFT) & 0x8000); const int ctrl_pressed = (GetKeyState( VK_CONTROL) & 0x8000); const int alt_pressed = (GetKeyState( VK_MENU) & 0x8000); const int extended = ((lParam & 0x01000000) != 0); const int repeated = (int)( lParam >> 30) & 1; const KPTAB *kptr = kptab + wParam; int key = 0; static int repeat_count; if( !repeated) *ptr_modified_key_to_return = 0; if( repeated) repeat_count++; else repeat_count = 0; if( SP->return_key_modifiers && !repeated) { /* See notes above this function */ if( wParam == VK_SHIFT) { if( GetKeyState( VK_LSHIFT) & 0x8000) *ptr_modified_key_to_return = KEY_SHIFT_L; else if( GetKeyState( VK_RSHIFT) & 0x8000) *ptr_modified_key_to_return = KEY_SHIFT_R; else if(( HIWORD( lParam) & 0xff) == 0x36) *ptr_modified_key_to_return = KEY_SHIFT_R; else *ptr_modified_key_to_return = KEY_SHIFT_L; } if( wParam == VK_CONTROL) *ptr_modified_key_to_return = (extended ? KEY_CONTROL_R : KEY_CONTROL_L); if( wParam == VK_MENU) *ptr_modified_key_to_return = (extended ? KEY_ALT_R : KEY_ALT_L); } if( !key) /* it's not a shift, ctl, alt handled above */ { if( extended && kptr->extended != 999) kptr = ext_kptab + kptr->extended; if( alt_pressed) key = kptr->alt; else if( ctrl_pressed) key = kptr->control; else if( shift_pressed) key = kptr->shift; else key = kptr->normal; } /* On non-US keyboards, people hit Alt-Gr ("Alt-Ctrl" to */ /* those on US keyboards) to get characters not otherwise */ /* available: accented characters, local currency symbols, */ /* etc. So we default to suppressing Alt-Ctrl-letter combos. */ /* However, apps can set PDC_show_ctrl_alts if they know they're */ /* running on a US keyboard layout (or other layout that doesn't */ /* make special use of Ctrl-Alt... for example, I use the Dvorak */ /* layout; it's fine with PDC_show_ctrl_alts = 1.) */ if( key >= KEY_MIN && key <= KEY_MAX) if( !ctrl_pressed || !alt_pressed || PDC_show_ctrl_alts) { add_key_to_queue( key); if( wParam == VK_MULTIPLY || wParam == VK_DIVIDE || wParam == VK_ADD || wParam == VK_SUBTRACT || wParam == VK_RETURN) if( !alt_pressed) key_already_handled = TRUE; } pdc_key_modifiers = 0; /* Save the key modifiers if required. Do this first to allow to detect e.g. a pressed CTRL key after a hit of NUMLOCK. */ if (SP->save_key_modifiers) { if( alt_pressed) pdc_key_modifiers |= PDC_KEY_MODIFIER_ALT; if( shift_pressed) pdc_key_modifiers |= PDC_KEY_MODIFIER_SHIFT; if( ctrl_pressed) pdc_key_modifiers |= PDC_KEY_MODIFIER_CONTROL; if( GetKeyState( VK_NUMLOCK) & 1) pdc_key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; if( repeat_count) pdc_key_modifiers |= PDC_KEY_MODIFIER_REPEAT; } } /* Blinking text is supposed to blink twice a second. Therefore, HandleTimer( ) is called every .5 seconds. In truth, it's not so much 'blinking' as 'changing certain types of text' that happens. If text is really blinking (i.e., PDC_set_blink(TRUE) has been called), we need to flip that text. Or if text _was_ blinking and we've just called PDC_set_blink(FALSE), all that text has to be redrawn in 'standout' mode. Also, if PDC_set_line_color() has been called, all text with left/right/under/over/strikeout lines needs to be redrawn. So. After determining which attributes require redrawing (if any), we run through all of 'curscr' and look for text with those attributes set. If we find such text, we run it through PDC_transform_line. (To speed matters up slightly, we skip over text at the start and end of each line that lacks the desired attributes. We could conceivably get more clever; as it stands, if the very first and very last characters are blinking, we redraw the entire line, even though everything in between may not require it. But it would probably be a lot of code for little benefit.) Note that by default, we'll usually find that the line color hasn't changed and the 'blink mode' is still FALSE. In that case, attr_to_seek will be zero and the only thing we'll do here is to blink the cursor. */ static void HandleTimer( const WPARAM wParam ) { int i; /* see WndProc() notes */ extern int PDC_really_blinking; /* see 'pdcsetsc.c' */ static int previously_really_blinking = 0; static int prev_line_color = -1; chtype attr_to_seek = 0; if( prev_line_color != SP->line_color) attr_to_seek = A_ALL_LINES; if( PDC_really_blinking || previously_really_blinking) attr_to_seek |= A_BLINK; prev_line_color = SP->line_color; previously_really_blinking = PDC_really_blinking; PDC_blink_state ^= 1; if( attr_to_seek) { for( i = 0; i < SP->lines; i++) { if( curscr->_y[i]) { int j = 0, n_chars; chtype *line = curscr->_y[i]; /* skip over starting text that isn't blinking: */ while( j < SP->cols && !(*line & attr_to_seek)) { j++; line++; } n_chars = SP->cols - j; /* then skip over text at the end that's not blinking: */ while( n_chars && !(line[n_chars - 1] & attr_to_seek)) { n_chars--; } if( n_chars) PDC_transform_line( i, j, n_chars, line); } /* else MessageBox( 0, "NULL _y[] found\n", "PDCurses", MB_OK); */ } } if( SP->cursrow >=SP->lines || SP->curscol >= SP->cols || SP->cursrow < 0 || SP->curscol < 0 || !curscr->_y || !curscr->_y[SP->cursrow]) debug_printf( "Cursor off-screen: %d %d, %d %d\n", SP->cursrow, SP->curscol, SP->lines, SP->cols); else if( PDC_CURSOR_IS_BLINKING) PDC_transform_line( SP->cursrow, SP->curscol, 1, curscr->_y[SP->cursrow] + SP->curscol); } /* Options to enlarge/shrink the font are currently commented out. */ static HMENU set_menu( void) { const HMENU hMenu = CreateMenu( ); #ifdef PDC_WIDE AppendMenu( hMenu, MF_STRING, WM_CHOOSE_FONT, L"Font"); AppendMenu( hMenu, MF_STRING, WM_PASTE, L"Paste"); #else AppendMenu( hMenu, MF_STRING, WM_CHOOSE_FONT, "Font"); AppendMenu( hMenu, MF_STRING, WM_PASTE, "Paste"); #endif return( hMenu); } INLINE void HandleMenuToggle( bool *ptr_ignore_resize) { const bool is_zoomed = IsZoomed( PDC_hWnd); HMENU hMenu; menu_shown ^= 1; hMenu = GetSystemMenu( PDC_hWnd, FALSE); CheckMenuItem( hMenu, WM_TOGGLE_MENU, MF_BYCOMMAND | (menu_shown ? MF_CHECKED : MF_UNCHECKED)); if( !is_zoomed) *ptr_ignore_resize = TRUE; if( !menu_shown) { hMenu = GetMenu( PDC_hWnd); /* destroy existing menu */ DestroyMenu( hMenu); hMenu = CreateMenu( ); /* then set an empty menu */ SetMenu( PDC_hWnd, hMenu); } else { SetMenu( PDC_hWnd, set_menu( )); } *ptr_ignore_resize = FALSE; if( !is_zoomed) { PDC_resize_screen( PDC_n_rows, PDC_n_cols ); } InvalidateRect( PDC_hWnd, NULL, FALSE); } INLINE uint64_t milliseconds_since_1970( void) { FILETIME ft; const uint64_t jd_1601 = 2305813; /* actually 2305813.5 */ const uint64_t jd_1970 = 2440587; /* actually 2440587.5 */ const uint64_t ten_million = 10000000; const uint64_t diff = (jd_1970 - jd_1601) * ten_million * 86400; uint64_t decimicroseconds_since_1970; /* i.e., time in units of 1e-7 seconds */ GetSystemTimeAsFileTime( &ft); decimicroseconds_since_1970 = ((uint64_t)ft.dwLowDateTime | ((uint64_t)ft.dwHighDateTime << 32)) - diff; return( decimicroseconds_since_1970 / 10000); } /* Note that there are two types of WM_TIMER timer messages. One type indicates that SP->mouse_wait milliseconds have elapsed since a mouse button was pressed; that's handled as described in the above notes. The other type, issued every half second, indicates that blinking should take place. For these, HandleTimer() is called (see above). On WM_PAINT, we determine what parts of 'curscr' would be covered by the update rectangle, and run those through PDC_transform_line. For determining left/right shift, alt, and control, I borrowed code from SDL. Note that the Win32 version of PDCurses doesn't work correctly here for Win9x; it just does GetKeyState( VK_LSHIFT), etc., which is apparently not supported in Win9x. So no matter which shift (or alt or Ctrl key) is hit, the right-hand variant is returned in that library. The SDL handling, and hence the handling below, _does_ work on Win9x. Note, though, that in Win9x, detection of the Shift keys is hardware dependent; if you've an unusual keyboard, both Shift keys may be detected as right, or both as left. */ #if defined(_WIN32) && defined(__GNUC__) #define ALIGN_STACK __attribute__((force_align_arg_pointer)) #else #define ALIGN_STACK #endif static LRESULT ALIGN_STACK CALLBACK WndProc (const HWND hwnd, const UINT message, const WPARAM wParam, const LPARAM lParam) { int button_down = -1, button_up = -1; static int mouse_buttons_pressed = 0; static LPARAM mouse_lParam; static uint64_t last_click_time[PDC_MAX_MOUSE_BUTTONS]; /* in millisec since 1970 */ static int modified_key_to_return = 0; const RECT before_rect = PDC_mouse_rect; static bool ignore_resize = FALSE; PDC_hWnd = hwnd; if( !hwnd) debug_printf( "Null hWnd: msg %u, wParam %x, lParam %lx\n", message, wParam, lParam); switch (message) { case WM_SIZING: HandleSizing( wParam, lParam ); return( TRUE ); case WM_SIZE: /* If ignore_resize = 1, don't bother resizing; */ /* the final window size has yet to be set */ if( ignore_resize == FALSE) HandleSize( wParam, lParam); return 0 ; case WM_MOUSEWHEEL: debug_printf( "Mouse wheel: %x %lx\n", wParam, lParam); modified_key_to_return = 0; set_mouse( VERTICAL_WHEEL_EVENT, (short)( HIWORD(wParam)), lParam); break; case WM_MOUSEHWHEEL: debug_printf( "Mouse horiz wheel: %x %lx\n", wParam, lParam); modified_key_to_return = 0; set_mouse( HORIZONTAL_WHEEL_EVENT, (short)( HIWORD(wParam)), lParam); break; case WM_MOUSEMOVE: HandleMouseMove( wParam, lParam, &modified_key_to_return ); break; case WM_LBUTTONDOWN: PDC_mouse_rect.left = PDC_mouse_rect.right = LOWORD( lParam) / PDC_cxChar; PDC_mouse_rect.top = PDC_mouse_rect.bottom = HIWORD( lParam) / PDC_cyChar; PDC_selecting_rectangle = (wParam & MK_SHIFT); SetCapture( hwnd); button_down = 0; break; case WM_LBUTTONUP: button_up = 0; ReleaseCapture( ); if( (PDC_mouse_rect.left != PDC_mouse_rect.right || PDC_mouse_rect.top != PDC_mouse_rect.bottom) && (PDC_mouse_rect.right >= 0 && PDC_mouse_rect.left >= 0 && curscr && curscr->_y) ) { /* RR: will crash sometimes */ /* As an example on double-click of the title bar */ HandleBlockCopy(); } PDC_mouse_rect.top = PDC_mouse_rect.bottom = -1; /* now hide rect */ break; case WM_RBUTTONDOWN: button_down = 2; SetCapture( hwnd); break; case WM_RBUTTONUP: button_up = 2; ReleaseCapture( ); break; case WM_MBUTTONDOWN: button_down = 1; SetCapture( hwnd); break; case WM_MBUTTONUP: button_up = 1; ReleaseCapture( ); break; #if( PDC_MAX_MOUSE_BUTTONS >= 5) /* WinGUI can support five mouse buttons. But some may wish */ /* to leave PDC_MAX_MOUSE_BUTTONS=3, for compatibility */ /* with older PDCurses libraries. Hence the above #if. */ case WM_XBUTTONDOWN: button_down = ((wParam & MK_XBUTTON1) ? 3 : 4); SetCapture( hwnd); break; case WM_XBUTTONUP: #ifdef WRONG_WAY /* You'd think we'd use the following line, wouldn't you? */ /* But we can't, because an XBUTTONUP message doesn't actually */ /* tell you which button was released! So we'll assume that */ /* the released xbutton matches a pressed one; and we've kept */ /* track of which buttons are currently pressed. */ button_up = ((wParam & MK_XBUTTON1) ? 3 : 4); #endif button_up = (((mouse_buttons_pressed & 8) || pdc_mouse_status.xbutton[0] & BUTTON_PRESSED) ? 3 : 4); ReleaseCapture( ); break; #endif /* #if( PDC_MAX_MOUSE_BUTTONS >= 5) */ case WM_MOVE: return 0 ; case WM_ERASEBKGND: /* no need to erase background; it'll */ return( 0); /* all get painted over anyway */ /* The WM_PAINT routine is sort of "borrowed" from doupdate( ) from */ /* refresh.c. I'm not entirely sure that this is what ought to be */ /* done, though it does appear to work correctly. */ case WM_PAINT: if( hwnd && curscr ) { HandlePaint( hwnd ); } break; case WM_KEYUP: case WM_SYSKEYUP: if( wParam == VK_MENU && numpad_unicode_value) { modified_key_to_return = numpad_unicode_value; numpad_unicode_value = 0; pdc_key_modifiers = 0; } if( modified_key_to_return ) { add_key_to_queue( modified_key_to_return ); modified_key_to_return = 0; } break; case WM_CHAR: /* _Don't_ add Shift-Tab; it's handled elsewhere */ if( wParam != 9 || !(GetKeyState( VK_SHIFT) & 0x8000)) if( !key_already_handled) add_key_to_queue( (int)wParam ); key_already_handled = FALSE; break; case WM_KEYDOWN: case WM_SYSKEYDOWN: if( wParam < 225 && wParam > 0 ) { HandleSyskeyDown( wParam, lParam, &modified_key_to_return ); } return 0 ; case WM_SYSCHAR: return 0 ; case WM_TIMER: /* see notes above this function */ if( wParam != TIMER_ID_FOR_BLINKING ) { static const int remap_table[PDC_MAX_MOUSE_BUTTONS] = { BUTTON1_PRESSED, BUTTON2_PRESSED, BUTTON3_PRESSED, BUTTON4_PRESSED, BUTTON5_PRESSED }; modified_key_to_return = 0; if( SP && (SP->_trap_mbe & remap_table[wParam])) set_mouse( (const int) wParam, BUTTON_PRESSED, mouse_lParam); KillTimer( PDC_hWnd, (int)wParam); mouse_buttons_pressed ^= (1 << wParam); } else if( SP && curscr && curscr->_y) { /* blink the blinking text */ HandleTimer( wParam ); } break; case WM_CLOSE: { if( !PDC_shutdown_key[FUNCTION_KEY_SHUT_DOWN]) { final_cleanup( ); PDC_bDone = TRUE; exit( 0); } else add_key_to_queue( PDC_shutdown_key[FUNCTION_KEY_SHUT_DOWN]); } return( 0); case WM_COMMAND: case WM_SYSCOMMAND: if( wParam == WM_EXIT_GRACELESSLY) { final_cleanup( ); PDC_bDone = TRUE; exit( 0); } else if( wParam == WM_ENLARGE_FONT || wParam == WM_SHRINK_FONT) { adjust_font_size( (wParam == WM_ENLARGE_FONT) ? 1 : -1); return( 0); } else if( wParam == WM_CHOOSE_FONT) { if( PDC_choose_a_new_font( )) adjust_font_size( 0); return( 0); } else if( wParam == WM_PASTE) { PDC_add_clipboard_to_key_queue( ); } else if( wParam == WM_TOGGLE_MENU) { HandleMenuToggle( &ignore_resize); } break; case WM_DESTROY: PDC_LOG(("WM_DESTROY\n")); PostQuitMessage (0) ; PDC_bDone = TRUE; return 0 ; } if( hwnd) show_mouse_rect( hwnd, before_rect, PDC_mouse_rect); if( button_down >= 0) { modified_key_to_return = 0; SetTimer( hwnd, button_down, SP->mouse_wait, NULL); mouse_buttons_pressed |= (1 << button_down); mouse_lParam = lParam; } if( button_up >= 0) { int message_to_send = -1; modified_key_to_return = 0; if( (mouse_buttons_pressed >> button_up) & 1) { const uint64_t curr_click_time = milliseconds_since_1970( ); static const int double_remap_table[PDC_MAX_MOUSE_BUTTONS] = { BUTTON1_DOUBLE_CLICKED, BUTTON2_DOUBLE_CLICKED, BUTTON3_DOUBLE_CLICKED, BUTTON4_DOUBLE_CLICKED, BUTTON5_DOUBLE_CLICKED }; static const int triple_remap_table[PDC_MAX_MOUSE_BUTTONS] = { BUTTON1_TRIPLE_CLICKED, BUTTON2_TRIPLE_CLICKED, BUTTON3_TRIPLE_CLICKED, BUTTON4_TRIPLE_CLICKED, BUTTON5_TRIPLE_CLICKED }; static int n_previous_clicks; if( curr_click_time < last_click_time[button_up] + 2 * SP->mouse_wait) n_previous_clicks++; /* 'n_previous_clicks' will be */ else /* zero for a "normal" click, 1 */ n_previous_clicks = 0; /* for a dblclick, 2 for a triple */ if( n_previous_clicks >= 2 && (SP->_trap_mbe & triple_remap_table[button_up])) message_to_send = BUTTON_TRIPLE_CLICKED; else if( n_previous_clicks >= 1 && (SP->_trap_mbe & double_remap_table[button_up])) message_to_send = BUTTON_DOUBLE_CLICKED; else /* either it's not a doubleclick, or we aren't */ { /* checking for double clicks */ static const int remap_table[PDC_MAX_MOUSE_BUTTONS] = { BUTTON1_CLICKED, BUTTON2_CLICKED, BUTTON3_CLICKED, BUTTON4_CLICKED, BUTTON5_CLICKED }; if( SP->_trap_mbe & remap_table[button_up]) message_to_send = BUTTON_CLICKED; } KillTimer( hwnd, button_up); mouse_buttons_pressed ^= (1 << button_up); last_click_time[button_up] = curr_click_time; } if( message_to_send == -1) /* might just send as a 'released' msg */ { static const int remap_table[PDC_MAX_MOUSE_BUTTONS] = { BUTTON1_RELEASED, BUTTON2_RELEASED, BUTTON3_RELEASED, BUTTON4_RELEASED, BUTTON5_RELEASED }; if( SP->_trap_mbe & remap_table[button_up]) message_to_send = BUTTON_RELEASED; } if( message_to_send != -1) set_mouse( button_up, message_to_send, lParam); } return DefWindowProc( hwnd, message, wParam, lParam) ; } /* Default behaviour is that, when one clicks on the 'close' button, */ /* exit( 0) is called, just as in the SDL and X11 versions. But if */ /* one wishes, one can call PDC_set_shutdown_key to cause those */ /* buttons to put a specified character into the input queue. It's */ /* then the application's problem to exit gracefully, perhaps with */ /* messages such as 'are you sure' and so forth. */ /* If you've set a shutdown key, there's always a risk that the */ /* program will get stuck in a loop and never process said key. So */ /* when the key is set, a 'Kill' item is appended to the system menu */ /* so that the user still has some way to terminate the app, albeit */ /* with extreme prejudice (i.e., click on 'Kill' and exit is called */ /* and the app exits gracelessly.) */ int PDC_set_function_key( const unsigned function, const int new_key) { int old_key = -1; if( function < PDC_MAX_FUNCTION_KEYS) { old_key = PDC_shutdown_key[function]; PDC_shutdown_key[function] = new_key; } if( function == FUNCTION_KEY_SHUT_DOWN) if( (new_key && !old_key) || (old_key && !new_key)) { HMENU hMenu = GetSystemMenu( PDC_hWnd, FALSE); if( new_key) AppendMenu( hMenu, MF_STRING, WM_EXIT_GRACELESSLY, _T( "Kill")); else RemoveMenu( hMenu, WM_EXIT_GRACELESSLY, MF_BYCOMMAND); } return( old_key); } /* https://msdn.microsoft.com/en-us/library/windows/desktop/dd162826(v=vs.85).aspx The code at the above link provides general methods for positioning a window on a multiple-display setup. The only instance we're using is the MONITOR_WORKAREA one, which ensures that even if monitor geometry changes, the window will still be entirely on-screen. These functions entered the Win32 API with Windows 2000. If MONITOR_DEFAULTTONEAREST isn't defined, we shouldn't try to do this. */ #ifdef MONITOR_DEFAULTTONEAREST static void clip_or_center_rect_to_monitor( LPRECT prc) { HMONITOR hMonitor; MONITORINFO mi; RECT rc; const int w = prc->right - prc->left; const int h = prc->bottom - prc->top; hMonitor = MonitorFromRect(prc, MONITOR_DEFAULTTONEAREST); mi.cbSize = sizeof(mi); GetMonitorInfo(hMonitor, &mi); rc = mi.rcMonitor; prc->left = max(rc.left, min(rc.right-w, prc->left)); prc->top = max(rc.top, min(rc.bottom-h, prc->top)); prc->right = prc->left + w; prc->bottom = prc->top + h; } static void clip_or_center_window_to_monitor( HWND hwnd) { RECT rc; GetWindowRect(hwnd, &rc); clip_or_center_rect_to_monitor(&rc); SetWindowPos(hwnd, NULL, rc.left, rc.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); } #endif /* By default, the user cannot resize the window. This is because many apps don't handle KEY_RESIZE, and one can get odd behavior in such cases. There are two ways around this. If you call PDC_set_resize_limits( ) before initwin( ), telling WinGUI exactly how large/small the window can be, the window will be user-resizable. Or you can set ttytype[0...3] to contain the resize limits. A call such as PDC_set_resize_limits( 42, 42, 135, 135); will result in the window being fixed at 42 lines by 135 columns. PDC_set_resize_limits( 20, 50, 70, 200); will mean the window can have 20 to 50 lines and 70 to 200 columns. The user will be able to resize the window freely within those limits. See 'newtest.c' (in the 'demos' folder) for an example. This function is used in only one place (PDC_scr_open( )), so it's inlined. */ INLINE int set_up_window( void) { /* create the dialog window */ WNDCLASS wndclass ; HMENU hMenu; HANDLE hInstance = GetModuleHandleA( NULL); int n_default_columns = 80; int n_default_rows = 25; int xsize, ysize, window_style; int xloc = CW_USEDEFAULT; int yloc = CW_USEDEFAULT; TCHAR WindowTitle[MAX_PATH]; const TCHAR *AppName = _T( "Curses_App"); HICON icon; static bool wndclass_has_been_registered = FALSE; if( !hInstance) debug_printf( "No instance: %d\n", GetLastError( )); originally_focussed_window = GetForegroundWindow( ); debug_printf( "hInstance %x\nOriginal window %x\n", hInstance, originally_focussed_window); /* set the window icon from the icon in the process */ icon = get_app_icon(); if( !icon ) icon = LoadIcon( NULL, IDI_APPLICATION); if( !wndclass_has_been_registered) { ATOM rval; wndclass.style = CS_VREDRAW ; wndclass.lpfnWndProc = WndProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.hInstance = hInstance ; wndclass.hIcon = icon; wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ; wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ; wndclass.lpszMenuName = NULL ; wndclass.lpszClassName = AppName ; rval = RegisterClass( &wndclass) ; if( !rval) { const DWORD last_error = GetLastError( ); debug_printf( "RegisterClass failed: GetLastError = %lx\n", last_error); return( -1); } wndclass_has_been_registered = TRUE; } get_app_name( WindowTitle, MAX_PATH, TRUE); #ifdef PDC_WIDE debug_printf( "WindowTitle = '%ls'\n", WindowTitle); #endif get_default_sizes_from_registry( &n_default_columns, &n_default_rows, &xloc, &yloc, &menu_shown); if( PDC_n_rows > 2 && PDC_n_cols > 2) { n_default_columns = PDC_n_cols; n_default_rows = PDC_n_rows; } if( ttytype[1]) PDC_set_resize_limits( (unsigned char)ttytype[0], (unsigned char)ttytype[1], (unsigned char)ttytype[2], (unsigned char)ttytype[3]); debug_printf( "Size %d x %d, loc %d x %d; menu %d\n", n_default_columns, n_default_rows, xloc, yloc, menu_shown); get_character_sizes( NULL, &PDC_cxChar, &PDC_cyChar); if( min_lines != max_lines || min_cols != max_cols) window_style = ((n_default_columns == -1) ? WS_MAXIMIZE | WS_OVERLAPPEDWINDOW : WS_OVERLAPPEDWINDOW); else /* fixed-size window: looks "normal", but w/o a maximize box */ window_style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX; if( n_default_columns == -1) xsize = ysize = CW_USEDEFAULT; else { keep_size_within_bounds( &n_default_rows, &n_default_columns); xsize = PDC_cxChar * n_default_columns; ysize = PDC_cyChar * n_default_rows; adjust_window_size( &xsize, &ysize, window_style, menu_shown); } PDC_hWnd = CreateWindow( AppName, WindowTitle, window_style, xloc, yloc, xsize, ysize, NULL, (menu_shown ? set_menu( ) : NULL), hInstance, NULL) ; if( !PDC_hWnd) { const DWORD last_error = GetLastError( ); debug_printf( "CreateWindow failed; GetLastError = %ld", last_error); return( -2); } hMenu = GetSystemMenu( PDC_hWnd, FALSE); AppendMenu( hMenu, MF_STRING | (menu_shown ? MF_CHECKED : MF_UNCHECKED), WM_TOGGLE_MENU, _T( "Menu")); AppendMenu( hMenu, MF_STRING, WM_CHOOSE_FONT, _T( "Choose Font")); debug_printf( "menu set\n"); ShowWindow (PDC_hWnd, (n_default_columns == -1) ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL); debug_printf( "window shown\n"); ValidateRect( PDC_hWnd, NULL); /* don't try repainting */ UpdateWindow (PDC_hWnd) ; debug_printf( "window updated\n"); SetTimer( PDC_hWnd, TIMER_ID_FOR_BLINKING, 500, NULL); debug_printf( "timer set\n"); #ifdef MONITOR_DEFAULTTONEAREST /* if the window is off-screen, move it on screen. */ clip_or_center_window_to_monitor( PDC_hWnd); #endif return( 0); } /* open the physical screen -- allocate SP, miscellaneous intialization, and may save the existing screen for later restoration. Deciding on a for-real maximum screen size has proven difficult. But there is really no particularly good reason to set such a maximum. If one does, you get some tricky issues: suppose the user drags the window to create a screen larger than MAX_LINES or MAX_COLUMNS? My hope is to evade that problem by just setting those constants to be... well... unrealistically large. */ #define MAX_LINES 50000 #define MAX_COLUMNS 50000 int PDC_scr_open( int argc, char **argv) { int i, r, g, b; HMODULE hntdll = GetModuleHandle( _T("ntdll.dll")); if( hntdll) wine_version = (wine_version_func)GetProcAddress(hntdll, "wine_get_version"); PDC_LOG(("PDC_scr_open() - called\n")); SP = calloc(1, sizeof(SCREEN)); color_pair_indices = (short *)calloc(PDC_COLOR_PAIRS * 2, sizeof( short)); pdc_rgbs = (COLORREF *)calloc(N_COLORS, sizeof( COLORREF)); if (!SP || !color_pair_indices || !pdc_rgbs) return ERR; debug_printf( "colors alloc\n"); COLORS = N_COLORS; /* should give this a try and see if it works! */ for( i = 0; i < 16; i++) { const int intensity = ((i & 8) ? 0xff : 0xc0); pdc_rgbs[i] = RGB( ((i & COLOR_RED) ? intensity : 0), ((i & COLOR_GREEN) ? intensity : 0), ((i & COLOR_BLUE) ? intensity : 0)); } /* 256-color xterm extended palette: 216 colors in a 6x6x6 color cube, plus 24 (not 50) shades of gray */ for( r = 0; r < 6; r++) for( g = 0; g < 6; g++) for( b = 0; b < 6; b++) pdc_rgbs[i++] = RGB( r ? r * 40 + 55 : 0, g ? g * 40 + 55 : 0, b ? b * 40 + 55 : 0); for( i = 0; i < 24; i++) pdc_rgbs[i + 232] = RGB( i * 10 + 8, i * 10 + 8, i * 10 + 8); SP->mouse_wait = PDC_CLICK_PERIOD; SP->visibility = 0; /* no cursor, by default */ SP->curscol = SP->cursrow = 0; SP->audible = TRUE; SP->mono = FALSE; /* note: we parse the non-wide argc (see comment in header), therefore using non-wide char handling here */ if( argc && argv) /* store a copy of the input arguments */ { PDC_argc = argc; PDC_argv = (char **)calloc( argc + 1, sizeof( char *)); for( i = 0; i < argc; i++) { PDC_argv[i] = (char *)malloc( strlen( argv[i]) + 1); strcpy( PDC_argv[i], argv[i]); } } if( set_up_window( )) { fprintf( stderr, "set_up_window failed\n"); return ERR; } debug_printf( "Back from set_up_window\n"); while( !PDC_get_rows( )) /* wait for screen to be drawn and */ ; /* actual size to be determined */ debug_printf( "Back from PDC_get_rows\n"); SP->lines = PDC_get_rows(); SP->cols = PDC_get_columns(); if (SP->lines < 2 || SP->lines > MAX_LINES || SP->cols < 2 || SP->cols > MAX_COLUMNS) { fprintf(stderr, "LINES value must be >= 2 and <= %d: got %d\n", MAX_LINES, SP->lines); fprintf(stderr, "COLS value must be >= 2 and <= %d: got %d\n", MAX_COLUMNS, SP->cols); return ERR; } /* PDC_reset_prog_mode(); doesn't do anything anyway */ debug_printf( "...we're done\n"); return OK; } /* the core of resize_term() */ int PDC_resize_screen( int nlines, int ncols) { if( !stdscr) /* window hasn't been created yet; we're */ { /* specifying its size before doing so */ PDC_n_rows = nlines; PDC_n_cols = ncols; return OK; } SP->resized = FALSE; debug_printf( "Incoming: %d %d\n", nlines, ncols); if( nlines >= 2 && ncols >= 2 && PDC_cxChar && PDC_cyChar && PDC_hWnd && !IsZoomed( PDC_hWnd) /* && WaitResult == WAIT_OBJECT_0 */) { RECT rect, client_rect; int new_width; int new_height; GetWindowRect( PDC_hWnd, &rect); GetClientRect( PDC_hWnd, &client_rect); debug_printf( "Outgoing: %d %d\n", nlines, ncols); new_width = ncols * PDC_cxChar; new_height = nlines * PDC_cyChar; if( new_width != client_rect.right || new_height != client_rect.bottom) { /* check to make sure size actually changed */ add_resize_key = 0; SetWindowPos( PDC_hWnd, 0, 0, 0, new_width + (rect.right - rect.left) - client_rect.right, new_height + (rect.bottom - rect.top) - client_rect.bottom, SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW); } } return OK; } void PDC_reset_prog_mode(void) { PDC_LOG(("PDC_reset_prog_mode() - called.\n")); #ifdef NOT_CURRENTLY_IN_USE if( PDC_bDone == FALSE && PDC_hWnd) { PDC_bDone = TRUE; SetForegroundWindow( PDC_hWnd); } #endif } void PDC_reset_shell_mode(void) { } void PDC_restore_screen_mode(int i) { } void PDC_save_screen_mode(int i) { } /* NOTE: as with PDC_init_color() (see below), this function has to redraw all text with color attribute 'pair' to match the newly-set foreground and background colors. The loops to go through every character in curscr, looking for those that need to be redrawn and ignoring those at the front and start of each line, are very similar. */ static short get_pair( const chtype ch) { return( (short)( (ch & A_COLOR) >> PDC_COLOR_SHIFT)); } void PDC_init_pair( short pair, short fg, short bg) { if( color_pair_indices[pair] != fg || color_pair_indices[pair + PDC_COLOR_PAIRS] != bg) { color_pair_indices[pair] = fg; color_pair_indices[pair + PDC_COLOR_PAIRS] = bg; /* Possibly go through curscr and redraw everything with that color! */ if( curscr && curscr->_y) { int i; for( i = 0; i < SP->lines; i++) if( curscr->_y[i]) { int j = 0, n_chars; chtype *line = curscr->_y[i]; /* skip over starting text that isn't of the desired color: */ while( j < SP->cols && get_pair( *line) != pair) { j++; line++; } n_chars = SP->cols - j; /* then skip over text at the end that's not the right color: */ while( n_chars && get_pair( line[n_chars - 1]) != pair) n_chars--; if( n_chars) PDC_transform_line( i, j, n_chars, line); } } } } int PDC_pair_content( short pair, short *fg, short *bg) { *fg = color_pair_indices[pair]; *bg = color_pair_indices[pair + PDC_COLOR_PAIRS]; return OK; } bool PDC_can_change_color(void) { return TRUE; } int PDC_color_content( short color, short *red, short *green, short *blue) { COLORREF col = pdc_rgbs[color]; *red = DIVROUND(GetRValue(col) * 1000, 255); *green = DIVROUND(GetGValue(col) * 1000, 255); *blue = DIVROUND(GetBValue(col) * 1000, 255); return OK; } /* We have an odd problem when changing colors with PDC_init_color(). On palette-based systems, you just change the palette and the hardware takes care of the rest. Here, though, we actually need to redraw any text that's drawn in the specified color. So we gotta look at each character and see if either the foreground or background matches the index that we're changing. Then, that text gets redrawn. For speed/simplicity, the code looks for the first and last character in each line that would be affected, then draws those in between (frequently, this will be zero characters, i.e., no text on that particular line happens to use the color index in question.) See similar code above for PDC_init_pair(), to handle basically the same problem. */ static int color_used_for_this_char( const chtype c, const int idx) { const int color = get_pair( c); const int rval = (color_pair_indices[color] == idx || color_pair_indices[color + PDC_COLOR_PAIRS] == idx); return( rval); } int PDC_init_color( short color, short red, short green, short blue) { const COLORREF new_rgb = RGB(DIVROUND(red * 255, 1000), DIVROUND(green * 255, 1000), DIVROUND(blue * 255, 1000)); if( pdc_rgbs[color] != new_rgb) { pdc_rgbs[color] = new_rgb; /* Possibly go through curscr and redraw everything with that color! */ if( curscr && curscr->_y) { int i; for( i = 0; i < SP->lines; i++) if( curscr->_y[i]) { int j = 0, n_chars; chtype *line = curscr->_y[i]; /* skip over starting text that isn't of the desired color: */ while( j < SP->cols && !color_used_for_this_char( *line, color)) { j++; line++; } n_chars = SP->cols - j; /* then skip over text at the end that's not the right color: */ while( n_chars && !color_used_for_this_char( line[n_chars - 1], color)) n_chars--; if( n_chars) PDC_transform_line( i, j, n_chars, line); } } } return OK; } curses-1.4.4/vendor/PDCurses/wingui/Makefile.mng0000644000004100000410000000656114201713275021575 0ustar www-datawww-data# GNU MAKE Makefile for PDCurses library - WIN32 MinGW GCC # # Usage: make -f [path\]Makefile.mng [DEBUG=Y] [DLL=Y] [WIDE=Y] [UTF8=Y] [target] # # where target can be any of: # [all|demos|pdcurses.a|testcurs.exe...] O = o ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. endif include $(PDCURSES_SRCDIR)/version.mif include $(PDCURSES_SRCDIR)/libobjs.mif uname_S := $(shell uname -s 2>/dev/null) CAT = cat PREFIX = PATH_SEP = / CP = cp DELETE = rm -f # It appears we have three cases: we're running in Cygwin/MSYS; or we're # running in command.com on Windows with MinGW; or we're on Linux or BSD # or similar system, cross-compiling with MinGW. ifneq (,$(findstring CYGWIN,$(uname_S))) # Insert Cygwin-specific changes here ON_WINDOWS = 1 endif ifneq (,$(findstring MINGW32_NT,$(uname_S))) # Insert MINGW32-specific changes here ON_WINDOWS = 1 endif ifneq (,$(findstring MINGW64_NT,$(uname_S))) # Insert MINGW64-specific changes here ON_WINDOWS = 1 endif ifeq ($(uname_S),) CAT = type PATH_SEP = \\ CP = -copy DELETE = -del ON_WINDOWS = 1 endif # If we aren't on Windows, assume MinGW on a Linux-like host # Only decision is: are we doing a 64-bit compile (_w64 defined)? ifndef ON_WINDOWS ifdef _w64 PREFIX = x86_64-w64-mingw32- else PREFIX = i686-w64-mingw32- endif endif osdir = $(PDCURSES_SRCDIR)/wingui PDCURSES_WIN_H = $(osdir)/pdcwin.h CC = $(PREFIX)gcc AR = $(PREFIX)ar STRIP = $(PREFIX)strip ifeq ($(DEBUG),Y) CFLAGS = -g -Wall -DPDCDEBUG LDFLAGS = -g else CFLAGS = -O4 -Wall -pedantic LDFLAGS = endif CFLAGS += -I$(PDCURSES_SRCDIR) ifdef CHTYPE_32 CFLAGS += -DCHTYPE_32 endif ifdef CHTYPE_16 CFLAGS += -DCHTYPE_16 endif ifeq ($(WIDE),Y) CFLAGS += -DPDC_WIDE endif ifeq ($(UTF8),Y) CFLAGS += -DPDC_FORCE_UTF8 endif LINK = $(CC) ifeq ($(DLL),Y) CFLAGS += -DPDC_DLL_BUILD LIBEXE = $(CC) LIBFLAGS = -Wl,--out-implib,pdcurses.a -shared -o LIBCURSES = pdcurses.dll LIBDEPS = $(LIBOBJS) $(PDCOBJS) LIBSADDED = -lgdi32 -lcomdlg32 EXELIBS = CLEAN = $(LIBCURSES) *.a else LIBEXE = $(AR) ifeq ($(PREFIX),) LIBFLAGS = rcv else LIBFLAGS = rv endif LIBCURSES = pdcurses.a LIBDEPS = $(LIBOBJS) $(PDCOBJS) LIBSADDED = EXELIBS = -lgdi32 -lcomdlg32 CLEAN = *.a endif .PHONY: all libs clean demos dist all: libs demos libs: $(LIBCURSES) clean: $(DELETE) *.o $(DELETE) *.exe $(DELETE) *.dll $(DELETE) $(CLEAN) demos: $(DEMOS) ifneq ($(DEBUG),Y) $(STRIP) *.exe endif $(LIBCURSES) : $(LIBDEPS) $(LIBEXE) $(LIBFLAGS) $@ $? $(LIBSADDED) $(CP) pdcurses.a panel.a $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_WIN_H) $(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) panel.o : $(PANEL_HEADER) terminfo.o: $(TERM_HEADER) $(LIBOBJS) : %.o: $(srcdir)/%.c $(CC) -c $(CFLAGS) $< $(PDCOBJS) : %.o: $(osdir)/%.c $(CC) -c $(CFLAGS) $< firework.exe ozdemo.exe newtest.exe ptest.exe rain.exe testcurs.exe \ version.exe worm.exe xmas.exe: %.exe: $(demodir)/%.c $(CC) $(CFLAGS) -mwindows -o$@ $< $(LIBCURSES) $(EXELIBS) tuidemo.exe: tuidemo.o tui.o $(LINK) $(LDFLAGS) -mwindows -o$@ tuidemo.o tui.o $(LIBCURSES) $(EXELIBS) tui.o: $(demodir)/tui.c $(demodir)/tui.h $(PDCURSES_CURSES_H) $(CC) -c $(CFLAGS) -I$(demodir) -o$@ $< tuidemo.o: $(demodir)/tuidemo.c $(PDCURSES_CURSES_H) $(CC) -c $(CFLAGS) -I$(demodir) -o$@ $< PLATFORM1 = MinGW Win32 PLATFORM2 = MinGW for Win32 ARCNAME = pdc$(VER)_ming_w32 include $(PDCURSES_SRCDIR)/makedist.mif curses-1.4.4/vendor/PDCurses/version.mif0000644000004100000410000000021014201713275020216 0ustar www-datawww-data# Version number macros for inclusion from makefiles VER = 40 VERDOT = 4.0 ABI_MAJOR = 4 ABI_MINOR = 0 ABI = $(ABI_MAJOR).$(ABI_MINOR) curses-1.4.4/vendor/PDCurses/.gitignore0000644000004100000410000000073014201713275020033 0ustar www-datawww-data*.[oa] *.exe firework manext libXCurses.so ozdemo newtest ptest rain sdltest testcurs tuidemo worm xmas *.sho Makefile config.h config.log config.status PDCurses.md xcurses-config *.dll wingui.gif wingui.htm *.bat clock.c clock1.c fullscrn.c hello hello.c wingui/wcr* wingui/wct* wingui/wc_* wingui/wcw* wingui/z* wingui/scr2html.c wingui/newtest* wingui/*.sav wingui/*.def wincon/*.def *.obj *.bak *.map *.lib m .vscode buildcurses-1.4.4/vendor/PDCurses/man/0000755000004100000410000000000014201713275016616 5ustar www-datawww-datacurses-1.4.4/vendor/PDCurses/man/Makefile0000644000004100000410000000151214201713275020255 0ustar www-datawww-data# Makefile for PDCurses manext program. all: manual manual: PDCurses.md PDCurses.md: manext intro.md x11.md sdl.md ../curses.h cat intro.md > PDCurses.md echo PDCurses Definitions and Variables >> PDCurses.md echo ================================== >> PDCurses.md ./manext ../curses.h >> PDCurses.md echo PDCurses Functions >> PDCurses.md echo ================== >> PDCurses.md ./manext ../pdcurses/*.c >> PDCurses.md ./manext ../x11/*.c >> PDCurses.md cat x11.md >> PDCurses.md echo >> PDCurses.md echo >> PDCurses.md echo \ -------------------------------------------------------------------------- \ >> PDCurses.md echo >> PDCurses.md cat sdl.md >> PDCurses.md manext: manext.c install: echo Does nothing at the moment clean: -rm -rf *.o manext PDCurses.md distclean: clean mostlyclean: clean realclean: distclean curses-1.4.4/vendor/PDCurses/man/README.md0000644000004100000410000000107114201713275020074 0ustar www-datawww-dataPDCurses Documentation ====================== Some plain text documents to provide a basic overview of PDCurses and details for specific platforms, along with a program to combine them with the "man page" sections from the source code files, into "PDCurses.md". Building -------- - Type "make". ("make clean" to remove the built files.) A Unix-like environment is required for the Makefile. This is called automatically when doing a top-level make of the X11 port. Distribution Status ------------------- Public Domain, except for manext.c, which is GPL 2+. curses-1.4.4/vendor/PDCurses/man/sdl.md0000644000004100000410000001541514201713275017730 0ustar www-datawww-dataSDL Considerations ================== There are no special requirements to use PDCurses for SDL -- all PDCurses-compatible code should work fine. (In fact, you can even build against the Win32 console pdcurses.dll, and then swap in the SDL pdcurses.dll.) Nothing extra is needed beyond the base SDL library. However, there are some optional special features, described here. The principal limitation of this port is that input is currently restricted to ASCII (i.e., 0-127), plus the special keys like KEY_LEFT. (You could have Unicode input, but then the input wouldn't match the output, which is in Code Page 437.) Also, see the note about the potential for incomplete output under "PDC_update_rects()", below. Fonts ----- The font is a simple BMP, 32 characters wide by 8 characters tall, preferably with a palette. (BMPs without palettes still work, but in that case, no attributes will be available, nor will the cursor work.) The first entry in the palette (usually black) is treated as the background color; the last entry (usually white) is treated as the foreground. These are changed or made transparent as appropriate; any other colors in the palette are passed through unchanged. So -- although a one-bit depth is sufficient for a normal font -- you could redraw some characters as multi-colored tiles. The font must be monospaced. The size of each character is derived by dividing the width of the BMP by 32 and the height by 8. There is no constraint on the dimensions. As provided in the default font and expected by acs_map[], the font is in Code Page 437 form. But you can of course use any layout if you're not relying on correct values for the ACS_* macros. The font can be set via the environment variable PDC_FONT. If it's not set, PDCurses looks for a file named "pdcfont.bmp" in the current directory at the time of initscr(). If neither is found, it uses the built-in default font encoded in deffont.h. Backgrounds ----------- PDCurses for SDL supports an optional background image BMP. This is used whenever start_color() has not been called (see the ptest demo for an example), or when use_default_colors() has been called after start_color(), and the background color of a pair has been set to -1 (see ozdemo, worm, and rain for examples). The usage parallels that of ncurses in an appropriate terminal (e.g., Gnome Terminal). The image is tiled to cover the PDCurses window, and can be any size or depth. As with the font, you can point to a location for the background via the environment variable PDC_BACKGROUND; "pdcback.bmp" is the fallback. (There is no default background.) Icons ----- The icon (used with SDL_WM_SetIcon() -- not used for the executable file) can be set via the environment variable PDC_ICON, and falls back to "pdcicon.bmp", and then to the built-in icon from deficon.h. The built-in icon is the PDCurses logo, as seen in ../x11/little_icon.xbm. The SDL docs say that the icon must be 32x32, at least for use with MS Windows. If pdc_screen is preinitialized (see below), PDCurses does not attempt to set the icon. Screen size ----------- The default screen size is 80x25 characters (whatever size they may be), but you can override this via the environment variables PDC_COLS and/or PDC_LINES. (Some other ports use COLS and LINES; this is not done here because those values are, or should be, those of the controlling terminal, and PDCurses for SDL is independent of the terminal.) If pdc_screen is preinitialized (see below), these are ignored. Integration with SDL -------------------- If you want to go further, you can mix PDCurses and SDL functions. (Of course this is extremely non-portable!) To aid you, there are several external variables and functions specific to the SDL port; you could include pdcsdl.h, or just add the declarations you need in your code: PDCEX SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back; PDCEX int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset; void PDC_update_rects(void); void PDC_retile(void); pdc_screen is the main surface, created by SDL_SetVideoMode(), unless it's preset before initscr(). You can perform normal SDL operations on this surface, but PDCurses won't respect them when it updates. (For that, see PDC_retile().) As an alternative, you can preinitialize this surface before calling initscr(). In that case, you can use pdc_sheight, pdc_swidth, pdc_yoffset and/or pdc_xoffset (q.v.) to confine PDCurses to only a specific area of the surface, reserving the rest for other SDL operations. If you preinitialize pdc_screen, you'll have to close it yourself; PDCurses will ignore resize events, and won't try to set the icon. Also note that if you preinitialize pdc_screen, it need not be the display surface. pdc_font, pdc_icon, and pdc_back are the SDL_surfaces for the font, icon, and background, respectively. You can set any or all of them before initscr(), and thus override any of the other ways to set them. But note that pdc_icon will be ignored if pdc_screen is preset. pdc_sheight and pdc_swidth are the dimensions of the area of pdc_screen to be used by PDCurses. You can preset them before initscr(); if either is not set, it defaults to the full screen size minus the x or y offset, as appropriate. pdc_xoffset and pdc_yoffset are the x and y offset for the area of pdc_screen to be used by PDCurses. See the sdltest demo for an example. PDC_retile() makes a copy of pdc_screen, then tiles it with the background image, if any. The resulting surface is used as the background for transparent character cells. PDC_retile() is called from initscr() and resize_term(). However, you can also use it at other times, to take advantage of the way it copies pdc_screen: Draw some SDL stuff; call PDC_retile(); do some curses stuff -- it will use whatever was on pdc_screen as the background. Then you can erase the curses screen, do some more SDL stuff, and call PDC_retile() again to make a new background. (If you don't erase the curses screen, it will be incorporated into the background when you call PDC_retile().) But this only works if no background image is set. PDC_update_rects() is how the screen actually gets updated. For performance reasons, when drawing, PDCurses for SDL maintains a table of rectangles that need updating, and only updates (by calling this function) during getch(), napms(), or when the table gets full. Normally, this is sufficient; but if you're pausing in some way other than by using napms(), and you're not doing keyboard checks, you may get an incomplete update. If that happens, you can call PDC_update_rects() manually. Interaction with stdio ---------------------- As with X11, it's a bad idea to mix curses and stdio calls. (In fact, that's true for PDCurses on any platform; but especially these two, which don't run under terminals.) Depending on how SDL is built, stdout and stderr may be redirected to files. curses-1.4.4/vendor/PDCurses/man/intro.md0000644000004100000410000003002614201713275020274 0ustar www-datawww-dataPDCurses User's Guide ===================== Curses Overview --------------- The X/Open Curses Interface Definition describes a set of C-Language functions that provide screen-handling and updating, which are collectively known as the curses library. The curses library permits manipulation of data structures called windows which may be thought of as two-dimensional arrays of characters representing all or part of a terminal's screen. The windows are manipulated using a procedural interface described elsewhere. The curses package maintains a record of what characters are on the screen. At the most basic level, manipulation is done with the routines move() and addch() which are used to "move" the curses around and add characters to the default window, stdscr, which represents the whole screen. An application may use these routines to add data to the window in any convenient order. Once all data have been added, the routine refresh() is called. The package then determines what changes have been made which affect the screen. The screen contents are then changed to reflect those characters now in the window, using a sequence of operations optimized for the type of terminal in use. At a higher level routines combining the actions of move() and addch() are defined, as are routines to add whole strings and to perform format conversions in the manner of printf(). Interfaces are also defined to erase the entire window and to specify the attributes of individual characters in the window. Attributes such as inverse video, underline and blink can be used on a per-character basis. New windows can be created by allowing the application to build several images of the screen and display the appropriate one very quickly. New windows are created using the routine newwin(). For each routine that manipulates the default window, stdscr, there is a corresponding routine prefixed with w to manipulate the contents of a specified window; for example, move() and wmove(). In fact, move(...) is functionally equivalent to wmove( stdscr, ...). This is similar to the interface offered by printf(...) and fprintf(stdout, ...). Windows do not have to correspond to the entire screen. It is possible to create smaller windows, and also to indicate that the window is only partially visible on the screen. Furthermore, large windows or pads, which are bigger than the actual screen size, may be created. Interfaces are also defined to allow input character manipulation and to disable and enable many input attributes: character echo, single character input with or without signal processing (cbreak or raw modes), carriage returns mapping to newlines, screen scrolling, etc. Data Types and the \ Header -------------------------------------- The data types supported by curses are described in this section. As the library supports a procedural interface to the data types, actual structure contents are not described. All curses data are manipulated using the routines provided. ### The \ Header The \ header defines various constants and declares the data types that are available to the application. ### Data Types The following data types are declared: WINDOW * pointer to screen representation SCREEN * pointer to terminal descriptor bool boolean data type chtype representation of a character in a window cchar_t the wide-character equivalent of chtype attr_t for WA_-style attributes The actual WINDOW and SCREEN objects used to store information are created by the corresponding routines and a pointer to them is provided. All manipulation is through that pointer. ### Variables The following variables are defined: LINES number of lines on terminal screen COLS number of columns on terminal screen stdscr pointer to the default screen window curscr pointer to the current screen image SP pointer to the current SCREEN struct Mouse_status status of the mouse COLORS number of colors available COLOR_PAIRS number of color pairs available TABSIZE size of one TAB block acs_map[] alternate character set map ttytype[] terminal name/description ### Constants The following constants are defined: #### General FALSE boolean false value TRUE boolean true value NULL zero pointer value ERR value returned on error condition OK value returned on successful completion #### Video Attributes Normally, attributes are a property of the character. For chtype: A_ALTCHARSET use the alternate character set A_BLINK bright background or blinking A_BOLD bright foreground or bold A_DIM half bright -- no effect in PDCurses A_INVIS invisible A_ITALIC italic A_LEFTLINE line along the left edge A_PROTECT protected (?) -- PDCurses renders this as a combination of the *LINE attributes A_REVERSE reverse video A_RIGHTLINE line along the right edge A_STANDOUT terminal's best highlighting mode A_UNDERLINE underline A_ATTRIBUTES bit-mask to extract attributes A_CHARTEXT bit-mask to extract a character A_COLOR bit-mask to extract a color-pair Not all attributes will work on all terminals. A_RIGHTLINE, A_LEFTLINE and A_ITALIC are specific to PDCurses. A_INVIS and A_ITALIC are given the same value in PDCurses. For attr_t: WA_ALTCHARSET same as A_ALTCHARSET WA_BLINK same as A_BLINK WA_BOLD same as A_BOLD WA_DIM same as A_DIM WA_INVIS same as A_INVIS WA_LEFT same as A_LEFTLINE WA_PROTECT same as A_PROTECT WA_REVERSE same as A_REVERSE WA_RIGHT same as A_RIGHTLINE WA_STANDOUT same as A_STANDOUT WA_UNDERLINE same as A_UNDERLINE Note that while A_LEFTLINE and A_RIGHTLINE are PDCurses-specific, WA_LEFT and WA_RIGHT are standard. The following are also defined, for compatibility, but currently have no effect in PDCurses: WA_HORIZONTAL, WA_LOW, WA_TOP, WA_VERTICAL. ### The Alternate Character Set For use in chtypes and with related functions. These are a portable way to represent graphics characters on different terminals. VT100-compatible symbols -- box characters: ACS_ULCORNER upper left box corner ACS_LLCORNER lower left box corner ACS_URCORNER upper right box corner ACS_LRCORNER lower right box corner ACS_RTEE right "T" ACS_LTEE left "T" ACS_BTEE bottom "T" ACS_TTEE top "T" ACS_HLINE horizontal line ACS_VLINE vertical line ACS_PLUS plus sign, cross, or four-corner piece VT100-compatible symbols -- other: ACS_S1 scan line 1 ACS_S9 scan line 9 ACS_DIAMOND diamond ACS_CKBOARD checkerboard -- 50% grey ACS_DEGREE degree symbol ACS_PLMINUS plus/minus sign ACS_BULLET bullet Teletype 5410v1 symbols -- these are defined in SysV curses, but are not well-supported by most terminals. Stick to VT100 characters for optimum portability: ACS_LARROW left arrow ACS_RARROW right arrow ACS_DARROW down arrow ACS_UARROW up arrow ACS_BOARD checkerboard -- lighter (less dense) than ACS_CKBOARD ACS_LANTERN lantern symbol ACS_BLOCK solid block That goes double for these -- undocumented SysV symbols. Don't use them: ACS_S3 scan line 3 ACS_S7 scan line 7 ACS_LEQUAL less than or equal ACS_GEQUAL greater than or equal ACS_PI pi ACS_NEQUAL not equal ACS_STERLING pounds sterling symbol Box character aliases: ACS_BSSB same as ACS_ULCORNER ACS_SSBB same as ACS_LLCORNER ACS_BBSS same as ACS_URCORNER ACS_SBBS same as ACS_LRCORNER ACS_SBSS same as ACS_RTEE ACS_SSSB same as ACS_LTEE ACS_SSBS same as ACS_BTEE ACS_BSSS same as ACS_TTEE ACS_BSBS same as ACS_HLINE ACS_SBSB same as ACS_VLINE ACS_SSSS same as ACS_PLUS For cchar_t and wide-character functions, WACS_ equivalents are also defined. ### Colors For use with init_pair(), color_set(), etc.: COLOR_BLACK COLOR_BLUE COLOR_GREEN COLOR_CYAN COLOR_RED COLOR_MAGENTA COLOR_YELLOW COLOR_WHITE Use these instead of numeric values. The definition of the colors depends on the implementation of curses. ### Input Values The following constants might be returned by getch() if keypad() has been enabled. Note that not all of these may be supported on a particular terminal: KEY_BREAK break key KEY_DOWN the four arrow keys KEY_UP KEY_LEFT KEY_RIGHT KEY_HOME home key (upward+left arrow) KEY_BACKSPACE backspace KEY_F0 function keys; space for 64 keys is reserved KEY_F(n) (KEY_F0+(n)) KEY_DL delete line KEY_IL insert line KEY_DC delete character KEY_IC insert character KEY_EIC exit insert character mode KEY_CLEAR clear screen KEY_EOS clear to end of screen KEY_EOL clear to end of line KEY_SF scroll 1 line forwards KEY_SR scroll 1 line backwards (reverse) KEY_NPAGE next page KEY_PPAGE previous page KEY_STAB set tab KEY_CTAB clear tab KEY_CATAB clear all tabs KEY_ENTER enter or send KEY_SRESET soft (partial) reset KEY_RESET reset or hard reset KEY_PRINT print or copy KEY_LL home down or bottom (lower left) KEY_A1 upper left of virtual keypad KEY_A3 upper right of virtual keypad KEY_B2 center of virtual keypad KEY_C1 lower left of virtual keypad KEY_C3 lower right of virtual keypad KEY_BTAB Back tab key KEY_BEG Beginning key KEY_CANCEL Cancel key KEY_CLOSE Close key KEY_COMMAND Cmd (command) key KEY_COPY Copy key KEY_CREATE Create key KEY_END End key KEY_EXIT Exit key KEY_FIND Find key KEY_HELP Help key KEY_MARK Mark key KEY_MESSAGE Message key KEY_MOVE Move key KEY_NEXT Next object key KEY_OPEN Open key KEY_OPTIONS Options key KEY_PREVIOUS Previous object key KEY_REDO Redo key KEY_REFERENCE Reference key KEY_REFRESH Refresh key KEY_REPLACE Replace key KEY_RESTART Restart key KEY_RESUME Resume key KEY_SAVE Save key KEY_SBEG Shifted beginning key KEY_SCANCEL Shifted cancel key KEY_SCOMMAND Shifted command key KEY_SCOPY Shifted copy key KEY_SCREATE Shifted create key KEY_SDC Shifted delete char key KEY_SDL Shifted delete line key KEY_SELECT Select key KEY_SEND Shifted end key KEY_SEOL Shifted clear line key KEY_SEXIT Shifted exit key KEY_SFIND Shifted find key KEY_SHELP Shifted help key KEY_SHOME Shifted home key KEY_SIC Shifted input key KEY_SLEFT Shifted left arrow key KEY_SMESSAGE Shifted message key KEY_SMOVE Shifted move key KEY_SNEXT Shifted next key KEY_SOPTIONS Shifted options key KEY_SPREVIOUS Shifted prev key KEY_SPRINT Shifted print key KEY_SREDO Shifted redo key KEY_SREPLACE Shifted replace key KEY_SRIGHT Shifted right arrow KEY_SRSUME Shifted resume key KEY_SSAVE Shifted save key KEY_SSUSPEND Shifted suspend key KEY_SUNDO Shifted undo key KEY_SUSPEND Suspend key KEY_UNDO Undo key The virtual keypad is arranged like this: A1 up A3 left B2 right C1 down C3 This list is incomplete -- see curses.h for the full list, and use the testcurs demo to see what values are actually returned. The above are just the keys required by X/Open. In particular, PDCurses defines many CTL_ and ALT_ combinations; these are not portable. -------------------------------------------------------------------------- curses-1.4.4/vendor/PDCurses/man/sdl2.md0000644000004100000410000000361014201713275020004 0ustar www-datawww-dataSDL2 Considerations =================== Most of the information in the [SDL Considerations](sdl.md) document is also valid for the SDL2 platform. This document describes the differences. Integration with SDL2 --------------------- As mentioned in the [SDL Considerations](sdl.md) document, the SDL port uses the following variables: SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back; int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset; The SDL2 port adds: SDL_Window *pdc_window; These can be used or modified in your own code. Like the `pdc_screen` variable used by the SDL port, you can initialize `pdc_window` in your own code. See the sdltest demo for an example. If it's not initialized, PDCurses will do it for you. If PDCurses initializes `pdc_window`, it will clean up/deallocate these variables on exit. Fonts ----- If the `PDC_WIDE` flag is set during compilation, SDL2_ttf is used to render fonts. This allows for use of a full UCS-2 (16 bit Unicode) character set. Using SDL2_ttf adds: TTF_Font *pdc_ttffont; int pdc_font_size; The default TrueType font can be modified by setting a define during compile time (e.g. `-DPDC_FONT_PATH=/usr/share/fonts/truetype/dejavu/`). This can be overridden by initializing `pdc_ttffont` in your own code. Similar to the `PDC_FONT` environment variable for bitmap fonts, one can also override TTF fonts using the `PDC_FONT` environment variables. Unless modified during compile time, the defaults are: Windows: C:/Windows/Fonts/lucon.ttf OS X: /Library/Fonts/Courier New.ttf Other: /usr/share/fonts/truetype/freefont/FreeMono.ttf Font size can be set using the `PDC_FONT_SIZE` environment variable or by setting the value of `pdc_font_size` in your own code. The default size is 18. Clipboard --------- SDL2 port uses functionality provided by the SDL2 clipboard functions to add basic clipboard support. curses-1.4.4/vendor/PDCurses/man/x11.md0000644000004100000410000003566114201713275017564 0ustar www-datawww-dataX11 Considerations ================== PDCurses for X11 uses the System V IPC shared memory facility, along with sockets, to share data between the curses program and the child process created to manage the X stuff. When compiling your application, you need to include the \ or \ that comes with PDCurses. You also need to link your code with libXCurses. You may need to link with the following libraries under X11R5: Xaw Xmu Xt X11 or, under X11R6: Xaw Xmu Xt X11 SM ICE Xext You can run "xcurses-config --libs" to show the link parameters for your system. If using dynamic linking, on some systems, "-lXCurses" suffices. By calling Xinitscr() rather than initscr(), you can pass your program name and resource overrides to PDCurses. The program name is used as the title of the X window, and for defining X resources specific to your program. Interaction with stdio ---------------------- Be aware that curses programs that expect to have a normal tty underneath them will be very disappointed! Output directed to stdout will go to the xterm that invoked the PDCurses application, or to the console if not invoked directly from an xterm. Similarly, stdin will expect its input from the same place as stdout. X Resources ----------- PDCurses for X11 recognizes the following resources: ### lines Specifies the number of lines the "screen" will have. Directly equates to LINES. There is no theoretical maximum. The minimum value must be 2. Default: 24 ### cols Specifies the number of columns the "screen" will have. Directly equates to COLS. There is no theoretical maximum. The minimum value must be 2. Default: 80 ### normalFont The name of a fixed width font. Default: 7x13 ### italicFont The name of a fixed width font to be used for characters with A_ITALIC attributes. Must have the same cell size as normalFont. Default: 7x13 (obviously not an italic font) ### pointer The name of a valid pointer cursor. Default: xterm ### pointerForeColor The foreground color of the pointer. Default: black ### pointerBackColor The background color of the pointer. Default: white ### cursorColor ### textCursor The alignment of the text cursor; horizontal or vertical. Default: horizontal ### colorBlack The color of the COLOR_BLACK attribute. Default: Black ### colorRed The color of the COLOR_RED attribute. Default: red3 ### colorGreen The color of the COLOR_GREEN attribute. Default: green3 ### colorYellow The color of the COLOR_YELLOW attribute. Default: yellow3 ### colorBlue The color of the COLOR_BLUE attribute. Default: blue3 ### colorMagenta The color of the COLOR_MAGENTA attribute. Default: magenta3 ### colorCyan The color of the COLOR_CYAN attribute. Default: cyan3 ### colorWhite The color of the COLOR_WHITE attribute. Default: Grey ### colorBoldBlack COLOR_BLACK combined with A_BOLD. Default: grey40 ### colorBoldRed COLOR_RED combined with A_BOLD. Default: red1 ### colorBoldGreen COLOR_GREEN combined with A_BOLD. Default: green1 ### colorBoldYellow COLOR_YELLOW combined with A_BOLD. Default: yellow1 ### colorBoldBlue COLOR_BLUE combined with A_BOLD. Default: blue1 ### colorBoldMagenta COLOR_MAGENTA combined with A_BOLD. Default: magenta1 ### colorBoldCyan COLOR_CYAN combined with A_BOLD. Default: cyan1 ### colorBoldWhite COLOR_WHITE combined with A_BOLD. Default: White ### bitmap The name of a valid bitmap file of depth 1 (black and white) used for the application's icon. The file is an X bitmap. Default: a 32x32 or 64x64 pixmap depending on the window manager ### pixmap The name of a valid pixmap file of any depth supported by the window manager (color) for the application's icon, The file is an X11 pixmap. This resource is only available if the libXpm package has been installed (most systems have this by default). This resource overrides the "bitmap" resource. Default: none, uses default bitmap above ### translations Translations enable the user to customize the action that occurs when a key, combination of keys, or a button is pressed. The translations are similar to those used by xterm. Defaults: : XCursesKeyPress() : XCursesKeyPress() : XCursesButton() : XCursesButton() : XCursesButton() The most useful action for KeyPress translations is string(). The argument to the string() action can be either a string or a hex representation of a character; e.g., string(0x1b) will send the ASCII escape character to the application; string("[11~") will send [ 1 1 ~ , as separate keystrokes. ### shmmin On most systems, there are two Unix kernel parameters that determine the allowable size of a shared memory segment. These parameters are usually something like SHMMIN and SHMMAX. To use shared memory, a program must allocate a segment of shared memory that is between these two values. Usually these values are like 1 for SHMMIN and some large number for SHMMAX. Sometimes the Unix kernel is configured to have a value of SHMMIN that is bigger than the size of one of the shared memory segments that libXCurses uses. On these systems an error message like: Cannot allocate shared memory for SCREEN: Invalid argument will result. To overcome this problem, this resource should be set to the kernel value for SHMMIN. This ensures that a shared memory segment will always be bigger than the kernel value for SHMMIN (and hopefully less than SHMMAX!) Default: 0 ### borderColor The color of the border around the screen. Default: black ### borderWidth The width in pixels of the border around the screen. Default: 0 ### clickPeriod The period (in milliseconds) between a button press and a button release that determines if a click of a button has occurred. Default: 100 ### doubleClickPeriod The period (in milliseconds) between two button press events that determines if a double click of a button has occurred. Default: 200 ### composeKey The name of the X key that defines the "compose key", which is used to enter characters in the Latin-1 character set above 0xA0. (See "Compose Keys for Latin-1" below.) This is used only when PDCurses is built without XIM support. While in compose mode, the text cursor will appear as a hollow rectangle. Default: Multi_key Using Resources --------------- All applications have a top-level class name of "XCurses". If Xinitscr() is used, it sets an application's top-level widget name. (Otherwise the name defaults to "PDCurses".) Examples for app-defaults or .Xdefaults: ! ! resources for XCurses class of programs ! XCurses*lines: 30 XCurses*cols: 80 XCurses*normalFont: 9x13 XCurses*bitmap: /tmp/xcurses.xbm XCurses*pointer: top_left_arrow ! ! resources for testcurs - XCurses ! testcurs.colorRed: orange testcurs.colorBlack: midnightblue testcurs.lines: 25 *testcurs.Translations: #override \n \ F12: string(0x1b) string("[11~") \n ! ! resources for THE - XCurses ! ! resources with the * wildcard can be overridden by a parameter passed ! to initscr() ! the*normalFont: 9x15 the*lines: 40 the*cols: 86 the*pointer: xterm the*pointerForeColor: white the*pointerBackColor: black ! ! resources with the . format can not be overridden by a parameter passed ! to Xinitscr() ! the.bitmap: /home/mark/the/the64.xbm the.pixmap: /home/mark/the/the64.xpm Resources may also be passed as parameters to the Xinitscr() function. Parameters are strings in the form of switches; e.g., to set the color "red" to "indianred", and the number of lines to 30, the string passed to Xinitscr would be: "-colorRed indianred -lines 30" Compose Keys for Latin-1 ------------------------ When built without XIM support, PDCurses for X11 provides its own, limited compose key system for Latin-1 characters. The available combinations are listed here. For a given character, any of the combinations shown in the last column may be used. To generate a character, press the "compose" key followed by one of the pairs of keystrokes. Where no key is evident, the spacebar is used. Thus, to generate the NO-BREAK SPACE, press the "compose" key followed by two hits of the spacebar. With a typical modern X server, you can get many more compose key combinations by using XIM instead. Configure PDCurses with --enable-xim to use XIM support. This document is encoded in UTF-8. Hex| Dec |Chr| Description ISO 10646-1:1993(E) | Compose key combinations ---+-----+---+---------------------------------+------------------------- A0 | 160 | | NO-BREAK SPACE | A1 | 161 | ¡ | INVERTED EXCLAMATION MARK | ! !! A2 | 162 | ¢ | CENT SIGN | c| |c c/ c$ C$ C| A3 | 163 | £ | POUND SIGN | L- L$ L= l- l$ l= |- A4 | 164 | ¤ | CURRENCY SIGN | xo ox XO g$ A5 | 165 | Â¥ | YEN SIGN | =y y= =Y Y= Y- y$ y- A6 | 166 | ¦ | BROKEN BAR | | || vb VB |^ A7 | 167 | § | SECTION SIGN | SO SS s! S! so A8 | 168 | ¨ | DIAERESIS | " "" A9 | 169 | © | COPYRIGHT SIGN | CO co OC AA | 170 | ª | FEMININE ORDINAL INDICATOR | sa SA a_ A_ AB | 171 | « | LEFT DOUBLE ANGLE QUOTES | << AC | 172 | ¬ | NOT SIGN | -, no NO AD | 173 | ­ | SOFT HYPHEN | - -- AE | 174 | ® | REGISTERED SIGN | RO ro OR AF | 175 | ¯ | MACRON | -^ _^ __ B0 | 176 | ° | DEGREE SIGN | o 0^ 0* de DE ^0 B1 | 177 | ± | PLUS-MINUS SIGN | -+ +- B2 | 178 | ² | SUPERSCRIPT TWO | 2 2^ s2 ^2 B3 | 179 | ³ | SUPERSCRIPT THREE | 3 3^ s3 ^3 B4 | 180 | ´ | ACUTE ACCENT | ' '' B5 | 181 | µ | MICRO SIGN | u /u /U *m *M B6 | 182 | ¶ | PILCROW SIGN | p! P! pg PG B7 | 183 | · | MIDDLE DOT | . .^ .. B8 | 184 | ¸ | CEDILLA | , ,, B9 | 185 | ¹ | SUPERSCRIPT ONE | 1 1^ s1 ^1 BA | 186 | º | MASCULINE ORDINAL INDICATOR | o_ s0 S0 BB | 187 | » | RIGHT DOUBLE ANGLE QUOTES | >> BC | 188 | ¼ | VULGAR FRACTION ONE QUARTER | 14 BD | 189 | ½ | VULGAR FRACTION ONE HALF | 12 BE | 190 | ¾ | VULGAR FRACTION THREE QUARTERS | 34 BF | 191 | ¿ | INVERTED QUESTION MARK | ? ?? C0 | 192 | À | CAPITAL A WITH GRAVE ACCENT | `A A` C1 | 193 | à | CAPITAL A WITH ACUTE ACCENT | 'A A' C2 | 194 |  | CAPITAL A WITH CIRCUMFLEX ACCENT| ^A A^ A> C3 | 195 | à | CAPITAL A WITH TILDE | ~A A~ A- C4 | 196 | Ä | CAPITAL A WITH DIAERESIS | "A A" C5 | 197 | Ã… | CAPITAL A WITH RING ABOVE | oA Ao A* OA *A C6 | 198 | Æ | CAPITAL LIGATURE AE | AE C7 | 199 | Ç | CAPITAL C WITH CEDILLA | ,C C, C8 | 200 | È | CAPITAL E WITH GRAVE ACCENT | `E E` C9 | 201 | É | CAPITAL E WITH ACUTE ACCENT | 'E E' CA | 202 | Ê | CAPITAL E WITH CIRCUMFLEX ACCENT| ^E E^ E> CB | 203 | Ë | CAPITAL E WITH DIAERESIS | "E E" CC | 204 | ÃŒ | CAPITAL I WITH GRAVE ACCENT | `I I` CD | 205 | à | CAPITAL I WITH ACUTE ACCENT | 'I I' CE | 206 | ÃŽ | CAPITAL I WITH CIRCUMFLEX ACCENT| ^I I^ I> CF | 207 | à | CAPITAL I WITH DIAERESIS | "I I" D0 | 208 | à | CAPITAL ETH | D- D1 | 209 | Ñ | CAPITAL N WITH TILDE | ~N N~ N- D2 | 210 | Ã’ | CAPITAL O WITH GRAVE ACCENT | `O O` D3 | 211 | Ó | CAPITAL O WITH ACUTE ACCENT | 'O O' D4 | 212 | Ô | CAPITAL O WITH CIRCUMFLEX ACCENT| ^O O^ O> D5 | 213 | Õ | CAPITAL O WITH TILDE | ~O O~ O- D6 | 214 | Ö | CAPITAL O WITH DIAERESIS | "O O" D7 | 215 | × | MULTIPLICATION SIGN | x xx XX mu MU D8 | 216 | Ø | CAPITAL O WITH STROKE | /O O/ D9 | 217 | Ù | CAPITAL U WITH GRAVE ACCENT | `U U` DA | 218 | Ú | CAPITAL U WITH ACUTE ACCENT | 'U U' DB | 219 | Û | CAPITAL U WITH CIRCUMFLEX ACCENT| ^U U^ U> DC | 220 | Ü | CAPITAL U WITH DIAERESIS | "U U" DD | 221 | à | CAPITAL Y WITH ACUTE ACCENT | 'Y Y' DE | 222 | Þ | CAPITAL THORN | P TH |P DF | 223 | ß | SMALL SHARP S | ss E0 | 224 | à | SMALL A WITH GRAVE ACCENT | `a a` E1 | 225 | á | SMALL A WITH ACUTE ACCENT | 'a a' E2 | 226 | â | SMALL A WITH CIRCUMFLEX ACCENT | ^a a^ a> E3 | 227 | ã | SMALL A WITH TILDE | ~a a~ a- E4 | 228 | ä | SMALL A WITH DIAERESIS | "a a" E5 | 229 | Ã¥ | SMALL A WITH RING ABOVE | oa ao Oa a* *a E6 | 230 | æ | SMALL LIGATURE AE | ae E7 | 231 | ç | SMALL C WITH CEDILLA | ,c c, E8 | 232 | è | SMALL E WITH GRAVE ACCENT | `e e` E9 | 233 | é | SMALL E WITH ACUTE ACCENT | 'e e' EA | 234 | ê | SMALL E WITH CIRCUMFLEX ACCENT | ^e e^ e> EB | 235 | ë | SMALL E WITH DIAERESIS | "e e" EC | 236 | ì | SMALL I WITH GRAVE ACCENT | `i i` ED | 237 | í | SMALL I WITH ACUTE ACCENT | 'i i' EE | 238 | î | SMALL I WITH CIRCUMFLEX ACCENT | ^i i^ i> EF | 239 | ï | SMALL I WITH DIAERESIS | "i i" F0 | 240 | ð | SMALL ETH | d- F1 | 241 | ñ | SMALL N WITH TILDE | ~n n~ n- F2 | 242 | ò | SMALL O WITH GRAVE ACCENT | `o o` F3 | 243 | ó | SMALL O WITH ACUTE ACCENT | 'o o' F4 | 244 | ô | SMALL O WITH CIRCUMFLEX ACCENT | ^o o^ o> F5 | 245 | õ | SMALL O WITH TILDE | ~o o~ o- F6 | 246 | ö | SMALL O WITH DIAERESIS | "o o" F7 | 247 | ÷ | DIVISION SIGN | -: :- F8 | 248 | ø | SMALL O WITH OBLIQUE BAR | /o o/ F9 | 249 | ù | SMALL U WITH GRAVE ACCENT | `u u` FA | 250 | ú | SMALL U WITH ACUTE ACCENT | 'u u' FB | 251 | û | SMALL U WITH CIRCUMFLEX ACCENT | ^u u^ u> FC | 252 | ü | SMALL U WITH DIAERESIS | "u u" FD | 253 | ý | SMALL Y WITH ACUTE ACCENT | 'y y' FE | 254 | þ | SMALL THORN | p th |p FF | 255 | ÿ | SMALL Y WITH DIAERESIS | "y y" Deprecated ---------- XCursesProgramName is no longer used. To set the program name, you must use Xinitscr(), or PDC_set_title() to set just the window title. The XCursesExit() function is now called automatically via atexit(). (Multiple calls to it are OK, so you don't need to remove it if you've already added it for previous versions of PDCurses.) XCURSES is no longer defined automatically, but need not be defined, unless you want the X11-specific prototypes. (Normal curses programs won't need it.) curses-1.4.4/vendor/PDCurses/man/manext.c0000644000004100000410000000657314201713275020271 0ustar www-datawww-data/***********************************************************************/ /* MANEXT - Extract manual pages from C source code. */ /***********************************************************************/ /* * MANEXT - A program to extract manual pages from C source code. * Copyright (C) 1991-1996 Mark Hessling * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * If you make modifications to this software that you feel increases * it usefulness for the rest of the community, please email the * changes, enhancements, bug fixes as well as any and all ideas to me. * This software is going to be maintained and enhanced as deemed * necessary by the community. * * Mark Hessling */ #include #include #include #define MAX_LINE 255 void display_info() { fprintf(stderr, "\nMANEXT 1.03 Copyright (C) 1991-1996 Mark Hessling\n" "All rights reserved.\n" "MANEXT is distributed under the terms of the GNU\n" "General Public License and comes with NO WARRANTY.\n" "See the file COPYING for details.\n" "\nUsage: manext sourcefile [...]\n\n"); } int main(int argc, char **argv) { char s[MAX_LINE + 1]; /* input line */ int i; FILE *fp; #ifdef __EMX__ _wildcard(&argc, &argv); #endif if (strcmp(argv[1], "-h") == 0) { display_info(); exit(1); } for (i = 1; i < argc; i++) { if ((fp = fopen(argv[i], "r")) == NULL) { fprintf(stderr, "\nCould not open %s\n", argv[i]); continue; } while (!feof(fp)) { if (fgets(s, (int)sizeof(s), fp) == NULL) { if (ferror(fp) != 0) { fprintf(stderr, "*** Error reading %s. Exiting.\n", argv[i]); exit(1); } break; } /* check for manual entry marker at beginning of line */ if (strncmp(s, "/*man-start*", 12) != 0) continue; /* inner loop */ for (;;) { /* read next line of manual entry */ if (fgets(s, (int)sizeof(s), fp) == NULL) { if (ferror(fp) != 0) { fprintf(stderr, "*** Error reading %s. Exiting.\n", argv[i]); exit(1); } break; } /* check for end of entry marker */ if (strncmp(s, "**man-end", 9) == 0) break; printf("%s", s); } printf("\n\n-----------------------------------" "---------------------------------------\n\n"); } fclose(fp); } return 0; } curses-1.4.4/vendor/PDCurses/IMPLEMNT.md0000644000004100000410000003065214201713275017620 0ustar www-datawww-dataPDCurses Implementor's Guide ============================ - Version 1.3 - 20??/??/?? - notes about official ports, new indentation style; markdown - Version 1.2 - 2007/07/11 - added PDC_init_pair(), PDC_pair_content(), version history; removed pdc_atrtab - Version 1.1 - 2007/06/06 - minor cosmetic change - Version 1.0 - 2007/04/01 - initial revision This document is for those wishing to port PDCurses to a new platform, or just wanting to better understand how it works. Nothing here should be needed for application programming; for that, refer to PDCurses.md, as built in doc/, or distributed as a file separate from this source package. This document assumes that you've read the user-level documentation and are very familiar with application-level curses programming. If you want to submit your port for possible inclusion into the main PDCurses distribution, please follow these guidelines: - Don't modify anything in the pdcurses directory or in other port directories. Don't modify curses.h or curspriv.h unless absolutely necessary. (And prefer modifying curspriv.h over curses.h.) - Use the same indentation style, naming and scope conventions as the existing code. - Release all your code to the public domain -- no copyright. Code under GPL, BSD, etc. will not be accepted. Data Structures =============== A port of PDCurses must provide acs_map[], a 128-element array of chtypes, with values laid out based on the Alternate Character Set of the VT100 (see curses.h). PDC_transform_line() must use this table; when it encounters a chtype with the A_ALTCHARSET flag set, and an A_CHARTEXT value in the range 0-127, it must render it using the A_CHARTEXT portion of the corresponding value from this table, instead of the original value. Also, values may be read from this table by apps, and passed through functions such as waddch(), which does no special processing on control characters (0-31 and 127) when the A_ALTCHARSET flag is set. Thus, any control characters used in acs_map[] should also have the A_ALTCHARSET flag set. Implementations should provide suitable values for all the ACS_ macros defined in curses.h; other values in the table should be filled with their own indices (e.g., acs_map['E'] == 'E'). The table can be either hardwired, or filled by PDC_scr_open(). Existing ports define it in pdcdisp.c, but this is not required. Functions ========= A port of PDCurses must implement the following functions, with extern scope. These functions are traditionally divided into several modules, as indicated below; this division is not required (only the functions are), but may make it easier to follow for someone familiar with the existing ports. Any other functions you create as part of your implementation should have static scope, if possible. If they can't be static, they should be named with the "PDC_" prefix. This minimizes the risk of collision with an application's choices. Current PDCurses style also uses a single leading underscore with the name of any static function; and modified BSD/Allman-style indentation, approximately equivalent to "indent -kr -nut -bl -bli0", with adjustments to keep every line under 80 columns. pdcdisp.c: ---------- ### void PDC_gotoyx(int y, int x); Move the physical cursor (as opposed to the logical cursor affected by wmove()) to the given location. This is called mainly from doupdate(). In general, this function need not compare the old location with the new one, and should just move the cursor unconditionally. ### void PDC_transform_line(int lineno, int x, int len, const chtype *srcp); The core output routine. It takes len chtype entities from srcp (a pointer into curscr) and renders them to the physical screen at line lineno, column x. It must also translate characters 0-127 via acs_map[], if they're flagged with A_ALTCHARSET in the attribute portion of the chtype. pdcgetsc.c: ----------- ### int PDC_get_columns(void); Returns the size of the screen in columns. It's used in resize_term() to set the new value of COLS. (Some existing implementations also call it internally from PDC_scr_open(), but this is not required.) ### int PDC_get_cursor_mode(void); Returns the size/shape of the cursor. The format of the result is unspecified, except that it must be returned as an int. This function is called from initscr(), and the result is stored in SP->orig_cursor, which is used by PDC_curs_set() to determine the size/shape of the cursor in normal visibility mode (curs_set(1)). ### int PDC_get_rows(void); Returns the size of the screen in rows. It's used in resize_term() to set the new value of LINES. (Some existing implementations also call it internally from PDC_scr_open(), but this is not required.) pdckbd.c: --------- ### bool PDC_check_key(void); Keyboard/mouse event check, called from wgetch(). Returns TRUE if there's an event ready to process. This function must be non-blocking. ### void PDC_flushinp(void); This is the core of flushinp(). It discards any pending key or mouse events, removing them from any internal queue and from the OS queue, if applicable. ### int PDC_get_key(void); Get the next available key, or mouse event (indicated by a return of KEY_MOUSE), and remove it from the OS' input queue, if applicable. This function is called from wgetch(). This function may be blocking, and traditionally is; but it need not be. If a valid key or mouse event cannot be returned, for any reason, this function returns -1. Valid keys are those that fall within the appropriate character set, or are in the list of special keys found in curses.h (KEY_MIN through KEY_MAX). When returning a special key code, this routine must also set SP->key_code to TRUE; otherwise it must set it to FALSE. If SP->return_key_modifiers is TRUE, this function may return modifier keys (shift, control, alt), pressed alone, as special key codes; if SP->return_key_modifiers is FALSE, it must not. If modifier keys are returned, it should only happen if no other keys were pressed in the meantime; i.e., the return should happen on key up. But if this is not possible, it may return the modifier keys on key down (if and only if SP->return_key_modifiers is TRUE). ### int PDC_modifiers_set(void); Called from PDC_return_key_modifiers(). If your platform needs to do anything in response to a change in SP->return_key_modifiers, do it here. Returns OK or ERR, which is passed on by the caller. ### int PDC_mouse_set(void); Called by mouse_set(), mouse_on(), and mouse_off() -- all the functions that modify SP->_trap_mbe. If your platform needs to do anything in response to a change in SP->_trap_mbe (for example, turning the mouse cursor on or off), do it here. Returns OK or ERR, which is passed on by the caller. ### void PDC_set_keyboard_binary(bool on); Set keyboard input to "binary" mode. If you need to do something to keep the OS from processing ^C, etc. on your platform, do it here. TRUE turns the mode on; FALSE reverts it. This function is called from raw() and noraw(). pdcscrn.c: ---------- ### bool PDC_can_change_color(void); Returns TRUE if init_color() and color_content() give meaningful results, FALSE otherwise. Called from can_change_color(). ### int PDC_color_content(short color, short *red, short *green, short *blue); The core of color_content(). This does all the work of that function, except checking for values out of range and null pointers. ### int PDC_init_color(short color, short red, short green, short blue); The core of init_color(). This does all the work of that function, except checking for values out of range. ### void PDC_init_pair(short pair, short fg, short bg); The core of init_pair(). This does all the work of that function, except checking for values out of range. The values passed to this function should be returned by a call to PDC_pair_content() with the same pair number. PDC_transform_line() should use the specified colors when rendering a chtype with the given pair number. ### int PDC_pair_content(short pair, short *fg, short *bg); The core of pair_content(). This does all the work of that function, except checking for values out of range and null pointers. ### void PDC_reset_prog_mode(void); The non-portable functionality of reset_prog_mode() is handled here -- whatever's not done in _restore_mode(). In current ports: In OS/2, this sets the keyboard to binary mode; in Win32, it enables or disables the mouse pointer to match the saved mode; in others it does nothing. ### void PDC_reset_shell_mode(void); The same thing, for reset_shell_mode(). In OS/2 and Win32, it restores the default console mode; in others it does nothing. ### int PDC_resize_screen(int nlines, int ncols); This does the main work of resize_term(). It may respond to non-zero parameters, by setting the screen to the specified size; to zero parameters, by setting the screen to a size chosen by the user at runtime, in an unspecified way (e.g., by dragging the edges of the window); or both. It may also do nothing, if there's no appropriate action for the platform. ### void PDC_restore_screen_mode(int i); Called from _restore_mode() in kernel.c, this function does the actual mode changing, if applicable. Currently used only in DOS and OS/2. ### void PDC_save_screen_mode(int i); Called from _save_mode() in kernel.c, this function saves the actual screen mode, if applicable. Currently used only in DOS and OS/2. ### void PDC_scr_close(void); The platform-specific part of endwin(). It may restore the image of the original screen saved by PDC_scr_open(), if the PDC_RESTORE_SCREEN environment variable is set; either way, if using an existing terminal, this function should restore it to the mode it had at startup, and move the cursor to the lower left corner. (The X11 port does nothing.) ### void PDC_scr_free(void); Frees the memory for SP allocated by PDC_scr_open(). Called by delscreen(). ### int PDC_scr_open(int argc, char **argv); The platform-specific part of initscr(). It's actually called from Xinitscr(); the arguments, if present, correspond to those used with main(), and may be used to set the title of the terminal window, or for other, platform-specific purposes. (The arguments are currently used only in X11.) PDC_scr_open() must allocate memory for SP, and must initialize acs_map[] (unless it's preset) and several members of SP, including lines, cols, mouse_wait, orig_attr (and if orig_attr is TRUE, orig_fore and orig_back), mono, _restore and _preserve. (Although SP is used the same way in all ports, it's allocated here in order to allow the X11 port to map it to a block of shared memory.) If using an existing terminal, and the environment variable PDC_RESTORE_SCREEN is set, this function may also store the existing screen image for later restoration by PDC_scr_close(). pdcsetsc.c: ----------- ### int PDC_curs_set(int visibility); Called from curs_set(). Changes the appearance of the cursor -- 0 turns it off, 1 is normal (the terminal's default, if applicable, as determined by SP->orig_cursor), and 2 is high visibility. The exact appearance of these modes is not specified. pdcutil.c: ---------- ### void PDC_beep(void); Emits a short audible beep. If this is not possible on your platform, you must set SP->audible to FALSE during initialization (i.e., from PDC_scr_open() -- not here); otherwise, set it to TRUE. This function is called from beep(). ### void PDC_napms(int ms); This is the core delay routine, called by napms(). It pauses for about (the X/Open spec says "at least") ms milliseconds, then returns. High degrees of accuracy and precision are not expected (though desirable, if you can achieve them). More important is that this function gives back the process' time slice to the OS, so that PDCurses idles at low CPU usage. ### const char *PDC_sysname(void); Returns a short string describing the platform, such as "DOS" or "X11". This is used by longname(). It must be no more than 100 characters; it should be much, much shorter (existing platforms use no more than 5). More functions ============== The following functions are implemented in the platform directories, but are accessed directly by apps. Refer to the user documentation for their descriptions: pdcclip.c: ---------- ### int PDC_clearclipboard(void); ### int PDC_freeclipboard(char *contents); ### int PDC_getclipboard(char **contents, long *length); ### int PDC_setclipboard(const char *contents, long length); pdckbd.c: --------- ### unsigned long PDC_get_input_fd(void); pdcsetsc.c: ----------- ### int PDC_set_blink(bool blinkon); ### void PDC_set_title(const char *title); curses-1.4.4/vendor/PDCurses/curses.h0000644000004100000410000022765414201713275017540 0ustar www-datawww-data/* Public Domain Curses */ /*----------------------------------------------------------------------* * PDCurses * *----------------------------------------------------------------------*/ #ifndef __PDCURSES__ #define __PDCURSES__ 1 /*man-start************************************************************** PDCurses definitions list: (Only define those needed) XCURSES True if compiling for X11. PDC_RGB True if you want to use RGB color definitions (Red = 1, Green = 2, Blue = 4) instead of BGR. PDC_WIDE True if building wide-character support. PDC_DLL_BUILD True if building a Windows DLL. PDC_NCMOUSE Use the ncurses mouse API instead of PDCurses' traditional mouse API. PDCurses portable platform definitions list: PDC_BUILD Defines API build version. PDCURSES Enables access to PDCurses-only routines. XOPEN Always true. SYSVcurses True if you are compiling for SYSV portability. BSDcurses True if you are compiling for BSD portability. **man-end****************************************************************/ #define PDCURSES 1 /* PDCurses-only routines */ #define XOPEN 1 /* X/Open Curses routines */ #define SYSVcurses 1 /* System V Curses routines */ #define BSDcurses 1 /* BSD Curses routines */ #if defined( CHTYPE_32) #define CHTYPE_LONG 1 /* chtypes will be 32 bits */ #elif !defined( CHTYPE_16) #define CHTYPE_LONG 2 /* chtypes will be (default) 64 bits */ #endif /*----------------------------------------------------------------------*/ #ifdef NO_STDINT_H #define uint64_t unsigned long long #define uint32_t unsigned long #define uint16_t unsigned short #else #include #endif #include #include #include /* Required by X/Open usage below */ #ifdef PDC_WIDE # include #endif #if defined(__STDC_VERSION__) && __STDC_VERSION >= 199901L && \ !defined(__bool_true_false_are_defined) # include #endif #ifdef __cplusplus extern "C" { # define bool _bool #endif /*---------------------------------------------------------------------- * * Constants and Types * */ #undef FALSE #undef TRUE #ifdef __bool_true_false_are_defined # define FALSE false # define TRUE true #else typedef unsigned char bool; # define FALSE 0 # define TRUE 1 #endif #undef ERR #define ERR (-1) #undef OK #define OK 0 #ifdef CHTYPE_LONG #if(CHTYPE_LONG >= 2) /* "non-standard" 64-bit chtypes */ typedef uint64_t chtype; #else /* "Standard" CHTYPE_LONG case, 32-bit: */ typedef uint32_t chtype; # endif #else typedef uint16_t chtype; /* 8-bit attr + 8-bit char */ #endif #ifdef PDC_WIDE typedef chtype cchar_t; #endif typedef chtype attr_t; /* Version constants, available as of version 4.0 : */ /* Don't forget to update 'version.mif' if MAJOR/MINOR changes! */ #define PDC_VER_MAJOR 4 #define PDC_VER_MINOR 0 #define PDC_VER_CHANGE 4 #define PDC_VER_YEAR 2019 #define PDC_VER_MONTH 1 #define PDC_VER_DAY 20 #define PDC_BUILD (PDC_VER_MAJOR*1000 + PDC_VER_MINOR *100 + PDC_VER_CHANGE) /* When using PDCurses as a DLL (Windows) or shared library (BSD or *nix), it's possible to switch the DLL or shared library. One may therefore want to inquire of the DLL/shared library the port, version numbers, and chtype_size used, and make sure they're what one was expecting. The 'PDC_version' structure lets you do just that. */ enum PDC_port { PDC_PORT_X11 = 0, PDC_PORT_WIN32 = 1, PDC_PORT_WINGUI = 2, PDC_PORT_DOS = 3, PDC_PORT_OS2 = 4, PDC_PORT_SDL1 = 5, PDC_PORT_SDL2 = 6, PDC_PORT_VT = 7 }; /* Detailed PDC version information */ #define PDC_HAS_VERSION_INFO 1 typedef struct { const enum PDC_port port; const int ver_major; const int ver_minor; const int ver_change; const size_t chtype_size; const bool is_wide; const bool is_forced_utf8; } PDC_version_info; /*---------------------------------------------------------------------- * * Mouse Interface -- SYSVR4, with extensions * */ /* Most flavors of PDCurses support three buttons. WinGUI supports */ /* these plus two "extended" buttons. But we'll set this macro to */ /* six, allowing future versions to support up to nine total buttons. */ /* (The button states are broken up into two arrays to allow for the */ /* possibility of backward compatibility to DLLs compiled with only */ /* three mouse buttons.) */ #define PDC_MAX_MOUSE_BUTTONS 9 #define PDC_N_EXTENDED_MOUSE_BUTTONS 6 typedef struct { int x; /* absolute column, 0 based, measured in characters */ int y; /* absolute row, 0 based, measured in characters */ short button[3]; /* state of three "normal" buttons */ int changes; /* flags indicating what has changed with the mouse */ short xbutton[PDC_N_EXTENDED_MOUSE_BUTTONS]; /* state of ext buttons */ } MOUSE_STATUS; #define BUTTON_RELEASED 0x0000 #define BUTTON_PRESSED 0x0001 #define BUTTON_CLICKED 0x0002 #define BUTTON_DOUBLE_CLICKED 0x0003 #define BUTTON_TRIPLE_CLICKED 0x0004 #define BUTTON_MOVED 0x0005 /* PDCurses */ #define WHEEL_SCROLLED 0x0006 /* PDCurses */ #define BUTTON_ACTION_MASK 0x0007 /* PDCurses */ #define PDC_BUTTON_SHIFT 0x0008 /* PDCurses */ #define PDC_BUTTON_CONTROL 0x0010 /* PDCurses */ #define PDC_BUTTON_ALT 0x0020 /* PDCurses */ #define BUTTON_MODIFIER_MASK 0x0038 /* PDCurses */ #define MOUSE_X_POS (Mouse_status.x) #define MOUSE_Y_POS (Mouse_status.y) /* * Bits associated with the .changes field: * 3 2 1 0 * 210987654321098765432109876543210 * 1 <- button 1 has changed 0 * 10 <- button 2 has changed 1 * 100 <- button 3 has changed 2 * 1000 <- mouse has moved 3 * 10000 <- mouse position report 4 * 100000 <- mouse wheel up 5 * 1000000 <- mouse wheel down 6 * 10000000 <- mouse wheel left 7 * 100000000 <- mouse wheel right 8 * 1000000000 <- button 4 has changed 9 * (NOTE: buttons 6 to 10000000000 <- button 5 has changed 10 * 9 aren't implemented 100000000000 <- button 6 has changed 11 * in any flavor of 1000000000000 <- button 7 has changed 12 * PDCurses yet!) 10000000000000 <- button 8 has changed 13 * 100000000000000 <- button 9 has changed 14 */ #define PDC_MOUSE_MOVED 0x0008 #define PDC_MOUSE_POSITION 0x0010 #define PDC_MOUSE_WHEEL_UP 0x0020 #define PDC_MOUSE_WHEEL_DOWN 0x0040 #define PDC_MOUSE_WHEEL_LEFT 0x0080 #define PDC_MOUSE_WHEEL_RIGHT 0x0100 #define A_BUTTON_CHANGED (Mouse_status.changes & 7) #define MOUSE_MOVED (Mouse_status.changes & PDC_MOUSE_MOVED) #define MOUSE_POS_REPORT (Mouse_status.changes & PDC_MOUSE_POSITION) #define BUTTON_CHANGED(x) (Mouse_status.changes & (1 << ((x) - ((x)<4 ? 1 : -5)))) #define BUTTON_STATUS(x) (Mouse_status.button[(x) - 1]) #define MOUSE_WHEEL_UP (Mouse_status.changes & PDC_MOUSE_WHEEL_UP) #define MOUSE_WHEEL_DOWN (Mouse_status.changes & PDC_MOUSE_WHEEL_DOWN) #define MOUSE_WHEEL_LEFT (Mouse_status.changes & PDC_MOUSE_WHEEL_LEFT) #define MOUSE_WHEEL_RIGHT (Mouse_status.changes & PDC_MOUSE_WHEEL_RIGHT) /* mouse bit-masks */ #define BUTTON1_RELEASED 0x00000001L #define BUTTON1_PRESSED 0x00000002L #define BUTTON1_CLICKED 0x00000004L #define BUTTON1_DOUBLE_CLICKED 0x00000008L #define BUTTON1_TRIPLE_CLICKED 0x00000010L #define BUTTON1_MOVED 0x00000010L /* PDCurses */ #define BUTTON2_RELEASED 0x00000020L #define BUTTON2_PRESSED 0x00000040L #define BUTTON2_CLICKED 0x00000080L #define BUTTON2_DOUBLE_CLICKED 0x00000100L #define BUTTON2_TRIPLE_CLICKED 0x00000200L #define BUTTON2_MOVED 0x00000200L /* PDCurses */ #define BUTTON3_RELEASED 0x00000400L #define BUTTON3_PRESSED 0x00000800L #define BUTTON3_CLICKED 0x00001000L #define BUTTON3_DOUBLE_CLICKED 0x00002000L #define BUTTON3_TRIPLE_CLICKED 0x00004000L #define BUTTON3_MOVED 0x00004000L /* PDCurses */ /* For the ncurses-compatible functions only, BUTTON4_PRESSED and BUTTON5_PRESSED are returned for mouse scroll wheel up and down; otherwise PDCurses doesn't support buttons 4 and 5... except as described above for WinGUI, and perhaps to be extended to other PDCurses flavors */ #define BUTTON4_RELEASED 0x00008000L #define BUTTON4_PRESSED 0x00010000L #define BUTTON4_CLICKED 0x00020000L #define BUTTON4_DOUBLE_CLICKED 0x00040000L #define BUTTON4_TRIPLE_CLICKED 0x00080000L #define BUTTON5_RELEASED 0x00100000L #define BUTTON5_PRESSED 0x00200000L #define BUTTON5_CLICKED 0x00400000L #define BUTTON5_DOUBLE_CLICKED 0x00800000L #define BUTTON5_TRIPLE_CLICKED 0x01000000L #define MOUSE_WHEEL_SCROLL 0x02000000L /* PDCurses */ #define BUTTON_MODIFIER_SHIFT 0x04000000L /* PDCurses */ #define BUTTON_MODIFIER_CONTROL 0x08000000L /* PDCurses */ #define BUTTON_MODIFIER_ALT 0x10000000L /* PDCurses */ #define ALL_MOUSE_EVENTS 0x1fffffffL #define REPORT_MOUSE_POSITION 0x20000000L /* ncurses mouse interface */ typedef unsigned long mmask_t; typedef struct { short id; /* unused, always 0 */ int x, y, z; /* x, y same as MOUSE_STATUS; z unused */ mmask_t bstate; /* equivalent to changes + button[], but in the same format as used for mousemask() */ } MEVENT; #if defined(PDC_NCMOUSE) && !defined(NCURSES_MOUSE_VERSION) # define NCURSES_MOUSE_VERSION 2 #endif #ifdef NCURSES_MOUSE_VERSION # define BUTTON_SHIFT BUTTON_MODIFIER_SHIFT # define BUTTON_CONTROL BUTTON_MODIFIER_CONTROL # define BUTTON_CTRL BUTTON_MODIFIER_CONTROL # define BUTTON_ALT BUTTON_MODIFIER_ALT #else # define BUTTON_SHIFT PDC_BUTTON_SHIFT # define BUTTON_CONTROL PDC_BUTTON_CONTROL # define BUTTON_ALT PDC_BUTTON_ALT #endif /*---------------------------------------------------------------------- * * Window and Screen Structures * */ typedef struct _win /* definition of a window */ { int _cury; /* current pseudo-cursor */ int _curx; int _maxy; /* max window coordinates */ int _maxx; int _begy; /* origin on screen */ int _begx; int _flags; /* window properties */ chtype _attrs; /* standard attributes and colors */ chtype _bkgd; /* background, normally blank */ bool _clear; /* causes clear at next refresh */ bool _leaveit; /* leaves cursor where it is */ bool _scroll; /* allows window scrolling */ bool _nodelay; /* input character wait flag */ bool _immed; /* immediate update flag */ bool _sync; /* synchronise window ancestors */ bool _use_keypad; /* flags keypad key mode active */ chtype **_y; /* pointer to line pointer array */ int *_firstch; /* first changed character in line */ int *_lastch; /* last changed character in line */ int _tmarg; /* top of scrolling region */ int _bmarg; /* bottom of scrolling region */ int _delayms; /* milliseconds of delay for getch() */ int _parx, _pary; /* coords relative to parent (0,0) */ struct _win *_parent; /* subwin's pointer to parent win */ } WINDOW; /* Avoid using the SCREEN struct directly -- use the corresponding functions if possible. This struct may eventually be made private. */ typedef struct { bool alive; /* if initscr() called, and not endwin() */ bool autocr; /* if cr -> lf */ bool cbreak; /* if terminal unbuffered */ bool echo; /* if terminal echo */ bool raw_inp; /* raw input mode (v. cooked input) */ bool raw_out; /* raw output mode (7 v. 8 bits) */ bool audible; /* FALSE if the bell is visual */ bool mono; /* TRUE if current screen is mono */ bool resized; /* TRUE if TERM has been resized */ bool orig_attr; /* TRUE if we have the original colors */ short orig_fore; /* original screen foreground color */ short orig_back; /* original screen foreground color */ int cursrow; /* position of physical cursor */ int curscol; /* position of physical cursor */ int visibility; /* visibility of cursor */ int orig_cursor; /* original cursor size */ int lines; /* new value for LINES */ int cols; /* new value for COLS */ unsigned long _trap_mbe; /* trap these mouse button events */ unsigned long _map_mbe_to_key; /* map mouse buttons to slk */ int mouse_wait; /* time to wait (in ms) for a button release after a press, in order to count it as a click */ int slklines; /* lines in use by slk_init() */ WINDOW *slk_winptr; /* window for slk */ int linesrippedoff; /* lines ripped off via ripoffline() */ int linesrippedoffontop; /* lines ripped off on top via ripoffline() */ int delaytenths; /* 1/10ths second to wait block getch() for */ bool _preserve; /* TRUE if screen background to be preserved */ int _restore; /* specifies if screen background to be restored, and how */ bool save_key_modifiers; /* TRUE if each key modifiers saved with each key press */ bool return_key_modifiers; /* TRUE if modifier keys are returned as "real" keys */ bool key_code; /* TRUE if last key is a special key; used internally by get_wch() */ #ifdef XCURSES int XcurscrSize; /* size of Xcurscr shared memory block */ bool sb_on; int sb_viewport_y; int sb_viewport_x; int sb_total_y; int sb_total_x; int sb_cur_y; int sb_cur_x; int exit_key; #endif short line_color; /* color of line attributes - default -1 */ } SCREEN; /*---------------------------------------------------------------------- * * External Variables * */ #ifdef PDC_DLL_BUILD # ifdef CURSES_LIBRARY # define PDCEX __declspec(dllexport) extern # else # define PDCEX __declspec(dllimport) # endif #else # define PDCEX extern #endif PDCEX int LINES; /* terminal height */ PDCEX int COLS; /* terminal width */ PDCEX WINDOW *stdscr; /* the default screen window */ PDCEX WINDOW *curscr; /* the current screen image */ PDCEX SCREEN *SP; /* curses variables */ PDCEX MOUSE_STATUS Mouse_status; PDCEX int COLORS; PDCEX int COLOR_PAIRS; PDCEX int TABSIZE; PDCEX chtype acs_map[]; /* alternate character set map */ PDCEX char ttytype[]; /* terminal name/description */ PDCEX PDC_version_info PDC_version; /*man-start************************************************************** Text Attributes =============== Originally, PDCurses used a short (16 bits) for its chtype. To include color, a number of things had to be sacrificed from the strict Unix and System V support. The main problem was fitting all character attributes and color into an unsigned char (all 8 bits!). Today, PDCurses by default uses a long (32 bits) for its chtype, as in System V. The short chtype is still available, by undefining CHTYPE_LONG and rebuilding the library. The following is the structure of a win->_attrs chtype: short form: +-----------------------------------------------+ |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| +-----------------------------------------------+ color number | attrs | character eg 'a' The available non-color attributes are bold, reverse and blink. Others have no effect. The high order char is an index into an array of physical colors (defined in color.c) -- 32 foreground/background color pairs (5 bits) plus 3 bits for other attributes. long form: +--------------------------------------------------------------------+ |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|..| 2| 1| 0| +--------------------------------------------------------------------+ color number | modifiers | character eg 'a' The available non-color attributes are bold, underline, invisible, right-line, left-line, protect, reverse and blink. 256 color pairs (8 bits), 8 bits for other attributes, and 16 bits for character data. Note that there is now a "super-long" 64-bit form, available by defining CHTYPE_LONG to be 2: ------------------------------------------------------------------------------- |63|62|61|60|59|..|34|33|32|31|30|29|28|..|22|21|20|19|18|17|16|..| 3| 2| 1| 0| ------------------------------------------------------------------------------- color number | modifiers | character eg 'a' We take five more bits for the character (thus allowing Unicode values past 64K; UTF-16 can go up to 0x10ffff, requiring 21 bits total), and four more bits for attributes. Three are currently used as A_OVERLINE, A_DIM, and A_STRIKEOUT; one more is reserved for future use. 31 bits are then used for color. These are usually just treated as the usual palette indices, and range from 0 to 255. However, if bit 63 is set, the remaining 30 bits are interpreted as foreground RGB (first fifteen bits, five bits for each of the three channels) and background RGB (same scheme using the remaining 15 bits.) **man-end****************************************************************/ /*** Video attribute macros ***/ #define A_NORMAL (chtype)0 #ifdef CHTYPE_LONG # if(CHTYPE_LONG >= 2) /* 64-bit chtypes */ # define PDC_CHARTEXT_BITS 21 # define A_CHARTEXT (chtype)( ((chtype)0x1 << PDC_CHARTEXT_BITS) - 1) # define A_ALTCHARSET ((chtype)0x001 << PDC_CHARTEXT_BITS) # define A_RIGHTLINE ((chtype)0x002 << PDC_CHARTEXT_BITS) # define A_LEFTLINE ((chtype)0x004 << PDC_CHARTEXT_BITS) # define A_INVIS ((chtype)0x008 << PDC_CHARTEXT_BITS) # define A_UNDERLINE ((chtype)0x010 << PDC_CHARTEXT_BITS) # define A_REVERSE ((chtype)0x020 << PDC_CHARTEXT_BITS) # define A_BLINK ((chtype)0x040 << PDC_CHARTEXT_BITS) # define A_BOLD ((chtype)0x080 << PDC_CHARTEXT_BITS) # define A_OVERLINE ((chtype)0x100 << PDC_CHARTEXT_BITS) # define A_STRIKEOUT ((chtype)0x200 << PDC_CHARTEXT_BITS) # define A_DIM ((chtype)0x400 << PDC_CHARTEXT_BITS) #if 0 /* May come up with a use for this bit */ /* someday; reserved for the future: */ # define A_FUTURE_2 ((chtype)0x800 << PDC_CHARTEXT_BITS) #endif # define PDC_COLOR_SHIFT (PDC_CHARTEXT_BITS + 12) # define A_COLOR ((chtype)0x7fffffff << PDC_COLOR_SHIFT) # define A_RGB_COLOR ((chtype)0x40000000 << PDC_COLOR_SHIFT) # define A_ATTRIBUTES (((chtype)0xfff << PDC_CHARTEXT_BITS) | A_COLOR) # define A_RGB( rfore, gfore, bfore, rback, gback, bback) \ (( (((chtype)(bfore) << 25) \ | ((chtype)(gfore) << 20) \ | ((chtype)(rfore) << 15) \ | ((chtype)(bback) << 10) \ | ((chtype)(gback) << 5) \ | ((chtype)(rback) )) << PDC_COLOR_SHIFT) | A_RGB_COLOR) # else /* plain ol' 32-bit chtypes */ # define A_ALTCHARSET (chtype)0x00010000 # define A_RIGHTLINE (chtype)0x00020000 # define A_LEFTLINE (chtype)0x00040000 # define A_INVIS (chtype)0x00080000 # define A_UNDERLINE (chtype)0x00100000 # define A_REVERSE (chtype)0x00200000 # define A_BLINK (chtype)0x00400000 # define A_BOLD (chtype)0x00800000 # define A_COLOR (chtype)0xff000000 # define A_RGB_COLOR A_NORMAL #ifdef PDC_WIDE # define A_CHARTEXT (chtype)0x0000ffff # define A_ATTRIBUTES (chtype)0xffff0000 # define A_DIM A_NORMAL # define A_OVERLINE A_NORMAL # define A_STRIKEOUT A_NORMAL #else /* with 8-bit chars, we have bits for these attribs : */ # define A_CHARTEXT (chtype)0x000000ff # define A_ATTRIBUTES (chtype)0xffffe000 # define A_DIM (chtype)0x00008000 # define A_OVERLINE (chtype)0x00004000 # define A_STRIKEOUT (chtype)0x00002000 #endif # define PDC_COLOR_SHIFT 24 #endif # define A_ITALIC A_INVIS # define A_PROTECT (A_UNDERLINE | A_LEFTLINE | A_RIGHTLINE) #else /* 16-bit chtypes */ # define A_BOLD (chtype)0x0100 /* X/Open */ # define A_REVERSE (chtype)0x0200 /* X/Open */ # define A_BLINK (chtype)0x0400 /* X/Open */ # define A_ATTRIBUTES (chtype)0xff00 /* X/Open */ # define A_CHARTEXT (chtype)0x00ff /* X/Open */ # define A_COLOR (chtype)0xf800 /* System V */ # define A_ALTCHARSET A_NORMAL /* X/Open */ # define A_PROTECT A_NORMAL /* X/Open */ # define A_UNDERLINE A_NORMAL /* X/Open */ # define A_OVERLINE A_NORMAL /* X/Open */ # define A_STRIKEOUT A_NORMAL /* X/Open */ # define A_LEFTLINE A_NORMAL # define A_RIGHTLINE A_NORMAL # define A_ITALIC A_NORMAL # define A_INVIS A_NORMAL # define A_RGB_COLOR A_NORMAL # define A_DIM A_NORMAL # define PDC_COLOR_SHIFT 11 #endif #define A_STANDOUT (A_REVERSE | A_BOLD) /* X/Open */ #define CHR_MSK A_CHARTEXT /* Obsolete */ #define ATR_MSK A_ATTRIBUTES /* Obsolete */ #define ATR_NRM A_NORMAL /* Obsolete */ /* For use with attr_t -- X/Open says, "these shall be distinct", so this is a non-conforming implementation. */ #define WA_NORMAL A_NORMAL #define WA_ALTCHARSET A_ALTCHARSET #define WA_BLINK A_BLINK #define WA_BOLD A_BOLD #define WA_DIM A_DIM #define WA_INVIS A_INVIS #define WA_LEFT A_LEFTLINE #define WA_PROTECT A_PROTECT #define WA_REVERSE A_REVERSE #define WA_RIGHT A_RIGHTLINE #define WA_STANDOUT A_STANDOUT #define WA_UNDERLINE A_UNDERLINE #define WA_HORIZONTAL A_NORMAL #define WA_LOW A_NORMAL #define WA_TOP A_NORMAL #define WA_VERTICAL A_NORMAL #define WA_ATTRIBUTES A_ATTRIBUTES /*** Alternate character set macros ***/ /* 'w' = 32-bit chtype; acs_map[] index | A_ALTCHARSET 'n' = 16-bit chtype; it gets the fallback set because no bit is available for A_ALTCHARSET */ #ifdef CHTYPE_LONG # define PDC_ACS(w, n) ((chtype)w | A_ALTCHARSET) #else # define PDC_ACS(w, n) ((chtype)n) #endif /* VT100-compatible symbols -- box chars */ #define ACS_LRCORNER PDC_ACS('V', '+') #define ACS_URCORNER PDC_ACS('W', '+') #define ACS_ULCORNER PDC_ACS('X', '+') #define ACS_LLCORNER PDC_ACS('Y', '+') #define ACS_PLUS PDC_ACS('Z', '+') #define ACS_LTEE PDC_ACS('[', '+') #define ACS_RTEE PDC_ACS('\\', '+') #define ACS_BTEE PDC_ACS(']', '+') #define ACS_TTEE PDC_ACS('^', '+') #define ACS_HLINE PDC_ACS('_', '-') #define ACS_VLINE PDC_ACS('`', '|') /* PDCurses-only ACS chars. Don't use if ncurses compatibility matters. Some won't work in non-wide X11 builds (see 'acs_defs.h' for details). */ #define ACS_CENT PDC_ACS('{', 'c') #define ACS_YEN PDC_ACS('|', 'y') #define ACS_PESETA PDC_ACS('}', 'p') #define ACS_HALF PDC_ACS('&', '/') #define ACS_QUARTER PDC_ACS('\'', '/') #define ACS_LEFT_ANG_QU PDC_ACS(')', '<') #define ACS_RIGHT_ANG_QU PDC_ACS('*', '>') #define ACS_D_HLINE PDC_ACS('a', '-') #define ACS_D_VLINE PDC_ACS('b', '|') #define ACS_CLUB PDC_ACS( 11, 'C') #define ACS_HEART PDC_ACS( 12, 'H') #define ACS_SPADE PDC_ACS( 13, 'S') #define ACS_SMILE PDC_ACS( 14, 'O') #define ACS_REV_SMILE PDC_ACS( 15, 'O') #define ACS_MED_BULLET PDC_ACS( 16, '.') #define ACS_WHITE_BULLET PDC_ACS( 17, 'O') #define ACS_PILCROW PDC_ACS( 18, 'O') #define ACS_SECTION PDC_ACS( 19, 'O') #define ACS_SUP2 PDC_ACS(',', '2') #define ACS_ALPHA PDC_ACS('.', 'a') #define ACS_BETA PDC_ACS('/', 'b') #define ACS_GAMMA PDC_ACS('0', 'y') #define ACS_UP_SIGMA PDC_ACS('1', 'S') #define ACS_LO_SIGMA PDC_ACS('2', 's') #define ACS_MU PDC_ACS('4', 'u') #define ACS_TAU PDC_ACS('5', 't') #define ACS_UP_PHI PDC_ACS('6', 'F') #define ACS_THETA PDC_ACS('7', 't') #define ACS_OMEGA PDC_ACS('8', 'w') #define ACS_DELTA PDC_ACS('9', 'd') #define ACS_INFINITY PDC_ACS('-', 'i') #define ACS_LO_PHI PDC_ACS( 22, 'f') #define ACS_EPSILON PDC_ACS(':', 'e') #define ACS_INTERSECT PDC_ACS('e', 'u') #define ACS_TRIPLE_BAR PDC_ACS('f', '=') #define ACS_DIVISION PDC_ACS('c', '/') #define ACS_APPROX_EQ PDC_ACS('d', '~') #define ACS_SM_BULLET PDC_ACS('g', '.') #define ACS_SQUARE_ROOT PDC_ACS('i', '!') #define ACS_UBLOCK PDC_ACS('p', '^') #define ACS_BBLOCK PDC_ACS('q', '_') #define ACS_LBLOCK PDC_ACS('r', '<') #define ACS_RBLOCK PDC_ACS('s', '>') #define ACS_A_ORDINAL PDC_ACS(20, 'a') #define ACS_O_ORDINAL PDC_ACS(21, 'o') #define ACS_INV_QUERY PDC_ACS(24, '?') #define ACS_REV_NOT PDC_ACS(25, '!') #define ACS_NOT PDC_ACS(26, '!') #define ACS_INV_BANG PDC_ACS(23, '!') #define ACS_UP_INTEGRAL PDC_ACS(27, '|') #define ACS_LO_INTEGRAL PDC_ACS(28, '|') #define ACS_SUP_N PDC_ACS(29, 'n') #define ACS_CENTER_SQU PDC_ACS(30, 'x') #define ACS_F_WITH_HOOK PDC_ACS(31, 'f') #define ACS_SD_LRCORNER PDC_ACS(';', '+') #define ACS_SD_URCORNER PDC_ACS('<', '+') #define ACS_SD_ULCORNER PDC_ACS('=', '+') #define ACS_SD_LLCORNER PDC_ACS('>', '+') #define ACS_SD_PLUS PDC_ACS('?', '+') #define ACS_SD_LTEE PDC_ACS('@', '+') #define ACS_SD_RTEE PDC_ACS('A', '+') #define ACS_SD_BTEE PDC_ACS('B', '+') #define ACS_SD_TTEE PDC_ACS('C', '+') #define ACS_D_LRCORNER PDC_ACS('D', '+') #define ACS_D_URCORNER PDC_ACS('E', '+') #define ACS_D_ULCORNER PDC_ACS('F', '+') #define ACS_D_LLCORNER PDC_ACS('G', '+') #define ACS_D_PLUS PDC_ACS('H', '+') #define ACS_D_LTEE PDC_ACS('I', '+') #define ACS_D_RTEE PDC_ACS('J', '+') #define ACS_D_BTEE PDC_ACS('K', '+') #define ACS_D_TTEE PDC_ACS('L', '+') #define ACS_DS_LRCORNER PDC_ACS('M', '+') #define ACS_DS_URCORNER PDC_ACS('N', '+') #define ACS_DS_ULCORNER PDC_ACS('O', '+') #define ACS_DS_LLCORNER PDC_ACS('P', '+') #define ACS_DS_PLUS PDC_ACS('Q', '+') #define ACS_DS_LTEE PDC_ACS('R', '+') #define ACS_DS_RTEE PDC_ACS('S', '+') #define ACS_DS_BTEE PDC_ACS('T', '+') #define ACS_DS_TTEE PDC_ACS('U', '+') /* VT100-compatible symbols -- other */ #define ACS_S1 PDC_ACS('l', '-') #define ACS_S9 PDC_ACS('o', '_') #define ACS_DIAMOND PDC_ACS('j', '+') #define ACS_CKBOARD PDC_ACS('k', ':') #define ACS_DEGREE PDC_ACS('w', '\'') #define ACS_PLMINUS PDC_ACS('x', '#') #define ACS_BULLET PDC_ACS('h', 'o') /* Teletype 5410v1 symbols -- these are defined in SysV curses, but are not well-supported by most terminals. Stick to VT100 characters for optimum portability. */ #define ACS_LARROW PDC_ACS('!', '<') #define ACS_RARROW PDC_ACS(' ', '>') #define ACS_DARROW PDC_ACS('#', 'v') #define ACS_UARROW PDC_ACS('"', '^') #define ACS_BOARD PDC_ACS('+', '#') #define ACS_LTBOARD PDC_ACS('y', '#') #define ACS_LANTERN PDC_ACS('z', '*') #define ACS_BLOCK PDC_ACS('t', '#') /* That goes double for these -- undocumented SysV symbols. Don't use them. */ #define ACS_S3 PDC_ACS('m', '-') #define ACS_S7 PDC_ACS('n', '-') #define ACS_LEQUAL PDC_ACS('u', '<') #define ACS_GEQUAL PDC_ACS('v', '>') #define ACS_PI PDC_ACS('$', 'n') #define ACS_NEQUAL PDC_ACS('%', '+') #define ACS_STERLING PDC_ACS('~', 'L') /* Box char aliases */ #define ACS_BSSB ACS_ULCORNER #define ACS_SSBB ACS_LLCORNER #define ACS_BBSS ACS_URCORNER #define ACS_SBBS ACS_LRCORNER #define ACS_SBSS ACS_RTEE #define ACS_SSSB ACS_LTEE #define ACS_SSBS ACS_BTEE #define ACS_BSSS ACS_TTEE #define ACS_BSBS ACS_HLINE #define ACS_SBSB ACS_VLINE #define ACS_SSSS ACS_PLUS /* cchar_t aliases */ #ifdef PDC_WIDE # define WACS_LRCORNER (&(acs_map['V'])) # define WACS_URCORNER (&(acs_map['W'])) # define WACS_ULCORNER (&(acs_map['X'])) # define WACS_LLCORNER (&(acs_map['Y'])) # define WACS_PLUS (&(acs_map['Z'])) # define WACS_LTEE (&(acs_map['['])) # define WACS_RTEE (&(acs_map['\\'])) # define WACS_BTEE (&(acs_map[']'])) # define WACS_TTEE (&(acs_map['^'])) # define WACS_HLINE (&(acs_map['_'])) # define WACS_VLINE (&(acs_map['`'])) # define WACS_CENT (&(acs_map['{'])) # define WACS_YEN (&(acs_map['|'])) # define WACS_PESETA (&(acs_map['}'])) # define WACS_HALF (&(acs_map['&'])) # define WACS_QUARTER (&(acs_map['\''])) # define WACS_LEFT_ANG_QU (&(acs_map[')'])) # define WACS_RIGHT_ANG_QU (&(acs_map['*'])) # define WACS_D_HLINE (&(acs_map['a'])) # define WACS_D_VLINE (&(acs_map['b'])) # define WACS_CLUB (&(acs_map[ 11])) # define WACS_HEART (&(acs_map[ 12])) # define WACS_SPADE (&(acs_map[ 13])) # define WACS_SMILE (&(acs_map[ 14])) # define WACS_REV_SMILE (&(acs_map[ 15])) # define WACS_MED_BULLET (&(acs_map[ 16])) # define WACS_WHITE_BULLET (&(acs_map[ 17])) # define WACS_PILCROW (&(acs_map[ 18])) # define WACS_SECTION (&(acs_map[ 19])) # define WACS_SUP2 (&(acs_map[','])) # define WACS_ALPHA (&(acs_map['.'])) # define WACS_BETA (&(acs_map['/'])) # define WACS_GAMMA (&(acs_map['0'])) # define WACS_UP_SIGMA (&(acs_map['1'])) # define WACS_LO_SIGMA (&(acs_map['2'])) # define WACS_MU (&(acs_map['4'])) # define WACS_TAU (&(acs_map['5'])) # define WACS_UP_PHI (&(acs_map['6'])) # define WACS_THETA (&(acs_map['7'])) # define WACS_OMEGA (&(acs_map['8'])) # define WACS_DELTA (&(acs_map['9'])) # define WACS_INFINITY (&(acs_map['-'])) # define WACS_LO_PHI (&(acs_map[ 22])) # define WACS_EPSILON (&(acs_map[':'])) # define WACS_INTERSECT (&(acs_map['e'])) # define WACS_TRIPLE_BAR (&(acs_map['f'])) # define WACS_DIVISION (&(acs_map['c'])) # define WACS_APPROX_EQ (&(acs_map['d'])) # define WACS_SM_BULLET (&(acs_map['g'])) # define WACS_SQUARE_ROOT (&(acs_map['i'])) # define WACS_UBLOCK (&(acs_map['p'])) # define WACS_BBLOCK (&(acs_map['q'])) # define WACS_LBLOCK (&(acs_map['r'])) # define WACS_RBLOCK (&(acs_map['s'])) # define WACS_A_ORDINAL (&(acs_map[20])) # define WACS_O_ORDINAL (&(acs_map[21])) # define WACS_INV_QUERY (&(acs_map[24])) # define WACS_REV_NOT (&(acs_map[25])) # define WACS_NOT (&(acs_map[26])) # define WACS_INV_BANG (&(acs_map[23])) # define WACS_UP_INTEGRAL (&(acs_map[27])) # define WACS_LO_INTEGRAL (&(acs_map[28])) # define WACS_SUP_N (&(acs_map[29])) # define WACS_CENTER_SQU (&(acs_map[30])) # define WACS_F_WITH_HOOK (&(acs_map[31])) # define WACS_SD_LRCORNER (&(acs_map[';'])) # define WACS_SD_URCORNER (&(acs_map['<'])) # define WACS_SD_ULCORNER (&(acs_map['='])) # define WACS_SD_LLCORNER (&(acs_map['>'])) # define WACS_SD_PLUS (&(acs_map['?'])) # define WACS_SD_LTEE (&(acs_map['@'])) # define WACS_SD_RTEE (&(acs_map['A'])) # define WACS_SD_BTEE (&(acs_map['B'])) # define WACS_SD_TTEE (&(acs_map['C'])) # define WACS_D_LRCORNER (&(acs_map['D'])) # define WACS_D_URCORNER (&(acs_map['E'])) # define WACS_D_ULCORNER (&(acs_map['F'])) # define WACS_D_LLCORNER (&(acs_map['G'])) # define WACS_D_PLUS (&(acs_map['H'])) # define WACS_D_LTEE (&(acs_map['I'])) # define WACS_D_RTEE (&(acs_map['J'])) # define WACS_D_BTEE (&(acs_map['K'])) # define WACS_D_TTEE (&(acs_map['L'])) # define WACS_DS_LRCORNER (&(acs_map['M'])) # define WACS_DS_URCORNER (&(acs_map['N'])) # define WACS_DS_ULCORNER (&(acs_map['O'])) # define WACS_DS_LLCORNER (&(acs_map['P'])) # define WACS_DS_PLUS (&(acs_map['Q'])) # define WACS_DS_LTEE (&(acs_map['R'])) # define WACS_DS_RTEE (&(acs_map['S'])) # define WACS_DS_BTEE (&(acs_map['T'])) # define WACS_DS_TTEE (&(acs_map['U'])) # define WACS_S1 (&(acs_map['l'])) # define WACS_S9 (&(acs_map['o'])) # define WACS_DIAMOND (&(acs_map['j'])) # define WACS_CKBOARD (&(acs_map['k'])) # define WACS_DEGREE (&(acs_map['w'])) # define WACS_PLMINUS (&(acs_map['x'])) # define WACS_BULLET (&(acs_map['h'])) # define WACS_LARROW (&(acs_map['!'])) # define WACS_RARROW (&(acs_map[' '])) # define WACS_DARROW (&(acs_map['#'])) # define WACS_UARROW (&(acs_map['"'])) # define WACS_BOARD (&(acs_map['+'])) # define WACS_LTBOARD (&(acs_map['y'])) # define WACS_LANTERN (&(acs_map['z'])) # define WACS_BLOCK (&(acs_map['t'])) # define WACS_S3 (&(acs_map['m'])) # define WACS_S7 (&(acs_map['n'])) # define WACS_LEQUAL (&(acs_map['u'])) # define WACS_GEQUAL (&(acs_map['v'])) # define WACS_PI (&(acs_map['$'])) # define WACS_NEQUAL (&(acs_map['%'])) # define WACS_STERLING (&(acs_map['~'])) # define WACS_BSSB WACS_ULCORNER # define WACS_SSBB WACS_LLCORNER # define WACS_BBSS WACS_URCORNER # define WACS_SBBS WACS_LRCORNER # define WACS_SBSS WACS_RTEE # define WACS_SSSB WACS_LTEE # define WACS_SSBS WACS_BTEE # define WACS_BSSS WACS_TTEE # define WACS_BSBS WACS_HLINE # define WACS_SBSB WACS_VLINE # define WACS_SSSS WACS_PLUS #endif /*** Color macros ***/ #define COLOR_BLACK 0 #ifdef PDC_RGB /* RGB */ # define COLOR_RED 1 # define COLOR_GREEN 2 # define COLOR_BLUE 4 #else /* BGR */ # define COLOR_BLUE 1 # define COLOR_GREEN 2 # define COLOR_RED 4 #endif #define COLOR_CYAN (COLOR_BLUE | COLOR_GREEN) #define COLOR_MAGENTA (COLOR_RED | COLOR_BLUE) #define COLOR_YELLOW (COLOR_RED | COLOR_GREEN) #define COLOR_WHITE 7 /*---------------------------------------------------------------------- * * Function and Keypad Key Definitions * Many are just for compatibility * */ #ifdef PDC_WIDE #define KEY_OFFSET 0xec00 #else #define KEY_OFFSET 0x100 #endif #define KEY_CODE_YES (KEY_OFFSET + 0x00) /* If get_wch() gives a key code */ #define KEY_BREAK (KEY_OFFSET + 0x01) /* Not on PC KBD */ #define KEY_DOWN (KEY_OFFSET + 0x02) /* Down arrow key */ #define KEY_UP (KEY_OFFSET + 0x03) /* Up arrow key */ #define KEY_LEFT (KEY_OFFSET + 0x04) /* Left arrow key */ #define KEY_RIGHT (KEY_OFFSET + 0x05) /* Right arrow key */ #define KEY_HOME (KEY_OFFSET + 0x06) /* home key */ #define KEY_BACKSPACE (KEY_OFFSET + 0x07) /* not on pc */ #define KEY_F0 (KEY_OFFSET + 0x08) /* function keys; 64 reserved */ #define KEY_DL (KEY_OFFSET + 0x48) /* delete line */ #define KEY_IL (KEY_OFFSET + 0x49) /* insert line */ #define KEY_DC (KEY_OFFSET + 0x4a) /* delete character */ #define KEY_IC (KEY_OFFSET + 0x4b) /* insert char or enter ins mode */ #define KEY_EIC (KEY_OFFSET + 0x4c) /* exit insert char mode */ #define KEY_CLEAR (KEY_OFFSET + 0x4d) /* clear screen */ #define KEY_EOS (KEY_OFFSET + 0x4e) /* clear to end of screen */ #define KEY_EOL (KEY_OFFSET + 0x4f) /* clear to end of line */ #define KEY_SF (KEY_OFFSET + 0x50) /* scroll 1 line forward */ #define KEY_SR (KEY_OFFSET + 0x51) /* scroll 1 line back (reverse) */ #define KEY_NPAGE (KEY_OFFSET + 0x52) /* next page */ #define KEY_PPAGE (KEY_OFFSET + 0x53) /* previous page */ #define KEY_STAB (KEY_OFFSET + 0x54) /* set tab */ #define KEY_CTAB (KEY_OFFSET + 0x55) /* clear tab */ #define KEY_CATAB (KEY_OFFSET + 0x56) /* clear all tabs */ #define KEY_ENTER (KEY_OFFSET + 0x57) /* enter or send (unreliable) */ #define KEY_SRESET (KEY_OFFSET + 0x58) /* soft/reset (partial/unreliable) */ #define KEY_RESET (KEY_OFFSET + 0x59) /* reset/hard reset (unreliable) */ #define KEY_PRINT (KEY_OFFSET + 0x5a) /* print/copy */ #define KEY_LL (KEY_OFFSET + 0x5b) /* home down/bottom (lower left) */ #define KEY_ABORT (KEY_OFFSET + 0x5c) /* abort/terminate key (any) */ #define KEY_SHELP (KEY_OFFSET + 0x5d) /* short help */ #define KEY_LHELP (KEY_OFFSET + 0x5e) /* long help */ #define KEY_BTAB (KEY_OFFSET + 0x5f) /* Back tab key */ #define KEY_BEG (KEY_OFFSET + 0x60) /* beg(inning) key */ #define KEY_CANCEL (KEY_OFFSET + 0x61) /* cancel key */ #define KEY_CLOSE (KEY_OFFSET + 0x62) /* close key */ #define KEY_COMMAND (KEY_OFFSET + 0x63) /* cmd (command) key */ #define KEY_COPY (KEY_OFFSET + 0x64) /* copy key */ #define KEY_CREATE (KEY_OFFSET + 0x65) /* create key */ #define KEY_END (KEY_OFFSET + 0x66) /* end key */ #define KEY_EXIT (KEY_OFFSET + 0x67) /* exit key */ #define KEY_FIND (KEY_OFFSET + 0x68) /* find key */ #define KEY_HELP (KEY_OFFSET + 0x69) /* help key */ #define KEY_MARK (KEY_OFFSET + 0x6a) /* mark key */ #define KEY_MESSAGE (KEY_OFFSET + 0x6b) /* message key */ #define KEY_MOVE (KEY_OFFSET + 0x6c) /* move key */ #define KEY_NEXT (KEY_OFFSET + 0x6d) /* next object key */ #define KEY_OPEN (KEY_OFFSET + 0x6e) /* open key */ #define KEY_OPTIONS (KEY_OFFSET + 0x6f) /* options key */ #define KEY_PREVIOUS (KEY_OFFSET + 0x70) /* previous object key */ #define KEY_REDO (KEY_OFFSET + 0x71) /* redo key */ #define KEY_REFERENCE (KEY_OFFSET + 0x72) /* ref(erence) key */ #define KEY_REFRESH (KEY_OFFSET + 0x73) /* refresh key */ #define KEY_REPLACE (KEY_OFFSET + 0x74) /* replace key */ #define KEY_RESTART (KEY_OFFSET + 0x75) /* restart key */ #define KEY_RESUME (KEY_OFFSET + 0x76) /* resume key */ #define KEY_SAVE (KEY_OFFSET + 0x77) /* save key */ #define KEY_SBEG (KEY_OFFSET + 0x78) /* shifted beginning key */ #define KEY_SCANCEL (KEY_OFFSET + 0x79) /* shifted cancel key */ #define KEY_SCOMMAND (KEY_OFFSET + 0x7a) /* shifted command key */ #define KEY_SCOPY (KEY_OFFSET + 0x7b) /* shifted copy key */ #define KEY_SCREATE (KEY_OFFSET + 0x7c) /* shifted create key */ #define KEY_SDC (KEY_OFFSET + 0x7d) /* shifted delete char key */ #define KEY_SDL (KEY_OFFSET + 0x7e) /* shifted delete line key */ #define KEY_SELECT (KEY_OFFSET + 0x7f) /* select key */ #define KEY_SEND (KEY_OFFSET + 0x80) /* shifted end key */ #define KEY_SEOL (KEY_OFFSET + 0x81) /* shifted clear line key */ #define KEY_SEXIT (KEY_OFFSET + 0x82) /* shifted exit key */ #define KEY_SFIND (KEY_OFFSET + 0x83) /* shifted find key */ #define KEY_SHOME (KEY_OFFSET + 0x84) /* shifted home key */ #define KEY_SIC (KEY_OFFSET + 0x85) /* shifted input key */ #define KEY_SLEFT (KEY_OFFSET + 0x87) /* shifted left arrow key */ #define KEY_SMESSAGE (KEY_OFFSET + 0x88) /* shifted message key */ #define KEY_SMOVE (KEY_OFFSET + 0x89) /* shifted move key */ #define KEY_SNEXT (KEY_OFFSET + 0x8a) /* shifted next key */ #define KEY_SOPTIONS (KEY_OFFSET + 0x8b) /* shifted options key */ #define KEY_SPREVIOUS (KEY_OFFSET + 0x8c) /* shifted prev key */ #define KEY_SPRINT (KEY_OFFSET + 0x8d) /* shifted print key */ #define KEY_SREDO (KEY_OFFSET + 0x8e) /* shifted redo key */ #define KEY_SREPLACE (KEY_OFFSET + 0x8f) /* shifted replace key */ #define KEY_SRIGHT (KEY_OFFSET + 0x90) /* shifted right arrow */ #define KEY_SRSUME (KEY_OFFSET + 0x91) /* shifted resume key */ #define KEY_SSAVE (KEY_OFFSET + 0x92) /* shifted save key */ #define KEY_SSUSPEND (KEY_OFFSET + 0x93) /* shifted suspend key */ #define KEY_SUNDO (KEY_OFFSET + 0x94) /* shifted undo key */ #define KEY_SUSPEND (KEY_OFFSET + 0x95) /* suspend key */ #define KEY_UNDO (KEY_OFFSET + 0x96) /* undo key */ /* PDCurses-specific key definitions -- PC only */ #define ALT_0 (KEY_OFFSET + 0x97) #define ALT_1 (KEY_OFFSET + 0x98) #define ALT_2 (KEY_OFFSET + 0x99) #define ALT_3 (KEY_OFFSET + 0x9a) #define ALT_4 (KEY_OFFSET + 0x9b) #define ALT_5 (KEY_OFFSET + 0x9c) #define ALT_6 (KEY_OFFSET + 0x9d) #define ALT_7 (KEY_OFFSET + 0x9e) #define ALT_8 (KEY_OFFSET + 0x9f) #define ALT_9 (KEY_OFFSET + 0xa0) #define ALT_A (KEY_OFFSET + 0xa1) #define ALT_B (KEY_OFFSET + 0xa2) #define ALT_C (KEY_OFFSET + 0xa3) #define ALT_D (KEY_OFFSET + 0xa4) #define ALT_E (KEY_OFFSET + 0xa5) #define ALT_F (KEY_OFFSET + 0xa6) #define ALT_G (KEY_OFFSET + 0xa7) #define ALT_H (KEY_OFFSET + 0xa8) #define ALT_I (KEY_OFFSET + 0xa9) #define ALT_J (KEY_OFFSET + 0xaa) #define ALT_K (KEY_OFFSET + 0xab) #define ALT_L (KEY_OFFSET + 0xac) #define ALT_M (KEY_OFFSET + 0xad) #define ALT_N (KEY_OFFSET + 0xae) #define ALT_O (KEY_OFFSET + 0xaf) #define ALT_P (KEY_OFFSET + 0xb0) #define ALT_Q (KEY_OFFSET + 0xb1) #define ALT_R (KEY_OFFSET + 0xb2) #define ALT_S (KEY_OFFSET + 0xb3) #define ALT_T (KEY_OFFSET + 0xb4) #define ALT_U (KEY_OFFSET + 0xb5) #define ALT_V (KEY_OFFSET + 0xb6) #define ALT_W (KEY_OFFSET + 0xb7) #define ALT_X (KEY_OFFSET + 0xb8) #define ALT_Y (KEY_OFFSET + 0xb9) #define ALT_Z (KEY_OFFSET + 0xba) #define CTL_LEFT (KEY_OFFSET + 0xbb) /* Control-Left-Arrow */ #define CTL_RIGHT (KEY_OFFSET + 0xbc) #define CTL_PGUP (KEY_OFFSET + 0xbd) #define CTL_PGDN (KEY_OFFSET + 0xbe) #define CTL_HOME (KEY_OFFSET + 0xbf) #define CTL_END (KEY_OFFSET + 0xc0) #define KEY_A1 (KEY_OFFSET + 0xc1) /* upper left on Virtual keypad */ #define KEY_A2 (KEY_OFFSET + 0xc2) /* upper middle on Virt. keypad */ #define KEY_A3 (KEY_OFFSET + 0xc3) /* upper right on Vir. keypad */ #define KEY_B1 (KEY_OFFSET + 0xc4) /* middle left on Virt. keypad */ #define KEY_B2 (KEY_OFFSET + 0xc5) /* center on Virt. keypad */ #define KEY_B3 (KEY_OFFSET + 0xc6) /* middle right on Vir. keypad */ #define KEY_C1 (KEY_OFFSET + 0xc7) /* lower left on Virt. keypad */ #define KEY_C2 (KEY_OFFSET + 0xc8) /* lower middle on Virt. keypad */ #define KEY_C3 (KEY_OFFSET + 0xc9) /* lower right on Vir. keypad */ #define PADSLASH (KEY_OFFSET + 0xca) /* slash on keypad */ #define PADENTER (KEY_OFFSET + 0xcb) /* enter on keypad */ #define CTL_PADENTER (KEY_OFFSET + 0xcc) /* ctl-enter on keypad */ #define ALT_PADENTER (KEY_OFFSET + 0xcd) /* alt-enter on keypad */ #define PADSTOP (KEY_OFFSET + 0xce) /* stop on keypad */ #define PADSTAR (KEY_OFFSET + 0xcf) /* star on keypad */ #define PADMINUS (KEY_OFFSET + 0xd0) /* minus on keypad */ #define PADPLUS (KEY_OFFSET + 0xd1) /* plus on keypad */ #define CTL_PADSTOP (KEY_OFFSET + 0xd2) /* ctl-stop on keypad */ #define CTL_PADCENTER (KEY_OFFSET + 0xd3) /* ctl-enter on keypad */ #define CTL_PADPLUS (KEY_OFFSET + 0xd4) /* ctl-plus on keypad */ #define CTL_PADMINUS (KEY_OFFSET + 0xd5) /* ctl-minus on keypad */ #define CTL_PADSLASH (KEY_OFFSET + 0xd6) /* ctl-slash on keypad */ #define CTL_PADSTAR (KEY_OFFSET + 0xd7) /* ctl-star on keypad */ #define ALT_PADPLUS (KEY_OFFSET + 0xd8) /* alt-plus on keypad */ #define ALT_PADMINUS (KEY_OFFSET + 0xd9) /* alt-minus on keypad */ #define ALT_PADSLASH (KEY_OFFSET + 0xda) /* alt-slash on keypad */ #define ALT_PADSTAR (KEY_OFFSET + 0xdb) /* alt-star on keypad */ #define ALT_PADSTOP (KEY_OFFSET + 0xdc) /* alt-stop on keypad */ #define CTL_INS (KEY_OFFSET + 0xdd) /* ctl-insert */ #define ALT_DEL (KEY_OFFSET + 0xde) /* alt-delete */ #define ALT_INS (KEY_OFFSET + 0xdf) /* alt-insert */ #define CTL_UP (KEY_OFFSET + 0xe0) /* ctl-up arrow */ #define CTL_DOWN (KEY_OFFSET + 0xe1) /* ctl-down arrow */ #define CTL_TAB (KEY_OFFSET + 0xe2) /* ctl-tab */ #define ALT_TAB (KEY_OFFSET + 0xe3) #define ALT_MINUS (KEY_OFFSET + 0xe4) #define ALT_EQUAL (KEY_OFFSET + 0xe5) #define ALT_HOME (KEY_OFFSET + 0xe6) #define ALT_PGUP (KEY_OFFSET + 0xe7) #define ALT_PGDN (KEY_OFFSET + 0xe8) #define ALT_END (KEY_OFFSET + 0xe9) #define ALT_UP (KEY_OFFSET + 0xea) /* alt-up arrow */ #define ALT_DOWN (KEY_OFFSET + 0xeb) /* alt-down arrow */ #define ALT_RIGHT (KEY_OFFSET + 0xec) /* alt-right arrow */ #define ALT_LEFT (KEY_OFFSET + 0xed) /* alt-left arrow */ #define ALT_ENTER (KEY_OFFSET + 0xee) /* alt-enter */ #define ALT_ESC (KEY_OFFSET + 0xef) /* alt-escape */ #define ALT_BQUOTE (KEY_OFFSET + 0xf0) /* alt-back quote */ #define ALT_LBRACKET (KEY_OFFSET + 0xf1) /* alt-left bracket */ #define ALT_RBRACKET (KEY_OFFSET + 0xf2) /* alt-right bracket */ #define ALT_SEMICOLON (KEY_OFFSET + 0xf3) /* alt-semi-colon */ #define ALT_FQUOTE (KEY_OFFSET + 0xf4) /* alt-forward quote */ #define ALT_COMMA (KEY_OFFSET + 0xf5) /* alt-comma */ #define ALT_STOP (KEY_OFFSET + 0xf6) /* alt-stop */ #define ALT_FSLASH (KEY_OFFSET + 0xf7) /* alt-forward slash */ #define ALT_BKSP (KEY_OFFSET + 0xf8) /* alt-backspace */ #define CTL_BKSP (KEY_OFFSET + 0xf9) /* ctl-backspace */ #define PAD0 (KEY_OFFSET + 0xfa) /* keypad 0 */ #define CTL_PAD0 (KEY_OFFSET + 0xfb) /* ctl-keypad 0 */ #define CTL_PAD1 (KEY_OFFSET + 0xfc) #define CTL_PAD2 (KEY_OFFSET + 0xfd) #define CTL_PAD3 (KEY_OFFSET + 0xfe) #define CTL_PAD4 (KEY_OFFSET + 0xff) #define CTL_PAD5 (KEY_OFFSET + 0x100) #define CTL_PAD6 (KEY_OFFSET + 0x101) #define CTL_PAD7 (KEY_OFFSET + 0x102) #define CTL_PAD8 (KEY_OFFSET + 0x103) #define CTL_PAD9 (KEY_OFFSET + 0x104) #define ALT_PAD0 (KEY_OFFSET + 0x105) /* alt-keypad 0 */ #define ALT_PAD1 (KEY_OFFSET + 0x106) #define ALT_PAD2 (KEY_OFFSET + 0x107) #define ALT_PAD3 (KEY_OFFSET + 0x108) #define ALT_PAD4 (KEY_OFFSET + 0x109) #define ALT_PAD5 (KEY_OFFSET + 0x10a) #define ALT_PAD6 (KEY_OFFSET + 0x10b) #define ALT_PAD7 (KEY_OFFSET + 0x10c) #define ALT_PAD8 (KEY_OFFSET + 0x10d) #define ALT_PAD9 (KEY_OFFSET + 0x10e) #define CTL_DEL (KEY_OFFSET + 0x10f) /* clt-delete */ #define ALT_BSLASH (KEY_OFFSET + 0x110) /* alt-back slash */ #define CTL_ENTER (KEY_OFFSET + 0x111) /* ctl-enter */ #define SHF_PADENTER (KEY_OFFSET + 0x112) /* shift-enter on keypad */ #define SHF_PADSLASH (KEY_OFFSET + 0x113) /* shift-slash on keypad */ #define SHF_PADSTAR (KEY_OFFSET + 0x114) /* shift-star on keypad */ #define SHF_PADPLUS (KEY_OFFSET + 0x115) /* shift-plus on keypad */ #define SHF_PADMINUS (KEY_OFFSET + 0x116) /* shift-minus on keypad */ #define SHF_UP (KEY_OFFSET + 0x117) /* shift-up on keypad */ #define SHF_DOWN (KEY_OFFSET + 0x118) /* shift-down on keypad */ #define SHF_IC (KEY_OFFSET + 0x119) /* shift-insert on keypad */ #define SHF_DC (KEY_OFFSET + 0x11a) /* shift-delete on keypad */ #define KEY_MOUSE (KEY_OFFSET + 0x11b) /* "mouse" key */ #define KEY_SHIFT_L (KEY_OFFSET + 0x11c) /* Left-shift */ #define KEY_SHIFT_R (KEY_OFFSET + 0x11d) /* Right-shift */ #define KEY_CONTROL_L (KEY_OFFSET + 0x11e) /* Left-control */ #define KEY_CONTROL_R (KEY_OFFSET + 0x11f) /* Right-control */ #define KEY_ALT_L (KEY_OFFSET + 0x120) /* Left-alt */ #define KEY_ALT_R (KEY_OFFSET + 0x121) /* Right-alt */ #define KEY_RESIZE (KEY_OFFSET + 0x122) /* Window resize */ #define KEY_SUP (KEY_OFFSET + 0x123) /* Shifted up arrow */ #define KEY_SDOWN (KEY_OFFSET + 0x124) /* Shifted down arrow */ /* The following were added 2011 Sep 14, and are */ /* not returned by most flavors of PDCurses: */ #define CTL_SEMICOLON (KEY_OFFSET + 0x125) #define CTL_EQUAL (KEY_OFFSET + 0x126) #define CTL_COMMA (KEY_OFFSET + 0x127) #define CTL_MINUS (KEY_OFFSET + 0x128) #define CTL_STOP (KEY_OFFSET + 0x129) #define CTL_FSLASH (KEY_OFFSET + 0x12a) #define CTL_BQUOTE (KEY_OFFSET + 0x12b) #define KEY_APPS (KEY_OFFSET + 0x12c) #define KEY_SAPPS (KEY_OFFSET + 0x12d) #define CTL_APPS (KEY_OFFSET + 0x12e) #define ALT_APPS (KEY_OFFSET + 0x12f) #define KEY_PAUSE (KEY_OFFSET + 0x130) #define KEY_SPAUSE (KEY_OFFSET + 0x131) #define CTL_PAUSE (KEY_OFFSET + 0x132) #define KEY_PRINTSCREEN (KEY_OFFSET + 0x133) #define ALT_PRINTSCREEN (KEY_OFFSET + 0x134) #define KEY_SCROLLLOCK (KEY_OFFSET + 0x135) #define ALT_SCROLLLOCK (KEY_OFFSET + 0x136) #define CTL_0 (KEY_OFFSET + 0x137) #define CTL_1 (KEY_OFFSET + 0x138) #define CTL_2 (KEY_OFFSET + 0x139) #define CTL_3 (KEY_OFFSET + 0x13a) #define CTL_4 (KEY_OFFSET + 0x13b) #define CTL_5 (KEY_OFFSET + 0x13c) #define CTL_6 (KEY_OFFSET + 0x13d) #define CTL_7 (KEY_OFFSET + 0x13e) #define CTL_8 (KEY_OFFSET + 0x13f) #define CTL_9 (KEY_OFFSET + 0x140) #define KEY_BROWSER_BACK (KEY_OFFSET + 0x141) #define KEY_SBROWSER_BACK (KEY_OFFSET + 0x142) #define KEY_CBROWSER_BACK (KEY_OFFSET + 0x143) #define KEY_ABROWSER_BACK (KEY_OFFSET + 0x144) #define KEY_BROWSER_FWD (KEY_OFFSET + 0x145) #define KEY_SBROWSER_FWD (KEY_OFFSET + 0x146) #define KEY_CBROWSER_FWD (KEY_OFFSET + 0x147) #define KEY_ABROWSER_FWD (KEY_OFFSET + 0x148) #define KEY_BROWSER_REF (KEY_OFFSET + 0x149) #define KEY_SBROWSER_REF (KEY_OFFSET + 0x14A) #define KEY_CBROWSER_REF (KEY_OFFSET + 0x14B) #define KEY_ABROWSER_REF (KEY_OFFSET + 0x14C) #define KEY_BROWSER_STOP (KEY_OFFSET + 0x14D) #define KEY_SBROWSER_STOP (KEY_OFFSET + 0x14E) #define KEY_CBROWSER_STOP (KEY_OFFSET + 0x14F) #define KEY_ABROWSER_STOP (KEY_OFFSET + 0x150) #define KEY_SEARCH (KEY_OFFSET + 0x151) #define KEY_SSEARCH (KEY_OFFSET + 0x152) #define KEY_CSEARCH (KEY_OFFSET + 0x153) #define KEY_ASEARCH (KEY_OFFSET + 0x154) #define KEY_FAVORITES (KEY_OFFSET + 0x155) #define KEY_SFAVORITES (KEY_OFFSET + 0x156) #define KEY_CFAVORITES (KEY_OFFSET + 0x157) #define KEY_AFAVORITES (KEY_OFFSET + 0x158) #define KEY_BROWSER_HOME (KEY_OFFSET + 0x159) #define KEY_SBROWSER_HOME (KEY_OFFSET + 0x15A) #define KEY_CBROWSER_HOME (KEY_OFFSET + 0x15B) #define KEY_ABROWSER_HOME (KEY_OFFSET + 0x15C) #define KEY_VOLUME_MUTE (KEY_OFFSET + 0x15D) #define KEY_SVOLUME_MUTE (KEY_OFFSET + 0x15E) #define KEY_CVOLUME_MUTE (KEY_OFFSET + 0x15F) #define KEY_AVOLUME_MUTE (KEY_OFFSET + 0x160) #define KEY_VOLUME_DOWN (KEY_OFFSET + 0x161) #define KEY_SVOLUME_DOWN (KEY_OFFSET + 0x162) #define KEY_CVOLUME_DOWN (KEY_OFFSET + 0x163) #define KEY_AVOLUME_DOWN (KEY_OFFSET + 0x164) #define KEY_VOLUME_UP (KEY_OFFSET + 0x165) #define KEY_SVOLUME_UP (KEY_OFFSET + 0x166) #define KEY_CVOLUME_UP (KEY_OFFSET + 0x167) #define KEY_AVOLUME_UP (KEY_OFFSET + 0x168) #define KEY_NEXT_TRACK (KEY_OFFSET + 0x169) #define KEY_SNEXT_TRACK (KEY_OFFSET + 0x16A) #define KEY_CNEXT_TRACK (KEY_OFFSET + 0x16B) #define KEY_ANEXT_TRACK (KEY_OFFSET + 0x16C) #define KEY_PREV_TRACK (KEY_OFFSET + 0x16D) #define KEY_SPREV_TRACK (KEY_OFFSET + 0x16E) #define KEY_CPREV_TRACK (KEY_OFFSET + 0x16F) #define KEY_APREV_TRACK (KEY_OFFSET + 0x170) #define KEY_MEDIA_STOP (KEY_OFFSET + 0x171) #define KEY_SMEDIA_STOP (KEY_OFFSET + 0x172) #define KEY_CMEDIA_STOP (KEY_OFFSET + 0x173) #define KEY_AMEDIA_STOP (KEY_OFFSET + 0x174) #define KEY_PLAY_PAUSE (KEY_OFFSET + 0x175) #define KEY_SPLAY_PAUSE (KEY_OFFSET + 0x176) #define KEY_CPLAY_PAUSE (KEY_OFFSET + 0x177) #define KEY_APLAY_PAUSE (KEY_OFFSET + 0x178) #define KEY_LAUNCH_MAIL (KEY_OFFSET + 0x179) #define KEY_SLAUNCH_MAIL (KEY_OFFSET + 0x17A) #define KEY_CLAUNCH_MAIL (KEY_OFFSET + 0x17B) #define KEY_ALAUNCH_MAIL (KEY_OFFSET + 0x17C) #define KEY_MEDIA_SELECT (KEY_OFFSET + 0x17D) #define KEY_SMEDIA_SELECT (KEY_OFFSET + 0x17E) #define KEY_CMEDIA_SELECT (KEY_OFFSET + 0x17F) #define KEY_AMEDIA_SELECT (KEY_OFFSET + 0x180) #define KEY_LAUNCH_APP1 (KEY_OFFSET + 0x181) #define KEY_SLAUNCH_APP1 (KEY_OFFSET + 0x182) #define KEY_CLAUNCH_APP1 (KEY_OFFSET + 0x183) #define KEY_ALAUNCH_APP1 (KEY_OFFSET + 0x184) #define KEY_LAUNCH_APP2 (KEY_OFFSET + 0x185) #define KEY_SLAUNCH_APP2 (KEY_OFFSET + 0x186) #define KEY_CLAUNCH_APP2 (KEY_OFFSET + 0x187) #define KEY_ALAUNCH_APP2 (KEY_OFFSET + 0x188) #define KEY_MIN KEY_BREAK /* Minimum curses key value */ #define KEY_MAX KEY_ALAUNCH_APP2 /* Maximum curses key */ #define KEY_F(n) (KEY_F0 + (n)) /*---------------------------------------------------------------------- * * PDCurses Function Declarations * */ /* Standard */ PDCEX int addch(const chtype); PDCEX int addchnstr(const chtype *, int); PDCEX int addchstr(const chtype *); PDCEX int addnstr(const char *, int); PDCEX int addstr(const char *); PDCEX int attroff(chtype); PDCEX int attron(chtype); PDCEX int attrset(chtype); PDCEX int attr_get(attr_t *, short *, void *); PDCEX int attr_off(attr_t, void *); PDCEX int attr_on(attr_t, void *); PDCEX int attr_set(attr_t, short, void *); PDCEX int baudrate(void); PDCEX int beep(void); PDCEX int bkgd(chtype); PDCEX void bkgdset(chtype); PDCEX int border(chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype); PDCEX int box(WINDOW *, chtype, chtype); PDCEX bool can_change_color(void); PDCEX int cbreak(void); PDCEX int chgat(int, attr_t, short, const void *); PDCEX int clearok(WINDOW *, bool); PDCEX int clear(void); PDCEX int clrtobot(void); PDCEX int clrtoeol(void); PDCEX int color_content(short, short *, short *, short *); PDCEX int color_set(short, void *); PDCEX int copywin(const WINDOW *, WINDOW *, int, int, int, int, int, int, int); PDCEX int curs_set(int); PDCEX int def_prog_mode(void); PDCEX int def_shell_mode(void); PDCEX int delay_output(int); PDCEX int delch(void); PDCEX int deleteln(void); PDCEX void delscreen(SCREEN *); PDCEX int delwin(WINDOW *); PDCEX WINDOW *derwin(WINDOW *, int, int, int, int); PDCEX int doupdate(void); PDCEX WINDOW *dupwin(WINDOW *); PDCEX int echochar(const chtype); PDCEX int echo(void); PDCEX int endwin(void); PDCEX char erasechar(void); PDCEX int erase(void); PDCEX void filter(void); PDCEX int flash(void); PDCEX int flushinp(void); PDCEX chtype getbkgd(WINDOW *); PDCEX int getnstr(char *, int); PDCEX int getstr(char *); PDCEX WINDOW *getwin(FILE *); PDCEX int halfdelay(int); PDCEX bool has_colors(void); PDCEX bool has_ic(void); PDCEX bool has_il(void); PDCEX int hline(chtype, int); PDCEX void idcok(WINDOW *, bool); PDCEX int idlok(WINDOW *, bool); PDCEX void immedok(WINDOW *, bool); PDCEX int inchnstr(chtype *, int); PDCEX int inchstr(chtype *); PDCEX chtype inch(void); PDCEX int init_color(short, short, short, short); PDCEX int init_pair(short, short, short); PDCEX WINDOW *initscr(void); PDCEX int innstr(char *, int); PDCEX int insch(chtype); PDCEX int insdelln(int); PDCEX int insertln(void); PDCEX int insnstr(const char *, int); PDCEX int insstr(const char *); PDCEX int instr(char *); PDCEX int intrflush(WINDOW *, bool); PDCEX bool isendwin(void); PDCEX bool is_linetouched(WINDOW *, int); PDCEX bool is_wintouched(WINDOW *); PDCEX char *keyname(int); PDCEX int keypad(WINDOW *, bool); PDCEX char killchar(void); PDCEX int leaveok(WINDOW *, bool); PDCEX char *longname(void); PDCEX int meta(WINDOW *, bool); PDCEX int move(int, int); PDCEX int mvaddch(int, int, const chtype); PDCEX int mvaddchnstr(int, int, const chtype *, int); PDCEX int mvaddchstr(int, int, const chtype *); PDCEX int mvaddnstr(int, int, const char *, int); PDCEX int mvaddstr(int, int, const char *); PDCEX int mvchgat(int, int, int, attr_t, short, const void *); PDCEX int mvcur(int, int, int, int); PDCEX int mvdelch(int, int); PDCEX int mvderwin(WINDOW *, int, int); PDCEX int mvgetch(int, int); PDCEX int mvgetnstr(int, int, char *, int); PDCEX int mvgetstr(int, int, char *); PDCEX int mvhline(int, int, chtype, int); PDCEX chtype mvinch(int, int); PDCEX int mvinchnstr(int, int, chtype *, int); PDCEX int mvinchstr(int, int, chtype *); PDCEX int mvinnstr(int, int, char *, int); PDCEX int mvinsch(int, int, chtype); PDCEX int mvinsnstr(int, int, const char *, int); PDCEX int mvinsstr(int, int, const char *); PDCEX int mvinstr(int, int, char *); PDCEX int mvprintw(int, int, const char *, ...); PDCEX int mvscanw(int, int, const char *, ...); PDCEX int mvvline(int, int, chtype, int); PDCEX int mvwaddchnstr(WINDOW *, int, int, const chtype *, int); PDCEX int mvwaddchstr(WINDOW *, int, int, const chtype *); PDCEX int mvwaddch(WINDOW *, int, int, const chtype); PDCEX int mvwaddnstr(WINDOW *, int, int, const char *, int); PDCEX int mvwaddstr(WINDOW *, int, int, const char *); PDCEX int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *); PDCEX int mvwdelch(WINDOW *, int, int); PDCEX int mvwgetch(WINDOW *, int, int); PDCEX int mvwgetnstr(WINDOW *, int, int, char *, int); PDCEX int mvwgetstr(WINDOW *, int, int, char *); PDCEX int mvwhline(WINDOW *, int, int, chtype, int); PDCEX int mvwinchnstr(WINDOW *, int, int, chtype *, int); PDCEX int mvwinchstr(WINDOW *, int, int, chtype *); PDCEX chtype mvwinch(WINDOW *, int, int); PDCEX int mvwinnstr(WINDOW *, int, int, char *, int); PDCEX int mvwinsch(WINDOW *, int, int, chtype); PDCEX int mvwinsnstr(WINDOW *, int, int, const char *, int); PDCEX int mvwinsstr(WINDOW *, int, int, const char *); PDCEX int mvwinstr(WINDOW *, int, int, char *); PDCEX int mvwin(WINDOW *, int, int); PDCEX int mvwprintw(WINDOW *, int, int, const char *, ...); PDCEX int mvwscanw(WINDOW *, int, int, const char *, ...); PDCEX int mvwvline(WINDOW *, int, int, chtype, int); PDCEX int napms(int); PDCEX WINDOW *newpad(int, int); PDCEX SCREEN *newterm(const char *, FILE *, FILE *); PDCEX WINDOW *newwin(int, int, int, int); PDCEX int nl(void); PDCEX int nocbreak(void); PDCEX int nodelay(WINDOW *, bool); PDCEX int noecho(void); PDCEX int nonl(void); PDCEX void noqiflush(void); PDCEX int noraw(void); PDCEX int notimeout(WINDOW *, bool); PDCEX int overlay(const WINDOW *, WINDOW *); PDCEX int overwrite(const WINDOW *, WINDOW *); PDCEX int pair_content(short, short *, short *); PDCEX int pechochar(WINDOW *, chtype); PDCEX int pnoutrefresh(WINDOW *, int, int, int, int, int, int); PDCEX int prefresh(WINDOW *, int, int, int, int, int, int); PDCEX int printw(const char *, ...); PDCEX int putwin(WINDOW *, FILE *); PDCEX void qiflush(void); PDCEX int raw(void); PDCEX int redrawwin(WINDOW *); PDCEX int refresh(void); PDCEX int reset_prog_mode(void); PDCEX int reset_shell_mode(void); PDCEX int resetty(void); PDCEX int ripoffline(int, int (*)(WINDOW *, int)); PDCEX int savetty(void); PDCEX int scanw(const char *, ...); PDCEX int scr_dump(const char *); PDCEX int scr_init(const char *); PDCEX int scr_restore(const char *); PDCEX int scr_set(const char *); PDCEX int scrl(int); PDCEX int scroll(WINDOW *); PDCEX int scrollok(WINDOW *, bool); PDCEX SCREEN *set_term(SCREEN *); PDCEX int setscrreg(int, int); PDCEX int slk_attroff(const chtype); PDCEX int slk_attr_off(const attr_t, void *); PDCEX int slk_attron(const chtype); PDCEX int slk_attr_on(const attr_t, void *); PDCEX int slk_attrset(const chtype); PDCEX int slk_attr_set(const attr_t, short, void *); PDCEX int slk_clear(void); PDCEX int slk_color(short); PDCEX int slk_init(int); PDCEX char *slk_label(int); PDCEX int slk_noutrefresh(void); PDCEX int slk_refresh(void); PDCEX int slk_restore(void); PDCEX int slk_set(int, const char *, int); PDCEX int slk_touch(void); PDCEX int standend(void); PDCEX int standout(void); PDCEX int start_color(void); PDCEX WINDOW *subpad(WINDOW *, int, int, int, int); PDCEX WINDOW *subwin(WINDOW *, int, int, int, int); PDCEX int syncok(WINDOW *, bool); PDCEX chtype termattrs(void); PDCEX attr_t term_attrs(void); PDCEX char *termname(void); PDCEX void timeout(int); PDCEX int touchline(WINDOW *, int, int); PDCEX int touchwin(WINDOW *); PDCEX int typeahead(int); PDCEX int untouchwin(WINDOW *); PDCEX void use_env(bool); PDCEX int vidattr(chtype); PDCEX int vid_attr(attr_t, short, void *); PDCEX int vidputs(chtype, int (*)(int)); PDCEX int vid_puts(attr_t, short, void *, int (*)(int)); PDCEX int vline(chtype, int); PDCEX int vw_printw(WINDOW *, const char *, va_list); PDCEX int vwprintw(WINDOW *, const char *, va_list); PDCEX int vw_scanw(WINDOW *, const char *, va_list); PDCEX int vwscanw(WINDOW *, const char *, va_list); PDCEX int waddchnstr(WINDOW *, const chtype *, int); PDCEX int waddchstr(WINDOW *, const chtype *); PDCEX int waddch(WINDOW *, const chtype); PDCEX int waddnstr(WINDOW *, const char *, int); PDCEX int waddstr(WINDOW *, const char *); PDCEX int wattroff(WINDOW *, chtype); PDCEX int wattron(WINDOW *, chtype); PDCEX int wattrset(WINDOW *, chtype); PDCEX int wattr_get(WINDOW *, attr_t *, short *, void *); PDCEX int wattr_off(WINDOW *, attr_t, void *); PDCEX int wattr_on(WINDOW *, attr_t, void *); PDCEX int wattr_set(WINDOW *, attr_t, short, void *); PDCEX void wbkgdset(WINDOW *, chtype); PDCEX int wbkgd(WINDOW *, chtype); PDCEX int wborder(WINDOW *, chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype); PDCEX int wchgat(WINDOW *, int, attr_t, short, const void *); PDCEX int wclear(WINDOW *); PDCEX int wclrtobot(WINDOW *); PDCEX int wclrtoeol(WINDOW *); PDCEX int wcolor_set(WINDOW *, short, void *); PDCEX void wcursyncup(WINDOW *); PDCEX int wdelch(WINDOW *); PDCEX int wdeleteln(WINDOW *); PDCEX int wechochar(WINDOW *, const chtype); PDCEX int werase(WINDOW *); PDCEX int wgetch(WINDOW *); PDCEX int wgetnstr(WINDOW *, char *, int); PDCEX int wgetstr(WINDOW *, char *); PDCEX int whline(WINDOW *, chtype, int); PDCEX int winchnstr(WINDOW *, chtype *, int); PDCEX int winchstr(WINDOW *, chtype *); PDCEX chtype winch(WINDOW *); PDCEX int winnstr(WINDOW *, char *, int); PDCEX int winsch(WINDOW *, chtype); PDCEX int winsdelln(WINDOW *, int); PDCEX int winsertln(WINDOW *); PDCEX int winsnstr(WINDOW *, const char *, int); PDCEX int winsstr(WINDOW *, const char *); PDCEX int winstr(WINDOW *, char *); PDCEX int wmove(WINDOW *, int, int); PDCEX int wnoutrefresh(WINDOW *); PDCEX int wprintw(WINDOW *, const char *, ...); PDCEX int wredrawln(WINDOW *, int, int); PDCEX int wrefresh(WINDOW *); PDCEX int wscanw(WINDOW *, const char *, ...); PDCEX int wscrl(WINDOW *, int); PDCEX int wsetscrreg(WINDOW *, int, int); PDCEX int wstandend(WINDOW *); PDCEX int wstandout(WINDOW *); PDCEX void wsyncdown(WINDOW *); PDCEX void wsyncup(WINDOW *); PDCEX void wtimeout(WINDOW *, int); PDCEX int wtouchln(WINDOW *, int, int, int); PDCEX int wvline(WINDOW *, chtype, int); /* Wide-character functions */ #ifdef PDC_WIDE PDCEX int addnwstr(const wchar_t *, int); PDCEX int addwstr(const wchar_t *); PDCEX int add_wch(const cchar_t *); PDCEX int add_wchnstr(const cchar_t *, int); PDCEX int add_wchstr(const cchar_t *); PDCEX int border_set(const cchar_t *, const cchar_t *, const cchar_t *, const cchar_t *, const cchar_t *, const cchar_t *, const cchar_t *, const cchar_t *); PDCEX int box_set(WINDOW *, const cchar_t *, const cchar_t *); PDCEX int echo_wchar(const cchar_t *); PDCEX int erasewchar(wchar_t *); PDCEX int getbkgrnd(cchar_t *); PDCEX int getcchar(const cchar_t *, wchar_t *, attr_t *, short *, void *); PDCEX int getn_wstr(wint_t *, int); PDCEX int get_wch(wint_t *); PDCEX int get_wstr(wint_t *); PDCEX int hline_set(const cchar_t *, int); PDCEX int innwstr(wchar_t *, int); PDCEX int ins_nwstr(const wchar_t *, int); PDCEX int ins_wch(const cchar_t *); PDCEX int ins_wstr(const wchar_t *); PDCEX int inwstr(wchar_t *); PDCEX int in_wch(cchar_t *); PDCEX int in_wchnstr(cchar_t *, int); PDCEX int in_wchstr(cchar_t *); PDCEX char *key_name(wchar_t); PDCEX int killwchar(wchar_t *); PDCEX int mvaddnwstr(int, int, const wchar_t *, int); PDCEX int mvaddwstr(int, int, const wchar_t *); PDCEX int mvadd_wch(int, int, const cchar_t *); PDCEX int mvadd_wchnstr(int, int, const cchar_t *, int); PDCEX int mvadd_wchstr(int, int, const cchar_t *); PDCEX int mvgetn_wstr(int, int, wint_t *, int); PDCEX int mvget_wch(int, int, wint_t *); PDCEX int mvget_wstr(int, int, wint_t *); PDCEX int mvhline_set(int, int, const cchar_t *, int); PDCEX int mvinnwstr(int, int, wchar_t *, int); PDCEX int mvins_nwstr(int, int, const wchar_t *, int); PDCEX int mvins_wch(int, int, const cchar_t *); PDCEX int mvins_wstr(int, int, const wchar_t *); PDCEX int mvinwstr(int, int, wchar_t *); PDCEX int mvin_wch(int, int, cchar_t *); PDCEX int mvin_wchnstr(int, int, cchar_t *, int); PDCEX int mvin_wchstr(int, int, cchar_t *); PDCEX int mvvline_set(int, int, const cchar_t *, int); PDCEX int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int); PDCEX int mvwaddwstr(WINDOW *, int, int, const wchar_t *); PDCEX int mvwadd_wch(WINDOW *, int, int, const cchar_t *); PDCEX int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int); PDCEX int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *); PDCEX int mvwgetn_wstr(WINDOW *, int, int, wint_t *, int); PDCEX int mvwget_wch(WINDOW *, int, int, wint_t *); PDCEX int mvwget_wstr(WINDOW *, int, int, wint_t *); PDCEX int mvwhline_set(WINDOW *, int, int, const cchar_t *, int); PDCEX int mvwinnwstr(WINDOW *, int, int, wchar_t *, int); PDCEX int mvwins_nwstr(WINDOW *, int, int, const wchar_t *, int); PDCEX int mvwins_wch(WINDOW *, int, int, const cchar_t *); PDCEX int mvwins_wstr(WINDOW *, int, int, const wchar_t *); PDCEX int mvwin_wch(WINDOW *, int, int, cchar_t *); PDCEX int mvwin_wchnstr(WINDOW *, int, int, cchar_t *, int); PDCEX int mvwin_wchstr(WINDOW *, int, int, cchar_t *); PDCEX int mvwinwstr(WINDOW *, int, int, wchar_t *); PDCEX int mvwvline_set(WINDOW *, int, int, const cchar_t *, int); PDCEX int pecho_wchar(WINDOW *, const cchar_t*); PDCEX int setcchar(cchar_t*, const wchar_t*, const attr_t, short, const void*); PDCEX int slk_wset(int, const wchar_t *, int); PDCEX int unget_wch(const wchar_t); PDCEX int vline_set(const cchar_t *, int); PDCEX int waddnwstr(WINDOW *, const wchar_t *, int); PDCEX int waddwstr(WINDOW *, const wchar_t *); PDCEX int wadd_wch(WINDOW *, const cchar_t *); PDCEX int wadd_wchnstr(WINDOW *, const cchar_t *, int); PDCEX int wadd_wchstr(WINDOW *, const cchar_t *); PDCEX int wbkgrnd(WINDOW *, const cchar_t *); PDCEX void wbkgrndset(WINDOW *, const cchar_t *); PDCEX int wborder_set(WINDOW *, const cchar_t *, const cchar_t *, const cchar_t *, const cchar_t *, const cchar_t *, const cchar_t *, const cchar_t *, const cchar_t *); PDCEX int wecho_wchar(WINDOW *, const cchar_t *); PDCEX int wgetbkgrnd(WINDOW *, cchar_t *); PDCEX int wgetn_wstr(WINDOW *, wint_t *, int); PDCEX int wget_wch(WINDOW *, wint_t *); PDCEX int wget_wstr(WINDOW *, wint_t *); PDCEX int whline_set(WINDOW *, const cchar_t *, int); PDCEX int winnwstr(WINDOW *, wchar_t *, int); PDCEX int wins_nwstr(WINDOW *, const wchar_t *, int); PDCEX int wins_wch(WINDOW *, const cchar_t *); PDCEX int wins_wstr(WINDOW *, const wchar_t *); PDCEX int winwstr(WINDOW *, wchar_t *); PDCEX int win_wch(WINDOW *, cchar_t *); PDCEX int win_wchnstr(WINDOW *, cchar_t *, int); PDCEX int win_wchstr(WINDOW *, cchar_t *); PDCEX wchar_t *wunctrl(cchar_t *); PDCEX int wvline_set(WINDOW *, const cchar_t *, int); #endif /* Quasi-standard */ PDCEX chtype getattrs(WINDOW *); PDCEX int getbegx(WINDOW *); PDCEX int getbegy(WINDOW *); PDCEX int getmaxx(WINDOW *); PDCEX int getmaxy(WINDOW *); PDCEX int getparx(WINDOW *); PDCEX int getpary(WINDOW *); PDCEX int getcurx(WINDOW *); PDCEX int getcury(WINDOW *); PDCEX void traceoff(void); PDCEX void traceon(void); PDCEX char *unctrl(chtype); PDCEX int crmode(void); PDCEX int nocrmode(void); PDCEX int draino(int); PDCEX int resetterm(void); PDCEX int fixterm(void); PDCEX int saveterm(void); PDCEX void setsyx(int, int); PDCEX int mouse_set(unsigned long); PDCEX int mouse_on(unsigned long); PDCEX int mouse_off(unsigned long); PDCEX int request_mouse_pos(void); PDCEX int map_button(unsigned long); PDCEX void wmouse_position(WINDOW *, int *, int *); PDCEX unsigned long getmouse(void); PDCEX unsigned long getbmap(void); /* ncurses */ PDCEX int assume_default_colors(int, int); PDCEX const char *curses_version(void); PDCEX bool has_key(int); PDCEX int use_default_colors(void); PDCEX int wresize(WINDOW *, int, int); PDCEX int mouseinterval(int); PDCEX mmask_t mousemask(mmask_t, mmask_t *); PDCEX bool mouse_trafo(int *, int *, bool); PDCEX int nc_getmouse(MEVENT *); PDCEX int ungetmouse(MEVENT *); PDCEX bool wenclose(const WINDOW *, int, int); PDCEX bool wmouse_trafo(const WINDOW *, int *, int *, bool); /* PDCurses */ PDCEX int addrawch(chtype); PDCEX int insrawch(chtype); PDCEX bool is_termresized(void); PDCEX int mvaddrawch(int, int, chtype); PDCEX int mvdeleteln(int, int); PDCEX int mvinsertln(int, int); PDCEX int mvinsrawch(int, int, chtype); PDCEX int mvwaddrawch(WINDOW *, int, int, chtype); PDCEX int mvwdeleteln(WINDOW *, int, int); PDCEX int mvwinsertln(WINDOW *, int, int); PDCEX int mvwinsrawch(WINDOW *, int, int, chtype); PDCEX int raw_output(bool); PDCEX int resize_term(int, int); PDCEX WINDOW *resize_window(WINDOW *, int, int); PDCEX int waddrawch(WINDOW *, chtype); PDCEX int winsrawch(WINDOW *, chtype); PDCEX char wordchar(void); #ifdef PDC_WIDE PDCEX wchar_t *slk_wlabel(int); #endif PDCEX void PDC_debug(const char *, ...); PDCEX int PDC_ungetch(int); PDCEX int PDC_set_blink(bool); PDCEX int PDC_set_line_color(short); PDCEX void PDC_set_title(const char *); PDCEX int PDC_clearclipboard(void); PDCEX int PDC_freeclipboard(char *); PDCEX int PDC_getclipboard(char **, long *); PDCEX int PDC_setclipboard(const char *, long); PDCEX unsigned long PDC_get_input_fd(void); PDCEX unsigned long PDC_get_key_modifiers(void); PDCEX int PDC_return_key_modifiers(bool); PDCEX int PDC_save_key_modifiers(bool); PDCEX void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines, const int new_min_cols, const int new_max_cols); #define FUNCTION_KEY_SHUT_DOWN 0 #define FUNCTION_KEY_PASTE 1 #define FUNCTION_KEY_ENLARGE_FONT 2 #define FUNCTION_KEY_SHRINK_FONT 3 #define FUNCTION_KEY_CHOOSE_FONT 4 #define FUNCTION_KEY_ABORT 5 #define PDC_MAX_FUNCTION_KEYS 6 PDCEX int PDC_set_function_key( const unsigned function, const int new_key); PDCEX WINDOW *Xinitscr(int, char **); #ifdef XCURSES PDCEX void XCursesExit(void); PDCEX int sb_init(void); PDCEX int sb_set_horz(int, int, int); PDCEX int sb_set_vert(int, int, int); PDCEX int sb_get_horz(int *, int *, int *); PDCEX int sb_get_vert(int *, int *, int *); PDCEX int sb_refresh(void); #endif /*** Functions defined as macros ***/ /* getch() and ungetch() conflict with some DOS libraries */ #define getch() wgetch(stdscr) #define ungetch(ch) PDC_ungetch(ch) #define COLOR_PAIR(n) (((chtype)(n) << PDC_COLOR_SHIFT) & A_COLOR) #define PAIR_NUMBER(n) ((((n) & A_COLOR) >> PDC_COLOR_SHIFT) & 0xff) /* These will _only_ work as macros */ #define getbegyx(w, y, x) (y = getbegy(w), x = getbegx(w)) #define getmaxyx(w, y, x) (y = getmaxy(w), x = getmaxx(w)) #define getparyx(w, y, x) (y = getpary(w), x = getparx(w)) #define getyx(w, y, x) (y = getcury(w), x = getcurx(w)) #define getsyx(y, x) { if (curscr->_leaveit) (y)=(x)=-1; \ else getyx(curscr,(y),(x)); } #ifdef NCURSES_MOUSE_VERSION # define getmouse(x) nc_getmouse(x) #endif /* return codes from PDC_getclipboard() and PDC_setclipboard() calls */ #define PDC_CLIP_SUCCESS 0 #define PDC_CLIP_ACCESS_ERROR 1 #define PDC_CLIP_EMPTY 2 #define PDC_CLIP_MEMORY_ERROR 3 /* PDCurses key modifier masks */ #define PDC_KEY_MODIFIER_SHIFT 1 #define PDC_KEY_MODIFIER_CONTROL 2 #define PDC_KEY_MODIFIER_ALT 4 #define PDC_KEY_MODIFIER_NUMLOCK 8 #define PDC_KEY_MODIFIER_REPEAT 16 #ifdef __cplusplus # undef bool } #endif #endif /* __PDCURSES__ */ curses-1.4.4/vendor/PDCurses/watcom.mif0000644000004100000410000000324114201713275020032 0ustar www-datawww-data# Common elements for the Watcom makefiles !ifeq CROSS Y DEL = rm -f COPY = cp !else DEL = del COPY = copy !endif srcdir = $(PDCURSES_SRCDIR)/pdcurses demodir = $(PDCURSES_SRCDIR)/demos LIBOBJS = addch.obj addchstr.obj addstr.obj attr.obj beep.obj bkgd.obj & border.obj clear.obj color.obj delch.obj deleteln.obj deprec.obj & getch.obj getstr.obj getyx.obj inch.obj inchstr.obj initscr.obj inopts.obj & insch.obj insstr.obj instr.obj kernel.obj keyname.obj mouse.obj move.obj & outopts.obj overlay.obj pad.obj panel.obj printw.obj refresh.obj & scanw.obj scr_dump.obj scroll.obj slk.obj termattr.obj terminfo.obj & touch.obj util.obj window.obj debug.obj PDCOBJS = pdcclip.obj pdcdisp.obj pdcgetsc.obj pdckbd.obj pdcscrn.obj & pdcsetsc.obj pdcutil.obj DEMOS = testcurs.exe ozdemo.exe xmas.exe tuidemo.exe firework.exe & newtest.exe ptest.exe rain.exe worm.exe LIBCURSES = pdcurses.lib LINK = wlink !ifdef __LOADDLL__ ! loaddll wcc wccd ! loaddll wcc386 wccd386 ! loaddll wlink wlinkd ! loaddll wlib wlibd !endif all: $(LIBCURSES) $(DEMOS) clean -$(DEL) *.obj -$(DEL) *.lib -$(DEL) *.exe -$(DEL) *.err demos: $(DEMOS) .c: $(srcdir);$(osdir);$(demodir) .c.obj: .autodepend $(CC) $(CFLAGS) -fo=$@ $< .obj.exe: $(LINK) $(LDFLAGS) n $@ f $*.obj l $(LIBCURSES) testcurs.exe: testcurs.obj $(LIBCURSES) ozdemo.exe: ozdemo.obj $(LIBCURSES) newtest.exe: newtest.obj $(LIBCURSES) xmas.exe: xmas.obj $(LIBCURSES) firework.exe: firework.obj $(LIBCURSES) rain.exe: rain.obj $(LIBCURSES) worm.exe: worm.obj $(LIBCURSES) ptest.exe: ptest.obj $(LIBCURSES) tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES) $(LINK) $(LDFLAGS) n $@ f tuidemo.obj f tui.obj l $(LIBCURSES) dist: .symbolic curses-1.4.4/vendor/PDCurses/demos/0000755000004100000410000000000014201713275017152 5ustar www-datawww-datacurses-1.4.4/vendor/PDCurses/demos/ozdemo.c0000644000004100000410000002301414201713275020613 0ustar www-datawww-data/* * ozdemo.c - A demo program using PDCurses. The program * illustrates the use of colors for text output. * * Hacks by jbuhler@cs.washington.edu on 12/29/96 */ #include #include #include #include #include #include #include int WaitForUser(void); int SubWinTest(WINDOW *); int BouncingBalls(WINDOW *); void trap(int); /* An ASCII map of Australia */ char *AusMap[17] = { " A ", " AA AA ", " N.T. AAAAA AAAA ", " AAAAAAAAAAA AAAAAAAA ", " AAAAAAAAAAAAAAAAAAAAAAAAA Qld.", " AAAAAAAAAAAAAAAAAAAAAAAAAAAA ", " AAAAAAAAAAAAAAAAAAAAAAAAAAAAA ", " AAAAAAAAAAAAAAAAAAAAAAAAAAAA ", " AAAAAAAAAAAAAAAAAAAAAAAAA N.S.W.", "W.A. AAAAAAAAA AAAAAA Vic.", " AAA S.A. AA", " A Tas.", "" }; /* Funny messages for the scroller */ char *messages[] = { "Hello from the Land Down Under", "The Land of crocs, and a big Red Rock", "Where the sunflower runs along the highways", "The dusty red roads lead one to loneliness", "Blue sky in the morning and", "Freezing nights and twinkling stars", NULL }; int WaitForUser(void) { chtype ch; nodelay(stdscr, TRUE); halfdelay(50); ch = getch(); nodelay(stdscr, FALSE); nocbreak(); /* Reset the halfdelay() value */ cbreak(); return (ch == '\033') ? '\033' : 0; } int SubWinTest(WINDOW *win) { WINDOW *swin1, *swin2, *swin3; int w, h, sw, sh, bx, by; wattrset(win, 0); getmaxyx(win, h, w); getbegyx(win, by, bx); sw = w / 3; sh = h / 3; if ((swin1 = derwin(win, sh, sw, 3, 5)) == NULL) return 1; if ((swin2 = subwin(win, sh, sw, by + 4, bx + 8)) == NULL) return 1; if ((swin3 = subwin(win, sh, sw, by + 5, bx + 11)) == NULL) return 1; init_pair(8, COLOR_RED, COLOR_BLUE); wbkgd(swin1, COLOR_PAIR(8)); werase(swin1); mvwaddstr(swin1, 0, 3, "Sub-window 1"); wrefresh(swin1); init_pair(9, COLOR_CYAN, COLOR_MAGENTA); wbkgd(swin2, COLOR_PAIR(9)); werase(swin2); mvwaddstr(swin2, 0, 3, "Sub-window 2"); wrefresh(swin2); init_pair(10, COLOR_YELLOW, COLOR_GREEN); wbkgd(swin3, COLOR_PAIR(10)); werase(swin3); mvwaddstr(swin3, 0, 3, "Sub-window 3"); wrefresh(swin3); delwin(swin1); delwin(swin2); delwin(swin3); WaitForUser(); return 0; } int BouncingBalls(WINDOW *win) { chtype c1, c2, c3, ball1, ball2, ball3; int w, h, x1, y1, xd1, yd1, x2, y2, xd2, yd2, x3, y3, xd3, yd3, c; curs_set(0); wbkgd(win, COLOR_PAIR(1)); wrefresh(win); wattrset(win, 0); init_pair(11, COLOR_RED, COLOR_GREEN); init_pair(12, COLOR_BLUE, COLOR_RED); init_pair(13, COLOR_YELLOW, COLOR_WHITE); ball1 = 'O' | COLOR_PAIR(11); ball2 = '*' | COLOR_PAIR(12); ball3 = '@' | COLOR_PAIR(13); getmaxyx(win, h, w); x1 = 2 + rand() % (w - 4); y1 = 2 + rand() % (h - 4); x2 = 2 + rand() % (w - 4); y2 = 2 + rand() % (h - 4); x3 = 2 + rand() % (w - 4); y3 = 2 + rand() % (h - 4); xd1 = 1; yd1 = 1; xd2 = 1; yd2 = -1; xd3 = -1; yd3 = 1; nodelay(stdscr, TRUE); while ((c = getch()) == ERR) { x1 += xd1; if (x1 <= 1 || x1 >= w - 2) xd1 *= -1; y1 += yd1; if (y1 <= 1 || y1 >= h - 2) yd1 *= -1; x2 += xd2; if (x2 <= 1 || x2 >= w - 2) xd2 *= -1; y2 += yd2; if (y2 <= 1 || y2 >= h - 2) yd2 *= -1; x3 += xd3; if (x3 <= 1 || x3 >= w - 2) xd3 *= -1; y3 += yd3; if (y3 <= 1 || y3 >= h - 2) yd3 *= -1; c1 = mvwinch(win, y1, x1); c2 = mvwinch(win, y2, x2); c3 = mvwinch(win, y3, x3); mvwaddch(win, y1, x1, ball1); mvwaddch(win, y2, x2, ball2); mvwaddch(win, y3, x3, ball3); wmove(win, 0, 0); wrefresh(win); mvwaddch(win, y1, x1, c1); mvwaddch(win, y2, x2, c2); mvwaddch(win, y3, x3, c3); napms(150); } nodelay(stdscr, FALSE); ungetch(c); return 0; } /* Trap interrupt */ void trap(int sig) { if (sig == SIGINT) { endwin(); exit(0); } } int main(int argc, char **argv) { WINDOW *win; chtype save[80], ch; int width, height, w, x, y, i, j, seed; const char *versions = " DOS, OS/2, Windows console & GUI, X11, SDL 1/2, VT"; const char *hit_any_key = " Type a key to continue or ESC to quit "; assert( strlen( versions) == strlen( hit_any_key)); #ifdef PDCURSES #ifdef PDC_VER_MAJOR /* so far only seen in 4.0+ */ PDC_set_resize_limits( 20, 50, 70, 200); #endif #endif #ifdef XCURSES Xinitscr(argc, argv); #else initscr(); #endif seed = (int)time((time_t *)0); srand(seed); start_color(); # if defined(NCURSES_VERSION) || (defined(PDC_BUILD) && PDC_BUILD > 3000) use_default_colors(); # endif cbreak(); noecho(); curs_set(0); #if !defined(__TURBOC__) && !defined(OS2) signal(SIGINT, trap); #endif noecho(); /* refresh stdscr so that reading from it will not cause it to overwrite the other windows that are being created */ refresh(); /* Create a drawing window */ width = strlen( versions) + 4; height = 18; win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2); if (win == NULL) { endwin(); return 1; } for (;;) { init_pair(1, COLOR_WHITE, COLOR_BLUE); wbkgd(win, COLOR_PAIR(1)); werase(win); init_pair(2, COLOR_RED, COLOR_RED); wattrset(win, COLOR_PAIR(2)); box(win, ' ', ' '); wrefresh(win); wattrset(win, 0); /* Do random output of a character */ ch = 'a'; nodelay(stdscr, TRUE); for (i = 0; i < 5000; ++i) { x = rand() % (width - 2) + 1; y = rand() % (height - 2) + 1; mvwaddch(win, y, x, ch); wrefresh(win); if (getch() != ERR) break; napms( 1); if (i == 2000) { ch = 'b'; init_pair(3, COLOR_CYAN, COLOR_YELLOW); wattrset(win, COLOR_PAIR(3)); } } nodelay(stdscr, FALSE); SubWinTest(win); /* Erase and draw green window */ init_pair(4, COLOR_YELLOW, COLOR_GREEN); wbkgd(win, COLOR_PAIR(4)); wattrset(win, A_BOLD); werase(win); wrefresh(win); /* Draw RED bounding box */ wattrset(win, COLOR_PAIR(2)); box(win, ' ', ' '); wrefresh(win); /* Display Australia map */ wattrset(win, A_BOLD); i = 0; while (*AusMap[i]) { mvwaddstr(win, i + 1, 8, AusMap[i]); wrefresh(win); napms(100); ++i; } init_pair(5, COLOR_BLUE, COLOR_WHITE); wattrset(win, COLOR_PAIR(5) | A_BLINK); mvwaddstr( win, height - 4, 2, longname( )); mvwaddstr( win, height - 3, 2, curses_version( )); mvwaddstr( win, height - 2, 2, versions); wrefresh(win); /* Draw running messages */ init_pair(6, COLOR_BLACK, COLOR_WHITE); wattrset(win, COLOR_PAIR(6)); w = width - 2; nodelay(win, TRUE); mvwhline(win, height / 2, 1, ' ', w); for (j = 0; messages[j] != NULL; j++) { char *message = messages[j]; int msg_len = strlen(message); int stop = 0; int xpos, start, count, n; for (n = 0; n <= w + msg_len; n++) { if (n < w) { xpos = w - n; start = 0; count = (n > msg_len) ? msg_len : n; } else { xpos = 0; start = n - w; count = (w > msg_len - start) ? msg_len - start : w; } mvwaddnstr(win, height / 2, xpos + 1, message + start, count); if (xpos + count < w) waddstr(win, " "); wrefresh(win); if (wgetch(win) != ERR) { flushinp(); stop = 1; break; } napms(100); } if (stop) break; } j = 0; /* Draw running 'A's across in RED */ init_pair(7, COLOR_RED, COLOR_GREEN); wattron(win, COLOR_PAIR(7)); for (i = 2; i < width - 4; ++i) { ch = mvwinch(win, 5, i); save[j++] = ch; ch = ch & 0x7f; mvwaddch(win, 5, i, ch); } wrefresh(win); /* Put a message up; wait for a key */ i = height - 2; wattrset(win, COLOR_PAIR(5)); mvwaddstr(win, i, 2, hit_any_key); wrefresh(win); if (WaitForUser() == '\033') break; /* Restore the old line */ wattrset(win, 0); for (i = 2, j = 0; i < width - 4; ++i) mvwaddch(win, 5, i, save[j++]); wrefresh(win); BouncingBalls(win); /* BouncingBalls() leaves a keystroke in the queue */ if (WaitForUser() == '\033') break; } endwin(); return 0; } curses-1.4.4/vendor/PDCurses/demos/tui.c0000644000004100000410000006375014201713275020132 0ustar www-datawww-data/********************************* tui.c ************************************/ /* * 'textual user interface' * * Author : P.J. Kunst * Date : 25-02-93 */ #include #include #include #include #include #include #include "tui.h" void statusmsg(char *); int waitforkey(void); void rmerror(void); #if defined(__unix) && !defined(__DJGPP__) #include #endif #ifdef PDCURSES #define HAVE_CLIPBOARD #else #define nc_getmouse getmouse #endif #ifdef A_COLOR # define TITLECOLOR 1 /* color pair indices */ # define MAINMENUCOLOR (2 | A_BOLD) # define MAINMENUREVCOLOR (3 | A_BOLD | A_REVERSE) # define SUBMENUCOLOR (4 | A_BOLD) # define SUBMENUREVCOLOR (5 | A_BOLD | A_REVERSE) # define BODYCOLOR 6 # define STATUSCOLOR (7 | A_BOLD) # define INPUTBOXCOLOR 8 # define EDITBOXCOLOR (9 | A_BOLD | A_REVERSE) #else # define TITLECOLOR 0 /* color pair indices */ # define MAINMENUCOLOR (A_BOLD) # define MAINMENUREVCOLOR (A_BOLD | A_REVERSE) # define SUBMENUCOLOR (A_BOLD) # define SUBMENUREVCOLOR (A_BOLD | A_REVERSE) # define BODYCOLOR 0 # define STATUSCOLOR (A_BOLD) # define INPUTBOXCOLOR 0 # define EDITBOXCOLOR (A_BOLD | A_REVERSE) #endif #define th 1 /* title window height */ #define mh 1 /* main menu height */ #define sh 2 /* status window height */ #define bh (LINES - th - mh - sh) /* body window height */ #define bw COLS /* body window width */ /******************************* STATIC ************************************/ static WINDOW *wtitl, *wmain, *wbody, *wstat; /* title, menu, body, status win*/ static int nexty, nextx; static int key = ERR, ch = ERR; static bool quit = FALSE; static bool incurses = FALSE; #ifndef PDCURSES static char wordchar(void) { return 0x17; /* ^W */ } #endif static char *padstr(char *s, int length) { static char buf[MAXSTRLEN]; char fmt[10]; sprintf(fmt, (int)strlen(s) > length ? "%%.%ds" : "%%-%ds", length); sprintf(buf, fmt, s); return buf; } static char *prepad(char *s, int length) { int i; char *p = s; if (length > 0) { memmove((void *)(s + length), (const void *)s, strlen(s) + 1); for (i = 0; i < length; i++) *p++ = ' '; } return s; } static void rmline(WINDOW *win, int nr) /* keeps box lines intact */ { mvwaddstr(win, nr, 1, padstr(" ", bw - 2)); wrefresh(win); } static void initcolor(void) { #ifdef A_COLOR if (has_colors()) start_color(); /* foreground, background */ init_pair(TITLECOLOR & ~A_ATTR, COLOR_BLACK, COLOR_CYAN); init_pair(MAINMENUCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN); init_pair(MAINMENUREVCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLACK); init_pair(SUBMENUCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN); init_pair(SUBMENUREVCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLACK); init_pair(BODYCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLUE); init_pair(STATUSCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN); init_pair(INPUTBOXCOLOR & ~A_ATTR, COLOR_BLACK, COLOR_CYAN); init_pair(EDITBOXCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLACK); #endif } static void setcolor(WINDOW *win, chtype color) { chtype attr = color & A_ATTR; /* extract Bold, Reverse, Blink bits */ #ifdef A_COLOR attr &= ~A_REVERSE; /* ignore reverse, use colors instead! */ wattrset(win, COLOR_PAIR(color & A_CHARTEXT) | attr); #else attr &= ~A_BOLD; /* ignore bold, gives messy display on HP-UX */ wattrset(win, attr); #endif } static void colorbox(WINDOW *win, chtype color, int hasbox) { int maxy; #ifndef PDCURSES int maxx; #endif chtype attr = color & A_ATTR; /* extract Bold, Reverse, Blink bits */ setcolor(win, color); #ifdef A_COLOR if (has_colors()) wbkgd(win, COLOR_PAIR(color & A_CHARTEXT) | (attr & ~A_REVERSE)); else #endif wbkgd(win, attr); werase(win); #ifdef PDCURSES maxy = getmaxy(win); #else getmaxyx(win, maxy, maxx); #endif if (hasbox && (maxy > 2)) box(win, 0, 0); touchwin(win); wrefresh(win); } static void idle(void) { char buf[MAXSTRLEN]; time_t t; struct tm *tp; if (time (&t) == -1) return; /* time not available */ tp = localtime(&t); sprintf(buf, " %.2d-%.2d-%.4d %.2d:%.2d:%.2d", tp->tm_mday, tp->tm_mon + 1, tp->tm_year + 1900, tp->tm_hour, tp->tm_min, tp->tm_sec); mvwaddstr(wtitl, (int)0, (int)(bw - strlen(buf) - 2), buf); wrefresh(wtitl); } static void menudim(menu *mp, int *lines, int *columns) { int n, l, mmax = 0; for (n=0; mp->func; n++, mp++) if ((l = (int)strlen(mp->name)) > mmax) mmax = l; *lines = n; *columns = mmax + 2; } static void setmenupos(int y, int x) { nexty = y; nextx = x; } static void getmenupos(int *y, int *x) { *y = nexty; *x = nextx; } static int hotkey(const char *s) { int c0 = *s; /* if no upper case found, return first char */ for (; *s; s++) if (isupper((unsigned char)*s)) break; return *s ? *s : c0; } static void repaintmenu(WINDOW *wmenu, menu *mp) { int i; menu *p = mp; for (i = 0; p->func; i++, p++) mvwaddstr(wmenu, i + 1, 2, p->name); touchwin(wmenu); wrefresh(wmenu); } static void repaintmainmenu(int width, menu *mp) { int i; menu *p = mp; for (i = 0; p->func; i++, p++) mvwaddstr(wmain, 0, i * width, prepad(padstr(p->name, width - 1), 1)); touchwin(wmain); wrefresh(wmain); } static void mainhelp(void) { #ifdef ALT_X statusmsg("Use arrow keys and Enter to select (Alt-X to quit)"); #else statusmsg("Use arrow keys and Enter to select"); #endif } static void mainmenu(menu *mp) { int nitems, barlen, old = -1, cur = 0, c, cur0, x; MEVENT mouse_event; menudim(mp, &nitems, &barlen); repaintmainmenu(barlen, mp); #ifdef __PDCURSES__ nc_getmouse( &mouse_event); #else getmouse( &mouse_event); #endif mousemask( BUTTON1_DOUBLE_CLICKED | BUTTON1_PRESSED | BUTTON1_CLICKED |BUTTON3_DOUBLE_CLICKED |BUTTON3_PRESSED |BUTTON3_CLICKED , NULL); while (!quit) { if (cur != old) { if (old != -1) { mvwaddstr(wmain, 0, old * barlen, prepad(padstr(mp[old].name, barlen - 1), 1)); statusmsg(mp[cur].desc); } else mainhelp(); setcolor(wmain, MAINMENUREVCOLOR); mvwaddstr(wmain, 0, cur * barlen, prepad(padstr(mp[cur].name, barlen - 1), 1)); setcolor(wmain, MAINMENUCOLOR); old = cur; wrefresh(wmain); } switch (c = (key != ERR ? key : waitforkey())) { #ifdef KEY_C2 case KEY_C2: #endif case KEY_DOWN: case '\n': /* menu item selected */ touchwin(wbody); wrefresh(wbody); rmerror(); setmenupos(th + mh, cur * barlen); curs_set(1); (mp[cur].func)(); /* perform function */ curs_set(0); switch (key) { #ifdef KEY_B1 case KEY_B1: #endif case KEY_LEFT: cur = (cur + nitems - 1) % nitems; key = '\n'; break; #ifdef KEY_B3 case KEY_B3: #endif case KEY_RIGHT: cur = (cur + 1) % nitems; key = '\n'; break; case KEY_MOUSE: if(nc_getmouse(&mouse_event) == OK) { if((mouse_event.bstate & BUTTON1_PRESSED) || (mouse_event.bstate & BUTTON1_DOUBLE_CLICKED) || (mouse_event.bstate & BUTTON1_CLICKED)) { for( x = 1; x <= nitems ; ++x){ if((mouse_event.x > (barlen * (x-1)) && mouse_event.x < (barlen * x) ) && (mouse_event.y == th )){ if(x>=1){ cur = x-1; break; } else{ key = KEY_ESC; break; } } } } break; } break; default: key = ERR; } repaintmainmenu(barlen, mp); old = -1; break; #ifdef KEY_B1 case KEY_B1: #endif case KEY_LEFT: cur = (cur + nitems - 1) % nitems; break; #ifdef KEY_B3 case KEY_B3: #endif case KEY_RIGHT: cur = (cur + 1) % nitems; break; case KEY_ESC: mainhelp(); break; case KEY_MOUSE: if(nc_getmouse(&mouse_event) == OK) { if((mouse_event.bstate & BUTTON1_PRESSED) || (mouse_event.bstate & BUTTON1_DOUBLE_CLICKED) || (mouse_event.bstate & BUTTON1_CLICKED)) { for( x = 1; x <= nitems ; ++x){ if((mouse_event.x > (barlen * (x-1)) && mouse_event.x < (barlen * x) ) && (mouse_event.y == th)){ cur = x-1; key = '\n'; break; } } } break; } break; default: cur0 = cur; do { cur = (cur + 1) % nitems; } while ((cur != cur0) && (hotkey(mp[cur].name) != toupper(c))); if (hotkey(mp[cur].name) == toupper(c)) key = '\n'; } } rmerror(); touchwin(wbody); wrefresh(wbody); } static void cleanup(void) /* cleanup curses settings */ { if (incurses) { delwin(wtitl); delwin(wmain); delwin(wbody); delwin(wstat); curs_set(1); endwin(); incurses = FALSE; } } /******************************* EXTERNAL **********************************/ void clsbody(void) { werase(wbody); wmove(wbody, 0, 0); } int bodylen(void) { #ifdef PDCURSES return getmaxy(wbody); #else int maxy, maxx; getmaxyx(wbody, maxy, maxx); return maxy; #endif } WINDOW *bodywin(void) { return wbody; } void rmerror(void) { rmline(wstat, 0); } void rmstatus(void) { rmline(wstat, 1); } void titlemsg(char *msg) { mvwaddstr(wtitl, 0, 2, padstr(msg, bw - 3)); wrefresh(wtitl); } void bodymsg(char *msg) { waddstr(wbody, msg); wrefresh(wbody); } void errormsg(char *msg) { beep(); mvwaddstr(wstat, 0, 2, padstr(msg, bw - 3)); wrefresh(wstat); } void statusmsg(char *msg) { mvwaddstr(wstat, 1, 2, padstr(msg, bw - 3)); wrefresh(wstat); } bool keypressed(void) { ch = wgetch(wbody); return ch != ERR; } int getkey(void) { int c = ch; ch = ERR; #ifdef ALT_X quit = (c == ALT_X); /* PC only ! */ #endif return c; } int waitforkey(void) { do idle(); while (!keypressed()); return getkey(); } void DoExit(void) /* terminate program */ { quit = TRUE; } void domenu(menu *mp) { int y, x, nitems, barlen, mheight, mw, old = -1, cur = 0, cur0; bool stop = FALSE; WINDOW *wmenu; MEVENT mouse_event; curs_set(0); getmenupos(&y, &x); menudim(mp, &nitems, &barlen); mheight = nitems + 2; mw = barlen + 2; wmenu = newwin(mheight, mw, y, x); colorbox(wmenu, SUBMENUCOLOR, 1); repaintmenu(wmenu, mp); key = ERR; #ifdef __PDCURSES__ nc_getmouse( &mouse_event); #else getmouse( &mouse_event); #endif mousemask( BUTTON1_DOUBLE_CLICKED | BUTTON1_PRESSED | BUTTON1_CLICKED |BUTTON3_DOUBLE_CLICKED |BUTTON3_PRESSED |BUTTON3_CLICKED , NULL); while (!stop && !quit) { if (cur != old) { if (old != -1) mvwaddstr(wmenu, old + 1, 1, prepad(padstr(mp[old].name, barlen - 1), 1)); setcolor(wmenu, SUBMENUREVCOLOR); mvwaddstr(wmenu, cur + 1, 1, prepad(padstr(mp[cur].name, barlen - 1), 1)); setcolor(wmenu, SUBMENUCOLOR); statusmsg(mp[cur].desc); old = cur; wrefresh(wmenu); } switch (key = ((key != ERR) ? key : waitforkey())) { case '\n': /* menu item selected */ touchwin(wbody); wrefresh(wbody); setmenupos(y + 1, x + 1); rmerror(); key = ERR; curs_set(1); (mp[cur].func)(); /* perform function */ curs_set(0); repaintmenu(wmenu, mp); old = -1; break; #ifdef KEY_A2 case KEY_A2: #endif case KEY_UP: cur = (cur + nitems - 1) % nitems; key = ERR; break; #ifdef KEY_C2 case KEY_C2: #endif case KEY_DOWN: cur = (cur + 1) % nitems; key = ERR; break; case KEY_ESC: #ifdef KEY_B1 case KEY_B1: #endif case KEY_LEFT: #ifdef KEY_B3 case KEY_B3: #endif case KEY_RIGHT: if (key == KEY_ESC) key = ERR; /* return to prev submenu */ stop = TRUE; break; case KEY_MOUSE: if(nc_getmouse(&mouse_event) == OK) { if((mouse_event.bstate & BUTTON1_PRESSED) || (mouse_event.bstate & BUTTON1_CLICKED)) { if( mouse_event.y <= th+1) { key = KEY_ESC; /* exit menu */ break; } else if((mouse_event.y - (y-1) > 0) && mouse_event.y > th && mouse_event.y < y+mheight && mouse_event.y > y && mouse_event.x > x && mouse_event.x < mw +x) { cur = (mouse_event.y - y-1) % nitems; key = ERR; break; } else if(mouse_event.y > 0 && mouse_event.y != y-1 && mouse_event.x > 0 && mouse_event.x != x-1) { key = KEY_ESC; /* exit menu */ break; } stop = TRUE; break; } else if(mouse_event.bstate & BUTTON1_DOUBLE_CLICKED) { if((mouse_event.y - (y-1) > 0) && mouse_event.y > th && mouse_event.y < y+mheight && mouse_event.y > y){ cur = (mouse_event.y - y-1) % nitems; key = '\n'; break; }else{ key = KEY_ESC; break; } } else if( (mouse_event.bstate & BUTTON3_PRESSED) || (mouse_event.bstate & BUTTON3_CLICKED)) { key = KEY_ESC; break; } } break; default: cur0 = cur; do { cur = (cur + 1) % nitems; } while ((cur != cur0) && (hotkey(mp[cur].name) != toupper((int)key))); key = (hotkey(mp[cur].name) == toupper((int)key)) ? '\n' : ERR; } } rmerror(); delwin(wmenu); touchwin(wbody); wrefresh(wbody); } void startmenu(menu *mp, char *mtitle) { initscr(); incurses = TRUE; initcolor(); wtitl = subwin(stdscr, th, bw, 0, 0); wmain = subwin(stdscr, mh, bw, th, 0); wbody = subwin(stdscr, bh, bw, th + mh, 0); wstat = subwin(stdscr, sh, bw, th + mh + bh, 0); colorbox(wtitl, TITLECOLOR, 0); colorbox(wmain, MAINMENUCOLOR, 0); colorbox(wbody, BODYCOLOR, 0); colorbox(wstat, STATUSCOLOR, 0); if (mtitle) titlemsg(mtitle); cbreak(); /* direct input (no newline required)... */ noecho(); /* ... without echoing */ curs_set(0); /* hide cursor (if possible) */ nodelay(wbody, TRUE); /* don't wait for input... */ halfdelay(10); /* ...well, no more than a second, anyway */ keypad(wbody, TRUE); /* enable cursor keys */ scrollok(wbody, TRUE); /* enable scrolling in main window */ leaveok(stdscr, TRUE); leaveok(wtitl, TRUE); leaveok(wmain, TRUE); leaveok(wstat, TRUE); mainmenu(mp); cleanup(); } static void repainteditbox(WINDOW *win, int x, char *buf) { #ifndef PDCURSES int maxy; #endif int maxx; #ifdef PDCURSES maxx = getmaxx(win); #else getmaxyx(win, maxy, maxx); #endif werase(win); mvwprintw(win, 0, 0, "%s", padstr(buf, maxx)); wmove(win, 0, x); wrefresh(win); } /* weditstr() - edit string Description: The initial value of 'str' with a maximum length of 'field' - 1, which is supplied by the calling routine, is editted. The user's erase (^H), kill (^U) and delete word (^W) chars are interpreted. The PC insert or Tab keys toggle between insert and edit mode. Escape aborts the edit session, leaving 'str' unchanged. Enter, Up or Down Arrow are used to accept the changes to 'str'. NOTE: editstr(), mveditstr(), and mvweditstr() are macros. Return Value: Returns the input terminating character on success (Escape, Enter, Up or Down Arrow) and ERR on error. Errors: It is an error to call this function with a NULL window pointer. The length of the initial 'str' must not exceed 'field' - 1. */ int weditstr(WINDOW *win, char *buf, int field) { char org[MAXSTRLEN], *tp, *bp = buf; bool defdisp = TRUE, stop = FALSE, insert = FALSE; int cury, curx, begy, begx; chtype oldattr; WINDOW *wedit; int c = 0; #ifdef HAVE_CLIPBOARD char *ptr = NULL; long j, length = 0; MEVENT mouse_event; #ifdef __PDCURSES__ nc_getmouse( &mouse_event); #else getmouse( &mouse_event); #endif mousemask( BUTTON1_DOUBLE_CLICKED | BUTTON1_PRESSED | BUTTON1_CLICKED |BUTTON3_DOUBLE_CLICKED |BUTTON3_PRESSED |BUTTON3_CLICKED , NULL); #endif if ((field >= MAXSTRLEN) || (buf == NULL) || ((int)strlen(buf) > field - 1)) return ERR; strcpy(org, buf); /* save original */ wrefresh(win); getyx(win, cury, curx); getbegyx(win, begy, begx); wedit = subwin(win, 1, field, begy + cury, begx + curx); oldattr = wedit->_attrs; colorbox(wedit, EDITBOXCOLOR, 0); keypad(wedit, TRUE); curs_set(1); while (!stop) { idle(); repainteditbox(wedit, (int)(bp - buf), buf); switch (c = wgetch(wedit)) { case ERR: break; case KEY_ESC: strcpy(buf, org); /* restore original */ stop = TRUE; break; case '\n': #ifdef KEY_A2 case KEY_A2: #endif case KEY_UP: #ifdef KEY_C2 case KEY_C2: #endif case KEY_DOWN: stop = TRUE; break; #ifdef KEY_B1 case KEY_B1: #endif case KEY_LEFT: if (bp > buf) bp--; break; #ifdef KEY_B3 case KEY_B3: #endif case KEY_RIGHT: defdisp = FALSE; if (bp - buf < (int)strlen(buf)) bp++; break; #ifdef HAVE_CLIPBOARD case KEY_MOUSE: if(nc_getmouse(&mouse_event) == OK) { if(mouse_event.bstate & BUTTON1_DOUBLE_CLICKED){ if(mouse_event.y >= begy + cury && mouse_event.y <= begy + cury + 1 && mouse_event.x >= begx + curx && mouse_event.x <= begx + curx + field){ c = KEY_DOWN; stop = TRUE; break; }else{ c = KEY_ESC; strcpy(buf, org); /* restore original */ stop = TRUE; break; } } else if(mouse_event.bstate & BUTTON3_DOUBLE_CLICKED){ c = KEY_UP; strcpy(buf, org); /* restore original */ stop = TRUE; break; } else if( (mouse_event.bstate & BUTTON3_PRESSED) || (mouse_event.bstate & BUTTON3_CLICKED)) { j = PDC_getclipboard(&ptr, &length); switch(j) { case PDC_CLIP_ACCESS_ERROR: strcpy(buf, org); /* restore original as default */ stop = TRUE; c = KEY_ESC; break; case PDC_CLIP_MEMORY_ERROR: strcpy(buf, org); /* restore original as default */ stop = TRUE; c = KEY_ESC; break; case PDC_CLIP_EMPTY: strcpy(buf, org); /* restore original as default */ stop = TRUE; c = KEY_ESC; break; case PDC_CLIP_SUCCESS: if ((int)strlen(ptr) && insert){ if ((int)strlen(buf) < field + 1 ) { memmove((void *)(ptr+(int)strlen(ptr)), (const void *)bp, (int)strlen(buf)+1); /* Experimental insert/add to existing text*/ strncpy(bp, ptr, field - (int)strlen(buf)); /* copy clip-board to already existing field */ insert = !insert; curs_set(insert ? 2 : 1); while (bp - buf < (int)strlen(buf)) bp++; } } break; default: strcpy(buf, org); /* restore original */ stop = TRUE; c = KEY_ESC; break; } } } break; #endif case '\t': /* TAB -- because insert is broken on HPUX */ case KEY_IC: /* enter insert mode */ case KEY_EIC: /* exit insert mode */ defdisp = FALSE; insert = !insert; curs_set(insert ? 2 : 1); break; default: if (c == erasechar()) /* backspace, ^H */ { if (bp > buf) { memmove((void *)(bp - 1), (const void *)bp, strlen(bp) + 1); bp--; } } else if (c == killchar()) /* ^U */ { bp = buf; *bp = '\0'; } else if (c == wordchar()) /* ^W */ { tp = bp; while ((bp > buf) && (*(bp - 1) == ' ')) bp--; while ((bp > buf) && (*(bp - 1) != ' ')) bp--; memmove((void *)bp, (const void *)tp, strlen(tp) + 1); } else if( c >=0 && c < 256 && isprint(c)) { if (defdisp) { bp = buf; *bp = '\0'; defdisp = FALSE; } if (insert) { if ((int)strlen(buf) < field - 1) { memmove((void *)(bp + 1), (const void *)bp, strlen(bp) + 1); *bp++ = c; } } else if (bp - buf < field - 1) { /* append new string terminator */ if (!*bp) bp[1] = '\0'; *bp++ = c; } } } } curs_set(0); wattrset(wedit, oldattr); repainteditbox(wedit, (int)(bp - buf), buf); delwin(wedit); return c; } WINDOW *winputbox(WINDOW *win, int nlines, int ncols) { WINDOW *winp; int cury, curx, begy, begx; getyx(win, cury, curx); getbegyx(win, begy, begx); winp = newwin(nlines, ncols, begy + cury, begx + curx); colorbox(winp, INPUTBOXCOLOR, 1); return winp; } int getstrings(char *desc[], char *buf[], int field) { WINDOW *winput; int oldy, oldx, maxy, maxx, nlines, ncols, i, n, l, mmax = 0; int c = 0; bool stop = FALSE; for (n = 0; desc[n]; n++) if ((l = (int)strlen(desc[n])) > mmax) mmax = l; nlines = n + 2; ncols = mmax + field + 4; getyx(wbody, oldy, oldx); getmaxyx(wbody, maxy, maxx); winput = mvwinputbox(wbody, (maxy - nlines) / 2, (maxx - ncols) / 2, nlines, ncols); for (i = 0; i < n; i++) mvwprintw(winput, i + 1, 2, "%s", desc[i]); i = 0; while (!stop) { switch (c = mvweditstr(winput, i+1, mmax+3, buf[i], field)) { case KEY_ESC: stop = TRUE; break; #ifdef KEY_A2 case KEY_A2: #endif case KEY_UP: i = (i + n - 1) % n; break; case '\n': case '\t': #ifdef KEY_C2 case KEY_C2: #endif case KEY_DOWN: if (++i == n) stop = TRUE; /* all passed? */ } } delwin(winput); touchwin(wbody); wmove(wbody, oldy, oldx); wrefresh(wbody); return c; } curses-1.4.4/vendor/PDCurses/demos/rain.c0000644000004100000410000001111614201713275020247 0ustar www-datawww-data/**************************************************************************** * Copyright (c) 2002 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ #include #include #include /* rain 11/3/1980 EPS/CITHEP */ static int next_j(int j) { if (j == 0) j = 4; else --j; if (has_colors()) { int z = rand() % 3; chtype color = COLOR_PAIR(z); if (z) color |= A_BOLD; attrset(color); } return j; } int main(int argc, char *argv[]) { int x, y, j, r, c, seed; static int xpos[5], ypos[5]; #ifdef XCURSES Xinitscr(argc, argv); #else initscr(); #endif seed = (int)time((time_t *)0); srand(seed); if (has_colors()) { short bg = COLOR_BLACK; start_color(); #if defined(NCURSES_VERSION) || (defined(PDC_BUILD) && PDC_BUILD > 3000) if (use_default_colors() == OK) bg = -1; #endif init_pair(1, COLOR_BLUE, bg); init_pair(2, COLOR_CYAN, bg); } nl(); noecho(); curs_set(0); timeout(0); keypad(stdscr, TRUE); r = LINES - 4; c = COLS - 4; for (j = 5; --j >= 0;) { xpos[j] = rand() % c + 2; ypos[j] = rand() % r + 2; } for (j = 0;;) { x = rand() % c + 2; y = rand() % r + 2; mvaddch(y, x, '.'); mvaddch(ypos[j], xpos[j], 'o'); j = next_j(j); mvaddch(ypos[j], xpos[j], 'O'); j = next_j(j); mvaddch(ypos[j] - 1, xpos[j], '-'); mvaddstr(ypos[j], xpos[j] - 1, "|.|"); mvaddch(ypos[j] + 1, xpos[j], '-'); j = next_j(j); mvaddch(ypos[j] - 2, xpos[j], '-'); mvaddstr(ypos[j] - 1, xpos[j] - 1, "/ \\"); mvaddstr(ypos[j], xpos[j] - 2, "| O |"); mvaddstr(ypos[j] + 1, xpos[j] - 1, "\\ /"); mvaddch(ypos[j] + 2, xpos[j], '-'); j = next_j(j); mvaddch(ypos[j] - 2, xpos[j], ' '); mvaddstr(ypos[j] - 1, xpos[j] - 1, " "); mvaddstr(ypos[j], xpos[j] - 2, " "); mvaddstr(ypos[j] + 1, xpos[j] - 1, " "); mvaddch(ypos[j] + 2, xpos[j], ' '); xpos[j] = x; ypos[j] = y; switch (getch()) { case 'q': case 'Q': curs_set(1); endwin(); return EXIT_SUCCESS; case 's': nodelay(stdscr, FALSE); break; case ' ': nodelay(stdscr, TRUE); #ifdef KEY_RESIZE break; case KEY_RESIZE: # ifdef PDCURSES resize_term(0, 0); erase(); # endif r = LINES - 4; c = COLS - 4; #endif } napms(50); } } curses-1.4.4/vendor/PDCurses/demos/README.md0000644000004100000410000000145414201713275020435 0ustar www-datawww-dataPDCurses Demos ============== This directory contains demonstration programs to show and test the capabilities of curses libraries. Some of them predate PDCurses, PCcurses or even pcurses/ncurses. Although some PDCurses-specific code has been added, all programs remain portable to other implementations (at a minimum, to ncurses). Building -------- The demos are built by the platform-specific makefiles, in the platform directories. Alternatively, you can build them manually, individually, and link with any curses library; e.g., "cc -lcurses -orain rain.c". There are no dependencies besides curses and the standard C library, and no configuration is needed. Distribution Status ------------------- Public Domain, except for rain.c and worm.c, which are under the ncurses license (MIT-like). curses-1.4.4/vendor/PDCurses/demos/tui.h0000644000004100000410000000304114201713275020122 0ustar www-datawww-data/* * 'textual user interface' * * Author : P.J. Kunst * Date : 25-02-93 */ #ifndef _TUI_H_ #define _TUI_H_ #include #ifdef A_COLOR #define A_ATTR (A_ATTRIBUTES ^ A_COLOR) /* A_BLINK, A_REVERSE, A_BOLD */ #else #define A_ATTR (A_ATTRIBUTES) /* standard UNIX attributes */ #endif #define MAXSTRLEN 256 #define KEY_ESC 0x1b /* Escape */ typedef void (*FUNC)(void); typedef struct { char *name; /* item label */ FUNC func; /* (pointer to) function */ char *desc; /* function description */ } menu; /* ANSI C function prototypes: */ void clsbody(void); int bodylen(void); WINDOW *bodywin(void); void rmerror(void); void rmstatus(void); void titlemsg(char *msg); void bodymsg(char *msg); void errormsg(char *msg); void statusmsg(char *msg); bool keypressed(void); int getkey(void); int waitforkey(void); void DoExit(void); void startmenu(menu *mp, char *title); void domenu(menu *mp); int weditstr(WINDOW *win, char *buf, int field); WINDOW *winputbox(WINDOW *win, int nlines, int ncols); int getstrings(char *desc[], char *buf[], int field); #define editstr(s,f) (weditstr(stdscr,s,f)) #define mveditstr(y,x,s,f) (move(y,x)==ERR?ERR:editstr(s,f)) #define mvweditstr(w,y,x,s,f) (wmove(w,y,x)==ERR?ERR:weditstr(w,s,f)) #define inputbox(l,c) (winputbox(stdscr,l,c)) #define mvinputbox(y,x,l,c) (move(y,x)==ERR?w:inputbox(l,c)) #define mvwinputbox(w,y,x,l,c) (wmove(w,y,x)==ERR?w:winputbox(w,l,c)) #endif curses-1.4.4/vendor/PDCurses/demos/ptest.c0000644000004100000410000001240614201713275020460 0ustar www-datawww-data#include #include #include PANEL *p1, *p2, *p3, *p4, *p5; WINDOW *w4, *w5; long nap_msec = 1; char *mod[] = { "test ", "TEST ", "(**) ", "*()* ", "<--> ", "LAST " }; void pflush(void) { update_panels(); doupdate(); } void backfill(void) { int y, x; erase(); for (y = 0; y < LINES - 1; y++) for (x = 0; x < COLS; x++) printw("%d", (y + x) % 10); } void wait_a_while(long msec) { int c; if (msec != 1) timeout(msec); c = getch(); if (c == 'q') { endwin(); exit(1); } } void saywhat(const char *text) { mvprintw(LINES - 1, 0, "%-20.20s", text); } /* mkpanel - alloc a win and panel and associate them */ PANEL *mkpanel(int rows, int cols, int tly, int tlx) { WINDOW *win = newwin(rows, cols, tly, tlx); PANEL *pan = (PANEL *)0; if (win) { pan = new_panel(win); if (!pan) delwin(win); } return pan; } void rmpanel(PANEL *pan) { WINDOW *win = pan->win; del_panel(pan); delwin(win); } void fill_panel(PANEL *pan) { WINDOW *win = pan->win; char num = *((char *)pan->user + 1); int y, x, maxy, maxx; box(win, 0, 0); mvwprintw(win, 1, 1, "-pan%c-", num); getmaxyx(win, maxy, maxx); for (y = 2; y < maxy - 1; y++) for (x = 1; x < maxx - 1; x++) mvwaddch(win, y, x, num); } int main(int argc, char **argv) { int itmp, y; if (argc > 1 && atol(argv[1])) nap_msec = atol(argv[1]); #ifdef XCURSES Xinitscr(argc, argv); #else initscr(); #endif backfill(); for (y = 0; y < 5; y++) { p1 = mkpanel(10, 10, 0, 0); set_panel_userptr(p1, "p1"); p2 = mkpanel(14, 14, 5, 5); set_panel_userptr(p2, "p2"); p3 = mkpanel(6, 8, 12, 12); set_panel_userptr(p3, "p3"); p4 = mkpanel(10, 10, 10, 30); w4 = panel_window(p4); set_panel_userptr(p4, "p4"); p5 = mkpanel(10, 10, 13, 37); w5 = panel_window(p5); set_panel_userptr(p5, "p5"); fill_panel(p1); fill_panel(p2); fill_panel(p3); fill_panel(p4); fill_panel(p5); hide_panel(p4); hide_panel(p5); pflush(); wait_a_while(nap_msec); saywhat("h3 s1 s2 s4 s5;"); move_panel(p1, 0, 0); hide_panel(p3); show_panel(p1); show_panel(p2); show_panel(p4); show_panel(p5); pflush(); wait_a_while(nap_msec); saywhat("s1;"); show_panel(p1); pflush(); wait_a_while(nap_msec); saywhat("s2;"); show_panel(p2); pflush(); wait_a_while(nap_msec); saywhat("m2;"); move_panel(p2, 10, 10); pflush(); wait_a_while(nap_msec); saywhat("s3;"); show_panel(p3); pflush(); wait_a_while(nap_msec); saywhat("m3;"); move_panel(p3, 5, 5); pflush(); wait_a_while(nap_msec); saywhat("b3;"); bottom_panel(p3); pflush(); wait_a_while(nap_msec); saywhat("s4;"); show_panel(p4); pflush(); wait_a_while(nap_msec); saywhat("s5;"); show_panel(p5); pflush(); wait_a_while(nap_msec); saywhat("t3;"); top_panel(p3); pflush(); wait_a_while(nap_msec); saywhat("t1;"); top_panel(p1); pflush(); wait_a_while(nap_msec); saywhat("t2;"); top_panel(p2); pflush(); wait_a_while(nap_msec); saywhat("t3;"); top_panel(p3); pflush(); wait_a_while(nap_msec); saywhat("t4;"); top_panel(p4); pflush(); wait_a_while(nap_msec); for (itmp = 0; itmp < 6; itmp++) { saywhat("m4;"); mvwaddstr(w4, 3, 1, mod[itmp]); move_panel(p4, 4, itmp * 10); mvwaddstr(w5, 4, 1, mod[itmp]); pflush(); wait_a_while(nap_msec); saywhat("m5;"); mvwaddstr(w4, 4, 1, mod[itmp]); move_panel(p5, 7, itmp * 10 + 6); mvwaddstr(w5, 3, 1, mod[itmp]); pflush(); wait_a_while(nap_msec); } saywhat("m4;"); move_panel(p4, 4, itmp * 10); pflush(); wait_a_while(nap_msec); saywhat("t5;"); top_panel(p5); pflush(); wait_a_while(nap_msec); saywhat("t2;"); top_panel(p2); pflush(); wait_a_while(nap_msec); saywhat("t1;"); top_panel(p1); pflush(); wait_a_while(nap_msec); saywhat("d2;"); rmpanel(p2); pflush(); wait_a_while(nap_msec); saywhat("h3;"); hide_panel(p3); pflush(); wait_a_while(nap_msec); saywhat("d1;"); rmpanel(p1); pflush(); wait_a_while(nap_msec); saywhat("d4; "); rmpanel(p4); pflush(); wait_a_while(nap_msec); saywhat("d5; "); rmpanel(p5); pflush(); wait_a_while(nap_msec); if (nap_msec == 1) break; nap_msec = 100L; } endwin(); return 0; } /* end of main */ curses-1.4.4/vendor/PDCurses/demos/tuidemo.c0000644000004100000410000001157214201713275020772 0ustar www-datawww-data/* * Author : P.J. Kunst * Date : 25-02-93 * * Purpose: This program demonstrates the use of the 'curses' library * for the creation of (simple) menu-operated programs. * In the PDCurses version, use is made of colors for the * highlighting of subwindows (title bar, status bar etc). * * Acknowledgement: some ideas were borrowed from Mark Hessling's * version of the 'testcurs' program. */ #include #include #include #include #include "tui.h" /* change this if source at other location */ # define FNAME "../demos/tui.c" /**************************** strings entry box ***************************/ void address(void) { char *fieldname[6] = { "Name", "Street", "City", "State", "Country", (char *)0 }; char *fieldbuf[5]; WINDOW *wbody = bodywin(); int i, field = 50; for (i = 0; i < 5; i++) fieldbuf[i] = calloc(1, field + 1); if (getstrings(fieldname, fieldbuf, field) != KEY_ESC) { for (i = 0; fieldname[i]; i++) wprintw(wbody, "%10s : %s\n", fieldname[i], fieldbuf[i]); wrefresh(wbody); } for (i = 0; i < 5; i++) free(fieldbuf[i]); } /**************************** string entry box ****************************/ char *getfname(char *desc, char *fname, int field) { char *fieldname[2]; char *fieldbuf[1]; fieldname[0] = desc; fieldname[1] = 0; fieldbuf[0] = fname; return (getstrings(fieldname, fieldbuf, field) == KEY_ESC) ? NULL : fname; } /**************************** a very simple file browser ******************/ void showfile(char *fname) { int i, bh = bodylen(); FILE *fp; char buf[MAXSTRLEN]; bool ateof = FALSE; statusmsg("FileBrowser: Hit key to continue, Q to quit"); if ((fp = fopen(fname, "r")) != NULL) /* file available? */ { while (!ateof) { clsbody(); for (i = 0; i < bh - 1 && !ateof; i++) { buf[0] = '\0'; if( fgets(buf, MAXSTRLEN, fp)) { size_t j = 0; while( buf[j] >= ' ') j++; buf[j] = '\0'; bodymsg(buf); bodymsg( "\n"); } else ateof = TRUE; } switch (waitforkey()) { case 'Q': case 'q': case 0x1b: ateof = TRUE; } } fclose(fp); } else { sprintf(buf, "ERROR: file '%s' not found", fname); errormsg(buf); } } /***************************** forward declarations ***********************/ void sub0(void), sub1(void), sub2(void), sub3(void); void func1(void), func2(void); void subfunc1(void), subfunc2(void); void subsub(void); /***************************** menus initialization ***********************/ menu MainMenu[] = { { "Asub", sub0, "Go inside first submenu" }, { "Bsub", sub1, "Go inside second submenu" }, { "Csub", sub2, "Go inside third submenu" }, { "Dsub", sub3, "Go inside fourth submenu" }, { "", (FUNC)0, "" } /* always add this as the last item! */ }; menu SubMenu0[] = { { "Exit", DoExit, "Terminate program" }, { "", (FUNC)0, "" } }; menu SubMenu1[] = { { "OneBeep", func1, "Sound one beep" }, { "TwoBeeps", func2, "Sound two beeps" }, { "", (FUNC)0, "" } }; menu SubMenu2[] = { { "Browse", subfunc1, "Source file lister" }, { "Input", subfunc2, "Interactive file lister" }, { "Address", address, "Get address data" }, { "", (FUNC)0, "" } }; menu SubMenu3[] = { { "SubSub", subsub, "Go inside sub-submenu" }, { "", (FUNC)0, "" } }; /***************************** main menu functions ************************/ void sub0(void) { domenu(SubMenu0); } void sub1(void) { domenu(SubMenu1); } void sub2(void) { domenu(SubMenu2); } void sub3(void) { domenu(SubMenu3); } /***************************** submenu1 functions *************************/ void func1(void) { beep(); bodymsg("One beep! "); } void func2(void) { beep(); bodymsg("Two beeps! "); beep(); } /***************************** submenu2 functions *************************/ void subfunc1(void) { showfile(FNAME); } void subfunc2(void) { char fname[MAXSTRLEN]; strcpy(fname, FNAME); if (getfname ("File to browse:", fname, 50)) showfile(fname); } /***************************** submenu3 functions *************************/ void subsub(void) { domenu(SubMenu2); } /***************************** start main menu ***************************/ int main(int argc, char **argv) { setlocale(LC_ALL, ""); startmenu(MainMenu, "TUI - 'textual user interface' demonstration program"); return 0; } curses-1.4.4/vendor/PDCurses/demos/worm.c0000644000004100000410000002764714201713275020322 0ustar www-datawww-data/**************************************************************************** * Copyright (c) 2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /* @@@ @@@ @@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@ @@@ @@@ @@@@@@@@@@@@ @@@@@@@@@@@@ @@@@@@@@@@@@@ @@@ @@@ @@@@ @@@@ @@@@ @@@@ @@@ @@@@ @@@ @@ @@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@@ @@@@ @@@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@@@@@@@@@@ @@@@ @@@@ @@@ @@@ @@@ @@@ @@@@ @@@@ @@@@@@@@@@@@ @@@ @@@ @@@ @@@ @@ @@ @@@@@@@@@@ @@@ @@@ @@@ @@@ Eric P. Scott Caltech High Energy Physics October, 1980 Color by Eric S. Raymond July, 1995 Options: -f fill screen with copies of 'WORM' at start. -l set worm length -n set number of worms -t make worms leave droppings */ #include #include #include #define FLAVORS 7 static chtype flavor[FLAVORS] = { 'O', '*', '#', '$', '%', '0', '@' }; static const short xinc[] = { 1, 1, 1, 0, -1, -1, -1, 0 }, yinc[] = { -1, 0, 1, 1, 1, 0, -1, -1 }; static struct worm { int orientation, head; short *xpos, *ypos; } worm[40]; static const char *field; static int length = 16, number = 3; static chtype trail = ' '; static const struct options { int nopts; int opts[3]; } normal[8] = { { 3, { 7, 0, 1 } }, { 3, { 0, 1, 2 } }, { 3, { 1, 2, 3 } }, { 3, { 2, 3, 4 } }, { 3, { 3, 4, 5 } }, { 3, { 4, 5, 6 } }, { 3, { 5, 6, 7 } }, { 3, { 6, 7, 0 } } }, upper[8] = { { 1, { 1, 0, 0 } }, { 2, { 1, 2, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 2, { 4, 5, 0 } }, { 1, { 5, 0, 0 } }, { 2, { 1, 5, 0 } } }, left[8] = { { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 2, { 2, 3, 0 } }, { 1, { 3, 0, 0 } }, { 2, { 3, 7, 0 } }, { 1, { 7, 0, 0 } }, { 2, { 7, 0, 0 } } }, right[8] = { { 1, { 7, 0, 0 } }, { 2, { 3, 7, 0 } }, { 1, { 3, 0, 0 } }, { 2, { 3, 4, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 2, { 6, 7, 0 } } }, lower[8] = { { 0, { 0, 0, 0 } }, { 2, { 0, 1, 0 } }, { 1, { 1, 0, 0 } }, { 2, { 1, 5, 0 } }, { 1, { 5, 0, 0 } }, { 2, { 5, 6, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } } }, upleft[8] = { { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 1, { 3, 0, 0 } }, { 2, { 1, 3, 0 } }, { 1, { 1, 0, 0 } } }, upright[8] = { { 2, { 3, 5, 0 } }, { 1, { 3, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 1, { 5, 0, 0 } } }, lowleft[8] = { { 3, { 7, 0, 1 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 1, { 1, 0, 0 } }, { 2, { 1, 7, 0 } }, { 1, { 7, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } } }, lowright[8] = { { 0, { 0, 0, 0 } }, { 1, { 7, 0, 0 } }, { 2, { 5, 7, 0 } }, { 1, { 5, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } }, { 0, { 0, 0, 0 } } }; static void cleanup(void) { standend(); refresh(); curs_set(1); endwin(); } int main(int argc, char *argv[]) { const struct options *op; struct worm *w; short **ref, *ip; int x, y, n, h, last, bottom, seed; for (x = 1; x < argc; x++) { char *p = argv[x]; if (*p == '-') p++; switch (*p) { case 'f': field = "WORM"; break; case 'l': if (++x == argc) goto usage; if ((length = atoi(argv[x])) < 2 || length > 1024) { fprintf(stderr, "%s: Invalid length\n", *argv); return EXIT_FAILURE; } break; case 'n': if (++x == argc) goto usage; if ((number = atoi(argv[x])) < 1 || number > 40) { fprintf(stderr, "%s: Invalid number of worms\n", *argv); return EXIT_FAILURE; } break; case 't': trail = '.'; break; default: usage: fprintf(stderr, "usage: %s [-field] [-length #] " "[-number #] [-trail]\n", *argv); return EXIT_FAILURE; } } #ifdef XCURSES Xinitscr(argc, argv); #else initscr(); #endif seed = (int)time((time_t *)0); srand(seed); noecho(); cbreak(); nonl(); keypad(stdscr, TRUE); curs_set(0); bottom = LINES - 1; last = COLS - 1; #ifdef A_COLOR if (has_colors()) { short bg = COLOR_BLACK; start_color(); # if defined(NCURSES_VERSION) || (defined(PDC_BUILD) && PDC_BUILD > 3000) if (use_default_colors() == OK) bg = -1; # endif # define SET_COLOR(num, fg) \ init_pair(num + 1, fg, bg); \ flavor[num] |= COLOR_PAIR(num + 1) | A_BOLD SET_COLOR(0, COLOR_GREEN); SET_COLOR(1, COLOR_RED); SET_COLOR(2, COLOR_CYAN); SET_COLOR(3, COLOR_WHITE); SET_COLOR(4, COLOR_MAGENTA); SET_COLOR(5, COLOR_BLUE); SET_COLOR(6, COLOR_YELLOW); } #endif ref = malloc(sizeof(short *) * LINES); for (y = 0; y < LINES; y++) { ref[y] = malloc(sizeof(short) * COLS); for (x = 0; x < COLS; x++) ref[y][x] = 0; } #ifdef BADCORNER /* if addressing the lower right corner doesn't work in your curses */ ref[bottom][last] = 1; #endif for (n = number, w = &worm[0]; --n >= 0; w++) { w->orientation = w->head = 0; if ((ip = malloc(sizeof(short) * (length + 1))) == NULL) { fprintf(stderr, "%s: out of memory\n", *argv); return EXIT_FAILURE; } w->xpos = ip; for (x = length; --x >= 0;) *ip++ = -1; if ((ip = malloc(sizeof(short) * (length + 1))) == NULL) { fprintf(stderr, "%s: out of memory\n", *argv); return EXIT_FAILURE; } w->ypos = ip; for (y = length; --y >= 0;) *ip++ = -1; } if (field) { const char *p = field; for (y = bottom; --y >= 0;) for (x = COLS; --x >= 0;) { addch((chtype) (*p++)); if (!*p) p = field; } } napms(12); refresh(); nodelay(stdscr, TRUE); for (;;) { int ch; if ((ch = getch()) > 0) { #ifdef KEY_RESIZE if (ch == KEY_RESIZE) { # ifdef PDCURSES resize_term(0, 0); erase(); # endif if (last != COLS - 1) { for (y = 0; y <= bottom; y++) { ref[y] = realloc(ref[y], sizeof(short) * COLS); for (x = last + 1; x < COLS; x++) ref[y][x] = 0; } last = COLS - 1; } if (bottom != LINES - 1) { for (y = LINES; y <= bottom; y++) free(ref[y]); ref = realloc(ref, sizeof(short *) * LINES); for (y = bottom + 1; y < LINES; y++) { ref[y] = malloc(sizeof(short) * COLS); for (x = 0; x < COLS; x++) ref[y][x] = 0; } bottom = LINES - 1; } } #endif /* KEY_RESIZE */ /* Make it simple to put this into single-step mode, or resume normal operation - T. Dickey */ if (ch == 'q') { cleanup(); return EXIT_SUCCESS; } else if (ch == 's') nodelay(stdscr, FALSE); else if (ch == ' ') nodelay(stdscr, TRUE); } for (n = 0, w = &worm[0]; n < number; n++, w++) { if ((x = w->xpos[h = w->head]) < 0) { move(y = w->ypos[h] = bottom, x = w->xpos[h] = 0); addch(flavor[n % FLAVORS]); ref[y][x]++; } else y = w->ypos[h]; if (x > last) x = last; if (y > bottom) y = bottom; if (++h == length) h = 0; if (w->xpos[w->head = h] >= 0) { int x1 = w->xpos[h]; int y1 = w->ypos[h]; if (y1 < LINES && x1 < COLS && --ref[y1][x1] == 0) { move(y1, x1); addch(trail); } } op = &(x == 0 ? (y == 0 ? upleft : (y == bottom ? lowleft : left)) : (x == last ? (y == 0 ? upright : (y == bottom ? lowright : right)) : (y == 0 ? upper : (y == bottom ? lower : normal)))) [w->orientation]; switch (op->nopts) { case 0: cleanup(); return EXIT_SUCCESS; case 1: w->orientation = op->opts[0]; break; default: w->orientation = op->opts[rand() % op->nopts]; } move(y += yinc[w->orientation], x += xinc[w->orientation]); if (y < 0) y = 0; addch(flavor[n % FLAVORS]); ref[w->ypos[h] = y][w->xpos[h] = x]++; } napms(12); refresh(); } } curses-1.4.4/vendor/PDCurses/demos/testcurs.c0000644000004100000410000012630214201713275021176 0ustar www-datawww-data/* * This is a test program for PDCurses. Originally by * John Burnell * * wrs(5/28/93) -- modified to be consistent (perform identically) * with either PDCurses or under Unix System V, R4 */ #ifndef _XOPEN_SOURCE_EXTENDED # define _XOPEN_SOURCE_EXTENDED 1 #endif #ifdef HAVE_NCURSESW #define HAVE_WIDE 1 #include #include #endif #ifdef PDC_WIDE #define HAVE_WIDE 1 #include #include #endif #ifndef HAVE_WIDE #include #define HAVE_WIDE 0 #endif #include #include #include #include #include #if defined( PDCURSES) #define getmouse nc_getmouse #else #define NCURSES_MOUSE_INTERFACE #endif #if defined(PDCURSES) && !defined(XCURSES) # define HAVE_RESIZE 1 #else # define HAVE_RESIZE 0 #endif #ifdef A_COLOR # define HAVE_COLOR 1 #else # define HAVE_COLOR 0 #endif /* Set to non-zero if you want to test the PDCurses clipboard */ /* (obviously, can't do that with ncurses) */ #if defined( PDCURSES) #define HAVE_CLIPBOARD 1 #else #define HAVE_CLIPBOARD 0 #endif void inputTest(WINDOW *); void scrollTest(WINDOW *); void introTest(WINDOW *); int initTest(WINDOW **, int, char **); void outputTest(WINDOW *); void padTest(WINDOW *); void acsTest(WINDOW *); #if HAVE_COLOR void colorTest(WINDOW *); #endif #if HAVE_RESIZE void resizeTest(WINDOW *); #endif #if HAVE_CLIPBOARD void clipboardTest(WINDOW *); #endif #if HAVE_WIDE void wideTest(WINDOW *); #endif void display_menu(int, int); struct commands { const char *text; void (*function)(WINDOW *); }; typedef struct commands COMMAND; #define MAX_OPTIONS (6 + HAVE_COLOR + HAVE_RESIZE + HAVE_CLIPBOARD + HAVE_WIDE) COMMAND command[MAX_OPTIONS] = { {"Intro Test", introTest}, {"Pad Test", padTest}, #if HAVE_RESIZE {"Resize Test", resizeTest}, #endif {"Scroll Test", scrollTest}, {"Input Test", inputTest}, {"Output Test", outputTest}, {"ACS Test", acsTest}, #if HAVE_COLOR {"Color Test", colorTest}, #endif #if HAVE_CLIPBOARD {"Clipboard Test", clipboardTest}, #endif #if HAVE_WIDE {"Wide Input", wideTest} #endif }; int width, height; static short background_index = COLOR_BLACK; static bool report_mouse_movement = FALSE; int main(int argc, char *argv[]) { WINDOW *win; int key, old_option = -1, new_option = 0, i; bool quit = FALSE; setlocale(LC_ALL, ""); #ifdef PDCURSES #ifdef PDC_VER_MAJOR /* so far only seen in 4.0+ */ PDC_set_resize_limits( 20, 50, 70, 200); #endif #endif if (initTest(&win, argc, argv)) return 1; for( i = 1; i < argc; i++) if( argv[i][0] == '-') switch( argv[i][1]) { case 'l': case 'L': setlocale( LC_ALL, argv[i] + 2); break; case 'i': case 'I': background_index = (short)atoi( argv[i] + 2); break; #ifdef PDCURSES case 'b': case 'B': PDC_set_blink( TRUE); break; case 'm': case 'M': PDC_return_key_modifiers( TRUE); break; #ifdef PDC_VER_MAJOR /* so far only seen in 4.0+ */ case 'r': /* allow user-resizable windows */ { int min_lines, max_lines, min_cols, max_cols; if( sscanf( argv[i] + 2, "%d,%d,%d,%d", &min_lines, &max_lines, &min_cols, &max_cols) == 4) PDC_set_resize_limits( min_lines, max_lines, min_cols, max_cols); } break; #endif #endif case 'z': report_mouse_movement = TRUE; break; default: break; } #ifdef A_COLOR if (has_colors()) { init_pair(1, COLOR_WHITE, COLOR_BLUE); wbkgd(win, COLOR_PAIR(1)); } else #endif wbkgd(win, A_REVERSE); #ifdef PDCURSES #ifdef PDC_VER_MAJOR /* so far only seen in 4.0+ */ PDC_set_function_key( FUNCTION_KEY_ABORT, 3 ); /* ctrl-C aborts */ #endif #endif erase(); display_menu(old_option, new_option); while (1) { bool run_option = FALSE; noecho(); keypad(stdscr, TRUE); raw(); #ifdef PDCURSES mouse_set( ALL_MOUSE_EVENTS); #else mousemask( ALL_MOUSE_EVENTS, NULL); #endif key = getch(); switch(key) { case KEY_MOUSE: { const int tmarg = (LINES - (MAX_OPTIONS + 2)) / 2; int selected_opt; MEVENT mouse_event; getmouse( &mouse_event); #if defined( BUTTON4_PRESSED) && defined( BUTTON5_PRESSED) if( mouse_event.bstate & BUTTON4_PRESSED) selected_opt = new_option - 1; /* wheel up */ else if( mouse_event.bstate & BUTTON5_PRESSED) selected_opt = new_option + 1; /* wheel down */ else #endif selected_opt = mouse_event.y - tmarg; if( selected_opt >= 0 && selected_opt < MAX_OPTIONS) { old_option = new_option; new_option = selected_opt; display_menu( old_option, new_option); } if( mouse_event.bstate & BUTTON1_DOUBLE_CLICKED) run_option = TRUE; } break; case 10: case 13: case KEY_ENTER: run_option = TRUE; break; case KEY_PPAGE: case KEY_HOME: old_option = new_option; new_option = 0; display_menu(old_option, new_option); break; case KEY_NPAGE: case KEY_END: old_option = new_option; new_option = MAX_OPTIONS - 1; display_menu(old_option, new_option); break; case KEY_UP: old_option = new_option; new_option = (new_option == 0) ? new_option : new_option - 1; display_menu(old_option, new_option); break; case KEY_DOWN: old_option = new_option; new_option = (new_option == MAX_OPTIONS - 1) ? new_option : new_option + 1; display_menu(old_option, new_option); break; case KEY_RESIZE: # ifdef PDCURSES resize_term(0, 0); # endif old_option = -1; erase(); display_menu(old_option, new_option); break; case 'Q': case 'q': quit = TRUE; } if( run_option) { old_option = -1; erase(); refresh(); (*command[new_option].function)(win); erase(); display_menu(old_option, new_option); } if (quit == TRUE) break; } delwin(win); endwin(); return 0; } void Continue(WINDOW *win) { mvwaddstr(win, 10, 1, " Press any key to continue"); wrefresh(win); raw(); wgetch(win); wrefresh(win); } void Continue2(void) { move(LINES - 1, 1); clrtoeol(); mvaddstr(LINES - 2, 1, " Press any key to continue"); refresh(); raw(); getch(); } int initTest(WINDOW **win, int argc, char *argv[]) { #ifdef XCURSES Xinitscr(argc, argv); #else initscr(); #endif #ifdef A_COLOR if (has_colors()) start_color(); #endif /* Create a drawing window */ width = 60; height = 19; *win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2); if (*win == NULL) { endwin(); return 1; } return 0; } void introTest(WINDOW *win) { werase(win); wmove(win, height / 2 - 5, width / 2); wvline(win, ACS_VLINE, 10); wmove(win, height / 2, width / 2 - 10); whline(win, ACS_HLINE, 20); Continue(win); beep(); werase(win); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); cbreak(); mvwaddstr(win, 1, 1, "You should have a rectangle in the middle of the screen"); mvwaddstr(win, 2, 1, "You should have heard a beep"); Continue(win); flash(); mvwaddstr(win, 3, 1, "You should have seen a flash"); Continue(win); } void scrollTest(WINDOW *win) { int i, OldY; #if !defined (PDCURSES) && !defined (NCURSES_VERSION) int OldX; #endif werase(win); mvwaddstr(win, height - 2, 1, "The window will now scroll slowly"); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); scrollok(win, TRUE); napms(500); for (i = 1; i <= height; i++) { napms(150); scroll(win); wrefresh(win); }; #if defined (PDCURSES) || defined (NCURSES_VERSION) OldY = getmaxy(win); #else getmaxyx(win, OldY, OldX); #endif mvwaddstr(win, 6, 1, "The top of the window will scroll"); wmove(win, 1, 1); wsetscrreg(win, 0, 4); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); for (i = 1; i <= 5; i++) { napms(500); scroll(win); wrefresh(win); } mvwaddstr(win, 3, 1, "The bottom of the window will scroll"); wmove(win, 8, 1); wsetscrreg(win, 5, --OldY); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); for (i = 5; i <= OldY; i++) { napms(300); wscrl(win, -1); wrefresh(win); } wsetscrreg(win, 0, OldY); } void inputTest(WINDOW *win) { int w, h, bx, by, sw, sh, i, c, num = 0; int line_to_use = 3; char buffer[80]; WINDOW *subWin; static const char spinner[4] = "/-\\|"; int spinner_count = 0; wclear(win); getmaxyx(win, h, w); getbegyx(win, by, bx); sw = w / 3; sh = h / 3; if ((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2)) == NULL) return; #ifdef A_COLOR if (has_colors()) { init_pair(2, COLOR_WHITE, COLOR_RED); wbkgd(subWin, COLOR_PAIR(2) | A_BOLD); } else #endif wbkgd(subWin, A_BOLD); box(subWin, ACS_VLINE, ACS_HLINE); wrefresh(win); nocbreak(); wclear (win); mvwaddstr(win, 1, 1, "Press keys (or mouse buttons) to show their names"); mvwaddstr(win, 2, 1, "Press spacebar to finish, Ctrl-A to return to main menu"); wrefresh(win); keypad(win, TRUE); raw(); noecho(); wtimeout(win, 200); #ifdef PDCURSES mouse_set( ALL_MOUSE_EVENTS | (report_mouse_movement ? REPORT_MOUSE_POSITION : 0)); PDC_save_key_modifiers(TRUE); #else mousemask( ALL_MOUSE_EVENTS | (report_mouse_movement ? REPORT_MOUSE_POSITION : 0), NULL); if( report_mouse_movement) printf("\033[?1003h\n"); /* used in ncurses with some X-based */ #endif /* terms to enable mouse move events */ curs_set(0); /* turn cursor off */ while (1) { while (1) { c = wgetch(win); if (c == ERR) { spinner_count++; if (spinner_count == 4) spinner_count = 0; mvwaddch(win, line_to_use, 3, spinner[spinner_count]); wrefresh(win); } else break; } #ifdef PDCURSES /* wmove(win, line_to_use + 1, 18); wclrtoeol(win); */ #endif mvwaddstr(win, line_to_use, 5, "Key Pressed: "); wclrtoeol(win); wprintw( win, "(%x) ", c); if( has_key( c)) wprintw(win, "%s", keyname(c)); else if (isprint(c) || c > 0xff) waddch( win, c); else wprintw(win, "%s", unctrl(c)); if (c == KEY_MOUSE) { #ifdef NCURSES_MOUSE_INTERFACE const mmask_t masks[ ] = { BUTTON1_RELEASED, BUTTON1_PRESSED, BUTTON1_CLICKED, BUTTON1_DOUBLE_CLICKED, BUTTON1_TRIPLE_CLICKED, BUTTON2_RELEASED, BUTTON2_PRESSED, BUTTON2_CLICKED, BUTTON2_DOUBLE_CLICKED, BUTTON2_TRIPLE_CLICKED, BUTTON3_RELEASED, BUTTON3_PRESSED, BUTTON3_CLICKED, BUTTON3_DOUBLE_CLICKED, BUTTON3_TRIPLE_CLICKED, BUTTON4_RELEASED, BUTTON4_PRESSED, BUTTON4_CLICKED, BUTTON4_DOUBLE_CLICKED, BUTTON4_TRIPLE_CLICKED, #ifdef BUTTON5_RELEASED BUTTON5_RELEASED, BUTTON5_PRESSED, BUTTON5_CLICKED, BUTTON5_DOUBLE_CLICKED, BUTTON5_TRIPLE_CLICKED, #endif }; #ifdef BUTTON4_RESERVED_EVENT const mmask_t reserved_masks[] = { BUTTON1_RESERVED_EVENT, BUTTON2_RESERVED_EVENT, BUTTON3_RESERVED_EVENT, BUTTON4_RESERVED_EVENT }; #endif MEVENT mouse_event; getmouse( &mouse_event); wmove(win, line_to_use, 5); wclrtoeol(win); wprintw(win, "Posn: Y: %d X: %d", mouse_event.y, mouse_event.x); for( i = 0; i < sizeof( masks) / sizeof( masks[0]); i++) if( mouse_event.bstate & masks[i]) { const char *event_names[] = { "released", "pressed", "clicked", "double-clicked", "triple-clicked" }; wprintw( win, " Button %d %s", i / 5 + 1, event_names[i % 5]); } #ifdef BUTTON_CTRL if( mouse_event.bstate & BUTTON_CTRL) wprintw( win, " Ctrl"); #endif if( mouse_event.bstate & BUTTON_ALT) wprintw( win, " Alt"); if( mouse_event.bstate & BUTTON_SHIFT) wprintw( win, " Shift"); if( mouse_event.bstate & REPORT_MOUSE_POSITION) wprintw( win, " Moved"); #ifdef BUTTON4_RESERVED_EVENT for( i = 0; i < sizeof( reserved_masks) / sizeof( reserved_masks[0]); i++) if( mouse_event.bstate & reserved_masks[i]) wprintw( win, " Reserved %d", i + 1); #endif #else /* using the 'classic' (undocumented) Sys V mouse functions */ int button = 0, status = 0; request_mouse_pos(); if (BUTTON_CHANGED(1)) button = 1; else if (BUTTON_CHANGED(2)) button = 2; else if (BUTTON_CHANGED(3)) button = 3; else if (BUTTON_CHANGED(4)) /* added 21 Jan 2011: BJG */ button = 4; else if (BUTTON_CHANGED(5)) button = 5; if( button) #ifdef PDC_N_EXTENDED_MOUSE_BUTTONS status = (button > 3 ? Mouse_status.xbutton[(button) - 4] : Mouse_status.button[(button) - 1]); #else status = (button > 3 ? 0 : Mouse_status.button[(button) - 1]); #endif wmove(win, line_to_use, 5); wclrtoeol(win); wprintw(win, "Button %d: ", button); if (MOUSE_MOVED) waddstr(win, "moved: "); else if (MOUSE_WHEEL_UP) waddstr(win, "wheel up: "); else if (MOUSE_WHEEL_DOWN) waddstr(win, "wheel dn: "); #ifdef MOUSE_WHEEL_LEFT else if (MOUSE_WHEEL_LEFT) waddstr(win, "wheel lt: "); #endif #ifdef MOUSE_WHEEL_RIGHT else if (MOUSE_WHEEL_RIGHT) waddstr(win, "wheel rt: "); #endif else if ((status & BUTTON_ACTION_MASK) == BUTTON_PRESSED) waddstr(win, "pressed: "); else if ((status & BUTTON_ACTION_MASK) == BUTTON_CLICKED) waddstr(win, "clicked: "); else if ((status & BUTTON_ACTION_MASK) == BUTTON_DOUBLE_CLICKED) waddstr(win, "double: "); else if ((status & BUTTON_ACTION_MASK) == BUTTON_TRIPLE_CLICKED) waddstr(win, "triple: "); else if( button) waddstr(win, "released: "); wprintw(win, "Posn: Y: %d X: %d", MOUSE_Y_POS, MOUSE_X_POS); if( !button) /* just to get shift/alt/ctrl status */ status = Mouse_status.button[0]; if (status & BUTTON_SHIFT) waddstr(win, " SHIFT"); if (status & BUTTON_CONTROL) waddstr(win, " CONTROL"); if (status & BUTTON_ALT) waddstr(win, " ALT"); } else if (PDC_get_key_modifiers()) { waddstr(win, " Modifier(s):"); if (PDC_get_key_modifiers() & PDC_KEY_MODIFIER_SHIFT) waddstr(win, " SHIFT"); if (PDC_get_key_modifiers() & PDC_KEY_MODIFIER_CONTROL) waddstr(win, " CONTROL"); if (PDC_get_key_modifiers() & PDC_KEY_MODIFIER_ALT) waddstr(win, " ALT"); if (PDC_get_key_modifiers() & PDC_KEY_MODIFIER_NUMLOCK) waddstr(win, " NUMLOCK"); #ifdef PDC_KEY_MODIFIER_REPEAT if (PDC_get_key_modifiers() & PDC_KEY_MODIFIER_REPEAT) waddstr(win, " REPEAT"); #endif #endif /* end of mouse display */ } wrefresh(win); if (c == ' ' || c == 1) break; line_to_use++; if( line_to_use == 17) line_to_use = 3; } wtimeout(win, -1); /* turn off timeout() */ curs_set(1); /* turn cursor back on */ #ifdef PDCURSES mouse_set(0L); PDC_save_key_modifiers(FALSE); /* PDC_return_key_modifiers(FALSE); */ #endif wclear(win); if( c == 1) return; #ifdef PDCURSES #ifdef PDC_VER_MAJOR /* so far only seen in 4.0+ */ PDC_set_function_key( FUNCTION_KEY_ABORT, 0 ); /* un-abortable */ #endif #endif mvwaddstr(win, 2, 1, "Press some keys for 5 seconds"); mvwaddstr(win, 1, 1, "Pressing ^C should do nothing"); wrefresh(win); werase(subWin); box(subWin, ACS_VLINE, ACS_HLINE); for (i = 0; i < 5; i++) { mvwprintw(subWin, 1, 1, "Time = %d", i); wrefresh(subWin); napms(1000); flushinp(); } #ifdef PDCURSES #ifdef PDC_VER_MAJOR /* so far only seen in 4.0+ */ PDC_set_function_key( FUNCTION_KEY_ABORT, 3 ); /* ctrl-C aborts */ #endif #endif delwin(subWin); werase(win); flash(); wrefresh(win); napms(500); flushinp(); mvwaddstr(win, 2, 1, "Press a key, followed by ENTER"); wmove(win, 9, 10); wrefresh(win); echo(); keypad(win, TRUE); raw(); wgetnstr(win, buffer, 3); flushinp(); wmove(win, 9, 10); wdelch(win); mvwaddstr(win, 4, 1, "The character should now have been deleted"); Continue(win); refresh(); wclear(win); echo(); buffer[0] = '\0'; mvwaddstr(win, 3, 2, "The window should have moved"); mvwaddstr(win, 4, 2, "This text should have appeared without you pressing a key"); mvwaddstr(win, 6, 2, "Enter a number then a string separated by space"); mvwin(win, 2, 1); wrefresh(win); mvwscanw(win, 7, 6, "%d %s", &num, buffer); mvwprintw(win, 8, 6, "String: %s Number: %d", buffer, num); Continue(win); refresh(); wclear(win); echo(); mvwaddstr(win, 3, 2, "Enter a 5 character string: "); wgetnstr(win, buffer, 5); mvwprintw(win, 4, 2, "String: %s", buffer); Continue(win); } void outputTest(WINDOW *win) { WINDOW *win1; char Buffer[80]; chtype ch; int by, bx; nl(); wclear(win); mvwaddstr(win, 1, 1, "You should now have a screen in the upper " "left corner, and this text should have wrapped"); waddstr(win,"\nThis text should be down\n"); waddstr(win, "and broken into two here ^"); Continue(win); wclear(win); wattron(win, A_BOLD); mvwaddstr(win, 1, 1, "A new window will appear with this text in it"); mvwaddstr(win, 8, 1, "Press any key to continue"); wrefresh(win); wgetch(win); getbegyx(win, by, bx); if (LINES < 24 || COLS < 75) { mvwaddstr(win, 5, 1, "Some tests have been skipped as they require a"); mvwaddstr(win, 6, 1, "display of at least 24 LINES by 75 COLUMNS"); Continue(win); } else { win1 = newwin(10, 50, 14, 25); if (win1 == NULL) { endwin(); return; } #ifdef A_COLOR if (has_colors()) { init_pair(3, COLOR_BLUE, COLOR_WHITE); wbkgd(win1, COLOR_PAIR(3)); } else #endif wbkgd(win1, A_NORMAL); wclear(win1); mvwaddstr(win1, 5, 1, "This text should appear; using overlay option"); copywin(win, win1, 0, 0, 0, 0, 9, 49, TRUE); box(win1, ACS_VLINE, ACS_HLINE); wmove(win1, 8, 26); wrefresh(win1); wgetch(win1); wclear(win1); wattron(win1, A_BLINK); mvwaddstr(win1, 4, 1, "This blinking text should appear in only the second window"); wattroff(win1, A_BLINK); mvwin(win1, by, bx); overlay(win, win1); mvwin(win1, 14, 25); wmove(win1, 8, 26); wrefresh(win1); wgetch(win1); delwin(win1); } clear(); wclear(win); wrefresh(win); mvwaddstr(win, 6, 2, "This line shouldn't appear"); mvwaddstr(win, 4, 2, "Only half of the next line is visible"); mvwaddstr(win, 5, 2, "Only half of the next line is visible"); wmove(win, 6, 1); wclrtobot(win); wmove(win, 5, 20); wclrtoeol(win); mvwaddstr(win, 8, 2, "This line also shouldn't appear"); wmove(win, 8, 1); winsdelln(win, -1); Continue(win); wmove(win, 5, 9); ch = winch(win); wclear(win); wmove(win, 6, 2); waddstr(win, "The next char should be l: "); winsch(win, ch); Continue(win); mvwinsstr(win, 6, 2, "A1B2C3D4E5"); Continue(win); wmove(win, 5, 1); winsdelln(win, 1); mvwaddstr(win, 5, 2, "The lines below should have moved down"); Continue(win); wclear(win); wmove(win, 2, 2); wprintw(win, "This is a formatted string in a window: %d %s\n", 42, "is it"); mvwaddstr(win, 10, 1, "Enter a string: "); wrefresh(win); echo(); wscanw(win, "%s", Buffer); printw("This is a formatted string in stdscr: %d %s\n", 42, "is it"); mvaddstr(10, 1, "Enter a string: "); scanw("%s", Buffer); wclear(win); curs_set(2); mvwaddstr(win, 1, 1, "The cursor should be in high-visibility mode"); Continue(win); wclear(win); curs_set(0); mvwaddstr(win, 1, 1, "The cursor should have disappeared"); Continue(win); wclear(win); curs_set(1); mvwaddstr(win, 1, 1, "The cursor should be normal"); Continue(win); #ifdef A_COLOR if (has_colors()) { wclear(win); mvwaddstr(win, 1, 1, "Colors should change after you press a key"); Continue(win); init_pair(1, COLOR_RED, COLOR_WHITE); wrefresh(win); } #endif werase(win); mvwaddstr(win, 1, 1, "Information About Your Terminal"); mvwaddstr(win, 3, 1, termname()); mvwaddstr(win, 4, 1, longname()); if (termattrs() & A_BLINK) mvwaddstr(win, 5, 1, "This terminal claims to support blinking."); else mvwaddstr(win, 5, 1, "This terminal does NOT support blinking."); mvwaddnstr(win, 7, 5, "Have a nice day!ok", 16); wrefresh(win); mvwinnstr(win, 7, 5, Buffer, 18); mvaddstr(LINES - 2, 10, Buffer); refresh(); Continue(win); } #if HAVE_RESIZE void resizeTest(WINDOW *dummy) { WINDOW *win1; int nwidth = 135, nheight = 52; int owidth = COLS, oheight = LINES; savetty(); resize_term(nheight, nwidth); clear(); refresh(); win1 = newwin(10, 50, 14, 25); if (win1 == NULL) { endwin(); return; } #ifdef A_COLOR if (has_colors()) { init_pair(3, COLOR_BLUE, COLOR_WHITE); wattrset(win1, COLOR_PAIR(3)); } wclear(win1); #endif mvwaddstr(win1, 0, 0, "The screen may now be resized"); mvwprintw(win1, 1, 4, "Given size: %d by %d", nwidth, nheight); mvwprintw(win1, 2, 4, "Actual size: %d by %d", COLS, LINES); Continue(win1); wclear(win1); resetty(); mvwaddstr(win1, 0, 0, "The screen should now be reset"); mvwprintw(win1, 1, 6, "Old size: %d by %d", owidth, oheight); mvwprintw(win1, 2, 6, "Size now: %d by %d", COLS, LINES); Continue(win1); delwin(win1); clear(); refresh(); } #endif /* HAVE_RESIZE */ void padTest(WINDOW *dummy) { WINDOW *pad, *spad; pad = newpad(50, 100); wattron(pad, A_REVERSE); mvwaddstr(pad, 5, 2, "This is a new pad"); wattrset(pad, 0); mvwaddstr(pad, 8, 0, "The end of this line should be truncated here:except now"); mvwaddstr(pad, 11, 1, "This line should not appear.It will now"); wmove(pad, 10, 1); wclrtoeol(pad); mvwaddstr(pad, 10, 1, " Press any key to continue"); prefresh(pad, 0, 0, 0, 0, 10, 45); keypad(pad, TRUE); raw(); wgetch(pad); spad = subpad(pad, 12, 25, 7, 52); mvwaddstr(spad, 2, 2, "This is a new subpad"); box(spad, 0, 0); prefresh(pad, 0, 0, 0, 0, 15, 75); keypad(pad, TRUE); raw(); wgetch(pad); mvwaddstr(pad, 35, 2, "This is displayed at line 35 in the pad"); mvwaddstr(pad, 40, 1, " Press any key to continue"); prefresh(pad, 30, 0, 0, 0, 10, 45); keypad(pad, TRUE); raw(); wgetch(pad); delwin(pad); } #if HAVE_CLIPBOARD void clipboardTest(WINDOW *win) { static const char *text = "This string placed in clipboard by PDCurses test program, testcurs."; char *ptr = NULL; long i, length = 0; mvaddstr(1, 1, "This test will display the contents of the system clipboard"); Continue2(); scrollok(stdscr, TRUE); i = PDC_getclipboard(&ptr, &length); switch(i) { case PDC_CLIP_ACCESS_ERROR: mvaddstr(3, 1, "There was an error accessing the clipboard"); refresh(); break; case PDC_CLIP_MEMORY_ERROR: mvaddstr(3, 1, "Unable to allocate memory for clipboard contents"); break; case PDC_CLIP_EMPTY: mvaddstr(3, 1, "There was no text in the clipboard"); break; default: wsetscrreg(stdscr, 0, LINES - 1); clear(); mvaddstr(1, 1, "Clipboard contents..."); mvprintw(2, 1, "%s\n", ptr); } Continue2(); clear(); mvaddstr(1, 1, "This test will place the following string in the system clipboard:"); mvaddstr(2, 1, text); i = PDC_setclipboard(text, (long)strlen(text)); switch(i) { case PDC_CLIP_ACCESS_ERROR: mvaddstr(3, 1, "There was an error accessing the clipboard"); break; case PDC_CLIP_MEMORY_ERROR: mvaddstr(3, 1, "Unable to allocate memory for clipboard contents"); break; default: mvaddstr(3, 1, "The string was placed in the clipboard successfully"); } Continue2(); } #endif /* HAVE_CLIPBOARD */ void acsTest(WINDOW *win) { static const char *acs_names[] = { "ACS_ULCORNER", "ACS_URCORNER", "ACS_LLCORNER", "ACS_LRCORNER", "ACS_LTEE", "ACS_RTEE", "ACS_TTEE", "ACS_BTEE", "ACS_HLINE", "ACS_VLINE", "ACS_PLUS", #ifdef ACS_D_ULCORNER "ACS_D_ULCORNER", "ACS_D_URCORNER", "ACS_D_LLCORNER", "ACS_D_LRCORNER", "ACS_D_LTEE", "ACS_D_RTEE", "ACS_D_TTEE", "ACS_D_BTEE", "ACS_D_HLINE", "ACS_D_VLINE", "ACS_D_PLUS", #endif #ifdef ACS_SD_ULCORNER "ACS_SD_ULCORNER", "ACS_SD_URCORNER", "ACS_SD_LLCORNER", "ACS_SD_LRCORNER", "ACS_SD_LTEE", "ACS_SD_RTEE", "ACS_SD_TTEE", "ACS_SD_BTEE", "ACS_SD_PLUS", "ACS_DS_ULCORNER", "ACS_DS_URCORNER", "ACS_DS_LLCORNER", "ACS_DS_LRCORNER", "ACS_DS_LTEE", "ACS_DS_RTEE", "ACS_DS_TTEE", "ACS_DS_BTEE", "ACS_DS_PLUS", #endif "ACS_S1", #ifdef ACS_S3 "ACS_S3", "ACS_S7", #endif "ACS_S9", "ACS_DIAMOND", #ifdef ACS_CLUB "ACS_CLUB", "ACS_SPADE", "ACS_HEART", "ACS_LTBOARD", #endif "ACS_BOARD", "ACS_CKBOARD", "ACS_DEGREE", "ACS_PLMINUS", "ACS_BULLET", #ifdef ACS_SM_BULLET "ACS_SM_BULLET", "ACS_MED_BULLET", "ACS_WHITE_BULLET", "ACS_PILCROW", "ACS_SECTION", "ACS_SMILE", "ACS_REV_SMILE", #endif "ACS_LARROW", "ACS_RARROW", "ACS_UARROW", "ACS_DARROW", "ACS_LANTERN", "ACS_BLOCK", #ifdef ACS_LEQUAL "ACS_LEQUAL", "ACS_GEQUAL", "ACS_NEQUAL", "ACS_PI", "ACS_STERLING", #endif #ifdef ACS_CENT "ACS_CENT", "ACS_YEN", "ACS_PESETA", "ACS_ALPHA", "ACS_BETA", "ACS_GAMMA", "ACS_UP_SIGMA", "ACS_LO_SIGMA", "ACS_MU", "ACS_TAU", "ACS_UP_PHI", "ACS_LO_PHI", "ACS_OMEGA", "ACS_DELTA", "ACS_INFINITY", "ACS_THETA", "ACS_EPSILON", "ACS_INTERSECT", "ACS_SUP2", "ACS_SUP_N", "ACS_TRIPLE_BAR", "ACS_APPROX_EQ", "ACS_SQUARE_ROOT", "ACS_NOT", "ACS_REV_NOT", "ACS_HALF", "ACS_QUARTER", "ACS_DIVISION", "ACS_UP_INTEGRAL", "ACS_LO_INTEGRAL", "ACS_UBLOCK", "ACS_BBLOCK", "ACS_LBLOCK", "ACS_RBLOCK", "ACS_A_ORDINAL", "ACS_O_ORDINAL", "ACS_INV_BANG", "ACS_INV_QUERY", "ACS_LEFT_ANG_QU", "ACS_RIGHT_ANG_QU", "ACS_CENTER_SQU", "ACS_F_WITH_HOOK", #endif }; const chtype acs_values[] = { ACS_ULCORNER, ACS_URCORNER, ACS_LLCORNER, ACS_LRCORNER, ACS_LTEE, ACS_RTEE, ACS_TTEE, ACS_BTEE, ACS_HLINE, ACS_VLINE, ACS_PLUS, #ifdef ACS_D_ULCORNER ACS_D_ULCORNER, ACS_D_URCORNER, ACS_D_LLCORNER, ACS_D_LRCORNER, ACS_D_LTEE, ACS_D_RTEE, ACS_D_TTEE, ACS_D_BTEE, ACS_D_HLINE, ACS_D_VLINE, ACS_D_PLUS, #endif #ifdef ACS_SD_ULCORNER ACS_SD_ULCORNER, ACS_SD_URCORNER, ACS_SD_LLCORNER, ACS_SD_LRCORNER, ACS_SD_LTEE, ACS_SD_RTEE, ACS_SD_TTEE, ACS_SD_BTEE, ACS_SD_PLUS, ACS_DS_ULCORNER, ACS_DS_URCORNER, ACS_DS_LLCORNER, ACS_DS_LRCORNER, ACS_DS_LTEE, ACS_DS_RTEE, ACS_DS_TTEE, ACS_DS_BTEE, ACS_DS_PLUS, #endif ACS_S1, #ifdef ACS_S3 ACS_S3, ACS_S7, #endif ACS_S9, ACS_DIAMOND, #ifdef ACS_CLUB ACS_CLUB, ACS_SPADE, ACS_HEART, ACS_LTBOARD, #endif ACS_BOARD, ACS_CKBOARD, ACS_DEGREE, ACS_PLMINUS, ACS_BULLET, #ifdef ACS_SM_BULLET ACS_SM_BULLET, ACS_MED_BULLET, ACS_WHITE_BULLET, ACS_PILCROW, ACS_SECTION, ACS_SMILE, ACS_REV_SMILE, #endif ACS_LARROW, ACS_RARROW, ACS_UARROW, ACS_DARROW, ACS_LANTERN, ACS_BLOCK, #ifdef ACS_LEQUAL ACS_LEQUAL, ACS_GEQUAL, ACS_NEQUAL, ACS_PI, ACS_STERLING, #endif #ifdef ACS_CENT ACS_CENT, ACS_YEN, ACS_PESETA, ACS_ALPHA, ACS_BETA, ACS_GAMMA, ACS_UP_SIGMA, ACS_LO_SIGMA, ACS_MU, ACS_TAU, ACS_UP_PHI, ACS_LO_PHI, ACS_OMEGA, ACS_DELTA, ACS_INFINITY, ACS_THETA, ACS_EPSILON, ACS_INTERSECT, ACS_SUP2, ACS_SUP_N, ACS_TRIPLE_BAR, ACS_APPROX_EQ, ACS_SQUARE_ROOT, ACS_NOT, ACS_REV_NOT, ACS_HALF, ACS_QUARTER, ACS_DIVISION, ACS_UP_INTEGRAL, ACS_LO_INTEGRAL, ACS_UBLOCK, ACS_BBLOCK, ACS_LBLOCK, ACS_RBLOCK, ACS_A_ORDINAL, ACS_O_ORDINAL, ACS_INV_BANG, ACS_INV_QUERY, ACS_LEFT_ANG_QU, ACS_RIGHT_ANG_QU, ACS_CENTER_SQU, ACS_F_WITH_HOOK, #endif }; #ifdef WACS_S1 const cchar_t *wacs_values[] = { WACS_ULCORNER, WACS_URCORNER, WACS_LLCORNER, WACS_LRCORNER, WACS_LTEE, WACS_RTEE, WACS_TTEE, WACS_BTEE, WACS_HLINE, WACS_VLINE, WACS_PLUS, #ifdef WACS_D_ULCORNER WACS_D_ULCORNER, WACS_D_URCORNER, WACS_D_LLCORNER, WACS_D_LRCORNER, WACS_D_LTEE, WACS_D_RTEE, WACS_D_TTEE, WACS_D_BTEE, WACS_D_HLINE, WACS_D_VLINE, WACS_D_PLUS, #endif #ifdef WACS_SD_ULCORNER WACS_SD_ULCORNER, WACS_SD_URCORNER, WACS_SD_LLCORNER, WACS_SD_LRCORNER, WACS_SD_LTEE, WACS_SD_RTEE, WACS_SD_TTEE, WACS_SD_BTEE, WACS_SD_PLUS, WACS_DS_ULCORNER, WACS_DS_URCORNER, WACS_DS_LLCORNER, WACS_DS_LRCORNER, WACS_DS_LTEE, WACS_DS_RTEE, WACS_DS_TTEE, WACS_DS_BTEE, WACS_DS_PLUS, #endif WACS_S1, #ifdef WACS_S3 WACS_S3, WACS_S7, #endif WACS_S9, WACS_DIAMOND, #ifdef WACS_CLUB WACS_CLUB, WACS_SPADE, WACS_HEART, WACS_LTBOARD, #endif WACS_BOARD, WACS_CKBOARD, WACS_DEGREE, WACS_PLMINUS, WACS_BULLET, #ifdef WACS_SM_BULLET WACS_SM_BULLET, WACS_MED_BULLET, WACS_WHITE_BULLET, WACS_PILCROW, WACS_SECTION, WACS_SMILE, WACS_REV_SMILE, #endif WACS_LARROW, WACS_RARROW, WACS_UARROW, WACS_DARROW, WACS_LANTERN, WACS_BLOCK, #ifdef WACS_LEQUAL WACS_LEQUAL, WACS_GEQUAL, WACS_NEQUAL, WACS_PI, WACS_STERLING, #endif #ifdef WACS_CENT WACS_CENT, WACS_YEN, WACS_PESETA, WACS_ALPHA, WACS_BETA, WACS_GAMMA, WACS_UP_SIGMA, WACS_LO_SIGMA, WACS_MU, WACS_TAU, WACS_UP_PHI, WACS_LO_PHI, WACS_OMEGA, WACS_DELTA, WACS_INFINITY, WACS_THETA, WACS_EPSILON, WACS_INTERSECT, WACS_SUP2, WACS_SUP_N, WACS_TRIPLE_BAR, WACS_APPROX_EQ, WACS_SQUARE_ROOT, WACS_NOT, WACS_REV_NOT, WACS_HALF, WACS_QUARTER, WACS_DIVISION, WACS_UP_INTEGRAL, WACS_LO_INTEGRAL, WACS_UBLOCK, WACS_BBLOCK, WACS_LBLOCK, WACS_RBLOCK, WACS_A_ORDINAL, WACS_O_ORDINAL, WACS_INV_BANG, WACS_INV_QUERY, WACS_LEFT_ANG_QU, WACS_RIGHT_ANG_QU, WACS_CENTER_SQU, WACS_F_WITH_HOOK, #endif /* #if WACS_CENT */ }; #endif /* #ifdef WACS_S1 */ #ifdef WACS_S1 static const wchar_t russian[] = {0x0420, 0x0443, 0x0441, 0x0441, 0x043a, 0x0438, 0x0439, L' ', 0x044f, 0x0437, 0x044b, 0x043a, 0}; static const wchar_t greek[] = {0x0395, 0x03bb, 0x03bb, 0x03b7, 0x03bd, 0x03b9, 0x03ba, 0x03ac, 0}; static const wchar_t georgian[] = {0x10e5, 0x10d0, 0x10e0, 0x10d7, 0x10e3, 0x10da, 0x10d8, L' ', 0x10d4, 0x10dc, 0x10d0, 0}; static const wchar_t fullwidth[] = { 0xff26, 0xff55, 0xff4c, 0xff4c, 0xff57, 0xff49, 0xff44, 0xff54, 0xff48, 0 }; /* "Fullwidth" */ static const wchar_t combining_marks[] = { L'C', L'o', 0x35c, L'm', L'b', 0x30a, L'i', L'n', L'i', 0x304, L'n', 0x30b, 0x329, L'g', 0x310, L' ', L'C', 0x338, L'h', 0x306, L'a', 0x361, L'r', L's', 0x30e, 0x348, 0 }; #endif int i, tmarg = 1, ncols = (COLS - 4) / 19; int col_size = (COLS - 4) / ncols; int n_items = sizeof( acs_names) / sizeof( acs_names[0]); int n_rows = LINES / 2 - 4; i = 0; while( i < n_items) { int j, xloc = 3; attrset(A_BOLD); mvaddstr( 1, (COLS - 23) / 2, "Alternate Character Set"); attrset(A_NORMAL); tmarg = 4; while( i < n_items && xloc < COLS - col_size) { for( j = 0; i < n_items && j < n_rows; j++, i++) { move( j * 2 + tmarg, xloc); addch(acs_values[i]); printw(" %s", acs_names[i]); } xloc += col_size; } mvaddstr( tmarg + n_rows * 2, 3, curses_version( )); move( tmarg + n_rows * 2 + 1, 3); printw( "sizeof( chtype) = %d; sizeof( mmask_t) = %d", (int)sizeof( chtype), (int)sizeof( mmask_t)); mvaddstr(tmarg + n_rows * 2 + 2, 3, "Press any key to continue"); getch(); clear( ); } #if HAVE_WIDE i = 0; while( i < n_items) { int j, xloc = 3; attrset(A_BOLD); mvaddstr( 1, (COLS - 28) / 2, "Wide Alternate Character Set"); attrset(A_NORMAL); tmarg = 4; #ifdef WACS_S1 while( i < n_items && xloc < COLS - col_size) { for( j = 0; i < n_items && j < n_rows; j++, i++) { move( j * 2 + tmarg, xloc); add_wch( wacs_values[i]); printw(" W%s", acs_names[i]); } xloc += col_size; } #endif /* Spanish, Russian, Greek, Georgian, fullwidth, combining */ tmarg += n_rows * 2; mvaddwstr(tmarg, COLS / 8 - 5, L"Espa\xf1ol"); mvaddwstr(tmarg, 3 * (COLS / 8) - 5, russian); mvaddwstr(tmarg, 5 * (COLS / 8) - 5, greek); mvaddwstr(tmarg, 7 * (COLS / 8) - 5, georgian); mvaddwstr(tmarg + 1, COLS / 8 - 5, fullwidth); mvaddwstr(tmarg + 1, 3 * (COLS / 8) - 5, combining_marks); #if(CHTYPE_LONG >= 2) /* "non-standard" 64-bit chtypes */ mvaddch( tmarg + 1, 7 * (COLS / 8) - 5, (chtype)0x1d11e); #endif /* U+1D11E = musical symbol G clef */ mvaddstr(tmarg + 2, 3, "Press any key to continue"); getch(); clear( ); } #endif } #if HAVE_COLOR #if CHTYPE_LONG >= 2 || (CHTYPE_LONG == 1 && !defined( PDC_WIDE)) #define GOT_DIM #ifdef A_OVERLINE #define GOT_OVERLINE #endif #ifdef A_STIKEOUT #define GOT_STRIKEOUT #endif #endif void colorTest(WINDOW *win) { static const short colors[] = { COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_CYAN, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE }; static const char *colornames[] = { "COLOR_BLACK", "COLOR_RED", "COLOR_GREEN", "COLOR_BLUE", "COLOR_CYAN", "COLOR_MAGENTA", "COLOR_YELLOW", "COLOR_WHITE" }; chtype fill = ACS_BLOCK; int i, j, tmarg, col1, col2, col3, col4, ch; if (!has_colors()) return; do { tmarg = (LINES - 19) / 2; col1 = (COLS - 60) / 2; col2 = col1 + 15; col3 = col2 + 15; col4 = col3 + 15; attrset(A_BOLD); mvaddstr(tmarg, (COLS - 22) / 2, "Color Attribute Macros"); attrset(A_NORMAL); mvaddstr(tmarg + 3, col2 + 2, "A_NORMAL"); mvaddstr(tmarg + 3, col3 + 3, "A_BOLD"); mvaddstr(tmarg + 3, col4 + 3, "A_BLINK"); for (i = 0; i < 8; i++) { init_pair((short)(i + 4), colors[i], background_index); mvaddstr(tmarg + i + 5, col1, colornames[i]); for (j = 0; j < 12; j++) { mvaddch(tmarg + i + 5, col2 + j, fill | COLOR_PAIR(i + 4)); mvaddch(tmarg + i + 5, col3 + j, fill | COLOR_PAIR(i + 4) | A_BOLD); mvaddch(tmarg + i + 5, col4 + j, fill | COLOR_PAIR(i + 4) | A_BLINK); } attrset( COLOR_PAIR( i + 4) | A_BLINK); mvaddstr( tmarg + i + 5, col4 + 5, "Text"); attrset( COLOR_PAIR( i + 4) | A_BOLD); mvaddstr( tmarg + i + 5, col3 + 5, "Text"); attroff( A_BOLD); mvaddstr( tmarg + i + 5, col2 + 5, "Text"); attrset( A_NORMAL); } mvprintw(tmarg + 15, col1, "COLORS = %d", COLORS); mvprintw(tmarg + 16, col1, "COLOR_PAIRS = %d", COLOR_PAIRS); #ifdef CHTYPE_LONG attrset(A_ITALIC); mvprintw( tmarg + 15, col3, "Italic"); attrset(A_ITALIC | A_BLINK); mvprintw( tmarg + 15, col4, "Italic Blink"); attrset(A_BOLD | A_ITALIC); mvprintw( tmarg + 17, col4, "Italic Bold"); attrset(A_BOLD | A_ITALIC | A_BLINK); mvprintw( tmarg + 18, col4, "Italic Blink Bold"); #endif attrset(A_BOLD); mvprintw( tmarg + 16, col3, "Bold"); attrset(A_BLINK); mvprintw( tmarg + 17, col3, "Blink"); attrset(A_BLINK | A_BOLD); mvprintw( tmarg + 16, col4, "Blink Bold"); /* end BJG addenda */ attrset(A_NORMAL); mvaddstr(tmarg + 19, 3, "Press any key to continue"); ch = getch(); # ifdef PDCURSES if( ch == KEY_RESIZE) { erase(); resize_term(0, 0); } # endif } while( ch == KEY_RESIZE); if (can_change_color()) { struct { short red, green, blue; } orgcolors[16]; int MAXCOL = (COLORS >= 16) ? 16 : 8; if (MAXCOL < 8) return; for (i = 0; i < MAXCOL; i++) color_content((short)i, &(orgcolors[i].red), &(orgcolors[i].green), &(orgcolors[i].blue)); attrset(A_BOLD); mvaddstr(tmarg, (COLS - 22) / 2, " init_color() Example "); attrset(A_NORMAL); refresh(); for (i = 0; i < 8; i++) { init_color(colors[i], (short)(i * 125), 0, (short)(i * 125)); if (MAXCOL == 16) init_color((short)(colors[i] + 8), 0, (short)(i * 125), 0); } mvaddstr(tmarg + 19, 3, "Press any key to continue"); getch(); for (i = 0; i < MAXCOL; i++) init_color((short)i, orgcolors[i].red, orgcolors[i].green, orgcolors[i].blue); } if (COLORS >= 256) do { int x, y, z, lmarg = (COLS - 77) / 2; erase(); attrset(A_BOLD); mvaddstr(tmarg, (COLS - 15) / 2, "Extended Colors"); attrset(A_NORMAL); mvaddstr(tmarg + 3, lmarg, "6x6x6 Color Cube (16-231):"); for (i = 16; i < 256; i++) init_pair(i, COLOR_BLACK, i); for (i = 16, z = 0; z < 6; z++) for (y = 0; y < 6; y++) for (x = 0; x < 6; x++) { chtype ch = ' ' | COLOR_PAIR(i++); mvaddch(tmarg + 5 + y, z * 13 + x * 2 + lmarg, ch); addch(ch); } mvaddstr(tmarg + 13, lmarg, "Greyscale (232-255):"); for (x = 0; x < 24; x++) { chtype ch = ' ' | COLOR_PAIR(232 + x); mvaddch(tmarg + 15, x * 2 + lmarg, ch); addch(ch); } #ifdef CHTYPE_LONG attrset( A_LEFTLINE); mvaddstr( tmarg + 17, col1, "A_LEFTLINE"); attrset( A_UNDERLINE); mvaddstr( tmarg + 18, col1, "A_UNDERLINE"); attrset( A_RIGHTLINE); mvaddstr( tmarg + 19, col1, "A_RIGHTLINE"); #endif #ifdef GOT_OVERLINE attrset( A_OVERLINE); mvaddstr( tmarg + 17, col2, "A_OVERLINE"); #ifdef GOT_STRIKEOUT attrset( A_STRIKEOUT); mvaddstr( tmarg + 18, col2, "A_STRIKEOUT"); #endif attrset( A_OVERLINE | A_UNDERLINE); mvaddstr( tmarg + 19, col2, "Over/underlined"); #endif attrset(A_NORMAL); refresh( ); ch = getch( ); # ifdef PDCURSES if( ch == KEY_RESIZE) resize_term(0, 0); # endif } while( ch == KEY_RESIZE); } #endif #if HAVE_WIDE void wideTest(WINDOW *win) { wchar_t tmp[513]; size_t i; attrset(A_BOLD); mvaddstr(1, (COLS - 25) / 2, "Wide Character Input Test"); attrset(A_NORMAL); mvaddstr(4, 1, "Enter a string: "); echo(); get_wstr((wint_t *)tmp); addstr("\n\n String:\n\n "); addwstr(tmp); addstr("\n\n\n Hex:\n\n "); for (i = 0; i < wcslen(tmp); i++) { printw("%04x ", tmp[i]); addnwstr(tmp + i, 1); addstr(" "); } noecho(); Continue2(); } #endif void display_menu(int old_option, int new_option) { int lmarg = (COLS - 14) / 2, tmarg = (LINES - (MAX_OPTIONS + 2)) / 2; if (old_option == -1) { int i; attrset(A_BOLD); mvaddstr(tmarg - 3, lmarg - 5, "PDCurses Test Program"); attrset(A_NORMAL); for (i = 0; i < MAX_OPTIONS; i++) mvaddstr(tmarg + i, lmarg, command[i].text); } else mvaddstr(tmarg + old_option, lmarg, command[old_option].text); attrset(A_REVERSE); mvaddstr(tmarg + new_option, lmarg, command[new_option].text); attrset(A_NORMAL); mvaddstr(tmarg + MAX_OPTIONS + 2, lmarg - 23, "Use Up and Down Arrows to select - Enter to run - Q to quit"); refresh(); } curses-1.4.4/vendor/PDCurses/demos/firework.c0000644000004100000410000000564514201713275021160 0ustar www-datawww-data#include #include #include #include #include #include #include #define DELAYSIZE 100 void myrefresh(void); void get_color(void); void explode(int, int); short color_table[] = { COLOR_RED, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN, COLOR_RED, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE }; int main(int argc, char **argv) { int i, start, end, row, diff, flag, direction, seed; #ifdef XCURSES Xinitscr(argc, argv); #else initscr(); #endif nodelay(stdscr, TRUE); noecho(); if (has_colors()) start_color(); for (i = 0; i < 8; i++) init_pair( (short)i, color_table[i], COLOR_BLACK); seed = (int)time((time_t *)0); srand(seed); flag = 0; while (getch() == ERR) /* loop until a key is hit */ { do { start = rand() % (COLS - 5) + 2; end = rand() % (COLS - 5) + 2; direction = (start > end) ? -1 : 1; diff = abs(start - end); } while (diff < 2 || diff >= LINES - 2); attrset(A_NORMAL); for (row = 0; row < diff; row++) { mvaddstr(LINES - row, row * direction + start, (direction < 0) ? "\\" : "/"); if (flag++) { myrefresh(); erase(); flag = 0; } } if (flag++) { myrefresh(); flag = 0; } explode(LINES - row, diff * direction + start); erase(); myrefresh(); } endwin(); return 0; } void explode(int row, int col) { erase(); mvaddstr(row, col, "-"); myrefresh(); --col; get_color(); mvaddstr(row - 1, col, " - "); mvaddstr(row, col, "-+-"); mvaddstr(row + 1, col, " - "); myrefresh(); --col; get_color(); mvaddstr(row - 2, col, " --- "); mvaddstr(row - 1, col, "-+++-"); mvaddstr(row, col, "-+#+-"); mvaddstr(row + 1, col, "-+++-"); mvaddstr(row + 2, col, " --- "); myrefresh(); get_color(); mvaddstr(row - 2, col, " +++ "); mvaddstr(row - 1, col, "++#++"); mvaddstr(row, col, "+# #+"); mvaddstr(row + 1, col, "++#++"); mvaddstr(row + 2, col, " +++ "); myrefresh(); get_color(); mvaddstr(row - 2, col, " # "); mvaddstr(row - 1, col, "## ##"); mvaddstr(row, col, "# #"); mvaddstr(row + 1, col, "## ##"); mvaddstr(row + 2, col, " # "); myrefresh(); get_color(); mvaddstr(row - 2, col, " # # "); mvaddstr(row - 1, col, "# #"); mvaddstr(row, col, " "); mvaddstr(row + 1, col, "# #"); mvaddstr(row + 2, col, " # # "); myrefresh(); } void myrefresh(void) { napms(DELAYSIZE); move(LINES - 1, COLS - 1); refresh(); } void get_color(void) { chtype bold = (rand() % 2) ? A_BOLD : A_NORMAL; attrset(COLOR_PAIR(rand() % 8) | bold); } curses-1.4.4/vendor/PDCurses/demos/version.c0000644000004100000410000000466714201713275021020 0ustar www-datawww-data#include #include /* Example usage of the PDC_version structure declared in curses.h. The general idea is that, while we have various macros defined to tell us which version of PDCurses we're using (PDC_VER_MAJOR, PDC_VER_MINOR, PDC_WIDE, etc.), these may not match the library to which we are linked; it may have been compiled with different flags, or a different chtype size (16, 32, or 64-bit), etc. This is a small issue with static libraries, but with DLLs (Windows and OS/2) or shared libraries (*nix and *BSD), we may not really control which DLL/shared library happens to be available. In such cases, the PDC_version structure (declared within the library but global/available to the application) tells us how the library was compiled. Note that this can be used even though we never call initscr(). The idea is that version checking can be done without attempting function calls, some of which would fail if (for example) the library had been compiled with wide characters and the application had not, or the version numbers didn't match, or the size of chtypes differed. */ int main( const int argc, const char **argv) { static const char *port_text[] = { "X11", "Win32 console", "Win32a", "DOS", "OS/2", "SDL1", "SDL2", "VT" }; printf( "Compiled as version %d.%d.%d, chtype size %d\n", PDC_VER_MAJOR, PDC_VER_MINOR, PDC_VER_CHANGE, (int)sizeof( chtype)); #ifdef PDC_WIDE printf( "Compiled with PDC_WIDE defined\n"); #else printf( "Compiled with PDC_WIDE undefined\n"); #endif #ifdef PDC_FORCE_UTF8 printf( "Compiled with PDC_FORCE_UTF8 defined\n"); #else printf( "Compiled with PDC_FORCE_UTF8 undefined\n"); #endif printf( "\nInformation on the library :\n"); printf( "PDCurses version %d.%d.%d, chtype size %d\n", PDC_version.ver_major, PDC_version.ver_minor, PDC_version.ver_change, (int)PDC_version.chtype_size); printf( "Port %d (%s)\n", PDC_version.port, port_text[PDC_version.port]); printf( "is_wide = %d is_utf8 = %d\n", PDC_version.is_wide, PDC_version.is_forced_utf8); printf( "longname is '%s'\n", longname( )); printf( "Curses version string is '%s'\n", curses_version( )); if( PDC_version.ver_major != PDC_VER_MAJOR || PDC_version.ver_minor != PDC_VER_MINOR || PDC_version.ver_change != PDC_VER_CHANGE) printf( "Versions do not match!\n"); return( 0); } curses-1.4.4/vendor/PDCurses/demos/newtest.c0000644000004100000410000004631414201713275021017 0ustar www-datawww-data/* * newtest.c - Tests certain PDCurses functions, * mostly those in Win32a, including some of the * new attributes for 64-bit chtype. I wanted to be * sure the PDC_set_blink and PDC_set_line_color * functions worked, and that A_OVERLINE and A_STRIKEOUT * displayed properly. Also tests "extended" SLK functions. * */ #ifndef _XOPEN_SOURCE_EXTENDED # define _XOPEN_SOURCE_EXTENDED 1 #endif #ifdef PDC_WIDE #define HAVE_WIDE #include #include #endif #ifdef HAVE_NCURSESW #define HAVE_WIDE #include #include #endif #ifndef HAVE_WIDE #include #endif #include #include #include #include int PDC_write_screen_to_file( const char *filename, WINDOW *win); static const char *labels[] = { "Quit", "Blink", "No labels", "431", "2134", "55", "62-really-longer-than-it-should-be-just-for-testing", "83", "7", "b", "25", "Able", "Baker", "Charlie", "Dog", "Easy", "Fox", "Golf", "How", "Item", "Jig", "King", "Love", "Mike", "Nan", "Oboe", "Peter", "Queen", "Roger", "Sugar", "Tear", "Uncle", "Victor", "Whiskey", "X-Ray", "Yoke", "Zebra", NULL }; static void slk_setup( const int slk_format) { int i; #ifdef PDCURSES static int old_format = 0xa; if( slk_format != old_format) slk_init( slk_format); old_format = slk_format; #endif for( i = 0; labels[i]; i++) slk_set( i + 1, labels[i], 1); slk_refresh( ); } /* Uses the left/right/under/overline capabilities of Win32a */ /* to ensure the text is "boxed". */ void text_in_a_box( const char *istr) { const int len = (int)strlen( istr); #ifdef CHTYPE_LONG attron( A_OVERLINE | A_UNDERLINE | A_LEFTLINE); if( len == 1) attron( A_RIGHTLINE); #endif addnstr( istr, 1); if( len > 1) { #ifdef CHTYPE_LONG attroff( A_LEFTLINE); #endif if( len > 2) addnstr( istr + 1, len - 2); #ifdef CHTYPE_LONG attron( A_RIGHTLINE); #endif addnstr( istr + len - 1, 1); } #ifdef CHTYPE_LONG attroff( A_OVERLINE | A_UNDERLINE | A_LEFTLINE | A_RIGHTLINE); #endif } #define COL1 2 #define COL2 (COL1 + 30) #define COL3 72 #define N_CURSORS 9 /* There are nine different cursor types; see below for the list. */ /* You specify two types, and the cursor blinks between them. */ /* Default is between "underline" and "invisible". Set both states */ /* to the same value to get an unblinking cursor. */ #if defined( _WIN32) && !defined( __BORLANDC__) #define PURE_WINDOWS_VERSION 1 #endif /* Among other things, 'newtest' demonstrates how to make a Win32a PDCurses app that is a for-real, "pure Windows" version (instead of a console application). Doing this is quite easy, and has certain advantages. If the app is invoked from a command prompt, the only difference you'll see is that the app runs separately (that is, you can continue to use the command prompt, switching between it, your PDCurses/Win32a app, and other processes). Which is the main reason I did it; it meant that I could invoke a PDCurses-based text editor, for example, and still have use of the command line. (NOTE that, for reasons I don't actually understand, this happens when the Visual C++ compiler is used. With MinGW or OpenWatcom, it's still "really" a console app.) To do it, we ensure that the usual main() function has an alternative dummy_main() form, taking the same arguments as main(). We add a WinMain() function, whose sole purpose is to reformulate lpszCmdLine into argc/argv form, and pass it on to dummy_main(). And, of course, we can switch back to a "normal" console app by removing the above #define PURE_WINDOWS_VERSION line. */ #ifdef PURE_WINDOWS_VERSION #undef MOUSE_MOVED #include int dummy_main( int argc, char **argv); int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) { char *argv[30]; int i, argc = 1; argv[0] = "newtest"; for( i = 0; lpszCmdLine[i]; i++) if( lpszCmdLine[i] != ' ' && (!i || lpszCmdLine[i - 1] == ' ')) argv[argc++] = lpszCmdLine + i; for( i = 0; lpszCmdLine[i]; i++) if( lpszCmdLine[i] == ' ') lpszCmdLine[i] = '\0'; return dummy_main( argc, (char **)argv); } int dummy_main( int argc, char **argv) #else /* "usual", console-app version: */ int main( int argc, char **argv) #endif { int quit = 0, i, use_slk = 1; bool show_mouse_moves = false; #ifdef PDCURSES bool blink_state = FALSE; int fmt = 0xa; const char *title_text = "NewTest: tests various PDCurses features"; #else int fmt = 3; /* for ncurses, this is the 4-4-4 SLK format */ #endif int cursor_state_1 = 0, cursor_state_2 = 1; int cursor_y = 19, cursor_x = 51; int show_slk_index_line = 0; int redraw = 1; unsigned extra_character_to_show = 0; #ifdef HAVE_WIDE unsigned unicode_offset = 0x80; #endif setlocale(LC_ALL, ""); ttytype[0] = 25; ttytype[1] = 90; /* Allow 25 to 90 lines... */ ttytype[2] = 80; ttytype[3] = (char)200; /* ...and 80 to 200 columns */ /* (This program gets weird artifacts when smaller than 25x80.) */ for( i = 1; i < argc; i++) if( argv[i][0] == '-') switch( argv[i][1]) { case 's': use_slk = 0; break; case 'l': setlocale( LC_ALL, argv[i] + 2); break; case 'e': sscanf( argv[i] + 2, "%x", &extra_character_to_show); break; case 'f': sscanf( argv[i] + 2, "%x", (unsigned *)&fmt); break; case 'i': show_slk_index_line = 1; break; case 'r': /* allow user-resizable windows */ { int min_lines, max_lines, min_cols, max_cols; if( sscanf( argv[i] + 2, "%d,%d,%d,%d", &min_lines, &max_lines, &min_cols, &max_cols) == 4) { ttytype[0] = min_lines; ttytype[1] = max_lines; ttytype[2] = min_cols; ttytype[3] = max_cols; } } break; case 'd': /* set window size before initscr */ { int n_lines, n_cols; if( sscanf( argv[i] + 2, "%d,%d", &n_lines, &n_cols) == 2) resize_term( n_lines, n_cols); } break; #ifdef PDCURSES case 'z': traceon( ); PDC_debug( "Debugging is on\n"); break; case 't': title_text = argv[i] + 2; break; #endif #ifdef HAVE_WIDE case 'u': sscanf( argv[i] + 2, "%x", &unicode_offset); break; #endif case 'm': show_mouse_moves = true; break; default: printf( "Option '%s' unrecognized\n", argv[i]); break; } if( use_slk) slk_init( show_slk_index_line ? -fmt : fmt); #ifdef XCURSES Xinitscr(argc, argv); #else initscr(); #endif if( use_slk) slk_setup( show_slk_index_line ? -fmt : fmt); start_color(); # if defined(NCURSES_VERSION) || (defined(PDC_BUILD) && PDC_BUILD > 3000) use_default_colors(); # endif cbreak(); noecho(); clear(); refresh(); #ifdef __PDCURSES__ PDC_set_title( title_text); #endif keypad( stdscr, TRUE); init_pair( 1, COLOR_WHITE, COLOR_BLACK); init_pair( 2, COLOR_BLACK, COLOR_YELLOW); mousemask( ALL_MOUSE_EVENTS | (show_mouse_moves ? REPORT_MOUSE_POSITION : 0), NULL); attrset( COLOR_PAIR( 1)); while( !quit) { char buff[80]; const int xmax = getmaxx( stdscr); const int ymax = getmaxy( stdscr); const int color_block_start = 54; int c, color_block_cols = (xmax - color_block_start) / 2; const int color_block_lines = 19; const char *cursor_state_text[N_CURSORS] = { "Invisible (click to change) ", "Underscore (click to change)", "Block (click to change) ", "Outline (click to change) ", "Caret (click to change) ", "Half-block (click to change)", "Central (click to change) ", "Cross (click to change) ", "Heavy box (click to change) " }; if( color_block_cols < 0) color_block_cols = 0; if( redraw) { int line = 21; mvaddstr( 1, COL1, "'Normal' white-on-black"); mvaddstr( 2, COL1, longname( )); #if(CHTYPE_LONG >= 2) /* "non-standard" 64-bit chtypes */ attron( A_DIM); mvaddstr( 15, 41, "Dimmed text"); attroff( A_DIM); #endif #ifdef A_STANDOUT attron( A_STANDOUT); mvaddstr( 16, 41, "Standout text"); attroff( A_STANDOUT); #endif #ifdef HAVE_WIDE mvaddwstr( 3, COL1, L"'Normal' text, but wide"); #endif attron( A_BLINK); mvaddstr( 6, 40, "Blinking"); attron( A_BOLD); mvaddstr( 8, 40, "BlinkBold"); attron( A_ITALIC); mvaddstr( 0, COL2, "BlinkBoldItalic"); attrset( COLOR_PAIR( 3)); attron( A_UNDERLINE); #ifdef HAVE_WIDE mvaddstr( 1, COL2, "Underlined"); addwstr( L"WideUnder"); #endif attrset( COLOR_PAIR( 1)); attron( A_UNDERLINE | A_ITALIC); mvaddstr( 2, COL2, "UnderlinedItalic"); attrset( COLOR_PAIR( 2)); attron( A_BLINK); mvaddstr( 4, COL1, "Black-on-yellow blinking"); attrset( COLOR_PAIR( 1)); move( 4, COL2); text_in_a_box( "Text in a box"); #ifdef CHTYPE_LONG attrset( COLOR_PAIR( 6)); attron( A_STRIKEOUT); mvaddstr( 10, 40, "Strikeout"); attrset( COLOR_PAIR( 1)); #endif #ifdef HAVE_WIDE move( 11, 40); text_in_a_box( "Next Ucode pg"); if( unicode_offset) { move( 12, 40); text_in_a_box( "Prev Ucode pg"); } mvprintw( 13, 40, "U+%04x ", unicode_offset); #endif mvaddstr( 5, 1, " 0 1 2 3 4 5 6 7 8 9 a b c d e f"); for( i = 0; i < 8; i++) { char buff[4]; sprintf( buff, "%02x", #ifdef HAVE_WIDE (unsigned)( i * 16 + unicode_offset) & 0xff); #else (unsigned)( i * 16 + 128) & 0xff); #endif mvaddstr( 6 + i, 1, buff); mvaddstr( 6 + i, 36, buff); } for( i = 0; i < 128; i++) { /* Show extended characters: */ #ifdef HAVE_WIDE wchar_t buff[2]; buff[0] = (wchar_t)( i + unicode_offset); buff[1] = '\0'; mvaddwstr( 6 + i / 16, 4 + 2 * (i % 16), buff); #else move( 6 + i / 16, 4 + 2 * (i % 16)); addch( i + 128); #endif addch( ' '); } #if(CHTYPE_LONG >= 2) /* "non-standard" 64-bit chtypes */ for( i = 0; i < 3 && line < ymax; i++, line++) { /* Demonstrate full RGB color control: */ int j; const char *output_text[3] = { "Red on green to white on black | (you can get full RGB colors when desired,", "Blue on yellow to black on red | with palette coloring still being available)", "White on red to green on blue, underlined and italic" }; const int len = (int)strlen( output_text[i]); move( line, 1); for( j = 0; j < len && j + 1 < xmax; j++) { attr_t output_color; const int oval = j * 31 / len; const int reverse = 31 - oval; if( !i) output_color = A_RGB( 31, oval, oval, 0, reverse, 0); else if( i == 1) output_color = A_RGB( 0, 0, reverse, 31, reverse, 0); else { output_color = A_RGB( reverse, 31, reverse, reverse, 0, oval); output_color |= A_UNDERLINE | A_ITALIC; } attrset( output_color); addch( output_text[i][j]); } } #endif /* #if(CHTYPE_LONG >= 2) */ redraw = 0; attrset( COLOR_PAIR( 1)); if( extra_character_to_show && ymax > 23) mvaddch( 23, 63, (chtype)extra_character_to_show); #ifdef HAVE_WIDE for( i = 0; i < 6; i++) { static const wchar_t spanish[] = L"Espa\xf1ol"; static const wchar_t russian[] = {0x0420, 0x0443, 0x0441, 0x0441, 0x043a, 0x0438, 0x0439, L' ', 0x044f, 0x0437, 0x044b, 0x043a, 0}; static const wchar_t greek[] = {0x0395, 0x03bb, 0x03bb, 0x03b7, 0x03bd, 0x03b9, 0x03ba, 0x03ac, 0}; static const wchar_t georgian[] = {0x10e5, 0x10d0, 0x10e0, 0x10d7, 0x10e3, 0x10da, 0x10d8, L' ', 0x10d4, 0x10dc, 0x10d0, 0}; static const wchar_t fullwidth[] = { 0xff26, 0xff55, 0xff4c, 0xff4c, 0xff57, 0xff49, 0xff44, 0xff54, 0xff48, 0 }; /* "Fullwidth" */ static const wchar_t combining_marks[] = { L'C', L'o', 0x35c, L'm', L'b', 0x30a, L'i', L'n', L'i', 0x304, L'n', 0x30b, 0x329, L'g', 0x310, L' ', L'C', 0x338, L'h', 0x306, L'a', 0x361, L'r', L's', 0x30e, 0x348, 0 }; static const wchar_t *texts[6] = { spanish, russian, greek, georgian, fullwidth, combining_marks}; mvaddwstr( 15 + i / 2, 2 + 20 * (i % 2), texts[i]); } #if(CHTYPE_LONG >= 2) /* "non-standard" 64-bit chtypes */ mvaddch( line - 1, 58, (chtype)0x1d11e); #endif /* U+1D11E = musical symbol G clef */ line += 2; #endif mvaddstr( 19, 1, curses_version( )); #ifdef MAYBE_TRY_THIS_SOMEWHERE_ELSE mvaddstr( 1, COL3, "Click on cursor descriptions to"); mvaddstr( 2, COL3, "cycle through possible cursors"); mvaddstr( 3, COL3, "Click on colors at left to change"); mvaddstr( 4, COL3, "colors used for under/over/outlining"); mvaddstr( 5, COL3, "Click 'Blink' at bottom to toggle"); mvaddstr( 6, COL3, "'real' blinking vs. 'highlit' blink"); #endif } mvaddnstr( 19, color_block_start, cursor_state_text[cursor_state_1], xmax - color_block_start); mvaddnstr( 20, color_block_start, cursor_state_text[cursor_state_2], xmax - color_block_start); curs_set( (cursor_state_1 << 8) | cursor_state_2); for( i = 0; i < color_block_cols * color_block_lines; i++) { const int n_color_blocks = (COLOR_PAIRS < 256 ? COLOR_PAIRS : 256); attrset( COLOR_PAIR( i >= n_color_blocks ? 2 : i)); if( i > 2 && i < n_color_blocks) init_pair((short)i, (short)i, COLOR_BLACK); if( !(i % color_block_cols)) move( i / color_block_cols, color_block_start); attron( A_REVERSE); addstr( " "); } move( cursor_y, cursor_x); refresh(); c = getch( ); attrset( COLOR_PAIR( 1)); if( c == KEY_RESIZE) { redraw = 1; resize_term( 0, 0); } else if( c == KEY_F(1) || c == 27) quit = 1; #ifdef PDCURSES else if( c == KEY_F(2)) { blink_state ^= 1; PDC_set_blink( blink_state); } #endif else if( c == KEY_F(3)) /* toggle SLKs */ { use_slk ^= 1; if( use_slk) slk_restore( ); else slk_clear( ); } else if( c >= KEY_F(4) && c < KEY_F(12)) { sscanf( labels[c - KEY_F(1)], "%x", (unsigned *)&fmt); if( use_slk) slk_setup( show_slk_index_line ? -fmt : fmt); } if( c != KEY_MOUSE) { sprintf( buff, "Key %s", keyname( c)); if( !memcmp( buff + 4, "UNKNOWN", 7)) sprintf( buff + 11, " (%x)", c); strcat( buff, " hit "); buff[COL2 - COL1] = '\0'; mvaddstr( 0, COL1, buff); } else { MEVENT mouse_event; #ifdef __PDCURSES__ nc_getmouse( &mouse_event); #else getmouse( &mouse_event); #endif sprintf( buff, "Mouse at %d x %d: %x ", mouse_event.x, mouse_event.y, (unsigned)mouse_event.bstate); cursor_x = mouse_event.x; cursor_y = mouse_event.y; mvaddstr( 0, COL1, buff); if( mouse_event.x >= color_block_start && mouse_event.y < color_block_lines) { int new_color = (mouse_event.x - color_block_start) / 2 + mouse_event.y * color_block_cols; if( new_color >= 256) new_color = -1; #ifdef PDCURSES PDC_set_line_color( (short)new_color); #endif } #ifdef PDCURSES else if( mouse_event.x >= color_block_start) { int shift = ((mouse_event.bstate & BUTTON_MODIFIER_SHIFT) ? N_CURSORS - 1 : 1); if( mouse_event.y == 19) /* blink/non-blink toggle */ cursor_state_1 = (cursor_state_1 + shift) % N_CURSORS; else if( mouse_event.y == 20) /* cycle cursor state */ cursor_state_2 = (cursor_state_2 + shift) % N_CURSORS; } #endif #ifdef HAVE_WIDE else if( mouse_event.x >= 40 && mouse_event.x < 40 + 10) { if( mouse_event.y == 11) { redraw = 1; unicode_offset += 0x80; } else if( mouse_event.y == 12 && unicode_offset) { redraw = 1; unicode_offset -= 0x80; } } #endif } } endwin(); return 0; } curses-1.4.4/vendor/PDCurses/demos/xmas.c0000644000004100000410000005604014201713275020273 0ustar www-datawww-data/******************************************************************************/ /* asciixmas */ /* December 1989 Larry Bartz Indianapolis, IN */ /* */ /* */ /* I'm dreaming of an ascii character-based monochrome Christmas, */ /* Just like the one's I used to know! */ /* Via a full duplex communications channel, */ /* At 9600 bits per second, */ /* Even though it's kinda slow. */ /* */ /* I'm dreaming of an ascii character-based monochrome Christmas, */ /* With ev'ry C program I write! */ /* May your screen be merry and bright! */ /* And may all your Christmases be amber or green, */ /* (for reduced eyestrain and improved visibility)! */ /* */ /* */ /* */ /* IMPLEMENTATION */ /* */ /* Feel free to modify the defined string FROMWHO to reflect you, your */ /* organization, your site, whatever. */ /* */ /* This looks a lot better if you can turn off your cursor before execution. */ /* The cursor is distracting but it doesn't really ruin the show. */ /* */ /* At our site, we invoke this for our users just after login and the */ /* determination of terminal type. */ /* */ /* */ /* PORTABILITY */ /* */ /* I wrote this using only the very simplest curses functions so that it */ /* might be the most portable. I was personally able to test on five */ /* different cpu/UNIX combinations. */ /* */ /* */ /* COMPILE */ /* */ /* usually this: */ /* */ /* cc -O xmas.c -lcurses -o xmas -s */ /* */ /******************************************************************************/ #include #include void lil(WINDOW *); void midtop(WINDOW *); void bigtop(WINDOW *); void bigface(WINDOW *, chtype); void legs1(WINDOW *); void legs2(WINDOW *); void legs3(WINDOW *); void legs4(WINDOW *); void initdeer(void); void boxit(void); void seas(void); void greet(void); void fromwho(void); void del_msg(void); void tree(void); void balls(void); void star(void); void strng1(void); void strng2(void); void strng3(void); void strng4(void); void strng5(void); void blinkit(void); void reindeer(void); #define FROMWHO "From Larry Bartz, Mark Hessling and William McBrine" int y_pos, x_pos; WINDOW *treescrn, *treescrn2, *treescrn3, *treescrn4, *treescrn5, *treescrn6, *treescrn7, *treescrn8, *dotdeer0, *stardeer0, *lildeer0, *lildeer1, *lildeer2, *lildeer3, *middeer0, *middeer1, *middeer2, *middeer3, *bigdeer0, *bigdeer1, *bigdeer2, *bigdeer3, *bigdeer4, *lookdeer0, *lookdeer1, *lookdeer2, *lookdeer3, *lookdeer4, *w_holiday, *w_del_msg; int main(int argc, char **argv) { int loopy; #ifdef XCURSES Xinitscr(argc, argv); #else initscr(); #endif nodelay(stdscr, TRUE); noecho(); nonl(); refresh(); #ifdef A_COLOR if (has_colors()) start_color(); #endif curs_set(0); treescrn = newwin(16, 27, 3, 53); treescrn2 = newwin(16, 27, 3, 53); treescrn3 = newwin(16, 27, 3, 53); treescrn4 = newwin(16, 27, 3, 53); treescrn5 = newwin(16, 27, 3, 53); treescrn6 = newwin(16, 27, 3, 53); treescrn7 = newwin(16, 27, 3, 53); treescrn8 = newwin(16, 27, 3, 53); w_holiday = newwin(1, 26, 3, 27); w_del_msg = newwin(1, 12, 23, 60); mvwaddstr(w_holiday, 0, 0, "H A P P Y H O L I D A Y S"); initdeer(); clear(); werase(treescrn); touchwin(treescrn); werase(treescrn2); touchwin(treescrn2); werase(treescrn8); touchwin(treescrn8); refresh(); napms(1000); boxit(); del_msg(); napms(1000); seas(); del_msg(); napms(1000); greet(); del_msg(); napms(1000); fromwho(); del_msg(); napms(1000); tree(); napms(1000); balls(); napms(1000); star(); napms(1000); strng1(); strng2(); strng3(); strng4(); strng5(); /* set up the windows for our blinking trees */ /* **************************************** */ /* treescrn3 */ overlay(treescrn, treescrn3); /* balls */ mvwaddch(treescrn3, 4, 18, ' '); mvwaddch(treescrn3, 7, 6, ' '); mvwaddch(treescrn3, 8, 19, ' '); mvwaddch(treescrn3, 11, 22, ' '); /* star */ mvwaddch(treescrn3, 0, 12, '*'); /* strng1 */ mvwaddch(treescrn3, 3, 11, ' '); /* strng2 */ mvwaddch(treescrn3, 5, 13, ' '); mvwaddch(treescrn3, 6, 10, ' '); /* strng3 */ mvwaddch(treescrn3, 7, 16, ' '); mvwaddch(treescrn3, 7, 14, ' '); /* strng4 */ mvwaddch(treescrn3, 10, 13, ' '); mvwaddch(treescrn3, 10, 10, ' '); mvwaddch(treescrn3, 11, 8, ' '); /* strng5 */ mvwaddch(treescrn3, 11, 18, ' '); mvwaddch(treescrn3, 12, 13, ' '); /* treescrn4 */ overlay(treescrn, treescrn4); /* balls */ mvwaddch(treescrn4, 3, 9, ' '); mvwaddch(treescrn4, 4, 16, ' '); mvwaddch(treescrn4, 7, 6, ' '); mvwaddch(treescrn4, 8, 19, ' '); mvwaddch(treescrn4, 11, 2, ' '); mvwaddch(treescrn4, 12, 23, ' '); /* star */ mvwaddch(treescrn4, 0, 12, '*' | A_STANDOUT); /* strng1 */ mvwaddch(treescrn4, 3, 13, ' '); /* strng2 */ /* strng3 */ mvwaddch(treescrn4, 7, 15, ' '); mvwaddch(treescrn4, 8, 11, ' '); /* strng4 */ mvwaddch(treescrn4, 9, 16, ' '); mvwaddch(treescrn4, 10, 12, ' '); mvwaddch(treescrn4, 11, 8, ' '); /* strng5 */ mvwaddch(treescrn4, 11, 18, ' '); mvwaddch(treescrn4, 12, 14, ' '); /* treescrn5 */ overlay(treescrn, treescrn5); /* balls */ mvwaddch(treescrn5, 3, 15, ' '); mvwaddch(treescrn5, 10, 20, ' '); mvwaddch(treescrn5, 12, 1, ' '); /* star */ mvwaddch(treescrn5, 0, 12, '*'); /* strng1 */ mvwaddch(treescrn5, 3, 11, ' '); /* strng2 */ mvwaddch(treescrn5, 5, 12, ' '); /* strng3 */ mvwaddch(treescrn5, 7, 14, ' '); mvwaddch(treescrn5, 8, 10, ' '); /* strng4 */ mvwaddch(treescrn5, 9, 15, ' '); mvwaddch(treescrn5, 10, 11, ' '); mvwaddch(treescrn5, 11, 7, ' '); /* strng5 */ mvwaddch(treescrn5, 11, 17, ' '); mvwaddch(treescrn5, 12, 13, ' '); /* treescrn6 */ overlay(treescrn, treescrn6); /* balls */ mvwaddch(treescrn6, 6, 7, ' '); mvwaddch(treescrn6, 7, 18, ' '); mvwaddch(treescrn6, 10, 4, ' '); mvwaddch(treescrn6, 11, 23, ' '); /* star */ mvwaddch(treescrn6, 0, 12, '*' | A_STANDOUT); /* strng1 */ /* strng2 */ mvwaddch(treescrn6, 5, 11, ' '); /* strng3 */ mvwaddch(treescrn6, 7, 13, ' '); mvwaddch(treescrn6, 8, 9, ' '); /* strng4 */ mvwaddch(treescrn6, 9, 14, ' '); mvwaddch(treescrn6, 10, 10, ' '); mvwaddch(treescrn6, 11, 6, ' '); /* strng5 */ mvwaddch(treescrn6, 11, 16, ' '); mvwaddch(treescrn6, 12, 12, ' '); /* treescrn7 */ overlay(treescrn, treescrn7); /* balls */ mvwaddch(treescrn7, 3, 15, ' '); mvwaddch(treescrn7, 6, 7, ' '); mvwaddch(treescrn7, 7, 18, ' '); mvwaddch(treescrn7, 10, 4, ' '); mvwaddch(treescrn7, 11, 22, ' '); /* star */ mvwaddch(treescrn7, 0, 12, '*'); /* strng1 */ mvwaddch(treescrn7, 3, 12, ' '); /* strng2 */ mvwaddch(treescrn7, 5, 13, ' '); mvwaddch(treescrn7, 6, 9, ' '); /* strng3 */ mvwaddch(treescrn7, 7, 15, ' '); mvwaddch(treescrn7, 8, 11, ' '); /* strng4 */ mvwaddch(treescrn7, 9, 16, ' '); mvwaddch(treescrn7, 10, 12, ' '); mvwaddch(treescrn7, 11, 8, ' '); /* strng5 */ mvwaddch(treescrn7, 11, 18, ' '); mvwaddch(treescrn7, 12, 14, ' '); napms(1000); reindeer(); touchwin(w_holiday); wrefresh(w_holiday); wrefresh(w_del_msg); napms(1000); for (loopy = 0; loopy < 50; loopy++) blinkit(); clear(); refresh(); endwin(); return 0; } void lil(WINDOW *win) { mvwaddch(win, 0, 0, (chtype) 'V'); mvwaddch(win, 1, 0, (chtype) '@'); mvwaddch(win, 1, 3, (chtype) '~'); } void midtop(WINDOW *win) { mvwaddstr(win, 0, 2, "yy"); mvwaddstr(win, 1, 2, "0(=)~"); } void bigtop(WINDOW *win) { mvwaddstr(win, 0, 17, "\\/"); mvwaddstr(win, 0, 20, "\\/"); mvwaddch(win, 1, 18, (chtype) '\\'); mvwaddch(win, 1, 20, (chtype) '/'); mvwaddstr(win, 2, 19, "|_"); mvwaddstr(win, 3, 18, "/^0\\"); mvwaddstr(win, 4, 17, "//\\"); mvwaddch(win, 4, 22, (chtype) '\\'); mvwaddstr(win, 5, 7, "^~~~~~~~~// ~~U"); } void bigface(WINDOW *win, chtype noseattr) { mvwaddstr(win, 0, 16, "\\/ \\/"); mvwaddstr(win, 1, 17, "\\Y/ \\Y/"); mvwaddstr(win, 2, 19, "\\=/"); mvwaddstr(win, 3, 17, "^\\o o/^"); mvwaddstr(win, 4, 17, "//( )"); mvwaddstr(win, 5, 7, "^~~~~~~~~// \\"); waddch(win, 'O' | noseattr); waddstr(win, "/"); } void legs1(WINDOW *win) { mvwaddstr(win, 6, 7, "( \\_____( /"); mvwaddstr(win, 7, 8, "( ) /"); mvwaddstr(win, 8, 9, "\\\\ /"); mvwaddstr(win, 9, 11, "\\>/>"); } void legs2(WINDOW *win) { mvwaddstr(win, 6, 7, "(( )____( /"); mvwaddstr(win, 7, 7, "( / |"); mvwaddstr(win, 8, 8, "\\/ |"); mvwaddstr(win, 9, 9, "|> |>"); } void legs3(WINDOW *win) { mvwaddstr(win, 6, 6, "( ()_____( /"); mvwaddstr(win, 7, 6, "/ / /"); mvwaddstr(win, 8, 5, "|/ \\"); mvwaddstr(win, 9, 5, "/> \\>"); } void legs4(WINDOW *win) { mvwaddstr(win, 6, 6, "( )______( /"); mvwaddstr(win, 7, 5, "(/ \\"); mvwaddstr(win, 8, 0, "v___= ----^"); } void initdeer(void) { chtype noseattr; #ifdef A_COLOR if (has_colors()) { init_pair(31, COLOR_RED, COLOR_BLACK); noseattr = COLOR_PAIR(31); } else #endif noseattr = A_NORMAL; /* set up the windows for our various reindeer */ dotdeer0 = newwin(3, 71, 0, 8); stardeer0 = newwin(4, 56, 0, 8); lildeer0 = newwin(7, 54, 0, 8); middeer0 = newwin(15, 42, 0, 8); bigdeer0 = newwin(10, 23, 0, 0); lookdeer0 = newwin(10, 25, 0, 0); /* lildeer1 */ lildeer1 = newwin(2, 4, 0, 0); lil(lildeer1); mvwaddstr(lildeer1, 1, 1, "<>"); /* lildeer2 */ lildeer2 = newwin(2, 4, 0, 0); lil(lildeer2); mvwaddstr(lildeer2, 1, 1, "||"); /* lildeer3 */ lildeer3 = newwin(2, 4, 0, 0); lil(lildeer3); mvwaddstr(lildeer3, 1, 1, "><"); /* middeer1 */ middeer1 = newwin(3, 7, 0, 0); midtop(middeer1); mvwaddstr(middeer1, 2, 3, "\\/"); /* middeer2 */ middeer2 = newwin(3, 7, 0, 0); midtop(middeer2); mvwaddch(middeer2, 2, 3, (chtype) '|'); mvwaddch(middeer2, 2, 5, (chtype) '|'); /* middeer3 */ middeer3 = newwin(3, 7, 0, 0); midtop(middeer3); mvwaddch(middeer3, 2, 2, (chtype) '/'); mvwaddch(middeer3, 2, 6, (chtype) '\\'); /* bigdeer1 */ bigdeer1 = newwin(10, 23, 0, 0); bigtop(bigdeer1); legs1(bigdeer1); /* bigdeer2 */ bigdeer2 = newwin(10, 23, 0, 0); bigtop(bigdeer2); legs2(bigdeer2); /* bigdeer3 */ bigdeer3 = newwin(10, 23, 0, 0); bigtop(bigdeer3); legs3(bigdeer3); /* bigdeer4 */ bigdeer4 = newwin(10, 23, 0, 0); bigtop(bigdeer4); legs4(bigdeer4); /* lookdeer1 */ lookdeer1 = newwin(10, 25, 0, 0); bigface(lookdeer1, noseattr); legs1(lookdeer1); /* lookdeer2 */ lookdeer2 = newwin(10, 25, 0, 0); bigface(lookdeer2, noseattr); legs2(lookdeer2); /* lookdeer3 */ lookdeer3 = newwin(10, 25, 0, 0); bigface(lookdeer3, noseattr); legs3(lookdeer3); /* lookdeer4 */ lookdeer4 = newwin(10, 25, 0, 0); bigface(lookdeer4, noseattr); legs4(lookdeer4); } void boxit(void) { int x; for (x = 0; x < 20; ++x) mvaddch(x, 7, '|'); for (x = 0; x < 80; ++x) { if (x > 7) mvaddch(19, x, '_'); mvaddch(22, x, '_'); } } void seas(void) { mvaddch(4, 1, 'S'); mvaddch(6, 1, 'E'); mvaddch(8, 1, 'A'); mvaddch(10, 1, 'S'); mvaddch(12, 1, 'O'); mvaddch(14, 1, 'N'); mvaddch(16, 1, '`'); mvaddch(18, 1, 'S'); } void greet(void) { mvaddch(3, 5, 'G'); mvaddch(5, 5, 'R'); mvaddch(7, 5, 'E'); mvaddch(9, 5, 'E'); mvaddch(11, 5, 'T'); mvaddch(13, 5, 'I'); mvaddch(15, 5, 'N'); mvaddch(17, 5, 'G'); mvaddch(19, 5, 'S'); } void fromwho(void) { mvaddstr(21, 13, FROMWHO); } void del_msg(void) { refresh(); } void tree(void) { #ifdef A_COLOR if (has_colors()) { init_pair(30, COLOR_GREEN, COLOR_BLACK); wattrset(treescrn, COLOR_PAIR(30)); } #endif mvwaddch(treescrn, 1, 11, (chtype) '/'); mvwaddch(treescrn, 2, 11, (chtype) '/'); mvwaddch(treescrn, 3, 10, (chtype) '/'); mvwaddch(treescrn, 4, 9, (chtype) '/'); mvwaddch(treescrn, 5, 9, (chtype) '/'); mvwaddch(treescrn, 6, 8, (chtype) '/'); mvwaddch(treescrn, 7, 7, (chtype) '/'); mvwaddch(treescrn, 8, 6, (chtype) '/'); mvwaddch(treescrn, 9, 6, (chtype) '/'); mvwaddch(treescrn, 10, 5, (chtype) '/'); mvwaddch(treescrn, 11, 3, (chtype) '/'); mvwaddch(treescrn, 12, 2, (chtype) '/'); mvwaddch(treescrn, 1, 13, (chtype) '\\'); mvwaddch(treescrn, 2, 13, (chtype) '\\'); mvwaddch(treescrn, 3, 14, (chtype) '\\'); mvwaddch(treescrn, 4, 15, (chtype) '\\'); mvwaddch(treescrn, 5, 15, (chtype) '\\'); mvwaddch(treescrn, 6, 16, (chtype) '\\'); mvwaddch(treescrn, 7, 17, (chtype) '\\'); mvwaddch(treescrn, 8, 18, (chtype) '\\'); mvwaddch(treescrn, 9, 18, (chtype) '\\'); mvwaddch(treescrn, 10, 19, (chtype) '\\'); mvwaddch(treescrn, 11, 21, (chtype) '\\'); mvwaddch(treescrn, 12, 22, (chtype) '\\'); mvwaddch(treescrn, 4, 10, (chtype) '_'); mvwaddch(treescrn, 4, 14, (chtype) '_'); mvwaddch(treescrn, 8, 7, (chtype) '_'); mvwaddch(treescrn, 8, 17, (chtype) '_'); mvwaddstr(treescrn, 13, 0, "//////////// \\\\\\\\\\\\\\\\\\\\\\\\"); #ifdef A_COLOR if (has_colors()) { init_pair(20, COLOR_YELLOW, COLOR_BLACK); wattrset(treescrn, COLOR_PAIR(20)); } #endif mvwaddstr(treescrn, 14, 11, "| |"); mvwaddstr(treescrn, 15, 11, "|_|"); wrefresh(treescrn); wrefresh(w_del_msg); } void balls(void) { chtype ball1, ball2, ball3, ball4, ball5, ball6; overlay(treescrn, treescrn2); #ifdef A_COLOR if (has_colors()) { init_pair(1, COLOR_BLUE, COLOR_BLACK); init_pair(2, COLOR_RED, COLOR_BLACK); init_pair(3, COLOR_MAGENTA, COLOR_BLACK); init_pair(4, COLOR_CYAN, COLOR_BLACK); init_pair(5, COLOR_YELLOW, COLOR_BLACK); init_pair(6, COLOR_WHITE, COLOR_BLACK); ball1 = COLOR_PAIR(1) | '@'; ball2 = COLOR_PAIR(2) | '@'; ball3 = COLOR_PAIR(3) | '@'; ball4 = COLOR_PAIR(4) | '@'; ball5 = COLOR_PAIR(5) | '@'; ball6 = COLOR_PAIR(6) | '@'; } else #endif ball1 = ball2 = ball3 = ball4 = ball5 = ball6 = '@'; mvwaddch(treescrn2, 3, 9, ball1); mvwaddch(treescrn2, 3, 15, ball2); mvwaddch(treescrn2, 4, 8, ball3); mvwaddch(treescrn2, 4, 16, ball4); mvwaddch(treescrn2, 5, 7, ball5); mvwaddch(treescrn2, 5, 17, ball6); mvwaddch(treescrn2, 7, 6, ball1 | A_BOLD); mvwaddch(treescrn2, 7, 18, ball2 | A_BOLD); mvwaddch(treescrn2, 8, 5, ball3 | A_BOLD); mvwaddch(treescrn2, 8, 19, ball4 | A_BOLD); mvwaddch(treescrn2, 10, 4, ball5 | A_BOLD); mvwaddch(treescrn2, 10, 20, ball6 | A_BOLD); mvwaddch(treescrn2, 11, 2, ball1); mvwaddch(treescrn2, 11, 22, ball2); mvwaddch(treescrn2, 12, 1, ball3); mvwaddch(treescrn2, 12, 23, ball4); wrefresh(treescrn2); wrefresh(w_del_msg); } void star(void) { mvwaddch(treescrn2, 0, 12, (chtype) '*' | A_STANDOUT); wrefresh(treescrn2); wrefresh(w_del_msg); } void strng1(void) { #ifdef A_COLOR if (has_colors()) { init_pair(10, COLOR_YELLOW, COLOR_BLACK); wattrset(treescrn2, COLOR_PAIR(10) | A_BOLD); } #endif mvwaddstr(treescrn2, 3, 11, ".:'"); wrefresh(treescrn2); wrefresh(w_del_msg); } void strng2(void) { #ifdef A_COLOR if (has_colors()) { init_pair(11, COLOR_RED, COLOR_BLACK); wattrset(treescrn2, COLOR_PAIR(11) | A_BOLD); } #endif mvwaddstr(treescrn2, 5, 11, ",.:'"); mvwaddstr(treescrn2, 6, 9, ":'"); wrefresh(treescrn2); wrefresh(w_del_msg); } void strng3(void) { #ifdef A_COLOR if (has_colors()) { init_pair(12, COLOR_GREEN, COLOR_BLACK); wattrset(treescrn2, COLOR_PAIR(12) | A_BOLD); } #endif mvwaddstr(treescrn2, 7, 13, ",.:'"); mvwaddstr(treescrn2, 8, 9, ",.:'"); wrefresh(treescrn2); wrefresh(w_del_msg); } void strng4(void) { #ifdef A_COLOR if (has_colors()) { init_pair(13, COLOR_WHITE, COLOR_BLACK); wattrset(treescrn2, COLOR_PAIR(13) | A_BOLD); } #endif mvwaddstr(treescrn2, 9, 14, ",.:'"); mvwaddstr(treescrn2, 10, 10, ",.:'"); mvwaddstr(treescrn2, 11, 6, ",.:'"); mvwaddch(treescrn2, 12, 5, (chtype) '\''); wrefresh(treescrn2); wrefresh(w_del_msg); } void strng5(void) { #ifdef A_COLOR if (has_colors()) { init_pair(14, COLOR_CYAN, COLOR_BLACK); wattrset(treescrn2, COLOR_PAIR(14) | A_BOLD); } #endif mvwaddstr(treescrn2, 11, 16, ",.:'"); mvwaddstr(treescrn2, 12, 12, ",.:'"); /* save a fully lit tree */ overlay(treescrn2, treescrn); wrefresh(treescrn2); wrefresh(w_del_msg); } void blinkit(void) { static int cycle; if (cycle > 4) cycle = 0; touchwin(treescrn8); switch (cycle) { case 0: overlay(treescrn3, treescrn8); break; case 1: overlay(treescrn4, treescrn8); break; case 2: overlay(treescrn5, treescrn8); break; case 3: overlay(treescrn6, treescrn8); break; case 4: overlay(treescrn7, treescrn8); } wrefresh(treescrn8); wrefresh(w_del_msg); napms(50); touchwin(treescrn8); /*ALL ON************************************************** */ overlay(treescrn, treescrn8); wrefresh(treescrn8); wrefresh(w_del_msg); ++cycle; } #define TSHOW(win, pause) touchwin(win); wrefresh(win); \ wrefresh(w_del_msg); napms(pause) #define SHOW(win, pause) mvwin(win, y_pos, x_pos); wrefresh(win); \ wrefresh(w_del_msg); napms(pause) void reindeer(void) { int looper; y_pos = 0; for (x_pos = 70; x_pos > 62; x_pos--) { if (x_pos < 62) y_pos = 1; for (looper = 0; looper < 4; looper++) { mvwaddch(dotdeer0, y_pos, x_pos, (chtype) '.'); wrefresh(dotdeer0); wrefresh(w_del_msg); werase(dotdeer0); wrefresh(dotdeer0); wrefresh(w_del_msg); } } y_pos = 2; for (; x_pos > 50; x_pos--) { for (looper = 0; looper < 4; looper++) { if (x_pos < 56) { y_pos = 3; mvwaddch(stardeer0, y_pos, x_pos, (chtype) '*'); wrefresh(stardeer0); wrefresh(w_del_msg); werase(stardeer0); wrefresh(stardeer0); } else { mvwaddch(dotdeer0, y_pos, x_pos, (chtype) '*'); wrefresh(dotdeer0); wrefresh(w_del_msg); werase(dotdeer0); wrefresh(dotdeer0); } wrefresh(w_del_msg); } } x_pos = 58; for (y_pos = 2; y_pos < 5; y_pos++) { TSHOW(lildeer0, 50); for (looper = 0; looper < 4; looper++) { SHOW(lildeer3, 50); SHOW(lildeer2, 50); SHOW(lildeer1, 50); SHOW(lildeer2, 50); SHOW(lildeer3, 50); TSHOW(lildeer0, 50); x_pos -= 2; } } x_pos = 35; for (y_pos = 5; y_pos < 10; y_pos++) { touchwin(middeer0); wrefresh(middeer0); wrefresh(w_del_msg); for (looper = 0; looper < 2; looper++) { SHOW(middeer3, 50); SHOW(middeer2, 50); SHOW(middeer1, 50); SHOW(middeer2, 50); SHOW(middeer3, 50); TSHOW(middeer0, 50); x_pos -= 3; } } napms(2000); y_pos = 1; for (x_pos = 8; x_pos < 16; x_pos++) { SHOW(bigdeer4, 30); SHOW(bigdeer3, 30); SHOW(bigdeer2, 30); SHOW(bigdeer1, 30); SHOW(bigdeer2, 30); SHOW(bigdeer3, 30); SHOW(bigdeer4, 30); SHOW(bigdeer0, 30); } --x_pos; for (looper = 0; looper < 6; looper++) { SHOW(lookdeer4, 40); SHOW(lookdeer3, 40); SHOW(lookdeer2, 40); SHOW(lookdeer1, 40); SHOW(lookdeer2, 40); SHOW(lookdeer3, 40); SHOW(lookdeer4, 40); } SHOW(lookdeer0, 40); for (; y_pos < 10; y_pos++) { for (looper = 0; looper < 2; looper++) { SHOW(bigdeer4, 30); SHOW(bigdeer3, 30); SHOW(bigdeer2, 30); SHOW(bigdeer1, 30); SHOW(bigdeer2, 30); SHOW(bigdeer3, 30); SHOW(bigdeer4, 30); } SHOW(bigdeer0, 30); } --y_pos; mvwin(lookdeer3, y_pos, x_pos); wrefresh(lookdeer3); wrefresh(w_del_msg); } curses-1.4.4/vendor/PDCurses/acs_defs.h0000644000004100000410000003726214201713275017775 0ustar www-datawww-data/* Many of the following #defines are completely unused for the nonce. For each character, its code point in code page 437, Unicode, and page 8859-1 are given. The first is used for non-wide builds in Win32 console, DOS, SDL, and OS/2. Unicode is used for all wide builds, and for the non-wide build of WinGUI. Code page 8859-1 is used for non-wide X11. All of these characters exist in CP437 and Unicode. Some don't exist in 8859-1, in which case the last column is 'TBD'. Only 32 are used in ncurses. So caution is advised. */ #ifdef USE_ISO8859_CHARSET #define CHOOSE( A, B, C) (C) #define TBD '!' #else #define CHOOSE( A, B, C) (USE_UNICODE_ACS_CHARS ? B : A) #endif /* Codes found from https://en.wikipedia.org/wiki/Code_page_437 */ #define SMILE CHOOSE( 0x01, 0x263a, 'O') #define REV_SMILE CHOOSE( 0x02, 0x263b, 'O') #define HEART CHOOSE( 0x03, 0x2665, 'H') #define DIAMOND CHOOSE( 0x04, 0x2666, 0x01) #define CLUB CHOOSE( 0x05, 0x2663, 'C') #define SPADE CHOOSE( 0x06, 0x2660, 'S') #define MEDIUM_BULLET CHOOSE( 0x07, 0x2022, 0xb7) #define REV_BULLET CHOOSE( 0x08, 0x2508, 0xb7) #define WHITE_BULLET CHOOSE( 0x09, 0x25cb, 7) #define REV_WHITE_BULLET CHOOSE( 0x0a, 0x25D9, 7) #define MALE_SYM CHOOSE( 0x0b, 0x2642, 'm') #define FEMALE_SYM CHOOSE( 0x0c, 0x2640, 'f') #define QTR_NOTE CHOOSE( 0x0d, 0x266a, 0xbc) #define EIGHTH_NOTE CHOOSE( 0x0e, 0x266b, 0xbd) #define SPLAT CHOOSE( 0x0f, 0xa4 , 0xa4) #define RIGHT_TRIANGLE CHOOSE( 0x10, 0x25b6, '>') #define LEFT_TRIANGLE CHOOSE( 0x11, 0x25c0, '<') #define UP_DOWN_ARROW CHOOSE( 0x12, 0x2195, 0x19) #define DBL_BANG CHOOSE( 0x13, 0x203c, '!') #define PILCROW CHOOSE( 0x14, 0xb6 , 0xb6) #define SECTION_SIGN CHOOSE( 0x15, 0xa7 , 0xa7) #define LOW_QTR_BLOCK CHOOSE( 0x16, 0x25b2, '_') #define UP_DOWN_ARROW_UNDERSCORED CHOOSE( 0x17, 0x21ab, 0x19) #define UP_ARROW CHOOSE( 0x18, 0x2191, '^') #define DOWN_ARROW CHOOSE( 0x19, 0x2193, 'v') #define RIGHT_ARROW CHOOSE( 0x1a, 0x2192, '>') #define LEFT_ARROW CHOOSE( 0x1b, 0x2190, '<') #define RIGHT_ANGLE CHOOSE( 0x1c, 0x221f, 0xe) #define LEFT_RIGHT_ARROW CHOOSE( 0x1d, 0x2194, '-') #define UP_TRIANGLE CHOOSE( 0x1e, 0x25b2, '^') #define DOWN_TRIANGLE CHOOSE( 0x1f, 0x25bc, 'v') #define UPPERCASE_C_CEDILLA CHOOSE( 0x80, 0xc7 , 0xc7) #define LOWERCASE_U_UMLAUT CHOOSE( 0x81, 0xfc , 0xfc) #define LOWERCASE_E_ACUTE CHOOSE( 0x82, 0xe9 , 0xe9) #define LOWERCASE_A_CIRCUMFLEX CHOOSE( 0x83, 0xe2 , 0xe2) #define LOWERCASE_A_UMLAUT CHOOSE( 0x84, 0xe4 , 0xe4) #define LOWERCASE_A_GRAVE CHOOSE( 0x85, 0xe0 , 0xea) #define LOWERCASE_A_RING CHOOSE( 0x86, 0xe5 , 0xe5) #define LOWERCASE_C_CEDILLA CHOOSE( 0x87, 0xe7 , 0xe7) #define LOWERCASE_E_CIRCUMFLEX CHOOSE( 0x88, 0xea , 0xea) #define LOWERCASE_E_UMLAUT CHOOSE( 0x89, 0xeb , 0xeb) #define LOWERCASE_E_GRAVE CHOOSE( 0x8a, 0xe8 , 0xe8) #define LOWERCASE_I_UMLAUT CHOOSE( 0x8b, 0xef , 0xef) #define LOWERCASE_I_CIRCUMFLEX CHOOSE( 0x8c, 0xee , 0xee) #define LOWERCASE_I_GRAVE CHOOSE( 0x8d, 0xec , 0xce) #define UPPERCASE_A_UMLAUT CHOOSE( 0x8e, 0xc4 , 0xc4) #define UPPERCASE_A_RING CHOOSE( 0x8f, 0xc5 , 0xc5) #define UPPERCASE_E_ACUTE CHOOSE( 0x90, 0xc9 , 0xc9) #define LOWERCASE_AE_LIGATURE CHOOSE( 0x91, 0xe6 , 0xe6) #define UPPERCASE_AE_LIGATURE CHOOSE( 0x92, 0xc6 , 0xc6) #define LOWERCASE_O_CIRCUMFLEX CHOOSE( 0x93, 0xf4 , 0xf4) #define LOWERCASE_O_UMLAUT CHOOSE( 0x94, 0xf6 , 0xf6) #define LOWERCASE_O_GRAVE CHOOSE( 0x95, 0xf2 , 0xf2) #define LOWERCASE_U_CIRCUMFLEX CHOOSE( 0x96, 0xfb , 0xfb) #define LOWERCASE_U_GRAVE CHOOSE( 0x97, 0xf9 , 0xf9) #define LOWERCASE_Y_UMLAUT CHOOSE( 0x98, 0xff , 0xff) #define UPPERCASE_O_UMLAUT CHOOSE( 0x99, 0xd6 , 0xd6) #define UPPERCASE_U_UMLAUT CHOOSE( 0x9a, 0xdc , 0xdc) #define CENT_SIGN CHOOSE( 0x9b, 0xa2 , 0xa2) #define STERLING_SIGN CHOOSE( 0x9c, 0xa3 , 30) #define YEN_SIGN CHOOSE( 0x9d, 0xa5 , 0xa5) #define PESETA_SIGN CHOOSE( 0x9e, 0x20a7, TBD) #define F_WITH_HOOK CHOOSE( 0x9f, 0x0192, TBD) #define LOWERCASE_A_ACUTE CHOOSE( 0xa0, 0xe1 , 0xe1) #define LOWERCASE_I_ACUTE CHOOSE( 0xa1, 0xed , 0xed) #define LOWERCASE_O_ACUTE CHOOSE( 0xa2, 0xf3 , 0xf3) #define LOWERCASE_U_ACUTE CHOOSE( 0xa3, 0xfa , 0xfa) #define LOWERCASE_N_TILDE CHOOSE( 0xa4, 0xf1 , 0xf1) #define UPPERCASE_N_TILDE CHOOSE( 0xa5, 0xd1 , 0xd1) #define A_ORDINAL CHOOSE( 0xa6, 0xaa , 0xaa) #define O_ORDINAL CHOOSE( 0xa7, 0xba , 0xba) #define INVERTED_QUESTION_MARK CHOOSE( 0xa8, 0xbf , 0xbf) #define REVERSED_NOT_SIGN CHOOSE( 0xa9, 0x2310, TBD) #define NOT_SIGN CHOOSE( 0xaa, 0xac , 0xac) #define VULGAR_HALF CHOOSE( 0xab, 0xbd , 0xbd) #define VULGAR_QUARTER CHOOSE( 0xac, 0xbc , 0xbc) #define INVERTED_EXCLAMATION_MARK CHOOSE( 0xad, 0xa1 , 0xa1) #define LEFT_ANGLE_QUOTE_MARK CHOOSE( 0xae, 0xab , 0xab) #define RIGHT_ANGLE_QUOTE_MARK CHOOSE( 0xaf, 0xbb , 0xbb) #define LIGHT_SHADE CHOOSE( 0xb0, 0x2591, '#' ) #define MEDIUM_SHADE CHOOSE( 0xb1, 0x2592, 2) #define DARK_SHADE CHOOSE( 0xb2, 0x2593, TBD) #define BOX_VLINE CHOOSE( 0xb3, 0x2502, 25) #define BOX_RTEE CHOOSE( 0xb4, 0x2524, 22) #define BOX_SD_RTEE CHOOSE( 0xb5, 0x2561, 22) #define BOX_DS_RTEE CHOOSE( 0xb6, 0x2562, 22) #define BOX_DS_URCORNER CHOOSE( 0xb7, 0x2556, 12) #define BOX_SD_URCORNER CHOOSE( 0xb8, 0x2555, 12) #define BOX_D_RTEE CHOOSE( 0xb9, 0x2563, 22) #define BOX_D_VLINE CHOOSE( 0xba, 0x2551, 25) #define BOX_D_URCORNER CHOOSE( 0xbb, 0x2557, 12) #define BOX_D_LRCORNER CHOOSE( 0xbc, 0x255D, 11) #define BOX_DS_LRCORNER CHOOSE( 0xbd, 0x255c, 11) #define BOX_SD_LRCORNER CHOOSE( 0xbe, 0x255b, 11) #define BOX_URCORNER CHOOSE( 0xbf, 0x2510, 12) #define BOX_LLCORNER CHOOSE( 0xc0, 0x2514, 14) #define BOX_BTEE CHOOSE( 0xc1, 0x2534, 23) #define BOX_TTEE CHOOSE( 0xc2, 0x252c, 24) #define BOX_LTEE CHOOSE( 0xc3, 0x251c, 21) #define BOX_HLINE CHOOSE( 0xc4, 0x2500, 18) #define BOX_PLUS CHOOSE( 0xc5, 0x253c, 15) #define BOX_SD_LTEE CHOOSE( 0xc6, 0x255e, 21) #define BOX_DS_LTEE CHOOSE( 0xc7, 0x255f, 21) #define BOX_D_LLCORNER CHOOSE( 0xc8, 0x255A, 14) #define BOX_D_ULCORNER CHOOSE( 0xc9, 0x2554, 13) #define BOX_D_BTEE CHOOSE( 0xca, 0x2569, 23) #define BOX_D_TTEE CHOOSE( 0xcb, 0x2566, 24) #define BOX_D_LTEE CHOOSE( 0xcc, 0x2560, 21) #define BOX_D_HLINE CHOOSE( 0xcd, 0x2550, 18) #define BOX_D_PLUS CHOOSE( 0xce, 0x256C, 15) #define BOX_SD_BTEE CHOOSE( 0xcf, 0x2567, 23) #define BOX_DS_BTEE CHOOSE( 0xd0, 0x2568, 23) #define BOX_SD_TTEE CHOOSE( 0xd1, 0x2564, 24) #define BOX_DS_TTEE CHOOSE( 0xd2, 0x2565, 24) #define BOX_DS_LLCORNER CHOOSE( 0xd3, 0x2559, 14) #define BOX_SD_LLCORNER CHOOSE( 0xd4, 0x2558, 14) #define BOX_SD_ULCORNER CHOOSE( 0xd5, 0x2552, 13) #define BOX_DS_ULCORNER CHOOSE( 0xd6, 0x2553, 13) #define BOX_DS_PLUS CHOOSE( 0xd7, 0x256b, 15) #define BOX_SD_PLUS CHOOSE( 0xd8, 0x256a, 15) #define BOX_LRCORNER CHOOSE( 0xd9, 0x2518, 11) #define BOX_ULCORNER CHOOSE( 0xda, 0x250c, 13) #define FULL_BLOCK CHOOSE( 0xdb, 0x2588, 0) #define LOWER_HALF_BLOCK CHOOSE( 0xdc, 0x2584, TBD) #define LEFT_HALF_BLOCK CHOOSE( 0xdd, 0x258c, TBD) #define RIGHT_HALF_BLOCK CHOOSE( 0xde, 0x2590, TBD) #define UPPER_HALF_BLOCK CHOOSE( 0xdf, 0x2580, TBD) #define ALPHA CHOOSE( 0xe0, 0x03b1, TBD) #define BETA CHOOSE( 0xe1, 0x00df, TBD) #define GAMMA CHOOSE( 0xe2, 0x0393, TBD) #define PI CHOOSE( 0xe3, 0x03c0, 28) #define UPPERCASE_SIGMA CHOOSE( 0xe4, 0x03a3, TBD) #define LOWERCASE_SIGMA CHOOSE( 0xe5, 0x03c3, TBD) #define MU CHOOSE( 0xe6, 0x00b5, 0xb5) #define TAU CHOOSE( 0xe7, 0x03c4, TBD) #define UPPERCASE_PHI CHOOSE( 0xe8, 0x03a6, TBD) #define THETA CHOOSE( 0xe9, 0x0398, TBD) #define OMEGA CHOOSE( 0xea, 0x03a9, TBD) #define DELTA CHOOSE( 0xeb, 0x03b4, TBD) #define INFINITY_SIGN CHOOSE( 0xec, 0x221e, TBD) #define LOWERCASE_PHI CHOOSE( 0xed, 0x03c6, TBD) #define EPSILON CHOOSE( 0xee, 0x03b5, TBD) #define INTERSECTION CHOOSE( 0xef, 0x2229, TBD) #define TRIPLE_BAR CHOOSE( 0xf0, 0x2261, TBD) #define PLUS_OR_MINUS CHOOSE( 0xf1, 0x00b1, 8) #define GREATER_THAN_OR_EQUAL_TO CHOOSE( 0xf2, 0x2265, 27) #define LESSER_THAN_OR_EQUAL_TO CHOOSE( 0xf3, 0x2264, 26) #define UPPER_HALF_INTEGRAL_SIGN CHOOSE( 0xf4, 0x2320, TBD) #define LOWER_HALF_INTEGRAL_SIGN CHOOSE( 0xf5, 0x2321, TBD) #define DIVISION_SIGN CHOOSE( 0xf6, 0x00f7, 0xf7) #define APPROXIMATELY_EQUALS_SIGN CHOOSE( 0xf7, 0x2248, TBD) #define DEGREE_SIGN CHOOSE( 0xf8, 0x00b0, 0xb0) #define LARGE_BULLET CHOOSE( 0xf9, 0x2219, 7) #define SMALL_BULLET CHOOSE( 0xfa, 0x00b7, 0xb7) #define SQUARE_ROOT CHOOSE( 0xfb, 0x221a, TBD) #define SUPERSCRIPT_N CHOOSE( 0xfc, 0x207f, TBD) #define SUPERSCRIPT_2 CHOOSE( 0xfd, 0x00b2, 0xb2) #define CENTERED_SQUARE CHOOSE( 0xfe, 0x25a0, TBD) #define NON_BREAKING_SPACE CHOOSE( 0xff, 0x00a0, TBD) /* It says at http://unicode.org/charts/PDF/U2300.pdf */ /* that '...the scan line numbers here refer to old, */ /* low-resolution technology for terminals, with only */ /* nine scan lines per fixed-size character glyph. */ /* Even-numbered scan lines are unified with box */ /* drawing graphics." */ /* The utility of these is questionable; they'd */ /* work Just Fine in wingdi (_if_ the appropriate */ /* glyphs are available), but not elsewhere. */ #define HORIZ_SCAN_LINE_1 CHOOSE( 0x2d, 0x23ba, 16) #define HORIZ_SCAN_LINE_3 CHOOSE( 0x2d, 0x23bb, 17) #define HORIZ_SCAN_LINE_7 CHOOSE( 0x2d, 0x23bc, 19) #define HORIZ_SCAN_LINE_9 CHOOSE( '_', 0x23bd, 20) /* Code page 437 lacks a 'for real' not-equals, so for that, */ /* we use the double-horizontal single-vertical box drawing : */ #define NOT_EQUALS_SIGN CHOOSE( 0xd8, 0x2260, 29) # define A(x) ((chtype)x | A_ALTCHARSET) chtype acs_map[128] = { A(0), A(1), A(2), A(3), A(4), A(5), A(6), A(7), A(8), A(9), A(10), CLUB, HEART, SPADE, SMILE, REV_SMILE, /* 11 12 13 14 15 */ MEDIUM_BULLET, WHITE_BULLET, PILCROW, SECTION_SIGN, /* 16 17 18 19 */ A_ORDINAL, O_ORDINAL, LOWERCASE_PHI, /* 20 21 22 */ INVERTED_EXCLAMATION_MARK, INVERTED_QUESTION_MARK, /* 23 24 */ REVERSED_NOT_SIGN, NOT_SIGN, /* 25 26 */ UPPER_HALF_INTEGRAL_SIGN, LOWER_HALF_INTEGRAL_SIGN, /* 27 28 */ SUPERSCRIPT_N, CENTERED_SQUARE, F_WITH_HOOK, /* 29 30 31 */ RIGHT_ARROW, LEFT_ARROW, UP_ARROW, DOWN_ARROW, /* 32 !"# */ PI, NOT_EQUALS_SIGN, VULGAR_HALF, VULGAR_QUARTER, /* $%&' */ '(', LEFT_ANGLE_QUOTE_MARK, RIGHT_ANGLE_QUOTE_MARK, /* )* */ DARK_SHADE, SUPERSCRIPT_2, INFINITY_SIGN, /* +,- */ ALPHA, BETA, GAMMA, UPPERCASE_SIGMA, LOWERCASE_SIGMA, /* ./012 */ '3', MU, TAU, UPPERCASE_PHI, THETA, OMEGA, DELTA, EPSILON, /* 456789: */ BOX_SD_LRCORNER, BOX_SD_URCORNER, BOX_SD_ULCORNER, /* ;<= */ BOX_SD_LLCORNER, BOX_SD_PLUS, /* >? */ BOX_SD_LTEE, BOX_SD_RTEE, BOX_SD_BTEE, BOX_SD_TTEE, /* @ABC */ BOX_D_LRCORNER, BOX_D_URCORNER, BOX_D_ULCORNER, /* DEF */ BOX_D_LLCORNER, BOX_D_PLUS, /* GH */ BOX_D_LTEE, BOX_D_RTEE, BOX_D_BTEE, BOX_D_TTEE, /* IJKL */ BOX_DS_LRCORNER, BOX_DS_URCORNER, BOX_DS_ULCORNER, /* MNO */ BOX_DS_LLCORNER, BOX_DS_PLUS, /* PQ */ BOX_DS_LTEE, BOX_DS_RTEE, BOX_DS_BTEE, BOX_DS_TTEE, /* RSTU */ BOX_LRCORNER, BOX_URCORNER, BOX_ULCORNER, /* VWX */ BOX_LLCORNER, BOX_PLUS, /* YZ */ BOX_LTEE, BOX_RTEE, BOX_BTEE, BOX_TTEE, /* [\]^ */ BOX_HLINE, BOX_VLINE, BOX_D_HLINE, BOX_D_VLINE, /* _`ab */ DIVISION_SIGN, APPROXIMATELY_EQUALS_SIGN, /* cd */ INTERSECTION, TRIPLE_BAR, /* ef */ SMALL_BULLET, LARGE_BULLET, SQUARE_ROOT, /* ghi */ DIAMOND, MEDIUM_SHADE, /* jk */ HORIZ_SCAN_LINE_1, HORIZ_SCAN_LINE_3, /* lm */ HORIZ_SCAN_LINE_7, HORIZ_SCAN_LINE_9, /* no */ UPPER_HALF_BLOCK, LOWER_HALF_BLOCK, /* pq */ LEFT_HALF_BLOCK, RIGHT_HALF_BLOCK, FULL_BLOCK, /* rst */ LESSER_THAN_OR_EQUAL_TO, GREATER_THAN_OR_EQUAL_TO, /* uv */ DEGREE_SIGN, PLUS_OR_MINUS, LIGHT_SHADE, SPLAT, /* wxyz */ CENT_SIGN, YEN_SIGN, PESETA_SIGN, STERLING_SIGN, /* {|}~ */ A(127) }; # undef A curses-1.4.4/vendor/PDCurses/sdl1/0000755000004100000410000000000014201713275016706 5ustar www-datawww-datacurses-1.4.4/vendor/PDCurses/sdl1/Makefile0000644000004100000410000000501614201713275020350 0ustar www-datawww-data# Makefile for PDCurses library for SDL # # Usage: [g]make [DEBUG=Y] [WIDE=Y] [UTF8=Y] [target] # # where target can be any of: # [all|demos|libpdcurses.a|testcurs]... O = o RM = rm ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. endif include $(PDCURSES_SRCDIR)/libobjs.mif osdir = $(PDCURSES_SRCDIR)/sdl1 PDCURSES_SDL_H = $(osdir)/pdcsdl.h SFLAGS = $(shell sdl-config --cflags) SLIBS = $(shell sdl-config --libs) # If your system doesn't have these, remove the defines here SFLAGS += -DHAVE_VSNPRINTF -DHAVE_VSSCANF ifeq ($(DEBUG),Y) CFLAGS = -g -Wall -DPDCDEBUG -fPIC else CFLAGS = -O2 -Wall -fPIC endif ifeq ($(WIDE),Y) CFLAGS += -DPDC_WIDE SLIBS += -lSDL_ttf endif ifeq ($(UTF8),Y) CFLAGS += -DPDC_FORCE_UTF8 endif ifdef CHTYPE_32 CFLAGS += -DCHTYPE_32 endif ifdef CHTYPE_16 CFLAGS += -DCHTYPE_16 endif BUILD = $(CC) $(CFLAGS) -I$(PDCURSES_SRCDIR) ifeq ($(shell uname),Darwin) DEMOFLAGS = -Dmain=SDL_main endif LINK = $(CC) LDFLAGS = $(LIBCURSES) $(SLIBS) RANLIB = ranlib LIBCURSES = libpdcurses.a DEMOS = firework ozdemo newtest ptest rain testcurs tuidemo worm xmas \ sdltest .PHONY: all libs clean demos all: libs libs: $(LIBCURSES) clean: -$(RM) -rf *.o trace $(LIBCURSES) $(DEMOS) demos: $(DEMOS) ifneq ($(DEBUG),Y) strip $(DEMOS) endif $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) ar rv $@ $? -$(RANLIB) $@ $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_SDL_H) $(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) tui.o tuidemo.o : $(PDCURSES_CURSES_H) terminfo.o: $(TERM_HEADER) panel.o ptest: $(PANEL_HEADER) $(LIBOBJS) : %.o: $(srcdir)/%.c $(BUILD) $(SFLAGS) -c $< $(PDCOBJS) : %.o: $(osdir)/%.c $(BUILD) $(SFLAGS) -c $< firework: $(demodir)/firework.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) ozdemo: $(demodir)/ozdemo.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) newtest: $(demodir)/newtest.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) ptest: $(demodir)/ptest.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) rain: $(demodir)/rain.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) testcurs: $(demodir)/testcurs.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) tuidemo: tuidemo.o tui.o $(LINK) tui.o tuidemo.o -o $@ $(LDFLAGS) worm: $(demodir)/worm.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) xmas: $(demodir)/xmas.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) sdltest: $(osdir)/sdltest.c $(BUILD) $(DEMOFLAGS) $(SFLAGS) -o $@ $< $(LDFLAGS) tui.o: $(demodir)/tui.c $(demodir)/tui.h $(BUILD) -c $(DEMOFLAGS) $(demodir)/tui.c tuidemo.o: $(demodir)/tuidemo.c $(BUILD) -c $(DEMOFLAGS) $(demodir)/tuidemo.c curses-1.4.4/vendor/PDCurses/sdl1/README.md0000644000004100000410000000171114201713275020165 0ustar www-datawww-dataPDCurses for SDL ================ This is a port of PDCurses for SDL. Building -------- - On *nix (including Linux and Mac OS X), run "make" or "make WIDE=Y" in the sdl1 directory. There is no configure script (yet?) for this port. This assumes a working sdl-config, and GNU make. It builds the library libpdcurses.a (dynamic lib not implemented). - With MinGW, run "make -f Makefile.mng". This assumes SDL is installed in the standard directories. The MinGW makefile accepts the optional parameters "DLL=Y", "DEBUG=Y", and "WIDE=Y", as with the console version. Both makefiles recognize the optional PDCURSES_SRCDIR environment variable, as with the console ports. Makefile.mng builds libpdcurses.a, along with pdcurses.dll, if specified. Distribution Status ------------------- The files in this directory are released to the Public Domain. Acknowledgements ---------------- SDL port was provided by William McBrine curses-1.4.4/vendor/PDCurses/sdl1/pdckbd.c0000644000004100000410000002657514201713275020320 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcsdl.h" /*man-start************************************************************** pdckbd ------ ### Synopsis unsigned long PDC_get_input_fd(void); ### Description PDC_get_input_fd() returns the file descriptor that PDCurses reads its input from. It can be used for select(). ### Portability X/Open BSD SYS V PDC_get_input_fd - - - **man-end****************************************************************/ #include unsigned long pdc_key_modifiers = 0L; static SDL_Event event; static SDLKey oldkey; static MOUSE_STATUS old_mouse_status; static struct { SDLKey keycode; bool numkeypad; unsigned short normal; unsigned short shifted; unsigned short control; unsigned short alt; } key_table[] = { /* keycode keypad normal shifted control alt*/ {SDLK_LEFT, FALSE, KEY_LEFT, KEY_SLEFT, CTL_LEFT, ALT_LEFT}, {SDLK_RIGHT, FALSE, KEY_RIGHT, KEY_SRIGHT, CTL_RIGHT, ALT_RIGHT}, {SDLK_UP, FALSE, KEY_UP, KEY_SUP, CTL_UP, ALT_UP}, {SDLK_DOWN, FALSE, KEY_DOWN, KEY_SDOWN, CTL_DOWN, ALT_DOWN}, {SDLK_HOME, FALSE, KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME}, {SDLK_END, FALSE, KEY_END, KEY_SEND, CTL_END, ALT_END}, {SDLK_PAGEUP, FALSE, KEY_PPAGE, KEY_SPREVIOUS,CTL_PGUP, ALT_PGUP}, {SDLK_PAGEDOWN,FALSE, KEY_NPAGE, KEY_SNEXT, CTL_PGDN, ALT_PGDN}, {SDLK_INSERT, FALSE, KEY_IC, KEY_SIC, CTL_INS, ALT_INS}, {SDLK_DELETE, FALSE, KEY_DC, KEY_SDC, CTL_DEL, ALT_DEL}, {SDLK_F1, FALSE, KEY_F(1), KEY_F(13), KEY_F(25), KEY_F(37)}, {SDLK_F2, FALSE, KEY_F(2), KEY_F(14), KEY_F(26), KEY_F(38)}, {SDLK_F3, FALSE, KEY_F(3), KEY_F(15), KEY_F(27), KEY_F(39)}, {SDLK_F4, FALSE, KEY_F(4), KEY_F(16), KEY_F(28), KEY_F(40)}, {SDLK_F5, FALSE, KEY_F(5), KEY_F(17), KEY_F(29), KEY_F(41)}, {SDLK_F6, FALSE, KEY_F(6), KEY_F(18), KEY_F(30), KEY_F(42)}, {SDLK_F7, FALSE, KEY_F(7), KEY_F(19), KEY_F(31), KEY_F(43)}, {SDLK_F8, FALSE, KEY_F(8), KEY_F(20), KEY_F(32), KEY_F(44)}, {SDLK_F9, FALSE, KEY_F(9), KEY_F(21), KEY_F(33), KEY_F(45)}, {SDLK_F10, FALSE, KEY_F(10), KEY_F(22), KEY_F(34), KEY_F(46)}, {SDLK_F11, FALSE, KEY_F(11), KEY_F(23), KEY_F(35), KEY_F(47)}, {SDLK_F12, FALSE, KEY_F(12), KEY_F(24), KEY_F(36), KEY_F(48)}, {SDLK_F13, FALSE, KEY_F(13), KEY_F(25), KEY_F(37), KEY_F(49)}, {SDLK_F14, FALSE, KEY_F(14), KEY_F(26), KEY_F(38), KEY_F(50)}, {SDLK_F15, FALSE, KEY_F(15), KEY_F(27), KEY_F(39), KEY_F(51)}, {SDLK_BACKSPACE,FALSE, 0x08, 0x08, CTL_BKSP, ALT_BKSP}, {SDLK_TAB, FALSE, 0x09, KEY_BTAB, CTL_TAB, ALT_TAB}, {SDLK_PRINT, FALSE, KEY_PRINT, KEY_SPRINT, KEY_PRINT, KEY_PRINT}, {SDLK_PAUSE, FALSE, KEY_SUSPEND, KEY_SSUSPEND, KEY_SUSPEND, KEY_SUSPEND}, {SDLK_CLEAR, FALSE, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR}, {SDLK_BREAK, FALSE, KEY_BREAK, KEY_BREAK, KEY_BREAK, KEY_BREAK}, {SDLK_HELP, FALSE, KEY_HELP, KEY_SHELP, KEY_LHELP, KEY_HELP}, {SDLK_MENU, FALSE, KEY_OPTIONS, KEY_SOPTIONS, KEY_OPTIONS, KEY_OPTIONS}, {SDLK_ESCAPE, FALSE, 0x1B, 0x1B, 0x1B, ALT_ESC}, {SDLK_KP_ENTER,TRUE, PADENTER, PADENTER, CTL_PADENTER,ALT_PADENTER}, {SDLK_KP_PLUS, TRUE, PADPLUS, '+', CTL_PADPLUS, ALT_PADPLUS}, {SDLK_KP_MINUS,TRUE, PADMINUS, '-', CTL_PADMINUS,ALT_PADMINUS}, {SDLK_KP_MULTIPLY,TRUE,PADSTAR, '*', CTL_PADSTAR, ALT_PADSTAR}, {SDLK_KP_DIVIDE,TRUE, PADSLASH, '/', CTL_PADSLASH,ALT_PADSLASH}, {SDLK_KP_PERIOD,TRUE, PADSTOP, '.', CTL_PADSTOP, ALT_PADSTOP}, {SDLK_KP0, TRUE, PAD0, '0', CTL_PAD0, ALT_PAD0}, {SDLK_KP1, TRUE, KEY_C1, '1', CTL_PAD1, ALT_PAD1}, {SDLK_KP2, TRUE, KEY_C2, '2', CTL_PAD2, ALT_PAD2}, {SDLK_KP3, TRUE, KEY_C3, '3', CTL_PAD3, ALT_PAD3}, {SDLK_KP4, TRUE, KEY_B1, '4', CTL_PAD4, ALT_PAD4}, {SDLK_KP5, TRUE, KEY_B2, '5', CTL_PAD5, ALT_PAD5}, {SDLK_KP6, TRUE, KEY_B3, '6', CTL_PAD6, ALT_PAD6}, {SDLK_KP7, TRUE, KEY_A1, '7', CTL_PAD7, ALT_PAD7}, {SDLK_KP8, TRUE, KEY_A2, '8', CTL_PAD8, ALT_PAD8}, {SDLK_KP9, TRUE, KEY_A3, '9', CTL_PAD9, ALT_PAD9}, {0, 0, 0, 0, 0, 0} }; unsigned long PDC_get_input_fd(void) { PDC_LOG(("PDC_get_input_fd() - called\n")); return 0L; /* test this */ } void PDC_set_keyboard_binary(bool on) { PDC_LOG(("PDC_set_keyboard_binary() - called\n")); } /* check if a key or mouse event is waiting */ bool PDC_check_key(void) { Uint32 current = SDL_GetTicks(); int haveevent = SDL_PollEvent(&event); /* if we have an event, or 30 ms have passed without a screen update, or the timer has wrapped, update now */ if (haveevent || current < pdc_lastupdate || ((current - pdc_lastupdate) > 30)) PDC_update_rects(); return haveevent; } static int _process_key_event(void) { int i, key = 0; pdc_key_modifiers = 0L; SP->key_code = FALSE; if (event.type == SDL_KEYUP) { if (SP->return_key_modifiers && event.key.keysym.sym == oldkey) { switch (oldkey) { case SDLK_RSHIFT: return KEY_SHIFT_R; case SDLK_LSHIFT: return KEY_SHIFT_L; case SDLK_RCTRL: return KEY_CONTROL_R; case SDLK_LCTRL: return KEY_CONTROL_L; case SDLK_RALT: return KEY_ALT_R; case SDLK_LALT: return KEY_ALT_L; default: break; } } return -1; } oldkey = event.key.keysym.sym; if (SP->save_key_modifiers) { if (event.key.keysym.mod & KMOD_NUM) pdc_key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; if (event.key.keysym.mod & KMOD_SHIFT) pdc_key_modifiers |= PDC_KEY_MODIFIER_SHIFT; if (event.key.keysym.mod & KMOD_CTRL) pdc_key_modifiers |= PDC_KEY_MODIFIER_CONTROL; if (event.key.keysym.mod & KMOD_ALT) pdc_key_modifiers |= PDC_KEY_MODIFIER_ALT; } for (i = 0; key_table[i].keycode; i++) { if (key_table[i].keycode == event.key.keysym.sym) { if ((event.key.keysym.mod & KMOD_SHIFT) || (key_table[i].numkeypad && (event.key.keysym.mod & KMOD_NUM))) { key = key_table[i].shifted; } else if (event.key.keysym.mod & KMOD_CTRL) { key = key_table[i].control; } else if (event.key.keysym.mod & KMOD_ALT) { key = key_table[i].alt; } /* To get here, we ignore all other modifiers */ else key = key_table[i].normal; SP->key_code = (key > 0x100); break; } } if (!key) { key = event.key.keysym.unicode; if (key > 0x7f) key = 0; } /* Handle ALT letters and numbers */ if (event.key.keysym.mod & KMOD_ALT) { if (key >= 'A' && key <= 'Z') { key += ALT_A - 'A'; SP->key_code = TRUE; } if (key >= 'a' && key <= 'z') { key += ALT_A - 'a'; SP->key_code = TRUE; } if (key >= '0' && key <= '9') { key += ALT_0 - '0'; SP->key_code = TRUE; } } return key ? key : -1; } static int _process_mouse_event(void) { SDLMod keymods; short shift_flags = 0; memset(&pdc_mouse_status, 0, sizeof(MOUSE_STATUS)); keymods = SDL_GetModState(); if (keymods & KMOD_SHIFT) shift_flags |= BUTTON_SHIFT; if (keymods & KMOD_CTRL) shift_flags |= BUTTON_CONTROL; if (keymods & KMOD_ALT) shift_flags |= BUTTON_ALT; if (event.type == SDL_MOUSEMOTION) { int i; pdc_mouse_status.x = event.motion.x / pdc_fwidth; pdc_mouse_status.y = event.motion.y / pdc_fheight; if (!event.motion.state || (pdc_mouse_status.x == old_mouse_status.x && pdc_mouse_status.y == old_mouse_status.y)) return -1; pdc_mouse_status.changes = PDC_MOUSE_MOVED; for (i = 0; i < 3; i++) { if (event.motion.state & SDL_BUTTON(i + 1)) { pdc_mouse_status.button[i] = BUTTON_MOVED | shift_flags; pdc_mouse_status.changes |= (1 << i); } } } else { short action = (event.button.state == SDL_PRESSED) ? BUTTON_PRESSED : BUTTON_RELEASED; Uint8 btn = event.button.button; /* handle scroll wheel */ if ((btn >= 4 && btn <= 7) && action == BUTTON_RELEASED) { pdc_mouse_status.x = pdc_mouse_status.y = -1; switch (btn) { case 4: pdc_mouse_status.changes = PDC_MOUSE_WHEEL_UP; break; case 5: pdc_mouse_status.changes = PDC_MOUSE_WHEEL_DOWN; break; case 6: pdc_mouse_status.changes = PDC_MOUSE_WHEEL_LEFT; break; case 7: pdc_mouse_status.changes = PDC_MOUSE_WHEEL_RIGHT; } SP->key_code = TRUE; return KEY_MOUSE; } if (btn < 1 || btn > 3) return -1; /* check for a click -- a press followed immediately by a release */ if (action == BUTTON_PRESSED && SP->mouse_wait) { SDL_Event rel; napms(SP->mouse_wait); if (SDL_PollEvent(&rel)) { if (rel.type == SDL_MOUSEBUTTONUP && rel.button.button == btn) action = BUTTON_CLICKED; else SDL_PushEvent(&rel); } } pdc_mouse_status.x = event.button.x / pdc_fwidth; pdc_mouse_status.y = event.button.y / pdc_fheight; btn--; pdc_mouse_status.button[btn] = action | shift_flags; pdc_mouse_status.changes = (1 << btn); } old_mouse_status = pdc_mouse_status; SP->key_code = TRUE; return KEY_MOUSE; } /* return the next available key or mouse event */ int PDC_get_key(void) { switch (event.type) { case SDL_QUIT: exit(1); case SDL_VIDEORESIZE: if (pdc_own_screen && (event.resize.h / pdc_fheight != LINES || event.resize.w / pdc_fwidth != COLS)) { pdc_sheight = event.resize.h; pdc_swidth = event.resize.w; if (!SP->resized) { SP->resized = TRUE; return KEY_RESIZE; } } break; case SDL_MOUSEMOTION: SDL_ShowCursor(SDL_ENABLE); case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONDOWN: oldkey = SDLK_SPACE; if (SP->_trap_mbe) return _process_mouse_event(); break; case SDL_KEYUP: case SDL_KEYDOWN: PDC_mouse_set(); return _process_key_event(); } return -1; } /* discard any pending keyboard or mouse input -- this is the core routine for flushinp() */ void PDC_flushinp(void) { PDC_LOG(("PDC_flushinp() - called\n")); while (PDC_check_key()); } int PDC_mouse_set(void) { SDL_ShowCursor(SP->_trap_mbe ? SDL_ENABLE : SDL_DISABLE); return OK; } int PDC_modifiers_set(void) { return OK; } curses-1.4.4/vendor/PDCurses/sdl1/pdcsetsc.c0000644000004100000410000000320514201713275020662 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcsdl.h" /*man-start************************************************************** pdcsetsc -------- ### Synopsis int PDC_set_blink(bool blinkon); void PDC_set_title(const char *title); ### Description PDC_set_blink() toggles whether the A_BLINK attribute sets an actual blink mode (TRUE), or sets the background color to high intensity (FALSE). The default is platform-dependent (FALSE in most cases). It returns OK if it could set the state to match the given parameter, ERR otherwise. Current platforms also adjust the value of COLORS according to this function -- 16 for FALSE, and 8 for TRUE. PDC_set_title() sets the title of the window in which the curses program is running. This function may not do anything on some platforms. (Currently it only works in Win32 and X11.) ### Portability X/Open BSD SYS V PDC_set_blink - - - PDC_set_title - - - **man-end****************************************************************/ int PDC_curs_set(int visibility) { int ret_vis; PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); ret_vis = SP->visibility; SP->visibility = visibility; PDC_gotoyx(SP->cursrow, SP->curscol); return ret_vis; } void PDC_set_title(const char *title) { PDC_LOG(("PDC_set_title() - called:<%s>\n", title)); SDL_WM_SetCaption(title, title); } int PDC_set_blink(bool blinkon) { // if (pdc_color_started) /* We've got 256 colors in this version */ // COLORS = 16; return blinkon ? ERR : OK; } curses-1.4.4/vendor/PDCurses/sdl1/pdcgetsc.c0000644000004100000410000000074314201713275020652 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcsdl.h" /* get the cursor size/shape */ int PDC_get_cursor_mode(void) { PDC_LOG(("PDC_get_cursor_mode() - called\n")); return 0; } /* return number of screen rows */ int PDC_get_rows(void) { PDC_LOG(("PDC_get_rows() - called\n")); return pdc_sheight / pdc_fheight; } /* return width of screen/viewport */ int PDC_get_columns(void) { PDC_LOG(("PDC_get_columns() - called\n")); return pdc_swidth / pdc_fwidth; } curses-1.4.4/vendor/PDCurses/sdl1/pdcsdl.h0000644000004100000410000000224414201713275020332 0ustar www-datawww-data/* Public Domain Curses */ #include #include #ifdef PDC_WIDE #include #endif #ifdef PDC_WIDE PDCEX TTF_Font *pdc_ttffont; PDCEX int pdc_font_size; #endif PDCEX SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back; PDCEX int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset; extern SDL_Surface *pdc_tileback; /* used to regenerate the background of "transparent" cells */ extern SDL_Color pdc_color[256]; /* colors for font palette */ extern Uint32 pdc_mapped[256]; /* colors for FillRect(), as used in _highlight() */ extern int pdc_fheight, pdc_fwidth; /* font height and width */ extern int pdc_flastc; /* font palette's last color (treated as the foreground) */ extern bool pdc_own_screen; /* if pdc_screen was not set before initscr(), PDCurses is responsible for (owns) it */ extern Uint32 pdc_lastupdate; /* time of last update, in ticks */ void PDC_update_rects(void); void PDC_retile(void); curses-1.4.4/vendor/PDCurses/sdl1/sdltest.c0000644000004100000410000000324514201713275020540 0ustar www-datawww-data/* Here's a simple example of combining SDL and PDCurses functionality. The top portion of the window is devoted to SDL, with a four-line (assuming the default 8x16 font) stdscr at the bottom. */ #include #include #include #include /* You could #include pdcsdl.h, or just add the relevant declarations here: */ PDCEX SDL_Surface *pdc_screen; PDCEX int pdc_yoffset; int main(int argc, char **argv) { char inp[60]; int i, j, seed; seed = time((time_t *)0); srand(seed); /* Initialize SDL */ if (SDL_Init(SDL_INIT_VIDEO) < 0) exit(1); atexit(SDL_Quit); pdc_screen = SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE|SDL_ANYFORMAT); /* Initialize PDCurses */ pdc_yoffset = 416; /* 480 - 4 * 16 */ initscr(); start_color(); scrollok(stdscr, TRUE); PDC_set_title("PDCurses for SDL"); /* Do some SDL stuff */ for (i = 640, j = 416; j; i -= 2, j -= 2) { SDL_Rect dest; dest.x = (640 - i) / 2; dest.y = (416 - j) / 2; dest.w = i; dest.h = j; SDL_FillRect(pdc_screen, &dest, SDL_MapRGB(pdc_screen->format, rand() % 256, rand() % 256, rand() % 256)); } SDL_UpdateRect(pdc_screen, 0, 0, 640, 416); /* Do some curses stuff */ init_pair(1, COLOR_WHITE + 8, COLOR_BLUE); bkgd(COLOR_PAIR(1)); addstr("This is a demo of "); attron(A_UNDERLINE); addstr("PDCurses for SDL"); attroff(A_UNDERLINE); addstr(".\nYour comments here: "); getnstr(inp, 59); addstr("Press any key to exit."); getch(); endwin(); return 0; } curses-1.4.4/vendor/PDCurses/sdl1/pdcdisp.c0000644000004100000410000002224714201713275020507 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcsdl.h" #include #include #ifdef CHTYPE_LONG #ifdef PDC_WIDE #define USE_UNICODE_ACS_CHARS 1 #else #define USE_UNICODE_ACS_CHARS 0 #endif #include "acs_defs.h" #endif Uint32 pdc_lastupdate = 0; #define MAXRECT 200 /* maximum number of rects to queue up before an update is forced; the number was chosen arbitrarily */ static SDL_Rect uprect[MAXRECT]; /* table of rects to update */ static chtype oldch = (chtype)(-1); /* current attribute */ static int rectcount = 0; /* index into uprect */ static short foregr = -2, backgr = -2; /* current foreground, background */ /* do the real updates on a delay */ void PDC_update_rects(void) { if (rectcount) { /* if the maximum number of rects has been reached, we're probably better off doing a full screen update */ if (rectcount == MAXRECT) SDL_Flip(pdc_screen); else SDL_UpdateRects(pdc_screen, rectcount, uprect); pdc_lastupdate = SDL_GetTicks(); rectcount = 0; } } /* set the font colors to match the chtype's attribute */ static void _set_attr(chtype ch) { ch &= (A_COLOR|A_BOLD|A_BLINK|A_REVERSE); if (oldch != ch) { short newfg, newbg; if (SP->mono) return; PDC_pair_content(PAIR_NUMBER(ch), &newfg, &newbg); newfg |= (ch & A_BOLD) ? 8 : 0; newbg |= (ch & A_BLINK) ? 8 : 0; if (ch & A_REVERSE) { short tmp = newfg; newfg = newbg; newbg = tmp; } if (newfg != foregr) { #ifndef PDC_WIDE SDL_SetPalette(pdc_font, SDL_LOGPAL, pdc_color + newfg, pdc_flastc, 1); #endif foregr = newfg; } if (newbg != backgr) { #ifndef PDC_WIDE if (newbg == -1) SDL_SetColorKey(pdc_font, SDL_SRCCOLORKEY, 0); else { if (backgr == -1) SDL_SetColorKey(pdc_font, 0, 0); SDL_SetPalette(pdc_font, SDL_LOGPAL, pdc_color + newbg, 0, 1); } #endif backgr = newbg; } oldch = ch; } } /* draw a cursor at (y, x) */ void PDC_gotoyx(int row, int col) { SDL_Rect src, dest; chtype ch; int oldrow, oldcol; #ifdef PDC_WIDE Uint16 chstr[2] = {0, 0}; #endif PDC_LOG(("PDC_gotoyx() - called: row %d col %d from row %d col %d\n", row, col, SP->cursrow, SP->curscol)); if (SP->mono) return; oldrow = SP->cursrow; oldcol = SP->curscol; /* clear the old cursor */ PDC_transform_line(oldrow, oldcol, 1, curscr->_y[oldrow] + oldcol); if (!SP->visibility) return; /* draw a new cursor by overprinting the existing character in reverse, either the full cell (when visibility == 2) or the lowest quarter of it (when visibility == 1) */ ch = curscr->_y[row][col] ^ A_REVERSE; _set_attr(ch); #ifdef CHTYPE_LONG if (ch & A_ALTCHARSET && !(ch & 0xff80)) ch = acs_map[ch & 0x7f]; #endif src.h = (SP->visibility == 1) ? pdc_fheight >> 2 : pdc_fheight; src.w = pdc_fwidth; dest.y = (row + 1) * pdc_fheight - src.h + pdc_yoffset; dest.x = col * pdc_fwidth + pdc_xoffset; #ifdef PDC_WIDE chstr[0] = ch & A_CHARTEXT; pdc_font = TTF_RenderUNICODE_Solid(pdc_ttffont, chstr, pdc_color[foregr]); if (pdc_font) { dest.h = src.h; dest.w = src.w; src.x = 0; src.y = 0; SDL_SetColorKey(pdc_font, 0, 0); SDL_SetPalette(pdc_font, SDL_LOGPAL, pdc_color + backgr, 0, 1); SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest); SDL_FreeSurface(pdc_font); pdc_font = NULL; } #else src.x = (ch & 0xff) % 32 * pdc_fwidth; src.y = (ch & 0xff) / 32 * pdc_fheight + (pdc_fheight - src.h); SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest); #endif if (oldrow != row || oldcol != col) { if (rectcount == MAXRECT) PDC_update_rects(); uprect[rectcount++] = dest; } } /* handle the A_*LINE attributes */ static void _highlight(SDL_Rect *src, SDL_Rect *dest, chtype ch) { short col = SP->line_color; #ifdef PDC_WIDE Uint16 chstr[2] = {'_', 0}; #endif if (SP->mono) return; if (ch & (A_UNDERLINE | A_OVERLINE | A_STRIKEOUT)) { #ifdef PDC_WIDE if (col == -1) col = foregr; pdc_font = TTF_RenderUNICODE_Solid(pdc_ttffont, chstr, pdc_color[col]); if (pdc_font) { src->x = 0; src->y = 0; if (backgr != -1) SDL_SetColorKey(pdc_font, SDL_SRCCOLORKEY, 0); if( ch & A_UNDERLINE) SDL_BlitSurface(pdc_font, src, pdc_screen, dest); if( ch & A_OVERLINE) { dest->y -= pdc_fheight - 1; SDL_BlitSurface(pdc_font, src, pdc_screen, dest); dest->y += pdc_fheight - 1; } if( ch & A_STRIKEOUT) { dest->y -= pdc_fheight / 2; SDL_BlitSurface(pdc_font, src, pdc_screen, dest); dest->y += pdc_fheight / 2; } SDL_FreeSurface(pdc_font); pdc_font = NULL; } #else if (col != -1) SDL_SetPalette(pdc_font, SDL_LOGPAL, pdc_color + col, pdc_flastc, 1); src->x = '_' % 32 * pdc_fwidth; src->y = '_' / 32 * pdc_fheight; if (backgr != -1) SDL_SetColorKey(pdc_font, SDL_SRCCOLORKEY, 0); if( ch & A_UNDERLINE) SDL_BlitSurface(pdc_font, src, pdc_screen, dest); if( ch & A_OVERLINE) { dest->y -= pdc_fheight - 1; SDL_BlitSurface(pdc_font, src, pdc_screen, dest); dest->y += pdc_fheight - 1; } if( ch & A_STRIKEOUT) { dest->y -= pdc_fheight / 2; SDL_BlitSurface(pdc_font, src, pdc_screen, dest); dest->y += pdc_fheight / 2; } if (backgr != -1) SDL_SetColorKey(pdc_font, 0, 0); if (col != -1) SDL_SetPalette(pdc_font, SDL_LOGPAL, pdc_color + foregr, pdc_flastc, 1); #endif } if (ch & (A_LEFTLINE|A_RIGHTLINE)) { if (col == -1) col = foregr; dest->w = 1; if (ch & A_LEFTLINE) SDL_FillRect(pdc_screen, dest, pdc_mapped[col]); if (ch & A_RIGHTLINE) { dest->x += pdc_fwidth - 1; SDL_FillRect(pdc_screen, dest, pdc_mapped[col]); dest->x -= pdc_fwidth - 1; } dest->w = pdc_fwidth; } } /* update the given physical line to look like the corresponding line in curscr */ void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) { SDL_Rect src, dest, lastrect; int j; #ifdef PDC_WIDE Uint16 chstr[2] = {0, 0}; #endif PDC_LOG(("PDC_transform_line() - called: lineno=%d\n", lineno)); if (rectcount == MAXRECT) PDC_update_rects(); src.h = pdc_fheight; src.w = pdc_fwidth; dest.y = pdc_fheight * lineno + pdc_yoffset; dest.x = pdc_fwidth * x + pdc_xoffset; dest.h = pdc_fheight; dest.w = pdc_fwidth * len; /* if the previous rect was just above this one, with the same width and horizontal position, then merge the new one with it instead of adding a new entry */ if (rectcount) lastrect = uprect[rectcount - 1]; if (rectcount && lastrect.x == dest.x && lastrect.w == dest.w) { if (lastrect.y + lastrect.h == dest.y) uprect[rectcount - 1].h = lastrect.h + pdc_fheight; else if (lastrect.y != dest.y) uprect[rectcount++] = dest; } else uprect[rectcount++] = dest; dest.w = pdc_fwidth; #ifdef PDC_WIDE src.x = 0; src.y = 0; #endif for (j = 0; j < len; j++) { chtype ch = srcp[j]; _set_attr(ch); #ifdef CHTYPE_LONG if (ch & A_ALTCHARSET && !(ch & 0xff80)) ch = (ch & (A_ATTRIBUTES ^ A_ALTCHARSET)) | acs_map[ch & 0x7f]; #endif if (backgr == -1) SDL_LowerBlit(pdc_tileback, &dest, pdc_screen, &dest); #ifdef PDC_WIDE chstr[0] = ch & A_CHARTEXT; pdc_font = TTF_RenderUNICODE_Solid(pdc_ttffont, chstr, pdc_color[foregr]); if (pdc_font) { if (backgr != -1) { SDL_SetColorKey(pdc_font, 0, 0); SDL_SetPalette(pdc_font, SDL_LOGPAL, pdc_color + backgr, 0, 1); } SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest); SDL_FreeSurface(pdc_font); pdc_font = NULL; } #else src.x = (ch & 0xff) % 32 * pdc_fwidth; src.y = (ch & 0xff) / 32 * pdc_fheight; SDL_LowerBlit(pdc_font, &src, pdc_screen, &dest); #endif if (ch & (A_UNDERLINE|A_LEFTLINE|A_RIGHTLINE|A_OVERLINE|A_STRIKEOUT)) _highlight(&src, &dest, ch); dest.x += pdc_fwidth; } } curses-1.4.4/vendor/PDCurses/sdl1/deficon.h0000644000004100000410000000244614201713275020474 0ustar www-datawww-data/* The PDCurses logo as #include'able BMP (from ../x11/little_icon.xbm) */ unsigned char deficon[] = { 0x42, 0x4d, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xce, 0x6f, 0x9c, 0xe7, 0xb5, 0xaf, 0x6b, 0x5b, 0xbd, 0xaf, 0xeb, 0xfb, 0xbd, 0xaf, 0x98, 0xe7, 0xbd, 0xaf, 0x7b, 0x5f, 0xb5, 0xa5, 0x6b, 0x5b, 0xcd, 0xab, 0x9c, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0x03, 0xff, 0xff, 0xce, 0x03, 0xff, 0xff, 0xcc, 0x73, 0xff, 0xff, 0xcc, 0xf3, 0xff, 0xff, 0xcc, 0xf3, 0xff, 0xff, 0xcc, 0x73, 0xff, 0xff, 0xc6, 0x33, 0xff, 0xff, 0xc3, 0x13, 0xff, 0xff, 0xc1, 0x83, 0xff, 0xff, 0xc8, 0xc3, 0xff, 0xff, 0xcc, 0x63, 0xff, 0xff, 0xce, 0x33, 0xff, 0xff, 0xcf, 0x33, 0xff, 0xff, 0xcf, 0x33, 0xff, 0xff, 0xce, 0x33, 0xff, 0xff, 0xc0, 0x73, 0xff, 0xff, 0xc0, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; curses-1.4.4/vendor/PDCurses/sdl1/pdcclip.c0000644000004100000410000000657514201713275020505 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcsdl.h" #include /*man-start************************************************************** clipboard --------- ### Synopsis int PDC_getclipboard(char **contents, long *length); int PDC_setclipboard(const char *contents, long length); int PDC_freeclipboard(char *contents); int PDC_clearclipboard(void); ### Description PDC_getclipboard() gets the textual contents of the system's clipboard. This function returns the contents of the clipboard in the contents argument. It is the responsibilitiy of the caller to free the memory returned, via PDC_freeclipboard(). The length of the clipboard contents is returned in the length argument. PDC_setclipboard copies the supplied text into the system's clipboard, emptying the clipboard prior to the copy. PDC_clearclipboard() clears the internal clipboard. ### Return Values indicator of success/failure of call. PDC_CLIP_SUCCESS the call was successful PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for the clipboard contents PDC_CLIP_EMPTY the clipboard contains no text PDC_CLIP_ACCESS_ERROR no clipboard support ### Portability X/Open BSD SYS V PDC_getclipboard - - - PDC_setclipboard - - - PDC_freeclipboard - - - PDC_clearclipboard - - - **man-end****************************************************************/ /* global clipboard contents, should be NULL if none set */ static char *pdc_SDL_clipboard = NULL; int PDC_getclipboard(char **contents, long *length) { int len; PDC_LOG(("PDC_getclipboard() - called\n")); if (!pdc_SDL_clipboard) return PDC_CLIP_EMPTY; len = strlen(pdc_SDL_clipboard); if ((*contents = malloc(len + 1)) == NULL) return PDC_CLIP_MEMORY_ERROR; strcpy(*contents, pdc_SDL_clipboard); *length = len; return PDC_CLIP_SUCCESS; } int PDC_setclipboard(const char *contents, long length) { PDC_LOG(("PDC_setclipboard() - called\n")); if (pdc_SDL_clipboard) { free(pdc_SDL_clipboard); pdc_SDL_clipboard = NULL; } if (contents) { if ((pdc_SDL_clipboard = malloc(length + 1)) == NULL) return PDC_CLIP_MEMORY_ERROR; strcpy(pdc_SDL_clipboard, contents); } return PDC_CLIP_SUCCESS; } int PDC_freeclipboard(char *contents) { PDC_LOG(("PDC_freeclipboard() - called\n")); /* should we also free empty the system clipboard? probably not */ if (contents) { /* NOTE: We free the memory, but we can not set caller's pointer to NULL, so if caller calls again then will try to access free'd memory. We 1st overwrite memory with a string so if caller tries to use free memory they won't get what they expect & hopefully notice. */ /* memset(contents, 0xFD, strlen(contents)); */ if (strlen(contents) >= strlen("PDCURSES")) strcpy(contents, "PDCURSES"); free(contents); } return PDC_CLIP_SUCCESS; } int PDC_clearclipboard(void) { PDC_LOG(("PDC_clearclipboard() - called\n")); if (pdc_SDL_clipboard) { free(pdc_SDL_clipboard); pdc_SDL_clipboard = NULL; } return PDC_CLIP_SUCCESS; } curses-1.4.4/vendor/PDCurses/sdl1/pdcutil.c0000644000004100000410000000141714201713275020521 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcsdl.h" void PDC_beep(void) { PDC_LOG(("PDC_beep() - called\n")); } void PDC_napms(int ms) { PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); PDC_update_rects(); SDL_PumpEvents(); SDL_Delay(ms); } const char *PDC_sysname(void) { return "SDL"; } PDCEX PDC_version_info PDC_version = { PDC_PORT_SDL1, PDC_VER_MAJOR, PDC_VER_MINOR, PDC_VER_CHANGE, sizeof( chtype), /* note that thus far, 'wide' and 'UTF8' versions exist */ /* only for SDL2, X11, Win32, and Win32a; elsewhere, */ /* these will be FALSE */ #ifdef PDC_WIDE TRUE, #else FALSE, #endif #ifdef PDC_FORCE_UTF8 TRUE, #else FALSE, #endif }; curses-1.4.4/vendor/PDCurses/sdl1/deffont.h0000644000004100000410000006410314201713275020510 0ustar www-datawww-data/* Default font -- this is simply a 256x128x1 BMP, in #include'able form. The font is 8x16, code page 437, and is based on the pc8x16s.bdf font from the vgafonts.tar.gz package, by "Myrlin". */ unsigned char deffont[] = { 0x42, 0x4d, 0x3e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xf8, 0xc0, 0x6c, 0xfe, 0x70, 0x7c, 0x18, 0x7e, 0x38, 0xee, 0x3c, 0x00, 0xc0, 0x1c, 0xc6, 0x00, 0x7e, 0x7e, 0x7e, 0x18, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0xdc, 0xcc, 0xc0, 0x6c, 0xc6, 0xd8, 0x66, 0x18, 0x18, 0x6c, 0x6c, 0x66, 0x00, 0x60, 0x30, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x18, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x7e, 0x00, 0xd8, 0xcc, 0xc0, 0x6c, 0x60, 0xd8, 0x66, 0x18, 0x3c, 0xc6, 0x6c, 0x66, 0x7e, 0x7e, 0x60, 0xc6, 0x00, 0x00, 0x30, 0x0c, 0x18, 0xd8, 0x18, 0xdc, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x7e, 0x00, 0xd8, 0xcc, 0xc0, 0x6c, 0x30, 0xd8, 0x66, 0x18, 0x66, 0xc6, 0x6c, 0x66, 0xdb, 0xf3, 0x60, 0xc6, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x76, 0x00, 0x18, 0x00, 0x6c, 0x00, 0x00, 0x7e, 0x00, 0xd8, 0xc8, 0xc0, 0x6c, 0x18, 0xd8, 0x66, 0x18, 0x66, 0xc6, 0x6c, 0x66, 0xdb, 0xdb, 0x60, 0xc6, 0xfe, 0x18, 0x0c, 0x30, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x18, 0x18, 0xec, 0x00, 0x00, 0x7e, 0x00, 0xdc, 0xdc, 0xc0, 0x6c, 0x18, 0xd8, 0x66, 0x18, 0x66, 0xfe, 0xc6, 0x3e, 0xdb, 0xdb, 0x7c, 0xc6, 0x00, 0x7e, 0x06, 0x60, 0x18, 0x18, 0x00, 0xdc, 0x00, 0x00, 0x00, 0x0c, 0x36, 0x7e, 0x7e, 0x00, 0x76, 0xce, 0xc0, 0xfe, 0x30, 0x7e, 0x66, 0xdc, 0x66, 0xc6, 0xc6, 0x0c, 0x7e, 0x7e, 0x60, 0xc6, 0x00, 0x18, 0x0c, 0x30, 0x18, 0x18, 0x18, 0x76, 0x00, 0x00, 0x00, 0x0c, 0x36, 0x32, 0x7e, 0x00, 0x00, 0xc6, 0xc6, 0x00, 0x60, 0x00, 0x00, 0x76, 0x3c, 0xc6, 0xc6, 0x18, 0x00, 0x06, 0x60, 0xc6, 0xfe, 0x18, 0x18, 0x18, 0x1b, 0x18, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0c, 0x36, 0x18, 0x7e, 0x00, 0x00, 0xce, 0xc6, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x18, 0x6c, 0x6c, 0x30, 0x00, 0x03, 0x30, 0x7c, 0x00, 0x00, 0x30, 0x0c, 0x1b, 0x18, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x0c, 0x36, 0x0c, 0x00, 0x00, 0x00, 0x7c, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x7e, 0x38, 0x38, 0x1e, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x18, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x0c, 0x36, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0f, 0x6c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x36, 0x00, 0x36, 0x00, 0x36, 0x36, 0x00, 0x36, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x18, 0x36, 0x36, 0x18, 0x00, 0x18, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x1f, 0xff, 0xff, 0x1f, 0xff, 0xff, 0x1f, 0x37, 0x3f, 0x37, 0xff, 0xf7, 0x37, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x1f, 0x1f, 0x3f, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xf0, 0x0f, 0x00, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x30, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x36, 0x18, 0x18, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x1f, 0x36, 0x37, 0x3f, 0xf7, 0xff, 0x37, 0xff, 0xf7, 0xff, 0x36, 0xff, 0x00, 0x36, 0x1f, 0x1f, 0x00, 0x36, 0xff, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18, 0x00, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18, 0x00, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18, 0x00, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18, 0x00, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x18, 0x18, 0x00, 0x18, 0x00, 0x18, 0x18, 0x36, 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x18, 0x36, 0x00, 0x00, 0x36, 0x18, 0x00, 0x00, 0x36, 0x18, 0x18, 0x00, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x06, 0x00, 0x00, 0x00, 0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x06, 0x00, 0x00, 0x00, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0x76, 0x18, 0x7c, 0x78, 0x66, 0xc6, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x0c, 0x3f, 0x18, 0x00, 0x00, 0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0xcc, 0x18, 0xc6, 0xcc, 0x66, 0xc6, 0x00, 0x00, 0xc6, 0xc0, 0x06, 0x86, 0x9a, 0x3c, 0x00, 0x00, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0xcc, 0x18, 0xc6, 0xcc, 0x66, 0xc6, 0x00, 0x00, 0xc6, 0xc0, 0x06, 0xdc, 0xce, 0x3c, 0x36, 0xd8, 0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0xcc, 0x18, 0xc6, 0xcc, 0x66, 0xce, 0x00, 0x00, 0xc0, 0xc0, 0x06, 0x60, 0x66, 0x3c, 0x6c, 0x6c, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x36, 0x18, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x18, 0x7c, 0x18, 0xc6, 0xcc, 0x66, 0xde, 0x7e, 0x7c, 0x60, 0xc0, 0x06, 0x30, 0x30, 0x18, 0xd8, 0x36, 0x44, 0xaa, 0x77, 0x18, 0xf8, 0xf8, 0xf6, 0xfe, 0xf8, 0xf6, 0x36, 0xf6, 0xfe, 0xfe, 0xf8, 0xf8, 0x0c, 0x18, 0xc6, 0xcc, 0x66, 0xfe, 0x00, 0x00, 0x30, 0xfe, 0xfe, 0x18, 0x18, 0x18, 0x6c, 0x6c, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x00, 0x18, 0x06, 0x36, 0x06, 0x06, 0x36, 0x18, 0x00, 0x78, 0x38, 0x7c, 0xcc, 0x5c, 0xf6, 0x3e, 0x38, 0x30, 0x00, 0x00, 0x6c, 0x6c, 0x18, 0x36, 0xd8, 0x44, 0xaa, 0x77, 0x18, 0x18, 0xf8, 0x36, 0x00, 0xf8, 0xf6, 0x36, 0xfe, 0xf6, 0x36, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36, 0x36, 0x00, 0x36, 0x36, 0x18, 0x00, 0x60, 0x30, 0x60, 0x60, 0xdc, 0xc6, 0x6c, 0x6c, 0x30, 0x00, 0x00, 0x62, 0x62, 0x18, 0x00, 0x00, 0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36, 0x36, 0x00, 0x36, 0x36, 0x18, 0x00, 0x30, 0x18, 0x30, 0x30, 0x76, 0x00, 0x3c, 0x38, 0x30, 0x00, 0x00, 0xe0, 0xe0, 0x18, 0x00, 0x00, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36, 0x36, 0x00, 0x36, 0x36, 0x18, 0x00, 0x18, 0x0c, 0x18, 0x18, 0x00, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x44, 0xaa, 0x77, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36, 0x36, 0x00, 0x36, 0x36, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x55, 0xdd, 0x18, 0x18, 0x18, 0x36, 0x00, 0x00, 0x36, 0x36, 0x00, 0x36, 0x36, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x78, 0x7c, 0x76, 0x76, 0x76, 0x76, 0x7c, 0x7c, 0x7c, 0x7c, 0x18, 0x18, 0x18, 0xc6, 0xc6, 0xfc, 0x6e, 0xce, 0x7c, 0x7c, 0x7c, 0x78, 0x78, 0x76, 0x7c, 0x7c, 0x18, 0xfe, 0x18, 0xc6, 0x70, 0x3c, 0xcc, 0xc2, 0xcc, 0xcc, 0xcc, 0xcc, 0xc6, 0xc2, 0xc2, 0xc2, 0x18, 0x18, 0x18, 0xc6, 0xc6, 0xc0, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, 0xce, 0xc6, 0xc6, 0x18, 0x60, 0x7e, 0xcc, 0xd8, 0x66, 0xcc, 0xc0, 0xcc, 0xcc, 0xcc, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0x18, 0x18, 0x18, 0xc6, 0xc6, 0xc0, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6, 0x7c, 0x60, 0x18, 0xcc, 0x18, 0xc6, 0xcc, 0xc0, 0xcc, 0xcc, 0xcc, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0x18, 0x18, 0x18, 0xfe, 0xc6, 0xc0, 0x7e, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0x60, 0x7e, 0xcc, 0x18, 0xc0, 0xcc, 0xfe, 0x7c, 0x7c, 0x7c, 0x7c, 0xc0, 0xfe, 0xfe, 0xfe, 0x18, 0x18, 0x18, 0xc6, 0xfe, 0xf0, 0x36, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6, 0xc0, 0x60, 0x18, 0xde, 0x18, 0xc0, 0xcc, 0xc6, 0x0c, 0x0c, 0x0c, 0x0c, 0xc6, 0xc6, 0xc6, 0xc6, 0x18, 0x18, 0x18, 0xc6, 0xc6, 0xc0, 0x36, 0xfe, 0xc6, 0xc6, 0xc6, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6, 0xc0, 0xf8, 0x3c, 0xcc, 0x7e, 0xc0, 0xcc, 0x7c, 0x78, 0x78, 0x78, 0x78, 0x7c, 0x7c, 0x7c, 0x7c, 0x38, 0x38, 0x38, 0x6c, 0x6c, 0xc0, 0xec, 0xcc, 0x7c, 0x7c, 0x7c, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6, 0xc0, 0x60, 0x66, 0xc4, 0x18, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0xc0, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x60, 0x66, 0xf8, 0x18, 0x3c, 0xcc, 0x30, 0x6c, 0x00, 0x18, 0x38, 0x00, 0x6c, 0x00, 0x18, 0x00, 0x66, 0x18, 0x10, 0x10, 0xfc, 0x00, 0x6c, 0x6c, 0x00, 0x18, 0xcc, 0x18, 0x00, 0x7c, 0xc6, 0x7c, 0x62, 0x66, 0xcc, 0x18, 0x00, 0xcc, 0x18, 0x38, 0xcc, 0x30, 0x6c, 0x00, 0x38, 0xc6, 0x30, 0x66, 0x3c, 0x30, 0x00, 0x38, 0x00, 0x00, 0x3e, 0x38, 0xc6, 0x30, 0x78, 0x30, 0xc6, 0x00, 0x00, 0x18, 0x3c, 0x66, 0xcc, 0x1b, 0x00, 0x00, 0x0c, 0x10, 0x00, 0x60, 0x38, 0x00, 0x10, 0x00, 0x60, 0x00, 0x18, 0x60, 0xc6, 0x6c, 0x30, 0x00, 0x00, 0x10, 0x00, 0x60, 0x30, 0x60, 0x00, 0xc6, 0xc6, 0x18, 0x00, 0x00, 0xf8, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xf8, 0x78, 0x7c, 0x7c, 0x30, 0x7c, 0xcc, 0x18, 0x0c, 0xcc, 0x18, 0xc6, 0xcc, 0x78, 0xf8, 0x7c, 0xc0, 0x7c, 0x30, 0x78, 0x10, 0x6c, 0xc6, 0x76, 0xfe, 0x0e, 0x18, 0x70, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xc4, 0xcc, 0xc2, 0x30, 0xcc, 0xcc, 0x18, 0x0c, 0xcc, 0x18, 0xd6, 0xcc, 0xcc, 0xcc, 0xcc, 0xc0, 0x86, 0x30, 0xcc, 0x6c, 0xfe, 0x6c, 0xce, 0xc0, 0x18, 0x18, 0x18, 0x00, 0xfe, 0x00, 0xcc, 0xcc, 0xc0, 0xcc, 0xc0, 0x30, 0xcc, 0xcc, 0x18, 0x0c, 0xd8, 0x18, 0xd6, 0xcc, 0xcc, 0xcc, 0xcc, 0xc0, 0x06, 0x30, 0xcc, 0xc6, 0xd6, 0x38, 0xc6, 0x60, 0x18, 0x18, 0x18, 0x00, 0xc6, 0x00, 0xcc, 0xcc, 0xc0, 0xcc, 0xc0, 0x30, 0xcc, 0xcc, 0x18, 0x0c, 0xf0, 0x18, 0xd6, 0xcc, 0xcc, 0xcc, 0xcc, 0xc0, 0x1c, 0x30, 0xcc, 0xc6, 0xd6, 0x38, 0xc6, 0x30, 0x18, 0x18, 0x18, 0x00, 0xc6, 0x00, 0x7c, 0xcc, 0xc0, 0xcc, 0xfe, 0x30, 0xcc, 0xcc, 0x18, 0x0c, 0xf0, 0x18, 0xd6, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x70, 0x30, 0xcc, 0xc6, 0xd6, 0x38, 0xc6, 0x18, 0x18, 0x18, 0x18, 0x00, 0xc6, 0x00, 0x0c, 0xcc, 0xc4, 0xcc, 0xc6, 0x78, 0xcc, 0xec, 0x18, 0x0c, 0xd8, 0x18, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xec, 0xc2, 0x30, 0xcc, 0xc6, 0xc6, 0x6c, 0xc6, 0x0c, 0x70, 0x18, 0x0e, 0x00, 0x6c, 0x00, 0x78, 0xf8, 0x78, 0x7c, 0x7c, 0x30, 0x7c, 0xd8, 0x38, 0x0c, 0xcc, 0x18, 0xec, 0xb8, 0x78, 0xf8, 0x7c, 0xb8, 0x7c, 0xfc, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0x18, 0x18, 0x18, 0x00, 0x38, 0x00, 0x00, 0xc0, 0x00, 0x0c, 0x00, 0x32, 0x00, 0xc0, 0x00, 0x00, 0xc0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x00, 0x10, 0x0c, 0x00, 0xc0, 0x00, 0x0c, 0x00, 0x36, 0x00, 0xc0, 0x18, 0x0c, 0xc0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x00, 0xc0, 0x00, 0x0c, 0x00, 0x1c, 0x00, 0xc0, 0x18, 0x0c, 0xc0, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x18, 0x70, 0xdc, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfc, 0x3c, 0xf8, 0xfc, 0xc0, 0x3e, 0xc6, 0x18, 0x78, 0xc2, 0xfc, 0xc6, 0xc6, 0x7c, 0xc0, 0x7c, 0xc6, 0x7c, 0x18, 0x7c, 0x10, 0x6c, 0xc6, 0x18, 0xfe, 0x3c, 0x02, 0x3c, 0x00, 0x00, 0xc0, 0xc6, 0xc6, 0x66, 0xdc, 0xc0, 0xc0, 0x66, 0xc6, 0x18, 0xcc, 0xc6, 0xc0, 0xc6, 0xc6, 0xc6, 0xc0, 0xde, 0xc6, 0x86, 0x18, 0xc6, 0x38, 0xee, 0xc6, 0x18, 0xc0, 0x30, 0x06, 0x0c, 0x00, 0x00, 0xdc, 0xc6, 0xc6, 0xc2, 0xce, 0xc0, 0xc0, 0xc6, 0xc6, 0x18, 0xcc, 0xcc, 0xc0, 0xc6, 0xc6, 0xc6, 0xc0, 0xd6, 0xcc, 0x06, 0x18, 0xc6, 0x6c, 0xfe, 0x6c, 0x18, 0xc0, 0x30, 0x0e, 0x0c, 0x00, 0x00, 0xde, 0xc6, 0xc6, 0xc0, 0xc6, 0xc0, 0xc0, 0xc6, 0xc6, 0x18, 0xcc, 0xd8, 0xc0, 0xc6, 0xc6, 0xc6, 0xc0, 0xc6, 0xcc, 0x06, 0x18, 0xc6, 0xc6, 0xd6, 0x7c, 0x18, 0x60, 0x30, 0x1c, 0x0c, 0x00, 0x00, 0xde, 0xfe, 0xc6, 0xc0, 0xc6, 0xc0, 0xc0, 0xde, 0xc6, 0x18, 0x0c, 0xf0, 0xc0, 0xc6, 0xce, 0xc6, 0xc0, 0xc6, 0xd8, 0x0c, 0x18, 0xc6, 0xc6, 0xd6, 0x38, 0x18, 0x30, 0x30, 0x38, 0x0c, 0x00, 0x00, 0xde, 0xc6, 0xfc, 0xc0, 0xc6, 0xf8, 0xf8, 0xc0, 0xfe, 0x18, 0x0c, 0xf0, 0xc0, 0xd6, 0xde, 0xc6, 0xfc, 0xc6, 0xfc, 0x38, 0x18, 0xc6, 0xc6, 0xd6, 0x38, 0x3c, 0x18, 0x30, 0x70, 0x0c, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc0, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x18, 0x0c, 0xd8, 0xc0, 0xfe, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x60, 0x18, 0xc6, 0xc6, 0xc6, 0x7c, 0x66, 0x0c, 0x30, 0xe0, 0x0c, 0x00, 0x00, 0xc6, 0x6c, 0xc6, 0xc2, 0xce, 0xc0, 0xc0, 0xc0, 0xc6, 0x18, 0x0c, 0xcc, 0xc0, 0xfe, 0xf6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc0, 0x18, 0xc6, 0xc6, 0xc6, 0x6c, 0x66, 0x06, 0x30, 0xc0, 0x0c, 0x00, 0x00, 0x7c, 0x38, 0xc6, 0x66, 0xdc, 0xc0, 0xc0, 0x62, 0xc6, 0x18, 0x0c, 0xc6, 0xc0, 0xee, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc2, 0x7e, 0xc6, 0xc6, 0xc6, 0xc6, 0x66, 0x06, 0x30, 0x80, 0x0c, 0xc6, 0x00, 0x00, 0x10, 0xfc, 0x3c, 0xf8, 0xfc, 0xfc, 0x3c, 0xc6, 0x18, 0x1e, 0xc2, 0xc0, 0xc6, 0xc6, 0x7c, 0xfc, 0x7c, 0xfc, 0x7c, 0x7e, 0xc6, 0xc6, 0xc6, 0xc6, 0x66, 0xfe, 0x3c, 0x00, 0x3c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6c, 0x7c, 0x86, 0x76, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x18, 0x00, 0x18, 0x80, 0x38, 0x18, 0xfe, 0x7c, 0x0c, 0x7c, 0x7c, 0x30, 0x7c, 0x78, 0x00, 0x30, 0x06, 0x00, 0x60, 0x18, 0x00, 0x18, 0x00, 0x6c, 0xc6, 0xc6, 0xcc, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x00, 0x18, 0xc0, 0x6c, 0x18, 0xc0, 0x86, 0x0c, 0x86, 0xc6, 0x30, 0xc6, 0x8c, 0x18, 0x18, 0x0c, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0xfe, 0x86, 0x60, 0xcc, 0x00, 0x30, 0x0c, 0x66, 0x18, 0x18, 0x00, 0x00, 0x60, 0xc6, 0x18, 0xc0, 0x06, 0x0c, 0x06, 0xc6, 0x30, 0xc6, 0x06, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x6c, 0x06, 0x30, 0xcc, 0x00, 0x30, 0x0c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x30, 0xe6, 0x18, 0x60, 0x06, 0x0c, 0x06, 0xc6, 0x30, 0xc6, 0x06, 0x00, 0x00, 0x30, 0x7e, 0x0c, 0x18, 0x00, 0x18, 0x00, 0x6c, 0x06, 0x18, 0xdc, 0x00, 0x30, 0x0c, 0xff, 0x7e, 0x00, 0xfe, 0x00, 0x18, 0xf6, 0x18, 0x30, 0x06, 0xfe, 0x06, 0xe6, 0x18, 0xc6, 0x06, 0x00, 0x00, 0x60, 0x00, 0x06, 0x18, 0x00, 0x18, 0x00, 0x6c, 0x7c, 0x0c, 0x76, 0x00, 0x30, 0x0c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x0c, 0xde, 0x18, 0x18, 0x3c, 0xcc, 0xfc, 0xdc, 0x0c, 0x7c, 0x7e, 0x00, 0x00, 0x30, 0x00, 0x0c, 0x18, 0x00, 0x3c, 0x00, 0xfe, 0xc0, 0xc6, 0x38, 0x00, 0x30, 0x0c, 0x66, 0x18, 0x00, 0x00, 0x00, 0x06, 0xce, 0x18, 0x0c, 0x06, 0x6c, 0xc0, 0xc0, 0x06, 0xc6, 0xc6, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x0c, 0x00, 0x3c, 0x24, 0x6c, 0xc2, 0xc2, 0x6c, 0x60, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xc6, 0x78, 0x06, 0x06, 0x3c, 0xc0, 0xc0, 0x06, 0xc6, 0xc6, 0x18, 0x18, 0x0c, 0x00, 0x30, 0xc6, 0x00, 0x3c, 0x66, 0x6c, 0xc6, 0x00, 0x6c, 0x30, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x38, 0xc6, 0x86, 0x1c, 0xc0, 0x60, 0x06, 0xc6, 0xc6, 0x00, 0x00, 0x06, 0x00, 0x60, 0xc6, 0x00, 0x18, 0x66, 0x00, 0x7c, 0x00, 0x38, 0x30, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x18, 0x7c, 0x7c, 0x0c, 0xfe, 0x3c, 0xfe, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x66, 0x00, 0x18, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x10, 0x00, 0x3c, 0x3c, 0x00, 0xff, 0x00, 0xff, 0x78, 0x18, 0xe0, 0xe6, 0x18, 0x80, 0x02, 0x00, 0x66, 0x1b, 0xc6, 0xfe, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xff, 0x38, 0x10, 0x18, 0x18, 0x00, 0xff, 0x3c, 0xc3, 0xcc, 0x18, 0xf0, 0xe7, 0x18, 0xc0, 0x06, 0x18, 0x66, 0x1b, 0x0c, 0xfe, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x10, 0x00, 0x81, 0xff, 0x7c, 0x38, 0x18, 0x18, 0x18, 0xe7, 0x66, 0x99, 0xcc, 0x7e, 0x70, 0x67, 0xdb, 0xe0, 0x0e, 0x3c, 0x00, 0x1b, 0x38, 0xfe, 0x3c, 0x18, 0x7e, 0x18, 0x30, 0xfe, 0x28, 0xfe, 0x38, 0x00, 0x99, 0xe7, 0xfe, 0x7c, 0xe7, 0x7e, 0x3c, 0xc3, 0x42, 0xbd, 0xcc, 0x18, 0x30, 0x63, 0x3c, 0xf0, 0x1e, 0x7e, 0x66, 0x1b, 0x6c, 0xfe, 0x7e, 0x18, 0x18, 0x0c, 0x60, 0xc0, 0x6c, 0x7c, 0x38, 0x00, 0xbd, 0xc3, 0xfe, 0xfe, 0xe7, 0xff, 0x3c, 0xc3, 0x42, 0xbd, 0xcc, 0x3c, 0x30, 0x63, 0xe7, 0xf8, 0x3e, 0x18, 0x66, 0x1b, 0xc6, 0x00, 0x18, 0x18, 0x18, 0xfe, 0xfe, 0xc0, 0xfe, 0x7c, 0x7c, 0x00, 0x81, 0xff, 0xfe, 0x7c, 0xe7, 0xff, 0x18, 0xe7, 0x66, 0x99, 0x78, 0x66, 0x30, 0x63, 0x3c, 0xfe, 0xfe, 0x18, 0x66, 0x7b, 0xc6, 0x00, 0x18, 0x18, 0x18, 0x0c, 0x60, 0xc0, 0x6c, 0x38, 0x7c, 0x00, 0x81, 0xff, 0xfe, 0x38, 0x3c, 0x7e, 0x00, 0xff, 0x3c, 0xc3, 0x32, 0x66, 0x30, 0x63, 0xdb, 0xf8, 0x3e, 0x18, 0x66, 0xdb, 0x6c, 0x00, 0x18, 0x18, 0x18, 0x18, 0x30, 0x00, 0x28, 0x38, 0xfe, 0x00, 0xa5, 0xdb, 0x6c, 0x10, 0x3c, 0x3c, 0x00, 0xff, 0x00, 0xff, 0x1a, 0x66, 0x3f, 0x7f, 0x18, 0xf0, 0x1e, 0x7e, 0x66, 0xdb, 0x38, 0x00, 0x7e, 0x7e, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0xfe, 0x00, 0x81, 0xff, 0x00, 0x00, 0x18, 0x18, 0x00, 0xff, 0x00, 0xff, 0x0e, 0x66, 0x33, 0x63, 0x18, 0xe0, 0x0e, 0x3c, 0x66, 0xdb, 0x60, 0x00, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x1e, 0x3c, 0x3f, 0x7f, 0x00, 0xc0, 0x06, 0x18, 0x66, 0x7f, 0xc6, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; curses-1.4.4/vendor/PDCurses/sdl1/pdcscrn.c0000644000004100000410000002320214201713275020505 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcsdl.h" #include #ifndef PDC_WIDE #include "deffont.h" #endif #include "deficon.h" #ifdef PDC_WIDE # ifndef PDC_FONT_PATH # ifdef _WIN32 #define PDC_FONT_PATH "C:/Windows/Fonts/lucon.ttf" # elif defined(__APPLE__) #define PDC_FONT_PATH "/Library/Fonts/Courier New.ttf" # else #define PDC_FONT_PATH "/usr/share/fonts/truetype/freefont/FreeMono.ttf" # endif # endif TTF_Font *pdc_ttffont = NULL; int pdc_font_size = 18; #endif SDL_Surface *pdc_screen = NULL, *pdc_font = NULL, *pdc_icon = NULL, *pdc_back = NULL, *pdc_tileback = NULL; int pdc_sheight = 0, pdc_swidth = 0, pdc_yoffset = 0, pdc_xoffset = 0; SDL_Color pdc_color[256]; Uint32 pdc_mapped[256]; int pdc_fheight, pdc_fwidth, pdc_flastc; bool pdc_own_screen; /* special purpose function keys */ static int PDC_shutdown_key[PDC_MAX_FUNCTION_KEYS] = { 0, 0, 0, 0, 0 }; /* COLOR_PAIR to attribute encoding table. */ static struct {short f, b;} atrtab[PDC_COLOR_PAIRS]; static void _clean(void) { #ifdef PDC_WIDE if (pdc_ttffont) { TTF_CloseFont(pdc_ttffont); TTF_Quit(); } #endif SDL_FreeSurface(pdc_tileback); SDL_FreeSurface(pdc_back); SDL_FreeSurface(pdc_icon); SDL_FreeSurface(pdc_font); SDL_Quit(); } void PDC_retile(void) { if (pdc_tileback) SDL_FreeSurface(pdc_tileback); pdc_tileback = SDL_DisplayFormat(pdc_screen); if (pdc_tileback == NULL) return; if (pdc_back) { SDL_Rect dest; dest.y = 0; while (dest.y < pdc_tileback->h) { dest.x = 0; while (dest.x < pdc_tileback->w) { SDL_BlitSurface(pdc_back, 0, pdc_tileback, &dest); dest.x += pdc_back->w; } dest.y += pdc_back->h; } SDL_BlitSurface(pdc_tileback, 0, pdc_screen, 0); } } void PDC_scr_close(void) { PDC_LOG(("PDC_scr_close() - called\n")); } void PDC_scr_free(void) { if (SP) free(SP); } static int default_pdc_swidth = 80, default_pdc_sheight = 25; /* open the physical screen -- allocate SP, miscellaneous intialization */ int PDC_scr_open(int argc, char **argv) { int i, r, g, b; PDC_LOG(("PDC_scr_open() - called\n")); SP = calloc(1, sizeof(SCREEN)); if (!SP) return ERR; pdc_own_screen = !pdc_screen; if (pdc_own_screen) { if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER) < 0) { fprintf(stderr, "Could not start SDL: %s\n", SDL_GetError()); return ERR; } atexit(_clean); } #ifdef PDC_WIDE if (!pdc_ttffont) { const char *ptsz, *fname; if (TTF_Init() == -1) { fprintf(stderr, "Could not start SDL_TTF: %s\n", SDL_GetError()); return ERR; } ptsz = getenv("PDC_FONT_SIZE"); if (ptsz != NULL) pdc_font_size = atoi(ptsz); if (pdc_font_size <= 0) pdc_font_size = 18; fname = getenv("PDC_FONT"); pdc_ttffont = TTF_OpenFont(fname ? fname : PDC_FONT_PATH, pdc_font_size); } if (!pdc_ttffont) { fprintf(stderr, "Could not load font\n"); return ERR; } TTF_SetFontKerning(pdc_ttffont, 0); TTF_SetFontHinting(pdc_ttffont, TTF_HINTING_MONO); SP->mono = FALSE; #else if (!pdc_font) { const char *fname = getenv("PDC_FONT"); pdc_font = SDL_LoadBMP(fname ? fname : "pdcfont.bmp"); } if (!pdc_font) pdc_font = SDL_LoadBMP_RW(SDL_RWFromMem(deffont, sizeof(deffont)), 0); if (!pdc_font) { fprintf(stderr, "Could not load font\n"); return ERR; } SP->mono = !pdc_font->format->palette; #endif if (!SP->mono && !pdc_back) { const char *bname = getenv("PDC_BACKGROUND"); pdc_back = SDL_LoadBMP(bname ? bname : "pdcback.bmp"); } if (!SP->mono && (pdc_back || !pdc_own_screen)) { SP->orig_attr = TRUE; SP->orig_fore = COLOR_WHITE; SP->orig_back = -1; } else SP->orig_attr = FALSE; #ifdef PDC_WIDE TTF_SizeText(pdc_ttffont, "W", &pdc_fwidth, &pdc_fheight); #else pdc_fheight = pdc_font->h / 8; pdc_fwidth = pdc_font->w / 32; if (!SP->mono) pdc_flastc = pdc_font->format->palette->ncolors - 1; #endif if (pdc_own_screen && !pdc_icon) { const char *iname = getenv("PDC_ICON"); pdc_icon = SDL_LoadBMP(iname ? iname : "pdcicon.bmp"); if (!pdc_icon) pdc_icon = SDL_LoadBMP_RW(SDL_RWFromMem(deficon, sizeof(deficon)), 0); if (pdc_icon) SDL_WM_SetIcon(pdc_icon, NULL); } if (pdc_own_screen) { const char *env = getenv("PDC_LINES"); pdc_sheight = (env ? atoi(env) : default_pdc_sheight) * pdc_fheight; env = getenv("PDC_COLS"); pdc_swidth = (env ? atoi(env) : default_pdc_swidth) * pdc_fwidth; pdc_screen = SDL_SetVideoMode(pdc_swidth, pdc_sheight, 0, SDL_SWSURFACE|SDL_ANYFORMAT|SDL_RESIZABLE); } else { if (!pdc_sheight) pdc_sheight = pdc_screen->h - pdc_yoffset; if (!pdc_swidth) pdc_swidth = pdc_screen->w - pdc_xoffset; } if (!pdc_screen) { fprintf(stderr, "Couldn't create a surface: %s\n", SDL_GetError()); return ERR; } if (SP->orig_attr) PDC_retile(); COLORS = 256; /* we have 256 colors in this flavor of PDCurses */ for (i = 0; i < 8; i++) { pdc_color[i].r = (i & COLOR_RED) ? 0xc0 : 0; pdc_color[i].g = (i & COLOR_GREEN) ? 0xc0 : 0; pdc_color[i].b = (i & COLOR_BLUE) ? 0xc0 : 0; pdc_color[i + 8].r = (i & COLOR_RED) ? 0xff : 0x40; pdc_color[i + 8].g = (i & COLOR_GREEN) ? 0xff : 0x40; pdc_color[i + 8].b = (i & COLOR_BLUE) ? 0xff : 0x40; } /* 256-color xterm extended palette: 216 colors in a 6x6x6 color cube, plus 24 (not 50) shades of gray */ i = 16; for( r = 0; r < 6; r++) for( g = 0; g < 6; g++) for( b = 0; b < 6; b++, i++) { pdc_color[i].r = ( r ? r * 40 + 55 : 0); pdc_color[i].g = ( g ? g * 40 + 55 : 0); pdc_color[i].b = ( b ? b * 40 + 55 : 0); } for( i = 232; i < 256; i++) pdc_color[i].r = pdc_color[i].g = pdc_color[i].b = (i - 232) * 10 + 8; for (i = 0; i < 256; i++) pdc_mapped[i] = SDL_MapRGB(pdc_screen->format, pdc_color[i].r, pdc_color[i].g, pdc_color[i].b); SDL_EnableUNICODE(1); PDC_mouse_set(); if (pdc_own_screen) PDC_set_title(argc ? argv[0] : "PDCurses"); SP->lines = PDC_get_rows(); SP->cols = PDC_get_columns(); SP->mouse_wait = PDC_CLICK_PERIOD; SP->audible = FALSE; PDC_reset_prog_mode(); return OK; } /* the core of resize_term() */ int PDC_resize_screen(int nlines, int ncols) { if( !stdscr) /* window hasn't been created yet; we're */ { /* specifying its size before doing so */ default_pdc_swidth = ncols; default_pdc_sheight = nlines; return OK; } if (!pdc_own_screen) return ERR; if (nlines && ncols) { pdc_sheight = nlines * pdc_fheight; pdc_swidth = ncols * pdc_fwidth; } SDL_FreeSurface(pdc_screen); pdc_screen = SDL_SetVideoMode(pdc_swidth, pdc_sheight, 0, SDL_SWSURFACE|SDL_ANYFORMAT|SDL_RESIZABLE); if (pdc_tileback) PDC_retile(); SP->resized = FALSE; SP->cursrow = SP->curscol = 0; return OK; } void PDC_reset_prog_mode(void) { PDC_LOG(("PDC_reset_prog_mode() - called.\n")); PDC_flushinp(); SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); } void PDC_reset_shell_mode(void) { PDC_LOG(("PDC_reset_shell_mode() - called.\n")); SDL_EnableKeyRepeat(0, 0); PDC_flushinp(); } void PDC_restore_screen_mode(int i) { } void PDC_save_screen_mode(int i) { } void PDC_init_pair(short pair, short fg, short bg) { atrtab[pair].f = fg; atrtab[pair].b = bg; } int PDC_pair_content(short pair, short *fg, short *bg) { *fg = atrtab[pair].f; *bg = atrtab[pair].b; return OK; } bool PDC_can_change_color(void) { return TRUE; } int PDC_color_content(short color, short *red, short *green, short *blue) { *red = DIVROUND(pdc_color[color].r * 1000, 255); *green = DIVROUND(pdc_color[color].g * 1000, 255); *blue = DIVROUND(pdc_color[color].b * 1000, 255); return OK; } int PDC_init_color(short color, short red, short green, short blue) { pdc_color[color].r = DIVROUND(red * 255, 1000); pdc_color[color].g = DIVROUND(green * 255, 1000); pdc_color[color].b = DIVROUND(blue * 255, 1000); pdc_mapped[color] = SDL_MapRGB(pdc_screen->format, pdc_color[color].r, pdc_color[color].g, pdc_color[color].b); wrefresh(curscr); return OK; } /* Does nothing in the SDL flavors of PDCurses. That may change, eventually, allowing one to limit the range of user-resizable windows. See X11 or Win32a versions of this function for details. */ void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines, const int new_min_cols, const int new_max_cols) { } /* PDC_set_function_key() does nothing on this platform */ int PDC_set_function_key( const unsigned function, const int new_key) { int old_key = -1; if( function < PDC_MAX_FUNCTION_KEYS) { old_key = PDC_shutdown_key[function]; PDC_shutdown_key[function] = new_key; } return( old_key); } curses-1.4.4/vendor/PDCurses/sdl1/Makefile.mng0000644000004100000410000000404614201713275021132 0ustar www-datawww-data# Makefile for PDCurses library for SDL for MinGW # # Usage: [g]make -f Makefile.mng [DEBUG=Y] [WIDE=Y] [UTF8=Y] [target] # # where target can be any of: # [all|demos|libpdcurses.a|testcurs]... O = o RM = rm ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. endif include $(PDCURSES_SRCDIR)/libobjs.mif osdir = $(PDCURSES_SRCDIR)/sdl1 PDCURSES_SDL_H = $(osdir)/pdcsdl.h SLIBS = -lSDL ifeq ($(DEBUG),Y) CFLAGS = -g -Wall -DPDCDEBUG else CFLAGS = -O2 -Wall endif ifeq ($(WIDE),Y) CFLAGS += -DPDC_WIDE SLIBS += -lSDL_ttf endif ifeq ($(UTF8),Y) CFLAGS += -DPDC_FORCE_UTF8 endif ifdef CHTYPE_32 CFLAGS += -DCHTYPE_32 endif ifdef CHTYPE_16 CFLAGS += -DCHTYPE_16 endif CC = gcc BUILD = $(CC) $(CFLAGS) -I$(PDCURSES_SRCDIR) LDFLAGS = -mwindows $(LIBCURSES) ifeq ($(DLL),Y) BUILD += -DPDC_DLL_BUILD LIBFLAGS = -Wl,--out-implib,libpdcurses.a -shared -o LIBCURSES = pdcurses.dll CLEAN = $(LIBCURSES) *.a POST = $(SLIBS) else LIBEXE = ar LIBFLAGS = rcv LIBCURSES = libpdcurses.a CLEAN = *.a LDFLAGS += $(SLIBS) endif DEMOS += sdltest.exe .PHONY: all libs clean demos all: libs demos libs: $(LIBCURSES) clean: -$(RM) *.o $(CLEAN) *.exe demos: $(DEMOS) ifneq ($(DEBUG),Y) strip *.exe endif $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) $(LIBFLAGS) $@ $? $(POST) $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_SDL_H) $(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) tui.o tuidemo.o : $(PDCURSES_CURSES_H) terminfo.o: $(TERM_HEADER) panel.o ptest.exe: $(PANEL_HEADER) $(LIBOBJS) : %.o: $(srcdir)/%.c $(BUILD) -c $< $(PDCOBJS) : %.o: $(osdir)/%.c $(BUILD) -c $< firework.exe ozdemo.exe newtest.exe rain.exe testcurs.exe worm.exe xmas.exe \ ptest.exe: %.exe: $(demodir)/%.c $(BUILD) -o $@ $< $(LDFLAGS) sdltest.exe: $(osdir)/sdltest.c $(BUILD) -o $@ $< -mwindows $(LIBCURSES) -lmingw32 -lSDLmain -lSDL tuidemo.exe: tuidemo.o tui.o $(CC) -o $@ tuidemo.o tui.o $(LDFLAGS) tui.o: $(demodir)/tui.c $(demodir)/tui.h $(BUILD) -c $< tuidemo.o: $(demodir)/tuidemo.c $(demodir)/tui.h $(BUILD) -c $< curses-1.4.4/vendor/PDCurses/libobjs.mif0000644000004100000410000000220114201713275020157 0ustar www-datawww-data# Common elements for most of the DOS, OS/2 and Win32 # makefiles (not Watcom or LCC) PDCURSES_CURSES_H = $(PDCURSES_SRCDIR)/curses.h PDCURSES_CURSPRIV_H = $(PDCURSES_SRCDIR)/curspriv.h PDCURSES_HEADERS = $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H) PANEL_HEADER = $(PDCURSES_SRCDIR)/panel.h TERM_HEADER = $(PDCURSES_SRCDIR)/term.h srcdir = $(PDCURSES_SRCDIR)/pdcurses demodir = $(PDCURSES_SRCDIR)/demos LIBOBJS = addch.$(O) addchstr.$(O) addstr.$(O) attr.$(O) beep.$(O) \ bkgd.$(O) border.$(O) clear.$(O) color.$(O) delch.$(O) deleteln.$(O) \ deprec.$(O) getch.$(O) getstr.$(O) getyx.$(O) inch.$(O) inchstr.$(O) \ initscr.$(O) inopts.$(O) insch.$(O) insstr.$(O) instr.$(O) kernel.$(O) \ keyname.$(O) mouse.$(O) move.$(O) outopts.$(O) overlay.$(O) pad.$(O) \ panel.$(O) printw.$(O) refresh.$(O) scanw.$(O) scr_dump.$(O) scroll.$(O) \ slk.$(O) termattr.$(O) terminfo.$(O) touch.$(O) util.$(O) window.$(O) \ debug.$(O) PDCOBJS = pdcclip.$(O) pdcdisp.$(O) pdcgetsc.$(O) pdckbd.$(O) pdcscrn.$(O) \ pdcsetsc.$(O) pdcutil.$(O) DEMOS = testcurs.exe ozdemo.exe xmas.exe tuidemo.exe firework.exe \ newtest.exe ptest.exe rain.exe worm.exe curses-1.4.4/vendor/PDCurses/CMakeLists.txt0000644000004100000410000000325214201713275020605 0ustar www-datawww-datacmake_minimum_required(VERSION 3.11) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING "Choose the type of build, options are: Debug, Release, or MinSizeRel." FORCE) message(STATUS "CMAKE_BUILD_TYPE not set, defaulting to MinSizeRel.") endif() set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/cmake") include (get_version) if(MSVC) set(CMAKE_DEBUG_POSTFIX d) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") # enable parallel builds endif() message(STATUS "Generator .............. ${CMAKE_GENERATOR}") message(STATUS "Build Type ............. ${CMAKE_BUILD_TYPE}") include(build_options) include(build_dependencies) project(pdcurses VERSION "${CURSES_VERSION}" LANGUAGES C) message(STATUS "PDC Version ............ ${PROJECT_VERSION}") include(gen_config_header) file(GLOB pdcurses_src_files pdcurses/*.c) if(CYGWIN) message(STATUS "Windows Kit UM lib path = ${WINDOWS_KIT_LIBRARY_DIR}") link_directories(${WINDOWS_KIT_LIBRARY_DIR}) endif() if(PDC_DOS_BUILD) # currently requires a unique toolchain file add_subdirectory(dos) elseif(PDC_OS2_BUILD) # currently requires a unique toolchain file add_subdirectory(os2) else() add_subdirectory(ncurses) if(PDC_SDL2_BUILD) add_subdirectory(sdl2) endif() if(UNIX) add_subdirectory(vt) endif() if(WIN32) add_subdirectory(wincon) add_subdirectory(wingui) endif() endif() add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_SOURCE_DIR}/cmake/make_uninstall.cmake") set(CPACK_COMPONENTS_ALL applications) curses-1.4.4/vendor/PDCurses/pdcurses/0000755000004100000410000000000014201713275017673 5ustar www-datawww-datacurses-1.4.4/vendor/PDCurses/pdcurses/beep.c0000644000004100000410000000236114201713275020754 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** beep ---- ### Synopsis int beep(void); int flash(void); ### Description beep() sounds the audible bell on the terminal, if possible; if not, it calls flash(). flash() "flashes" the screen, by inverting the foreground and background of every cell, pausing, and then restoring the original attributes. ### Return Value These functions return OK. ### Portability X/Open BSD SYS V beep Y Y Y flash Y Y Y **man-end****************************************************************/ int beep(void) { PDC_LOG(("beep() - called\n")); if (SP->audible) PDC_beep(); else flash(); return OK; } int flash(void) { int z, y, x; PDC_LOG(("flash() - called\n")); /* Reverse each cell; wait; restore the screen */ for (z = 0; z < 2; z++) { for (y = 0; y < LINES; y++) for (x = 0; x < COLS; x++) curscr->_y[y][x] ^= A_REVERSE; wrefresh(curscr); if (!z) napms(50); } return OK; } curses-1.4.4/vendor/PDCurses/pdcurses/delch.c0000644000004100000410000000370614201713275021124 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** delch ----- ### Synopsis int delch(void); int wdelch(WINDOW *win); int mvdelch(int y, int x); int mvwdelch(WINDOW *win, int y, int x); ### Description The character under the cursor in the window is deleted. All characters to the right on the same line are moved to the left one position and the last character on the line is filled with a blank. The cursor position does not change (after moving to y, x if coordinates are specified). ### Return Value All functions return OK on success and ERR on error. ### Portability X/Open BSD SYS V delch Y Y Y wdelch Y Y Y mvdelch Y Y Y mvwdelch Y Y Y **man-end****************************************************************/ #include int wdelch(WINDOW *win) { int y, x, maxx; chtype *temp1; PDC_LOG(("wdelch() - called\n")); if (!win) return ERR; y = win->_cury; x = win->_curx; maxx = win->_maxx - 1; temp1 = &win->_y[y][x]; memmove(temp1, temp1 + 1, (maxx - x) * sizeof(chtype)); /* wrs (4/10/93) account for window background */ win->_y[y][maxx] = win->_bkgd; win->_lastch[y] = maxx; if ((win->_firstch[y] == _NO_CHANGE) || (win->_firstch[y] > x)) win->_firstch[y] = x; PDC_sync(win); return OK; } int delch(void) { PDC_LOG(("delch() - called\n")); return wdelch(stdscr); } int mvdelch(int y, int x) { PDC_LOG(("mvdelch() - called\n")); if (move(y, x) == ERR) return ERR; return wdelch(stdscr); } int mvwdelch(WINDOW *win, int y, int x) { PDC_LOG(("mvwdelch() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return wdelch(win); } curses-1.4.4/vendor/PDCurses/pdcurses/scanw.c0000644000004100000410000003700414201713275021156 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** scanw ----- ### Synopsis int scanw(const char *fmt, ...); int wscanw(WINDOW *win, const char *fmt, ...); int mvscanw(int y, int x, const char *fmt, ...); int mvwscanw(WINDOW *win, int y, int x, const char *fmt, ...); int vwscanw(WINDOW *win, const char *fmt, va_list varglist); int vw_scanw(WINDOW *win, const char *fmt, va_list varglist); ### Description These routines correspond to the standard C library's scanf() family. Each gets a string from the window via wgetnstr(), and uses the resulting line as input for the scan. ### Return Value On successful completion, these functions return the number of items successfully matched. Otherwise they return ERR. ### Portability X/Open BSD SYS V scanw Y Y Y wscanw Y Y Y mvscanw Y Y Y mvwscanw Y Y Y vwscanw Y - 4.0 vw_scanw Y **man-end****************************************************************/ #include #ifndef HAVE_VSSCANF # include # include # include static int _pdc_vsscanf(const char *, const char *, va_list); # define vsscanf _pdc_vsscanf #endif int vwscanw(WINDOW *win, const char *fmt, va_list varglist) { char scanbuf[256]; PDC_LOG(("vwscanw() - called\n")); if (wgetnstr(win, scanbuf, 255) == ERR) return ERR; return vsscanf(scanbuf, fmt, varglist); } int scanw(const char *fmt, ...) { va_list args; int retval; PDC_LOG(("scanw() - called\n")); va_start(args, fmt); retval = vwscanw(stdscr, fmt, args); va_end(args); return retval; } int wscanw(WINDOW *win, const char *fmt, ...) { va_list args; int retval; PDC_LOG(("wscanw() - called\n")); va_start(args, fmt); retval = vwscanw(win, fmt, args); va_end(args); return retval; } int mvscanw(int y, int x, const char *fmt, ...) { va_list args; int retval; PDC_LOG(("mvscanw() - called\n")); if (move(y, x) == ERR) return ERR; va_start(args, fmt); retval = vwscanw(stdscr, fmt, args); va_end(args); return retval; } int mvwscanw(WINDOW *win, int y, int x, const char *fmt, ...) { va_list args; int retval; PDC_LOG(("mvscanw() - called\n")); if (wmove(win, y, x) == ERR) return ERR; va_start(args, fmt); retval = vwscanw(win, fmt, args); va_end(args); return retval; } int vw_scanw(WINDOW *win, const char *fmt, va_list varglist) { PDC_LOG(("vw_scanw() - called\n")); return vwscanw(win, fmt, varglist); } #ifndef HAVE_VSSCANF /* _pdc_vsscanf() - Internal routine to parse and format an input buffer. It scans a series of input fields; each field is formatted according to a supplied format string and the formatted input is stored in the variable number of addresses passed. Returns the number of input fields or EOF on error. Don't compile this unless required. Some compilers (at least Borland C++ 3.0) have to link with math libraries due to the use of floats. Based on vsscanf.c and input.c from emx 0.8f library source, Copyright (c) 1990-1992 by Eberhard Mattes, who has kindly agreed to its inclusion in PDCurses. */ #define WHITE(x) ((x) == ' ' || (x) == '\t' || (x) == '\n') #define NEXT(x) \ do { \ x = *buf++; \ if (!x) \ return (count ? count : EOF); \ ++chars; \ } while (0) #define UNGETC() \ do { \ --buf; --chars; \ } while (0) static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr) { int count, chars, c, width, radix, d, i; int *int_ptr; long *long_ptr; short *short_ptr; char *char_ptr; unsigned char f; char neg, assign, ok, size; long n; char map[256], end; double dx, dd, *dbl_ptr; float *flt_ptr; int exp; char eneg; count = 0; chars = 0; c = 0; while ((f = *fmt) != 0) { if (WHITE(f)) { do { ++fmt; f = *fmt; } while (WHITE(f)); do { c = *buf++; if (!c) { if (!f || count) return count; else return EOF; } else ++chars; } while (WHITE(c)); UNGETC(); } else if (f != '%') { NEXT(c); if (c != f) return count; ++fmt; } else { assign = TRUE; width = INT_MAX; char_ptr = NULL; ++fmt; if (*fmt == '*') { assign = FALSE; ++fmt; } if (isdigit(*fmt)) { width = 0; while (isdigit(*fmt)) width = width * 10 + (*fmt++ - '0'); if (!width) width = INT_MAX; } size = 0; if (*fmt == 'h' || *fmt == 'l') size = *fmt++; f = *fmt; switch (f) { case 'c': if (width == INT_MAX) width = 1; if (assign) char_ptr = va_arg(arg_ptr, char *); while (width > 0) { --width; NEXT(c); if (assign) { *char_ptr++ = (char) c; ++count; } } break; case '[': memset(map, 0, 256); end = 0; ++fmt; if (*fmt == '^') { ++fmt; end = 1; } i = 0; for (;;) { f = (unsigned char) *fmt; switch (f) { case 0: /* avoid skipping past 0 */ --fmt; NEXT(c); goto string; case ']': if (i > 0) { NEXT(c); goto string; } /* no break */ default: if (fmt[1] == '-' && fmt[2] && f < (unsigned char)fmt[2]) { memset(map + f, 1, (unsigned char)fmt[2] - f); fmt += 2; } else map[f] = 1; break; } ++fmt; ++i; } case 's': memset(map, 0, 256); map[' '] = 1; map['\n'] = 1; map['\r'] = 1; map['\t'] = 1; end = 1; do { NEXT(c); } while (WHITE(c)); string: if (assign) char_ptr = va_arg(arg_ptr, char *); while (width > 0 && map[(unsigned char) c] != end) { --width; if (assign) *char_ptr++ = (char) c; c = *buf++; if (!c) break; else ++chars; } if (assign) { *char_ptr = 0; ++count; } if (!c) return count; else UNGETC(); break; case 'f': case 'e': case 'E': case 'g': case 'G': neg = ok = FALSE; dx = 0.0; do { NEXT(c); } while (WHITE(c)); if (c == '+') { NEXT(c); --width; } else if (c == '-') { neg = TRUE; NEXT(c); --width; } while (width > 0 && isdigit(c)) { --width; dx = dx * 10.0 + (double) (c - '0'); ok = TRUE; c = *buf++; if (!c) break; else ++chars; } if (width > 0 && c == '.') { --width; dd = 10.0; NEXT(c); while (width > 0 && isdigit(c)) { --width; dx += (double) (c - '0') / dd; dd *= 10.0; ok = TRUE; c = *buf++; if (!c) break; else ++chars; } } if (!ok) return count; if (width > 0 && (c == 'e' || c == 'E')) { eneg = FALSE; exp = 0; NEXT(c); --width; if (width > 0 && c == '+') { NEXT(c); --width; } else if (width > 0 && c == '-') { eneg = TRUE; NEXT(c); --width; } if (!(width > 0 && isdigit(c))) { UNGETC(); return count; } while (width > 0 && isdigit(c)) { --width; exp = exp * 10 + (c - '0'); c = *buf++; if (!c) break; else ++chars; } if (eneg) exp = -exp; while (exp > 0) { dx *= 10.0; --exp; } while (exp < 0) { dx /= 10.0; ++exp; } } if (assign) { if (neg) dx = -dx; if (size == 'l') { dbl_ptr = va_arg(arg_ptr, double *); *dbl_ptr = dx; } else { flt_ptr = va_arg(arg_ptr, float *); *flt_ptr = (float)dx; } ++count; } if (!c) return count; else UNGETC(); break; case 'i': neg = FALSE; radix = 10; do { NEXT(c); } while (WHITE(c)); if (!(width > 0 && c == '0')) goto scan_complete_number; NEXT(c); --width; if (width > 0 && (c == 'x' || c == 'X')) { NEXT(c); radix = 16; --width; } else if (width > 0 && (c >= '0' && c <= '7')) radix = 8; goto scan_unsigned_number; case 'd': case 'u': case 'o': case 'x': case 'X': do { NEXT(c); } while (WHITE(c)); switch (f) { case 'o': radix = 8; break; case 'x': case 'X': radix = 16; break; default: radix = 10; break; } scan_complete_number: neg = FALSE; if (width > 0 && c == '+') { NEXT(c); --width; } else if (width > 0 && c == '-' && radix == 10) { neg = TRUE; NEXT(c); --width; } scan_unsigned_number: n = 0; ok = FALSE; while (width > 0) { --width; if (isdigit(c)) d = c - '0'; else if (isupper(c)) d = c - 'A' + 10; else if (islower(c)) d = c - 'a' + 10; else break; if (d < 0 || d >= radix) break; ok = TRUE; n = n * radix + d; c = *buf++; if (!c) break; else ++chars; } if (!ok) return count; if (assign) { if (neg) n = -n; switch (size) { case 'h': short_ptr = va_arg(arg_ptr, short *); *short_ptr = (short) n; break; case 'l': long_ptr = va_arg(arg_ptr, long *); *long_ptr = (long) n; break; default: int_ptr = va_arg(arg_ptr, int *); *int_ptr = (int) n; } ++count; } if (!c) return count; else UNGETC(); break; case 'n': if (assign) { int_ptr = va_arg(arg_ptr, int *); *int_ptr = chars; ++count; } break; default: if (!f) /* % at end of string */ return count; NEXT(c); if (c != f) return count; break; } ++fmt; } } return count; } #endif /* HAVE_VSSCANF */ curses-1.4.4/vendor/PDCurses/pdcurses/terminfo.c0000644000004100000410000001064214201713275021665 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** terminfo -------- ### Synopsis int mvcur(int oldrow, int oldcol, int newrow, int newcol); int vidattr(chtype attr); int vid_attr(attr_t attr, short color_pair, void *opt); int vidputs(chtype attr, int (*putfunc)(int)); int vid_puts(attr_t attr, short color_pair, void *opt, int (*putfunc)(int)); int del_curterm(TERMINAL *); int putp(const char *); int restartterm(const char *, int, int *); TERMINAL *set_curterm(TERMINAL *); int setterm(const char *term); int setupterm(const char *, int, int *); int tgetent(char *, const char *); int tgetflag(const char *); int tgetnum(const char *); char *tgetstr(const char *, char **); char *tgoto(const char *, int, int); int tigetflag(const char *); int tigetnum(const char *); char *tigetstr(const char *); char *tparm(const char *,long, long, long, long, long, long, long, long, long); int tputs(const char *, int, int (*)(int)); ### Description mvcur() lets you move the physical cursor without updating any window cursor positions. It returns OK or ERR. The rest of these functions are currently implemented as stubs, returning the appropriate errors and doing nothing else. ### Portability X/Open BSD SYS V mvcur Y Y Y **man-end****************************************************************/ #include TERMINAL *cur_term = NULL; int mvcur(int oldrow, int oldcol, int newrow, int newcol) { PDC_LOG(("mvcur() - called: oldrow %d oldcol %d newrow %d newcol %d\n", oldrow, oldcol, newrow, newcol)); if ((newrow >= LINES) || (newcol >= COLS) || (newrow < 0) || (newcol < 0)) return ERR; PDC_gotoyx(newrow, newcol); SP->cursrow = newrow; SP->curscol = newcol; return OK; } int vidattr(chtype attr) { PDC_LOG(("vidattr() - called: attr %d\n", attr)); return ERR; } int vid_attr(attr_t attr, short color_pair, void *opt) { PDC_LOG(("vid_attr() - called\n")); return ERR; } int vidputs(chtype attr, int (*putfunc)(int)) { PDC_LOG(("vidputs() - called: attr %d\n", attr)); return ERR; } int vid_puts(attr_t attr, short color_pair, void *opt, int (*putfunc)(int)) { PDC_LOG(("vid_puts() - called\n")); return ERR; } int del_curterm(TERMINAL *oterm) { PDC_LOG(("del_curterm() - called\n")); return ERR; } int putp(const char *str) { PDC_LOG(("putp() - called: str %s\n", str)); return ERR; } int restartterm(const char *term, int filedes, int *errret) { PDC_LOG(("restartterm() - called\n")); if (errret) *errret = -1; return ERR; } TERMINAL *set_curterm(TERMINAL *nterm) { PDC_LOG(("set_curterm() - called\n")); return (TERMINAL *)NULL; } int setterm(const char *term) { PDC_LOG(("setterm() - called\n")); return ERR; } int setupterm(const char *term, int filedes, int *errret) { PDC_LOG(("setupterm() - called\n")); if (errret) *errret = -1; else fprintf(stderr, "There is no terminfo database\n"); return ERR; } int tgetent(char *bp, const char *name) { PDC_LOG(("tgetent() - called: name %s\n", name)); return ERR; } int tgetflag(const char *id) { PDC_LOG(("tgetflag() - called: id %s\n", id)); return ERR; } int tgetnum(const char *id) { PDC_LOG(("tgetnum() - called: id %s\n", id)); return ERR; } char *tgetstr(const char *id, char **area) { PDC_LOG(("tgetstr() - called: id %s\n", id)); return (char *)NULL; } char *tgoto(const char *cap, int col, int row) { PDC_LOG(("tgoto() - called\n")); return (char *)NULL; } int tigetflag(const char *capname) { PDC_LOG(("tigetflag() - called: capname %s\n", capname)); return -1; } int tigetnum(const char *capname) { PDC_LOG(("tigetnum() - called: capname %s\n", capname)); return -2; } char *tigetstr(const char *capname) { PDC_LOG(("tigetstr() - called: capname %s\n", capname)); return (char *)(-1); } char *tparm(const char *cap, long p1, long p2, long p3, long p4, long p5, long p6, long p7, long p8, long p9) { PDC_LOG(("tparm() - called: cap %s\n", cap)); return (char *)NULL; } int tputs(const char *str, int affcnt, int (*putfunc)(int)) { PDC_LOG(("tputs() - called\n")); return ERR; } curses-1.4.4/vendor/PDCurses/pdcurses/touch.c0000644000004100000410000000753414201713275021172 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** touch ----- ### Synopsis int touchwin(WINDOW *win); int touchline(WINDOW *win, int start, int count); int untouchwin(WINDOW *win); int wtouchln(WINDOW *win, int y, int n, int changed); bool is_linetouched(WINDOW *win, int line); bool is_wintouched(WINDOW *win); ### Description touchwin() and touchline() throw away all information about which parts of the window have been touched, pretending that the entire window has been drawn on. This is sometimes necessary when using overlapping windows, since a change to one window will affect the other window, but the records of which lines have been changed in the other window will not reflect the change. untouchwin() marks all lines in the window as unchanged since the last call to wrefresh(). wtouchln() makes n lines in the window, starting at line y, look as if they have (changed == 1) or have not (changed == 0) been changed since the last call to wrefresh(). is_linetouched() returns TRUE if the specified line in the specified window has been changed since the last call to wrefresh(). is_wintouched() returns TRUE if the specified window has been changed since the last call to wrefresh(). ### Return Value All functions return OK on success and ERR on error except is_wintouched() and is_linetouched(). ### Portability X/Open BSD SYS V touchwin Y Y Y touchline Y - 3.0 untouchwin Y - 4.0 wtouchln Y Y Y is_linetouched Y - 4.0 is_wintouched Y - 4.0 **man-end****************************************************************/ int touchwin(WINDOW *win) { int i; PDC_LOG(("touchwin() - called: Win=%x\n", win)); if (!win) return ERR; for (i = 0; i < win->_maxy; i++) { win->_firstch[i] = 0; win->_lastch[i] = win->_maxx - 1; } return OK; } int touchline(WINDOW *win, int start, int count) { int i; PDC_LOG(("touchline() - called: win=%p start %d count %d\n", win, start, count)); if (!win || start > win->_maxy || start + count > win->_maxy) return ERR; for (i = start; i < start + count; i++) { win->_firstch[i] = 0; win->_lastch[i] = win->_maxx - 1; } return OK; } int untouchwin(WINDOW *win) { int i; PDC_LOG(("untouchwin() - called: win=%p", win)); if (!win) return ERR; for (i = 0; i < win->_maxy; i++) { win->_firstch[i] = _NO_CHANGE; win->_lastch[i] = _NO_CHANGE; } return OK; } int wtouchln(WINDOW *win, int y, int n, int changed) { int i; PDC_LOG(("wtouchln() - called: win=%p y=%d n=%d changed=%d\n", win, y, n, changed)); if (!win || y > win->_maxy || y + n > win->_maxy) return ERR; for (i = y; i < y + n; i++) { if (changed) { win->_firstch[i] = 0; win->_lastch[i] = win->_maxx - 1; } else { win->_firstch[i] = _NO_CHANGE; win->_lastch[i] = _NO_CHANGE; } } return OK; } bool is_linetouched(WINDOW *win, int line) { PDC_LOG(("is_linetouched() - called: win=%p line=%d\n", win, line)); if (!win || line > win->_maxy || line < 0) return FALSE; return (win->_firstch[line] != _NO_CHANGE) ? TRUE : FALSE; } bool is_wintouched(WINDOW *win) { int i; PDC_LOG(("is_wintouched() - called: win=%p\n", win)); if (win) for (i = 0; i < win->_maxy; i++) if (win->_firstch[i] != _NO_CHANGE) return TRUE; return FALSE; } curses-1.4.4/vendor/PDCurses/pdcurses/move.c0000644000004100000410000000243014201713275021004 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** move ---- ### Synopsis int move(int y, int x); int wmove(WINDOW *win, int y, int x); ### Description The cursor associated with the window is moved to the given location. This does not move the physical cursor of the terminal until refresh() is called. The position specified is relative to the upper left corner of the window, which is (0,0). ### Return Value All functions return OK on success and ERR on error. ### Portability X/Open BSD SYS V move Y Y Y wmove Y Y Y **man-end****************************************************************/ int move(int y, int x) { PDC_LOG(("move() - called: y=%d x=%d\n", y, x)); if (!stdscr || x < 0 || y < 0 || x >= stdscr->_maxx || y >= stdscr->_maxy) return ERR; stdscr->_curx = x; stdscr->_cury = y; return OK; } int wmove(WINDOW *win, int y, int x) { PDC_LOG(("wmove() - called: y=%d x=%d\n", y, x)); if (!win || x < 0 || y < 0 || x >= win->_maxx || y >= win->_maxy) return ERR; win->_curx = x; win->_cury = y; return OK; } curses-1.4.4/vendor/PDCurses/pdcurses/README.md0000644000004100000410000000072414201713275021155 0ustar www-datawww-dataPDCurses Portable Core ====================== This directory contains core PDCurses source code files common to all platforms. Building -------- These modules are built by the platform-specific makefiles, in the platform directories. Distribution Status ------------------- The files in this directory are released to the Public Domain. Acknowledgements ---------------- The panel library was originally provided by Warren Tucker curses-1.4.4/vendor/PDCurses/pdcurses/outopts.c0000644000004100000410000000740614201713275021563 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** outopts ------- ### Synopsis int clearok(WINDOW *win, bool bf); int idlok(WINDOW *win, bool bf); void idcok(WINDOW *win, bool bf); void immedok(WINDOW *win, bool bf); int leaveok(WINDOW *win, bool bf); int setscrreg(int top, int bot); int wsetscrreg(WINDOW *win, int top, int bot); int scrollok(WINDOW *win, bool bf); int raw_output(bool bf); ### Description With clearok(), if bf is TRUE, the next call to wrefresh() with this window will clear the screen completely and redraw the entire screen. immedok(), called with a second argument of TRUE, causes an automatic wrefresh() every time a change is made to the specified window. Normally, the hardware cursor is left at the location of the window being refreshed. leaveok() allows the cursor to be left wherever the update happens to leave it. It's useful for applications where the cursor is not used, since it reduces the need for cursor motions. If possible, the cursor is made invisible when this option is enabled. wsetscrreg() sets a scrolling region in a window; "top" and "bot" are the line numbers for the top and bottom margins. If this option and scrollok() are enabled, any attempt to move off the bottom margin will cause all lines in the scrolling region to scroll up one line. setscrreg() is the stdscr version. idlok() and idcok() do nothing in PDCurses, but are provided for compatibility with other curses implementations. raw_output() enables the output of raw characters using the standard *add* and *ins* curses functions (that is, it disables translation of control characters). ### Return Value All functions return OK on success and ERR on error. ### Portability X/Open BSD SYS V clearok Y Y Y idlok Y Y Y idcok Y - 4.0 immedok Y - 4.0 leaveok Y Y Y setscrreg Y Y Y wsetscrreg Y Y Y scrollok Y Y Y raw_output - - - **man-end****************************************************************/ int clearok(WINDOW *win, bool bf) { PDC_LOG(("clearok() - called\n")); if (!win) return ERR; win->_clear = bf; return OK; } int idlok(WINDOW *win, bool bf) { PDC_LOG(("idlok() - called\n")); return OK; } void idcok(WINDOW *win, bool bf) { PDC_LOG(("idcok() - called\n")); } void immedok(WINDOW *win, bool bf) { PDC_LOG(("immedok() - called\n")); if (win) win->_immed = bf; } int leaveok(WINDOW *win, bool bf) { PDC_LOG(("leaveok() - called\n")); if (!win) return ERR; win->_leaveit = bf; curs_set(!bf); return OK; } int setscrreg(int top, int bottom) { PDC_LOG(("setscrreg() - called: top %d bottom %d\n", top, bottom)); return wsetscrreg(stdscr, top, bottom); } int wsetscrreg(WINDOW *win, int top, int bottom) { PDC_LOG(("wsetscrreg() - called: top %d bottom %d\n", top, bottom)); if (win && 0 <= top && top <= win->_cury && win->_cury <= bottom && bottom < win->_maxy) { win->_tmarg = top; win->_bmarg = bottom; return OK; } else return ERR; } int scrollok(WINDOW *win, bool bf) { PDC_LOG(("scrollok() - called\n")); if (!win) return ERR; win->_scroll = bf; return OK; } int raw_output(bool bf) { PDC_LOG(("raw_output() - called\n")); SP->raw_out = bf; return OK; } curses-1.4.4/vendor/PDCurses/pdcurses/addstr.c0000644000004100000410000001335514201713275021327 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** addstr ------ ### Synopsis int addstr(const char *str); int addnstr(const char *str, int n); int waddstr(WINDOW *win, const char *str); int waddnstr(WINDOW *win, const char *str, int n); int mvaddstr(int y, int x, const char *str); int mvaddnstr(int y, int x, const char *str, int n); int mvwaddstr(WINDOW *win, int y, int x, const char *str); int mvwaddnstr(WINDOW *win, int y, int x, const char *str, int n); int addwstr(const wchar_t *wstr); int addnwstr(const wchar_t *wstr, int n); int waddwstr(WINDOW *win, const wchar_t *wstr); int waddnwstr(WINDOW *win, const wchar_t *wstr, int n); int mvaddwstr(int y, int x, const wchar_t *wstr); int mvaddnwstr(int y, int x, const wchar_t *wstr, int n); int mvwaddwstr(WINDOW *win, int y, int x, const wchar_t *wstr); int mvwaddnwstr(WINDOW *win, int y, int x, const wchar_t *wstr, int n); ### Description These routines write all the characters of the null-terminated string str or wide-character string wstr to the given window. The functionality is similar to calling waddch() once for each character in the string; except that, when PDCurses is built with wide-character support enabled, the narrow-character functions treat the string as a multibyte string in the current locale, and convert it. The routines with n as the last argument write at most n characters; if n is negative, then the entire string will be added. ### Return Value All functions return OK or ERR. ### Portability X/Open BSD SYS V addstr Y Y Y waddstr Y Y Y mvaddstr Y Y Y mvwaddstr Y Y Y addnstr Y - 4.0 waddnstr Y - 4.0 mvaddnstr Y - 4.0 mvwaddnstr Y - 4.0 addwstr Y waddwstr Y mvaddwstr Y mvwaddwstr Y addnwstr Y waddnwstr Y mvaddnwstr Y mvwaddnwstr Y **man-end****************************************************************/ int waddnstr(WINDOW *win, const char *str, int n) { int i = 0; PDC_LOG(("waddnstr() - called: string=\"%s\" n %d \n", str, n)); if (!win || !str) return ERR; while (str[i] && (i < n || n < 0)) { #ifdef PDC_WIDE wchar_t wch; int retval = PDC_mbtowc(&wch, str + i, n >= 0 ? n - i : 6); if (retval <= 0) return OK; i += retval; #else chtype wch = (unsigned char)(str[i++]); #endif if (waddch(win, wch) == ERR) return ERR; } return OK; } int addstr(const char *str) { PDC_LOG(("addstr() - called: string=\"%s\"\n", str)); return waddnstr(stdscr, str, -1); } int addnstr(const char *str, int n) { PDC_LOG(("addnstr() - called: string=\"%s\" n %d \n", str, n)); return waddnstr(stdscr, str, n); } int waddstr(WINDOW *win, const char *str) { PDC_LOG(("waddstr() - called: string=\"%s\"\n", str)); return waddnstr(win, str, -1); } int mvaddstr(int y, int x, const char *str) { PDC_LOG(("mvaddstr() - called: y %d x %d string=\"%s\"\n", y, x, str)); if (move(y, x) == ERR) return ERR; return waddnstr(stdscr, str, -1); } int mvaddnstr(int y, int x, const char *str, int n) { PDC_LOG(("mvaddnstr() - called: y %d x %d string=\"%s\" n %d \n", y, x, str, n)); if (move(y, x) == ERR) return ERR; return waddnstr(stdscr, str, n); } int mvwaddstr(WINDOW *win, int y, int x, const char *str) { PDC_LOG(("mvwaddstr() - called: string=\"%s\"\n", str)); if (wmove(win, y, x) == ERR) return ERR; return waddnstr(win, str, -1); } int mvwaddnstr(WINDOW *win, int y, int x, const char *str, int n) { PDC_LOG(("mvwaddnstr() - called: y %d x %d string=\"%s\" n %d \n", y, x, str, n)); if (wmove(win, y, x) == ERR) return ERR; return waddnstr(win, str, n); } #ifdef PDC_WIDE int waddnwstr(WINDOW *win, const wchar_t *wstr, int n) { int i = 0; PDC_LOG(("waddnwstr() - called\n")); if (!win || !wstr) return ERR; while (wstr[i] && (i < n || n < 0)) { chtype wch = wstr[i++]; if (waddch(win, wch) == ERR) return ERR; } return OK; } int addwstr(const wchar_t *wstr) { PDC_LOG(("addwstr() - called\n")); return waddnwstr(stdscr, wstr, -1); } int addnwstr(const wchar_t *wstr, int n) { PDC_LOG(("addnwstr() - called\n")); return waddnwstr(stdscr, wstr, n); } int waddwstr(WINDOW *win, const wchar_t *wstr) { PDC_LOG(("waddwstr() - called\n")); return waddnwstr(win, wstr, -1); } int mvaddwstr(int y, int x, const wchar_t *wstr) { PDC_LOG(("mvaddstr() - called\n")); if (move(y, x) == ERR) return ERR; return waddnwstr(stdscr, wstr, -1); } int mvaddnwstr(int y, int x, const wchar_t *wstr, int n) { PDC_LOG(("mvaddnstr() - called\n")); if (move(y, x) == ERR) return ERR; return waddnwstr(stdscr, wstr, n); } int mvwaddwstr(WINDOW *win, int y, int x, const wchar_t *wstr) { PDC_LOG(("mvwaddstr() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return waddnwstr(win, wstr, -1); } int mvwaddnwstr(WINDOW *win, int y, int x, const wchar_t *wstr, int n) { PDC_LOG(("mvwaddnstr() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return waddnwstr(win, wstr, n); } #endif curses-1.4.4/vendor/PDCurses/pdcurses/getstr.c0000644000004100000410000002573114201713275021357 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** getstr ------ ### Synopsis int getstr(char *str); int wgetstr(WINDOW *win, char *str); int mvgetstr(int y, int x, char *str); int mvwgetstr(WINDOW *win, int y, int x, char *str); int getnstr(char *str, int n); int wgetnstr(WINDOW *win, char *str, int n); int mvgetnstr(int y, int x, char *str, int n); int mvwgetnstr(WINDOW *win, int y, int x, char *str, int n); int get_wstr(wint_t *wstr); int wget_wstr(WINDOW *win, wint_t *wstr); int mvget_wstr(int y, int x, wint_t *wstr); int mvwget_wstr(WINDOW *win, int, int, wint_t *wstr); int getn_wstr(wint_t *wstr, int n); int wgetn_wstr(WINDOW *win, wint_t *wstr, int n); int mvgetn_wstr(int y, int x, wint_t *wstr, int n); int mvwgetn_wstr(WINDOW *win, int y, int x, wint_t *wstr, int n); ### Description These routines call wgetch() repeatedly to build a string, interpreting erase and kill characters along the way, until a newline or carriage return is received. When PDCurses is built with wide-character support enabled, the narrow-character functions convert the wgetch()'d values into a multibyte string in the current locale before returning it. The resulting string is placed in the area pointed to by *str. The routines with n as the last argument read at most n characters. Note that there's no way to know how long the buffer passed to wgetstr() is, so use wgetnstr() to avoid buffer overflows. ### Return Value These functions return ERR on failure or any other value on success. ### Portability X/Open BSD SYS V getstr Y Y Y wgetstr Y Y Y mvgetstr Y Y Y mvwgetstr Y Y Y getnstr Y - 4.0 wgetnstr Y - 4.0 mvgetnstr Y - - mvwgetnstr Y - - get_wstr Y wget_wstr Y mvget_wstr Y mvwget_wstr Y getn_wstr Y wgetn_wstr Y mvgetn_wstr Y mvwgetn_wstr Y **man-end****************************************************************/ #define MAXLINE 255 int wgetnstr(WINDOW *win, char *str, int n) { #ifdef PDC_WIDE wchar_t wstr[MAXLINE + 1]; if (n < 0 || n > MAXLINE) n = MAXLINE; if (wgetn_wstr(win, (wint_t *)wstr, n) == ERR) return ERR; return (int)PDC_wcstombs(str, wstr, n); #else int ch, i, num, x, chars; char *p; bool stop, oldecho, oldcbreak, oldnodelay; PDC_LOG(("wgetnstr() - called\n")); if (!win || !str) return ERR; chars = 0; p = str; stop = FALSE; x = win->_curx; oldcbreak = SP->cbreak; /* remember states */ oldecho = SP->echo; oldnodelay = win->_nodelay; SP->echo = FALSE; /* we do echo ourselves */ cbreak(); /* ensure each key is returned immediately */ win->_nodelay = FALSE; /* don't return -1 */ wrefresh(win); while (!stop) { ch = wgetch(win); switch (ch) { case '\t': ch = ' '; num = TABSIZE - (win->_curx - x) % TABSIZE; for (i = 0; i < num; i++) { if (chars < n) { if (oldecho) waddch(win, ch); *p++ = (char)ch; ++chars; } else beep(); } break; case _ECHAR: /* CTRL-H -- Delete character */ if (p > str) { if (oldecho) waddstr(win, "\b \b"); ch = (unsigned char)(*--p); if ((ch < ' ') && (oldecho)) waddstr(win, "\b \b"); chars--; } break; case _DLCHAR: /* CTRL-U -- Delete line */ while (p > str) { if (oldecho) waddstr(win, "\b \b"); ch = (unsigned char)(*--p); if ((ch < ' ') && (oldecho)) waddstr(win, "\b \b"); } chars = 0; break; case _DWCHAR: /* CTRL-W -- Delete word */ while ((p > str) && (*(p - 1) == ' ')) { if (oldecho) waddstr(win, "\b \b"); --p; /* remove space */ chars--; } while ((p > str) && (*(p - 1) != ' ')) { if (oldecho) waddstr(win, "\b \b"); ch = (unsigned char)(*--p); if ((ch < ' ') && (oldecho)) waddstr(win, "\b \b"); chars--; } break; case '\n': case '\r': stop = TRUE; if (oldecho) waddch(win, '\n'); break; default: if (chars < n) { if (!SP->key_code && ch < 0x100) { *p++ = (char)ch; if (oldecho) waddch(win, ch); chars++; } } else beep(); break; } wrefresh(win); } *p = '\0'; SP->echo = oldecho; /* restore old settings */ SP->cbreak = oldcbreak; win->_nodelay = oldnodelay; return OK; #endif } int getstr(char *str) { PDC_LOG(("getstr() - called\n")); return wgetnstr(stdscr, str, MAXLINE); } int wgetstr(WINDOW *win, char *str) { PDC_LOG(("wgetstr() - called\n")); return wgetnstr(win, str, MAXLINE); } int mvgetstr(int y, int x, char *str) { PDC_LOG(("mvgetstr() - called\n")); if (move(y, x) == ERR) return ERR; return wgetnstr(stdscr, str, MAXLINE); } int mvwgetstr(WINDOW *win, int y, int x, char *str) { PDC_LOG(("mvwgetstr() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return wgetnstr(win, str, MAXLINE); } int getnstr(char *str, int n) { PDC_LOG(("getnstr() - called\n")); return wgetnstr(stdscr, str, n); } int mvgetnstr(int y, int x, char *str, int n) { PDC_LOG(("mvgetnstr() - called\n")); if (move(y, x) == ERR) return ERR; return wgetnstr(stdscr, str, n); } int mvwgetnstr(WINDOW *win, int y, int x, char *str, int n) { PDC_LOG(("mvwgetnstr() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return wgetnstr(win, str, n); } #ifdef PDC_WIDE int wgetn_wstr(WINDOW *win, wint_t *wstr, int n) { int ch, i, num, x, chars; wint_t *p; bool stop, oldecho, oldcbreak, oldnodelay; PDC_LOG(("wgetn_wstr() - called\n")); if (!win || !wstr) return ERR; chars = 0; p = wstr; stop = FALSE; x = win->_curx; oldcbreak = SP->cbreak; /* remember states */ oldecho = SP->echo; oldnodelay = win->_nodelay; SP->echo = FALSE; /* we do echo ourselves */ cbreak(); /* ensure each key is returned immediately */ win->_nodelay = FALSE; /* don't return -1 */ wrefresh(win); while (!stop) { ch = wgetch(win); switch (ch) { case '\t': ch = ' '; num = TABSIZE - (win->_curx - x) % TABSIZE; for (i = 0; i < num; i++) { if (chars < n) { if (oldecho) waddch(win, ch); *p++ = ch; ++chars; } else beep(); } break; case _ECHAR: /* CTRL-H -- Delete character */ if (p > wstr) { if (oldecho) waddstr(win, "\b \b"); ch = *--p; if ((ch < ' ') && (oldecho)) waddstr(win, "\b \b"); chars--; } break; case _DLCHAR: /* CTRL-U -- Delete line */ while (p > wstr) { if (oldecho) waddstr(win, "\b \b"); ch = *--p; if ((ch < ' ') && (oldecho)) waddstr(win, "\b \b"); } chars = 0; break; case _DWCHAR: /* CTRL-W -- Delete word */ while ((p > wstr) && (*(p - 1) == ' ')) { if (oldecho) waddstr(win, "\b \b"); --p; /* remove space */ chars--; } while ((p > wstr) && (*(p - 1) != ' ')) { if (oldecho) waddstr(win, "\b \b"); ch = *--p; if ((ch < ' ') && (oldecho)) waddstr(win, "\b \b"); chars--; } break; case '\n': case '\r': stop = TRUE; if (oldecho) waddch(win, '\n'); break; default: if (chars < n) { if (!SP->key_code) { *p++ = ch; if (oldecho) waddch(win, ch); chars++; } } else beep(); break; } wrefresh(win); } *p = '\0'; SP->echo = oldecho; /* restore old settings */ SP->cbreak = oldcbreak; win->_nodelay = oldnodelay; return OK; } int get_wstr(wint_t *wstr) { PDC_LOG(("get_wstr() - called\n")); return wgetn_wstr(stdscr, wstr, MAXLINE); } int wget_wstr(WINDOW *win, wint_t *wstr) { PDC_LOG(("wget_wstr() - called\n")); return wgetn_wstr(win, wstr, MAXLINE); } int mvget_wstr(int y, int x, wint_t *wstr) { PDC_LOG(("mvget_wstr() - called\n")); if (move(y, x) == ERR) return ERR; return wgetn_wstr(stdscr, wstr, MAXLINE); } int mvwget_wstr(WINDOW *win, int y, int x, wint_t *wstr) { PDC_LOG(("mvwget_wstr() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return wgetn_wstr(win, wstr, MAXLINE); } int getn_wstr(wint_t *wstr, int n) { PDC_LOG(("getn_wstr() - called\n")); return wgetn_wstr(stdscr, wstr, n); } int mvgetn_wstr(int y, int x, wint_t *wstr, int n) { PDC_LOG(("mvgetn_wstr() - called\n")); if (move(y, x) == ERR) return ERR; return wgetn_wstr(stdscr, wstr, n); } int mvwgetn_wstr(WINDOW *win, int y, int x, wint_t *wstr, int n) { PDC_LOG(("mvwgetn_wstr() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return wgetn_wstr(win, wstr, n); } #endif curses-1.4.4/vendor/PDCurses/pdcurses/instr.c0000644000004100000410000001333514201713275021203 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** instr ----- ### Synopsis int instr(char *str); int innstr(char *str, int n); int winstr(WINDOW *win, char *str); int winnstr(WINDOW *win, char *str, int n); int mvinstr(int y, int x, char *str); int mvinnstr(int y, int x, char *str, int n); int mvwinstr(WINDOW *win, int y, int x, char *str); int mvwinnstr(WINDOW *win, int y, int x, char *str, int n); int inwstr(wchar_t *wstr); int innwstr(wchar_t *wstr, int n); int winwstr(WINDOW *win, wchar_t *wstr); int winnwstr(WINDOW *win, wchar_t *wstr, int n); int mvinwstr(int y, int x, wchar_t *wstr); int mvinnwstr(int y, int x, wchar_t *wstr, int n); int mvwinwstr(WINDOW *win, int y, int x, wchar_t *wstr); int mvwinnwstr(WINDOW *win, int y, int x, wchar_t *wstr, int n); ### Description These functions take characters (or wide characters) from the current or specified position in the window, and return them as a string in str (or wstr). Attributes are ignored. The functions with n as the last argument return a string at most n characters long. ### Return Value Upon successful completion, innstr(), mvinnstr(), mvwinnstr() and winnstr() return the number of characters actually read into the string; instr(), mvinstr(), mvwinstr() and winstr() return OK. Otherwise, all these functions return ERR. ### Portability X/Open BSD SYS V instr Y - 4.0 winstr Y - 4.0 mvinstr Y - 4.0 mvwinstr Y - 4.0 innstr Y - 4.0 winnstr Y - 4.0 mvinnstr Y - 4.0 mvwinnstr Y - 4.0 inwstr Y winwstr Y mvinwstr Y mvwinwstr Y innwstr Y winnwstr Y mvinnwstr Y mvwinnwstr Y **man-end****************************************************************/ int winnstr(WINDOW *win, char *str, int n) { #ifdef PDC_WIDE wchar_t wstr[513]; if (n < 0 || n > 512) n = 512; if (winnwstr(win, wstr, n) == ERR) return ERR; return (int)PDC_wcstombs(str, wstr, n); #else chtype *src; int i; PDC_LOG(("winnstr() - called: n %d \n", n)); if (!win || !str) return ERR; if (n < 0 || (win->_curx + n) > win->_maxx) n = win->_maxx - win->_curx; src = win->_y[win->_cury] + win->_curx; for (i = 0; i < n; i++) str[i] = (char)( src[i] & A_CHARTEXT); str[i] = '\0'; return i; #endif } int instr(char *str) { PDC_LOG(("instr() - called: string=\"%s\"\n", str)); return (ERR == winnstr(stdscr, str, stdscr->_maxx)) ? ERR : OK; } int winstr(WINDOW *win, char *str) { PDC_LOG(("winstr() - called: \n")); return (ERR == winnstr(win, str, win->_maxx)) ? ERR : OK; } int mvinstr(int y, int x, char *str) { PDC_LOG(("mvinstr() - called: y %d x %d \n", y, x)); if (move(y, x) == ERR) return ERR; return (ERR == winnstr(stdscr, str, stdscr->_maxx)) ? ERR : OK; } int mvwinstr(WINDOW *win, int y, int x, char *str) { PDC_LOG(("mvwinstr() - called: y %d x %d \n", y, x)); if (wmove(win, y, x) == ERR) return ERR; return (ERR == winnstr(win, str, win->_maxx)) ? ERR : OK; } int innstr(char *str, int n) { PDC_LOG(("innstr() - called: n %d \n", n)); return winnstr(stdscr, str, n); } int mvinnstr(int y, int x, char *str, int n) { PDC_LOG(("mvinnstr() - called: y %d x %d n %d \n", y, x, n)); if (move(y, x) == ERR) return ERR; return winnstr(stdscr, str, n); } int mvwinnstr(WINDOW *win, int y, int x, char *str, int n) { PDC_LOG(("mvwinnstr() - called: y %d x %d n %d \n", y, x, n)); if (wmove(win, y, x) == ERR) return ERR; return winnstr(win, str, n); } #ifdef PDC_WIDE int winnwstr(WINDOW *win, wchar_t *wstr, int n) { chtype *src; int i; PDC_LOG(("winnstr() - called: n %d \n", n)); if (!win || !wstr) return ERR; if (n < 0 || (win->_curx + n) > win->_maxx) n = win->_maxx - win->_curx; src = win->_y[win->_cury] + win->_curx; for (i = 0; i < n; i++) wstr[i] = (wchar_t)src[i] & A_CHARTEXT; wstr[i] = L'\0'; return i; } int inwstr(wchar_t *wstr) { PDC_LOG(("inwstr() - called\n")); return (ERR == winnwstr(stdscr, wstr, stdscr->_maxx)) ? ERR : OK; } int winwstr(WINDOW *win, wchar_t *wstr) { PDC_LOG(("winwstr() - called\n")); return (ERR == winnwstr(win, wstr, win->_maxx)) ? ERR : OK; } int mvinwstr(int y, int x, wchar_t *wstr) { PDC_LOG(("mvinwstr() - called\n")); if (move(y, x) == ERR) return ERR; return (ERR == winnwstr(stdscr, wstr, stdscr->_maxx)) ? ERR : OK; } int mvwinwstr(WINDOW *win, int y, int x, wchar_t *wstr) { PDC_LOG(("mvwinstr() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return (ERR == winnwstr(win, wstr, win->_maxx)) ? ERR : OK; } int innwstr(wchar_t *wstr, int n) { PDC_LOG(("innwstr() - called\n")); return winnwstr(stdscr, wstr, n); } int mvinnwstr(int y, int x, wchar_t *wstr, int n) { PDC_LOG(("mvinnstr() - called\n")); if (move(y, x) == ERR) return ERR; return winnwstr(stdscr, wstr, n); } int mvwinnwstr(WINDOW *win, int y, int x, wchar_t *wstr, int n) { PDC_LOG(("mvwinnwstr() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return winnwstr(win, wstr, n); } #endif curses-1.4.4/vendor/PDCurses/pdcurses/keyname.c0000644000004100000410000001656014201713275021500 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** keyname ------- ### Synopsis char *keyname(int key); char *key_name(wchar_t c); bool has_key(int key); ### Description keyname() returns a string corresponding to the argument key. key may be any key returned by wgetch(). key_name() is the wide-character version. It takes a wchar_t parameter, but still returns a char *. has_key() returns TRUE for recognized keys, FALSE otherwise. This function is an ncurses extension. ### Portability X/Open BSD SYS V keyname Y - 3.0 key_name Y has_key - - - **man-end****************************************************************/ #include char *keyname(int key) { static char _keyname[14]; /* Key names must be in exactly the same order as in curses.h */ static char *key_names[] = { "KEY_BREAK", "KEY_DOWN", "KEY_UP", "KEY_LEFT", "KEY_RIGHT", "KEY_HOME", "KEY_BACKSPACE", "KEY_F0", "KEY_F(1)", "KEY_F(2)", "KEY_F(3)", "KEY_F(4)", "KEY_F(5)", "KEY_F(6)", "KEY_F(7)", "KEY_F(8)", "KEY_F(9)", "KEY_F(10)", "KEY_F(11)", "KEY_F(12)", "KEY_F(13)", "KEY_F(14)", "KEY_F(15)", "KEY_F(16)", "KEY_F(17)", "KEY_F(18)", "KEY_F(19)", "KEY_F(20)", "KEY_F(21)", "KEY_F(22)", "KEY_F(23)", "KEY_F(24)", "KEY_F(25)", "KEY_F(26)", "KEY_F(27)", "KEY_F(28)", "KEY_F(29)", "KEY_F(30)", "KEY_F(31)", "KEY_F(32)", "KEY_F(33)", "KEY_F(34)", "KEY_F(35)", "KEY_F(36)", "KEY_F(37)", "KEY_F(38)", "KEY_F(39)", "KEY_F(40)", "KEY_F(41)", "KEY_F(42)", "KEY_F(43)", "KEY_F(44)", "KEY_F(45)", "KEY_F(46)", "KEY_F(47)", "KEY_F(48)", "KEY_F(49)", "KEY_F(50)", "KEY_F(51)", "KEY_F(52)", "KEY_F(53)", "KEY_F(54)", "KEY_F(55)", "KEY_F(56)", "KEY_F(57)", "KEY_F(58)", "KEY_F(59)", "KEY_F(60)", "KEY_F(61)", "KEY_F(62)", "KEY_F(63)", "KEY_DL", "KEY_IL", "KEY_DC", "KEY_IC", "KEY_EIC", "KEY_CLEAR", "KEY_EOS", "KEY_EOL", "KEY_SF", "KEY_SR", "KEY_NPAGE", "KEY_PPAGE", "KEY_STAB", "KEY_CTAB", "KEY_CATAB", "KEY_ENTER", "KEY_SRESET", "KEY_RESET", "KEY_PRINT", "KEY_LL", "KEY_ABORT", "KEY_SHELP", "KEY_LHELP", "KEY_BTAB", "KEY_BEG", "KEY_CANCEL", "KEY_CLOSE", "KEY_COMMAND", "KEY_COPY", "KEY_CREATE", "KEY_END", "KEY_EXIT", "KEY_FIND", "KEY_HELP", "KEY_MARK", "KEY_MESSAGE", "KEY_MOVE", "KEY_NEXT", "KEY_OPEN", "KEY_OPTIONS", "KEY_PREVIOUS", "KEY_REDO", "KEY_REFERENCE", "KEY_REFRESH", "KEY_REPLACE", "KEY_RESTART", "KEY_RESUME", "KEY_SAVE", "KEY_SBEG", "KEY_SCANCEL", "KEY_SCOMMAND", "KEY_SCOPY", "KEY_SCREATE", "KEY_SDC", "KEY_SDL", "KEY_SELECT", "KEY_SEND", "KEY_SEOL", "KEY_SEXIT", "KEY_SFIND", "KEY_SHOME", "KEY_SIC", "UNKNOWN KEY", "KEY_SLEFT", "KEY_SMESSAGE", "KEY_SMOVE", "KEY_SNEXT", "KEY_SOPTIONS", "KEY_SPREVIOUS", "KEY_SPRINT", "KEY_SREDO", "KEY_SREPLACE", "KEY_SRIGHT", "KEY_SRSUME", "KEY_SSAVE", "KEY_SSUSPEND", "KEY_SUNDO", "KEY_SUSPEND", "KEY_UNDO", "ALT_0", "ALT_1", "ALT_2", "ALT_3", "ALT_4", "ALT_5", "ALT_6", "ALT_7", "ALT_8", "ALT_9", "ALT_A", "ALT_B", "ALT_C", "ALT_D", "ALT_E", "ALT_F", "ALT_G", "ALT_H", "ALT_I", "ALT_J", "ALT_K", "ALT_L", "ALT_M", "ALT_N", "ALT_O", "ALT_P", "ALT_Q", "ALT_R", "ALT_S", "ALT_T", "ALT_U", "ALT_V", "ALT_W", "ALT_X", "ALT_Y", "ALT_Z", "CTL_LEFT", "CTL_RIGHT", "CTL_PGUP", "CTL_PGDN", "CTL_HOME", "CTL_END", "KEY_A1", "KEY_A2", "KEY_A3", "KEY_B1", "KEY_B2", "KEY_B3", "KEY_C1", "KEY_C2", "KEY_C3", "PADSLASH", "PADENTER", "CTL_PADENTER", "ALT_PADENTER", "PADSTOP", "PADSTAR", "PADMINUS", "PADPLUS", "CTL_PADSTOP", "CTL_PADCENTER", "CTL_PADPLUS", "CTL_PADMINUS", "CTL_PADSLASH", "CTL_PADSTAR", "ALT_PADPLUS", "ALT_PADMINUS", "ALT_PADSLASH", "ALT_PADSTAR", "ALT_PADSTOP", "CTL_INS", "ALT_DEL", "ALT_INS", "CTL_UP", "CTL_DOWN", "CTL_TAB", "ALT_TAB", "ALT_MINUS", "ALT_EQUAL", "ALT_HOME", "ALT_PGUP", "ALT_PGDN", "ALT_END", "ALT_UP", "ALT_DOWN", "ALT_RIGHT", "ALT_LEFT", "ALT_ENTER", "ALT_ESC", "ALT_BQUOTE", "ALT_LBRACKET", "ALT_RBRACKET", "ALT_SEMICOLON", "ALT_FQUOTE", "ALT_COMMA", "ALT_STOP", "ALT_FSLASH", "ALT_BKSP", "CTL_BKSP", "PAD0", "CTL_PAD0", "CTL_PAD1", "CTL_PAD2", "CTL_PAD3", "CTL_PAD4", "CTL_PAD5", "CTL_PAD6", "CTL_PAD7","CTL_PAD8", "CTL_PAD9", "ALT_PAD0", "ALT_PAD1", "ALT_PAD2", "ALT_PAD3", "ALT_PAD4", "ALT_PAD5", "ALT_PAD6", "ALT_PAD7", "ALT_PAD8", "ALT_PAD9", "CTL_DEL", "ALT_BSLASH", "CTL_ENTER", "SHF_PADENTER", "SHF_PADSLASH", "SHF_PADSTAR", "SHF_PADPLUS", "SHF_PADMINUS", "SHF_UP", "SHF_DOWN", "SHF_IC", "SHF_DC", "KEY_MOUSE", "KEY_SHIFT_L", "KEY_SHIFT_R", "KEY_CONTROL_L", "KEY_CONTROL_R", "KEY_ALT_L", "KEY_ALT_R", "KEY_RESIZE", "KEY_SUP", "KEY_SDOWN", /* Win32a extras: */ "CTL_SEMICOLON", "CTL_EQUAL", "CTL_COMMA", "CTL_MINUS", "CTL_STOP", "CTL_FSLASH", "CTL_BQUOTE", "KEY_APPS", "KEY_SAPPS", "CTL_APPS", "ALT_APPS", "KEY_PAUSE", "KEY_SPAUSE", "CTL_PAUSE", "KEY_PRINTSCREEN", "ALT_PRINTSCREEN", "KEY_SCROLLLOCK", "ALT_SCROLLLOCK", "CTL_0", "CTL_1", "CTL_2", "CTL_3", "CTL_4", "CTL_5", "CTL_6", "CTL_7", "CTL_8", "CTL_9", "BROWSER_BACK", "SBROWSER_BACK", "CBROWSER_BACK", "ABROWSER_BACK", "BROWSER_FWD", "SBROWSER_FWD", "CBROWSER_FWD", "ABROWSER_FWD", "BROWSER_REF", "SBROWSER_REF", "CBROWSER_REF", "ABROWSER_REF", "BROWSER_STOP", "SBROWSER_STOP", "CBROWSER_STOP", "ABROWSER_STOP", "SEARCH", "SSEARCH", "CSEARCH", "ASEARCH", "FAVORITES", "SFAVORITES", "CFAVORITES", "AFAVORITES", "BROWSER_HOME", "SBROWSER_HOME", "CBROWSER_HOME", "ABROWSER_HOME", "VOLUME_MUTE", "SVOLUME_MUTE", "CVOLUME_MUTE", "AVOLUME_MUTE", "VOLUME_DOWN", "SVOLUME_DOWN", "CVOLUME_DOWN", "AVOLUME_DOWN", "VOLUME_UP", "SVOLUME_UP", "CVOLUME_UP", "AVOLUME_UP", "NEXT_TRACK", "SNEXT_TRACK", "CNEXT_TRACK", "ANEXT_TRACK", "PREV_TRACK", "SPREV_TRACK", "CPREV_TRACK", "APREV_TRACK", "MEDIA_STOP", "SMEDIA_STOP", "CMEDIA_STOP", "AMEDIA_STOP", "PLAY_PAUSE", "SPLAY_PAUSE", "CPLAY_PAUSE", "APLAY_PAUSE", "LAUNCH_MAIL", "SLAUNCH_MAIL", "CLAUNCH_MAIL", "ALAUNCH_MAIL", "MEDIA_SELECT", "SMEDIA_SELECT", "CMEDIA_SELECT", "AMEDIA_SELECT", "LAUNCH_APP1", "SLAUNCH_APP1", "CLAUNCH_APP1", "ALAUNCH_APP1", "LAUNCH_APP2", "SLAUNCH_APP2", "CLAUNCH_APP2", "ALAUNCH_APP2" }; PDC_LOG(("keyname() - called: key %d\n", key)); strcpy(_keyname, ((key >= 0) && (key < 0x80)) ? unctrl((chtype)key) : has_key(key) ? key_names[key - KEY_MIN] : "UNKNOWN KEY"); return _keyname; } bool has_key(int key) { PDC_LOG(("has_key() - called: key %d\n", key)); return (key >= KEY_MIN && key <= KEY_MAX); } #ifdef PDC_WIDE char *key_name(wchar_t c) { PDC_LOG(("key_name() - called\n")); return keyname((int)c); } #endif curses-1.4.4/vendor/PDCurses/pdcurses/util.c0000644000004100000410000001624714201713275021026 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** util ---- ### Synopsis char *unctrl(chtype c); void filter(void); void use_env(bool x); int delay_output(int ms); int getcchar(const cchar_t *wcval, wchar_t *wch, attr_t *attrs, short *color_pair, void *opts); int setcchar(cchar_t *wcval, const wchar_t *wch, const attr_t attrs, short color_pair, const void *opts); wchar_t *wunctrl(cchar_t *wc); int PDC_mbtowc(wchar_t *pwc, const char *s, size_t n); size_t PDC_mbstowcs(wchar_t *dest, const char *src, size_t n); size_t PDC_wcstombs(char *dest, const wchar_t *src, size_t n); ### Description unctrl() expands the text portion of the chtype c into a printable string. Control characters are changed to the "^X" notation; others are passed through. wunctrl() is the wide- character version of the function. filter() and use_env() are no-ops in PDCurses. delay_output() inserts an ms millisecond pause in output. getcchar() works in two modes: When wch is not NULL, it reads the cchar_t pointed to by wcval and stores the attributes in attrs, the color pair in color_pair, and the text in the wide-character string wch. When wch is NULL, getcchar() merely returns the number of wide characters in wcval. In either mode, the opts argument is unused. setcchar constructs a cchar_t at wcval from the wide-character text at wch, the attributes in attr and the color pair in color_pair. The opts argument is unused. Currently, the length returned by getcchar() is always 1 or 0. Similarly, setcchar() will only take the first wide character from wch, and ignore any others that it "should" take (i.e., combining characters). Nor will it correctly handle any character outside the basic multilingual plane (UCS-2). ### Return Value unctrl() and wunctrl() return NULL on failure. delay_output() always returns OK. getcchar() returns the number of wide characters wcval points to when wch is NULL; when it's not, getcchar() returns OK or ERR. setcchar() returns OK or ERR. ### Portability X/Open BSD SYS V unctrl Y Y Y filter Y - 3.0 use_env Y - 4.0 delay_output Y Y Y getcchar Y setcchar Y wunctrl Y PDC_mbtowc - - - PDC_mbstowcs - - - PDC_wcstombs - - - **man-end****************************************************************/ #ifdef PDC_WIDE # ifdef PDC_FORCE_UTF8 # include # else # include # endif #endif char *unctrl(chtype c) { static char strbuf[3] = {0, 0, 0}; chtype ic; PDC_LOG(("unctrl() - called\n")); ic = c & A_CHARTEXT; if (ic >= 0x20 && ic != 0x7f) /* normal characters */ { strbuf[0] = (char)ic; strbuf[1] = '\0'; return strbuf; } strbuf[0] = '^'; /* '^' prefix */ if (ic == 0x7f) /* 0x7f == DEL */ strbuf[1] = '?'; else /* other control */ strbuf[1] = (char)(ic + '@'); return strbuf; } void filter(void) { PDC_LOG(("filter() - called\n")); } void use_env(bool x) { PDC_LOG(("use_env() - called: x %d\n", x)); } int delay_output(int ms) { PDC_LOG(("delay_output() - called: ms %d\n", ms)); return napms(ms); } #ifdef PDC_WIDE int getcchar(const cchar_t *wcval, wchar_t *wch, attr_t *attrs, short *color_pair, void *opts) { if (!wcval) return ERR; if (wch) { if (!attrs || !color_pair) return ERR; *wch = (wchar_t)(*wcval & A_CHARTEXT); *attrs = (*wcval & (A_ATTRIBUTES & ~A_COLOR)); *color_pair = (short)( PAIR_NUMBER(*wcval & A_COLOR)); if (*wch) *++wch = L'\0'; return OK; } else return ((*wcval & A_CHARTEXT) != L'\0'); } int setcchar(cchar_t *wcval, const wchar_t *wch, const attr_t attrs, short color_pair, const void *opts) { if (!wcval || !wch) return ERR; *wcval = *wch | attrs | COLOR_PAIR(color_pair); return OK; } wchar_t *wunctrl(cchar_t *wc) { static wchar_t strbuf[3] = {0, 0, 0}; cchar_t ic; PDC_LOG(("wunctrl() - called\n")); ic = *wc & A_CHARTEXT; if (ic >= 0x20 && ic != 0x7f) /* normal characters */ { strbuf[0] = (wchar_t)ic; strbuf[1] = L'\0'; return strbuf; } strbuf[0] = '^'; /* '^' prefix */ if (ic == 0x7f) /* 0x7f == DEL */ strbuf[1] = '?'; else /* other control */ strbuf[1] = (wchar_t)(ic + '@'); return strbuf; } int PDC_mbtowc(wchar_t *pwc, const char *s, size_t n) { # ifdef PDC_FORCE_UTF8 wchar_t key; int i = -1; const unsigned char *string; if (!s || (n < 1)) return -1; if (!*s) return 0; string = (const unsigned char *)s; key = string[0]; /* Simplistic UTF-8 decoder -- only does the BMP, minimal validation */ if (key & 0x80) { if ((key & 0xe0) == 0xc0) { if (1 < n) { key = ((key & 0x1f) << 6) | (string[1] & 0x3f); i = 2; } } else if ((key & 0xe0) == 0xe0) { if (2 < n) { key = ((key & 0x0f) << 12) | ((string[1] & 0x3f) << 6) | (string[2] & 0x3f); i = 3; } } } else i = 1; if (i) *pwc = key; return i; # else return mbtowc(pwc, s, n); # endif } size_t PDC_mbstowcs(wchar_t *dest, const char *src, size_t n) { # ifdef PDC_FORCE_UTF8 size_t i = 0, len; if (!src || !dest) return 0; len = strlen(src); while (*src && i < n) { int retval = PDC_mbtowc(dest + i, src, len); if (retval < 1) return -1; src += retval; len -= retval; i++; } # else size_t i = mbstowcs(dest, src, n); # endif dest[i] = 0; return i; } size_t PDC_wcstombs(char *dest, const wchar_t *src, size_t n) { # ifdef PDC_FORCE_UTF8 size_t i = 0; if (!src || !dest) return 0; while (*src && i < n) { chtype code = *src++; if (code < 0x80) { dest[i] = (char)code; i++; } else if (code < 0x800) { dest[i] = (char)((code & 0x07c0) >> 6) | 0xc0; dest[i + 1] = (char)( (code & 0x003f) | 0x80); i += 2; } else { dest[i] = (char)( ((code & 0xf000) >> 12) | 0xe0); dest[i + 1] = (char)((code & 0x0fc0) >> 6) | 0x80; dest[i + 2] = (char)( (code & 0x003f) | 0x80); i += 3; } } # else size_t i = wcstombs(dest, src, n); # endif dest[i] = '\0'; return i; } #endif curses-1.4.4/vendor/PDCurses/pdcurses/pad.c0000644000004100000410000001621214201713275020605 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** pad --- ### Synopsis WINDOW *newpad(int nlines, int ncols); WINDOW *subpad(WINDOW *orig, int nlines, int ncols, int begy, int begx); int prefresh(WINDOW *win, int py, int px, int sy1, int sx1, int sy2, int sx2); int pnoutrefresh(WINDOW *w, int py, int px, int sy1, int sx1, int sy2, int sx2); int pechochar(WINDOW *pad, chtype ch); int pecho_wchar(WINDOW *pad, const cchar_t *wch); ### Description A pad is a special kind of window, which is not restricted by the screen size, and is not necessarily associated with a particular part of the screen. You can use a pad when you need a large window, and only a part of the window will be on the screen at one time. Pads are not refreshed automatically (e.g., from scrolling or echoing of input). You can't call wrefresh() with a pad as an argument; use prefresh() or pnoutrefresh() instead. Note that these routines require additional parameters to specify the part of the pad to be displayed, and the location to use on the screen. newpad() creates a new pad data structure. subpad() creates a new sub-pad within a pad, at position (begy, begx), with dimensions of nlines lines and ncols columns. This position is relative to the pad, and not to the screen as with subwin. Changes to either the parent pad or sub-pad will affect both. When using sub-pads, you may need to call touchwin() before calling prefresh(). pnoutrefresh() copies the specified pad to the virtual screen. prefresh() calls pnoutrefresh(), followed by doupdate(). These routines are analogous to wnoutrefresh() and wrefresh(). (py, px) specifies the upper left corner of the part of the pad to be displayed; (sy1, sx1) and (sy2, sx2) describe the screen rectangle that will contain the selected part of the pad. pechochar() is functionally equivalent to addch() followed by a call to prefresh(), with the last-used coordinates and dimensions. pecho_wchar() is the wide-character version. ### Return Value All functions return OK on success and ERR on error. ### Portability X/Open BSD SYS V newpad Y - Y subpad Y - Y prefresh Y - Y pnoutrefresh Y - Y pechochar Y - 3.0 pecho_wchar Y **man-end****************************************************************/ #include /* save values for pechochar() */ static int save_pminrow, save_pmincol; static int save_sminrow, save_smincol, save_smaxrow, save_smaxcol; WINDOW *newpad(int nlines, int ncols) { WINDOW *win; PDC_LOG(("newpad() - called: lines=%d cols=%d\n", nlines, ncols)); if ( !(win = PDC_makenew(nlines, ncols, 0, 0)) || !(win = PDC_makelines(win)) ) return (WINDOW *)NULL; werase(win); win->_flags = _PAD; /* save default values in case pechochar() is the first call to prefresh(). */ save_pminrow = 0; save_pmincol = 0; save_sminrow = 0; save_smincol = 0; save_smaxrow = min(LINES, nlines) - 1; save_smaxcol = min(COLS, ncols) - 1; return win; } WINDOW *subpad(WINDOW *orig, int nlines, int ncols, int begy, int begx) { WINDOW *win; int i; PDC_LOG(("subpad() - called: lines=%d cols=%d begy=%d begx=%d\n", nlines, ncols, begy, begx)); if (!orig || !(orig->_flags & _PAD)) return (WINDOW *)NULL; /* make sure window fits inside the original one */ if (begy < 0 || begx < 0 || (begy + nlines) > orig->_maxy || (begx + ncols) > orig->_maxx) return (WINDOW *)NULL; if (!nlines) nlines = orig->_maxy - begy; if (!ncols) ncols = orig->_maxx - begx; if ( !(win = PDC_makenew(nlines, ncols, begy, begx)) ) return (WINDOW *)NULL; /* initialize window variables */ win->_attrs = orig->_attrs; win->_leaveit = orig->_leaveit; win->_scroll = orig->_scroll; win->_nodelay = orig->_nodelay; win->_use_keypad = orig->_use_keypad; win->_parent = orig; for (i = 0; i < nlines; i++) win->_y[i] = orig->_y[begy + i] + begx; win->_flags = _SUBPAD; /* save default values in case pechochar() is the first call to prefresh(). */ save_pminrow = 0; save_pmincol = 0; save_sminrow = 0; save_smincol = 0; save_smaxrow = min(LINES, nlines) - 1; save_smaxcol = min(COLS, ncols) - 1; return win; } int prefresh(WINDOW *win, int py, int px, int sy1, int sx1, int sy2, int sx2) { PDC_LOG(("prefresh() - called\n")); if (pnoutrefresh(win, py, px, sy1, sx1, sy2, sx2) == ERR) return ERR; doupdate(); return OK; } int pnoutrefresh(WINDOW *w, int py, int px, int sy1, int sx1, int sy2, int sx2) { int num_cols; int sline = sy1; int pline = py; PDC_LOG(("pnoutrefresh() - called\n")); if (!w || !(w->_flags & (_PAD|_SUBPAD)) || (sy2 >= LINES) || (sx2 >= COLS)) return ERR; if (py < 0) py = 0; if (px < 0) px = 0; if (sy1 < 0) sy1 = 0; if (sx1 < 0) sx1 = 0; if (sy2 < sy1 || sx2 < sx1) return ERR; num_cols = min((sx2 - sx1 + 1), (w->_maxx - px)); while (sline <= sy2) { if (pline < w->_maxy) { memcpy(curscr->_y[sline] + sx1, w->_y[pline] + px, num_cols * sizeof(chtype)); if ((curscr->_firstch[sline] == _NO_CHANGE) || (curscr->_firstch[sline] > sx1)) curscr->_firstch[sline] = sx1; if (sx2 > curscr->_lastch[sline]) curscr->_lastch[sline] = sx2; w->_firstch[pline] = _NO_CHANGE; /* updated now */ w->_lastch[pline] = _NO_CHANGE; /* updated now */ } sline++; pline++; } if (w->_clear) { w->_clear = FALSE; curscr->_clear = TRUE; } /* position the cursor to the pad's current position if possible -- is the pad current position going to end up displayed? if not, then don't move the cursor; if so, move it to the correct place */ if (!w->_leaveit && w->_cury >= py && w->_curx >= px && w->_cury <= py + (sy2 - sy1) && w->_curx <= px + (sx2 - sx1)) { curscr->_cury = (w->_cury - py) + sy1; curscr->_curx = (w->_curx - px) + sx1; } return OK; } int pechochar(WINDOW *pad, chtype ch) { PDC_LOG(("pechochar() - called\n")); if (waddch(pad, ch) == ERR) return ERR; return prefresh(pad, save_pminrow, save_pmincol, save_sminrow, save_smincol, save_smaxrow, save_smaxcol); } #ifdef PDC_WIDE int pecho_wchar(WINDOW *pad, const cchar_t *wch) { PDC_LOG(("pecho_wchar() - called\n")); if (!wch || (waddch(pad, *wch) == ERR)) return ERR; return prefresh(pad, save_pminrow, save_pmincol, save_sminrow, save_smincol, save_smaxrow, save_smaxcol); } #endif curses-1.4.4/vendor/PDCurses/pdcurses/border.c0000644000004100000410000002602114201713275021315 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** border ------ ### Synopsis int border(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br); int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br); int box(WINDOW *win, chtype verch, chtype horch); int hline(chtype ch, int n); int vline(chtype ch, int n); int whline(WINDOW *win, chtype ch, int n); int wvline(WINDOW *win, chtype ch, int n); int mvhline(int y, int x, chtype ch, int n); int mvvline(int y, int x, chtype ch, int n); int mvwhline(WINDOW *win, int y, int x, chtype ch, int n); int mvwvline(WINDOW *win, int y, int x, chtype ch, int n); int border_set(const cchar_t *ls, const cchar_t *rs, const cchar_t *ts, const cchar_t *bs, const cchar_t *tl, const cchar_t *tr, const cchar_t *bl, const cchar_t *br); int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs, const cchar_t *ts, const cchar_t *bs, const cchar_t *tl, const cchar_t *tr, const cchar_t *bl, const cchar_t *br); int box_set(WINDOW *win, const cchar_t *verch, const cchar_t *horch); int hline_set(const cchar_t *wch, int n); int vline_set(const cchar_t *wch, int n); int whline_set(WINDOW *win, const cchar_t *wch, int n); int wvline_set(WINDOW *win, const cchar_t *wch, int n); int mvhline_set(int y, int x, const cchar_t *wch, int n); int mvvline_set(int y, int x, const cchar_t *wch, int n); int mvwhline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n); int mvwvline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n); ### Description border(), wborder(), and box() draw a border around the edge of the window. If any argument is zero, an appropriate default is used: ls left side of border ACS_VLINE rs right side of border ACS_VLINE ts top side of border ACS_HLINE bs bottom side of border ACS_HLINE tl top left corner of border ACS_ULCORNER tr top right corner of border ACS_URCORNER bl bottom left corner of border ACS_LLCORNER br bottom right corner of border ACS_LRCORNER hline() and whline() draw a horizontal line, using ch, starting from the current cursor position. The cursor position does not change. The line is at most n characters long, or as many as will fit in the window. vline() and wvline() draw a vertical line, using ch, starting from the current cursor position. The cursor position does not change. The line is at most n characters long, or as many as will fit in the window. ### Return Value These functions return OK on success and ERR on error. ### Portability X/Open BSD SYS V border Y - 4.0 wborder Y - 4.0 box Y Y Y hline Y - 4.0 vline Y - 4.0 whline Y - 4.0 wvline Y - 4.0 mvhline Y mvvline Y mvwhline Y mvwvline Y border_set Y wborder_set Y box_set Y hline_set Y vline_set Y whline_set Y wvline_set Y mvhline_set Y mvvline_set Y mvwhline_set Y mvwvline_set Y **man-end****************************************************************/ /* _attr_passthru() -- Takes a single chtype 'ch' and checks if the current attribute of window 'win', as set by wattrset(), and/or the current background of win, as set by wbkgd(), should by combined with it. Attributes set explicitly in ch take precedence. */ static chtype _attr_passthru(WINDOW *win, chtype ch) { chtype attr; /* If the incoming character doesn't have its own attribute, then use the current attributes for the window. If the incoming character has attributes, but not a color component, OR the attributes to the current attributes for the window. If the incoming character has a color component, use only the attributes from the incoming character. */ attr = ch & A_ATTRIBUTES; if (!(attr & A_COLOR)) attr |= win->_attrs; /* wrs (4/10/93) -- Apply the same sort of logic for the window background, in that it only takes precedence if other color attributes are not there. */ if (!(attr & A_COLOR)) attr |= win->_bkgd & A_ATTRIBUTES; else attr |= win->_bkgd & (A_ATTRIBUTES ^ A_COLOR); ch = (ch & A_CHARTEXT) | attr; return ch; } int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br) { int i, ymax, xmax; PDC_LOG(("wborder() - called\n")); if (!win) return ERR; ymax = win->_maxy - 1; xmax = win->_maxx - 1; ls = _attr_passthru(win, ls ? ls : ACS_VLINE); rs = _attr_passthru(win, rs ? rs : ACS_VLINE); ts = _attr_passthru(win, ts ? ts : ACS_HLINE); bs = _attr_passthru(win, bs ? bs : ACS_HLINE); tl = _attr_passthru(win, tl ? tl : ACS_ULCORNER); tr = _attr_passthru(win, tr ? tr : ACS_URCORNER); bl = _attr_passthru(win, bl ? bl : ACS_LLCORNER); br = _attr_passthru(win, br ? br : ACS_LRCORNER); for (i = 1; i < xmax; i++) { win->_y[0][i] = ts; win->_y[ymax][i] = bs; } for (i = 1; i < ymax; i++) { win->_y[i][0] = ls; win->_y[i][xmax] = rs; } win->_y[0][0] = tl; win->_y[0][xmax] = tr; win->_y[ymax][0] = bl; win->_y[ymax][xmax] = br; for (i = 0; i <= ymax; i++) { win->_firstch[i] = 0; win->_lastch[i] = xmax; } PDC_sync(win); return OK; } int border(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br) { PDC_LOG(("border() - called\n")); return wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br); } int box(WINDOW *win, chtype verch, chtype horch) { PDC_LOG(("box() - called\n")); return wborder(win, verch, verch, horch, horch, 0, 0, 0, 0); } int whline(WINDOW *win, chtype ch, int n) { chtype *dest; int startpos, endpos; PDC_LOG(("whline() - called\n")); if (!win || n < 1) return ERR; startpos = win->_curx; endpos = min(startpos + n, win->_maxx) - 1; dest = win->_y[win->_cury]; ch = _attr_passthru(win, ch ? ch : ACS_HLINE); for (n = startpos; n <= endpos; n++) dest[n] = ch; n = win->_cury; if (startpos < win->_firstch[n] || win->_firstch[n] == _NO_CHANGE) win->_firstch[n] = startpos; if (endpos > win->_lastch[n]) win->_lastch[n] = endpos; PDC_sync(win); return OK; } int hline(chtype ch, int n) { PDC_LOG(("hline() - called\n")); return whline(stdscr, ch, n); } int mvhline(int y, int x, chtype ch, int n) { PDC_LOG(("mvhline() - called\n")); if (move(y, x) == ERR) return ERR; return whline(stdscr, ch, n); } int mvwhline(WINDOW *win, int y, int x, chtype ch, int n) { PDC_LOG(("mvwhline() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return whline(win, ch, n); } int wvline(WINDOW *win, chtype ch, int n) { int endpos, x; PDC_LOG(("wvline() - called\n")); if (!win || n < 1) return ERR; endpos = min(win->_cury + n, win->_maxy); x = win->_curx; ch = _attr_passthru(win, ch ? ch : ACS_VLINE); for (n = win->_cury; n < endpos; n++) { win->_y[n][x] = ch; if (x < win->_firstch[n] || win->_firstch[n] == _NO_CHANGE) win->_firstch[n] = x; if (x > win->_lastch[n]) win->_lastch[n] = x; } PDC_sync(win); return OK; } int vline(chtype ch, int n) { PDC_LOG(("vline() - called\n")); return wvline(stdscr, ch, n); } int mvvline(int y, int x, chtype ch, int n) { PDC_LOG(("mvvline() - called\n")); if (move(y, x) == ERR) return ERR; return wvline(stdscr, ch, n); } int mvwvline(WINDOW *win, int y, int x, chtype ch, int n) { PDC_LOG(("mvwvline() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return wvline(win, ch, n); } #ifdef PDC_WIDE int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs, const cchar_t *ts, const cchar_t *bs, const cchar_t *tl, const cchar_t *tr, const cchar_t *bl, const cchar_t *br) { PDC_LOG(("wborder_set() - called\n")); return wborder(win, ls ? *ls : 0, rs ? *rs : 0, ts ? *ts : 0, bs ? *bs : 0, tl ? *tl : 0, tr ? *tr : 0, bl ? *bl : 0, br ? *br : 0); } int border_set(const cchar_t *ls, const cchar_t *rs, const cchar_t *ts, const cchar_t *bs, const cchar_t *tl, const cchar_t *tr, const cchar_t *bl, const cchar_t *br) { PDC_LOG(("border_set() - called\n")); return wborder_set(stdscr, ls, rs, ts, bs, tl, tr, bl, br); } int box_set(WINDOW *win, const cchar_t *verch, const cchar_t *horch) { PDC_LOG(("box_set() - called\n")); return wborder_set(win, verch, verch, horch, horch, (const cchar_t *)NULL, (const cchar_t *)NULL, (const cchar_t *)NULL, (const cchar_t *)NULL); } int whline_set(WINDOW *win, const cchar_t *wch, int n) { PDC_LOG(("whline_set() - called\n")); return wch ? whline(win, *wch, n) : ERR; } int hline_set(const cchar_t *wch, int n) { PDC_LOG(("hline_set() - called\n")); return whline_set(stdscr, wch, n); } int mvhline_set(int y, int x, const cchar_t *wch, int n) { PDC_LOG(("mvhline_set() - called\n")); if (move(y, x) == ERR) return ERR; return whline_set(stdscr, wch, n); } int mvwhline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n) { PDC_LOG(("mvwhline_set() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return whline_set(win, wch, n); } int wvline_set(WINDOW *win, const cchar_t *wch, int n) { PDC_LOG(("wvline_set() - called\n")); return wch ? wvline(win, *wch, n) : ERR; } int vline_set(const cchar_t *wch, int n) { PDC_LOG(("vline_set() - called\n")); return wvline_set(stdscr, wch, n); } int mvvline_set(int y, int x, const cchar_t *wch, int n) { PDC_LOG(("mvvline_set() - called\n")); if (move(y, x) == ERR) return ERR; return wvline_set(stdscr, wch, n); } int mvwvline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n) { PDC_LOG(("mvwvline_set() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return wvline_set(win, wch, n); } #endif curses-1.4.4/vendor/PDCurses/pdcurses/addchstr.c0000644000004100000410000001405714201713275021642 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** addchstr -------- ### Synopsis int addchstr(const chtype *ch); int addchnstr(const chtype *ch, int n); int waddchstr(WINDOW *win, const chtype *ch); int waddchnstr(WINDOW *win, const chtype *ch, int n); int mvaddchstr(int y, int x, const chtype *ch); int mvaddchnstr(int y, int x, const chtype *ch, int n); int mvwaddchstr(WINDOW *, int y, int x, const chtype *ch); int mvwaddchnstr(WINDOW *, int y, int x, const chtype *ch, int n); int add_wchstr(const cchar_t *wch); int add_wchnstr(const cchar_t *wch, int n); int wadd_wchstr(WINDOW *win, const cchar_t *wch); int wadd_wchnstr(WINDOW *win, const cchar_t *wch, int n); int mvadd_wchstr(int y, int x, const cchar_t *wch); int mvadd_wchnstr(int y, int x, const cchar_t *wch, int n); int mvwadd_wchstr(WINDOW *win, int y, int x, const cchar_t *wch); int mvwadd_wchnstr(WINDOW *win, int y, int x, const cchar_t *wch, int n); ### Description These routines write a chtype or cchar_t string directly into the window structure, starting at the current or specified position. The four routines with n as the last argument copy at most n elements, but no more than will fit on the line. If n = -1 then the whole string is copied, up to the maximum number that will fit on the line. The cursor position is not advanced. These routines do not check for newline or other special characters, nor does any line wrapping occur. ### Return Value All functions return OK or ERR. ### Portability X/Open BSD SYS V addchstr Y - 4.0 waddchstr Y - 4.0 mvaddchstr Y - 4.0 mvwaddchstr Y - 4.0 addchnstr Y - 4.0 waddchnstr Y - 4.0 mvaddchnstr Y - 4.0 mvwaddchnstr Y - 4.0 add_wchstr Y wadd_wchstr Y mvadd_wchstr Y mvwadd_wchstr Y add_wchnstr Y wadd_wchnstr Y mvadd_wchnstr Y mvwadd_wchnstr Y **man-end****************************************************************/ #include int waddchnstr(WINDOW *win, const chtype *ch, int n) { int y, x, maxx, minx; chtype *ptr; PDC_LOG(("waddchnstr() - called: win=%p n=%d\n", win, n)); if (!win || !ch || !n || n < -1) return ERR; x = win->_curx; y = win->_cury; ptr = &(win->_y[y][x]); if (n == -1 || n > win->_maxx - x) n = win->_maxx - x; minx = win->_firstch[y]; maxx = win->_lastch[y]; for (; n && *ch; n--, x++, ptr++, ch++) { if (*ptr != *ch) { if (x < minx || minx == _NO_CHANGE) minx = x; if (x > maxx) maxx = x; PDC_LOG(("y %d x %d minx %d maxx %d *ptr %x *ch" " %x firstch: %d lastch: %d\n", y, x, minx, maxx, *ptr, *ch, win->_firstch[y], win->_lastch[y])); *ptr = *ch; } } win->_firstch[y] = minx; win->_lastch[y] = maxx; return OK; } int addchstr(const chtype *ch) { PDC_LOG(("addchstr() - called\n")); return waddchnstr(stdscr, ch, -1); } int addchnstr(const chtype *ch, int n) { PDC_LOG(("addchnstr() - called\n")); return waddchnstr(stdscr, ch, n); } int waddchstr(WINDOW *win, const chtype *ch) { PDC_LOG(("waddchstr() - called: win=%p\n", win)); return waddchnstr(win, ch, -1); } int mvaddchstr(int y, int x, const chtype *ch) { PDC_LOG(("mvaddchstr() - called: y %d x %d\n", y, x)); if (move(y, x) == ERR) return ERR; return waddchnstr(stdscr, ch, -1); } int mvaddchnstr(int y, int x, const chtype *ch, int n) { PDC_LOG(("mvaddchnstr() - called: y %d x %d n %d\n", y, x, n)); if (move(y, x) == ERR) return ERR; return waddchnstr(stdscr, ch, n); } int mvwaddchstr(WINDOW *win, int y, int x, const chtype *ch) { PDC_LOG(("mvwaddchstr() - called:\n")); if (wmove(win, y, x) == ERR) return ERR; return waddchnstr(win, ch, -1); } int mvwaddchnstr(WINDOW *win, int y, int x, const chtype *ch, int n) { PDC_LOG(("mvwaddchnstr() - called: y %d x %d n %d \n", y, x, n)); if (wmove(win, y, x) == ERR) return ERR; return waddchnstr(win, ch, n); } #ifdef PDC_WIDE int wadd_wchnstr(WINDOW *win, const cchar_t *wch, int n) { PDC_LOG(("wadd_wchnstr() - called: win=%p n=%d\n", win, n)); return waddchnstr(win, wch, n); } int add_wchstr(const cchar_t *wch) { PDC_LOG(("add_wchstr() - called\n")); return wadd_wchnstr(stdscr, wch, -1); } int add_wchnstr(const cchar_t *wch, int n) { PDC_LOG(("add_wchnstr() - called\n")); return wadd_wchnstr(stdscr, wch, n); } int wadd_wchstr(WINDOW *win, const cchar_t *wch) { PDC_LOG(("wadd_wchstr() - called: win=%p\n", win)); return wadd_wchnstr(win, wch, -1); } int mvadd_wchstr(int y, int x, const cchar_t *wch) { PDC_LOG(("mvadd_wchstr() - called: y %d x %d\n", y, x)); if (move(y, x) == ERR) return ERR; return wadd_wchnstr(stdscr, wch, -1); } int mvadd_wchnstr(int y, int x, const cchar_t *wch, int n) { PDC_LOG(("mvadd_wchnstr() - called: y %d x %d n %d\n", y, x, n)); if (move(y, x) == ERR) return ERR; return wadd_wchnstr(stdscr, wch, n); } int mvwadd_wchstr(WINDOW *win, int y, int x, const cchar_t *wch) { PDC_LOG(("mvwadd_wchstr() - called:\n")); if (wmove(win, y, x) == ERR) return ERR; return wadd_wchnstr(win, wch, -1); } int mvwadd_wchnstr(WINDOW *win, int y, int x, const cchar_t *wch, int n) { PDC_LOG(("mvwadd_wchnstr() - called: y %d x %d n %d \n", y, x, n)); if (wmove(win, y, x) == ERR) return ERR; return wadd_wchnstr(win, wch, n); } #endif curses-1.4.4/vendor/PDCurses/pdcurses/overlay.c0000644000004100000410000001346114201713275021525 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** overlay ------- ### Synopsis int overlay(const WINDOW *src_w, WINDOW *dst_w) int overwrite(const WINDOW *src_w, WINDOW *dst_w) int copywin(const WINDOW *src_w, WINDOW *dst_w, int src_tr, int src_tc, int dst_tr, int dst_tc, int dst_br, int dst_bc, bool overlay) ### Description overlay() and overwrite() copy all the text from src_w into dst_w. The windows need not be the same size. Those characters in the source window that intersect with the destination window are copied, so that the characters appear in the same physical position on the screen. The difference between the two functions is that overlay() is non-destructive (blanks are not copied) while overwrite() is destructive (blanks are copied). copywin() is similar, but doesn't require that the two windows overlap. The arguments src_tc and src_tr specify the top left corner of the region to be copied. dst_tc, dst_tr, dst_br, and dst_bc specify the region within the destination window to copy to. The argument "overlay", if TRUE, indicates that the copy is done non-destructively (as in overlay()); blanks in the source window are not copied to the destination window. When overlay is FALSE, blanks are copied. ### Return Value All functions return OK on success and ERR on error. ### Portability X/Open BSD SYS V overlay Y Y Y overwrite Y Y Y copywin Y - 3.0 **man-end****************************************************************/ /* Thanks to Andreas Otte for the corrected overlay()/overwrite() behavior. */ static int _copy_win(const WINDOW *src_w, WINDOW *dst_w, int src_tr, int src_tc, int src_br, int src_bc, int dst_tr, int dst_tc, bool _overlay) { int col, line, y1, fc, *minchng, *maxchng; chtype *w1ptr, *w2ptr; int lc = 0; int xdiff = src_bc - src_tc; int ydiff = src_br - src_tr; if (!src_w || !dst_w) return ERR; minchng = dst_w->_firstch; maxchng = dst_w->_lastch; for (y1 = 0; y1 < dst_tr; y1++) { minchng++; maxchng++; } for (line = 0; line < ydiff; line++) { w1ptr = src_w->_y[line + src_tr] + src_tc; w2ptr = dst_w->_y[line + dst_tr] + dst_tc; fc = _NO_CHANGE; for (col = 0; col < xdiff; col++) { if ((*w1ptr) != (*w2ptr) && !((*w1ptr & A_CHARTEXT) == ' ' && _overlay)) { *w2ptr = *w1ptr; if (fc == _NO_CHANGE) fc = col + dst_tc; lc = col + dst_tc; } w1ptr++; w2ptr++; } if (*minchng == _NO_CHANGE) { *minchng = fc; *maxchng = lc; } else if (fc != _NO_CHANGE) { if (fc < *minchng) *minchng = fc; if (lc > *maxchng) *maxchng = lc; } minchng++; maxchng++; } return OK; } int _copy_overlap(const WINDOW *src_w, WINDOW *dst_w, bool overlay) { int first_line, first_col, last_line, last_col; int src_start_x, src_start_y, dst_start_x, dst_start_y; int xdiff, ydiff; if (!src_w || !dst_w) return ERR; first_col = max(dst_w->_begx, src_w->_begx); first_line = max(dst_w->_begy, src_w->_begy); last_col = min(src_w->_begx + src_w->_maxx, dst_w->_begx + dst_w->_maxx); last_line = min(src_w->_begy + src_w->_maxy, dst_w->_begy + dst_w->_maxy); /* determine the overlapping region of the two windows in real coordinates */ /* if no overlapping region, do nothing */ if ((last_col < first_col) || (last_line < first_line)) return OK; /* size of overlapping region */ xdiff = last_col - first_col; ydiff = last_line - first_line; if (src_w->_begx <= dst_w->_begx) { src_start_x = dst_w->_begx - src_w->_begx; dst_start_x = 0; } else { dst_start_x = src_w->_begx - dst_w->_begx; src_start_x = 0; } if (src_w->_begy <= dst_w->_begy) { src_start_y = dst_w->_begy - src_w->_begy; dst_start_y = 0; } else { dst_start_y = src_w->_begy - dst_w->_begy; src_start_y = 0; } return _copy_win(src_w, dst_w, src_start_y, src_start_x, src_start_y + ydiff, src_start_x + xdiff, dst_start_y, dst_start_x, overlay); } int overlay(const WINDOW *src_w, WINDOW *dst_w) { PDC_LOG(("overlay() - called\n")); return _copy_overlap(src_w, dst_w, TRUE); } int overwrite(const WINDOW *src_w, WINDOW *dst_w) { PDC_LOG(("overwrite() - called\n")); return _copy_overlap(src_w, dst_w, FALSE); } int copywin(const WINDOW *src_w, WINDOW *dst_w, int src_tr, int src_tc, int dst_tr, int dst_tc, int dst_br, int dst_bc, int _overlay) { int src_end_x, src_end_y; int src_rows, src_cols, dst_rows, dst_cols; int min_rows, min_cols; PDC_LOG(("copywin() - called\n")); if (!src_w || !dst_w || dst_w == curscr || dst_br >= dst_w->_maxy || dst_bc >= dst_w->_maxx || dst_tr < 0 || dst_tc < 0) return ERR; src_rows = src_w->_maxy - src_tr; src_cols = src_w->_maxx - src_tc; dst_rows = dst_br - dst_tr + 1; dst_cols = dst_bc - dst_tc + 1; min_rows = min(src_rows, dst_rows); min_cols = min(src_cols, dst_cols); src_end_y = src_tr + min_rows; src_end_x = src_tc + min_cols; return _copy_win(src_w, dst_w, src_tr, src_tc, src_end_y, src_end_x, dst_tr, dst_tc, (bool)_overlay); } curses-1.4.4/vendor/PDCurses/pdcurses/panel.c0000644000004100000410000003464514201713275021152 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** panel ----- ### Synopsis int bottom_panel(PANEL *pan); int del_panel(PANEL *pan); int hide_panel(PANEL *pan); int move_panel(PANEL *pan, int starty, int startx); PANEL *new_panel(WINDOW *win); PANEL *panel_above(const PANEL *pan); PANEL *panel_below(const PANEL *pan); int panel_hidden(const PANEL *pan); const void *panel_userptr(const PANEL *pan); WINDOW *panel_window(const PANEL *pan); int replace_panel(PANEL *pan, WINDOW *win); int set_panel_userptr(PANEL *pan, const void *uptr); int show_panel(PANEL *pan); int top_panel(PANEL *pan); void update_panels(void); ### Description The panel library is built using the curses library, and any program using panels routines must call one of the curses initialization routines such as initscr(). A program using these routines must be linked with the panels and curses libraries. The header includes the header . The panels package gives the applications programmer a way to have depth relationships between curses windows; a curses window is associated with every panel. The panels routines allow curses windows to overlap without making visible the overlapped portions of underlying windows. The initial curses window, stdscr, lies beneath all panels. The set of currently visible panels is the 'deck' of panels. The panels package allows the applications programmer to create panels, fetch and set their associated windows, shuffle panels in the deck, and manipulate panels in other ways. bottom_panel() places pan at the bottom of the deck. The size, location and contents of the panel are unchanged. del_panel() deletes pan, but not its associated winwow. hide_panel() removes a panel from the deck and thus hides it from view. move_panel() moves the curses window associated with pan, so that its upper lefthand corner is at the supplied coordinates. (Do not use mvwin() on the window.) new_panel() creates a new panel associated with win and returns the panel pointer. The new panel is placed at the top of the deck. panel_above() returns a pointer to the panel in the deck above pan, or NULL if pan is the top panel. If the value of pan passed is NULL, this function returns a pointer to the bottom panel in the deck. panel_below() returns a pointer to the panel in the deck below pan, or NULL if pan is the bottom panel. If the value of pan passed is NULL, this function returns a pointer to the top panel in the deck. panel_hidden() returns OK if pan is hidden and ERR if it is not. panel_userptr() - Each panel has a user pointer available for maintaining relevant information. This function returns a pointer to that information previously set up by set_panel_userptr(). panel_window() returns a pointer to the curses window associated with the panel. replace_panel() replaces the current window of pan with win. set_panel_userptr() - Each panel has a user pointer available for maintaining relevant information. This function sets the value of that information. show_panel() makes a previously hidden panel visible and places it back in the deck on top. top_panel() places pan on the top of the deck. The size, location and contents of the panel are unchanged. update_panels() refreshes the virtual screen to reflect the depth relationships between the panels in the deck. The user must use doupdate() to refresh the physical screen. ### Return Value Each routine that returns a pointer to an object returns NULL if an error occurs. Each panel routine that returns an integer, returns OK if it executes successfully and ERR if it does not. ### Portability X/Open BSD SYS V bottom_panel - - Y del_panel - - Y hide_panel - - Y move_panel - - Y new_panel - - Y panel_above - - Y panel_below - - Y panel_hidden - - Y panel_userptr - - Y panel_window - - Y replace_panel - - Y set_panel_userptr - - Y show_panel - - Y top_panel - - Y update_panels - - Y Credits: Original Author - Warren Tucker **man-end****************************************************************/ #include #include PANEL *_bottom_panel = (PANEL *)0; PANEL *_top_panel = (PANEL *)0; PANEL _stdscr_pseudo_panel = { (WINDOW *)0 }; #ifdef PANEL_DEBUG static void dPanel(char *text, PANEL *pan) { PDC_LOG(("%s id=%s b=%s a=%s y=%d x=%d", text, pan->user, pan->below ? pan->below->user : "--", pan->above ? pan->above->user : "--", pan->wstarty, pan->wstartx)); } static void dStack(char *fmt, int num, PANEL *pan) { char s80[80]; sprintf(s80, fmt, num, pan); PDC_LOG(("%s b=%s t=%s", s80, _bottom_panel ? _bottom_panel->user : "--", _top_panel ? _top_panel->user : "--")); if (pan) PDC_LOG(("pan id=%s", pan->user)); pan = _bottom_panel; while (pan) { dPanel("stk", pan); pan = pan->above; } } /* debugging hook for wnoutrefresh */ static void Wnoutrefresh(PANEL *pan) { dPanel("wnoutrefresh", pan); wnoutrefresh(pan->win); } static void Touchpan(PANEL *pan) { dPanel("Touchpan", pan); touchwin(pan->win); } static void Touchline(PANEL *pan, int start, int count) { char s80[80]; sprintf(s80, "Touchline s=%d c=%d", start, count); dPanel(s80, pan); touchline(pan->win, start, count); } #else /* PANEL_DEBUG */ #define dPanel(text, pan) #define dStack(fmt, num, pan) #define Wnoutrefresh(pan) wnoutrefresh((pan)->win) #define Touchpan(pan) touchwin((pan)->win) #define Touchline(pan, start, count) touchline((pan)->win, start, count) #endif /* PANEL_DEBUG */ static bool _panels_overlapped(PANEL *pan1, PANEL *pan2) { if (!pan1 || !pan2) return FALSE; return ((pan1->wstarty >= pan2->wstarty && pan1->wstarty < pan2->wendy) || (pan2->wstarty >= pan1->wstarty && pan2->wstarty < pan1->wendy)) && ((pan1->wstartx >= pan2->wstartx && pan1->wstartx < pan2->wendx) || (pan2->wstartx >= pan1->wstartx && pan2->wstartx < pan1->wendx)); } static void _free_obscure(PANEL *pan) { PANELOBS *tobs = pan->obscure; /* "this" one */ PANELOBS *nobs; /* "next" one */ while (tobs) { nobs = tobs->above; free((char *)tobs); tobs = nobs; } pan->obscure = (PANELOBS *)0; } static void _override(PANEL *pan, int show) { int y; PANEL *pan2; PANELOBS *tobs = pan->obscure; /* "this" one */ if (show == 1) Touchpan(pan); else if (!show) { Touchpan(pan); Touchpan(&_stdscr_pseudo_panel); } else if (show == -1) while (tobs && (tobs->pan != pan)) tobs = tobs->above; while (tobs) { if ((pan2 = tobs->pan) != pan) for (y = pan->wstarty; y < pan->wendy; y++) if ((y >= pan2->wstarty) && (y < pan2->wendy) && ((is_linetouched(pan->win, y - pan->wstarty)) || (is_linetouched(stdscr, y)))) Touchline(pan2, y - pan2->wstarty, 1); tobs = tobs->above; } } static void _calculate_obscure(void) { PANEL *pan, *pan2; PANELOBS *tobs; /* "this" one */ PANELOBS *lobs; /* last one */ pan = _bottom_panel; while (pan) { if (pan->obscure) _free_obscure(pan); lobs = (PANELOBS *)0; pan2 = _bottom_panel; while (pan2) { if (_panels_overlapped(pan, pan2)) { if ((tobs = malloc(sizeof(PANELOBS))) == NULL) return; tobs->pan = pan2; dPanel("obscured", pan2); tobs->above = (PANELOBS *)0; if (lobs) lobs->above = tobs; else pan->obscure = tobs; lobs = tobs; } pan2 = pan2->above; } _override(pan, 1); pan = pan->above; } } /* check to see if panel is in the stack */ static bool _panel_is_linked(const PANEL *pan) { PANEL *pan2 = _bottom_panel; while (pan2) { if (pan2 == pan) return TRUE; pan2 = pan2->above; } return FALSE; } /* link panel into stack at top */ static void _panel_link_top(PANEL *pan) { #ifdef PANEL_DEBUG dStack("", 1, pan); if (_panel_is_linked(pan)) return; #endif pan->above = (PANEL *)0; pan->below = (PANEL *)0; if (_top_panel) { _top_panel->above = pan; pan->below = _top_panel; } _top_panel = pan; if (!_bottom_panel) _bottom_panel = pan; _calculate_obscure(); dStack("", 9, pan); } /* link panel into stack at bottom */ static void _panel_link_bottom(PANEL *pan) { #ifdef PANEL_DEBUG dStack("", 1, pan); if (_panel_is_linked(pan)) return; #endif pan->above = (PANEL *)0; pan->below = (PANEL *)0; if (_bottom_panel) { _bottom_panel->below = pan; pan->above = _bottom_panel; } _bottom_panel = pan; if (!_top_panel) _top_panel = pan; _calculate_obscure(); dStack("", 9, pan); } static void _panel_unlink(PANEL *pan) { PANEL *prev; PANEL *next; #ifdef PANEL_DEBUG dStack("", 1, pan); if (!_panel_is_linked(pan)) return; #endif _override(pan, 0); _free_obscure(pan); prev = pan->below; next = pan->above; /* if non-zero, we will not update the list head */ if (prev) { prev->above = next; if(next) next->below = prev; } else if (next) next->below = prev; if (pan == _bottom_panel) _bottom_panel = next; if (pan == _top_panel) _top_panel = prev; _calculate_obscure(); pan->above = (PANEL *)0; pan->below = (PANEL *)0; dStack("", 9, pan); } /************************************************************************ * The following are the public functions for the panels library. * ************************************************************************/ int bottom_panel(PANEL *pan) { if (!pan) return ERR; if (pan == _bottom_panel) return OK; if (_panel_is_linked(pan)) hide_panel(pan); _panel_link_bottom(pan); return OK; } int del_panel(PANEL *pan) { if (pan) { if (_panel_is_linked(pan)) hide_panel(pan); free((char *)pan); return OK; } return ERR; } int hide_panel(PANEL *pan) { if (!pan) return ERR; if (!_panel_is_linked(pan)) { pan->above = (PANEL *)0; pan->below = (PANEL *)0; return ERR; } _panel_unlink(pan); return OK; } int move_panel(PANEL *pan, int starty, int startx) { WINDOW *win; int maxy, maxx; if (!pan) return ERR; if (_panel_is_linked(pan)) _override(pan, 0); win = pan->win; if (mvwin(win, starty, startx) == ERR) return ERR; getbegyx(win, pan->wstarty, pan->wstartx); getmaxyx(win, maxy, maxx); pan->wendy = pan->wstarty + maxy; pan->wendx = pan->wstartx + maxx; if (_panel_is_linked(pan)) _calculate_obscure(); return OK; } PANEL *new_panel(WINDOW *win) { PANEL *pan = malloc(sizeof(PANEL)); if (!_stdscr_pseudo_panel.win) { _stdscr_pseudo_panel.win = stdscr; _stdscr_pseudo_panel.wstarty = 0; _stdscr_pseudo_panel.wstartx = 0; _stdscr_pseudo_panel.wendy = LINES; _stdscr_pseudo_panel.wendx = COLS; _stdscr_pseudo_panel.user = "stdscr"; _stdscr_pseudo_panel.obscure = (PANELOBS *)0; } if (pan) { int maxy, maxx; pan->win = win; pan->above = (PANEL *)0; pan->below = (PANEL *)0; getbegyx(win, pan->wstarty, pan->wstartx); getmaxyx(win, maxy, maxx); pan->wendy = pan->wstarty + maxy; pan->wendx = pan->wstartx + maxx; #ifdef PANEL_DEBUG pan->user = "new"; #else pan->user = (char *)0; #endif pan->obscure = (PANELOBS *)0; show_panel(pan); } return pan; } PANEL *panel_above(const PANEL *pan) { return pan ? pan->above : _bottom_panel; } PANEL *panel_below(const PANEL *pan) { return pan ? pan->below : _top_panel; } int panel_hidden(const PANEL *pan) { if (!pan) return ERR; return _panel_is_linked(pan) ? ERR : OK; } const void *panel_userptr(const PANEL *pan) { return pan ? pan->user : NULL; } WINDOW *panel_window(const PANEL *pan) { PDC_LOG(("panel_window() - called\n")); return pan->win; } int replace_panel(PANEL *pan, WINDOW *win) { int maxy, maxx; if (!pan) return ERR; if (_panel_is_linked(pan)) _override(pan, 0); pan->win = win; getbegyx(win, pan->wstarty, pan->wstartx); getmaxyx(win, maxy, maxx); pan->wendy = pan->wstarty + maxy; pan->wendx = pan->wstartx + maxx; if (_panel_is_linked(pan)) _calculate_obscure(); return OK; } int set_panel_userptr(PANEL *pan, const void *uptr) { if (!pan) return ERR; pan->user = uptr; return OK; } int show_panel(PANEL *pan) { if (!pan) return ERR; if (pan == _top_panel) return OK; if (_panel_is_linked(pan)) hide_panel(pan); _panel_link_top(pan); return OK; } int top_panel(PANEL *pan) { return show_panel(pan); } void update_panels(void) { PANEL *pan; PDC_LOG(("update_panels() - called\n")); pan = _bottom_panel; while (pan) { _override(pan, -1); pan = pan->above; } if (is_wintouched(stdscr)) Wnoutrefresh(&_stdscr_pseudo_panel); pan = _bottom_panel; while (pan) { if (is_wintouched(pan->win) || !pan->above) Wnoutrefresh(pan); pan = pan->above; } } curses-1.4.4/vendor/PDCurses/pdcurses/addch.c0000644000004100000410000005676414201713275021124 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** Name: addch Synopsis: int addch(const chtype ch); int waddch(WINDOW *win, const chtype ch); int mvaddch(int y, int x, const chtype ch); int mvwaddch(WINDOW *win, int y, int x, const chtype ch); int echochar(const chtype ch); int wechochar(WINDOW *win, const chtype ch); int addrawch(chtype ch); int waddrawch(WINDOW *win, chtype ch); int mvaddrawch(int y, int x, chtype ch); int mvwaddrawch(WINDOW *win, int y, int x, chtype ch); int add_wch(const cchar_t *wch); int wadd_wch(WINDOW *win, const cchar_t *wch); int mvadd_wch(int y, int x, const cchar_t *wch); int mvwadd_wch(WINDOW *win, int y, int x, const cchar_t *wch); int echo_wchar(const cchar_t *wch); int wecho_wchar(WINDOW *win, const cchar_t *wch); Description: addch() adds the chtype ch to the default window (stdscr) at the current cursor position, and advances the cursor. Note that chtypes can convey both text (a single character) and attributes, including a color pair. add_wch() is the wide- character version of this function, taking a pointer to a cchar_t instead of a chtype. waddch() is like addch(), but also lets you specify the window. (This is in fact the core output routine.) wadd_wch() is the wide version. mvaddch() moves the cursor to the specified (y, x) position, and adds ch to stdscr. mvadd_wch() is the wide version. mvwaddch() moves the cursor to the specified position and adds ch to the specified window. mvwadd_wch() is the wide version. echochar() adds ch to stdscr at the current cursor position and calls refresh(). echo_wchar() is the wide version. wechochar() adds ch to the specified window and calls wrefresh(). wecho_wchar() is the wide version. addrawch(), waddrawch(), mvaddrawch() and mvwaddrawch() are PDCurses-specific wrappers for addch() etc. that disable the translation of control characters. The following applies to all these functions: If the cursor moves on to the right margin, an automatic newline is performed. If scrollok is enabled, and a character is added to the bottom right corner of the window, the scrolling region will be scrolled up one line. If scrolling is not allowed, ERR will be returned. If ch is a tab, newline, or backspace, the cursor will be moved appropriately within the window. If ch is a newline, the clrtoeol routine is called before the cursor is moved to the beginning of the next line. If newline mapping is off, the cursor will be moved to the next line, but the x coordinate will be unchanged. If ch is a tab the cursor is moved to the next tab position within the window. If ch is another control character, it will be drawn in the ^X notation. Calling the inch() routine after adding a control character returns the representation of the control character, not the control character. Video attributes can be combined with a character by ORing them into the parameter. Text, including attributes, can be copied from one place to another by using inch() and addch(). Note that in PDCurses, for now, a cchar_t and a chtype are the same. The text field is 16 bits wide, and is treated as Unicode (UCS-2) when PDCurses is built with wide-character support (define PDC_WIDE). So, in functions that take a chtype, like addch(), both the wide and narrow versions will handle Unicode. But for portability, you should use the wide functions. Return Value: All functions return OK on success and ERR on error. Portability X/Open BSD SYS V addch Y Y Y waddch Y Y Y mvaddch Y Y Y mvwaddch Y Y Y echochar Y - 3.0 wechochar Y - 3.0 addrawch - - - waddrawch - - - mvaddrawch - - - mvwaddrawch - - - add_wch Y wadd_wch Y mvadd_wch Y mvwadd_wch Y echo_wchar Y wecho_wchar Y **man-end****************************************************************/ /* As will be described below, the method used here for combining characters requires going beyond the usual 17*2^16 limit for Unicode. That can only happen with 64-bit chtype / cchar_t, and it's only worth doing if we're going past 8-byte characters in the first place. So if PDC_WIDE is defined _and_ we're using 64-bit chtypes, we're using the combining character scheme : */ #if defined( PDC_WIDE) && defined( CHTYPE_LONG) && CHTYPE_LONG >= 2 #define USING_COMBINING_CHARACTER_SCHEME #endif #ifdef USING_COMBINING_CHARACTER_SCHEME #include #include /* * A greatly stripped-down version of Markus Kuhn's excellent * wcwidth implementation. For his latest version and many * comments, see http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c * For PDCurses, only mk_wcwidth is used, modified to take an * int argument instead of wchar_t, because in MS-land, wchar_t * is 16 bits; getting the full Unicode range requires 21 bits. * Also modified format/indenting to conform to PDCurses norms. * NOTE that this version is current only to Unicode 5.0! Some * updates are almost certainly needed... */ struct interval { int first, last; }; /* auxiliary function for binary search in interval table */ static int bisearch( const int ucs, const struct interval *table, int max) { int min = 0; int mid; if (ucs < table[0].first || ucs > table[max].last) return 0; while (max >= min) { mid = (min + max) / 2; if (ucs > table[mid].last) min = mid + 1; else if (ucs < table[mid].first) max = mid - 1; else return 1; } return 0; } /* The following two functions define the column width of an ISO 10646 * character as follows: * * - The null character (U+0000) has a column width of 0. * * - Other C0/C1 control characters and DEL will lead to a return * value of -1. * * - Non-spacing and enclosing combining characters (general * category code Mn or Me in the Unicode database) have a * column width of 0. * * - SOFT HYPHEN (U+00AD) has a column width of 1. * * - Other format characters (general category code Cf in the Unicode * database) and ZERO WIDTH SPACE (U+200B) have a column width of 0. * * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF) * have a column width of 0. * * - Spacing characters in the East Asian Wide (W) or East Asian * Full-width (F) category as defined in Unicode Technical * Report #11 have a column width of 2. * * - All remaining characters (including all printable * ISO 8859-1 and WGL4 characters, Unicode control characters, * etc.) have a column width of 1. * * This implementation assumes that wchar_t characters are encoded * in ISO 10646. */ static int mk_wcwidth( const int ucs) { /* sorted list of non-overlapping intervals of non-spacing characters */ /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ static const struct interval combining[] = { { 0x0300, 0x036F }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 }, { 0x0591, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, { 0x05C4, 0x05C5 }, { 0x05C7, 0x05C7 }, { 0x0600, 0x0603 }, { 0x0610, 0x0615 }, { 0x064B, 0x065E }, { 0x0670, 0x0670 }, { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A }, { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, { 0x0901, 0x0902 }, { 0x093C, 0x093C }, { 0x0941, 0x0948 }, { 0x094D, 0x094D }, { 0x0951, 0x0954 }, { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, { 0x09E2, 0x09E3 }, { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C }, { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, { 0x0AE2, 0x0AE3 }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C }, { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, { 0x0B4D, 0x0B4D }, { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 }, { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 }, { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0CBC, 0x0CBC }, { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, { 0x0CE2, 0x0CE3 }, { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, { 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, { 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, { 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, { 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, { 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, { 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, { 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, { 0x1032, 0x1032 }, { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, { 0x1058, 0x1059 }, { 0x1160, 0x11FF }, { 0x135F, 0x135F }, { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, { 0x1752, 0x1753 }, { 0x1772, 0x1773 }, { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD }, { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD }, { 0x180B, 0x180D }, { 0x18A9, 0x18A9 }, { 0x1920, 0x1922 }, { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B }, { 0x1A17, 0x1A18 }, { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 }, { 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 }, { 0x1B6B, 0x1B73 }, { 0x1DC0, 0x1DCA }, { 0x1DFE, 0x1DFF }, { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 }, { 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F }, { 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B }, { 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F }, { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB }, { 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F }, { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 }, { 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, { 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F }, { 0xE0100, 0xE01EF } }; /* test for 8-bit control characters */ if (ucs == 0) return 0; if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) return -1; if( ucs < combining[0].first) /* everything else up to 0x300 is a */ return( 1); /* plain old single-width character */ /* binary search in table of non-spacing characters */ if (bisearch(ucs, combining, sizeof(combining) / sizeof(struct interval) - 1)) return 0; /* if we arrive here, ucs is not a combining or C0/C1 control character */ return 1 + (ucs >= 0x1100 && (ucs <= 0x115f || /* Hangul Jamo init. consonants */ ucs == 0x2329 || ucs == 0x232a || (ucs >= 0x2e80 && ucs <= 0xa4cf && ucs != 0x303f) || /* CJK ... Yi */ (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */ (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */ (ucs >= 0xfe10 && ucs <= 0xfe19) || /* Vertical forms */ (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */ (ucs >= 0xff00 && ucs <= 0xff60) || /* Fullwidth Forms */ (ucs >= 0xffe0 && ucs <= 0xffe6) || (ucs >= 0x20000 && ucs <= 0x2fffd) || (ucs >= 0x30000 && ucs <= 0x3fffd))); } /* The handling of "fullwidth" characters (those consuming two "normal" columns) and combining characters (characters that can add accents to a preceding character) in PDCurses is, of necessity, complex. Unicode is defined to have 17 planes of 2^16 characters each, so that the maximum Unicode code point is U+10FFFF. When addch() is given a fullwidth character, it handles that character "normally", and then stores the non-Unicode character DUMMY_CHAR_NEXT_TO_FULLWIDTH (U+110000) next to it, just as a placeholder. (That part is actually rather simple.) PDCurses handles combining characters by creating entirely new "Unicode" (let's call them "post-Unicode") characters, at code point U+110001 (COMBINED_CHAR_START) and beyond. The 'combos' table keeps track of these newly-created characters, essentially saying: "This post-Unicode character consists of the following 'root' character, plus an added combining character." The 'root' character in question may itself be a post-Unicode character; this allows us to add more than one combining character. For example, if one calls wchar() with, in succession, 'r' (U+72), a circumflex (U+0302), and an acute accent below (U+317), the call with the circumflex would cause 'combo' to be allocated, with combo[0].root = 'r' and combo[0].added = 0x302. Code point U+110001 would correspond to this character ('r' plus circumflex). The call with the acute accent below would create code point U+110002, combo[1].root = 0x110001 and combo[1].added = 0x317. Thus, a character with multiple combining characters simply resolves itself as a series of "post-Unicode" characters. When the display function in pdcdisp.c is asked to show character 0x110001 or 0x110002, it can use PDC_expand_combined_characters() to convert that code point to the actual series of characters. 'ncurses' handles combined characters in a very different manner: a 'cchar' is defined as an array of five characters, so that you can add up to four combining characters in any given cell. I had to reject that solution because backward compatibility within PDCurses would be broken. Quite aside from that, this is a simpler solution, and allows for any number of combining characters (though four ought to be enough for anybody). */ #define MAX_UNICODE 0x10ffff #define DUMMY_CHAR_NEXT_TO_FULLWIDTH (MAX_UNICODE + 1) #define COMBINED_CHAR_START (MAX_UNICODE + 2) /* "non-standard" 64-bit chtypes */ static int n_combos = 0, n_combos_allocated = 0; static struct combined_char { int32_t root, added; } *combos = NULL; static int find_combined_char_idx( const cchar_t root, const cchar_t added) { int i; for( i = 0; i < n_combos; i++) if( (int32_t)root == combos[i].root && (int32_t)added == combos[i].added) return( i); /* Didn't find this pair among existing combos; */ /* create a new one */ if( i == n_combos_allocated) { n_combos_allocated += 30 + n_combos_allocated / 2; combos = realloc( combos, n_combos_allocated * sizeof( struct combined_char)); } combos[i].root = (int32_t)root; combos[i].added = (int32_t)added; n_combos++; return( i); } int PDC_expand_combined_characters( const cchar_t c, cchar_t *added) { if( !c) /* flag to free up memory */ { n_combos = n_combos_allocated = 0; if( combos) free( combos); combos = NULL; return( 0); } assert( c >= COMBINED_CHAR_START && c < COMBINED_CHAR_START + n_combos); *added = combos[c - COMBINED_CHAR_START].added; return( combos[c - COMBINED_CHAR_START].root); } #endif /* #ifdef USING_COMBINING_CHARACTER_SCHEME */ int waddch( WINDOW *win, const chtype ch) { int x, y; #ifdef USING_COMBINING_CHARACTER_SCHEME int text_width; #endif chtype text, attr; bool xlat; PDC_LOG(("waddch() - called: win=%p ch=%x (text=%c attr=0x%x)\n", win, ch, ch & A_CHARTEXT, ch & A_ATTRIBUTES)); if (!win) return ERR; x = win->_curx; y = win->_cury; if (y > win->_maxy || x > win->_maxx || y < 0 || x < 0) return ERR; xlat = !SP->raw_out && !(ch & A_ALTCHARSET); text = ch & A_CHARTEXT; attr = ch & A_ATTRIBUTES; #ifdef USING_COMBINING_CHARACTER_SCHEME text_width = mk_wcwidth( (int)text); if( !text_width && text && (x || y)) { /* it's a combining char; combine w/prev char */ if( x) x--; else { y--; x = win->_maxx - 1; } text = COMBINED_CHAR_START + find_combined_char_idx( win->_y[y][x], text); } #endif if (xlat && (text < ' ' || text == 0x7f)) { int x2; switch ((int)text) { case '\t': for (x2 = ((x / TABSIZE) + 1) * TABSIZE; x < x2; x++) { if (waddch(win, attr | ' ') == ERR) return ERR; /* if tab to next line, exit the loop */ if (!win->_curx) break; } return OK; case '\n': /* if lf -> crlf */ if (!SP->raw_out) x = 0; wclrtoeol(win); if (++y > win->_bmarg) { y--; if (wscrl(win, 1) == ERR) return ERR; } break; case '\b': /* don't back over left margin */ if (--x < 0) case '\r': x = 0; break; case 0x7f: if (waddch(win, attr | '^') == ERR) return ERR; return waddch(win, attr | '?'); default: /* handle control chars */ if (waddch(win, attr | '^') == ERR) return ERR; return waddch(win, ch + '@'); } } else { /* If the incoming character doesn't have its own attribute, then use the current attributes for the window. If it has attributes but not a color component, OR the attributes to the current attributes for the window. If it has a color component, use the attributes solely from the incoming character. */ if (!(attr & A_COLOR)) attr |= win->_attrs; /* wrs (4/10/93): Apply the same sort of logic for the window background, in that it only takes precedence if other color attributes are not there and that the background character will only print if the printing character is blank. */ if (!(attr & A_COLOR)) attr |= win->_bkgd & A_ATTRIBUTES; else attr |= win->_bkgd & (A_ATTRIBUTES ^ A_COLOR); if (text == ' ') text = win->_bkgd & A_CHARTEXT; /* Add the attribute back into the character. */ text |= attr; /* Only change _firstch/_lastch if the character to be added is different from the character/attribute that is already in that position in the window. */ if (win->_y[y][x] != text) { if (win->_firstch[y] == _NO_CHANGE) win->_firstch[y] = win->_lastch[y] = x; else if (x < win->_firstch[y]) win->_firstch[y] = x; else if (x > win->_lastch[y]) win->_lastch[y] = x; win->_y[y][x] = text; } if (++x >= win->_maxx) { /* wrap around test */ x = 0; if (++y > win->_bmarg) { y--; if (wscrl(win, 1) == ERR) { PDC_sync(win); return ERR; } } } } win->_curx = x; win->_cury = y; #ifdef USING_COMBINING_CHARACTER_SCHEME /* If the character was fullwidth (should occupy two cells), we */ /* add a "dummy" character next to it : */ if( text_width == 2 && x) waddch( win, DUMMY_CHAR_NEXT_TO_FULLWIDTH); #endif if (win->_immed) wrefresh(win); if (win->_sync) wsyncup(win); return OK; } int addch(const chtype ch) { PDC_LOG(("addch() - called: ch=%x\n", ch)); return waddch(stdscr, ch); } int mvaddch(int y, int x, const chtype ch) { PDC_LOG(("mvaddch() - called: y=%d x=%d ch=%x\n", y, x, ch)); if (move(y,x) == ERR) return ERR; return waddch(stdscr, ch); } int mvwaddch(WINDOW *win, int y, int x, const chtype ch) { PDC_LOG(("mvwaddch() - called: win=%p y=%d x=%d ch=%d\n", win, y, x, ch)); if (wmove(win, y, x) == ERR) return ERR; return waddch(win, ch); } int echochar(const chtype ch) { PDC_LOG(("echochar() - called: ch=%x\n", ch)); return wechochar(stdscr, ch); } int wechochar(WINDOW *win, const chtype ch) { PDC_LOG(("wechochar() - called: win=%p ch=%x\n", win, ch)); if (waddch(win, ch) == ERR) return ERR; return wrefresh(win); } int waddrawch(WINDOW *win, chtype ch) { PDC_LOG(("waddrawch() - called: win=%p ch=%x (text=%c attr=0x%x)\n", win, ch, ch & A_CHARTEXT, ch & A_ATTRIBUTES)); if ((ch & A_CHARTEXT) < ' ' || (ch & A_CHARTEXT) == 0x7f) ch |= A_ALTCHARSET; return waddch(win, ch); } int addrawch(chtype ch) { PDC_LOG(("addrawch() - called: ch=%x\n", ch)); return waddrawch(stdscr, ch); } int mvaddrawch(int y, int x, chtype ch) { PDC_LOG(("mvaddrawch() - called: y=%d x=%d ch=%d\n", y, x, ch)); if (move(y, x) == ERR) return ERR; return waddrawch(stdscr, ch); } int mvwaddrawch(WINDOW *win, int y, int x, chtype ch) { PDC_LOG(("mvwaddrawch() - called: win=%p y=%d x=%d ch=%d\n", win, y, x, ch)); if (wmove(win, y, x) == ERR) return ERR; return waddrawch(win, ch); } #ifdef PDC_WIDE int wadd_wch(WINDOW *win, const cchar_t *wch) { PDC_LOG(("wadd_wch() - called: win=%p wch=%x\n", win, *wch)); return wch ? waddch(win, *wch) : ERR; } int add_wch(const cchar_t *wch) { PDC_LOG(("add_wch() - called: wch=%x\n", *wch)); return wadd_wch(stdscr, wch); } int mvadd_wch(int y, int x, const cchar_t *wch) { PDC_LOG(("mvaddch() - called: y=%d x=%d wch=%x\n", y, x, *wch)); if (move(y,x) == ERR) return ERR; return wadd_wch(stdscr, wch); } int mvwadd_wch(WINDOW *win, int y, int x, const cchar_t *wch) { PDC_LOG(("mvwaddch() - called: win=%p y=%d x=%d wch=%d\n", win, y, x, *wch)); if (wmove(win, y, x) == ERR) return ERR; return wadd_wch(win, wch); } int echo_wchar(const cchar_t *wch) { PDC_LOG(("echo_wchar() - called: wch=%x\n", *wch)); return wecho_wchar(stdscr, wch); } int wecho_wchar(WINDOW *win, const cchar_t *wch) { PDC_LOG(("wecho_wchar() - called: win=%p wch=%x\n", win, *wch)); if (!wch || (wadd_wch(win, wch) == ERR)) return ERR; return wrefresh(win); } #endif curses-1.4.4/vendor/PDCurses/pdcurses/getch.c0000644000004100000410000002446214201713275021141 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** getch ----- ### Synopsis int getch(void); int wgetch(WINDOW *win); int mvgetch(int y, int x); int mvwgetch(WINDOW *win, int y, int x); int ungetch(int ch); int flushinp(void); int get_wch(wint_t *wch); int wget_wch(WINDOW *win, wint_t *wch); int mvget_wch(int y, int x, wint_t *wch); int mvwget_wch(WINDOW *win, int y, int x, wint_t *wch); int unget_wch(const wchar_t wch); unsigned long PDC_get_key_modifiers(void); int PDC_save_key_modifiers(bool flag); int PDC_return_key_modifiers(bool flag); ### Description With the getch(), wgetch(), mvgetch(), and mvwgetch() functions, a character is read from the terminal associated with the window. In nodelay mode, if there is no input waiting, the value ERR is returned. In delay mode, the program will hang until the system passes text through to the program. Depending on the setting of cbreak(), this will be after one character or after the first newline. Unless noecho() has been set, the character will also be echoed into the designated window. If keypad() is TRUE, and a function key is pressed, the token for that function key will be returned instead of the raw characters. Possible function keys are defined in with integers beginning with 0401, whose names begin with KEY_. If nodelay(win, TRUE) has been called on the window and no input is waiting, the value ERR is returned. ungetch() places ch back onto the input queue to be returned by the next call to wgetch(). flushinp() throws away any type-ahead that has been typed by the user and has not yet been read by the program. PDC_get_key_modifiers() returns the keyboard modifiers (shift, control, alt, numlock) effective at the time of the last getch() call, if PDC_save_key_modifiers(TRUE) has been called before the getch(). Use the macros PDC_KEY_MODIFIER_* to determine which modifier(s) were set. PDC_return_key_modifiers() tells getch() to return modifier keys pressed alone as keystrokes (KEY_ALT_L, etc.). These may not work on all platforms. NOTE: getch() and ungetch() are implemented as macros, to avoid conflict with many DOS compiler's runtime libraries. ### Return Value These functions return ERR or the value of the character, meta character or function key token. ### Portability X/Open BSD SYS V getch Y Y Y wgetch Y Y Y mvgetch Y Y Y mvwgetch Y Y Y ungetch Y Y Y flushinp Y Y Y get_wch Y wget_wch Y mvget_wch Y mvwget_wch Y unget_wch Y PDC_get_key_modifiers - - - **man-end****************************************************************/ #define _INBUFSIZ 512 /* size of terminal input buffer */ #define NUNGETCH 256 /* max # chars to ungetch() */ static int c_pindex = 0; /* putter index */ static int c_gindex = 1; /* getter index */ static int c_ungind = 0; /* ungetch() push index */ static int c_ungch[NUNGETCH]; /* array of ungotten chars */ static int _mouse_key(WINDOW *win) { int i, key = KEY_MOUSE; unsigned long mbe = SP->_trap_mbe; /* Filter unwanted mouse events */ for (i = 0; i < 3; i++) { if (pdc_mouse_status.changes & (1 << i)) { int shf = i * 5; short button = pdc_mouse_status.button[i] & BUTTON_ACTION_MASK; if ( (!(mbe & (BUTTON1_PRESSED << shf)) && (button == BUTTON_PRESSED)) || (!(mbe & (BUTTON1_CLICKED << shf)) && (button == BUTTON_CLICKED)) || (!(mbe & (BUTTON1_DOUBLE_CLICKED << shf)) && (button == BUTTON_DOUBLE_CLICKED)) /* added triple clicks 2011 jun 4: BJG */ || (!(mbe & (BUTTON1_TRIPLE_CLICKED << shf)) && (button == BUTTON_TRIPLE_CLICKED)) || (!(mbe & (BUTTON1_MOVED << shf)) && (button == BUTTON_MOVED)) || (!(mbe & (BUTTON1_RELEASED << shf)) && (button == BUTTON_RELEASED)) ) pdc_mouse_status.changes ^= (1 << i); } } if (pdc_mouse_status.changes & PDC_MOUSE_MOVED) { if (!(mbe & (BUTTON1_MOVED|BUTTON2_MOVED|BUTTON3_MOVED | REPORT_MOUSE_POSITION))) pdc_mouse_status.changes ^= PDC_MOUSE_MOVED; } if (pdc_mouse_status.changes & (PDC_MOUSE_WHEEL_UP|PDC_MOUSE_WHEEL_DOWN)) { if (!(mbe & MOUSE_WHEEL_SCROLL)) pdc_mouse_status.changes &= ~(PDC_MOUSE_WHEEL_UP|PDC_MOUSE_WHEEL_DOWN); } if (!pdc_mouse_status.changes) return -1; /* Check for click in slk area */ i = PDC_mouse_in_slk(pdc_mouse_status.y, pdc_mouse_status.x); if (i) { if (pdc_mouse_status.button[0] & (BUTTON_PRESSED|BUTTON_CLICKED)) key = KEY_F(i); else key = -1; } return key; } int wgetch(WINDOW *win) { static int buffer[_INBUFSIZ]; /* character buffer */ int key, waitcount; PDC_LOG(("wgetch() - called\n")); if (!win) return ERR; waitcount = 0; /* set the number of 1/20th second napms() calls */ if (SP->delaytenths) waitcount = 2 * SP->delaytenths; else if (win->_delayms) { /* Can't really do millisecond intervals, so delay in 1/20ths of a second (50ms) */ waitcount = win->_delayms / 50; if (!waitcount) waitcount = 1; } /* refresh window when wgetch is called if there have been changes to it and it is not a pad */ if (!(win->_flags & _PAD) && ((!win->_leaveit && (win->_begx + win->_curx != SP->curscol || win->_begy + win->_cury != SP->cursrow)) || is_wintouched(win))) wrefresh(win); /* if ungotten char exists, remove and return it */ if (c_ungind) return c_ungch[--c_ungind]; /* if normal and data in buffer */ if ((!SP->raw_inp && !SP->cbreak) && (c_gindex < c_pindex)) return buffer[c_gindex++]; /* prepare to buffer data */ c_pindex = 0; c_gindex = 0; /* to get here, no keys are buffered. go and get one. */ for (;;) /* loop for any buffering */ { /* is there a keystroke ready? */ if (!PDC_check_key()) { /* if not, handle timeout() and halfdelay() */ if (SP->delaytenths || win->_delayms) { if (!waitcount) return ERR; waitcount--; } else if (win->_nodelay) return ERR; napms(50); /* sleep for 1/20th second */ continue; /* then check again */ } /* if there is, fetch it */ key = PDC_get_key(); if (SP->key_code) { /* filter special keys if not in keypad mode */ if (!win->_use_keypad) key = -1; /* filter mouse events; translate mouse clicks in the slk area to function keys */ else if (key == KEY_MOUSE) key = _mouse_key(win); } /* unwanted key? loop back */ if (key == -1) continue; /* translate CR */ if (key == '\r' && SP->autocr && !SP->raw_inp) key = '\n'; /* if echo is enabled */ if (SP->echo && !SP->key_code) { waddch(win, key); wrefresh(win); } /* if no buffering */ if (SP->raw_inp || SP->cbreak) return key; /* if no overflow, put data in buffer */ if (key == '\b') { if (c_pindex > c_gindex) c_pindex--; } else if (c_pindex < _INBUFSIZ - 2) buffer[c_pindex++] = key; /* if we got a line */ if (key == '\n' || key == '\r') return buffer[c_gindex++]; } } int mvgetch(int y, int x) { PDC_LOG(("mvgetch() - called\n")); if (move(y, x) == ERR) return ERR; return wgetch(stdscr); } int mvwgetch(WINDOW *win, int y, int x) { PDC_LOG(("mvwgetch() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return wgetch(win); } int PDC_ungetch(int ch) { PDC_LOG(("ungetch() - called\n")); if (c_ungind >= NUNGETCH) /* pushback stack full */ return ERR; c_ungch[c_ungind++] = ch; return OK; } int flushinp(void) { PDC_LOG(("flushinp() - called\n")); PDC_flushinp(); c_gindex = 1; /* set indices to kill buffer */ c_pindex = 0; c_ungind = 0; /* clear c_ungch array */ return OK; } unsigned long PDC_get_key_modifiers(void) { PDC_LOG(("PDC_get_key_modifiers() - called\n")); return pdc_key_modifiers; } int PDC_save_key_modifiers(bool flag) { PDC_LOG(("PDC_save_key_modifiers() - called\n")); SP->save_key_modifiers = flag; return OK; } int PDC_return_key_modifiers(bool flag) { PDC_LOG(("PDC_return_key_modifiers() - called\n")); SP->return_key_modifiers = flag; return PDC_modifiers_set(); } #ifdef PDC_WIDE int wget_wch(WINDOW *win, wint_t *wch) { int key; PDC_LOG(("wget_wch() - called\n")); if (!wch) return ERR; key = wgetch(win); if (key == ERR) return ERR; *wch = key; return SP->key_code ? KEY_CODE_YES : OK; } int get_wch(wint_t *wch) { PDC_LOG(("get_wch() - called\n")); return wget_wch(stdscr, wch); } int mvget_wch(int y, int x, wint_t *wch) { PDC_LOG(("mvget_wch() - called\n")); if (move(y, x) == ERR) return ERR; return wget_wch(stdscr, wch); } int mvwget_wch(WINDOW *win, int y, int x, wint_t *wch) { PDC_LOG(("mvwget_wch() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return wget_wch(win, wch); } int unget_wch(const wchar_t wch) { return PDC_ungetch(wch); } #endif curses-1.4.4/vendor/PDCurses/pdcurses/inch.c0000644000004100000410000000542614201713275020767 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** inch ---- ### Synopsis chtype inch(void); chtype winch(WINDOW *win); chtype mvinch(int y, int x); chtype mvwinch(WINDOW *win, int y, int x); int in_wch(cchar_t *wcval); int win_wch(WINDOW *win, cchar_t *wcval); int mvin_wch(int y, int x, cchar_t *wcval); int mvwin_wch(WINDOW *win, int y, int x, cchar_t *wcval); ### Description The inch() functions retrieve the character and attribute from the current or specified window position, in the form of a chtype. If a NULL window is specified, (chtype)ERR is returned. The in_wch() functions are the wide-character versions; instead of returning a chtype, they store a cchar_t at the address specified by wcval, and return OK or ERR. (No value is stored when ERR is returned.) Note that in PDCurses, chtype and cchar_t are the same. ### Portability X/Open BSD SYS V inch Y Y Y winch Y Y Y mvinch Y Y Y mvwinch Y Y Y in_wch Y win_wch Y mvin_wch Y mvwin_wch Y **man-end****************************************************************/ chtype winch(WINDOW *win) { PDC_LOG(("winch() - called\n")); if (!win) return (chtype)ERR; return win->_y[win->_cury][win->_curx]; } chtype inch(void) { PDC_LOG(("inch() - called\n")); return winch(stdscr); } chtype mvinch(int y, int x) { PDC_LOG(("mvinch() - called\n")); if (move(y, x) == ERR) return (chtype)ERR; return stdscr->_y[stdscr->_cury][stdscr->_curx]; } chtype mvwinch(WINDOW *win, int y, int x) { PDC_LOG(("mvwinch() - called\n")); if (wmove(win, y, x) == ERR) return (chtype)ERR; return win->_y[win->_cury][win->_curx]; } #ifdef PDC_WIDE int win_wch(WINDOW *win, cchar_t *wcval) { PDC_LOG(("win_wch() - called\n")); if (!win || !wcval) return ERR; *wcval = win->_y[win->_cury][win->_curx]; return OK; } int in_wch(cchar_t *wcval) { PDC_LOG(("in_wch() - called\n")); return win_wch(stdscr, wcval); } int mvin_wch(int y, int x, cchar_t *wcval) { PDC_LOG(("mvin_wch() - called\n")); if (!wcval || (move(y, x) == ERR)) return ERR; *wcval = stdscr->_y[stdscr->_cury][stdscr->_curx]; return OK; } int mvwin_wch(WINDOW *win, int y, int x, cchar_t *wcval) { PDC_LOG(("mvwin_wch() - called\n")); if (!wcval || (wmove(win, y, x) == ERR)) return ERR; *wcval = win->_y[win->_cury][win->_curx]; return OK; } #endif curses-1.4.4/vendor/PDCurses/pdcurses/clear.c0000644000004100000410000000631014201713275021125 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** clear ----- ### Synopsis int clear(void); int wclear(WINDOW *win); int erase(void); int werase(WINDOW *win); int clrtobot(void); int wclrtobot(WINDOW *win); int clrtoeol(void); int wclrtoeol(WINDOW *win); ### Description erase() and werase() copy blanks (i.e. the background chtype) to every cell of the window. clear() and wclear() are similar to erase() and werase(), but they also call clearok() to ensure that the the window is cleared on the next wrefresh(). clrtobot() and wclrtobot() clear the window from the current cursor position to the end of the window. clrtoeol() and wclrtoeol() clear the window from the current cursor position to the end of the current line. ### Return Value All functions return OK on success and ERR on error. ### Portability X/Open BSD SYS V clear Y Y Y wclear Y Y Y erase Y Y Y werase Y Y Y clrtobot Y Y Y wclrtobot Y Y Y clrtoeol Y Y Y wclrtoeol Y Y Y **man-end****************************************************************/ int wclrtoeol(WINDOW *win) { int x, y, minx; chtype blank, *ptr; PDC_LOG(("wclrtoeol() - called: Row: %d Col: %d\n", win->_cury, win->_curx)); if (!win) return ERR; y = win->_cury; x = win->_curx; /* wrs (4/10/93) account for window background */ blank = win->_bkgd; for (minx = x, ptr = &win->_y[y][x]; minx < win->_maxx; minx++, ptr++) *ptr = blank; if (x < win->_firstch[y] || win->_firstch[y] == _NO_CHANGE) win->_firstch[y] = x; win->_lastch[y] = win->_maxx - 1; PDC_sync(win); return OK; } int clrtoeol(void) { PDC_LOG(("clrtoeol() - called\n")); return wclrtoeol(stdscr); } int wclrtobot(WINDOW *win) { int savey, savex; PDC_LOG(("wclrtobot() - called\n")); if (!win) return ERR; savey = win->_cury; savex = win->_curx; /* should this involve scrolling region somehow ? */ if (win->_cury + 1 < win->_maxy) { win->_curx = 0; win->_cury++; for (; win->_maxy > win->_cury; win->_cury++) wclrtoeol(win); win->_cury = savey; win->_curx = savex; } wclrtoeol(win); PDC_sync(win); return OK; } int clrtobot(void) { PDC_LOG(("clrtobot() - called\n")); return wclrtobot(stdscr); } int werase(WINDOW *win) { PDC_LOG(("werase() - called\n")); if (wmove(win, 0, 0) == ERR) return ERR; return wclrtobot(win); } int erase(void) { PDC_LOG(("erase() - called\n")); return werase(stdscr); } int wclear(WINDOW *win) { PDC_LOG(("wclear() - called\n")); if (!win) return ERR; win->_clear = TRUE; return werase(win); } int clear(void) { PDC_LOG(("clear() - called\n")); return wclear(stdscr); } curses-1.4.4/vendor/PDCurses/pdcurses/printw.c0000644000004100000410000000542214201713275021365 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** printw ------ ### Synopsis int printw(const char *fmt, ...); int wprintw(WINDOW *win, const char *fmt, ...); int mvprintw(int y, int x, const char *fmt, ...); int mvwprintw(WINDOW *win, int y, int x, const char *fmt,...); int vwprintw(WINDOW *win, const char *fmt, va_list varglist); int vw_printw(WINDOW *win, const char *fmt, va_list varglist); ### Description The printw() functions add a formatted string to the window at the current or specified cursor position. The format strings are the same as used in the standard C library's printf(). (printw() can be used as a drop-in replacement for printf().) ### Return Value All functions return the number of characters printed, or ERR on error. ### Portability X/Open BSD SYS V printw Y Y Y wprintw Y Y Y mvprintw Y Y Y mvwprintw Y Y Y vwprintw Y - 4.0 vw_printw Y **man-end****************************************************************/ #include int vwprintw(WINDOW *win, const char *fmt, va_list varglist) { char printbuf[513]; int len; PDC_LOG(("vwprintw() - called\n")); #ifdef HAVE_VSNPRINTF len = vsnprintf(printbuf, 512, fmt, varglist); #else len = vsprintf(printbuf, fmt, varglist); #endif return (waddstr(win, printbuf) == ERR) ? ERR : len; } int printw(const char *fmt, ...) { va_list args; int retval; PDC_LOG(("printw() - called\n")); va_start(args, fmt); retval = vwprintw(stdscr, fmt, args); va_end(args); return retval; } int wprintw(WINDOW *win, const char *fmt, ...) { va_list args; int retval; PDC_LOG(("wprintw() - called\n")); va_start(args, fmt); retval = vwprintw(win, fmt, args); va_end(args); return retval; } int mvprintw(int y, int x, const char *fmt, ...) { va_list args; int retval; PDC_LOG(("mvprintw() - called\n")); if (move(y, x) == ERR) return ERR; va_start(args, fmt); retval = vwprintw(stdscr, fmt, args); va_end(args); return retval; } int mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...) { va_list args; int retval; PDC_LOG(("mvwprintw() - called\n")); if (wmove(win, y, x) == ERR) return ERR; va_start(args, fmt); retval = vwprintw(win, fmt, args); va_end(args); return retval; } int vw_printw(WINDOW *win, const char *fmt, va_list varglist) { PDC_LOG(("vw_printw() - called\n")); return vwprintw(win, fmt, varglist); } curses-1.4.4/vendor/PDCurses/pdcurses/termattr.c0000644000004100000410000001002314201713275021675 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** termattr -------- ### Synopsis int baudrate(void); char erasechar(void); bool has_ic(void); bool has_il(void); char killchar(void); char *longname(void); chtype termattrs(void); attr_t term_attrs(void); char *termname(void); int erasewchar(wchar_t *ch); int killwchar(wchar_t *ch); char wordchar(void); ### Description baudrate() is supposed to return the output speed of the terminal. In PDCurses, it simply returns INT_MAX. has_ic and has_il() return TRUE. These functions have meaning in some other implementations of curses. erasechar() and killchar() return ^H and ^U, respectively -- the ERASE and KILL characters. In other curses implementations, these may vary by terminal type. erasewchar() and killwchar() are the wide-character versions; they take a pointer to a location in which to store the character, and return OK or ERR. longname() returns a pointer to a static area containing a verbose description of the current terminal. The maximum length of the string is 128 characters. It is defined only after the call to initscr() or newterm(). termname() returns a pointer to a static area containing a short description of the current terminal (14 characters). termattrs() returns a logical OR of all video attributes supported by the terminal. wordchar() is a PDCurses extension of the concept behind the functions erasechar() and killchar(), returning the "delete word" character, ^W. ### Portability X/Open BSD SYS V baudrate Y Y Y erasechar Y Y Y has_ic Y Y Y has_il Y Y Y killchar Y Y Y longname Y Y Y termattrs Y Y Y termname Y Y Y erasewchar Y killwchar Y term_attrs Y wordchar - - - **man-end****************************************************************/ #include #include int baudrate(void) { PDC_LOG(("baudrate() - called\n")); return INT_MAX; } char erasechar(void) { PDC_LOG(("erasechar() - called\n")); return _ECHAR; /* character delete char (^H) */ } bool has_ic(void) { PDC_LOG(("has_ic() - called\n")); return TRUE; } bool has_il(void) { PDC_LOG(("has_il() - called\n")); return TRUE; } char killchar(void) { PDC_LOG(("killchar() - called\n")); return _DLCHAR; /* line delete char (^U) */ } char *longname(void) { PDC_LOG(("longname() - called\n")); sprintf(ttytype, "pdcurses|PDCurses for %s", PDC_sysname()); return ttytype + 9; /* skip "pdcurses|" */ } chtype termattrs(void) { chtype temp = A_BLINK | A_BOLD | A_INVIS | A_REVERSE | A_UNDERLINE | A_LEFTLINE | A_RIGHTLINE | A_ITALIC; /* note: blink is bold background on some platforms */ PDC_LOG(("termattrs() - called\n")); if (!SP->mono) temp |= A_COLOR; return temp; } attr_t term_attrs(void) { PDC_LOG(("term_attrs() - called\n")); return WA_BLINK | WA_BOLD | WA_INVIS | WA_LEFT | WA_REVERSE | WA_RIGHT | WA_UNDERLINE; } char *termname(void) { static char _termname[14] = "pdcurses"; PDC_LOG(("termname() - called\n")); return _termname; } char wordchar(void) { PDC_LOG(("wordchar() - called\n")); return _DWCHAR; /* word delete char */ } #ifdef PDC_WIDE int erasewchar(wchar_t *ch) { PDC_LOG(("erasewchar() - called\n")); if (!ch) return ERR; *ch = (wchar_t)_ECHAR; return OK; } int killwchar(wchar_t *ch) { PDC_LOG(("killwchar() - called\n")); if (!ch) return ERR; *ch = (wchar_t)_DLCHAR; return OK; } #endif curses-1.4.4/vendor/PDCurses/pdcurses/inchstr.c0000644000004100000410000001207614201713275021517 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** inchstr ------- ### Synopsis int inchstr(chtype *ch); int inchnstr(chtype *ch, int n); int winchstr(WINDOW *win, chtype *ch); int winchnstr(WINDOW *win, chtype *ch, int n); int mvinchstr(int y, int x, chtype *ch); int mvinchnstr(int y, int x, chtype *ch, int n); int mvwinchstr(WINDOW *, int y, int x, chtype *ch); int mvwinchnstr(WINDOW *, int y, int x, chtype *ch, int n); int in_wchstr(cchar_t *wch); int in_wchnstr(cchar_t *wch, int n); int win_wchstr(WINDOW *win, cchar_t *wch); int win_wchnstr(WINDOW *win, cchar_t *wch, int n); int mvin_wchstr(int y, int x, cchar_t *wch); int mvin_wchnstr(int y, int x, cchar_t *wch, int n); int mvwin_wchstr(WINDOW *win, int y, int x, cchar_t *wch); int mvwin_wchnstr(WINDOW *win, int y, int x, cchar_t *wch, int n); ### Description These routines read a chtype or cchar_t string from the window, starting at the current or specified position, and ending at the right margin, or after n elements, whichever is less. ### Return Value All functions return the number of elements read, or ERR on error. ### Portability X/Open BSD SYS V inchstr Y - 4.0 winchstr Y - 4.0 mvinchstr Y - 4.0 mvwinchstr Y - 4.0 inchnstr Y - 4.0 winchnstr Y - 4.0 mvinchnstr Y - 4.0 mvwinchnstr Y - 4.0 in_wchstr Y win_wchstr Y mvin_wchstr Y mvwin_wchstr Y in_wchnstr Y win_wchnstr Y mvin_wchnstr Y mvwin_wchnstr Y **man-end****************************************************************/ int winchnstr(WINDOW *win, chtype *ch, int n) { chtype *src; int i; PDC_LOG(("winchnstr() - called\n")); if (!win || !ch || n < 0) return ERR; if ((win->_curx + n) > win->_maxx) n = win->_maxx - win->_curx; src = win->_y[win->_cury] + win->_curx; for (i = 0; i < n; i++) *ch++ = *src++; *ch = (chtype)0; return OK; } int inchstr(chtype *ch) { PDC_LOG(("inchstr() - called\n")); return winchnstr(stdscr, ch, stdscr->_maxx - stdscr->_curx); } int winchstr(WINDOW *win, chtype *ch) { PDC_LOG(("winchstr() - called\n")); return winchnstr(win, ch, win->_maxx - win->_curx); } int mvinchstr(int y, int x, chtype *ch) { PDC_LOG(("mvinchstr() - called: y %d x %d\n", y, x)); if (move(y, x) == ERR) return ERR; return winchnstr(stdscr, ch, stdscr->_maxx - stdscr->_curx); } int mvwinchstr(WINDOW *win, int y, int x, chtype *ch) { PDC_LOG(("mvwinchstr() - called:\n")); if (wmove(win, y, x) == ERR) return ERR; return winchnstr(win, ch, win->_maxx - win->_curx); } int inchnstr(chtype *ch, int n) { PDC_LOG(("inchnstr() - called\n")); return winchnstr(stdscr, ch, n); } int mvinchnstr(int y, int x, chtype *ch, int n) { PDC_LOG(("mvinchnstr() - called: y %d x %d n %d\n", y, x, n)); if (move(y, x) == ERR) return ERR; return winchnstr(stdscr, ch, n); } int mvwinchnstr(WINDOW *win, int y, int x, chtype *ch, int n) { PDC_LOG(("mvwinchnstr() - called: y %d x %d n %d \n", y, x, n)); if (wmove(win, y, x) == ERR) return ERR; return winchnstr(win, ch, n); } #ifdef PDC_WIDE int win_wchnstr(WINDOW *win, cchar_t *wch, int n) { PDC_LOG(("win_wchnstr() - called\n")); return winchnstr(win, wch, n); } int in_wchstr(cchar_t *wch) { PDC_LOG(("in_wchstr() - called\n")); return win_wchnstr(stdscr, wch, stdscr->_maxx - stdscr->_curx); } int win_wchstr(WINDOW *win, cchar_t *wch) { PDC_LOG(("win_wchstr() - called\n")); return win_wchnstr(win, wch, win->_maxx - win->_curx); } int mvin_wchstr(int y, int x, cchar_t *wch) { PDC_LOG(("mvin_wchstr() - called: y %d x %d\n", y, x)); if (move(y, x) == ERR) return ERR; return win_wchnstr(stdscr, wch, stdscr->_maxx - stdscr->_curx); } int mvwin_wchstr(WINDOW *win, int y, int x, cchar_t *wch) { PDC_LOG(("mvwin_wchstr() - called:\n")); if (wmove(win, y, x) == ERR) return ERR; return win_wchnstr(win, wch, win->_maxx - win->_curx); } int in_wchnstr(cchar_t *wch, int n) { PDC_LOG(("in_wchnstr() - called\n")); return win_wchnstr(stdscr, wch, n); } int mvin_wchnstr(int y, int x, cchar_t *wch, int n) { PDC_LOG(("mvin_wchnstr() - called: y %d x %d n %d\n", y, x, n)); if (move(y, x) == ERR) return ERR; return win_wchnstr(stdscr, wch, n); } int mvwin_wchnstr(WINDOW *win, int y, int x, cchar_t *wch, int n) { PDC_LOG(("mvwinchnstr() - called: y %d x %d n %d \n", y, x, n)); if (wmove(win, y, x) == ERR) return ERR; return win_wchnstr(win, wch, n); } #endif curses-1.4.4/vendor/PDCurses/pdcurses/slk.c0000644000004100000410000003162414201713275020636 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** slk --- ### Synopsis int slk_init(int fmt); int slk_set(int labnum, const char *label, int justify); int slk_refresh(void); int slk_noutrefresh(void); char *slk_label(int labnum); int slk_clear(void); int slk_restore(void); int slk_touch(void); int slk_attron(const chtype attrs); int slk_attr_on(const attr_t attrs, void *opts); int slk_attrset(const chtype attrs); int slk_attr_set(const attr_t attrs, short color_pair, void *opts); int slk_attroff(const chtype attrs); int slk_attr_off(const attr_t attrs, void *opts); int slk_color(short color_pair); int slk_wset(int labnum, const wchar_t *label, int justify); int PDC_mouse_in_slk(int y, int x); void PDC_slk_free(void); void PDC_slk_initialize(void); wchar_t *slk_wlabel(int labnum) ### Description These functions manipulate a window that contain Soft Label Keys (SLK). To use the SLK functions, a call to slk_init() must be made BEFORE initscr() or newterm(). slk_init() removes 1 or 2 lines from the useable screen, depending on the format selected. The line(s) removed from the screen are used as a separate window, in which SLKs are displayed. slk_init() requires a single parameter which describes the format of the SLKs as follows: 0 3-2-3 format 1 4-4 format 2 4-4-4 format (ncurses extension) 3 4-4-4 format with index line (ncurses extension) 2 lines used 55 5-5 format (pdcurses format) In PDCurses, one can alternatively set fmt as a series of hex digits specifying the format. For example, 0x414 would result in 4-1-4 format; 0x21b3 would result in 2-1-11-3 format; and so on. Also, negating fmt results in the index line being added. Also, in PDCurses, one can call slk_init() at any time _after_ initscr(), to reset the label format. If you do this, you'll need to reset the label text and call slk_refresh(). And you can't toggle the index line. (Doing so would add/remove a line from the useable screen, which would be hard to handle correctly.) slk_refresh(), slk_noutrefresh() and slk_touch() are analogous to refresh(), noutrefresh() and touch(). ### Return Value All functions return OK on success and ERR on error. ### Portability X/Open BSD SYS V slk_init Y - Y slk_set Y - Y slk_refresh Y - Y slk_noutrefresh Y - Y slk_label Y - Y slk_clear Y - Y slk_restore Y - Y slk_touch Y - Y slk_attron Y - Y slk_attrset Y - Y slk_attroff Y - Y slk_attr_on Y slk_attr_set Y slk_attr_off Y slk_wset Y PDC_mouse_in_slk - - - PDC_slk_free - - - PDC_slk_initialize - - - slk_wlabel - - - **man-end****************************************************************/ #include static int label_length = 0; static int n_labels = 0; static int label_fmt = 0; static int label_line = 0; static bool hidden = FALSE; #define MAX_LABEL_LENGTH 32 static struct SLK { chtype label[MAX_LABEL_LENGTH]; int len; int format; int start_col; } *slk = (struct SLK *)NULL; /* See comments above on this function. */ int slk_init(int fmt) { int i; PDC_LOG(("slk_init() - called\n")); switch (fmt) { case 0: /* 3 - 2 - 3 */ label_fmt = 0x323; break; case 1: /* 4 - 4 */ label_fmt = 0x44; break; case 2: /* 4 4 4 */ label_fmt = 0x444; break; case 3: /* 4 4 4 with index */ label_fmt = -0x444; break; case 55: /* 5 - 5 */ label_fmt = 0x55; break; default: label_fmt = fmt; break; } n_labels = 0; for( i = abs( label_fmt); i; i /= 16) n_labels += i % 16; PDC_LOG(("slk_init: fmt %d, %d labels, %p\n", fmt, n_labels, slk)); if( slk) free( slk); slk = calloc(n_labels, sizeof(struct SLK)); PDC_LOG(( "New slk: %p; SP = %p\n", slk, SP)); if (!slk) n_labels = 0; if( SP) { if( SP->slk_winptr) wclear( SP->slk_winptr); PDC_slk_initialize( ); } return slk ? OK : ERR; } /* draw a single button */ static void _drawone(int num) { int i, col, slen; if (hidden) return; slen = slk[num].len; switch (slk[num].format) { case 0: /* LEFT */ col = 0; break; case 1: /* CENTER */ col = (label_length - slen) / 2; if (col + slen > label_length) --col; break; default: /* RIGHT */ col = label_length - slen; } if( col < 0) /* Ensure start of label is visible */ col = 0; wmove(SP->slk_winptr, label_line, slk[num].start_col); for (i = 0; i < label_length; ++i) waddch(SP->slk_winptr, (i >= col && i < (col + slen)) ? slk[num].label[i - col] : ' '); } /* redraw each button */ static void _redraw(void) { int i; if( !hidden) { for (i = 0; i < n_labels; ++i) _drawone(i); if (label_fmt < 0) { const chtype save_attr = SP->slk_winptr->_attrs; wattrset(SP->slk_winptr, A_NORMAL); wmove(SP->slk_winptr, 0, 0); whline(SP->slk_winptr, 0, COLS); for (i = 0; i < n_labels; i++) mvwprintw(SP->slk_winptr, 0, slk[i].start_col, "F%d", i + 1); SP->slk_winptr->_attrs = save_attr; } } } /* slk_set() Used to set a slk label to a string. labnum = 1 - 8 (or 10) (number of the label) label = string (8 or 7 bytes total), or NULL justify = 0 : left, 1 : center, 2 : right */ int slk_set(int labnum, const char *label, int justify) { #ifdef PDC_WIDE wchar_t wlabel[MAX_LABEL_LENGTH]; PDC_mbstowcs(wlabel, label, MAX_LABEL_LENGTH - 1); return slk_wset(labnum, wlabel, justify); #else PDC_LOG(("slk_set() - called\n")); if (labnum < 1 || labnum > n_labels || justify < 0 || justify > 2) return ERR; labnum--; if (!label || !(*label)) { /* Clear the label */ *slk[labnum].label = 0; slk[labnum].format = 0; slk[labnum].len = 0; } else { int i; /* Skip leading spaces */ while( *label == ' ') label++; /* Copy it */ for (i = 0; label[i] && i < MAX_LABEL_LENGTH - 1; i++) slk[labnum].label[i] = label[i]; /* Drop trailing spaces */ while( i && label[i - 1] == ' ') i--; slk[labnum].label[i] = 0; slk[labnum].format = justify; slk[labnum].len = i; } _drawone(labnum); return OK; #endif } int slk_refresh(void) { PDC_LOG(("slk_refresh() - called\n")); return (slk_noutrefresh() == ERR) ? ERR : doupdate(); } int slk_noutrefresh(void) { PDC_LOG(("slk_noutrefresh() - called\n")); return wnoutrefresh(SP->slk_winptr); } char *slk_label(int labnum) { static char temp[MAX_LABEL_LENGTH + 1]; #ifdef PDC_WIDE wchar_t *wtemp = slk_wlabel(labnum); PDC_wcstombs(temp, wtemp, MAX_LABEL_LENGTH); #else chtype *p; int i; PDC_LOG(("slk_label() - called\n")); if (labnum < 1 || labnum > n_labels) return (char *)0; for (i = 0, p = slk[labnum - 1].label; *p; i++) temp[i] = (char)*p++; /* BJG */ temp[i] = '\0'; #endif return temp; } int slk_clear(void) { PDC_LOG(("slk_clear() - called\n")); hidden = TRUE; werase(SP->slk_winptr); return wrefresh(SP->slk_winptr); } int slk_restore(void) { PDC_LOG(("slk_restore() - called\n")); hidden = FALSE; _redraw(); return wrefresh(SP->slk_winptr); } int slk_touch(void) { PDC_LOG(("slk_touch() - called\n")); return touchwin(SP->slk_winptr); } int slk_attron(const chtype attrs) { int rc; PDC_LOG(("slk_attron() - called\n")); rc = wattron(SP->slk_winptr, attrs); _redraw(); return rc; } int slk_attr_on(const attr_t attrs, void *opts) { PDC_LOG(("slk_attr_on() - called\n")); return slk_attron(attrs); } int slk_attroff(const chtype attrs) { int rc; PDC_LOG(("slk_attroff() - called\n")); rc = wattroff(SP->slk_winptr, attrs); _redraw(); return rc; } int slk_attr_off(const attr_t attrs, void *opts) { PDC_LOG(("slk_attr_off() - called\n")); return slk_attroff(attrs); } int slk_attrset(const chtype attrs) { int rc; PDC_LOG(("slk_attrset() - called\n")); rc = wattrset(SP->slk_winptr, attrs); _redraw(); return rc; } int slk_color(short color_pair) { int rc; PDC_LOG(("slk_color() - called\n")); rc = wcolor_set(SP->slk_winptr, color_pair, NULL); _redraw(); return rc; } int slk_attr_set(const attr_t attrs, short color_pair, void *opts) { PDC_LOG(("slk_attr_set() - called\n")); return slk_attrset(attrs | COLOR_PAIR(color_pair)); } static void _slk_calc(void) { int i, j, idx, remaining_space; int n_groups = 0, group_size[10]; label_length = COLS / n_labels; if (label_length > MAX_LABEL_LENGTH) label_length = MAX_LABEL_LENGTH; remaining_space = COLS - label_length * n_labels + 1; for( i = abs( label_fmt); i; i /= 16) group_size[n_groups++] = i % 16; /* We really want at least two spaces between groups: */ while( label_length > 1 && remaining_space < n_groups - 1) { label_length--; remaining_space += n_labels; } for( i = idx = 0; i < n_groups; i++) for( j = 0; j < group_size[i]; j++, idx++) slk[idx].start_col = label_length * idx + (i ? (i * remaining_space) / (n_groups - 1) : 0); if( label_length) --label_length; /* make sure labels are all in window */ _redraw(); } void PDC_slk_initialize(void) { if (slk) { if( label_fmt < 0) { SP->slklines = 2; label_line = 1; } else SP->slklines = 1; if (!SP->slk_winptr) { if ( !(SP->slk_winptr = newwin(SP->slklines, COLS, LINES - SP->slklines, 0)) ) return; wattrset(SP->slk_winptr, A_REVERSE); } _slk_calc(); touchwin(SP->slk_winptr); } } void PDC_slk_free(void) { if (slk) { if (SP->slk_winptr) { delwin(SP->slk_winptr); SP->slk_winptr = (WINDOW *)NULL; } free(slk); slk = (struct SLK *)NULL; label_length = 0; n_labels = 0; label_fmt = 0; label_line = 0; hidden = FALSE; } } int PDC_mouse_in_slk(int y, int x) { int i; PDC_LOG(("PDC_mouse_in_slk() - called: y->%d x->%d\n", y, x)); /* If the line on which the mouse was clicked is NOT the last line of the screen, or the SLKs are hidden, we are not interested in it. */ if (!slk || hidden || !SP->slk_winptr || (y != SP->slk_winptr->_begy + label_line)) return 0; for (i = 0; i < n_labels; i++) if (x >= slk[i].start_col && x < (slk[i].start_col + label_length)) return i + 1; return 0; } #ifdef PDC_WIDE int slk_wset(int labnum, const wchar_t *label, int justify) { PDC_LOG(("slk_wset() - called\n")); if (labnum < 1 || labnum > n_labels || justify < 0 || justify > 2) return ERR; labnum--; if (!label || !(*label)) { /* Clear the label */ *slk[labnum].label = 0; slk[labnum].format = 0; slk[labnum].len = 0; } else { int i; /* Skip leading spaces */ while( *label == L' ') label++; /* Copy it */ for (i = 0; label[i] && i < MAX_LABEL_LENGTH - 1; i++) slk[labnum].label[i] = label[i]; /* Drop trailing spaces */ while( i && label[i - 1] == L' ') i--; slk[labnum].label[i] = 0; slk[labnum].format = justify; slk[labnum].len = i; } _drawone(labnum); return OK; } wchar_t *slk_wlabel(int labnum) { static wchar_t temp[MAX_LABEL_LENGTH + 1]; chtype *p; int i; PDC_LOG(("slk_wlabel() - called\n")); if (labnum < 1 || labnum > n_labels) return (wchar_t *)0; for (i = 0, p = slk[labnum - 1].label; *p; i++) temp[i] = (wchar_t)*p++; temp[i] = '\0'; return temp; } #endif curses-1.4.4/vendor/PDCurses/pdcurses/refresh.c0000644000004100000410000001642514201713275021505 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** refresh ------- ### Synopsis int refresh(void); int wrefresh(WINDOW *win); int wnoutrefresh(WINDOW *win); int doupdate(void); int redrawwin(WINDOW *win); int wredrawln(WINDOW *win, int beg_line, int num_lines); ### Description wrefresh() copies the named window to the physical terminal screen, taking into account what is already there in order to optimize cursor movement. refresh() does the same, using stdscr. These routines must be called to get any output on the terminal, as other routines only manipulate data structures. Unless leaveok() has been enabled, the physical cursor of the terminal is left at the location of the window's cursor. wnoutrefresh() and doupdate() allow multiple updates with more efficiency than wrefresh() alone. wrefresh() works by first calling wnoutrefresh(), which copies the named window to the virtual screen. It then calls doupdate(), which compares the virtual screen to the physical screen and does the actual update. A series of calls to wrefresh() will result in alternating calls to wnoutrefresh() and doupdate(), causing several bursts of output to the screen. By first calling wnoutrefresh() for each window, it is then possible to call doupdate() only once. In PDCurses, redrawwin() is equivalent to touchwin(), and wredrawln() is the same as touchline(). In some other curses implementations, there's a subtle distinction, but it has no meaning in PDCurses. ### Return Value All functions return OK on success and ERR on error. ### Portability X/Open BSD SYS V refresh Y Y Y wrefresh Y Y Y wnoutrefresh Y Y Y doupdate Y Y Y redrawwin Y - 4.0 wredrawln Y - 4.0 **man-end****************************************************************/ #include int wnoutrefresh(WINDOW *win) { int begy, begx; /* window's place on screen */ int i, j; PDC_LOG(("wnoutrefresh() - called: win=%p\n", win)); if ( !win || (win->_flags & (_PAD|_SUBPAD)) ) return ERR; begy = win->_begy; begx = win->_begx; for (i = 0, j = begy; i < win->_maxy; i++, j++) { if (win->_firstch[i] != _NO_CHANGE) { chtype *src = win->_y[i]; chtype *dest = curscr->_y[j] + begx; int first = win->_firstch[i]; /* first changed */ int last = win->_lastch[i]; /* last changed */ /* ignore areas on the outside that are marked as changed, but really aren't */ while (first <= last && src[first] == dest[first]) first++; while (last >= first && src[last] == dest[last]) last--; /* if any have really changed... */ if (first <= last) { memcpy(dest + first, src + first, (last - first + 1) * sizeof(chtype)); first += begx; last += begx; if (first < curscr->_firstch[j] || curscr->_firstch[j] == _NO_CHANGE) curscr->_firstch[j] = first; if (last > curscr->_lastch[j]) curscr->_lastch[j] = last; } win->_firstch[i] = _NO_CHANGE; /* updated now */ } win->_lastch[i] = _NO_CHANGE; /* updated now */ } if (win->_clear) win->_clear = FALSE; if (!win->_leaveit) { curscr->_cury = win->_cury + begy; curscr->_curx = win->_curx + begx; } return OK; } int doupdate(void) { int y; bool clearall; PDC_LOG(("doupdate() - called\n")); if (!curscr) return ERR; if (isendwin()) /* coming back after endwin() called */ { reset_prog_mode(); clearall = TRUE; SP->alive = TRUE; /* so isendwin() result is correct */ } else clearall = curscr->_clear; for (y = 0; y < SP->lines; y++) { PDC_LOG(("doupdate() - Transforming line %d of %d: %s\n", y, SP->lines, (curscr->_firstch[y] != _NO_CHANGE) ? "Yes" : "No")); if (clearall || curscr->_firstch[y] != _NO_CHANGE) { int first, last; chtype *src = curscr->_y[y]; chtype *dest = pdc_lastscr->_y[y]; if (clearall) { first = 0; last = COLS - 1; } else { first = curscr->_firstch[y]; last = curscr->_lastch[y]; } while (first <= last) { int len = 0; /* build up a run of changed cells; if two runs are separated by a single unchanged cell, ignore the break */ if (clearall) len = last - first + 1; else while (first + len <= last && (src[first + len] != dest[first + len] || (len && first + len < last && src[first + len + 1] != dest[first + len + 1]) ) ) len++; /* update the screen, and pdc_lastscr */ if (len) { PDC_transform_line(y, first, len, src + first); memcpy(dest + first, src + first, len * sizeof(chtype)); first += len; } /* skip over runs of unchanged cells */ while (first <= last && src[first] == dest[first]) first++; } curscr->_firstch[y] = _NO_CHANGE; curscr->_lastch[y] = _NO_CHANGE; } } curscr->_clear = FALSE; if (SP->visibility) PDC_gotoyx(curscr->_cury, curscr->_curx); SP->cursrow = curscr->_cury; SP->curscol = curscr->_curx; return OK; } int wrefresh(WINDOW *win) { bool save_clear; PDC_LOG(("wrefresh() - called\n")); if ( !win || (win->_flags & (_PAD|_SUBPAD)) ) return ERR; save_clear = win->_clear; if (win == curscr) curscr->_clear = TRUE; else wnoutrefresh(win); if (save_clear && win->_maxy == SP->lines && win->_maxx == SP->cols) curscr->_clear = TRUE; return doupdate(); } int refresh(void) { PDC_LOG(("refresh() - called\n")); return wrefresh(stdscr); } int wredrawln(WINDOW *win, int start, int num) { int i; PDC_LOG(("wredrawln() - called: win=%p start=%d num=%d\n", win, start, num)); if (!win || start > win->_maxy || start + num > win->_maxy) return ERR; for (i = start; i < start + num; i++) { win->_firstch[i] = 0; win->_lastch[i] = win->_maxx - 1; } return OK; } int redrawwin(WINDOW *win) { PDC_LOG(("redrawwin() - called: win=%p\n", win)); if (!win) return ERR; return wredrawln(win, 0, win->_maxy); } curses-1.4.4/vendor/PDCurses/pdcurses/window.c0000644000004100000410000003560014201713275021352 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** window ------ ### Synopsis WINDOW *newwin(int nlines, int ncols, int begy, int begx); WINDOW *derwin(WINDOW* orig, int nlines, int ncols, int begy, int begx); WINDOW *subwin(WINDOW* orig, int nlines, int ncols, int begy, int begx); WINDOW *dupwin(WINDOW *win); int delwin(WINDOW *win); int mvwin(WINDOW *win, int y, int x); int mvderwin(WINDOW *win, int pary, int parx); int syncok(WINDOW *win, bool bf); void wsyncup(WINDOW *win); void wcursyncup(WINDOW *win); void wsyncdown(WINDOW *win); WINDOW *resize_window(WINDOW *win, int nlines, int ncols); int wresize(WINDOW *win, int nlines, int ncols); WINDOW *PDC_makelines(WINDOW *win); WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx); void PDC_sync(WINDOW *win); ### Description newwin() creates a new window with the given number of lines, nlines and columns, ncols. The upper left corner of the window is at line begy, column begx. If nlines is zero, it defaults to LINES - begy; ncols to COLS - begx. Create a new full-screen window by calling newwin(0, 0, 0, 0). delwin() deletes the named window, freeing all associated memory. In the case of overlapping windows, subwindows should be deleted before the main window. mvwin() moves the window so that the upper left-hand corner is at position (y,x). If the move would cause the window to be off the screen, it is an error and the window is not moved. Moving subwindows is allowed. subwin() creates a new subwindow within a window. The dimensions of the subwindow are nlines lines and ncols columns. The subwindow is at position (begy, begx) on the screen. This position is relative to the screen, and not to the window orig. Changes made to either window will affect both. When using this routine, you will often need to call touchwin() before calling wrefresh(). derwin() is the same as subwin(), except that begy and begx are relative to the origin of the window orig rather than the screen. There is no difference between subwindows and derived windows. mvderwin() moves a derived window (or subwindow) inside its parent window. The screen-relative parameters of the window are not changed. This routine is used to display different parts of the parent window at the same physical position on the screen. dupwin() creates an exact duplicate of the window win. wsyncup() causes a touchwin() of all of the window's parents. If wsyncok() is called with a second argument of TRUE, this causes a wsyncup() to be called every time the window is changed. wcursyncup() causes the current cursor position of all of a window's ancestors to reflect the current cursor position of the current window. wsyncdown() causes a touchwin() of the current window if any of its parent's windows have been touched. resize_window() allows the user to resize an existing window. It returns the pointer to the new window, or NULL on failure. wresize() is an ncurses-compatible wrapper for resize_window(). Note that, unlike ncurses, it will NOT process any subwindows of the window. (However, you still can call it _on_ subwindows.) It returns OK or ERR. PDC_makenew() allocates all data for a new WINDOW * except the actual lines themselves. If it's unable to allocate memory for the window structure, it will free all allocated memory and return a NULL pointer. PDC_makelines() allocates the memory for the lines. PDC_sync() handles wrefresh() and wsyncup() calls when a window is changed. ### Return Value newwin(), subwin(), derwin() and dupwin() return a pointer to the new window, or NULL on failure. delwin(), mvwin(), mvderwin() and syncok() return OK or ERR. wsyncup(), wcursyncup() and wsyncdown() return nothing. ### Errors It is an error to call resize_window() before calling initscr(). Also, an error will be generated if we fail to create a newly sized replacement window for curscr, or stdscr. This could happen when increasing the window size. NOTE: If this happens, the previously successfully allocated windows are left alone; i.e., the resize is NOT cancelled for those windows. ### Portability X/Open BSD SYS V newwin Y Y Y delwin Y Y Y mvwin Y Y Y subwin Y Y Y derwin Y - Y mvderwin Y - Y dupwin Y - 4.0 wsyncup Y - 4.0 syncok Y - 4.0 wcursyncup Y - 4.0 wsyncdown Y - 4.0 resize_window - - - wresize - - - PDC_makelines - - - PDC_makenew - - - PDC_sync - - - **man-end****************************************************************/ #include WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx) { WINDOW *win; PDC_LOG(("PDC_makenew() - called: lines %d cols %d begy %d begx %d\n", nlines, ncols, begy, begx)); /* allocate the window structure itself */ if ((win = calloc(1, sizeof(WINDOW))) == (WINDOW *)NULL) return win; /* allocate the line pointer array */ if ((win->_y = malloc(nlines * sizeof(chtype *))) == NULL) { free(win); return (WINDOW *)NULL; } /* allocate the minchng and maxchng arrays */ if ((win->_firstch = malloc(nlines * sizeof(int))) == NULL) { free(win->_y); free(win); return (WINDOW *)NULL; } if ((win->_lastch = malloc(nlines * sizeof(int))) == NULL) { free(win->_firstch); free(win->_y); free(win); return (WINDOW *)NULL; } /* initialize window variables */ win->_maxy = nlines; /* real max screen size */ win->_maxx = ncols; /* real max screen size */ win->_begy = begy; win->_begx = begx; win->_bkgd = ' '; /* wrs 4/10/93 -- initialize background to blank */ win->_clear = (bool) ((nlines == LINES) && (ncols == COLS)); win->_bmarg = nlines - 1; win->_parx = win->_pary = -1; /* init to say window all changed */ touchwin(win); return win; } WINDOW *PDC_makelines(WINDOW *win) { int i, j, nlines, ncols; PDC_LOG(("PDC_makelines() - called\n")); if (!win) return (WINDOW *)NULL; nlines = win->_maxy; ncols = win->_maxx; for (i = 0; i < nlines; i++) { if ((win->_y[i] = malloc(ncols * sizeof(chtype))) == NULL) { /* if error, free all the data */ for (j = 0; j < i; j++) free(win->_y[j]); free(win->_firstch); free(win->_lastch); free(win->_y); free(win); return (WINDOW *)NULL; } } return win; } void PDC_sync(WINDOW *win) { PDC_LOG(("PDC_sync() - called:\n")); if (win->_immed) wrefresh(win); if (win->_sync) wsyncup(win); } WINDOW *newwin(int nlines, int ncols, int begy, int begx) { WINDOW *win; PDC_LOG(("newwin() - called:lines=%d cols=%d begy=%d begx=%d\n", nlines, ncols, begy, begx)); if (!nlines) nlines = LINES - begy; if (!ncols) ncols = COLS - begx; if ( (begy + nlines > SP->lines || begx + ncols > SP->cols) || !(win = PDC_makenew(nlines, ncols, begy, begx)) || !(win = PDC_makelines(win)) ) return (WINDOW *)NULL; werase(win); return win; } int delwin(WINDOW *win) { int i; PDC_LOG(("delwin() - called\n")); if (!win) return ERR; /* subwindows use parents' lines */ if (!(win->_flags & (_SUBWIN|_SUBPAD))) for (i = 0; i < win->_maxy && win->_y[i]; i++) if (win->_y[i]) free(win->_y[i]); free(win->_firstch); free(win->_lastch); free(win->_y); free(win); return OK; } int mvwin(WINDOW *win, int y, int x) { PDC_LOG(("mvwin() - called\n")); if (!win || (y + win->_maxy > LINES || y < 0) || (x + win->_maxx > COLS || x < 0)) return ERR; win->_begy = y; win->_begx = x; touchwin(win); return OK; } WINDOW *subwin(WINDOW *orig, int nlines, int ncols, int begy, int begx) { WINDOW *win; int i; int j = begy - orig->_begy; int k = begx - orig->_begx; PDC_LOG(("subwin() - called: lines %d cols %d begy %d begx %d\n", nlines, ncols, begy, begx)); /* make sure window fits inside the original one */ if (!orig || (begy < orig->_begy) || (begx < orig->_begx) || (begy + nlines) > (orig->_begy + orig->_maxy) || (begx + ncols) > (orig->_begx + orig->_maxx)) return (WINDOW *)NULL; if (!nlines) nlines = orig->_maxy - 1 - j; if (!ncols) ncols = orig->_maxx - 1 - k; if ( !(win = PDC_makenew(nlines, ncols, begy, begx)) ) return (WINDOW *)NULL; /* initialize window variables */ win->_attrs = orig->_attrs; win->_bkgd = orig->_bkgd; win->_leaveit = orig->_leaveit; win->_scroll = orig->_scroll; win->_nodelay = orig->_nodelay; win->_delayms = orig->_delayms; win->_use_keypad = orig->_use_keypad; win->_immed = orig->_immed; win->_sync = orig->_sync; win->_pary = j; win->_parx = k; win->_parent = orig; for (i = 0; i < nlines; i++, j++) win->_y[i] = orig->_y[j] + k; win->_flags |= _SUBWIN; return win; } WINDOW *derwin(WINDOW *orig, int nlines, int ncols, int begy, int begx) { return subwin(orig, nlines, ncols, begy + orig->_begy, begx + orig->_begx); } int mvderwin(WINDOW *win, int pary, int parx) { int i, j; WINDOW *mypar; if (!win || !(win->_parent)) return ERR; mypar = win->_parent; if (pary < 0 || parx < 0 || (pary + win->_maxy) > mypar->_maxy || (parx + win->_maxx) > mypar->_maxx) return ERR; j = pary; for (i = 0; i < win->_maxy; i++) win->_y[i] = (mypar->_y[j++]) + parx; win->_pary = pary; win->_parx = parx; return OK; } WINDOW *dupwin(WINDOW *win) { WINDOW *new; chtype *ptr, *ptr1; int nlines, ncols, begy, begx, i; if (!win) return (WINDOW *)NULL; nlines = win->_maxy; ncols = win->_maxx; begy = win->_begy; begx = win->_begx; if ( !(new = PDC_makenew(nlines, ncols, begy, begx)) || !(new = PDC_makelines(new)) ) return (WINDOW *)NULL; /* copy the contents of win into new */ for (i = 0; i < nlines; i++) { for (ptr = new->_y[i], ptr1 = win->_y[i]; ptr < new->_y[i] + ncols; ptr++, ptr1++) *ptr = *ptr1; new->_firstch[i] = 0; new->_lastch[i] = ncols - 1; } new->_curx = win->_curx; new->_cury = win->_cury; new->_maxy = win->_maxy; new->_maxx = win->_maxx; new->_begy = win->_begy; new->_begx = win->_begx; new->_flags = win->_flags; new->_attrs = win->_attrs; new->_clear = win->_clear; new->_leaveit = win->_leaveit; new->_scroll = win->_scroll; new->_nodelay = win->_nodelay; new->_delayms = win->_delayms; new->_use_keypad = win->_use_keypad; new->_tmarg = win->_tmarg; new->_bmarg = win->_bmarg; new->_parx = win->_parx; new->_pary = win->_pary; new->_parent = win->_parent; new->_bkgd = win->_bkgd; new->_flags = win->_flags; return new; } WINDOW *resize_window(WINDOW *win, int nlines, int ncols) { WINDOW *new; int i, save_cury, save_curx, new_begy, new_begx; PDC_LOG(("resize_window() - called: nlines %d ncols %d\n", nlines, ncols)); if (!win) return (WINDOW *)NULL; if (win->_flags & _SUBPAD) { if ( !(new = subpad(win->_parent, nlines, ncols, win->_begy, win->_begx)) ) return (WINDOW *)NULL; } else if (win->_flags & _SUBWIN) { if ( !(new = subwin(win->_parent, nlines, ncols, win->_begy, win->_begx)) ) return (WINDOW *)NULL; } else { if (win == SP->slk_winptr) { new_begy = SP->lines - SP->slklines; new_begx = 0; } else { new_begy = win->_begy; new_begx = win->_begx; } if ( !(new = PDC_makenew(nlines, ncols, new_begy, new_begx)) ) return (WINDOW *)NULL; } save_curx = min(win->_curx, (new->_maxx - 1)); save_cury = min(win->_cury, (new->_maxy - 1)); if (!(win->_flags & (_SUBPAD|_SUBWIN))) { if ( !(new = PDC_makelines(new)) ) return (WINDOW *)NULL; werase(new); copywin(win, new, 0, 0, 0, 0, min(win->_maxy, new->_maxy) - 1, min(win->_maxx, new->_maxx) - 1, FALSE); for (i = 0; i < win->_maxy && win->_y[i]; i++) if (win->_y[i]) free(win->_y[i]); } new->_flags = win->_flags; new->_attrs = win->_attrs; new->_clear = win->_clear; new->_leaveit = win->_leaveit; new->_scroll = win->_scroll; new->_nodelay = win->_nodelay; new->_delayms = win->_delayms; new->_use_keypad = win->_use_keypad; new->_tmarg = (win->_tmarg > new->_maxy - 1) ? 0 : win->_tmarg; new->_bmarg = (win->_bmarg == win->_maxy - 1) ? new->_maxy - 1 : min(win->_bmarg, (new->_maxy - 1)); new->_parent = win->_parent; new->_immed = win->_immed; new->_sync = win->_sync; new->_bkgd = win->_bkgd; new->_curx = save_curx; new->_cury = save_cury; free(win->_firstch); free(win->_lastch); free(win->_y); *win = *new; free(new); return win; } int wresize(WINDOW *win, int nlines, int ncols) { return (resize_window(win, nlines, ncols) ? OK : ERR); } void wsyncup(WINDOW *win) { WINDOW *tmp; PDC_LOG(("wsyncup() - called\n")); for (tmp = win; tmp; tmp = tmp->_parent) touchwin(tmp); } int syncok(WINDOW *win, bool bf) { PDC_LOG(("syncok() - called\n")); if (!win) return ERR; win->_sync = bf; return OK; } void wcursyncup(WINDOW *win) { WINDOW *tmp; PDC_LOG(("wcursyncup() - called\n")); for (tmp = win; tmp && tmp->_parent; tmp = tmp->_parent) wmove(tmp->_parent, tmp->_pary + tmp->_cury, tmp->_parx + tmp->_curx); } void wsyncdown(WINDOW *win) { WINDOW *tmp; PDC_LOG(("wsyncdown() - called\n")); for (tmp = win; tmp; tmp = tmp->_parent) { if (is_wintouched(tmp)) { touchwin(win); break; } } } curses-1.4.4/vendor/PDCurses/pdcurses/mouse.c0000644000004100000410000003173614201713275021201 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** mouse ----- ### Synopsis int mouse_set(unsigned long mbe); int mouse_on(unsigned long mbe); int mouse_off(unsigned long mbe); int request_mouse_pos(void); int map_button(unsigned long button); void wmouse_position(WINDOW *win, int *y, int *x); unsigned long getmouse(void); unsigned long getbmap(void); int mouseinterval(int wait); bool wenclose(const WINDOW *win, int y, int x); bool wmouse_trafo(const WINDOW *win, int *y, int *x, bool to_screen); bool mouse_trafo(int *y, int *x, bool to_screen); mmask_t mousemask(mmask_t mask, mmask_t *oldmask); int nc_getmouse(MEVENT *event); int ungetmouse(MEVENT *event); ### Description As of PDCurses 3.0, there are two separate mouse interfaces: the classic interface, which is based on the undocumented Sys V mouse functions; and an ncurses-compatible interface. Both are active at all times, and you can mix and match functions from each, though it's not recommended. The ncurses interface is essentially an emulation layer built on top of the classic interface; it's here to allow easier porting of ncurses apps. The classic interface: mouse_set(), mouse_on(), mouse_off(), request_mouse_pos(), map_button(), wmouse_position(), getmouse(), and getbmap(). An application using this interface would start by calling mouse_set() or mouse_on() with a non-zero value, often ALL_MOUSE_EVENTS. Then it would check for a KEY_MOUSE return from getch(). If found, it would call request_mouse_pos() to get the current mouse status. mouse_set(), mouse_on() and mouse_off() are analagous to attrset(), attron() and attroff(). These functions set the mouse button events to trap. The button masks used in these functions are defined in curses.h and can be or'ed together. They are the group of masks starting with BUTTON1_RELEASED. request_mouse_pos() requests curses to fill in the Mouse_status structure with the current state of the mouse. map_button() enables the specified mouse action to activate the Soft Label Keys if the action occurs over the area of the screen where the Soft Label Keys are displayed. The mouse actions are defined in curses.h in the group that starts with BUTTON_RELEASED. wmouse_position() determines if the current mouse position is within the window passed as an argument. If the mouse is outside the current window, -1 is returned in the y and x arguments; otherwise the y and x coordinates of the mouse (relative to the top left corner of the window) are returned in y and x. getmouse() returns the current status of the trapped mouse buttons as set by mouse_set() or mouse_on(). getbmap() returns the current status of the button action used to map a mouse action to the Soft Label Keys as set by the map_button() function. The ncurses interface: mouseinterval(), wenclose(), wmouse_trafo(), mouse_trafo(), mousemask(), nc_getmouse(), and ungetmouse(). A typical application using this interface would start by calling mousemask() with a non-zero value, often ALL_MOUSE_EVENTS. Then it would check for a KEY_MOUSE return from getch(). If found, it would call nc_getmouse() to get the current mouse status. mouseinterval() sets the timeout for a mouse click. On all current platforms, PDCurses receives mouse button press and release events, but must synthesize click events. It does this by checking whether a release event is queued up after a press event. If it gets a press event, and there are no more events waiting, it will wait for the timeout interval, then check again for a release. A press followed by a release is reported as BUTTON_CLICKED; otherwise it's passed through as BUTTON_PRESSED. The default timeout is 150ms; valid values are 0 (no clicks reported) through 1000ms. In x11, the timeout can also be set via the clickPeriod resource. The return value from mouseinterval() is the old timeout. To check the old value without setting a new one, call it with a parameter of -1. Note that although there's no classic equivalent for this function (apart from the clickPeriod resource), the value set applies in both interfaces. wenclose() reports whether the given screen-relative y, x coordinates fall within the given window. wmouse_trafo() converts between screen-relative and window- relative coordinates. A to_screen parameter of TRUE means to convert from window to screen; otherwise the reverse. The function returns FALSE if the coordinates aren't within the window, or if any of the parameters are NULL. The coordinates have been converted when the function returns TRUE. mouse_trafo() is the stdscr version of wmouse_trafo(). mousemask() is nearly equivalent to mouse_set(), but instead of OK/ERR, it returns the value of the mask after setting it. (This isn't necessarily the same value passed in, since the mask could be altered on some platforms.) And if the second parameter is a non-null pointer, mousemask() stores the previous mask value there. Also, since the ncurses interface doesn't work with PDCurses' BUTTON_MOVED events, mousemask() filters them out. nc_getmouse() returns the current mouse status in an MEVENT struct. This is equivalent to ncurses' getmouse(), renamed to avoid conflict with PDCurses' getmouse(). But if you define PDC_NCMOUSE before including curses.h, it defines getmouse() to nc_getmouse(), along with a few other redefintions needed for compatibility with ncurses code. nc_getmouse() calls request_mouse_pos(), which (not getmouse()) is the classic equivalent. ungetmouse() is the mouse equivalent of ungetch(). However, PDCurses doesn't maintain a queue of mouse events; only one can be pushed back, and it can overwrite or be overwritten by real mouse events. ### Portability X/Open BSD SYS V mouse_set - - 4.0 mouse_on - - 4.0 mouse_off - - 4.0 request_mouse_pos - - 4.0 map_button - - 4.0 wmouse_position - - 4.0 getmouse - - 4.0 getbmap - - 4.0 mouseinterval - - - wenclose - - - wmouse_trafo - - - mouse_trafo - - - mousemask - - - nc_getmouse - - - ungetmouse - - - **man-end****************************************************************/ #include static bool ungot = FALSE; int mouse_set(unsigned long mbe) { PDC_LOG(("mouse_set() - called: event %x\n", mbe)); SP->_trap_mbe = mbe; return PDC_mouse_set(); } int mouse_on(unsigned long mbe) { PDC_LOG(("mouse_on() - called: event %x\n", mbe)); SP->_trap_mbe |= mbe; return PDC_mouse_set(); } int mouse_off(unsigned long mbe) { PDC_LOG(("mouse_off() - called: event %x\n", mbe)); SP->_trap_mbe &= ~mbe; return PDC_mouse_set(); } int map_button(unsigned long button) { PDC_LOG(("map_button() - called: button %x\n", button)); /****************** this does nothing at the moment ***************/ SP->_map_mbe_to_key = button; return OK; } int request_mouse_pos(void) { PDC_LOG(("request_mouse_pos() - called\n")); Mouse_status = pdc_mouse_status; return OK; } void wmouse_position(WINDOW *win, int *y, int *x) { PDC_LOG(("wmouse_position() - called\n")); if (win && wenclose(win, MOUSE_Y_POS, MOUSE_X_POS)) { if (y) *y = MOUSE_Y_POS - win->_begy; if (x) *x = MOUSE_X_POS - win->_begx; } else { if (y) *y = -1; if (x) *x = -1; } } unsigned long getmouse(void) { PDC_LOG(("getmouse() - called\n")); return SP->_trap_mbe; } unsigned long getbmap(void) { PDC_LOG(("getbmap() - called\n")); return SP->_map_mbe_to_key; } /* ncurses mouse interface */ int mouseinterval(int wait) { int old_wait; PDC_LOG(("mouseinterval() - called: %d\n", wait)); old_wait = SP->mouse_wait; if (wait >= 0 && wait <= 1000) SP->mouse_wait = wait; return old_wait; } bool wenclose(const WINDOW *win, int y, int x) { PDC_LOG(("wenclose() - called: %p %d %d\n", win, y, x)); return (win && y >= win->_begy && y < win->_begy + win->_maxy && x >= win->_begx && x < win->_begx + win->_maxx); } bool wmouse_trafo(const WINDOW *win, int *y, int *x, bool to_screen) { int newy, newx; PDC_LOG(("wmouse_trafo() - called\n")); if (!win || !y || !x) return FALSE; newy = *y; newx = *x; if (to_screen) { newy += win->_begy; newx += win->_begx; if (!wenclose(win, newy, newx)) return FALSE; } else { if (wenclose(win, newy, newx)) { newy -= win->_begy; newx -= win->_begx; } else return FALSE; } *y = newy; *x = newx; return TRUE; } bool mouse_trafo(int *y, int *x, bool to_screen) { PDC_LOG(("mouse_trafo() - called\n")); return wmouse_trafo(stdscr, y, x, to_screen); } mmask_t mousemask(mmask_t mask, mmask_t *oldmask) { PDC_LOG(("mousemask() - called\n")); if (oldmask) *oldmask = SP->_trap_mbe; /* The ncurses interface doesn't work with our move events, so filter them here */ mask &= ~(BUTTON1_MOVED | BUTTON2_MOVED | BUTTON3_MOVED); mouse_set(mask); return SP->_trap_mbe; } int nc_getmouse(MEVENT *event) { int i; mmask_t bstate = 0; PDC_LOG(("nc_getmouse() - called\n")); if (!event) return ERR; ungot = FALSE; request_mouse_pos(); event->id = 0; event->x = Mouse_status.x; event->y = Mouse_status.y; event->z = 0; for (i = 0; i < 3; i++) { if (Mouse_status.changes & (1 << i)) { int shf = i * 5; short button = Mouse_status.button[i] & BUTTON_ACTION_MASK; if (button == BUTTON_RELEASED) bstate |= (BUTTON1_RELEASED << shf); else if (button == BUTTON_PRESSED) bstate |= (BUTTON1_PRESSED << shf); else if (button == BUTTON_CLICKED) bstate |= (BUTTON1_CLICKED << shf); else if (button == BUTTON_DOUBLE_CLICKED) bstate |= (BUTTON1_DOUBLE_CLICKED << shf); else if (button == BUTTON_TRIPLE_CLICKED) bstate |= (BUTTON1_TRIPLE_CLICKED << shf); button = Mouse_status.button[i] & BUTTON_MODIFIER_MASK; if (button & PDC_BUTTON_SHIFT) bstate |= BUTTON_MODIFIER_SHIFT; if (button & PDC_BUTTON_CONTROL) bstate |= BUTTON_MODIFIER_CONTROL; if (button & PDC_BUTTON_ALT) bstate |= BUTTON_MODIFIER_ALT; } } if (MOUSE_WHEEL_UP) bstate |= BUTTON4_PRESSED; else if (MOUSE_WHEEL_DOWN) bstate |= BUTTON5_PRESSED; if( MOUSE_MOVED) bstate |= REPORT_MOUSE_POSITION; /* extra filter pass -- mainly for button modifiers */ event->bstate = bstate & SP->_trap_mbe; return OK; } int ungetmouse(MEVENT *event) { int i; unsigned long bstate; PDC_LOG(("ungetmouse() - called\n")); if (!event || ungot) return ERR; ungot = TRUE; pdc_mouse_status.x = event->x; pdc_mouse_status.y = event->y; pdc_mouse_status.changes = 0; bstate = event->bstate; for (i = 0; i < 3; i++) { int shf = i * 5; short button = 0; if (bstate & ((BUTTON1_RELEASED | BUTTON1_PRESSED | BUTTON1_TRIPLE_CLICKED | BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED) << shf)) { pdc_mouse_status.changes |= 1 << i; if (bstate & (BUTTON1_PRESSED << shf)) button = BUTTON_PRESSED; if (bstate & (BUTTON1_CLICKED << shf)) button = BUTTON_CLICKED; if (bstate & (BUTTON1_DOUBLE_CLICKED << shf)) button = BUTTON_DOUBLE_CLICKED; if (bstate & (BUTTON1_TRIPLE_CLICKED << shf)) button = BUTTON_TRIPLE_CLICKED; if (bstate & BUTTON_MODIFIER_SHIFT) button |= PDC_BUTTON_SHIFT; if (bstate & BUTTON_MODIFIER_CONTROL) button |= PDC_BUTTON_CONTROL; if (bstate & BUTTON_MODIFIER_ALT) button |= PDC_BUTTON_ALT; } pdc_mouse_status.button[i] = button; } if (bstate & BUTTON4_PRESSED) pdc_mouse_status.changes |= PDC_MOUSE_WHEEL_UP; else if (bstate & BUTTON5_PRESSED) pdc_mouse_status.changes |= PDC_MOUSE_WHEEL_DOWN; return ungetch(KEY_MOUSE); } curses-1.4.4/vendor/PDCurses/pdcurses/deprec.c0000644000004100000410000000077514201713275021312 0ustar www-datawww-data/* Public Domain Curses */ #include /* Deprecated functions. These should not be used, and will eventually be removed. They're here solely for the benefit of applications that linked to them in older versions of PDCurses. */ bool PDC_check_bios_key(void) { return PDC_check_key(); } int PDC_get_bios_key(void) { return PDC_get_key(); } bool PDC_get_ctrl_break(void) { return !SP->raw_inp; } int PDC_set_ctrl_break(bool setting) { return setting ? noraw() : raw(); } curses-1.4.4/vendor/PDCurses/pdcurses/initscr.c0000644000004100000410000002345014201713275021516 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** initscr ------- ### Synopsis WINDOW *initscr(void); WINDOW *Xinitscr(int argc, char *argv[]); int endwin(void); bool isendwin(void); SCREEN *newterm(const char *type, FILE *outfd, FILE *infd); SCREEN *set_term(SCREEN *new); void delscreen(SCREEN *sp); int resize_term(int nlines, int ncols); bool is_termresized(void); const char *curses_version(void); ### Description initscr() should be the first curses routine called. It will initialize all curses data structures, and arrange that the first call to refresh() will clear the screen. In case of error, initscr() will write a message to standard error and end the program. endwin() should be called before exiting or escaping from curses mode temporarily. It will restore tty modes, move the cursor to the lower left corner of the screen and reset the terminal into the proper non-visual mode. To resume curses after a temporary escape, call refresh() or doupdate(). isendwin() returns TRUE if endwin() has been called without a subsequent refresh, unless SP is NULL. In some implementations of curses, newterm() allows the use of multiple terminals. Here, it's just an alternative interface for initscr(). It always returns SP, or NULL. delscreen() frees the memory allocated by newterm() or initscr(), since it's not freed by endwin(). This function is usually not needed. In PDCurses, the parameter must be the value of SP, and delscreen() sets SP to NULL. set_term() does nothing meaningful in PDCurses, but is included for compatibility with other curses implementations. resize_term() is effectively two functions: When called with nonzero values for nlines and ncols, it attempts to resize the screen to the given size. On some platforms, you can do this before calling initscr(), thereby setting the starting screen size. When called with (0, 0), it merely adjusts the internal structures to match the current size after the screen is resized by the user. User, pre-initscr(), and programmatic resizing is platform-dependent, as follows (with ncurses added as a "platform" for comparison; it supports only user resizing.) Platform User Init Programmatic DOS - - x ncurses x - - OS/2 - - x SDL1 x x x SDL2 x x x VT x x x Wincon x - x WinGUI x x x X11 x x - If you want to support user resizing, you should check for getch() returning KEY_RESIZE, and/or call is_termresized() at appropriate times; if either condition occurs, call resize_term(0, 0). Then, with either user or programmatic resizing, you'll have to resize any windows you've created, as appropriate; resize_term() only handles stdscr and curscr. is_termresized() returns TRUE if the curses screen has been resized by the user, and a call to resize_term() is needed. Checking for KEY_RESIZE is generally preferable, unless you're not handling the keyboard. curses_version() returns a string describing the version of PDCurses. ### Return Value All functions return NULL on error, except endwin(), which always returns OK, and resize_term(), which returns either OK or ERR. ### Portability X/Open BSD SYS V initscr Y Y Y endwin Y Y Y isendwin Y - 3.0 newterm Y - Y set_term Y - Y delscreen Y - 4.0 resize_term - - - is_termresized - - - curses_version - - - **man-end****************************************************************/ #include char ttytype[128]; #define PDC_STR( x) #x #define PDC_str( x) PDC_STR( x) static const char *_curses_notice = "PDCurses " PDC_str(PDC_VER_MAJOR) "." PDC_str(PDC_VER_MINOR) "." PDC_str(PDC_VER_CHANGE) " - Public Domain " PDC_str(PDC_VER_YEAR) "-" PDC_str(PDC_VER_MONTH) "-" PDC_str(PDC_VER_DAY); SCREEN *SP = (SCREEN*)NULL; /* curses variables */ WINDOW *curscr = (WINDOW *)NULL; /* the current screen image */ WINDOW *stdscr = (WINDOW *)NULL; /* the default screen window */ WINDOW *pdc_lastscr = (WINDOW *)NULL; /* the last screen image */ int LINES = 0; /* current terminal height */ int COLS = 0; /* current terminal width */ int TABSIZE = 8; MOUSE_STATUS Mouse_status, pdc_mouse_status; extern RIPPEDOFFLINE linesripped[5]; extern char linesrippedoff; WINDOW *Xinitscr(int argc, char *argv[]) { int i; PDC_LOG(("Xinitscr() - called\n")); if (SP && SP->alive) return NULL; if (PDC_scr_open(argc, argv) == ERR) { fprintf(stderr, "initscr(): Unable to create SP\n"); exit(8); } SP->autocr = TRUE; /* cr -> lf by default */ SP->raw_out = FALSE; /* tty I/O modes */ SP->raw_inp = FALSE; /* tty I/O modes */ SP->cbreak = TRUE; SP->save_key_modifiers = FALSE; SP->return_key_modifiers = FALSE; SP->echo = TRUE; SP->visibility = 1; SP->resized = FALSE; SP->_trap_mbe = 0L; SP->_map_mbe_to_key = 0L; SP->linesrippedoff = 0; SP->linesrippedoffontop = 0; SP->delaytenths = 0; SP->line_color = -1; SP->orig_cursor = PDC_get_cursor_mode(); LINES = SP->lines; COLS = SP->cols; if (LINES < 2 || COLS < 2) { fprintf(stderr, "initscr(): LINES=%d COLS=%d: too small.\n", LINES, COLS); exit(4); } if ((curscr = newwin(LINES, COLS, 0, 0)) == (WINDOW *)NULL) { fprintf(stderr, "initscr(): Unable to create curscr.\n"); exit(2); } if ((pdc_lastscr = newwin(LINES, COLS, 0, 0)) == (WINDOW *)NULL) { fprintf(stderr, "initscr(): Unable to create pdc_lastscr.\n"); exit(2); } wattrset(pdc_lastscr, (chtype)(-1)); werase(pdc_lastscr); PDC_slk_initialize(); LINES -= SP->slklines; /* We have to sort out ripped off lines here, and reduce the height of stdscr by the number of lines ripped off */ for (i = 0; i < linesrippedoff; i++) { if (linesripped[i].line < 0) (*linesripped[i].init)(newwin(1, COLS, LINES - 1, 0), COLS); else (*linesripped[i].init)(newwin(1, COLS, SP->linesrippedoffontop++, 0), COLS); SP->linesrippedoff++; LINES--; } linesrippedoff = 0; if (!(stdscr = newwin(LINES, COLS, SP->linesrippedoffontop, 0))) { fprintf(stderr, "initscr(): Unable to create stdscr.\n"); exit(1); } wclrtobot(stdscr); /* If preserving the existing screen, don't allow a screen clear */ if (SP->_preserve) { untouchwin(curscr); untouchwin(stdscr); stdscr->_clear = FALSE; curscr->_clear = FALSE; } else curscr->_clear = TRUE; PDC_init_atrtab(); /* set up default colors */ MOUSE_X_POS = MOUSE_Y_POS = -1; BUTTON_STATUS(1) = BUTTON_RELEASED; BUTTON_STATUS(2) = BUTTON_RELEASED; BUTTON_STATUS(3) = BUTTON_RELEASED; Mouse_status.changes = 0; SP->alive = TRUE; def_shell_mode(); longname( ); /* to ensure that ttytype is initialized */ return stdscr; } WINDOW *initscr(void) { PDC_LOG(("initscr() - called\n")); return Xinitscr(0, NULL); } int endwin(void) { PDC_LOG(("endwin() - called\n")); /* Allow temporary exit from curses using endwin() */ def_prog_mode(); PDC_scr_close(); SP->alive = FALSE; return OK; } bool isendwin(void) { PDC_LOG(("isendwin() - called\n")); return SP ? !(SP->alive) : FALSE; } SCREEN *newterm(const char *type, FILE *outfd, FILE *infd) { PDC_LOG(("newterm() - called\n")); return Xinitscr(0, NULL) ? SP : NULL; } SCREEN *set_term(SCREEN *new) { PDC_LOG(("set_term() - called\n")); /* We only support one screen */ return (new == SP) ? SP : NULL; } void delscreen(SCREEN *sp) { PDC_LOG(("delscreen() - called\n")); if (sp != SP) return; PDC_slk_free(); /* free the soft label keys, if needed */ delwin(stdscr); delwin(curscr); delwin(pdc_lastscr); stdscr = (WINDOW *)NULL; curscr = (WINDOW *)NULL; pdc_lastscr = (WINDOW *)NULL; SP->alive = FALSE; PDC_scr_free(); /* free SP and pdc_atrtab */ SP = (SCREEN *)NULL; } int resize_term(int nlines, int ncols) { PDC_LOG(("resize_term() - called: nlines %d\n", nlines)); if( PDC_resize_screen(nlines, ncols) == ERR) return ERR; if (!stdscr) return OK; SP->lines = PDC_get_rows(); LINES = SP->lines - SP->linesrippedoff - SP->slklines; SP->cols = COLS = PDC_get_columns(); if (wresize(curscr, SP->lines, SP->cols) == ERR || wresize(stdscr, LINES, COLS) == ERR || wresize(pdc_lastscr, SP->lines, SP->cols) == ERR) return ERR; werase(pdc_lastscr); curscr->_clear = TRUE; if (SP->slk_winptr) { if (wresize(SP->slk_winptr, SP->slklines, COLS) == ERR) return ERR; wmove(SP->slk_winptr, 0, 0); wclrtobot(SP->slk_winptr); PDC_slk_initialize(); slk_noutrefresh(); } touchwin(stdscr); wnoutrefresh(stdscr); return OK; } bool is_termresized(void) { PDC_LOG(("is_termresized() - called\n")); return SP->resized; } const char *curses_version(void) { return _curses_notice; } curses-1.4.4/vendor/PDCurses/pdcurses/bkgd.c0000644000004100000410000001204114201713275020744 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** bkgd ---- ### Synopsis int bkgd(chtype ch); void bkgdset(chtype ch); chtype getbkgd(WINDOW *win); int wbkgd(WINDOW *win, chtype ch); void wbkgdset(WINDOW *win, chtype ch); int bkgrnd(const cchar_t *wch); void bkgrndset(const cchar_t *wch); int getbkgrnd(cchar_t *wch); int wbkgrnd(WINDOW *win, const cchar_t *wch); void wbkgrndset(WINDOW *win, const cchar_t *wch); int wgetbkgrnd(WINDOW *win, cchar_t *wch); ### Description bkgdset() and wbkgdset() manipulate the background of a window. The background is a chtype consisting of any combination of attributes and a character; it is combined with each chtype added or inserted to the window by waddch() or winsch(). Only the attribute part is used to set the background of non-blank characters, while both character and attributes are used for blank positions. bkgd() and wbkgd() not only change the background, but apply it immediately to every cell in the window. The attributes that are defined with the attrset()/attron() set of functions take precedence over the background attributes if there is a conflict (e.g., different color pairs). ### Return Value bkgd() and wbkgd() return OK, unless the window is NULL, in which case they return ERR. ### Portability X/Open BSD SYS V bkgd Y - 4.0 bkgdset Y - 4.0 getbkgd Y wbkgd Y - 4.0 wbkgdset Y - 4.0 bkgrnd Y bkgrndset Y getbkgrnd Y wbkgrnd Y wbkgrndset Y wgetbkgrnd Y **man-end****************************************************************/ int wbkgd(WINDOW *win, chtype ch) { int x, y; chtype oldcolr, oldch, newcolr, newch, colr, attr; chtype oldattr = 0, newattr = 0; chtype *winptr; PDC_LOG(("wbkgd() - called\n")); if (!win) return ERR; if (win->_bkgd == ch) return OK; oldcolr = win->_bkgd & A_COLOR; if (oldcolr) oldattr = (win->_bkgd & A_ATTRIBUTES) ^ oldcolr; oldch = win->_bkgd & A_CHARTEXT; wbkgdset(win, ch); newcolr = win->_bkgd & A_COLOR; if (newcolr) newattr = (win->_bkgd & A_ATTRIBUTES) ^ newcolr; newch = win->_bkgd & A_CHARTEXT; /* what follows is what seems to occur in the System V implementation of this routine */ for (y = 0; y < win->_maxy; y++) { for (x = 0; x < win->_maxx; x++) { winptr = win->_y[y] + x; ch = *winptr; /* determine the colors and attributes of the character read from the window */ colr = ch & A_COLOR; attr = ch & (A_ATTRIBUTES ^ A_COLOR); /* if the color is the same as the old background color, then make it the new background color, otherwise leave it */ if (colr == oldcolr) colr = newcolr; /* remove any attributes (non color) from the character that were part of the old background, then combine the remaining ones with the new background */ attr ^= oldattr; attr |= newattr; /* change character if it is there because it was the old background character */ ch &= A_CHARTEXT; if (ch == oldch) ch = newch; ch |= (attr | colr); *winptr = ch; } } touchwin(win); PDC_sync(win); return OK; } int bkgd(chtype ch) { PDC_LOG(("bkgd() - called\n")); return wbkgd(stdscr, ch); } void wbkgdset(WINDOW *win, chtype ch) { PDC_LOG(("wbkgdset() - called\n")); if (win) { if (!(ch & A_CHARTEXT)) ch |= ' '; win->_bkgd = ch; } } void bkgdset(chtype ch) { PDC_LOG(("bkgdset() - called\n")); wbkgdset(stdscr, ch); } chtype getbkgd(WINDOW *win) { PDC_LOG(("getbkgd() - called\n")); return win ? win->_bkgd : (chtype)ERR; } #ifdef PDC_WIDE int wbkgrnd(WINDOW *win, const cchar_t *wch) { PDC_LOG(("wbkgrnd() - called\n")); return wch ? wbkgd(win, *wch) : ERR; } int bkgrnd(const cchar_t *wch) { PDC_LOG(("bkgrnd() - called\n")); return wbkgrnd(stdscr, wch); } void wbkgrndset(WINDOW *win, const cchar_t *wch) { PDC_LOG(("wbkgdset() - called\n")); if (wch) wbkgdset(win, *wch); } void bkgrndset(const cchar_t *wch) { PDC_LOG(("bkgrndset() - called\n")); wbkgrndset(stdscr, wch); } int wgetbkgrnd(WINDOW *win, cchar_t *wch) { PDC_LOG(("wgetbkgrnd() - called\n")); if (!win || !wch) return ERR; *wch = win->_bkgd; return OK; } int getbkgrnd(cchar_t *wch) { PDC_LOG(("getbkgrnd() - called\n")); return wgetbkgrnd(stdscr, wch); } #endif curses-1.4.4/vendor/PDCurses/pdcurses/attr.c0000644000004100000410000002112314201713275021010 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** attr ---- ### Synopsis int attroff(chtype attrs); int wattroff(WINDOW *win, chtype attrs); int attron(chtype attrs); int wattron(WINDOW *win, chtype attrs); int attrset(chtype attrs); int wattrset(WINDOW *win, chtype attrs); int standend(void); int wstandend(WINDOW *win); int standout(void); int wstandout(WINDOW *win); int color_set(short color_pair, void *opts); int wcolor_set(WINDOW *win, short color_pair, void *opts); int attr_get(attr_t *attrs, short *color_pair, void *opts); int attr_off(attr_t attrs, void *opts); int attr_on(attr_t attrs, void *opts); int attr_set(attr_t attrs, short color_pair, void *opts); int wattr_get(WINDOW *win, attr_t *attrs, short *color_pair, void *opts); int wattr_off(WINDOW *win, attr_t attrs, void *opts); int wattr_on(WINDOW *win, attr_t attrs, void *opts); int wattr_set(WINDOW *win, attr_t attrs, short color_pair, void *opts); int chgat(int n, attr_t attr, short color, const void *opts); int mvchgat(int y, int x, int n, attr_t attr, short color, const void *opts); int mvwchgat(WINDOW *win, int y, int x, int n, attr_t attr, short color, const void *opts); int wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts); chtype getattrs(WINDOW *win); ### Description These functions manipulate the current attributes and/or colors of the named window. These attributes can be any combination of A_STANDOUT, A_REVERSE, A_BOLD, A_DIM, A_BLINK, A_UNDERLINE. These constants are defined in and can be combined with the bitwise-OR operator (|). The current attributes of a window are applied to all chtypes that are written into the window with waddch(). Attributes are a property of the chtype, and move with the character through any scrolling or insert/delete operations. attrset() sets the current attributes of the given window to attrs. attroff() turns off the named attributes without affecting any other attributes; attron() turns them on. color_set() sets the window color to the value of color_pair. standout() is the same as attron(A_STANDOUT). standend() is the same as attrset(A_NORMAL); that is, it turns off all attributes. wchgat() sets the attributes of the n symbols starts from current position of the given window. mvwchgat() moves the cursor to the specified position and sets the attributes of the n symbols starts from current position of the given window. ### Return Value All functions return OK on success and ERR on error. ### Portability X/Open BSD SYS V attroff Y Y Y wattroff Y Y Y attron Y Y Y wattron Y Y Y attrset Y Y Y wattrset Y Y Y standend Y Y Y wstandend Y Y Y standout Y Y Y wstandout Y Y Y color_set Y wcolor_set Y attr_get Y wattr_get Y attr_on Y wattr_on Y attr_off Y wattr_off Y attr_set Y wattr_set Y chgat Y wchgat Y mvchgat Y mvwchgat Y getattrs - **man-end****************************************************************/ int wattroff(WINDOW *win, chtype attrs) { PDC_LOG(("wattroff() - called\n")); if (!win) return ERR; win->_attrs &= (~attrs & A_ATTRIBUTES); return OK; } int attroff(chtype attrs) { PDC_LOG(("attroff() - called\n")); return wattroff(stdscr, attrs); } int wattron(WINDOW *win, chtype attrs) { chtype newcolr, oldcolr, newattr, oldattr; PDC_LOG(("wattron() - called\n")); if (!win) return ERR; if ((win->_attrs & A_COLOR) && (attrs & A_COLOR)) { oldcolr = win->_attrs & A_COLOR; oldattr = win->_attrs ^ oldcolr; newcolr = attrs & A_COLOR; newattr = (attrs & A_ATTRIBUTES) ^ newcolr; newattr |= oldattr; win->_attrs = newattr | newcolr; } else win->_attrs |= (attrs & A_ATTRIBUTES); return OK; } int attron(chtype attrs) { PDC_LOG(("attron() - called\n")); return wattron(stdscr, attrs); } int wattrset(WINDOW *win, chtype attrs) { PDC_LOG(("wattrset() - called\n")); if (!win) return ERR; win->_attrs = attrs & A_ATTRIBUTES; return OK; } int attrset(chtype attrs) { PDC_LOG(("attrset() - called\n")); return wattrset(stdscr, attrs); } int standend(void) { PDC_LOG(("standend() - called\n")); return wattrset(stdscr, A_NORMAL); } int standout(void) { PDC_LOG(("standout() - called\n")); return wattrset(stdscr, A_STANDOUT); } int wstandend(WINDOW *win) { PDC_LOG(("wstandend() - called\n")); return wattrset(win, A_NORMAL); } int wstandout(WINDOW *win) { PDC_LOG(("wstandout() - called\n")); return wattrset(win, A_STANDOUT); } chtype getattrs(WINDOW *win) { return win ? win->_attrs : 0; } int wcolor_set(WINDOW *win, short color_pair, void *opts) { PDC_LOG(("wcolor_set() - called\n")); if (!win) return ERR; win->_attrs = (win->_attrs & ~A_COLOR) | COLOR_PAIR(color_pair); return OK; } int color_set(short color_pair, void *opts) { PDC_LOG(("color_set() - called\n")); return wcolor_set(stdscr, color_pair, opts); } int wattr_get(WINDOW *win, attr_t *attrs, short *color_pair, void *opts) { PDC_LOG(("wattr_get() - called\n")); if (!win) return ERR; if (attrs) *attrs = win->_attrs & (A_ATTRIBUTES & ~A_COLOR); if (color_pair) *color_pair = (short)PAIR_NUMBER(win->_attrs); return OK; } int attr_get(attr_t *attrs, short *color_pair, void *opts) { PDC_LOG(("attr_get() - called\n")); return wattr_get(stdscr, attrs, color_pair, opts); } int wattr_off(WINDOW *win, attr_t attrs, void *opts) { PDC_LOG(("wattr_off() - called\n")); return wattroff(win, attrs); } int attr_off(attr_t attrs, void *opts) { PDC_LOG(("attr_off() - called\n")); return wattroff(stdscr, attrs); } int wattr_on(WINDOW *win, attr_t attrs, void *opts) { PDC_LOG(("wattr_off() - called\n")); return wattron(win, attrs); } int attr_on(attr_t attrs, void *opts) { PDC_LOG(("attr_on() - called\n")); return wattron(stdscr, attrs); } int wattr_set(WINDOW *win, attr_t attrs, short color_pair, void *opts) { PDC_LOG(("wattr_set() - called\n")); if (!win) return ERR; win->_attrs = (attrs & (A_ATTRIBUTES & ~A_COLOR)) | COLOR_PAIR(color_pair); return OK; } int attr_set(attr_t attrs, short color_pair, void *opts) { PDC_LOG(("attr_get() - called\n")); return wattr_set(stdscr, attrs, color_pair, opts); } int wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts) { chtype *dest, newattr; int startpos, endpos; PDC_LOG(("wchgat() - called\n")); if (!win) return ERR; newattr = (attr & A_ATTRIBUTES) | COLOR_PAIR(color); startpos = win->_curx; endpos = ((n < 0) ? win->_maxx : min(startpos + n, win->_maxx)) - 1; dest = win->_y[win->_cury]; for (n = startpos; n <= endpos; n++) dest[n] = (dest[n] & A_CHARTEXT) | newattr; n = win->_cury; if (startpos < win->_firstch[n] || win->_firstch[n] == _NO_CHANGE) win->_firstch[n] = startpos; if (endpos > win->_lastch[n]) win->_lastch[n] = endpos; PDC_sync(win); return OK; } int chgat(int n, attr_t attr, short color, const void *opts) { PDC_LOG(("chgat() - called\n")); return wchgat(stdscr, n, attr, color, opts); } int mvchgat(int y, int x, int n, attr_t attr, short color, const void *opts) { PDC_LOG(("mvchgat() - called\n")); if (move(y, x) == ERR) return ERR; return wchgat(stdscr, n, attr, color, opts); } int mvwchgat(WINDOW *win, int y, int x, int n, attr_t attr, short color, const void *opts) { PDC_LOG(("mvwchgat() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return wchgat(win, n, attr, color, opts); } curses-1.4.4/vendor/PDCurses/pdcurses/deleteln.c0000644000004100000410000001062614201713275021640 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** deleteln -------- ### Synopsis int deleteln(void); int wdeleteln(WINDOW *win); int insdelln(int n); int winsdelln(WINDOW *win, int n); int insertln(void); int winsertln(WINDOW *win); int mvdeleteln(int y, int x); int mvwdeleteln(WINDOW *win, int y, int x); int mvinsertln(int y, int x); int mvwinsertln(WINDOW *win, int y, int x); ### Description With the deleteln() and wdeleteln() functions, the line under the cursor in the window is deleted. All lines below the current line are moved up one line. The bottom line of the window is cleared. The cursor position does not change. With the insertln() and winsertn() functions, a blank line is inserted above the current line and the bottom line is lost. mvdeleteln(), mvwdeleteln(), mvinsertln() and mvwinsertln() allow moving the cursor and inserting/deleting in one call. ### Return Value All functions return OK on success and ERR on error. ### Portability X/Open BSD SYS V deleteln Y Y Y wdeleteln Y Y Y mvdeleteln - - - mvwdeleteln - - - insdelln Y - 4.0 winsdelln Y - 4.0 insertln Y Y Y winsertln Y Y Y mvinsertln - - - mvwinsertln - - - **man-end****************************************************************/ int wdeleteln(WINDOW *win) { chtype blank, *temp, *ptr; int y; PDC_LOG(("wdeleteln() - called\n")); if (!win) return ERR; /* wrs (4/10/93) account for window background */ blank = win->_bkgd; temp = win->_y[win->_cury]; for (y = win->_cury; y < win->_bmarg; y++) { win->_y[y] = win->_y[y + 1]; win->_firstch[y] = 0; win->_lastch[y] = win->_maxx - 1; } for (ptr = temp; (ptr - temp < win->_maxx); ptr++) *ptr = blank; /* make a blank line */ if (win->_cury <= win->_bmarg) { win->_firstch[win->_bmarg] = 0; win->_lastch[win->_bmarg] = win->_maxx - 1; win->_y[win->_bmarg] = temp; } return OK; } int deleteln(void) { PDC_LOG(("deleteln() - called\n")); return wdeleteln(stdscr); } int mvdeleteln(int y, int x) { PDC_LOG(("mvdeleteln() - called\n")); if (move(y, x) == ERR) return ERR; return wdeleteln(stdscr); } int mvwdeleteln(WINDOW *win, int y, int x) { PDC_LOG(("mvwdeleteln() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return wdeleteln(win); } int winsdelln(WINDOW *win, int n) { int i; PDC_LOG(("winsdelln() - called\n")); if (!win) return ERR; if (n > 0) { for (i = 0; i < n; i++) if (winsertln(win) == ERR) return ERR; } else if (n < 0) { n = -n; for (i = 0; i < n; i++) if (wdeleteln(win) == ERR) return ERR; } return OK; } int insdelln(int n) { PDC_LOG(("insdelln() - called\n")); return winsdelln(stdscr, n); } int winsertln(WINDOW *win) { chtype blank, *temp, *end; int y; PDC_LOG(("winsertln() - called\n")); if (!win) return ERR; /* wrs (4/10/93) account for window background */ blank = win->_bkgd; temp = win->_y[win->_maxy - 1]; for (y = win->_maxy - 1; y > win->_cury; y--) { win->_y[y] = win->_y[y - 1]; win->_firstch[y] = 0; win->_lastch[y] = win->_maxx - 1; } win->_y[win->_cury] = temp; for (end = &temp[win->_maxx - 1]; temp <= end; temp++) *temp = blank; win->_firstch[win->_cury] = 0; win->_lastch[win->_cury] = win->_maxx - 1; return OK; } int insertln(void) { PDC_LOG(("insertln() - called\n")); return winsertln(stdscr); } int mvinsertln(int y, int x) { PDC_LOG(("mvinsertln() - called\n")); if (move(y, x) == ERR) return ERR; return winsertln(stdscr); } int mvwinsertln(WINDOW *win, int y, int x) { PDC_LOG(("mvwinsertln() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return winsertln(win); } curses-1.4.4/vendor/PDCurses/pdcurses/scroll.c0000644000004100000410000000407214201713275021340 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** scroll ------ ### Synopsis int scroll(WINDOW *win); int scrl(int n); int wscrl(WINDOW *win, int n); ### Description scroll() causes the window to scroll up one line. This involves moving the lines in the window data strcture. With a positive n, scrl() and wscrl() scroll the window up n lines (line i + n becomes i); otherwise they scroll the window down n lines. For these functions to work, scrolling must be enabled via scrollok(). Note also that scrolling is not allowed if the supplied window is a pad. ### Return Value All functions return OK on success and ERR on error. ### Portability X/Open BSD SYS V scroll Y Y Y scrl Y - 4.0 wscrl Y - 4.0 **man-end****************************************************************/ int wscrl(WINDOW *win, int n) { int i, l, dir, start, end; chtype blank, *temp; /* Check if window scrolls. Valid for window AND pad */ if (!win || !win->_scroll || !n) return ERR; blank = win->_bkgd; if (n > 0) { start = win->_tmarg; end = win->_bmarg; dir = 1; } else { start = win->_bmarg; end = win->_tmarg; dir = -1; } for (l = 0; l < (n * dir); l++) { temp = win->_y[start]; /* re-arrange line pointers */ for (i = start; i != end; i += dir) win->_y[i] = win->_y[i + dir]; win->_y[end] = temp; /* make a blank line */ for (i = 0; i < win->_maxx; i++) *temp++ = blank; } touchline(win, win->_tmarg, win->_bmarg - win->_tmarg + 1); PDC_sync(win); return OK; } int scrl(int n) { PDC_LOG(("scrl() - called\n")); return wscrl(stdscr, n); } int scroll(WINDOW *win) { PDC_LOG(("scroll() - called\n")); return wscrl(win, 1); } curses-1.4.4/vendor/PDCurses/pdcurses/inopts.c0000644000004100000410000001640114201713275021355 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** inopts ------ ### Synopsis int cbreak(void); int nocbreak(void); int echo(void); int noecho(void); int halfdelay(int tenths); int intrflush(WINDOW *win, bool bf); int keypad(WINDOW *win, bool bf); int meta(WINDOW *win, bool bf); int nl(void); int nonl(void); int nodelay(WINDOW *win, bool bf); int notimeout(WINDOW *win, bool bf); int raw(void); int noraw(void); void noqiflush(void); void qiflush(void); void timeout(int delay); void wtimeout(WINDOW *win, int delay); int typeahead(int fildes); int crmode(void); int nocrmode(void); ### Description cbreak() and nocbreak() toggle cbreak mode. In cbreak mode, characters typed by the user are made available immediately, and erase/kill character processing is not performed. In nocbreak mode, typed characters are buffered until a newline or carriage return. Interrupt and flow control characters are unaffected by this mode. PDCurses always starts in cbreak mode. echo() and noecho() control whether typed characters are echoed by the input routine. Initially, input characters are echoed. Subsequent calls to echo() and noecho() do not flush type-ahead. halfdelay() is similar to cbreak(), but allows for a time limit to be specified, in tenths of a second. This causes getch() to block for that period before returning ERR if no key has been received. tenths must be between 1 and 255. keypad() controls whether getch() returns function/special keys as single key codes (e.g., the left arrow key as KEY_LEFT). Per X/Open, the default for keypad mode is OFF. You'll probably want it on. With keypad mode off, if a special key is pressed, getch() does nothing or returns ERR. nodelay() controls whether wgetch() is a non-blocking call. If the option is enabled, and no input is ready, wgetch() will return ERR. If disabled, wgetch() will hang until input is ready. nl() enables the translation of a carriage return into a newline on input. nonl() disables this. Initially, the translation does occur. raw() and noraw() toggle raw mode. Raw mode is similar to cbreak mode, in that characters typed are immediately passed through to the user program. The difference is that in raw mode, the INTR, QUIT, SUSP, and STOP characters are passed through without being interpreted, and without generating a signal. In PDCurses, the meta() function sets raw mode on or off. timeout() and wtimeout() set blocking or non-blocking reads for the specified window. The delay is measured in milliseconds. If it's negative, a blocking read is used; if zero, then non- blocking reads are done -- if no input is waiting, ERR is returned immediately. If the delay is positive, the read blocks for the delay period; if the period expires, ERR is returned. intrflush(), notimeout(), noqiflush(), qiflush() and typeahead() do nothing in PDCurses, but are included for compatibility with other curses implementations. crmode() and nocrmode() are archaic equivalents to cbreak() and nocbreak(), respectively. ### Return Value All functions return OK on success and ERR on error. ### Portability X/Open BSD SYS V cbreak Y Y Y nocbreak Y Y Y echo Y Y Y noecho Y Y Y halfdelay Y - Y intrflush Y - Y keypad Y - Y meta Y - Y nl Y Y Y nonl Y Y Y nodelay Y - Y notimeout Y - Y raw Y Y Y noraw Y Y Y noqiflush Y - Y qiflush Y - Y timeout Y - Y wtimeout Y - Y typeahead Y - Y crmode - nocrmode - **man-end****************************************************************/ int cbreak(void) { PDC_LOG(("cbreak() - called\n")); SP->cbreak = TRUE; return OK; } int nocbreak(void) { PDC_LOG(("nocbreak() - called\n")); SP->cbreak = FALSE; SP->delaytenths = 0; return OK; } int echo(void) { PDC_LOG(("echo() - called\n")); SP->echo = TRUE; return OK; } int noecho(void) { PDC_LOG(("noecho() - called\n")); SP->echo = FALSE; return OK; } int halfdelay(int tenths) { PDC_LOG(("halfdelay() - called\n")); if (tenths < 1 || tenths > 255) return ERR; SP->delaytenths = tenths; return OK; } int intrflush(WINDOW *win, bool bf) { PDC_LOG(("intrflush() - called\n")); return OK; } int keypad(WINDOW *win, bool bf) { PDC_LOG(("keypad() - called\n")); if (!win) return ERR; win->_use_keypad = bf; return OK; } int meta(WINDOW *win, bool bf) { PDC_LOG(("meta() - called\n")); SP->raw_inp = bf; return OK; } int nl(void) { PDC_LOG(("nl() - called\n")); SP->autocr = TRUE; return OK; } int nonl(void) { PDC_LOG(("nonl() - called\n")); SP->autocr = FALSE; return OK; } int nodelay(WINDOW *win, bool flag) { PDC_LOG(("nodelay() - called\n")); if (!win) return ERR; win->_nodelay = flag; return OK; } int notimeout(WINDOW *win, bool flag) { PDC_LOG(("notimeout() - called\n")); return OK; } int raw(void) { PDC_LOG(("raw() - called\n")); PDC_set_keyboard_binary(TRUE); SP->raw_inp = TRUE; return OK; } int noraw(void) { PDC_LOG(("noraw() - called\n")); PDC_set_keyboard_binary(FALSE); SP->raw_inp = FALSE; return OK; } void noqiflush(void) { PDC_LOG(("noqiflush() - called\n")); } void qiflush(void) { PDC_LOG(("qiflush() - called\n")); } int typeahead(int fildes) { PDC_LOG(("typeahead() - called\n")); return OK; } void wtimeout(WINDOW *win, int delay) { PDC_LOG(("wtimeout() - called\n")); if (!win) return; if (delay < 0) { /* This causes a blocking read on the window, so turn on delay mode */ win->_nodelay = FALSE; win->_delayms = 0; } else if (!delay) { /* This causes a non-blocking read on the window, so turn off delay mode */ win->_nodelay = TRUE; win->_delayms = 0; } else { /* This causes the read on the window to delay for the number of milliseconds. Also forces the window into non-blocking read mode */ /*win->_nodelay = TRUE;*/ win->_delayms = delay; } } void timeout(int delay) { PDC_LOG(("timeout() - called\n")); wtimeout(stdscr, delay); } int crmode(void) { PDC_LOG(("crmode() - called\n")); return cbreak(); } int nocrmode(void) { PDC_LOG(("nocrmode() - called\n")); return nocbreak(); } curses-1.4.4/vendor/PDCurses/pdcurses/insch.c0000644000004100000410000001460114201713275021145 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** insch ----- ### Synopsis int insch(chtype ch); int winsch(WINDOW *win, chtype ch); int mvinsch(int y, int x, chtype ch); int mvwinsch(WINDOW *win, int y, int x, chtype ch); int insrawch(chtype ch); int winsrawch(WINDOW *win, chtype ch); int mvinsrawch(int y, int x, chtype ch); int mvwinsrawch(WINDOW *win, int y, int x, chtype ch); int ins_wch(const cchar_t *wch); int wins_wch(WINDOW *win, const cchar_t *wch); int mvins_wch(int y, int x, const cchar_t *wch); int mvwins_wch(WINDOW *win, int y, int x, const cchar_t *wch); ### Description The insch() functions insert a chtype into the window at the current or specified cursor position. The cursor is NOT advanced. A newline is equivalent to clrtoeol(); tabs are expanded; other control characters are converted as with unctrl(). The ins_wch() functions are the wide-character equivalents, taking cchar_t pointers rather than chtypes. Video attributes can be combined with a character by ORing them into the parameter. Text, including attributes, can be copied from one place to another using inch() and insch(). insrawch() etc. are PDCurses-specific wrappers for insch() etc. that disable the translation of control characters. ### Return Value All functions return OK on success and ERR on error. ### Portability X/Open BSD SYS V insch Y Y Y winsch Y Y Y mvinsch Y Y Y mvwinsch Y Y Y insrawch - - - winsrawch - - - ins_wch Y wins_wch Y mvins_wch Y mvwins_wch Y **man-end****************************************************************/ #include int winsch(WINDOW *win, chtype ch) { int x, y; chtype attr; bool xlat; PDC_LOG(("winsch() - called: win=%p ch=%x (text=%c attr=0x%x)\n", win, ch, ch & A_CHARTEXT, ch & A_ATTRIBUTES)); if (!win) return ERR; x = win->_curx; y = win->_cury; if (y > win->_maxy || x > win->_maxx || y < 0 || x < 0) return ERR; xlat = !SP->raw_out && !(ch & A_ALTCHARSET); attr = ch & A_ATTRIBUTES; ch &= A_CHARTEXT; if (xlat && (ch < ' ' || ch == 0x7f)) { int x2; switch ((int)ch) { case '\t': for (x2 = ((x / TABSIZE) + 1) * TABSIZE; x < x2; x++) { if (winsch(win, attr | ' ') == ERR) return ERR; } return OK; case '\n': wclrtoeol(win); break; case 0x7f: if (winsch(win, attr | '?') == ERR) return ERR; return winsch(win, attr | '^'); default: /* handle control chars */ if (winsch(win, attr | (ch + '@')) == ERR) return ERR; return winsch(win, attr | '^'); } } else { int maxx; chtype *temp; /* If the incoming character doesn't have its own attribute, then use the current attributes for the window. If it has attributes but not a color component, OR the attributes to the current attributes for the window. If it has a color component, use the attributes solely from the incoming character. */ if (!(attr & A_COLOR)) attr |= win->_attrs; /* wrs (4/10/93): Apply the same sort of logic for the window background, in that it only takes precedence if other color attributes are not there and that the background character will only print if the printing character is blank. */ if (!(attr & A_COLOR)) attr |= win->_bkgd & A_ATTRIBUTES; else attr |= win->_bkgd & (A_ATTRIBUTES ^ A_COLOR); if (ch == ' ') ch = win->_bkgd & A_CHARTEXT; /* Add the attribute back into the character. */ ch |= attr; maxx = win->_maxx; temp = &win->_y[y][x]; memmove(temp + 1, temp, (maxx - x - 1) * sizeof(chtype)); win->_lastch[y] = maxx - 1; if ((win->_firstch[y] == _NO_CHANGE) || (win->_firstch[y] > x)) win->_firstch[y] = x; *temp = ch; } PDC_sync(win); return OK; } int insch(chtype ch) { PDC_LOG(("insch() - called\n")); return winsch(stdscr, ch); } int mvinsch(int y, int x, chtype ch) { PDC_LOG(("mvinsch() - called\n")); if (move(y, x) == ERR) return ERR; return winsch(stdscr, ch); } int mvwinsch(WINDOW *win, int y, int x, chtype ch) { PDC_LOG(("mvwinsch() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return winsch(win, ch); } int winsrawch(WINDOW *win, chtype ch) { PDC_LOG(("winsrawch() - called: win=%p ch=%x " "(char=%c attr=0x%x)\n", win, ch, ch & A_CHARTEXT, ch & A_ATTRIBUTES)); if ((ch & A_CHARTEXT) < ' ' || (ch & A_CHARTEXT) == 0x7f) ch |= A_ALTCHARSET; return winsch(win, ch); } int insrawch(chtype ch) { PDC_LOG(("insrawch() - called\n")); return winsrawch(stdscr, ch); } int mvinsrawch(int y, int x, chtype ch) { PDC_LOG(("mvinsrawch() - called\n")); if (move(y, x) == ERR) return ERR; return winsrawch(stdscr, ch); } int mvwinsrawch(WINDOW *win, int y, int x, chtype ch) { PDC_LOG(("mvwinsrawch() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return winsrawch(win, ch); } #ifdef PDC_WIDE int wins_wch(WINDOW *win, const cchar_t *wch) { PDC_LOG(("wins_wch() - called\n")); return wch ? winsch(win, *wch) : ERR; } int ins_wch(const cchar_t *wch) { PDC_LOG(("ins_wch() - called\n")); return wins_wch(stdscr, wch); } int mvins_wch(int y, int x, const cchar_t *wch) { PDC_LOG(("mvins_wch() - called\n")); if (move(y, x) == ERR) return ERR; return wins_wch(stdscr, wch); } int mvwins_wch(WINDOW *win, int y, int x, const cchar_t *wch) { PDC_LOG(("mvwins_wch() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return wins_wch(win, wch); } #endif curses-1.4.4/vendor/PDCurses/pdcurses/scr_dump.c0000644000004100000410000001205214201713275021653 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** scr_dump -------- ### Synopsis int putwin(WINDOW *win, FILE *filep); WINDOW *getwin(FILE *filep); int scr_dump(const char *filename); int scr_init(const char *filename); int scr_restore(const char *filename); int scr_set(const char *filename); ### Description getwin() reads window-related data previously stored in a file by putwin(). It then creates and initialises a new window using that data. putwin() writes all data associated with a window into a file, using an unspecified format. This information can be retrieved later using getwin(). scr_dump() writes the current contents of the virtual screen to the file named by filename in an unspecified format. scr_restore() function sets the virtual screen to the contents of the file named by filename, which must have been written using scr_dump(). The next refresh operation restores the screen to the way it looked in the dump file. In PDCurses, scr_init() does nothing, and scr_set() is a synonym for scr_restore(). Also, scr_dump() and scr_restore() save and load from curscr. This differs from some other implementations, where scr_init() works with curscr, and scr_restore() works with newscr; but the effect should be the same. (PDCurses has no newscr.) ### Return Value On successful completion, getwin() returns a pointer to the window it created. Otherwise, it returns a null pointer. Other functions return OK or ERR. ### Portability X/Open BSD SYS V putwin Y getwin Y scr_dump Y scr_init Y scr_restore Y scr_set Y **man-end****************************************************************/ #include #include #define DUMPVER 1 /* Should be updated whenever the WINDOW struct is changed */ int putwin(WINDOW *win, FILE *filep) { static const char *marker = "PDC"; static const unsigned char version = DUMPVER; PDC_LOG(("putwin() - called\n")); /* write the marker and the WINDOW struct */ if (filep && fwrite(marker, strlen(marker), 1, filep) && fwrite(&version, 1, 1, filep) && fwrite(win, sizeof(WINDOW), 1, filep)) { int i; /* write each line */ for (i = 0; i < win->_maxy && win->_y[i]; i++) if (!fwrite(win->_y[i], win->_maxx * sizeof(chtype), 1, filep)) return ERR; return OK; } return ERR; } WINDOW *getwin(FILE *filep) { WINDOW *win; char marker[4]; int i, nlines, ncols; PDC_LOG(("getwin() - called\n")); if ( !(win = malloc(sizeof(WINDOW))) ) return (WINDOW *)NULL; /* check for the marker, and load the WINDOW struct */ if (!filep || !fread(marker, 4, 1, filep) || strncmp(marker, "PDC", 3) || marker[3] != DUMPVER || !fread(win, sizeof(WINDOW), 1, filep)) { free(win); return (WINDOW *)NULL; } nlines = win->_maxy; ncols = win->_maxx; /* allocate the line pointer array */ if ( !(win->_y = malloc(nlines * sizeof(chtype *))) ) { free(win); return (WINDOW *)NULL; } /* allocate the minchng and maxchng arrays */ if ( !(win->_firstch = malloc(nlines * sizeof(int))) ) { free(win->_y); free(win); return (WINDOW *)NULL; } if ( !(win->_lastch = malloc(nlines * sizeof(int))) ) { free(win->_firstch); free(win->_y); free(win); return (WINDOW *)NULL; } /* allocate the lines */ if ( !(win = PDC_makelines(win)) ) return (WINDOW *)NULL; /* read them */ for (i = 0; i < nlines; i++) { if (!fread(win->_y[i], ncols * sizeof(chtype), 1, filep)) { delwin(win); return (WINDOW *)NULL; } } touchwin(win); return win; } int scr_dump(const char *filename) { FILE *filep; PDC_LOG(("scr_dump() - called: filename %s\n", filename)); if (filename && (filep = fopen(filename, "wb")) != NULL) { int result = putwin(curscr, filep); fclose(filep); return result; } return ERR; } int scr_init(const char *filename) { PDC_LOG(("scr_init() - called: filename %s\n", filename)); return OK; } int scr_restore(const char *filename) { FILE *filep; PDC_LOG(("scr_restore() - called: filename %s\n", filename)); if (filename && (filep = fopen(filename, "rb")) != NULL) { WINDOW *replacement = getwin(filep); fclose(filep); if (replacement) { int result = overwrite(replacement, curscr); delwin(replacement); return result; } } return ERR; } int scr_set(const char *filename) { PDC_LOG(("scr_set() - called: filename %s\n", filename)); return scr_restore(filename); } curses-1.4.4/vendor/PDCurses/pdcurses/getyx.c0000644000004100000410000000732514201713275021206 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** getyx ----- ### Synopsis void getyx(WINDOW *win, int y, int x); void getparyx(WINDOW *win, int y, int x); void getbegyx(WINDOW *win, int y, int x); void getmaxyx(WINDOW *win, int y, int x); void getsyx(int y, int x); void setsyx(int y, int x); int getbegy(WINDOW *win); int getbegx(WINDOW *win); int getcury(WINDOW *win); int getcurx(WINDOW *win); int getpary(WINDOW *win); int getparx(WINDOW *win); int getmaxy(WINDOW *win); int getmaxx(WINDOW *win); ### Description The getyx() macro (defined in curses.h -- the prototypes here are merely illustrative) puts the current cursor position of the specified window into y and x. getbegyx() and getmaxyx() return the starting coordinates and size of the specified window, respectively. getparyx() returns the starting coordinates of the parent's window, if the specified window is a subwindow; otherwise it sets y and x to -1. These are all macros. getsyx() gets the coordinates of the virtual screen cursor, and stores them in y and x. If leaveok() is TRUE, it returns -1, -1. If lines have been removed with ripoffline(), then getsyx() includes these lines in its count; so, the returned y and x values should only be used with setsyx(). setsyx() sets the virtual screen cursor to the y, x coordinates. If either y or x is -1, leaveok() is set TRUE, else it's set FALSE. getsyx() and setsyx() are meant to be used by a library routine that manipulates curses windows without altering the position of the cursor. Note that getsyx() is defined only as a macro. getbegy(), getbegx(), getcurx(), getcury(), getmaxy(), getmaxx(), getpary(), and getparx() return the appropriate coordinate or size values, or ERR in the case of a NULL window. ### Portability X/Open BSD SYS V getyx Y Y Y getparyx - - 4.0 getbegyx - - 3.0 getmaxyx - - 3.0 getsyx - - 3.0 setsyx - - 3.0 getbegy - - - getbegx - - - getcury - - - getcurx - - - getpary - - - getparx - - - getmaxy - - - getmaxx - - - **man-end****************************************************************/ int getbegy(WINDOW *win) { PDC_LOG(("getbegy() - called\n")); return win ? win->_begy : ERR; } int getbegx(WINDOW *win) { PDC_LOG(("getbegx() - called\n")); return win ? win->_begx : ERR; } int getcury(WINDOW *win) { PDC_LOG(("getcury() - called\n")); return win ? win->_cury : ERR; } int getcurx(WINDOW *win) { PDC_LOG(("getcurx() - called\n")); return win ? win->_curx : ERR; } int getpary(WINDOW *win) { PDC_LOG(("getpary() - called\n")); return win ? win->_pary : ERR; } int getparx(WINDOW *win) { PDC_LOG(("getparx() - called\n")); return win ? win->_parx : ERR; } int getmaxy(WINDOW *win) { PDC_LOG(("getmaxy() - called\n")); return win ? win->_maxy : ERR; } int getmaxx(WINDOW *win) { PDC_LOG(("getmaxx() - called\n")); return win ? win->_maxx : ERR; } void setsyx(int y, int x) { PDC_LOG(("setsyx() - called\n")); curscr->_leaveit = y == -1 || x == -1; if (!curscr->_leaveit) wmove(curscr, y, x); } curses-1.4.4/vendor/PDCurses/pdcurses/debug.c0000644000004100000410000000514214201713275021127 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** debug ----- ### Synopsis void traceon(void); void traceoff(void); void PDC_debug(const char *, ...); ### Description traceon() and traceoff() toggle the recording of debugging information to the file "trace". Although not standard, similar functions are in some other curses implementations. PDC_debug() is the function that writes to the file, based on whether traceon() has been called. It's used from the PDC_LOG() macro. The environment variable PDC_TRACE_FLUSH controls whether the trace file contents are fflushed after each write. The default is not. Set it to 1 to enable this (may affect performance). ### Portability X/Open BSD SYS V traceon - - - traceoff - - - PDC_debug - - - **man-end****************************************************************/ #include #include #include #include FILE *pdc_dbfp = NULL; static bool trace_on = FALSE; static bool want_fflush = FALSE; void PDC_debug(const char *fmt, ...) { va_list args; char hms[9]; time_t now; if( !trace_on) return; if (!pdc_dbfp) { pdc_dbfp = fopen("trace", "a"); if (!pdc_dbfp) { fprintf(stderr, "PDC_debug(): Unable to open debug log file\n"); return; } } time(&now); strftime(hms, 9, "%H:%M:%S", localtime(&now)); fprintf(pdc_dbfp, "At: %8.8ld - %s ", (long) clock(), hms); va_start(args, fmt); vfprintf(pdc_dbfp, fmt, args); va_end(args); /* If you are crashing and losing debugging information, enable this * by setting the environment variable PDC_TRACE_FLUSH to 1. This may * impact performance. */ if (want_fflush) fflush(pdc_dbfp); /* If with PDC_TRACE_FLUSH enabled you are still losing logging in * crashes, you may need to add a platform-dependent mechanism to flush * the OS buffers as well (such as fsync() on POSIX) -- but expect * terrible performance. */ } void traceon(void) { char *env; trace_on = TRUE; if ((env = getenv("PDC_TRACE_FLUSH"))) want_fflush = atoi(env); PDC_LOG(("traceon() - called\n")); } void traceoff(void) { if (!pdc_dbfp) return; PDC_LOG(("traceoff() - called\n")); fclose(pdc_dbfp); pdc_dbfp = NULL; want_fflush = trace_on = FALSE; } curses-1.4.4/vendor/PDCurses/pdcurses/color.c0000644000004100000410000001765214201713275021170 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** color ----- ### Synopsis int start_color(void); int init_pair(short pair, short fg, short bg); int init_color(short color, short red, short green, short blue); bool has_colors(void); bool can_change_color(void); int color_content(short color, short *red, short *green, short *blue); int pair_content(short pair, short *fg, short *bg); int assume_default_colors(int f, int b); int use_default_colors(void); int PDC_set_line_color(short color); ### Description To use these routines, start_color() must be called, usually immediately after initscr(). Colors are always used in pairs, referred to as color-pairs. A color-pair consists of a foreground color and a background color. A color-pair is initialized via init_pair(). After initialization, COLOR_PAIR(n) can be used like any other video attribute. start_color() initializes eight basic colors (black, red, green, yellow, blue, magenta, cyan, and white), and two global variables; COLORS and COLOR_PAIRS (respectively defining the maximum number of colors and color-pairs the terminal is capable of displaying). init_pair() changes the definition of a color-pair. It takes three arguments: the number of the color-pair to be redefined, and the new values of the foreground and background colors. The pair number must be between 0 and COLOR_PAIRS - 1, inclusive. The foreground and background must be between 0 and COLORS - 1, inclusive. If the color pair was previously initialized, the screen is refreshed, and all occurrences of that color-pair are changed to the new definition. has_colors() indicates if the terminal supports, and can maniplulate color. It returns TRUE or FALSE. can_change_color() indicates if the terminal has the capability to change the definition of its colors. pair_content() is used to determine what the colors of a given color-pair consist of. assume_default_colors() and use_default_colors() emulate the ncurses extensions of the same names. assume_default_colors(f, b) is essentially the same as init_pair(0, f, b) (which isn't allowed); it redefines the default colors. use_default_colors() allows the use of -1 as a foreground or background color with init_pair(), and calls assume_default_colors(-1, -1); -1 represents the foreground or background color that the terminal had at startup. If the environment variable PDC_ORIGINAL_COLORS is set at the time start_color() is called, that's equivalent to calling use_default_colors(). PDC_set_line_color() is used to set the color, globally, for the color of the lines drawn for the attributes: A_UNDERLINE, A_OVERLINE, A_LEFTLINE and A_RIGHTLINE. A value of -1 (the default) indicates that the current foreground color should be used. NOTE: COLOR_PAIR() and PAIR_NUMBER() are implemented as macros. ### Return Value All functions return OK on success and ERR on error, except for has_colors() and can_change_colors(), which return TRUE or FALSE. ### Portability X/Open BSD SYS V start_color Y - 3.2 init_pair Y - 3.2 init_color Y - 3.2 has_colors Y - 3.2 can_change_color Y - 3.2 color_content Y - 3.2 pair_content Y - 3.2 assume_default_colors - - - use_default_colors - - - PDC_set_line_color - - - **man-end****************************************************************/ #include #include int COLORS = 0; int COLOR_PAIRS = PDC_COLOR_PAIRS; bool pdc_color_started = FALSE; /* pair_set[] tracks whether a pair has been set via init_pair() */ static bool pair_set[PDC_COLOR_PAIRS]; static bool default_colors = FALSE; static short first_col = 0; int start_color(void) { PDC_LOG(("start_color() - called\n")); if (SP->mono) return ERR; pdc_color_started = TRUE; PDC_set_blink(FALSE); /* Also sets COLORS, to 8 or 16 */ if (!default_colors && SP->orig_attr && getenv("PDC_ORIGINAL_COLORS")) default_colors = TRUE; PDC_init_atrtab(); memset(pair_set, 0, PDC_COLOR_PAIRS); return OK; } static void _normalize(short *fg, short *bg) { if (*fg == -1) *fg = SP->orig_attr ? SP->orig_fore : COLOR_WHITE; if (*bg == -1) *bg = SP->orig_attr ? SP->orig_back : COLOR_BLACK; } int init_pair(short pair, short fg, short bg) { PDC_LOG(("init_pair() - called: pair %d fg %d bg %d\n", pair, fg, bg)); if (!pdc_color_started || pair < 1 || pair >= COLOR_PAIRS || fg < first_col || fg >= COLORS || bg < first_col || bg >= COLORS) return ERR; _normalize(&fg, &bg); /* To allow the PDC_PRESERVE_SCREEN option to work, we only reset curscr if this call to init_pair() alters a color pair created by the user. */ if (pair_set[pair]) { short oldfg, oldbg; PDC_pair_content(pair, &oldfg, &oldbg); if (oldfg != fg || oldbg != bg) curscr->_clear = TRUE; } PDC_init_pair(pair, fg, bg); pair_set[pair] = TRUE; return OK; } bool has_colors(void) { PDC_LOG(("has_colors() - called\n")); return !(SP->mono); } int init_color(short color, short red, short green, short blue) { PDC_LOG(("init_color() - called\n")); if (color < 0 || color >= COLORS || !PDC_can_change_color() || red < 0 || red > 1000 || green < 0 || green > 1000 || blue < 0 || blue > 1000) return ERR; return PDC_init_color(color, red, green, blue); } int color_content(short color, short *red, short *green, short *blue) { PDC_LOG(("color_content() - called\n")); if (color < 0 || color >= COLORS || !red || !green || !blue) return ERR; if (PDC_can_change_color()) return PDC_color_content(color, red, green, blue); else { /* Simulated values for platforms that don't support palette changing */ short maxval = (color & 8) ? 1000 : 680; *red = (color & COLOR_RED) ? maxval : 0; *green = (color & COLOR_GREEN) ? maxval : 0; *blue = (color & COLOR_BLUE) ? maxval : 0; return OK; } } bool can_change_color(void) { PDC_LOG(("can_change_color() - called\n")); return PDC_can_change_color(); } int pair_content(short pair, short *fg, short *bg) { PDC_LOG(("pair_content() - called\n")); if (pair < 0 || pair >= COLOR_PAIRS || !fg || !bg) return ERR; return PDC_pair_content(pair, fg, bg); } int assume_default_colors(int f, int b) { PDC_LOG(("assume_default_colors() - called: f %d b %d\n", f, b)); if (f < -1 || f >= COLORS || b < -1 || b >= COLORS) return ERR; if (pdc_color_started) { short fg, bg, oldfg, oldbg; fg = f; bg = b; _normalize(&fg, &bg); PDC_pair_content(0, &oldfg, &oldbg); if (oldfg != fg || oldbg != bg) curscr->_clear = TRUE; PDC_init_pair(0, fg, bg); } return OK; } int use_default_colors(void) { PDC_LOG(("use_default_colors() - called\n")); default_colors = TRUE; first_col = -1; return assume_default_colors(-1, -1); } int PDC_set_line_color(short color) { PDC_LOG(("PDC_set_line_color() - called: %d\n", color)); if (color < -1 || color >= COLORS) return ERR; SP->line_color = color; return OK; } void PDC_init_atrtab(void) { int i; short fg, bg; if (pdc_color_started && !default_colors) { fg = COLOR_WHITE; bg = COLOR_BLACK; } else fg = bg = -1; _normalize(&fg, &bg); for (i = 0; i < PDC_COLOR_PAIRS; i++) PDC_init_pair( (short)i, fg, bg); } curses-1.4.4/vendor/PDCurses/pdcurses/kernel.c0000644000004100000410000001366514201713275021332 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** kernel ------ ### Synopsis int def_prog_mode(void); int def_shell_mode(void); int reset_prog_mode(void); int reset_shell_mode(void); int resetty(void); int savetty(void); int ripoffline(int line, int (*init)(WINDOW *, int)); int curs_set(int visibility); int napms(int ms); int draino(int ms); int resetterm(void); int fixterm(void); int saveterm(void); ### Description def_prog_mode() and def_shell_mode() save the current terminal modes as the "program" (in curses) or "shell" (not in curses) state for use by the reset_prog_mode() and reset_shell_mode() functions. This is done automatically by initscr(). reset_prog_mode() and reset_shell_mode() restore the terminal to "program" (in curses) or "shell" (not in curses) state. These are done automatically by endwin() and doupdate() after an endwin(), so they would normally not be called before these functions. savetty() and resetty() save and restore the state of the terminal modes. savetty() saves the current state in a buffer, and resetty() restores the state to what it was at the last call to savetty(). curs_set() alters the appearance of the cursor. A visibility of 0 makes it disappear; 1 makes it appear "normal" (usually an underline) and 2 makes it "highly visible" (usually a block). ripoffline() reduces the size of stdscr by one line. If the "line" parameter is positive, the line is removed from the top of the screen; if negative, from the bottom. Up to 5 lines can be ripped off stdscr by calling ripoffline() repeatedly. The function argument, init, is called from within initscr() or newterm(), so ripoffline() must be called before either of these functions. The init function receives a pointer to a one-line WINDOW, and the width of the window. Calling ripoffline() with a NULL init function pointer is an error. napms() suspends the program for the specified number of milliseconds. draino() is an archaic equivalent. resetterm(), fixterm() and saveterm() are archaic equivalents for reset_shell_mode(), reset_prog_mode() and def_prog_mode(), respectively. ### Return Value All functions return OK on success and ERR on error, except curs_set(), which returns the previous visibility. ### Portability X/Open BSD SYS V def_prog_mode Y Y Y def_shell_mode Y Y Y reset_prog_mode Y Y Y reset_shell_mode Y Y Y resetty Y Y Y savetty Y Y Y ripoffline Y - 3.0 curs_set Y - 3.0 napms Y Y Y draino - resetterm - fixterm - saveterm - **man-end****************************************************************/ #include RIPPEDOFFLINE linesripped[5]; char linesrippedoff = 0; static struct cttyset { bool been_set; SCREEN saved; } ctty[3]; enum { PDC_SH_TTY, PDC_PR_TTY, PDC_SAVE_TTY }; static void _save_mode(int i) { ctty[i].been_set = TRUE; memcpy(&(ctty[i].saved), SP, sizeof(SCREEN)); PDC_save_screen_mode(i); } static int _restore_mode(int i) { if (ctty[i].been_set == TRUE) { memcpy(SP, &(ctty[i].saved), sizeof(SCREEN)); if (ctty[i].saved.raw_out) raw(); PDC_restore_screen_mode(i); if ((LINES != ctty[i].saved.lines) || (COLS != ctty[i].saved.cols)) resize_term(ctty[i].saved.lines, ctty[i].saved.cols); PDC_curs_set(ctty[i].saved.visibility); PDC_gotoyx(ctty[i].saved.cursrow, ctty[i].saved.curscol); } return ctty[i].been_set ? OK : ERR; } int def_prog_mode(void) { PDC_LOG(("def_prog_mode() - called\n")); _save_mode(PDC_PR_TTY); return OK; } int def_shell_mode(void) { PDC_LOG(("def_shell_mode() - called\n")); _save_mode(PDC_SH_TTY); return OK; } int reset_prog_mode(void) { PDC_LOG(("reset_prog_mode() - called\n")); _restore_mode(PDC_PR_TTY); PDC_reset_prog_mode(); return OK; } int reset_shell_mode(void) { PDC_LOG(("reset_shell_mode() - called\n")); _restore_mode(PDC_SH_TTY); PDC_reset_shell_mode(); return OK; } int resetty(void) { PDC_LOG(("resetty() - called\n")); return _restore_mode(PDC_SAVE_TTY); } int savetty(void) { PDC_LOG(("savetty() - called\n")); _save_mode(PDC_SAVE_TTY); return OK; } int curs_set(int visibility) { int ret_vis; PDC_LOG(("curs_set() - called: visibility=%d\n", visibility)); if ((visibility < 0) || (visibility > 0x10000)) return ERR; ret_vis = PDC_curs_set(visibility); /* If the cursor is changing from invisible to visible, update its position */ if (visibility && !ret_vis) PDC_gotoyx(SP->cursrow, SP->curscol); return ret_vis; } int napms(int ms) { PDC_LOG(("napms() - called: ms=%d\n", ms)); if (ms) PDC_napms(ms); return OK; } int ripoffline(int line, int (*init)(WINDOW *, int)) { PDC_LOG(("ripoffline() - called: line=%d\n", line)); if (linesrippedoff < 5 && line && init) { linesripped[(int)linesrippedoff].line = line; linesripped[(int)linesrippedoff++].init = init; return OK; } return ERR; } int draino(int ms) { PDC_LOG(("draino() - called\n")); return napms(ms); } int resetterm(void) { PDC_LOG(("resetterm() - called\n")); return reset_shell_mode(); } int fixterm(void) { PDC_LOG(("fixterm() - called\n")); return reset_prog_mode(); } int saveterm(void) { PDC_LOG(("saveterm() - called\n")); return def_prog_mode(); } curses-1.4.4/vendor/PDCurses/pdcurses/insstr.c0000644000004100000410000001426414201713275021370 0ustar www-datawww-data/* Public Domain Curses */ #include /*man-start************************************************************** insstr ------ ### Synopsis int insstr(const char *str); int insnstr(const char *str, int n); int winsstr(WINDOW *win, const char *str); int winsnstr(WINDOW *win, const char *str, int n); int mvinsstr(int y, int x, const char *str); int mvinsnstr(int y, int x, const char *str, int n); int mvwinsstr(WINDOW *win, int y, int x, const char *str); int mvwinsnstr(WINDOW *win, int y, int x, const char *str, int n); int ins_wstr(const wchar_t *wstr); int ins_nwstr(const wchar_t *wstr, int n); int wins_wstr(WINDOW *win, const wchar_t *wstr); int wins_nwstr(WINDOW *win, const wchar_t *wstr, int n); int mvins_wstr(int y, int x, const wchar_t *wstr); int mvins_nwstr(int y, int x, const wchar_t *wstr, int n); int mvwins_wstr(WINDOW *win, int y, int x, const wchar_t *wstr); int mvwins_nwstr(WINDOW *win, int y, int x, const wchar_t *wstr, int n); ### Description The insstr() functions insert a character string into a window at the current cursor position, by repeatedly calling winsch(). When PDCurses is built with wide-character support enabled, the narrow-character functions treat the string as a multibyte string in the current locale, and convert it first. All characters to the right of the cursor are moved to the right, with the possibility of the rightmost characters on the line being lost. The cursor position does not change (after moving to y, x, if specified). The routines with n as the last argument insert at most n characters; if n is negative, then the entire string is inserted. ### Return Value All functions return OK on success and ERR on error. ### Portability X/Open BSD SYS V insstr Y - 4.0 winsstr Y - 4.0 mvinsstr Y - 4.0 mvwinsstr Y - 4.0 insnstr Y - 4.0 winsnstr Y - 4.0 mvinsnstr Y - 4.0 mvwinsnstr Y - 4.0 ins_wstr Y wins_wstr Y mvins_wstr Y mvwins_wstr Y ins_nwstr Y wins_nwstr Y mvins_nwstr Y mvwins_nwstr Y **man-end****************************************************************/ #include int winsnstr(WINDOW *win, const char *str, int n) { #ifdef PDC_WIDE wchar_t wstr[513], *p; int i; #endif int len; PDC_LOG(("winsnstr() - called: string=\"%s\" n %d \n", str, n)); if (!win || !str) return ERR; len = (int)strlen(str); if (n < 0 || n < len) n = len; #ifdef PDC_WIDE if (n > 512) n = 512; p = wstr; i = 0; while (str[i] && i < n) { int retval = PDC_mbtowc(p, str + i, n - i); if (retval <= 0) break; p++; i += retval; } while (p > wstr) if (winsch(win, *--p) == ERR) #else while (n) if (winsch(win, (unsigned char)(str[--n])) == ERR) #endif return ERR; return OK; } int insstr(const char *str) { PDC_LOG(("insstr() - called: string=\"%s\"\n", str)); return winsnstr(stdscr, str, -1); } int winsstr(WINDOW *win, const char *str) { PDC_LOG(("winsstr() - called: string=\"%s\"\n", str)); return winsnstr(win, str, -1); } int mvinsstr(int y, int x, const char *str) { PDC_LOG(("mvinsstr() - called: y %d x %d string=\"%s\"\n", y, x, str)); if (move(y, x) == ERR) return ERR; return winsnstr(stdscr, str, -1); } int mvwinsstr(WINDOW *win, int y, int x, const char *str) { PDC_LOG(("mvwinsstr() - called: string=\"%s\"\n", str)); if (wmove(win, y, x) == ERR) return ERR; return winsnstr(win, str, -1); } int insnstr(const char *str, int n) { PDC_LOG(("insnstr() - called: string=\"%s\" n %d \n", str, n)); return winsnstr(stdscr, str, n); } int mvinsnstr(int y, int x, const char *str, int n) { PDC_LOG(("mvinsnstr() - called: y %d x %d string=\"%s\" n %d \n", y, x, str, n)); if (move(y, x) == ERR) return ERR; return winsnstr(stdscr, str, n); } int mvwinsnstr(WINDOW *win, int y, int x, const char *str, int n) { PDC_LOG(("mvwinsnstr() - called: y %d x %d string=\"%s\" n %d \n", y, x, str, n)); if (wmove(win, y, x) == ERR) return ERR; return winsnstr(win, str, n); } #ifdef PDC_WIDE int wins_nwstr(WINDOW *win, const wchar_t *wstr, int n) { const wchar_t *p; int len; PDC_LOG(("wins_nwstr() - called\n")); if (!win || !wstr) return ERR; for (len = 0, p = wstr; *p; p++) len++; if (n < 0 || n < len) n = len; while (n) if (winsch(win, wstr[--n]) == ERR) return ERR; return OK; } int ins_wstr(const wchar_t *wstr) { PDC_LOG(("ins_wstr() - called\n")); return wins_nwstr(stdscr, wstr, -1); } int wins_wstr(WINDOW *win, const wchar_t *wstr) { PDC_LOG(("wins_wstr() - called\n")); return wins_nwstr(win, wstr, -1); } int mvins_wstr(int y, int x, const wchar_t *wstr) { PDC_LOG(("mvins_wstr() - called\n")); if (move(y, x) == ERR) return ERR; return wins_nwstr(stdscr, wstr, -1); } int mvwins_wstr(WINDOW *win, int y, int x, const wchar_t *wstr) { PDC_LOG(("mvwinsstr() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return wins_nwstr(win, wstr, -1); } int ins_nwstr(const wchar_t *wstr, int n) { PDC_LOG(("ins_nwstr() - called\n")); return wins_nwstr(stdscr, wstr, n); } int mvins_nwstr(int y, int x, const wchar_t *wstr, int n) { PDC_LOG(("mvinsnstr() - called\n")); if (move(y, x) == ERR) return ERR; return wins_nwstr(stdscr, wstr, n); } int mvwins_nwstr(WINDOW *win, int y, int x, const wchar_t *wstr, int n) { PDC_LOG(("mvwinsnstr() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return wins_nwstr(win, wstr, n); } #endif curses-1.4.4/vendor/PDCurses/appveyor.yml0000644000004100000410000002420114201713275020432 0ustar www-datawww-dataversion: 4.0.2.{build} shallow_clone: true clone_depth: 1 configuration: #- MinSizeRel // https://bugzilla.libsdl.org/show_bug.cgi?id=4233 - Release - Debug environment: DIST_DIR: '%APPVEYOR_BUILD_FOLDER%\dist' WATCOM: C:\Tools\watcom matrix: - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017' TOOLCHAIN: Watcom20 TARGET: os2 ARCHIVE: WATCOM20_%CONFIGURATION%_OS2V2_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'Watcom WMake' CMAKE_TOOLCHAIN_ARGS: '-DCMAKE_TOOLCHAIN_FILE=..\cmake\watcom_open_os2v2_toolchain.cmake' CMAKE_ARGS: '-DPDC_OS2_BUILD=ON -DPDC_BUILD_SHARED=OFF -DPDC_SDL2_BUILD=OFF -DPDC_SDL2_DEPS_BUILD=OFF' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017' TOOLCHAIN: Watcom19 TARGET: dos ARCHIVE: WATCOM19_%CONFIGURATION%_DOS16_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'Watcom WMake' CMAKE_TOOLCHAIN_ARGS: '-DCMAKE_TOOLCHAIN_FILE=..\cmake\watcom_open_dos16_toolchain.cmake' CMAKE_ARGS: '-DPDC_DOS_BUILD=ON -DPDC_BUILD_SHARED=OFF -DPDC_SDL2_BUILD=OFF -DPDC_SDL2_DEPS_BUILD=OFF' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017' TOOLCHAIN: Watcom19 TARGET: dos ARCHIVE: WATCOM19_%CONFIGURATION%_DOS32_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'Watcom WMake' CMAKE_TOOLCHAIN_ARGS: '-DCMAKE_TOOLCHAIN_FILE=..\cmake\watcom_open_dos32_toolchain.cmake' CMAKE_ARGS: '-DPDC_DOS_BUILD=ON -DPDC_BUILD_SHARED=OFF -DPDC_SDL2_BUILD=OFF -DPDC_SDL2_DEPS_BUILD=OFF' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017' TOOLCHAIN: Watcom20 TARGET: dos ARCHIVE: WATCOM20_%CONFIGURATION%_DOS16_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'Watcom WMake' CMAKE_TOOLCHAIN_ARGS: '-DCMAKE_TOOLCHAIN_FILE=..\cmake\watcom_open_dos16_toolchain.cmake' CMAKE_ARGS: '-DPDC_DOS_BUILD=ON -DPDC_BUILD_SHARED=OFF -DPDC_SDL2_BUILD=OFF -DPDC_SDL2_DEPS_BUILD=OFF' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017' TOOLCHAIN: Watcom20 TARGET: dos ARCHIVE: WATCOM20_%CONFIGURATION%_DOS32_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'Watcom WMake' CMAKE_TOOLCHAIN_ARGS: '-DCMAKE_TOOLCHAIN_FILE=..\cmake\watcom_open_dos32_toolchain.cmake' CMAKE_ARGS: '-DPDC_DOS_BUILD=ON -DPDC_BUILD_SHARED=OFF -DPDC_SDL2_BUILD=OFF -DPDC_SDL2_DEPS_BUILD=OFF' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' VCVARSALL: '%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat' ARCHITECTURE: amd64_x86 ARCHIVE: VS2015_%CONFIGURATION%_WIDE_x86_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'NMake Makefiles' CMAKE_ARGS: '-DPDC_WIDE=ON -DPDC_UTF8=OFF -DPDC_SDL2_BUILD=ON -DPDC_SDL2_DEPS_BUILD=ON' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' VCVARSALL: '%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat' ARCHITECTURE: amd64_x86 ARCHIVE: VS2015_%CONFIGURATION%_UTF8_x86_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'NMake Makefiles' CMAKE_ARGS: '-DPDC_WIDE=OFF -DPDC_UTF8=ON -DPDC_SDL2_BUILD=ON -DPDC_SDL2_DEPS_BUILD=ON' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' VCVARSALL: '%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat' ARCHITECTURE: amd64 ARCHIVE: VS2015_%CONFIGURATION%_WIDE_x64_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'NMake Makefiles' CMAKE_ARGS: '-DPDC_WIDE=ON -DPDC_UTF8=OFF -DPDC_SDL2_BUILD=ON -DPDC_SDL2_DEPS_BUILD=ON' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' VCVARSALL: '%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat' ARCHITECTURE: amd64 ARCHIVE: VS2015_%CONFIGURATION%_UTF8_x64_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'NMake Makefiles' CMAKE_ARGS: '-DPDC_WIDE=OFF -DPDC_UTF8=ON -DPDC_SDL2_BUILD=ON -DPDC_SDL2_DEPS_BUILD=ON' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' VCVARSALL: '%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat' ARCHITECTURE: amd64_arm ARCHIVE: VS2015_%CONFIGURATION%_WIDE_ARM_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'NMake Makefiles' CMAKE_ARGS: '-DPDC_WIDE=ON -DPDC_UTF8=OFF -DPDC_SDL2_BUILD=OFF -DPDC_SDL2_DEPS_BUILD=OFF' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' VCVARSALL: '%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat' ARCHITECTURE: amd64_arm ARCHIVE: VS2015_%CONFIGURATION%_UTF8_ARM_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'NMake Makefiles' CMAKE_ARGS: '-DPDC_WIDE=OFF -DPDC_UTF8=ON -DPDC_SDL2_BUILD=OFF -DPDC_SDL2_DEPS_BUILD=OFF' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017' VCVARSALL: '%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsamd64_arm.bat' ARCHITECTURE: amd64_arm ARCHIVE: VS2017_%CONFIGURATION%_WIDE_ARM_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'NMake Makefiles' CMAKE_ARGS: '-DPDC_WIDE=ON -DPDC_UTF8=OFF -DPDC_SDL2_BUILD=OFF -DPDC_SDL2_DEPS_BUILD=OFF' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017' VCVARSALL: '%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsamd64_arm.bat' ARCHITECTURE: amd64_arm ARCHIVE: VS2017_%CONFIGURATION%_UTF8_ARM_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'NMake Makefiles' CMAKE_ARGS: '-DPDC_WIDE=OFF -DPDC_UTF8=ON -DPDC_SDL2_BUILD=OFF -DPDC_SDL2_DEPS_BUILD=OFF' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017' VCVARSALL: '%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat' ARCHITECTURE: amd64_arm64 ARCHIVE: VS2017_%CONFIGURATION%_WIDE_ARM64_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'NMake Makefiles' CMAKE_ARGS: '-DPDC_WIDE=ON -DPDC_UTF8=OFF -DPDC_SDL2_BUILD=OFF -DPDC_SDL2_DEPS_BUILD=OFF' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017' VCVARSALL: '%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat' ARCHITECTURE: amd64_arm64 ARCHIVE: VS2017_%CONFIGURATION%_UTF8_ARM64_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'NMake Makefiles' CMAKE_ARGS: '-DPDC_WIDE=OFF -DPDC_UTF8=ON -DPDC_SDL2_BUILD=OFF -DPDC_SDL2_DEPS_BUILD=OFF' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017' VCVARSALL: '%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat' ARCHITECTURE: amd64_x86 ARCHIVE: VS2017_%CONFIGURATION%_WIDE_x86_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'NMake Makefiles' CMAKE_ARGS: '-DPDC_WIDE=ON -DPDC_UTF8=OFF -DPDC_SDL2_BUILD=ON -DPDC_SDL2_DEPS_BUILD=ON' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017' VCVARSALL: '%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat' ARCHITECTURE: amd64_x86 ARCHIVE: VS2017_%CONFIGURATION%_UTF8_x86_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'NMake Makefiles' CMAKE_ARGS: '-DPDC_WIDE=OFF -DPDC_UTF8=ON -DPDC_SDL2_BUILD=ON -DPDC_SDL2_DEPS_BUILD=ON' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017' VCVARSALL: '%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat' ARCHITECTURE: amd64 ARCHIVE: VS2017_%CONFIGURATION%_WIDE_x64_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'NMake Makefiles' CMAKE_ARGS: '-DPDC_WIDE=ON -DPDC_UTF8=OFF -DPDC_SDL2_BUILD=ON -DPDC_SDL2_DEPS_BUILD=ON' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017' VCVARSALL: '%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat' ARCHITECTURE: amd64 ARCHIVE: VS2017_%CONFIGURATION%_UTF8_x64_%APPVEYOR_BUILD_NUMBER% GENERATOR: 'NMake Makefiles' CMAKE_ARGS: '-DPDC_WIDE=OFF -DPDC_UTF8=ON -DPDC_SDL2_BUILD=ON -DPDC_SDL2_DEPS_BUILD=ON' init: - echo BUILD_NUMBER=%APPVEYOR_BUILD_NUMBER% install: # Open Watcom - if "%TOOLCHAIN%"=="Watcom19" ( echo Installing Open Watcom 1.9 ) - if "%TOOLCHAIN%"=="Watcom19" ( cd %APPVEYOR_BUILD_FOLDER% ) - if "%TOOLCHAIN%"=="Watcom19" ( set "OPEN_WATCOM_URL=https://sourceforge.net/projects/openwatcom/files/open-watcom-1.9/open-watcom-c-win32-1.9.exe" ) - if "%TOOLCHAIN%"=="Watcom19" ( appveyor DownloadFile "%OPEN_WATCOM_URL%" -FileName open-watcom-c-win32-1.9.exe ) # todo - check the md5 here... - if "%TOOLCHAIN%"=="Watcom19" ( 7z x -y open-watcom-c-win32-1.9.exe -o"%WATCOM%" > nul ) - if "%TOOLCHAIN%"=="Watcom19" ( set "PATH=%WATCOM%\BINNT;%WATCOM%\BINW;%PATH%" ) - if "%TOOLCHAIN%"=="Watcom20" ( echo Installing Open Watcom 2.0 ) - if "%TOOLCHAIN%"=="Watcom20" ( cd %APPVEYOR_BUILD_FOLDER% ) - if "%TOOLCHAIN%"=="Watcom20" ( set "OPEN_WATCOM_URL=https://github.com/open-watcom/travis-ci-ow-builds/archive/master.zip" ) - if "%TOOLCHAIN%"=="Watcom20" ( appveyor DownloadFile "%OPEN_WATCOM_URL%" -FileName master.zip ) - if "%TOOLCHAIN%"=="Watcom20" ( 7z x -y master.zip -o"%WATCOM%" > nul ) # todo - check the md5 here... - if "%TOOLCHAIN%"=="Watcom20" ( set "WATCOM=%WATCOM%\travis-ci-ow-builds-master" ) - if "%TOOLCHAIN%"=="Watcom20" ( set "PATH=%WATCOM%\BINNT64;%WATCOM%\BINNT;%PATH%" ) # DOS BAT file - if "%TARGET%"=="dos" ( set "EDPATH=%WATCOM%\EDDAT" ) - if "%TARGET%"=="dos" ( set "INCLUDE=%WATCOM%\H;%WATCOM%\H\NT" ) # OS/2 CMD file - if "%TARGET%"=="os2" ( set "BEGINLIBPATH=%WATCOM%\BINP\DLL" ) - if "%TARGET%"=="os2" ( set "EDPATH=%WATCOM%\EDDAT" ) - if "%TARGET%"=="os2" ( set "INCLUDE=%WATCOM%\H;%WATCOM%\H\OS2" ) - cmake --version build: parallel: true build_script: - if exist "%VCVARSALL%" ( call "%VCVARSALL%" %ARCHITECTURE% ) - if "%CONFIGURATION%"=="Debug" ( set PDCDEBUG=ON ) else ( set PDCDEBUG=OFF ) - if "%CONFIGURATION%"=="Debug" ( set PDCDEBUG=ON ) else ( set PDCDEBUG=OFF ) - cd %APPVEYOR_BUILD_FOLDER% - mkdir build - cd build - cmake %CMAKE_TOOLCHAIN_ARGS% -G"%GENERATOR%" -DCMAKE_VERBOSE_MAKEFILE=TRUE -DCMAKE_BUILD_TYPE=%CONFIGURATION% "-DCMAKE_INSTALL_PREFIX=%DIST_DIR%\%APPVEYOR_BUILD_WORKER_IMAGE%" -DBUILD_NUMBER=%APPVEYOR_BUILD_NUMBER% -DPDCDEBUG=%PDCDEBUG% %CMAKE_ARGS% .. cmake --build . --config %CONFIGURATION% --target install after_build: - cd %DIST_DIR% - 7z a -tzip %ARCHIVE%.zip "%APPVEYOR_BUILD_WORKER_IMAGE%" - certutil -hashfile %ARCHIVE%.zip MD5 > %ARCHIVE%.md5 artifacts: - path: dist\$(ARCHIVE).zip - path: dist\$(ARCHIVE).md5 curses-1.4.4/vendor/PDCurses/makedist.mif0000644000004100000410000000133514201713275020343 0ustar www-datawww-data# Makefile include: build a binary archive with Info-ZIP # under DOS, OS/2 or Win32 dist: $(PDCLIBS) echo PDCurses $(VERDOT) for $(PLATFORM1) > file_id.diz echo ------------------------------------------ >> file_id.diz echo Public Domain Curses library for >> file_id.diz echo $(PLATFORM2). >> file_id.diz echo Source available in PDCURS$(VER).ZIP >> file_id.diz echo Public Domain. >> file_id.diz echo $(PDCURSES_SRCDIR)\README.md > flist echo $(PDCURSES_SRCDIR)\HISTORY.md >> flist echo $(PDCURSES_SRCDIR)\curses.h >> flist echo $(PDCURSES_SRCDIR)\panel.h >> flist echo $(PDCURSES_SRCDIR)\term.h >> flist echo $(LIBCURSES) >> flist echo file_id.diz >> flist zip -9jX $(ARCNAME) -@ DJGPP 1.x port was provided by David Nugent curses-1.4.4/vendor/PDCurses/dos/pdckbd.c0000644000004100000410000003262714201713275020235 0ustar www-datawww-data/* Public Domain Curses */ /* MS C doesn't return flags from int86() */ #ifdef MSC # define USE_KBHIT #endif #ifdef USE_KBHIT # include #endif #include "pdcdos.h" /*man-start************************************************************** pdckbd ------ ### Synopsis unsigned long PDC_get_input_fd(void); ### Description PDC_get_input_fd() returns the file descriptor that PDCurses reads its input from. It can be used for select(). ### Portability X/Open BSD SYS V PDC_get_input_fd - - - **man-end****************************************************************/ #ifdef __DJGPP__ # include # include # include #endif /************************************************************************ * Table for key code translation of function keys in keypad mode * * These values are for strict IBM keyboard compatibles only * ************************************************************************/ static short key_table[] = { -1, ALT_ESC, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ALT_BKSP, KEY_BTAB, ALT_Q, ALT_W, ALT_E, ALT_R, ALT_T, ALT_Y, ALT_U, ALT_I, ALT_O, ALT_P, ALT_LBRACKET, ALT_RBRACKET, ALT_ENTER, -1, ALT_A, ALT_S, ALT_D, ALT_F, ALT_G, ALT_H, ALT_J, ALT_K, ALT_L, ALT_SEMICOLON, ALT_FQUOTE, ALT_BQUOTE, -1, ALT_BSLASH, ALT_Z, ALT_X, ALT_C, ALT_V, ALT_B, ALT_N, ALT_M, ALT_COMMA, ALT_STOP, ALT_FSLASH, -1, ALT_PADSTAR, -1, -1, -1, KEY_F(1), KEY_F(2), KEY_F(3), KEY_F(4), KEY_F(5), KEY_F(6), KEY_F(7), KEY_F(8), KEY_F(9), KEY_F(10), -1, -1, KEY_HOME, KEY_UP, KEY_PPAGE, ALT_PADMINUS, KEY_LEFT, KEY_B2, KEY_RIGHT, ALT_PADPLUS, KEY_END, KEY_DOWN, KEY_NPAGE, KEY_IC, KEY_DC, KEY_F(13), KEY_F(14), KEY_F(15), KEY_F(16), KEY_F(17), KEY_F(18), KEY_F(19), KEY_F(20), KEY_F(21), KEY_F(22), KEY_F(25), KEY_F(26), KEY_F(27), KEY_F(28), KEY_F(29), KEY_F(30), KEY_F(31), KEY_F(32), KEY_F(33), KEY_F(34), KEY_F(37), KEY_F(38), KEY_F(39), KEY_F(40), KEY_F(41), KEY_F(42), KEY_F(43), KEY_F(44), KEY_F(45), KEY_F(46), -1, CTL_LEFT, CTL_RIGHT, CTL_END, CTL_PGDN, CTL_HOME, ALT_1, ALT_2, ALT_3, ALT_4, ALT_5, ALT_6, ALT_7, ALT_8, ALT_9, ALT_0, ALT_MINUS, ALT_EQUAL, CTL_PGUP, KEY_F(11), KEY_F(12), KEY_F(23), KEY_F(24), KEY_F(35), KEY_F(36), KEY_F(47), KEY_F(48), CTL_UP, CTL_PADMINUS, CTL_PADCENTER, CTL_PADPLUS, CTL_DOWN, CTL_INS, CTL_DEL, CTL_TAB, CTL_PADSLASH, CTL_PADSTAR, ALT_HOME, ALT_UP, ALT_PGUP, -1, ALT_LEFT, -1, ALT_RIGHT, -1, ALT_END, ALT_DOWN, ALT_PGDN, ALT_INS, ALT_DEL, ALT_PADSLASH, ALT_TAB, ALT_PADENTER, -1 }; unsigned long pdc_key_modifiers = 0L; static struct {unsigned short pressed, released;} button[3]; static bool mouse_avail = FALSE, mouse_vis = FALSE, mouse_moved = FALSE, mouse_button = FALSE, key_pressed = FALSE; static unsigned char mouse_scroll = 0; static PDCREGS ms_regs, old_ms; static unsigned short shift_status, old_shift = 0; static unsigned char keyboard_function = 0xff, shift_function = 0xff, check_function = 0xff; static const unsigned short button_map[3] = {0, 2, 1}; unsigned long PDC_get_input_fd(void) { PDC_LOG(("PDC_get_input_fd() - called\n")); return (unsigned long)fileno(stdin); } void PDC_set_keyboard_binary(bool on) { PDC_LOG(("PDC_set_keyboard_binary() - called\n")); #ifdef __DJGPP__ setmode(fileno(stdin), on ? O_BINARY : O_TEXT); signal(SIGINT, on ? SIG_IGN : SIG_DFL); #endif } /* check if a key or mouse event is waiting */ bool PDC_check_key(void) { PDCREGS regs; if (shift_function == 0xff) { int scan; /* get shift status for all keyboards */ regs.h.ah = 0x02; PDCINT(0x16, regs); scan = regs.h.al; /* get shift status for enhanced keyboards */ regs.h.ah = 0x12; PDCINT(0x16, regs); if (scan == regs.h.al && getdosmembyte(0x496) == 0x10) { keyboard_function = 0x10; check_function = 0x11; shift_function = 0x12; } else { keyboard_function = 0; check_function = 1; shift_function = 2; } } regs.h.ah = shift_function; PDCINT(0x16, regs); shift_status = regs.W.ax; if (mouse_vis) { unsigned short i; ms_regs.W.ax = 3; PDCINT(0x33, ms_regs); mouse_button = FALSE; for (i = 0; i < 3; i++) { regs.W.ax = 6; regs.W.bx = button_map[i]; PDCINT(0x33, regs); button[i].released = regs.W.bx; if (regs.W.bx) { ms_regs.W.cx = regs.W.cx; ms_regs.W.dx = regs.W.dx; mouse_button = TRUE; } regs.W.ax = 5; regs.W.bx = button_map[i]; PDCINT(0x33, regs); button[i].pressed = regs.W.bx; if (regs.W.bx) { ms_regs.W.cx = regs.W.cx; ms_regs.W.dx = regs.W.dx; mouse_button = TRUE; } } mouse_scroll = ms_regs.h.bh; mouse_moved = !mouse_button && ms_regs.h.bl && ms_regs.h.bl == old_ms.h.bl && (((ms_regs.W.cx ^ old_ms.W.cx) >> 3) || ((ms_regs.W.dx ^ old_ms.W.dx) >> 3)); if (mouse_scroll || mouse_button || mouse_moved) return TRUE; } if (old_shift && !shift_status) /* modifier released */ { if (!key_pressed && SP->return_key_modifiers) return TRUE; } else if (!old_shift && shift_status) /* modifier pressed */ key_pressed = FALSE; old_shift = shift_status; #ifndef USE_KBHIT regs.h.ah = check_function; PDCINT(0x16, regs); return !(regs.W.flags & 64); #else return kbhit(); #endif } static int _process_mouse_events(void) { int i; short shift_flags = 0; memset(&pdc_mouse_status, 0, sizeof(pdc_mouse_status)); key_pressed = TRUE; old_shift = shift_status; SP->key_code = TRUE; /* Set shift modifiers */ if (shift_status & 3) shift_flags |= BUTTON_SHIFT; if (shift_status & 4) shift_flags |= BUTTON_CONTROL; if (shift_status & 8) shift_flags |= BUTTON_ALT; /* Scroll wheel support for CuteMouse */ if (mouse_scroll) { pdc_mouse_status.changes = mouse_scroll & 0x80 ? PDC_MOUSE_WHEEL_UP : PDC_MOUSE_WHEEL_DOWN; pdc_mouse_status.x = -1; pdc_mouse_status.y = -1; return KEY_MOUSE; } if (mouse_moved) { pdc_mouse_status.changes = PDC_MOUSE_MOVED; for (i = 0; i < 3; i++) { if (ms_regs.h.bl & (1 << button_map[i])) { pdc_mouse_status.button[i] = BUTTON_MOVED | shift_flags; pdc_mouse_status.changes |= (1 << i); } } } else /* button event */ { for (i = 0; i < 3; i++) { if (button[i].pressed) { /* Check for a click -- a PRESS followed immediately by a release */ if (!button[i].released) { if (SP->mouse_wait) { PDCREGS regs; napms(SP->mouse_wait); regs.W.ax = 6; regs.W.bx = button_map[i]; PDCINT(0x33, regs); pdc_mouse_status.button[i] = regs.W.bx ? BUTTON_CLICKED : BUTTON_PRESSED; } else pdc_mouse_status.button[i] = BUTTON_PRESSED; } else pdc_mouse_status.button[i] = BUTTON_CLICKED; } if (button[i].pressed || button[i].released) { pdc_mouse_status.button[i] |= shift_flags; pdc_mouse_status.changes |= (1 << i); } } } pdc_mouse_status.x = ms_regs.W.cx >> 3; pdc_mouse_status.y = ms_regs.W.dx >> 3; old_ms = ms_regs; return KEY_MOUSE; } /* return the next available key or mouse event */ int PDC_get_key(void) { PDCREGS regs; int key, scan; pdc_key_modifiers = 0; if (mouse_vis && (mouse_scroll || mouse_button || mouse_moved)) return _process_mouse_events(); /* Return modifiers as keys? */ if (old_shift && !shift_status) { key = -1; if (old_shift & 1) key = KEY_SHIFT_R; if (old_shift & 2) key = KEY_SHIFT_L; if (shift_function == 0x12) { if (old_shift & 0x400) key = KEY_CONTROL_R; if (old_shift & 0x100) key = KEY_CONTROL_L; if (old_shift & 0x800) key = KEY_ALT_R; if (old_shift & 0x200) key = KEY_ALT_L; } else { if (old_shift & 4) key = KEY_CONTROL_R; if (old_shift & 8) key = KEY_ALT_R; } key_pressed = FALSE; old_shift = shift_status; SP->key_code = TRUE; return key; } regs.h.ah = keyboard_function; PDCINT(0x16, regs); key = regs.h.al; scan = regs.h.ah; if (SP->save_key_modifiers) { if (shift_status & 3) pdc_key_modifiers |= PDC_KEY_MODIFIER_SHIFT; if (shift_status & 4) pdc_key_modifiers |= PDC_KEY_MODIFIER_CONTROL; if (shift_status & 8) pdc_key_modifiers |= PDC_KEY_MODIFIER_ALT; if (shift_status & 0x20) pdc_key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; } if (scan == 0x1c && key == 0x0a) /* ^Enter */ key = CTL_ENTER; else if (scan == 0xe0 && key == 0x0d) /* PadEnter */ key = PADENTER; else if (scan == 0xe0 && key == 0x0a) /* ^PadEnter */ key = CTL_PADENTER; else if (scan == 0x37 && key == 0x2a) /* Star */ key = PADSTAR; else if (scan == 0x4a && key == 0x2d) /* Minus */ key = PADMINUS; else if (scan == 0x4e && key == 0x2b) /* Plus */ key = PADPLUS; else if (scan == 0xe0 && key == 0x2f) /* Slash */ key = PADSLASH; else if (key == 0x00 || (key == 0xe0 && scan > 53 && scan != 86)) key = (scan > 0xa7) ? -1 : key_table[scan]; if (shift_status & 3) { switch (key) { case KEY_HOME: /* Shift Home */ key = KEY_SHOME; break; case KEY_UP: /* Shift Up */ key = KEY_SUP; break; case KEY_PPAGE: /* Shift PgUp */ key = KEY_SPREVIOUS; break; case KEY_LEFT: /* Shift Left */ key = KEY_SLEFT; break; case KEY_RIGHT: /* Shift Right */ key = KEY_SRIGHT; break; case KEY_END: /* Shift End */ key = KEY_SEND; break; case KEY_DOWN: /* Shift Down */ key = KEY_SDOWN; break; case KEY_NPAGE: /* Shift PgDn */ key = KEY_SNEXT; break; case KEY_IC: /* Shift Ins */ key = KEY_SIC; break; case KEY_DC: /* Shift Del */ key = KEY_SDC; } } key_pressed = TRUE; SP->key_code = ((unsigned)key >= 256); return key; } /* discard any pending keyboard or mouse input -- this is the core routine for flushinp() */ void PDC_flushinp(void) { PDC_LOG(("PDC_flushinp() - called\n")); /* Force the BIOS keyboard buffer head and tail pointers to be the same... Real nasty trick... */ setdosmemword(0x41a, getdosmemword(0x41c)); } int PDC_mouse_set(void) { PDCREGS regs; unsigned long mbe = SP->_trap_mbe; if (mbe && !mouse_avail) { regs.W.ax = 0; PDCINT(0x33, regs); mouse_avail = !!(regs.W.ax); } if (mbe) { if (mouse_avail && !mouse_vis) { memset(&old_ms, 0, sizeof(old_ms)); regs.W.ax = 1; PDCINT(0x33, regs); mouse_vis = TRUE; } } else { if (mouse_avail && mouse_vis) { regs.W.ax = 2; PDCINT(0x33, regs); mouse_vis = FALSE; } } return (mouse_avail || !mbe) ? OK : ERR; } int PDC_modifiers_set(void) { key_pressed = FALSE; return OK; } curses-1.4.4/vendor/PDCurses/dos/pdcsetsc.c0000644000004100000410000000472014201713275020607 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcdos.h" /*man-start************************************************************** pdcsetsc -------- ### Synopsis int PDC_set_blink(bool blinkon); void PDC_set_title(const char *title); ### Description PDC_set_blink() toggles whether the A_BLINK attribute sets an actual blink mode (TRUE), or sets the background color to high intensity (FALSE). The default is platform-dependent (FALSE in most cases). It returns OK if it could set the state to match the given parameter, ERR otherwise. Current platforms also adjust the value of COLORS according to this function -- 16 for FALSE, and 8 for TRUE. PDC_set_title() sets the title of the window in which the curses program is running. This function may not do anything on some platforms. (Currently it only works in Win32 and X11.) ### Portability X/Open BSD SYS V PDC_set_blink - - - PDC_set_title - - - **man-end****************************************************************/ int PDC_curs_set(int visibility) { PDCREGS regs; int ret_vis, start, end; PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); ret_vis = SP->visibility; SP->visibility = visibility; switch (visibility) { case 0: /* invisible */ start = 32; end = 0; /* was 32 */ break; case 2: /* highly visible */ start = 0; /* full-height block */ end = 7; break; default: /* normal visibility */ start = (SP->orig_cursor >> 8) & 0xff; end = SP->orig_cursor & 0xff; } /* if scrnmode is not set, some BIOSes hang */ regs.h.ah = 0x01; regs.h.al = (unsigned char)pdc_scrnmode; regs.h.ch = (unsigned char)start; regs.h.cl = (unsigned char)end; PDCINT(0x10, regs); return ret_vis; } void PDC_set_title(const char *title) { PDC_LOG(("PDC_set_title() - called: <%s>\n", title)); } int PDC_set_blink(bool blinkon) { PDCREGS regs; switch (pdc_adapter) { case _EGACOLOR: case _EGAMONO: case _VGACOLOR: case _VGAMONO: regs.W.ax = 0x1003; regs.W.bx = blinkon; PDCINT(0x10, regs); if (pdc_color_started) COLORS = blinkon ? 8 : 16; break; default: COLORS = 8; } return (COLORS - (blinkon * 8) != 8) ? OK : ERR; } curses-1.4.4/vendor/PDCurses/dos/pdcgetsc.c0000644000004100000410000000351114201713275020570 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcdos.h" #include /* return width of screen/viewport */ int PDC_get_columns(void) { PDCREGS regs; int cols; const char *env_cols; PDC_LOG(("PDC_get_columns() - called\n")); /* use the value from COLS environment variable, if set. MH 10-Jun-92 */ /* and use the minimum of COLS and return from int10h MH 18-Jun-92 */ regs.h.ah = 0x0f; PDCINT(0x10, regs); cols = (int)regs.h.ah; env_cols = getenv("COLS"); if (env_cols) cols = min(atoi(env_cols), cols); PDC_LOG(("PDC_get_columns() - returned: cols %d\n", cols)); return cols; } /* get the cursor size/shape */ int PDC_get_cursor_mode(void) { PDC_LOG(("PDC_get_cursor_mode() - called\n")); return getdosmemword(0x460); } /* return number of screen rows */ int PDC_get_rows(void) { const char *env_rows; int rows; PDC_LOG(("PDC_get_rows() - called\n")); /* use the value from LINES environment variable, if set. MH 10-Jun-92 */ /* and use the minimum of LINES and *ROWS. MH 18-Jun-92 */ rows = getdosmembyte(0x484) + 1; env_rows = getenv("LINES"); if (env_rows) rows = min(atoi(env_rows), rows); if (rows == 1 && pdc_adapter == _MDS_GENIUS) rows = 66; if (rows == 1 && pdc_adapter == _MDA) rows = 25; if (rows == 1) { rows = 25; pdc_direct_video = FALSE; } switch (pdc_adapter) { case _EGACOLOR: case _EGAMONO: switch (rows) { case 25: case 43: break; default: rows = 25; } break; case _VGACOLOR: case _VGAMONO: break; default: rows = 25; break; } PDC_LOG(("PDC_get_rows() - returned: rows %d\n", rows)); return rows; } curses-1.4.4/vendor/PDCurses/dos/Makefile.msc0000644000004100000410000000432014201713275021050 0ustar www-datawww-data# NMAKE Makefile for PDCurses library - Microsoft C for DOS # # Usage: nmake -f [path\]Makefile.msc [DEBUG=] [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] # Change the memory MODEL here, if desired MODEL = L # one of L, S, M, T, H, C SIZE = LARGE # one of LARGE, SMALL, MEDIUM, TINY, HUGE, COMPACT O = obj !ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. !endif !include $(PDCURSES_SRCDIR)\version.mif !include $(PDCURSES_SRCDIR)\libobjs.mif osdir = $(PDCURSES_SRCDIR)\dos PDCURSES_DOS_H = $(osdir)\pdcdos.h CC = cl !ifdef DEBUG CFLAGS = /Od /Zi /DPDCDEBUG LDFLAGS = /CO /NOE /SE:160 !else CFLAGS = /Ox LDFLAGS = /NOE /SE:160 !endif CPPFLAGS = -I$(PDCURSES_SRCDIR) BUILD = $(CC) /J /nologo /c /D$(SIZE) /A$(MODEL) $(CFLAGS) $(CPPFLAGS) LINK = link CCLIBS = LIBEXE = lib LIBCURSES = pdcurses.lib all: $(LIBCURSES) $(DEMOS) clean: -del *.obj -del *.lib -del *.exe demos: $(DEMOS) DEMOOBJS = $(DEMOS:.exe=.obj) tui.obj $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(DEMOOBJS) : $(PDCURSES_CURSES_H) $(DEMOS) : $(LIBCURSES) panel.obj : $(PANEL_HEADER) terminfo.obj: $(TERM_HEADER) $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) $@ @$(osdir)\mscdos.lrf {$(srcdir)\}.c{}.obj: $(BUILD) $< {$(osdir)\}.c{}.obj: $(BUILD) $< {$(demodir)\}.c{}.obj: $(BUILD) $< firework.exe: firework.obj $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES); ozdemo.exe: ozdemo.obj $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES); ptest.exe: ptest.obj $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES); rain.exe: rain.obj $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES); testcurs.exe: testcurs.obj $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES); tuidemo.exe: tuidemo.obj tui.obj $(LINK) $(LDFLAGS) $*.obj+tui.obj,$*,,$(LIBCURSES); worm.exe: worm.obj $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES); xmas.exe: xmas.obj $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES); ptest.obj: $(demodir)\ptest.c $(PANEL_HEADER) $(BUILD) $(demodir)\ptest.c tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(BUILD) -I$(demodir) $(demodir)\tui.c tuidemo.obj: $(demodir)\tuidemo.c $(BUILD) -I$(demodir) $(demodir)\tuidemo.c PLATFORM1 = Microsoft C PLATFORM2 = Microsoft C for DOS ARCNAME = pdc$(VER)msc !include $(PDCURSES_SRCDIR)\makedist.mif curses-1.4.4/vendor/PDCurses/dos/pdcdisp.c0000644000004100000410000000703014201713275020422 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcdos.h" /* ACS definitions originally by jshumate@wrdis01.robins.af.mil -- these match code page 437 and compatible pages (CP850, CP852, etc.) */ #ifdef CHTYPE_LONG #define USE_UNICODE_ACS_CHARS 0 #include "acs_defs.h" #endif #ifdef __PACIFIC__ void movedata(unsigned sseg, unsigned soff, unsigned dseg, unsigned doff, unsigned n) { far char *src = MK_FP(sseg, soff); far char *dst = MK_FP(dseg, doff); while (n--) *dst++ = *src++; } #endif /* position hardware cursor at (y, x) */ void PDC_gotoyx(int row, int col) { PDCREGS regs; PDC_LOG(("PDC_gotoyx() - called: row %d col %d\n", row, col)); regs.h.ah = 0x02; regs.h.bh = 0; regs.h.dh = (unsigned char) row; regs.h.dl = (unsigned char) col; PDCINT(0x10, regs); } /* update the given physical line to look like the corresponding line in curscr */ /* NOTE: the original indexing into pdc_atrtab[] relied on three or five attribute bits in 'chtype' being adjacent to the color bits. Such is not the case for 64-bit chtypes (CHTYPE_LONG == 2), so we have to do additional bit-fiddling for that situation. Code is similar in Win32 and DOS flavors. (BJG) */ void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) { int j; PDC_LOG(("PDC_transform_line() - called: line %d\n", lineno)); if (pdc_direct_video) { #if SMALL || MEDIUM # ifndef __PACIFIC__ struct SREGS segregs; # endif int ds; #endif /* this should be enough for the maximum width of a screen */ struct {unsigned char text, attr;} temp_line[256]; /* replace the attribute part of the chtype with the actual color value for each chtype in the line */ for (j = 0; j < len; j++) { chtype ch = srcp[j]; #if defined( CHTYPE_LONG) && (CHTYPE_LONG >= 2) temp_line[j].attr = pdc_atrtab[((ch >> PDC_ATTR_SHIFT) & 0x1f) | (((ch >> PDC_COLOR_SHIFT) & 0xff) << 5)]; #else temp_line[j].attr = pdc_atrtab[ch >> PDC_ATTR_SHIFT]; #endif #ifdef CHTYPE_LONG if (ch & A_ALTCHARSET && !(ch & 0xff80)) ch = acs_map[ch & 0x7f]; #endif temp_line[j].text = ch & 0xff; } #ifdef __DJGPP__ dosmemput(temp_line, len * 2, (unsigned long)_FAR_POINTER(pdc_video_seg, pdc_video_ofs + (lineno * curscr->_maxx + x) * 2)); #else # if SMALL || MEDIUM # ifdef __PACIFIC__ ds = FP_SEG((void far *) temp_line); # else segread(&segregs); ds = segregs.ds; # endif movedata(ds, (int)temp_line, pdc_video_seg, pdc_video_ofs + (lineno * curscr->_maxx + x) * 2, len * 2); # else memcpy((void *)_FAR_POINTER(pdc_video_seg, pdc_video_ofs + (lineno * curscr->_maxx + x) * 2), temp_line, len * 2); # endif #endif } else for (j = 0; j < len;) { PDCREGS regs; unsigned short count = 1; chtype ch = srcp[j]; while ((j + count < len) && (ch == srcp[j + count])) count++; PDC_gotoyx(lineno, j + x); regs.h.ah = 0x09; regs.W.bx = pdc_atrtab[ch >> PDC_ATTR_SHIFT]; regs.W.cx = count; #ifdef CHTYPE_LONG if (ch & A_ALTCHARSET && !(ch & 0xff80)) ch = acs_map[ch & 0x7f]; #endif regs.h.al = (unsigned char) (ch & 0xff); PDCINT(0x10, regs); j += count; } } curses-1.4.4/vendor/PDCurses/dos/pdcclip.c0000644000004100000410000000661014201713275020415 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcdos.h" #include /*man-start************************************************************** clipboard --------- ### Synopsis int PDC_getclipboard(char **contents, long *length); int PDC_setclipboard(const char *contents, long length); int PDC_freeclipboard(char *contents); int PDC_clearclipboard(void); ### Description PDC_getclipboard() gets the textual contents of the system's clipboard. This function returns the contents of the clipboard in the contents argument. It is the responsibilitiy of the caller to free the memory returned, via PDC_freeclipboard(). The length of the clipboard contents is returned in the length argument. PDC_setclipboard copies the supplied text into the system's clipboard, emptying the clipboard prior to the copy. PDC_clearclipboard() clears the internal clipboard. ### Return Values indicator of success/failure of call. PDC_CLIP_SUCCESS the call was successful PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for the clipboard contents PDC_CLIP_EMPTY the clipboard contains no text PDC_CLIP_ACCESS_ERROR no clipboard support ### Portability X/Open BSD SYS V PDC_getclipboard - - - PDC_setclipboard - - - PDC_freeclipboard - - - PDC_clearclipboard - - - **man-end****************************************************************/ /* global clipboard contents, should be NULL if none set */ static char *pdc_DOS_clipboard = NULL; int PDC_getclipboard(char **contents, long *length) { int len; PDC_LOG(("PDC_getclipboard() - called\n")); if (!pdc_DOS_clipboard) return PDC_CLIP_EMPTY; len = strlen(pdc_DOS_clipboard); if ((*contents = malloc(len + 1)) == NULL) return PDC_CLIP_MEMORY_ERROR; strcpy(*contents, pdc_DOS_clipboard); *length = len; return PDC_CLIP_SUCCESS; } int PDC_setclipboard(const char *contents, long length) { PDC_LOG(("PDC_setclipboard() - called\n")); if (pdc_DOS_clipboard) { free(pdc_DOS_clipboard); pdc_DOS_clipboard = NULL; } if (contents) { if ((pdc_DOS_clipboard = malloc(length + 1)) == NULL) return PDC_CLIP_MEMORY_ERROR; strcpy(pdc_DOS_clipboard, contents); } return PDC_CLIP_SUCCESS; } int PDC_freeclipboard(char *contents) { PDC_LOG(("PDC_freeclipboard() - called\n")); /* should we also free empty the system clipboard? probably not */ if (contents) { /* NOTE: We free the memory, but we can not set caller's pointer to NULL, so if caller calls again then will try to access free'd memory. We 1st overwrite memory with a string so if caller tries to use free memory they won't get what they expect & hopefully notice. */ /* memset(contents, 0xFD, strlen(contents)); */ if (strlen(contents) >= strlen("PDCURSES")) strcpy(contents, "PDCURSES"); free(contents); } return PDC_CLIP_SUCCESS; } int PDC_clearclipboard(void) { PDC_LOG(("PDC_clearclipboard() - called\n")); if (pdc_DOS_clipboard) { free(pdc_DOS_clipboard); pdc_DOS_clipboard = NULL; } return PDC_CLIP_SUCCESS; } curses-1.4.4/vendor/PDCurses/dos/Makefile.dmc0000644000004100000410000001172214201713275021035 0ustar www-datawww-data# Makefile for PDCurses library - DOS Digital Mars # # Usage: make -f Makefile.dmc [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] PDCURSES_SRCDIR = .. PDCURSES_CURSES_H = $(PDCURSES_SRCDIR)\curses.h PDCURSES_CURSPRIV_H = $(PDCURSES_SRCDIR)\curspriv.h PDCURSES_HEADERS = $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H) PANEL_HEADER = $(PDCURSES_SRCDIR)\panel.h TERM_HEADER = $(PDCURSES_SRCDIR)\term.h srcdir = $(PDCURSES_SRCDIR)\pdcurses osdir = $(PDCURSES_SRCDIR)\dos demodir = $(PDCURSES_SRCDIR)\demos PDCURSES_DOS_H = $(osdir)\pdcdos.h CC = dmc CHTYPE = -DCHTYPE_32 CFLAGS = -c -o+space -Nc -msd CPPFLAGS = -I$(PDCURSES_SRCDIR) -msd $(CHTYPE) LINK = dmc LIBEXE = lib LIBCURSES = pdcurses.lib BUILD = $(CC) $(CFLAGS) $(CPPFLAGS) DEMOS = testcurs.exe ozdemo.exe newtest.exe xmas.exe \ tuidemo.exe firework.exe ptest.exe rain.exe worm.exe all: $(LIBCURSES) $(DEMOS) clean: -del *.obj -del *.lib -del *.exe -del *.map -del advapi32.def LIBOBJS = addch.obj addchstr.obj addstr.obj attr.obj beep.obj bkgd.obj \ border.obj clear.obj color.obj delch.obj deleteln.obj deprec.obj getch.obj \ getstr.obj getyx.obj inch.obj inchstr.obj initscr.obj inopts.obj \ insch.obj insstr.obj instr.obj kernel.obj keyname.obj mouse.obj move.obj \ outopts.obj overlay.obj pad.obj panel.obj printw.obj refresh.obj \ scanw.obj scr_dump.obj scroll.obj slk.obj termattr.obj terminfo.obj \ touch.obj util.obj window.obj debug.obj PDCOBJS = pdcclip.obj pdcdisp.obj pdcgetsc.obj pdckbd.obj pdcscrn.obj \ pdcsetsc.obj pdcutil.obj DEMOOBJS = testcurs.obj ozdemo.obj newtest.obj xmas.obj tuidemo.obj \ tui.obj firework.obj ptest.obj rain.obj worm.obj $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_DOS_H) panel.obj ptest.obj: $(PANEL_HEADER) terminfo.obj: $(TERM_HEADER) $(DEMOOBJS) : $(PDCURSES_CURSES_H) $(DEMOS) : $(LIBCURSES) $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) -c $@ $(LIBOBJS) $(PDCOBJS) SRCBUILD = $(BUILD) $(srcdir)\$*.c OSBUILD = $(BUILD) $(osdir)\$*.c DEMOBUILD = $(LINK) $(CPPFLAGS) -o+space $@ $** addch.obj: $(srcdir)\addch.c $(SRCBUILD) addchstr.obj: $(srcdir)\addchstr.c $(SRCBUILD) addstr.obj: $(srcdir)\addstr.c $(SRCBUILD) attr.obj: $(srcdir)\attr.c $(SRCBUILD) beep.obj: $(srcdir)\beep.c $(SRCBUILD) bkgd.obj: $(srcdir)\bkgd.c $(SRCBUILD) border.obj: $(srcdir)\border.c $(SRCBUILD) clear.obj: $(srcdir)\clear.c $(SRCBUILD) color.obj: $(srcdir)\color.c $(SRCBUILD) delch.obj: $(srcdir)\delch.c $(SRCBUILD) deleteln.obj: $(srcdir)\deleteln.c $(SRCBUILD) deprec.obj: $(srcdir)\deprec.c $(SRCBUILD) getch.obj: $(srcdir)\getch.c $(SRCBUILD) getstr.obj: $(srcdir)\getstr.c $(SRCBUILD) getyx.obj: $(srcdir)\getyx.c $(SRCBUILD) inch.obj: $(srcdir)\inch.c $(SRCBUILD) inchstr.obj: $(srcdir)\inchstr.c $(SRCBUILD) initscr.obj: $(srcdir)\initscr.c $(SRCBUILD) inopts.obj: $(srcdir)\inopts.c $(SRCBUILD) insch.obj: $(srcdir)\insch.c $(SRCBUILD) insstr.obj: $(srcdir)\insstr.c $(SRCBUILD) instr.obj: $(srcdir)\instr.c $(SRCBUILD) kernel.obj: $(srcdir)\kernel.c $(SRCBUILD) keyname.obj: $(srcdir)\keyname.c $(SRCBUILD) mouse.obj: $(srcdir)\mouse.c $(SRCBUILD) move.obj: $(srcdir)\move.c $(SRCBUILD) outopts.obj: $(srcdir)\outopts.c $(SRCBUILD) overlay.obj: $(srcdir)\overlay.c $(SRCBUILD) pad.obj: $(srcdir)\pad.c $(SRCBUILD) panel.obj: $(srcdir)\panel.c $(SRCBUILD) printw.obj: $(srcdir)\printw.c $(SRCBUILD) refresh.obj: $(srcdir)\refresh.c $(SRCBUILD) scanw.obj: $(srcdir)\scanw.c $(SRCBUILD) scr_dump.obj: $(srcdir)\scr_dump.c $(SRCBUILD) scroll.obj: $(srcdir)\scroll.c $(SRCBUILD) slk.obj: $(srcdir)\slk.c $(SRCBUILD) termattr.obj: $(srcdir)\termattr.c $(SRCBUILD) terminfo.obj: $(srcdir)\terminfo.c $(SRCBUILD) touch.obj: $(srcdir)\touch.c $(SRCBUILD) util.obj: $(srcdir)\util.c $(SRCBUILD) window.obj: $(srcdir)\window.c $(SRCBUILD) debug.obj: $(srcdir)\debug.c $(SRCBUILD) pdcclip.obj: $(osdir)\pdcclip.c $(OSBUILD) pdcdisp.obj: $(osdir)\pdcdisp.c $(OSBUILD) pdcgetsc.obj: $(osdir)\pdcgetsc.c $(OSBUILD) pdckbd.obj: $(osdir)\pdckbd.c $(OSBUILD) pdcscrn.obj: $(osdir)\pdcscrn.c $(OSBUILD) pdcsetsc.obj: $(osdir)\pdcsetsc.c $(OSBUILD) pdcutil.obj: $(osdir)\pdcutil.c $(OSBUILD) firework.exe: $(demodir)\firework.c $(DEMOBUILD) ozdemo.exe: $(demodir)\ozdemo.c $(DEMOBUILD) newtest.exe: $(demodir)\newtest.c $(DEMOBUILD) ptest.exe: $(demodir)\ptest.c $(DEMOBUILD) rain.exe: $(demodir)\rain.c $(DEMOBUILD) testcurs.exe: $(demodir)\testcurs.c $(DEMOBUILD) advapi32.lib tuidemo.exe: tuidemo.obj tui.obj $(DEMOBUILD) worm.exe: $(demodir)\worm.c $(DEMOBUILD) xmas.exe: $(demodir)\xmas.c $(DEMOBUILD) tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(BUILD) -I$(demodir) $(demodir)\$*.c tuidemo.obj: $(demodir)\tuidemo.c $(BUILD) -I$(demodir) $(demodir)\$*.c curses-1.4.4/vendor/PDCurses/dos/pdcdos.h0000644000004100000410000001073714201713275020265 0ustar www-datawww-data/* Public Domain Curses */ #include #include # if(CHTYPE_LONG >= 2) /* 64-bit chtypes */ # define PDC_ATTR_SHIFT 23 # else #ifdef CHTYPE_LONG /* 32-bit chtypes */ # define PDC_ATTR_SHIFT 19 #else /* 16-bit chtypes */ # define PDC_ATTR_SHIFT 8 #endif #endif #if defined(_MSC_VER) || defined(_QC) # define MSC 1 #endif #if defined(__PACIFIC__) && !defined(__SMALL__) # define __SMALL__ #endif #if defined(__HIGHC__) || MSC # include #endif /*---------------------------------------------------------------------- * MEMORY MODEL SUPPORT: * * MODELS * TINY cs,ds,ss all in 1 segment (not enough memory!) * SMALL cs:1 segment, ds:1 segment * MEDIUM cs:many segments, ds:1 segment * COMPACT cs:1 segment, ds:many segments * LARGE cs:many segments, ds:many segments * HUGE cs:many segments, ds:segments > 64K */ #ifdef __TINY__ # define SMALL 1 #endif #ifdef __SMALL__ # define SMALL 1 #endif #ifdef __MEDIUM__ # define MEDIUM 1 #endif #ifdef __COMPACT__ # define COMPACT 1 #endif #ifdef __LARGE__ # define LARGE 1 #endif #ifdef __HUGE__ # define HUGE 1 #endif #include extern unsigned char *pdc_atrtab; extern int pdc_adapter; extern int pdc_scrnmode; extern int pdc_font; extern bool pdc_direct_video; extern bool pdc_bogus_adapter; extern unsigned pdc_video_seg; extern unsigned pdc_video_ofs; #ifdef __DJGPP__ /* Note: works only in plain DOS... */ # if DJGPP == 2 # define _FAR_POINTER(s,o) ((((int)(s)) << 4) + ((int)(o))) # else # define _FAR_POINTER(s,o) (0xe0000000 + (((int)(s)) << 4) + ((int)(o))) # endif # define _FP_SEGMENT(p) (unsigned short)((((long)p) >> 4) & 0xffff) #else # ifdef __TURBOC__ # define _FAR_POINTER(s,o) MK_FP(s,o) # else # if defined(__WATCOMC__) && defined(__FLAT__) # define _FAR_POINTER(s,o) ((((int)(s)) << 4) + ((int)(o))) # else # define _FAR_POINTER(s,o) (((long)s << 16) | (long)o) # endif # endif # define _FP_SEGMENT(p) (unsigned short)(((long)p) >> 4) #endif #define _FP_OFFSET(p) ((unsigned short)p & 0x000f) #ifdef __DJGPP__ # include unsigned char getdosmembyte(int offs); unsigned short getdosmemword(int offs); unsigned long getdosmemdword(int offs); void setdosmembyte(int offs, unsigned char b); void setdosmemword(int offs, unsigned short w); #else # if SMALL || MEDIUM || MSC # define PDC_FAR far # else # define PDC_FAR # endif # define getdosmembyte(offs) \ (*((unsigned char PDC_FAR *) _FAR_POINTER(0,offs))) # define getdosmemword(offs) \ (*((unsigned short PDC_FAR *) _FAR_POINTER(0,offs))) # define getdosmemdword(offs) \ (*((unsigned long PDC_FAR *) _FAR_POINTER(0,offs))) # define setdosmembyte(offs,x) \ (*((unsigned char PDC_FAR *) _FAR_POINTER(0,offs)) = (x)) # define setdosmemword(offs,x) \ (*((unsigned short PDC_FAR *) _FAR_POINTER(0,offs)) = (x)) #endif #if defined(__WATCOMC__) && defined(__386__) typedef union { struct { unsigned long edi, esi, ebp, res, ebx, edx, ecx, eax; } d; struct { unsigned short di, di_hi, si, si_hi, bp, bp_hi, res, res_hi, bx, bx_hi, dx, dx_hi, cx, cx_hi, ax, ax_hi, flags, es, ds, fs, gs, ip, cs, sp, ss; } w; struct { unsigned char edi[4], esi[4], ebp[4], res[4], bl, bh, ebx_b2, ebx_b3, dl, dh, edx_b2, edx_b3, cl, ch, ecx_b2, ecx_b3, al, ah, eax_b2, eax_b3; } h; } pdc_dpmi_regs; void PDC_dpmi_int(int, pdc_dpmi_regs *); #endif #ifdef __DJGPP__ # include # define PDCREGS __dpmi_regs # define PDCINT(vector, regs) __dpmi_int(vector, ®s) #else # ifdef __WATCOMC__ # ifdef __386__ # define PDCREGS pdc_dpmi_regs # define PDCINT(vector, regs) PDC_dpmi_int(vector, ®s) # else # define PDCREGS union REGPACK # define PDCINT(vector, regs) intr(vector, ®s) # endif # else # define PDCREGS union REGS # define PDCINT(vector, regs) int86(vector, ®s, ®s) # endif #endif /* Wide registers in REGS: w or x? */ #ifdef __WATCOMC__ # define W w #else # define W x #endif /* Monitor (terminal) type information */ enum { _NONE, _MDA, _CGA, _EGACOLOR = 0x04, _EGAMONO, _VGACOLOR = 0x07, _VGAMONO, _MCGACOLOR = 0x0a, _MCGAMONO, _MDS_GENIUS = 0x30 }; /* Text-mode font size information */ enum { _FONT8 = 8, _FONT14 = 14, _FONT15, /* GENIUS */ _FONT16 }; #ifdef __PACIFIC__ void movedata(unsigned, unsigned, unsigned, unsigned, unsigned); #endif curses-1.4.4/vendor/PDCurses/dos/Makefile.bcc0000644000004100000410000000267714201713275021032 0ustar www-datawww-data# Borland MAKE Makefile for PDCurses library - DOS BC++ 3.0+ # # Usage: make -f [path\]Makefile.bcc [DEBUG=] [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] # Change the memory MODEL here, if desired MODEL = l O = obj E = .exe RM = del !ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. !endif !include $(PDCURSES_SRCDIR)\version.mif !include $(PDCURSES_SRCDIR)\libobjs.mif osdir = $(PDCURSES_SRCDIR)\dos !ifdef DEBUG CFLAGS = -N -v -y -DPDCDEBUG !else CFLAGS = -O !endif CPPFLAGS = -I$(PDCURSES_SRCDIR) BUILD = $(CC) -1- -K -G -rd -d -w-eff -w-par -c \ -m$(MODEL) $(CFLAGS) $(CPPFLAGS) LIBEXE = tlib /C /E LIBCURSES = pdcurses.lib all: $(LIBCURSES) clean: -$(RM) *.obj -$(RM) *.lib -$(RM) *.map -$(RM) *.exe demos: $(DEMOS) $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) -$(RM) $@ $(LIBEXE) $@ @$(PDCURSES_SRCDIR)\borland.lrf .autodepend {$(srcdir)\}.c.obj: $(BUILD) $< {$(osdir)\}.c.obj: $(BUILD) $< {$(demodir)\}.c.obj: $(BUILD) $< .c.obj: $(BUILD) $< .obj.exe: $(CC) -m$(MODEL) -e$@ $** $(LIBCURSES) tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES) $(CC) -m$(MODEL) -e$@ $** tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(PDCURSES_CURSES_H) $(BUILD) -I$(demodir) $(demodir)\tui.c tuidemo.obj: $(demodir)\tuidemo.c $(PDCURSES_CURSES_H) $(BUILD) -I$(demodir) $(demodir)\tuidemo.c PLATFORM1 = Borland C++ 3.1 PLATFORM2 = Borland C/C++ 3.1 for DOS ARCNAME = pdc$(VER)bcc !include $(PDCURSES_SRCDIR)\makedist.mif curses-1.4.4/vendor/PDCurses/dos/CMakeLists.txt0000644000004100000410000000321114201713275021365 0ustar www-datawww-datacmake_minimum_required(VERSION 3.11) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING "Choose the type of build, options are: Debug, Release, or MinSizeRel." FORCE) message(STATUS "No build type specified, defaulting to MinSizeRel.") endif() PROJECT(dos VERSION "${PROJECT_VERSION}" LANGUAGES C) MESSAGE(STATUS "${PROJECT_NAME} version: ${PROJECT_VERSION}") include(project_common) if(WATCOM) # this requires using the following toolchainfile file # -DCMAKE_TOOLCHAIN_FILE={path}\watcom_open_dos_toolchain.cmake string(APPEND CMAKE_C_FLAGS " -wx") # warning level: to maximum setting if(WATCOM_DOS32) string(APPEND CMAKE_C_FLAGS " -mf") # memory model: options are flat (-mf), large (-ml), memdium (-mm), small (-ms) else() string(APPEND CMAKE_C_FLAGS " -ml") # memory model: options are large (-ml), memdium (-mm), small (-ms) endif() string(APPEND CMAKE_C_FLAGS_RELEASE " -oneatx") string(APPEND CMAKE_C_FLAGS_MINSIZEREL " -oneatx") # optimization: # n -> allow numerically unstable optimizations # e -> expand user functions inline # a -> relax aliasing constraints # t -> favor execution time over code size in optimizations # x -> equivalent to -obmiler -s string(APPEND CMAKE_C_FLAGS_DEBUG " -d2") # full symbolic debugging info string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG " debug watcom all") endif() demo_app(../demos version) demo_app(../demos firework) demo_app(../demos ozdemo) demo_app(../demos newtest) demo_app(../demos ptest) demo_app(../demos rain) demo_app(../demos testcurs) demo_app(../demos worm) demo_app(../demos xmas) curses-1.4.4/vendor/PDCurses/dos/pdcutil.c0000644000004100000410000001142214201713275020440 0ustar www-datawww-data/* Public Domain Curses */ #include #include "pdcdos.h" void PDC_beep(void) { PDCREGS regs; PDC_LOG(("PDC_beep() - called\n")); regs.W.ax = 0x0e07; /* Write ^G in TTY fashion */ regs.W.bx = 0; PDCINT(0x10, regs); } #if UINT_MAX >= 0xfffffffful # define irq0_ticks() (getdosmemdword(0x46c)) /* For 16-bit platforms, we expect that the program will need _two_ memory read instructions to read the tick count. Between the two instructions, if we do not turn off interrupts, an IRQ 0 might intervene and update the tick count with a carry over from the lower half to the upper half --- and our read count will be bogus. */ #elif defined __TURBOC__ static unsigned long irq0_ticks(void) { unsigned long t; disable(); t = getdosmemdword(0x46c); enable(); return t; } #elif defined __WATCOMC__ static unsigned long irq0_ticks(void) { unsigned long t; _disable(); t = getdosmemdword(0x46c); _enable(); return t; } #else # define irq0_ticks() (getdosmemdword(0x46c)) /* FIXME */ #endif static void do_idle(void) { PDCREGS regs; regs.W.ax = 0x1680; PDCINT(0x2f, regs); PDCINT(0x28, regs); } #define MAX_TICK 0x1800b0ul /* no. of IRQ 0 clock ticks per day; BIOS counter (0:0x46c) will go up to MAX_TICK - 1 before wrapping to 0 at midnight */ #define MS_PER_DAY 86400000ul /* no. of milliseconds in a day */ void PDC_napms(int ms) { unsigned long goal, start, current; PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); #if INT_MAX > MS_PER_DAY / 2 /* If `int' is 32-bit, we might be asked to "nap" for more than one day, in which case the system timer might wrap around at least twice, and that will be tricky to handle as is. Slice the "nap" into half-day portions. */ while (ms > MS_PER_DAY / 2) { PDC_napms (MS_PER_DAY / 2); ms -= MS_PER_DAY / 2; } #endif if (ms < 0) return; /* Scale the millisecond count by MAX_TICK / MS_PER_DAY. The scaling done here is not very precise, but what is more important is preventing integer overflow. The approximation 67 / 3680 can be obtained by considering the convergents (mathworld.wolfram.com/Convergent.html) of MAX_TICK / MS_PER_DAY 's continued fraction representation. */ #if MS_PER_DAY / 2 <= ULONG_MAX / 67ul # define MS_TO_TICKS(x) ((x) * 67ul / 3680ul) #else # error "unpossible!" #endif goal = MS_TO_TICKS(ms); if (!goal) goal++; start = irq0_ticks(); goal += start; if (goal >= MAX_TICK) { /* We expect to cross over midnight! Wait for the clock tick count to wrap around, then wait out the remaining ticks. */ goal -= MAX_TICK; while (irq0_ticks() == start) do_idle(); while (irq0_ticks() > start) do_idle(); start = 0; } while (goal > (current = irq0_ticks())) { if (current < start) { /* If the BIOS time somehow gets reset under us (ugh!), then restart (what is left of) the nap with `current' as the new starting time. Remember to adjust the goal time accordingly! */ goal -= start - current; start = current; } do_idle(); } } const char *PDC_sysname(void) { return "DOS"; } PDC_version_info PDC_version = { PDC_PORT_DOS, PDC_VER_MAJOR, PDC_VER_MINOR, PDC_VER_CHANGE, sizeof( chtype), /* note that thus far, 'wide' and 'UTF8' versions exist */ /* only for SDL2, X11, Win32, and Win32a; elsewhere, */ /* these will be FALSE */ #ifdef PDC_WIDE TRUE, #else FALSE, #endif #ifdef PDC_FORCE_UTF8 TRUE, #else FALSE, #endif }; #ifdef __DJGPP__ unsigned char getdosmembyte(int offset) { unsigned char b; dosmemget(offset, sizeof(unsigned char), &b); return b; } unsigned short getdosmemword(int offset) { unsigned short w; dosmemget(offset, sizeof(unsigned short), &w); return w; } unsigned long getdosmemdword(int offset) { unsigned long dw; dosmemget(offset, sizeof(unsigned long), &dw); return dw; } void setdosmembyte(int offset, unsigned char b) { dosmemput(&b, sizeof(unsigned char), offset); } void setdosmemword(int offset, unsigned short w) { dosmemput(&w, sizeof(unsigned short), offset); } #endif #if defined(__WATCOMC__) && defined(__386__) void PDC_dpmi_int(int vector, pdc_dpmi_regs *rmregs) { union REGPACK regs = {0}; rmregs->w.ss = 0; rmregs->w.sp = 0; rmregs->w.flags = 0; regs.w.ax = 0x300; regs.h.bl = vector; regs.x.edi = FP_OFF(rmregs); regs.x.es = FP_SEG(rmregs); intr(0x31, ®s); } #endif curses-1.4.4/vendor/PDCurses/dos/pdcscrn.c0000644000004100000410000004263314201713275020440 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcdos.h" #include #ifdef CHTYPE_LONG # define PDC_OFFSET 32 #else # define PDC_OFFSET 8 #endif /* COLOR_PAIR to attribute encoding table. */ unsigned char *pdc_atrtab = (unsigned char *)NULL; int pdc_adapter; /* screen type */ int pdc_scrnmode; /* default screen mode */ int pdc_font; /* default font size */ bool pdc_direct_video; /* allow direct screen memory writes */ bool pdc_bogus_adapter; /* TRUE if adapter has insane values */ unsigned pdc_video_seg; /* video base segment */ unsigned pdc_video_ofs; /* video base offset */ static short curstoreal[16], realtocurs[16] = { COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN, COLOR_RED, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE, COLOR_BLACK + 8, COLOR_BLUE + 8, COLOR_GREEN + 8, COLOR_CYAN + 8, COLOR_RED + 8, COLOR_MAGENTA + 8, COLOR_YELLOW + 8, COLOR_WHITE + 8 }; static bool sizeable = FALSE; /* TRUE if adapter is resizeable */ static unsigned short *saved_screen = NULL; static int saved_lines = 0; static int saved_cols = 0; static int saved_scrnmode[3]; static int saved_font[3]; /* special purpose function keys */ static int PDC_shutdown_key[PDC_MAX_FUNCTION_KEYS] = { 0, 0, 0, 0, 0 }; /* Thanks to Jeff Duntemann, K16RA for providing the impetus (through the Dr. Dobbs Journal, March 1989 issue) for getting the routines below merged into Bjorn Larsson's PDCurses 1.3... -- frotz@dri.com 900730 */ /* _get_font() - Get the current font size */ static int _get_font(void) { int retval; retval = getdosmemword(0x485); /* Assume the MDS Genius is in 66 line mode. */ if ((retval == 0) && (pdc_adapter == _MDS_GENIUS)) retval = _FONT15; switch (pdc_adapter) { case _MDA: retval = 10; /* POINTS is not certain on MDA/Hercules */ break; case _EGACOLOR: case _EGAMONO: switch (retval) { case _FONT8: case _FONT14: break; default: retval = _FONT14; } break; case _CGA: retval = _FONT8; } return retval; } /* _set_font() - Sets the current font size, if the adapter allows such a change. It is an error to attempt to change the font size on a "bogus" adapter. The reason for this is that we have a known video adapter identity problem. e.g. Two adapters report the same identifying characteristics. */ static void _set_font(int size) { PDCREGS regs; if (pdc_bogus_adapter) return; switch (pdc_adapter) { case _CGA: case _MDA: case _MCGACOLOR: case _MCGAMONO: case _MDS_GENIUS: break; case _EGACOLOR: case _EGAMONO: if (sizeable && (pdc_font != size)) { switch (size) { case _FONT8: regs.W.ax = 0x1112; regs.h.bl = 0x00; PDCINT(0x10, regs); break; case _FONT14: regs.W.ax = 0x1111; regs.h.bl = 0x00; PDCINT(0x10, regs); } } break; case _VGACOLOR: case _VGAMONO: if (sizeable && (pdc_font != size)) { switch (size) { case _FONT8: regs.W.ax = 0x1112; regs.h.bl = 0x00; PDCINT(0x10, regs); break; case _FONT14: regs.W.ax = 0x1111; regs.h.bl = 0x00; PDCINT(0x10, regs); break; case _FONT16: regs.W.ax = 0x1114; regs.h.bl = 0x00; PDCINT(0x10, regs); } } } curs_set(SP->visibility); pdc_font = _get_font(); } /* _set_80x25() - force a known screen state: 80x25 text mode. Forces the appropriate 80x25 alpha mode given the display adapter. */ static void _set_80x25(void) { PDCREGS regs; switch (pdc_adapter) { case _CGA: case _EGACOLOR: case _EGAMONO: case _VGACOLOR: case _VGAMONO: case _MCGACOLOR: case _MCGAMONO: regs.h.ah = 0x00; regs.h.al = 0x03; PDCINT(0x10, regs); break; case _MDA: regs.h.ah = 0x00; regs.h.al = 0x07; PDCINT(0x10, regs); } } /* _get_scrn_mode() - Return the current BIOS video mode */ static int _get_scrn_mode(void) { PDCREGS regs; regs.h.ah = 0x0f; PDCINT(0x10, regs); return (int)regs.h.al; } /* _set_scrn_mode() - Sets the BIOS Video Mode Number only if it is different from the current video mode. */ static void _set_scrn_mode(int new_mode) { PDCREGS regs; if (_get_scrn_mode() != new_mode) { regs.h.ah = 0; regs.h.al = (unsigned char) new_mode; PDCINT(0x10, regs); } pdc_font = _get_font(); pdc_scrnmode = new_mode; LINES = PDC_get_rows(); COLS = PDC_get_columns(); } /* _sanity_check() - A video adapter identification sanity check. This routine will force sane values for various control flags. */ static int _sanity_check(int adapter) { int fontsize = _get_font(); int rows = PDC_get_rows(); PDC_LOG(("_sanity_check() - called: Adapter %d\n", adapter)); switch (adapter) { case _EGACOLOR: case _EGAMONO: switch (rows) { case 25: case 43: break; default: pdc_bogus_adapter = TRUE; } switch (fontsize) { case _FONT8: case _FONT14: break; default: pdc_bogus_adapter = TRUE; } break; case _VGACOLOR: case _VGAMONO: break; case _CGA: case _MDA: case _MCGACOLOR: case _MCGAMONO: switch (rows) { case 25: break; default: pdc_bogus_adapter = TRUE; } break; default: pdc_bogus_adapter = TRUE; } if (pdc_bogus_adapter) { sizeable = FALSE; pdc_direct_video = FALSE; } return adapter; } /* _query_adapter_type() - Determine PC video adapter type. */ static int _query_adapter_type(void) { PDCREGS regs; int retval = _NONE; /* thanks to paganini@ax.apc.org for the GO32 fix */ #if !defined(__DJGPP__) && !defined(__WATCOMC__) struct SREGS segs; #endif short video_base = getdosmemword(0x463); PDC_LOG(("_query_adapter_type() - called\n")); /* attempt to call VGA Identify Adapter Function */ regs.W.ax = 0x1a00; PDCINT(0x10, regs); if ((regs.h.al == 0x1a) && (retval == _NONE)) { /* We know that the PS/2 video BIOS is alive and well. */ switch (regs.h.al) { case 0: retval = _NONE; break; case 1: retval = _MDA; break; case 2: retval = _CGA; break; case 4: retval = _EGACOLOR; sizeable = TRUE; break; case 5: retval = _EGAMONO; break; case 26: /* ...alt. VGA BIOS... */ case 7: retval = _VGACOLOR; sizeable = TRUE; break; case 8: retval = _VGAMONO; break; case 10: case 13: retval = _MCGACOLOR; break; case 12: retval = _MCGAMONO; break; default: retval = _CGA; } } else { /* No VGA BIOS, check for an EGA BIOS by selecting an Alternate Function Service... bx == 0x0010 --> return EGA information */ regs.h.ah = 0x12; regs.W.bx = 0x10; PDCINT(0x10, regs); if ((regs.h.bl != 0x10) && (retval == _NONE)) { /* An EGA BIOS exists */ regs.h.ah = 0x12; regs.h.bl = 0x10; PDCINT(0x10, regs); if (regs.h.bh == 0) retval = _EGACOLOR; else retval = _EGAMONO; } else if (retval == _NONE) { /* Now we know we only have CGA or MDA */ PDCINT(0x11, regs); switch (regs.h.al & 0x30) { case 0x10: case 0x20: retval = _CGA; break; case 0x30: retval = _MDA; break; default: retval = _NONE; } } } if (video_base == 0x3d4) { pdc_video_seg = 0xb800; switch (retval) { case _EGAMONO: retval = _EGACOLOR; break; case _VGAMONO: retval = _VGACOLOR; } } if (video_base == 0x3b4) { pdc_video_seg = 0xb000; switch (retval) { case _EGACOLOR: retval = _EGAMONO; break; case _VGACOLOR: retval = _VGAMONO; } } if ((retval == _NONE) #ifndef CGA_DIRECT || (retval == _CGA) #endif ) pdc_direct_video = FALSE; if ((unsigned)pdc_video_seg == 0xb000) SP->mono = TRUE; else SP->mono = FALSE; /* Check for DESQview shadow buffer thanks to paganini@ax.apc.org for the GO32 fix */ #ifndef __WATCOMC__ regs.h.ah = 0xfe; regs.h.al = 0; regs.x.di = pdc_video_ofs; # ifdef __DJGPP__ regs.x.es = pdc_video_seg; __dpmi_int(0x10, ®s); pdc_video_seg = regs.x.es; # else segs.es = pdc_video_seg; int86x(0x10, ®s, ®s, &segs); pdc_video_seg = segs.es; # endif pdc_video_ofs = regs.x.di; #endif if (!pdc_adapter) pdc_adapter = retval; return _sanity_check(retval); } /* close the physical screen -- may restore the screen to its state before PDC_scr_open(); miscellaneous cleanup */ void PDC_scr_close(void) { #if SMALL || MEDIUM # ifndef __PACIFIC__ struct SREGS segregs; # endif int ds; #endif PDC_LOG(("PDC_scr_close() - called\n")); if (getenv("PDC_RESTORE_SCREEN") && saved_screen) { #ifdef __DJGPP__ dosmemput(saved_screen, saved_lines * saved_cols * 2, (unsigned long)_FAR_POINTER(pdc_video_seg, pdc_video_ofs)); #else # if (SMALL || MEDIUM) # ifdef __PACIFIC__ ds = FP_SEG((void far *)saved_screen); # else segread(&segregs); ds = segregs.ds; # endif movedata(ds, (int)saved_screen, pdc_video_seg, pdc_video_ofs, (saved_lines * saved_cols * 2)); # else memcpy((void *)_FAR_POINTER(pdc_video_seg, pdc_video_ofs), (void *)saved_screen, (saved_lines * saved_cols * 2)); # endif #endif free(saved_screen); saved_screen = NULL; } reset_shell_mode(); if (SP->visibility != 1) curs_set(1); /* Position cursor to the bottom left of the screen. */ PDC_gotoyx(PDC_get_rows() - 2, 0); } void PDC_scr_free(void) { if (SP) free(SP); if (pdc_atrtab) free(pdc_atrtab); pdc_atrtab = (unsigned char *)NULL; } /* open the physical screen -- allocate SP, miscellaneous intialization, and may save the existing screen for later restoration */ int PDC_scr_open(int argc, char **argv) { #if SMALL || MEDIUM # ifndef __PACIFIC__ struct SREGS segregs; # endif int ds; #endif int i; PDC_LOG(("PDC_scr_open() - called\n")); SP = calloc(1, sizeof(SCREEN)); pdc_atrtab = calloc(PDC_COLOR_PAIRS * PDC_OFFSET, 1); if (!SP || !pdc_atrtab) return ERR; for (i = 0; i < 16; i++) curstoreal[realtocurs[i]] = i; SP->orig_attr = FALSE; pdc_direct_video = TRUE; /* Assume that we can */ pdc_video_seg = 0xb000; /* Base screen segment addr */ pdc_video_ofs = 0x0; /* Base screen segment ofs */ pdc_adapter = _query_adapter_type(); pdc_scrnmode = _get_scrn_mode(); pdc_font = _get_font(); SP->lines = PDC_get_rows(); SP->cols = PDC_get_columns(); SP->mouse_wait = PDC_CLICK_PERIOD; SP->audible = TRUE; /* If the environment variable PDCURSES_BIOS is set, the DOS int10() BIOS calls are used in place of direct video memory access. */ if (getenv("PDCURSES_BIOS")) pdc_direct_video = FALSE; /* This code for preserving the current screen. */ if (getenv("PDC_RESTORE_SCREEN")) { saved_lines = SP->lines; saved_cols = SP->cols; saved_screen = malloc(saved_lines * saved_cols * 2); if (!saved_screen) { SP->_preserve = FALSE; return OK; } #ifdef __DJGPP__ dosmemget((unsigned long)_FAR_POINTER(pdc_video_seg, pdc_video_ofs), saved_lines * saved_cols * 2, saved_screen); #else # if SMALL || MEDIUM # ifdef __PACIFIC__ ds = FP_SEG((void far *) saved_screen); # else segread(&segregs); ds = segregs.ds; # endif movedata(pdc_video_seg, pdc_video_ofs, ds, (int)saved_screen, (saved_lines * saved_cols * 2)); # else memcpy((void *)saved_screen, (void *)_FAR_POINTER(pdc_video_seg, pdc_video_ofs), (saved_lines * saved_cols * 2)); # endif #endif } SP->_preserve = (getenv("PDC_PRESERVE_SCREEN") != NULL); return OK; } /* the core of resize_term() */ int PDC_resize_screen(int nlines, int ncols) { PDC_LOG(("PDC_resize_screen() - called. Lines: %d Cols: %d\n", nlines, ncols)); if( !stdscr) /* window hasn't been created yet; we're */ { /* specifying its size before doing so */ return OK; /* ...which doesn't work in DOS */ } /* Trash the stored value of orig_cursor -- it's only good if the video mode doesn't change */ SP->orig_cursor = 0x0607; switch (pdc_adapter) { case _EGACOLOR: if (nlines >= 43) _set_font(_FONT8); else _set_80x25(); break; case _VGACOLOR: if (nlines > 28) _set_font(_FONT8); else if (nlines > 25) _set_font(_FONT14); else _set_80x25(); } PDC_set_blink(COLORS == 8); return OK; } void PDC_reset_prog_mode(void) { PDC_LOG(("PDC_reset_prog_mode() - called.\n")); } void PDC_reset_shell_mode(void) { PDC_LOG(("PDC_reset_shell_mode() - called.\n")); } void PDC_restore_screen_mode(int i) { if (i >= 0 && i <= 2) { pdc_font = _get_font(); _set_font(saved_font[i]); if (_get_scrn_mode() != saved_scrnmode[i]) _set_scrn_mode(saved_scrnmode[i]); } } void PDC_save_screen_mode(int i) { if (i >= 0 && i <= 2) { saved_font[i] = pdc_font; saved_scrnmode[i] = pdc_scrnmode; } } void PDC_init_pair(short pair, short fg, short bg) { unsigned char att, temp_bg; chtype i; fg = curstoreal[fg]; bg = curstoreal[bg]; for (i = 0; i < PDC_OFFSET; i++) { att = fg | (bg << 4); if (i & (A_REVERSE >> PDC_ATTR_SHIFT)) att = bg | (fg << 4); if (i & (A_UNDERLINE >> PDC_ATTR_SHIFT)) att = 1; if (i & (A_INVIS >> PDC_ATTR_SHIFT)) { temp_bg = att >> 4; att = temp_bg << 4 | temp_bg; } if (i & (A_BOLD >> PDC_ATTR_SHIFT)) att |= 8; if (i & (A_BLINK >> PDC_ATTR_SHIFT)) att |= 128; pdc_atrtab[pair * PDC_OFFSET + i] = att; } } int PDC_pair_content(short pair, short *fg, short *bg) { *fg = realtocurs[pdc_atrtab[pair * PDC_OFFSET] & 0x0F]; *bg = realtocurs[(pdc_atrtab[pair * PDC_OFFSET] & 0xF0) >> 4]; return OK; } /* _egapal() - Find the EGA palette value (0-63) for the color (0-15). On VGA, this is an index into the DAC. */ static short _egapal(short color) { PDCREGS regs; regs.W.ax = 0x1007; regs.h.bl = curstoreal[color]; PDCINT(0x10, regs); return regs.h.bh; } bool PDC_can_change_color(void) { return (pdc_adapter == _VGACOLOR); } /* These are only valid when pdc_adapter == _VGACOLOR */ int PDC_color_content(short color, short *red, short *green, short *blue) { PDCREGS regs; /* Read single DAC register */ regs.W.ax = 0x1015; regs.h.bl = _egapal(color); PDCINT(0x10, regs); /* Scale and store */ *red = DIVROUND((unsigned)(regs.h.dh) * 1000, 63); *green = DIVROUND((unsigned)(regs.h.ch) * 1000, 63); *blue = DIVROUND((unsigned)(regs.h.cl) * 1000, 63); return OK; } int PDC_init_color(short color, short red, short green, short blue) { PDCREGS regs; /* Scale */ regs.h.dh = DIVROUND((unsigned)red * 63, 1000); regs.h.ch = DIVROUND((unsigned)green * 63, 1000); regs.h.cl = DIVROUND((unsigned)blue * 63, 1000); /* Set single DAC register */ regs.W.ax = 0x1010; regs.W.bx = _egapal(color); PDCINT(0x10, regs); return OK; } /* Does nothing in the DOS (or OS/2 or Win32 console) flavors of PDCurses, which lack user resizing. See X11 or Win32a versions of this function for details of what it does on platforms that do support user resizing. */ void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines, const int new_min_cols, const int new_max_cols) { } /* PDC_set_function_key() does nothing on this platform */ int PDC_set_function_key( const unsigned function, const int new_key) { int old_key = -1; if( function < PDC_MAX_FUNCTION_KEYS) { old_key = PDC_shutdown_key[function]; PDC_shutdown_key[function] = new_key; } return( old_key); } curses-1.4.4/vendor/PDCurses/dos/mscdos.lrf0000644000004100000410000000135114201713275020625 0ustar www-datawww-data-+addch.obj & -+addchstr.obj & -+addstr.obj & -+attr.obj & -+beep.obj & -+bkgd.obj & -+border.obj & -+clear.obj & -+color.obj & -+delch.obj & -+deleteln.obj & -+deprec.obj & -+getch.obj & -+getstr.obj & -+getyx.obj & -+inch.obj & -+inchstr.obj & -+initscr.obj & -+inopts.obj & -+insch.obj & -+insstr.obj & -+instr.obj & -+kernel.obj & -+keyname.obj & -+mouse.obj & -+move.obj & -+outopts.obj & -+overlay.obj & -+pad.obj & -+panel.obj & -+printw.obj & -+refresh.obj & -+scanw.obj & -+scr_dump.obj & -+scroll.obj & -+slk.obj & -+termattr.obj & -+terminfo.obj & -+touch.obj & -+util.obj & -+window.obj & -+debug.obj & -+pdcclip.obj & -+pdcdisp.obj & -+pdcgetsc.obj & -+pdckbd.obj & -+pdcscrn.obj & -+pdcsetsc.obj & -+pdcutil.obj & ,lib.map; curses-1.4.4/vendor/PDCurses/HISTORY.md0000644000004100000410000022723614201713275017542 0ustar www-datawww-dataPDCurses 4.0.4 - 2019 Jan 20 ========================= Major new feature: ------------------- - New VT backend. Works within an xterm or xterm-based terminal and some other terminals. Mostly works in the Linux console, and on Win10 directly and on Win9x/DOS if ANSI.SYS (or NANSI or NNANSI .SYS or .COM) are installed. Minor new features: ------------------- - SDL2 variant: dimmed, bold, blinking, and RGB text are handled, as is window resizing. - DOS variant: cross-compilation from GNU/Linux works with both DJGPP and Watcom C/C++; and, 16-bit and 32-bit Watcom makefiles have been combined into one - Many modifications (and some bug fixes) taken from William McBrine's branch. An effort has been made to narrow the gap between the forks where possible. But both forks are moving targets with different design choices and priorities. - Demos improved to show version info Bug fixes ------------------- - compilation warnings/errors with some compilers in some variants #53, #57, #58, #65, ... - newtest sample was broken in all widw variants #60 - the paste button printed debug output #62 - some corner cases (midnight crossing, atomicity of tick count reads) in DOS version of napms() were not handled well PDCurses 4.0.2 - 2017 Sep 12 ========================= Major new features: ------------------- - New WinGUI (Windows GUI) and SDL2 backends. SDL1 is still supported, but may eventually go away. - Bold, italic, underlined, overlined, dimmed, 'strikeout', blinking text, 256 colors and color pairs, and full RGB colors. These are all supported in WinGUI and mostly supported in X11, SDL1 and SDL2. - In WinGUI, one can choose a font, and both programmatic and user resizing are supported. (Recompiling is necessary to change the font in X11.) - (WinGUI only) Support of SMP Unicode (points beyond 64K) and combining characters. This may be extended to X11 and SDL2 eventually. - Demos corrected to be buildable and testable with `ncurses`. Minor new features ------------------- (note that not all of these are available on all backends) - Support for up to nine mouse buttons and wheel and tilt-wheel mice, and double and triple mouse clicks - (X11, WinGUI, Win32) Extended range of keys that are recognized. This now includes most of the "oddball" keys such as 'browser back' and 'favorites' found on some keyboards. - Blinking cursors in WinGUI and X11 of various shapes (this could be extended to SDLx eventually). - In X11 and WinGUI, one can call resize_term( ) before initscr( ) to set the initial window size. - Soft Label Keys (SLKs) are considerably more flexible, with the ability to set arbitrary numbers of keys and groupings. See slk.c for details. This applies to all backends. - Many changes to `testcurs` to test all these new features, and `newtest` added to test still more features. - Option to get detailed version information of the used PDCurses library at run time with new exported `PDC_version` as `PDC_version_info` structure. - ACS_x and WACS_x #defines extended to include a lot of "alternative characters" that overlap in Unicode and CP-437: double-line box chars, card suits, vulgar fractions, etc. This applies to all backends. See `acs_defs.h` for the full list. - Cleaned up some makefiles for Win32 and WinGUI. On both platforms, `vcwin32.mak` can now be used with the Intel(R) compiler, and `mingwin32.mak` can be used to cross-compile from Linux, or in `command.com` under Windows, or with Cygwin/MSYS. Also added a makefile for Digital Mars for the DOS version. - The "def" files that were needed before to create PDCurses on Windows are removed as they are no longer necessary. PDCurses 3.4 - 2008/09/08 ========================= Nothing much new this time, but I've been sitting on some bug fixes for almost a year, so it's overdue. Apart from bugs, the main changes are in the documentation. New features: ------------------- - setsyx() is now a function rather than a macro. Bug fixes and such: ------------------- - In x11, the xc_atrtab table size was under-calculated by half, resulting in crashes at (oddly) certain line counts. (It should've crashed a lot more.) Reported by Mark Hessling. - Test for moved cursor was omitting the window origin offset. Reported by Carey Evans. - Is DOS and OS/2, the value for max items in key_table was still wrong. Reported by C.E. - Changed isendwin() so it won't crash after delscreen(). - Ensure zero-termination in PDC_mbstowcs() and PDC_wcstombs(). - Disable QuickEdit Mode when enabling mouse input for the Win32 console; reported by "Zalapkrakna". - Fix for building under Innotek C (I hope). Report by Elbert Pol, fix courtesy of Paul Smedley. - Unified exports list with no duplicates -- pdcurses.def is now built from components at compile time. - Don't install curspriv.h, and don't include it with binary distributions. - Building DLLs with LCC is no longer supported, due to the primitive nature of its make.exe. - Export the terminfo stub functions from the DLLs, too. - Added support for Apple's ".dylib" in configure. Suggested by Marc Vaillant (who says it's needed with OS 10.5.) - In sdl1/Makefile.mng, ensure that CC is set. - In the gcc makefiles, "$?" didn't really have the desired effect -- _all_ the dependencies showed up on the command line, including curses.h, and pdcurses.a twice. And apparently, this can mess up some old version (?) of MinGW. So, revert to spelling out "tuidemo.o tui.o". Reported by "Howard L." - Extensive documentation revision and reorganizing. More to do here. For example, I moved the build instructions from INSTALL (which never really described installation) to the platform-specific READMEs. - New indentation standard: four spaces, no tabs. ------------------------------------------------------------------------ PDCurses 3.3 - 2007/07/11 ========================= This release adds an SDL backend, refines the demos, and is faster in some cases. New features: ------------------- - SDL port. See INSTALL, doc/sdl.txt and sdl1/* for details. - Double-buffering -- minimize screen writes by checking, in doupdate() and wnoutrefresh(), whether the changes to curscr are really changes. In most cases, this makes no difference (writes were already limited to areas marked as changed), but it can greatly reduce the overhead from touchwin(). It also helps if you have small, separated updates on the same line. - The PDC_RGB colors can now be used, or not, with any platform (as long as the same options are used when compiling both the library and apps). This may help if you have apps that are hardwired to assume certain definitions. - Restored the use_default_colors() stuff from the ncurses versions of the rain and worm demos, to make them "transparent" (this is useful now, with the SDL port); added transparency to newdemo. - Added setlocale() to tuidemo, to make it easier to browse files with non-ASCII characters. - Sped up firework demo by replacing unneeded clear() and init_pair() calls. - Allow exit from ptest demo by typing 'q'. - New functions for implementors: PDC_pair_content() and PDC_init_pair() (the old pdc_atrtab stuff was arguably the last remnant of code in the pdcurses directory that was based on platform details). Bug fixes and such: ------------------- - Implicit wrefresh() needs to be called from wgetch() when the window's cursor position is changed, even if there are no other changes. - Set SP->audible on a per-platform basis, as was documented in IMPLEMNT, but not actually being done. - Minor tweaks for efficiency and readability, notably with wscrl(). - tuidemo didn't work correctly on monochrome screens when A_COLOR was defined -- the color pair numbers appeared as the corresponding character; also, the input box was (I now realize) broken with ncurses since our 2.7, and broke more subtly with PDCurses' new implicit refresh handling; also, the path to the default file for the Browse function was a bit off. - Assume in the demos that curs_set() is always available -- there's no good test for this, and the existing tests were bogus. - Made the command-line parameter for ptest work. (If given an argument, it delays that number of milliseconds between changes, instead of waiting for a key, and automatically loops five times.) - Building the Win32 DLL with MinGW or Cygwin wouldn't work from outside the platform directory. - Building the X11 port with Cygwin required manually editing the Makefile after configuring; no longer. Reported by Warren W. Gay. - Minor tightening of configure and makefiles. - Bogus references to "ACS_BLCORNER" in the border man page. Reported by "Walrii". - slk_wlabel() was not documented. - Spelling cleanup. - Changed RCSIDs to not end with a semicolon -- avoids warnings when compiling with the -pedantic option. - Merged latin-1.txt into x11.txt. - Updated config.guess and config.sub to more recent versions. ------------------------------------------------------------------------ PDCurses 3.2 - 2007/06/06 ========================= This release mainly covers changes to the build process, along with a few structural changes. New features: ------------------- - The panel library has been folded into the main library. What this means is that you no longer need to specify "-lpanel" or equivalent when linking programs that use panel functionality with PDCurses; however, panel.lib/.a is still provided (as a copy of pdcurses.lib/.a) so that you can, optionally, build your projects with no changes. It also means that panel functionality is available with the DLL or shared library. Note that panel.h remains separate from curses.h. - Setting the PDCURSES_SRCDIR environment variable is no longer required before building, unless you want to build in a location other than the platform directory. (See INSTALL.) - MinGW and Cygwin makefiles support building DLLs, via the "DLL=Y" option. Partly due to Timofei Shatrov. - Support for the Digital Mars compiler. - Watcom makefiles now use the "loaddll" feature. Bug fixes and such: ------------------- - Eliminated the platform defines (DOS, WIN32, OS2, XCURSES) from curses.h, except for X11-specific SCREEN elements and functions. Dynamically-linked X11 apps built against an old version will have their red and blue swapped until rebuilt. (You can define PDC_RGB to build the library with the old color scheme, but it would also have to be defined when building any new app.) Any app that depends on PDCurses to determine the platform it's building on will have to make other arrangements. - Documentation cleanup -- added more details; removed some content that didn't apply to PDCurses; moved the doc-building tool to the doc directory; changed *.man to *.txt. - The EMX makefile now accepts "DLL=Y", builds pdcurses.dll instead of curses.dll, builds either the static library or the DLL (not both at once), and links all the demos with the DLL when building it. - In Win32, read the registry only when needed: when init_color() or color_content() is called, instead of at startup. - A few additional consts in declarations. - The Win32 compilers that build DLLs now use common .def files. - panel.h functions sorted by name, as with other .h files; curses.h is no longer included by repeated inclusions of panel.h or term.h. - Simplified Borland makefiles. - Makefile.aix.in depended on a file, xcurses.exp, that was never there. This problem was fixed as part of the change to common .def files; however, I still haven't been able to test building on AIX. ------------------------------------------------------------------------ PDCurses 3.1 - 2007/05/03 ========================= Primarily clipboard-related fixes, and special UTF-8 support. New features: ------------------- - "Force UTF-8" mode, a compile-time option to force the use of UTF-8 for multibyte strings, instead of the system locale. (Mainly for Windows, where UTF-8 doesn't work well in the console.) See INSTALL. - Multibyte string support in PDC_*clipboard() functions, and in Win32's PDC_set_title(). - Added the global string "ttytype", per other curses implementations, for compatibility with old BSD curses. - Real functions for the "quasi-standard aliases" -- crmode(), nocrmode(), draino(), resetterm(), fixterm() and saveterm(). (Corresponding macros removed.) Bug fixes and such: ------------------- - In Win32, under NT-family OSes, the scrollback buffer would be restored by endwin(), but would not be turned off again when resuming curses after an endwin(). The result was an odd, partly-scrolled-up display. Now, the buffer is toggled by PDC_reset_prog_mode() and PDC_reset_shell_mode(), so it's properly turned off when returning from an endwin(). - In 3.0, selection in X11 didn't work. (Well, the selecting worked, but the pasting elsewhere didn't.) This was due to the attempted fix "don't return selection start as a press event," so that's been reverted for now. - PDC_setclipboard() was locking up in X11. Reported by Mark Hessling. - Missing underscore in the declaration of XC_say() prevented compilation with PDCDEBUG defined. Reported by M.H. - Off-by-one error in copywin() -- the maximum coordinates for the destination window should be inclusive. Reported by Tiago Dionizio. - Start in echo mode, per X/Open. Reported by T.D. - Strip leading and trailing spaces from slk labels, per a literal reading of X/Open. Suggested by Alexey Miheev (about ncurses, but it also applies here). - The #endif for __PDCURSES__ needs to come _after_ the closing of the extern "C". This has been broken since June 2005. Fortunately (?), it only shows up if the file is included multiple times, and then only in C++. Reported on the DOSBox forums. - Use CF_OEMTEXT instead of CF_TEXT in the narrow versions of the clipboard functions in Win32, to match the console. - Changed the format of the string returned from longname(). - In the clipboard test in the testcurs demo, use a single mvprintw() to display the return from PDC_getclipboard(), instead of a loop of addch(), which was incompatible with multibyte strings. - Moved has_key() into the keyname module, and documented it. - Moved RIPPEDOFFLINE to curspriv.h. - Typos in IMPLEMNT. ------------------------------------------------------------------------ PDCurses 3.0 - 2007/04/01 ========================= The focuses for this release are X/Open conformance, i18n, better color support, cleaner code, and more consistency across platforms. This is only a brief summary of the changes. For more details, consult the CVS log. New features: ------------------- - An almost complete implementation of X/Open curses, including the wide-character and attr_t functions (but excluding terminfo). The wide-character functions work only in Win32 and X11, for now, and require building the library with the appropriate options (see INSTALL). Note that this is a simplistic implementation, with exactly one wchar_t per cchar_t; the only characters it handles properly are those that are one column wide. - Support for X Input Methods in the X11 port (see INSTALL). When built this way, the internal compose key support is disabled in favor of XIM's, which is a lot more complete, although you lose the box cursor. - Multibyte character support in the non-wide string handling functions, per X/Open. This only works when the library is built with wide- character support enabled. - Mouse support for DOS and OS/2. The DOS version includes untested support for scroll wheels, via the "CuteMouse" driver. - An ncurses-compatible mouse interface, which can work in parallel with the traditional PDCurses mouse interface. See the man page (or mouse.c) for details. - DOS and OS/2 can now return modifiers as keys, as in Win32 and X11. - COLORS, which had been fixed at 8, is now either 8 or 16, depending on the terminal -- usually 16. When it's 8, blinking mode is enabled (controlled as before by the A_BLINK attribute); when it's 16, bright background colors are used instead. On platforms where it can be changed, the mode is toggled by the new function PDC_set_blink(). PDCurses tries to set PDC_set_blink(FALSE) at startup. (In Win32, it's always set to FALSE; in DOS, with other than an EGA or VGA card, it can't be.) Also, COLORS is now set to 0 until start_color() is called. - Corresponding to the change in COLORS, COLOR_PAIRS is now 256. - Working init_color() and color_content(). The OS/2 version of init_color() works only in a full-screen session; the Win32 version works only in windowed mode, and only in NT-family OSes; the DOS version works only with VGA adapters (real or simulated). The Win32 version is based mostly on James Brown's setconsoleinfo.c (www.catch22.net). - use_default_colors(), assume_default_colors(), and curses_version(), after ncurses. - Added global int TABSIZE, after ncurses and Solaris curses; removed window-specific _tabsize. - Logical extension to the wide-character slk_ funcs: slk_wlabel(), for retrieving the label as a wide-character string. - A non-macro implementation of ncurses' wresize(). - Working putwin(), getwin(), scr_dump() and scr_restore(). - A working acs_map[]. Characters from the ACS are now stored in window structures as a regular character plus the A_ALTCHARSET attribute, and rendered to the ACS only when displayed. (This allows, for example, the correct display on one platform of windows saved from another.) - In X11, allow selection and paste of UTF8_STRING. - The testcurs demo now includes a color chart and init_color() test, a wide character input test, a display of wide ACS characters with sample Unicode text, a specific test of flash(), more info in the resize test, and attempts to change the width as well as the height. - Command-line option for MSVC to build DLLs (see INSTALL). Also, the naming distinction for DLLs ("curses" vs. "pdcurses") is abandoned, and either the static lib or DLL is built, not both at once (except for X11). - For backwards compatibility, a special module just for deprecated functions -- currently PDC_check_bios_key(), PDC_get_bios_key(), PDC_get_ctrl_break() and PDC_set_ctrl_break(). These shouldn't be used in applications, but currently are... in fact, all the "private" functions (in curspriv.h) are subject to change and should be avoided. - A new document, IMPLEMNT, describing PDCurses' internal functions for those wishing to port it to new platforms. - Mark Hessling has released the X11 port to the public domain. (However, x11/ScrollBox* retain their separate copyright and MIT-like license.) Bug fixes and such: ------------------- - Most of the macros have been removed (along with the NOMACROS ifdef). The only remaining ones are those which have to be macros to work, and those that are required by X/Open to be macros. There were numerous problems with the macros, and no apparent reason to keep them, except tradition -- although it was PCcurses 1.x that first omitted them. - Clean separation of platform-specific code from the rest. Outside of the platform directories, there remain only a few ifdefs in curses.h and curspriv.h. - General reorganization and simplification. - Documentation revisions. - When expanding control characters in addch() or insch(), retain the attributes from the chtype. - Preserve the A_ALTCHARSET attribute in addch() and insch(). - Per X/Open, beep() should always return OK. - On platforms with a controlling terminal (i.e., not X11), curs_set(1) now sets the cursor to the shape it had at the time of initscr(), rather than always making it small. (Exception for DOS: If the video mode has been changed by PDC_resize_screen(), curs_set(1) reverts to line 6/7.) The shape is taken from SP->orig_cursor (the meaning of which is platform-specific). - Stop updating the cursor position when the cursor is invisible (this gives a huge performance boost in Win 9x); update the cursor position from curs_set() if changing from invisible to visible. - Some tweaking of the behavior of def_prog_mode(), def_shell_mode(), savetty(), reset_prog_mode(), reset_shell_mode() and resetty()... still not quite right. - flash() was not implemented for Win32 or X. A portable implementation is now used for all platforms. Note that it's much slower than the old (DOS and OS/2) version, but this is only apparent on an extremely slow machine, such as an XT. - In getstr(), backspacing on high-bit characters caused a double backspace. - hline() and vline() used an incorrect (off by one) interpretation of _maxx and _maxy. If values of n greater than the max were specified, these functions could access unallocated memory. - innstr() is supposed to return the number of characters read, not just OK or ERR. Reported by Mike Aubury. - A proper implementation of insch() -- the PDC_chadd()-based version wasn't handling the control characters correctly. - Return ASCII and control key names from keyname() (problem revealed by ncurses' movewindow test); also, per X/Open, return "UNKNOWN KEY" when appropriate, rather than "NO KEY NAME". - Turn off the cursor from leaveok(TRUE), even in X11; leaveok(FALSE) now calls curs_set(1), regardless of the previous state of the cursor. - In the slk area, BUTTON_CLICKED events now translate to function keys, along with the previously recognized BUTTON_PRESSED events. Of course, it should really be checking the events specified by map_button(), which still doesn't work. - napms(0) now returns immediately. - A unified napms() implementation for DOS -- no longer throttles the CPU when built with any compiler. - Allow backspace editing of the nocbreak() buffer. - pair_content(0, ...) is valid. - There was no check to ensure that the pnoutrefresh() window fit within the screen. It now returns an ERR if it doesn't. - In X11, resize_term() must be called with parameters (0, 0), and only when SP->resized is set, else it returns ERR. - Copy _bkgd in resize_window(). Patch found on Frederic L. W. Meunier's web site. - slk_clear() now removes the buttons completely, as in ncurses. - Use the current foreground color for the line attributes (underline, left, right), unless PDC_set_line_color() is explicitly called. After setting the line color, you can reset it to this mode via "PDC_set_line_color(-1)". - Removed non-macro implementations of COLOR_PAIR() and PAIR_NUMBER(). - Dispensed with PDC_chadd() and PDC_chins() -- waddch() and winsch() are now (again) the core functions. - Dropped or made static many obsolete, unused, and/or broken functions, including PDC_chg_attrs(), PDC_cursor_on() and _off(), PDC_fix_cursor(), PDC_get_attribute(), PDC_get_cur_col() and _row(), PDC_set_80x25(), PDC_set_cursor_mode(), PDC_set_rows(), PDC_wunderline(), PDC_wleftline(), PDC_wrightline(), XCursesModifierPress() and XCurses_refresh_scrollbar(). - Obsolete/unused defines: _BCHAR, _GOCHAR, _STOPCHAR, _PRINTCHAR _ENDLINE, _FULLWIN and _SCROLLWIN. - Obsolete/unused elements of the WINDOW struct: _pmax*, _lastp*, _lasts*. - Obsolete/unused elements of the SCREEN struct: orgcbr, visible_cursor, sizeable, shell, blank, cursor, orig_emulation, font, orig_font, tahead, adapter, scrnmode, kbdinfo, direct_video, video_page, video_seg, video_ofs, bogus_adapter. (Some of these persist outside the SCREEN struct, in the platform directories.) Added mouse_wait and key_code. - Removed all the EMALLOC stuff. Straight malloc calls were used elsewhere; it was undocumented outside of comments in curspriv.h; and there are better ways to use a substitute malloc(). - Single mouse clicks are now reportable on all platforms (not just double-clicks). And in general, mouse event reporting is more consistent across platforms. - The mouse cursor no longer appears in full-screen mode in Win32 unless a nonzero mouse event mask is used. - ALT-keypad input now works in Win32. - In Win32, SetConsoleMode(ENABLE_WINDOW_INPUT) is not useful, and appears to be the source of a four-year-old bug report (hanging in THE) by Phil Smith. - Removed the PDC_THREAD_BUILD stuff, which has never worked. For the record: PDCurses is not thread-safe. Neither is ncurses; and the X/Open curses spec explicitly makes it a non-requirement. - With the internal compose key system in the X11 port, modifier keys were breaking out of the compose state, making it impossible to type accented capitals, etc. Also, Multi_key is now the default compose key, instead of leaving it undefined by default; and a few more combos are supported. - In X11, the first reported mouse event after startup always read as a double-click at position 0, 0. (This bug was introduced in 2.8.) - In X11, don't return selection start as a press event. (Shift-click on button 1 is still returned.) - In X11, properly handle pasting of high-bit chars. (It was doing an unwanted sign extension.) - In X11, BUTTON_MOVED was never returned, although PDC_MOUSE_MOVED was set. - The fix in 2.8 for the scroll wheel in X11 wasn't very good -- it did report the events as scroll wheel events, but it doubled them. Here's a proper fix. - Changed mouse handling in X11: Simpler translation table, with XCursesPasteSelection() called from XCursesButton() instead of the translation table; require shift with button 1 or 2 for select or paste when mouse events are being reported (as with ncurses), allowing passthrough of simple button 2 events. This fixes the previously unreliable button 2 behavior. - Modifier keys are now returned on key up in X11, as in Win32. And in general, modifier key reporting is more consistent across platforms. - Modifiers are not returned as keys when a mouse click has occurred since the key press. - In BIOS mode (in DOS), count successive identical output bytes, and make only one BIOS call for all of them. This dramatically improves performance. - The cursor position was not always updated correctly in BIOS mode. - In testcurs, the way the ACS test was written, it would really only work with a) PDCurses (with any compiler), or b) gcc (with any curses). Here's a more portable implementation. - Better reporting of mouse events in testcurs. - Blank out buffer and num before the scanw() test in testcurs, in case the user just hits enter or etc.; clear the screen after resizing. - Allow tuidemo to use the last line. - Separate left/right modifier keys are now reported properly in Win32. (Everything was being reported as _R.) - Attempts to redirect input in Win32 now cause program exit and an error message, instead of hanging. - Dropped support for the Microway NDP compiler. - Some modules renamed, rearranged. - Fixes for errors and warnings when building with Visual C++ 2005. - In MSVC, the panel library didn't work with the DLL. - Complete export lists for DLLs. - Simplified makefiles; moved common elements to .mif files; better optimization; strip demos when possible. - Changed makefile targets of "pdcurses.a/lib" and "panel.a/lib" to $(LIBCURSES) and $(LIBPANEL). Suggestion of Doug Kaufman. - Changed "install" target in the makefile to a double-colon rule, to get around a conflict with INSTALL on non-case-sensitive filesystems, such as Mac OS X's HFS+. Reported by Douglas Godfrey et al. - Make PDCurses.man dependent on manext. Suggestion of Tiziano Mueller. - Set up configure.ac so autoheader works; removed some obsolescent macros. Partly the suggestion of T.M. - The X11 port now builds in the x11 directory (including the demos), as with other ports. - The X11 port should now build on more 64-bit systems. Partly due to M.H. - The default window title and icons for the X11 port are now "PDCurses" instead of "XCurses". - Internal functions and variables made static where possible. - Adopted a somewhat more consistent naming style: Internal functions with external linkage, and only those, have the prefix "PDC_"; external variables that aren't part of the API use "pdc_"; static functions use "_"; and "XC_" and "xc_" prefixes are used for functions and variables, respectively, that are shared between both processes in the X11 port. Also eliminated camel casing, where possible. - Changed the encoding for non-ASCII characters in comments and documentation from Latin-1 to UTF-8. ------------------------------------------------------------------------ PDCurses 2.8 - 2006/04/01 ========================= As with the previous version, you should assume that apps linked against older dynamic versions of the library won't work with this one until recompiled. New features: - Simpler, faster. - Declarations for all supported, standard functions, per the X/Open Curses 4.2 spec, with the notable exception of getch() and ungetch(). You can disable the use of the macro versions by defining NOMACROS before including curses.h (see xmas.c for an example). NOMACROS yields smaller but theoretically slower executables. - New functions: vwprintw(), vwscanw(), vw_printw() and vw_scanw(). This completes the list of X/Open 4.2 functions, except for those concerned with attr_t and wide characters. Some (especially the terminfo/termcap functions) aren't yet fully fleshed out, though. - Non-macro implementations for COLOR_PAIR(), PAIR_NUMBER(), getbkgd(), mvgetnstr(), mvwgetnstr(), mvhline(), mvvline(), mvwhline(), and mvwvline(). (The macros are still available, too.) - newterm() works now, in a limited way -- the parameters are ignored, and only the first invocation will work (i.e., only one SCREEN can be used). - start_color() works now -- which is to say, if you _don't_ call it, you'll only get monochrome output. Also, without calling it, the terminal's default colors will be used, where supported (currently only in Win32). This is equivalent to the PDC_ORIGINAL_COLORS behavior introduced in 2.7, except that _only_ the default colors will be used. (PDC_ORIGINAL_COLORS is still available, if you want to combine the use of specific colors and the default colors.) - New logic for termname() and longname(): termname() always returns "pdcurses"; longname() returns "PDCurses for [platform] [adapter] [COLOR/MONO]-YxX" (adapter is only defined for DOS and OS/2). This is the first time these functions return _anything_ in Win32. - New installation method for XCurses: the header files are placed in a subdirectory "xcurses" within the include directory, rather than being renamed. (But the renamed xcurses.h and xpanel.h are also installed, for backwards compatibility.) curspriv.h and term.h are now available, and existing curses-based code need no longer be edited to use XCurses' curses.h. And with no more need for explicit XCursesExit() calls (see below), your code need not be changed at all to move from another curses implementation to XCurses. It can be as simple as "gcc -I/usr/local/include/xcurses -lXCurses -oprogname progname.c". - Combined readme.* into this HISTORY file, and incorporated the old 1.x (PCcurses) history. - New functionality for the testcurs demo: ACS character display; menu support for PgUp, PgDn, Home and End; centered menu; and it can now be resized in X. - Added modified versions of the rain and worm demos from ncurses. Bug fixes and such: - Big cleanup of dead and redundant code, including unneeded defines, ifdefs, and structure elements. - flushinp() was not implemented for Win32. - resetty() was not restoring LINES and COLS. - nonl() made '\n' print a line feed without carriage return. This was incorrect. - Removed bogus implementation of intrflush(). - The line-breakout optimization system, disabled by default in 2.7, is removed in 2.8. It simply didn't work, and never has. (The typeahead() function remains, for compatibility, but does nothing.) - The declarations for the printw() and scanw() function families were erroneously ifdef'd. - Safer printw() calls on platforms that support vsnprintf(). - Use the native vsscanf() in DJGPP, MinGW and Cygwin. - ACS_BLOCK now works in X. - Explicit calls to XCursesExit() are no longer needed. - XCURSES is now defined automatically if not DOS, OS2 or WIN32. - The default icon for XCurses wasn't working (had to remove the focus hint code to fix this). Also, the default title is now "XCurses" instead of "main". - Incorrect dimensions (undercounting by two in each direction) were shown while resizing in X. - Scroll wheel events were not always correctly reported in X. - 32 bits are enough for the "long" chtype, but 64 bits were used on a 64-bit system, wasting memory. Now conditioned on _LP64. This could be faster, too. - The short, 16-bit chtype now works with XCurses. - Corrected return value for is_linetouched(), is_wintouched(), can_change_color() and isendwin() (bool instead of int). - timeout(), wtimeout(), idcok() and immedok() return void. - pair_content() takes a short. - Replaced incorrect usages of attr_t with chtype. attr_t is still typedef'd, for backwards compatibility. (It's supposed to be used for the WA_*-style functions, which PDCurses doesn't yet support.) - Added const where required by the spec, and in other appropriate places. - Removed PDC_usleep(). napms() is now the core delay routine. - Fixed poll() support in napms(). - Various changes to the internal PDC_* functions -- don't depend on these, and don't use them unless you absolutely have to. - Some routines accessed window structures in their variable declarations, _before_ checking for a NULL window pointer. - Dropped support for the undocumented PDC_FULL_DISPLAY, wtitle(), and PDC_print(). - Cleaned up remaining warnings. - Reduced unnecessary #include directives -- speeds up compilation. - Fix for demos build in Borland/DOS -- the makefile in 2.7 didn't specify the memory model. Reported by Erwin Waterlander. - Simplified the makefiles; e.g., some now build each demo in a single step, and Watcom no longer uses demos.lnk. Also, the demo exes are now stripped when possible; maximum compression used for archives built by the makefiles; xcurses-config removed as part of "make distclean"; and I tweaked optimization for some platforms. - Reverted to /usr/local/ as default installation directory for XCurses. - Upgraded to autoconf 2.59... instantly doubling the size of the configure script. Ah well. Otherwise, simplified the build system. - Dropped support for pre-ANSI compilers. (It hasn't worked since at least version 2.4, anyway.) - Revised and, I hope, clarified the boilerplate and other comments. - Simplified logging and RCS ids; added RCS ids where missing. - Consistent formatting for all code, approximately equivalent to "indent -kr -i8 -bl -bli0", with adjustments for 80 columns. ------------------------------------------------------------------------ PDCurses 2.7 - 2005/12/30 ========================= INTRODUCTION: Hello all. As of a few weeks ago, I'm the new maintainer for PDCurses. Here's a brief summary of changes in this release. (More details are available in the CVS log and trackers on SourceForge.) NEW FEATURES: - Functions: delscreen(), getattrs(), has_key(), slk_color(), wcolor_set(), wtimeout(). - Macros: color_set(), mvhline(), mvvline(), mvwgetnstr(), mvwhline(), mvwvline(), timeout(), wresize(). - Stub implementations of terminfo functions (including a term.h). - More stubs for compatibility: filter(), getwin(), putwin(), noqiflush(), qiflush(), scr_dump(), scr_init(), scr_restore(), scr_set(), use_env(), vidattr(), vidputs(). - The terminal's default colors are used as curses' default colors when the environment variable "PDC_ORIGINAL_COLORS" is set to any value (Win32 only at the moment). - Simplified build system. - Replaced PDC_STATIC_BUILD with its opposite, PDC_DLL_BUILD (see .mak files for more info). - Minimal implementation of color_content() -- no longer a stub. - Added the remaining ACS defines (ACS_S3, ACS_BBSS, etc.) for DOS/OS2/Win; "enhanced" versions of existing ACS characters used. - Support for scroll wheels. - Support for Pacific C. BUGS FIXED: - Builds correctly (including demos) on all tested platforms (see below); nearly all compiler warnings have been cleaned up; the ptest demo is built on all platforms; "clean" targets are improved. - The ability to build ncurses_tests has been restored (see demos dir). - Line-breakout optimization now defaults to off (equivalent to "typeahead(-1)"), so output is not interrupted by keystrokes (it's supposed to resume on the next refresh(), which wasn't working). - Implicit wrefresh() in wgetch() was not being invoked in nodelay mode. - subpad() was erroneously offsetting from the origin coordinates of the parent pad (which are always -1,-1). - In wborder(), whline(), and wvline(), the current (wattrset) attribute was being used, but not the current background (wbkgd). - Allow Russian 'r' character ASCII 0xe0 to be returned. - termattrs() now also returns A_UNDERLINE, A_REVERSE. - In Win32, with large scrollback buffers set, there was an unwanted "scrollup" effect on startup. - Revamped keyboard handling for Win32. - New screen resize method for Win32. - napms(), delay_output(), etc. now work with Cygwin. - curs_set(0) wasn't working in Win32 in full-screen (ALT-ENTER) mode -- the cursor stayed on. - The A_REVERSE attribute was broken in XCurses. - On 64-bit systems, XCurses was ignoring every other keystroke. - Added focus hints for XCurses. - Demos (except for tuidemo) once again have their proper titles in XCurses (using Xinitscr() instead of the obsolete XCursesProgramName). - The 16-bit chtype is a working option again (by removing #define CHTYPE_LONG from curses.h), except in XCurses. It's not recommended; but if your needs are limited, it still works. - Reset screen size in resetty() under DOS, as in Win32 and OS/2. - Changes for cursor size under DOS. - Automatic setting of BIOS mode for CGA under DOS now works. - The cursor is now always updated in PDC_gotoxy(); this fixes the problem of missing characters in BIOS mode. - Macros nocbreak(), cbreak(), nocrmode(), crmode(), nodelay(), nl() and nonl() now return OK. - ERR and OK are now defined as -1 and 0, respectively, for compatibility with other curses implementations -- note that this change is not binary compatible; you'll have to rebuild programs that use shared/dynamic libraries. - Added "const" to prototypes where appropriate. - Miscellaneous code cleanup. ACKNOWLEDGEMENTS: - Walter Briscoe - Jean-Pierre Demailly - Ruslan Fedyarov - Warren Gay - Florian Grosse-Coosmann - Vladimir Kokovic - Matt Maloy - K.H. Man - Michael Ryazanov - Ron Thibodeau - Alexandr Zamaraev and of course, MARK HESSLING, for his over 13 years of service as the maintainer of PDCurses. Plus, thanks to all who've reported bugs or requested features. Apologies to anyone I've forgotten. I've tested this version on Turbo C++ 3.0 and Borland C++ 3.1 for DOS; DJGPP 2.X; Open Watcom 1.3 for DOS (16 and 32-bit), Windows and OS/2; EMX 0.9d and the "newgcc" version of EMX; Borland C++ 5.5 for Windows; recent versions of MinGW, Cygwin, LCC-Win32 and Microsoft Visual C++; and gcc under several flavors of Linux, Mac OS X, *BSD and Solaris. -- William McBrine ------------------------------------------------------------------------ PDCurses 2.6 - 2003/01/08 ========================= INTRODUCTION: This release of PDCurses includes the following changes: BUGS FIXED: - Allow accented characters on Win32 platform when run on non-English keyboards. - Allow "special" characters like Ctrl-S, Ctrl-Q under OS/2 to be returned. - Some bugs with halfdelay() fixed by William McBrine. - pechochar() should now work correctly. - redrawwin() macro in curses.h was incorrect - fixed by Alberto Ornaghi - Don't include "special" characters like KEY_SHIFT_L to be returned in getnstr() family. Bug 542913 - Entering TAB in wgetnstr() no longer exceeds requested buffer size. Bug 489233 - Fixed bug 550066, scrollok() and pads. Also beep() called when buffer exceeded. Bug 562041. - Reverse video of X11 selection reinstated. Pablo Garcia Abio?? - Right Alt modifier now works like left Alt modifier under Win32 - Add support for all libXaw replacement libraries with Scrollbar bug. Note that for this to work, you still have to change the libXaw replacement libraries to fix the bug :-( - Don't trap signals in XCurses if calling application has ignored them. Change by Frank Heckenbach. - Bug reports from Warren W. Gay: - Fix termattrs() to return A_REVERSE and A_BLINK on all platforms. - Fix definition of getsyx() and setsyx() to be consistent with ncurses. Bug 624424. - Fix definition of echo() and noecho(). Bug 625001. - Fix definition of keypad() and leaveok(). Bug 632653. - Missing panel_hidden() prototype. Bug 649320. - Fixed bug with calling def_prog_mode(), resize_term(), reset_prog_mode(); the resize details were being lost. NEW FEATURES: - Clipboard support now available on DOS platform, but handled internally to the currently running process. - New X11 resource: textCursor, allows the text cursor to be specified as a vertical bar, or the standard horizontal bar. Thanks to Frank Heckenbach for the suggestion. NEW COMPILER SUPPORT: - lcc-win32 now works correctly ------------------------------------------------------------------------ PDCurses 2.5 - 2001/11/26 ========================= INTRODUCTION: This release of PDCurses includes the following changes: - Set BASE address for Win32 DLL - Add KEY_SUP and KEY_SDOWN. - Add PDC_set_line_color() - Add blink support as bold background - Add bold colors - Add getbkgd() macro - Add new PDC functions for adding underline, overline, leftline and rightline - Add support for shifted keypad keys. - Allow more keypad keys to work under Win32 - Change Win32 and OS/2 DLL name to curses.dll - Change example resources to allow overriding from the command line - Changes for building cleanly on OS/2 - Changes to handle building XCurses under AIX - Check if prefresh() and pnoutrefresh() parameters are valid. - Ensure build/install works from any directory - Handle platforms where X11 headers do not typedef XPointer. - Mention that Flexos is likely out-of-date. - Pass delaytenths to XCurses_rawgetch() - Remove boldFont - Updates for cursor blinking and italic. BUGS FIXED: - Fix bug with getting Win32 clipboard contents. Added new PDC_freeclipboard() function. - Fix bug with halfdelay() - Fix bug with mouse interrupting programs that are not trapping mouse events under Win32. - Fix return value from curs_set() - Reverse the left and right pointing bars in ALT_CHARSET NEW COMPILER SUPPORT: - Add QNX-RTP port ------------------------------------------------------------------------ PDCurses 2.4 - 2000/01/17 ========================= INTRODUCTION: This release of PDCurses includes the following changes: - full support of X11 selection handling - removed the need for the cursos2.h file - enabled the "shifted" key on the numeric keypad - added native clipboard support for X11, Win32 and OS/2 - added extra functions for obtaining internal PDCurses status - added clipboard and key modifier tests in testcurs.c - fixes for panel library - key modifiers pressed by themselves are now returned as keys: KEY_SHIFT_L KEY_SHIFT_R KEY_CONTROL_L KEY_CONTROL_R KEY_ALT_L KEY_ALT_R This works on Win32 and X11 ports only - Added X11 shared library support - Added extra slk formats supported by ncurses - Fixed bug with resizing the terminal when slk were on. - Changed behavior of slk_attrset(), slk_attron() slk_attroff() functions to work more like ncurses. BUGS FIXED: - some minor bug and portability fixes were included in this release NEW FUNCTIONS: - PDC_getclipboard() and PDC_setclipboard() for accessing the native clipboard (X11, Win32 and OS/2) - PDC_set_title() for setting the title of the window (X11 and Win32 only) - PDC_get_input_fd() for getting the file handle of the PDCurses input - PDC_get_key_modifiers() for getting the keyboard modifier settings at the time of the last (w)getch() - Xinitscr() (only for X11 port) which allows standard X11 switches to be passed to the application NEW COMPILER SUPPORT: - MingW32 GNU compiler under Win95/NT - Cygnus Win32 GNU compiler under Win95/NT - Borland C++ for OS/2 1.0+ - lcc-win32 compiler under Win95/NT ACKNOWLEDGEMENTS: (for this release) - Georg Fuchs for various changes. - Juan David Palomar for pointing out getnstr() was not implemented. - William McBrine for fix to allow black/black as valid color pair. - Peter Preus for pointing out the missing bccos2.mak file. - Laura Michaels for a couple of bug fixes and changes required to support Mingw32 compiler. - Frank Heckenbach for PDC_get_input_fd() and some portability fixes and the fixes for panel library. - Matthias Burian for the lcc-win32 compiler support. ------------------------------------------------------------------------ PDCurses 2.3 - 1998/07/09 ========================= INTRODUCTION: This release of PDCurses includes the following changes: - added more System V R4 functions - added Win32 port - the X11 port is now fully functional - the MS Visual C++ Win32 port now includes a DLL - both the X11 and Win32 ports support the mouse - the slk..() functions are now functional - support for scrollbars under X11 are experimental at this stage - long chtype extended to non-Unix ports The name of the statically built library is pdcurses.lib (or pdcurses.a). The name of the DLL import library (where applicable) is curses.lib. BUGS FIXED: - some minor bugs were corrected in this release NEW FUNCTIONS: - slk..() functions NEW COMPILER SUPPORT: - MS Visual C++ under Win95/NT - Watcom C++ under OS/2, Win32 and DOS - two EMX ports have been provided: - OS/2 only using OS/2 APIs - OS/2 and DOS using EMX video support routines EXTRA OPTIONS: PDCurses recognizes two environment variables which determines the initialization and finalization behavior. These environment variables do not apply to the X11 port. PDC_PRESERVE_SCREEN - If this environment variable is set, PDCurses will not clear the screen to the default white on black on startup. This allows you to overlay a window over the top of the existing screen background. PDC_RESTORE_SCREEN - If this environment variable is set, PDCurses will take a copy of the contents of the screen at the time that PDCurses is started; initscr(), and when endwin() is called, the screen will be restored. ACKNOWLEDGEMENTS: (for this release) - Chris Szurgot for original Win32 port. - Gurusamy Sarathy for some updates to the Win32 port. - Kim Huron for the slk..() functions. - Florian Grosse Coosmann for some bug fixes. - Esa Peuha for reducing compiler warnings. - Augustin Martin Domingo for patches to X11 port to enable accented characters. ------------------------------------------------------------------------ PDCurses 2.2 - 1995/02/12 ========================= INTRODUCTION: This release of PDCurses has includes a number of major changes: - The portable library functions are now grouped together into single files with the same arrangement as System V R4 curses. - A panels library has been included. This panels library was written by Warren Tucker. - Quite a few more functions have been supplied by Wade Schauer and incorporated into release 2.2. Wade also supplied the support for the Microway NDP C/C++ 32 bit DOS compiler. - The curses datatype has been changed from an unsigned int to a long. This allows more attributes to be stored as well as increasing the number of color-pairs from 32 to 64. - Xwindows port (experimental at the moment). BUGS FIXED: - mvwin() checked the wrong coordinates - removed DESQview shadow memory buffer checking bug in curses.h in \#define for wstandout() - lots of others I can't remember NEW FUNCTIONS: - Too many to mention. See intro.man for a complete list of the functions PDCurses now supports. COMPILER SUPPORT: - DJGPP 1.12 is now supported. The run-time error that caused programs to crash has been removed. - emx 0.9a is supported. A program compiled for OS/2 should also work under DOS if you use the VID=EMX switch when compiling. See the makefile for details. - The Microway NDP C/C++ DOS compiler is now supported. Thanks to Wade Schauer for this port. - The Watcom C++ 10.0 DOS compiler is now supported. Thanks to Pieter Kunst for this port. - The library now has many functions grouped together to reduce the size of the library and to improve the speed of compilation. - The "names" of a couple of the compilers in the makefile has changed; CSET2 is now ICC and GO32 is now GCC. EXTRA OPTIONS: One difference between the behavior of PDCurses and Unix curses is the attributes that are displayed when a character is cleared. Under Unix curses, no attributes are displayed, so the result is always black. Under PDCurses, these functions clear with the current attributes in effect at the time. With the introduction of the bkgd functions, by default, PDCurses clears using the value set by (w)bkgd(). To have PDCurses behave the same way as it did before release 2.2, compile with -DPDCURSES_WCLR ACKNOWLEDGEMENTS: (for this release) Pieter Kunst, David Nugent, Warren Tucker, Darin Haugen, Stefan Strack, Wade Schauer and others who either alerted me to bugs or supplied fixes. ------------------------------------------------------------------------ PDCurses 2.1 - 1993/06/20 ========================= INTRODUCTION: The current code contains bug fixes for the DOS and OS/2 releases and also includes an alpha release for Unix. The Unix release uses another public domain package (mytinfo) to handle the low-level screen writes. mytinfo was posted to comp.sources.unix (or misc) in December 1992 or January 1993. Unless you are a glutton for punishment I would recommend you avoid the Unix port at this stage. The other major addition to PDCurses is the support for DJGPP (the DOS port of GNU C++). Thanks to David Nugent . Other additions are copywin() function, function debugging support and getting the small and medium memory models to work. The testcurs.c demo program has also been changed significantly and a new demo program, tuidemo, has been added. Some people have suggested including information on where to get dmake from. oak.oakland.edu in /pub/msdos/c OTHER NOTES: Under DOS, by default, screen writes to a CGA monitor are done via the video BIOS rather than by direct video memory writes. This is due to the CGA "snow" problem. If you have a CGA monitor and do not suffer from snow, you can compile private\_queryad.c with CGA_DIRECT defined. This will then use cause PDCurses to write directly to the CGA video memory. Function debugging: Firstly to get function debugging, you have to compile the library with OPT=N in the makefile. This also turns on compiler debugging. You can control when you want PDCurses to write to the debug file (called trace in the current directory) by using the functions traceon() and traceoff() in your program. Microsoft C 6.00 Users note: ---------------------------- With the addition of several new functions, using dmake to compile PDCurses now causes the compiler to run "out of heap space in pass 2". Using the 6.00AX version (DOS-Extended) to compile PDCurses fixes this problem; hence the -EM switch. Functional changes ------------------ Added OS/2 DLL support. A few curses functions have been fixed to exhibit their correct behavior and make them more functionally portable with System V curses. The functions that have changed are overlay(), overwrite() and typeahead. overlay() and overwrite() Both of theses functions in PDCurses 2.0 allowed for one window to be effectively placed on top of another, and the characters in the first window were overlaid or overwritten starting at 0,0 in both windows. This behavior of these functions was not correct. These functions only operate on windows that physically overlap with respect to the displayed screen. To achieve the same functionality as before, use the new function copywin(). See the manual page for further details. typeahead() This function in PDCurses 2.0 effectively checked to see if there were any characters remaining in the keyboard buffer. This is not the behavior exhibited by System V curses. This function is intended purely to set a flag so that curses can check while updating the physical screen if any keyboard input is pending. To achieve the same effect with typeahead() under PDCurses 2.1 the following code should be used. In place of... while(!typeahead(stdin)) { /* do something until any key is pressed... */ } use... /* getch() to return ERR if no key pending */ nodelay(stdscr,TRUE); while(getch() == (ERR)) { /* do something until any key is pressed... */ } ACKNOWLEDGEMENTS: (in no particular order) Jason Shumate, Pieter Kunst, David Nugent, Andreas Otte, Pasi Hamalainen, James McLennan, Duane Paulson, Ib Hojme Apologies to anyone I may have left out. ------------------------------------------------------------------------ PDCurses 2.0 - 1992/11/23 ========================= INTRODUCTION: Well, here it finally is; PDCurses v2.0. PDCurses v2.0 is an almost total rewrite of PCcurses 1.4 done by John 'Frotz' Fa'atuai, the previous maintainer. It adds support for OS/2 as well as DOS. This version has been tested with Microsoft C v6.0, QuickC v2.0 and Borland C++ 2.0 under DOS and Microsoft C v6.0 and TopSpeed c v3.02 under OS/2 2.0. Also the library has been compiled successfully with emx 0.8e, C Set/2 and Watcom 9. Most testing was done with the large memory model, where applicable. The large memory model is probably the best model to use. The amount of testing has not been as extensive as I would have liked, but demands on releasing a product have outweighed the product's quality. Nothing new with that !! Hopefully with wider circulation, more bugs will be fixed more quickly. I have included just 1 makefile which is suitable for dmake 3.8 for both DOS and OS/2. The makefile does not rely on customization of the dmake.ini file. If you discover bugs, and especially if you have fixes, please let me know ASAP. The source to the library is distributed as a zip file made with zip 1.9. You will need Info-ZIP unzip 5.0 to unzip. Follow the directions below to compile the library. DIRECTIONS: 1. Create a new directory in which to unzip pdcurs20.zip. This will create a curses directory and a number of subdirectories containing source code for the library and utilities and the documentation. 2. Make changes to the makefile where necessary: Change the MODEL or model macro to the appropriate value (if it applies to your compiler). Use model for Borland compilers. Change any paths in the defined macros to be suitable for your compiler. 3. Invoke DMAKE [-e environment_options] [target] where environment_options are: OS (host operating system) COMP (compiler) OPT (optimized version or debug version) - optional. default Y TOS (target operating system) - optional. default OS see the makefile for valid combinations targets: all, demos, lcursesd.lib, manual... NB. dmake is case sensitive with targets, so those environments that use an upper case model value (eg MSC) MUST specify the library target as for eg. Lcursesd.lib The makefile is by default set up for Borland C++. The use of -e environment_options override these defaults. If you prefer, you can just change the defaults in the makefile and invoke it without the -e switch. OTHER NOTES: The documentation for the library is built into each source file, a couple of specific doc files and the header files. A program is supplied (manext) to build the manual. This program gets compiled when you build the documentation. To generate the library response file correctly, I had to write a quick and dirty program (buildlrf) to achieve this. Originally the makefiles just had statements like: "echo -+$(OBJ)\$* & >> $(LRF)" which appended a suitable line to the response file. Unfortunately under some combinations of makefiles and command processors (eg. nmake and 4DOS) the & would get treated as stderr and the echo command would fail. The original source for PDCurses that I received from the previous maintainer contained support for the FLEXOS operating system. Not having access to it, I could not test the changes I made so its support has fallen by the wayside. If you really need to have PDCurses running under FLEXOS, contact me and I will see what can be arranged. Under DOS, by default, screen writes to a CGA monitor are done via the video BIOS rather than by direct video memory writes. This is due to the CGA "snow" problem. If you have a CGA monitor and do not suffer from snow, you can compile private\_queryad.c with CGA_DIRECT defined. This will then use cause PDCurses to write directly to the CGA video memory. Added System V color support. COMPILER-SPECIFIC NOTES: Microsoft C ----------- It is possible with MSC 6.0 to build the OS/2 libraries and demo programs from within DOS. This is the only case where it is possible to specify the value of TOS on the command line to be OS2 and the value of OS be DOS. C Set/2 ------- I have only tested the library using the migration libraries. I doubt that the demo programs will work without them. emx --- Testing has been done with 0.8e of emx together with the 16_to_32 libraries. The emx\lib directory should include the vio32.lib and kbd32.lib libraries from the 16_to_32 package. BUGS and UNFINISHED BUSINESS: - PDC_set_ctrl_break() function does not work under OS/2. - win_print() and PDC_print() do not work under OS/2. - The file todo.man in the doc directory also lists those functions of System V 3.2 curses not yet implemented. Any volunteers? ACKNOWLEDGEMENTS: - John 'Frotz' Fa'atuai, the previous maintainer for providing an excellent base for further development. - John Burnell , for the OS/2 port. - John Steele, Jason (finally NOT a John) Shumate.... for various fixes and suggestions. - Eberhardt Mattes (author of emx) for allowing code based on his C library to be included with PDCurses. - Several others for their support, moral and actual. -- Mark Hessling ------------------------------------------------------------------------ PDCurses 2.0Beta - 1991/12/21 ============================= Changed back from short to int. (int is the correct size for the default platform. Short might be too short on some platforms. This is more portable. I, also, made this mistake.) Many functions are now macros. If you want the real thing, #undef the macro. (X/Open requirement.) Merged many sources into current release. Added many X/Open routines (not quite all yet). Added internal documentation to all routines. Added a HISTORY file to the environment. Added a CONTRIB file to the environment. ------------------------------------------------------------------------ PDCurses 1.5Beta - 1990/07/14 ============================= Added many levels of compiler support. Added mixed prototypes for all "internal" routines. Removed all assembly language. Added EGA/VGA support. Converted all #ifdef to #if in all modules except CURSES.H and CURSPRIV.H. Always include ASSERT.H. Added support for an external malloc(), calloc() and free(). Added support for FAST_VIDEO (direct-memory writes). Added various memory model support (for FAST_VIDEO). Added much of the December 1988 X/Open Curses specification. -- John 'Frotz' Fa'atuai ------------------------------------------------------------------------ PCcurses 1.4 - 1990/01/14 ========================= In PCcurses v.1.4, both portability improvements and bugfixes have been made. The files have been changed to allow lint-free compilation with Microsoft C v.5.1, and with Turbo C v.2.0. The source should still compile without problems on older compilers, although this has not been verified. The makefiles have been changed to suit both the public release and the author, who maintains a special kind of libraries for himself. In the case of Microsoft C, changes were done in the makefile to lower the warning level to 2 (was 3). This was to avoid ANSI warnings which are abundant because PCcurses does not attempt to follow strict ANSI C standard. BUG FIXES FROM V.1.3 TO V.1.4: !!!IMPORTANT CHANGE!!! The definitions for OK and ERR in curses.h were exchanged. This was done to be more consistent with UNIX versions. Also, it permits functions like newwin() and subwin() to return 0 (=NULL) when they fail due to memory shortage. This incompatibility with UNIX curses was pointed out by Fred C. Smith. If you have tested success/failure by comparisons to anything other than ERR and OK, your applications will need to be be changed on that point. Sorry... but presumably most of you used the symbolic constants? (END OF IMPORTANT CHANGE) Fred also pointed out a bug in the file update.c. The bug caused the first character printed after 'unauthorized' screen changes (like during a shell escape, for example) to be placed at the wrong screen position. This happened even if the normal precautions (clear / touch / refresh) were taken. The problem has now been fixed. PCcurses is currently also being used on a 68000 system with hard-coded ESCape sequences for ANSI terminals. However, ints used by the 68000 C compiler are 32 bits. Therefore ints have been turned into shorts wherever possible in the code (otherwise all window structures occupy twice as much space as required on the 68000). This does not affect PC versions since normally both ints and shorts are 16 bits for PC C compilers. At some places in the source code there are references made to the 68000 version. There are also a makefile, a curses68.c file, and a curses68.cmd file. These are for making, low-level I/O, and linking commands when building the 68000 version. These files are probably useful to no-one but the author, since it is very specific for its special hardware environment. Still in an effort to keep all curses-related sources in one place they are included. Note however that PCcurses will not officially support a non-PC environment. The file cursesio.c, which was included in the package at revision level 1.2, and which was to be an alternative to the cursesio.asm file, has been verified to behave incorrectly in the function _curseskeytst(). The problem was that the value of 'cflag' does not contain the proper data for the test that is attempted. Furthermore, neither Turbo C or Microsoft C allows any way to return the data that is needed, and consequently you should not use cursesio.c. The best solution is to simply use the ASM version. In v.1.2 and v.1.3, the user could edit the makefile to select which version he wanted to use. The makefiles in v.1.4 have removed this possibility forcing the use of the ASM file, and cursesio.c has been dropped from the distribution. A bug in the wgetstr() function caused PCcurses to echo characters when reading a keyboard string, even if the echo had been turned off. Thanks to Per Foreby at Lund University, Sweden, for this. Per also reported bugs concerning the handling of characters with bit 8 set. Their ASCII code were considered as lower than 32, so they were erased etc. like control characters, i.e. erasing two character positions. The control character test was changed to cope with this. The overlay() and overwrite() functions were changed so that the overlaying window is positioned at its 'own' coordinates inside the underlying window (it used to be at the underlying window's [0,0] position). There is some controversy about this - the documentation for different curses versions say different things. I think the choice made is the most reasonable. The border() and wborder() functions were changed to actually draw a border, since this seems to be the correct behavior of these functions. They used to just set the border characters to be used by box(). These functions are not present in standard BSD UNIX curses. The subwin() function previously did not allow the subwindow to be as big as the original window in which it was created. This has now been fixed. There was also the problem that the default size (set by specifying numlines or numcols (or both) as 0 made the resulting actual size 1 line/column too small. There were a few spelling errors in function names, both in the function declarations and in curses.h. This was reported by Carlos Amaral at INESC in Portugal. Thanks! There was also an unnecessary (but harmless) parameter in a function call at one place. ------------------------------------------------------------------------ PCcurses 1.3 - 1988/10/05 ========================= The file 'border.c' is now included. It allows you to explicitly specify what characters should be used as box borders when the box() functions are called. If the new border characters are non-0, they override the border characters specified in the box() call. In my understanding, this functionality is required for AT&T UNIX sV.3 compatibility. Thanks for this goes to Tony L. Hansen (hansen@pegasus.UUCP) for posting an article about it on Usenet (newsgroup comp.unix.questions; his posting was not related at all to PCcurses). The only other difference between v.1.2 and v.1.3 is that the latter has been changed to avoid warning diagnostics if the source files are compiled with warning switches on (for Microsoft this means '-W3', for Turbo C it means '-w -w-pro'). Of these, the Turbo C warning check is clearly to be used rather than Microsoft, even if neither of them comes even close to a real UNIX 'lint'. Some of the warnings in fact indicated real bugs, mostly functions that did not return correct return values or types. The makefiles for both MSC and TRC have been modified to produce warning messages as part of normal compilation. ------------------------------------------------------------------------ PCcurses 1.2 - 1988/10/02 ========================= The changes from v.1.1 to v.1.2 are minor. The biggest change is that there was a bug related to limiting the cursor movement if the application tried to move it outside the screen (something that should not be done anyway). Such erroneous application behavior is now handled appropriately. All modules have been changed to have a revision string in them, which makes it easier to determine what version is linked into a program (or what library version you have). There is now a 'cursesio.c' file. That file does the same as 'cursesio.asm' (i.e. it provides the interface to the lower-level system I/O routines). It is written in C and thus it is (possibly) more portable than the assembler version (but still not so portable since it uses 8086 INT XX calls directly). When one creates new curses libraries, one chooses whether to use the assembler or the C version of cursesio. The choice is made by commenting out the appropriate dependencies for cursesio.obj, near the end of the makefiles. There is now a 'setmode.c' file. That file contains functions that save and restore terminal modes. They do it into other variables than do savetty() and resetty(), so one should probably use either savetty()/resetty() or the new functions only - and not mix the both ways unless one really knows what one does. Diff lists vs v.1.0 are no longer included in the distribution. The make utility still is. PCcurses v.1.2 still compiles with Microsoft C v.4.0, and with Borland Turbo C v.1.0. There is as far as I know no reason to believe that it does not compile under Microsoft C v.3.0 and 5.x, or Turbo C v.1.5, but this has not been tested. There are two makefiles included, one for Microsoft C, one for Turbo C. They are both copies of my personal makefiles, and as such they reflect the directory structure on my own computer. This will have to be changed before you run make. Check $(INCDIR) and $(LIBDIR) in particular, and make the choice of ASM or C cursesio version as mentioned above (the distribution version uses the C version of cursesio). The manual file (curses.man) has been changed at appropriate places. I would like to thank the following persons for their help: Brandon S. Allbery (alberry@ncoast.UUCP) for running comp.binaries.ibm.pc (at that time) and comp.source.misc. Steve Balogh (Steve@cit5.cit.oz.AU) for writing a set of manual pages and posting them to the net. Torbjorn Lindh for finding bugs and suggesting raw character output routines. Nathan Glasser (nathan@eddie.mit.edu) for finding and reporting bugs. Ingvar Olafsson (...enea!hafro!ingvar) for finding and reporting bugs. Eric Rosco (...enea!ipmoea!ericr) for finding and reporting bugs. Steve Creps (creps@silver.bacs.indiana.edu) for doing a lot of work - among others posting bug fixes to the net, and writing the new cursesio.c module. N. Dean Pentcheff (dean@violet.berkeley.edu) for finding bugs and rewriting cursesio.asm for Turbo 'C' 1.5. Finally, Jeff Dean (parcvax,hplabs}!cdp!jeff) (jeff@ads.arpa) has had a shareware version of curses deliverable since about half a year before I released PCcurses 1.0 on Use- Net. He is very concerned about confusion between the two packages, and therefore any references on the network should make clear whether they reference Dean's PCcurses or Larsson's PCcurses. ------------------------------------------------------------------------ PCcurses 1.1 - 1988/03/06 ========================= The changes from v.1.0 to v.1.1 are minor. There are a few bug fixes, and new (non-portable) functions for verbatim IBM character font display have been added (in charadd.c and charins.c). The manual file (curses.man) has been changed at appropriate places. In the file v10tov11.dif there are listings of the differences between version 1.0 and 1.1. The diff listings are in UNIX diff(1) format. Version 1.1 compiles with Turbo C v.1.0, as well as Microsoft C v.3.0 and v.4.0. On the release disk there is a make.exe utility which is very similar to UNIX make (If the package was mailed to you, the make utility will be in uuencoded format - in make.uu - and must be uudecoded first). It is much more powerful than Microsoft's different MAKEs; the latter ones will NOT generate libraries properly if used with the PCcurses makefiles. There are three makefiles: makefile generic MSC 3.0 makefile makefile.ms MSC 4.0 makefile makefile.tc Turbo C 1.0 makefile To make a library with for example Turbo C, make directories to hold .H and .LIB files (these directories are the 'standard places'), edit makefile.tc for this, and type make -f makefile.tc all and libraries for all memory models will be created in the .LIB directory, while the include files will end up in the .H directory. Also read what is said about installation below! ------------------------------------------------------------------------ PCcurses 1.0 - 1987/08/24 ========================= This is the release notes for the PCcurses v.1.0 cursor/window control package. PCcurses offers the functionality of UNIX curses, plus some extras. Normally it should be possible to port curses-based programs from UNIX curses to PCcurses on the IBM PC without changes. PCcurses is a port/ rewrite of Pavel Curtis' public domain 'ncurses' package. All the code has been re-written - it is not just an edit of ncurses (or UNIX curses). I mention this to clarify any copyright violation claims. The data structures and ideas are very similar to ncurses. As for UNIX curses, I have not even seen any sources for it. For an introduction to the use of 'curses' and its derivatives, you should read 'Screen Updating and Cursor Movement Optimization: A Library Package' by Kenneth C. R. C. Arnold, which describes the original Berkeley UNIX version of curses. It is available as part of the UNIX manuals. The other source of information is 'The Ncurses Reference Manual' by Pavel Curtis. The latter is part of Curtis' ncurses package. The only other documentation provided is a 'man' page which describes all the included functions in a very terse way. In the sources, each function is preceded by a rather thorough description of what the function does. I didn't have time to write a nice manual/tutorial - sorry. PCcurses is released as a number of source files, a man page, and a make file. A uuencoded copy of a 'make' utility, and a manpage for the 'make' is also provided to make it easier to put together PCcurses libraries. Even if you are not interested in PCcurses, it may be worthwhile to grab the make. The makefile assumes the presence of the Microsoft C compiler (3.0 or 4.0), Microsoft MASM and LIB, plus some MS-DOS utilities. The reason for supplying MAKE.EXE is that the Microsoft 'MAKE:s' are much inferior to a real UNIX make. The supplied make is a port of a public domain make, published on Usenet. It is almost completely compatible with UNIX make. When generating the curses libraries, the makefile will direct make to do some directory creating and file copying, and then re-invoke itself with new targets. The workings of the makefile are not absolutely crystal clear at first sight... just start it and see what it does. For portability, the curses libraries depend on one assembler file for access to the BIOS routines. There is no support for the EGA, but both CGA, MGA, and the HGA can be used. The libraries are originally for Microsoft C, but all C modules should be portable right away. In the assembler file, segment names probably need to be changed, and possibly the parameter passing scheme. I think Turbo C will work right away - as far as I understand, all its conventions are compatible with Microsoft C. There are some parts left out between ncurses and PCcurses. One is the support for multiple terminals - not very interesting on a PC anyway. Because we KNOW what terminal we have, there is no need for a termcap or terminfo library. PCcurses also has some things that neither curses nor ncurses have. Compared to the original UNIX curses, PCcurses has lots of extras. The BIOS routines are used directly, which gives fast screen updates. PCcurses does not do direct writes to screen RAM - in my opinion it is a bit ugly to rely that much on hardware compatibility. Anyone could fix that, of course... One of the more serious problems with PCcurses is the way in which normal, cbreak, and raw input modes are done. All those details are in the 'charget' module - I do raw I/O via the BIOS, and perform any buffering myself. If an application program uses PCcurses, it should do ALL its I/O via PCcurses calls, otherwise the mix of normal and PCcurses I/O may mess up the display. I think my code is reasonable... comments are welcome, provided you express them nicely... To install, copy all files to a work directory, edit 'makefile' to define the standard include and library file directory names of your choice (these directories must exist already, and their path names must be relative to the root directory, not to the current one). You must also run uudecode on make.uu, to generate MAKE.EXE. You can do that on your PC, if you have uudecode there, otherwise you can do it under UNIX and do a binary transfer to the PC. When you have MAKE.EXE in your work directory (or in your /bin directory), type make. Make will now create 4 sub-directories (one for each memory model), copy some assembler include files into them, copy two include files to your include directory, CHDIR to each sub-directory and re-invoke itself with other make targets to compile and assemble all the source files into the appropriate directories. Then the library manager is run to create the library files in your desired library directory. Presto! If you only want to generate a library for one memory model, type 'make small', 'make large', etc. The name of the memory model must be in lower case, like in the makefile. I think the package is fairly well debugged - but then again, that's what I always think. It was completed in May-87, and no problems found yet. Now it's your turn... Comments, suggestions and bug reports and fixes (no flames please) to -- Bjorn Larsson curses-1.4.4/vendor/PDCurses/os2/0000755000004100000410000000000014201713275016546 5ustar www-datawww-datacurses-1.4.4/vendor/PDCurses/os2/Makefile0000644000004100000410000000525214201713275020212 0ustar www-datawww-data# GNU MAKE Makefile for PDCurses library - OS/2 emx 0.9c+ # # Usage: make -f [path\]Makefile [DEBUG=Y] [EMXVIDEO=Y] [DLL=Y] [target] # # where target can be any of: # [all|demos|pdcurses.a|testcurs.exe...] # # The EMXVIDEO option compiles with the emx video library, which # enables a PDCurses program to run under OS/2 and DOS. O = o ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. endif include $(PDCURSES_SRCDIR)/version.mif include $(PDCURSES_SRCDIR)/libobjs.mif osdir = $(PDCURSES_SRCDIR)/os2 PDCURSES_OS2_H = $(osdir)/pdcos2.h CC = gcc CFLAGS = -I$(PDCURSES_SRCDIR) -c -Wall ifeq ($(EMXVIDEO),Y) CFLAGS += -DEMXVIDEO CCLIBS = -lvideo BINDFLAGS = -acm else CCLIBS = BINDFLAGS = endif ifeq ($(DEBUG),Y) CFLAGS += -g -DPDCDEBUG LDFLAGS = -g else CFLAGS += -O2 LDFLAGS = endif DLLTARGET = pdcurses.dll DLLFLAGS = -Zdll -Zcrtdll -Zomf LINK = gcc EMXBIND = emxbind EMXOMF = emxomf LIBEXE = ar LIBFLAGS = rcv ifeq ($(DLL),Y) CFLAGS += -Zdll -Zcrtdll -Zomf LDFLAGS += -Zlinker /PM:VIO -Zomf -Zcrtdll LIBCURSES = pdcurses.lib LIBDEPS = $(LIBOBJS) $(PDCOBJS) PDCLIBS = $(DLLTARGET) EXEPOST = TUIPOST = CLEAN = *.dll *.lib else LIBCURSES = pdcurses.a LIBDEPS = $(LIBOBJS) $(PDCOBJS) PDCLIBS = $(LIBCURSES) EXEPOST = $(EMXBIND) $* $(BINDFLAGS) TUIPOST = $(EMXBIND) tuidemo $(BINDFLAGS) CLEAN = *.a testcurs ozdemo xmas tuidemo firework ptest rain worm endif .PHONY: all libs clean demos dist all: libs demos libs: $(PDCLIBS) clean: -del *.o -del *.exe -del $(CLEAN) demos: $(DEMOS) DEMOOBJS = testcurs.o ozdemo.o xmas.o tui.o tuidemo.o firework.o \ ptest.o rain.o worm.o $(LIBCURSES) : $(LIBDEPS) $(LIBEXE) $(LIBFLAGS) $@ $? -copy $(LIBCURSES) panel.a $(DLLTARGET) : $(LIBDEPS) $(LINK) $(DLLFLAGS) -o $(DLLTARGET) $? # lxlite $(DLLTARGET) $(LIBOBJS) $(PDCOBJS) $(DEMOOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_OS2_H) $(DEMOS) : $(LIBCURSES) panel.o ptest.o: $(PANEL_HEADER) terminfo.o: $(TERM_HEADER) $(LIBOBJS) : %.o: $(srcdir)/%.c $(CC) -c $(CFLAGS) -o$@ $< $(PDCOBJS) : %.o: $(osdir)/%.c $(CC) -c $(CFLAGS) -o$@ $< firework.exe ozdemo.exe rain.exe testcurs.exe worm.exe xmas.exe \ ptest.exe: %.exe: %.o $(LINK) $(LDFLAGS) -o $* $< $(LIBCURSES) $(CCLIBS) $(EXEPOST) tuidemo.exe: tuidemo.o tui.o $(LINK) $(LDFLAGS) -o tuidemo tuidemo.o tui.o $(LIBCURSES) $(CCLIBS) $(TUIPOST) firework.o ozdemo.o ptest.o rain.o testcurs.o worm.o xmas.o: %.o: \ $(demodir)/%.c $(CC) $(CFLAGS) -o$@ $< tui.o: $(demodir)\tui.c $(demodir)\tui.h $(CC) $(CFLAGS) -I$(demodir) -o $@ $< tuidemo.o: $(demodir)\tuidemo.c $(CC) $(CFLAGS) -I$(demodir) -o $@ $< PLATFORM1 = EMX OS/2 PLATFORM2 = EMX 0.9d for OS/2 ARCNAME = pdc$(VER)_emx_os2 include $(PDCURSES_SRCDIR)/makedist.mif curses-1.4.4/vendor/PDCurses/os2/Makefile.wcc0000644000004100000410000000162114201713275020761 0ustar www-datawww-data# Watcom WMAKE Makefile for PDCurses library - OS/2 Open Watcom 1.1+ # # Usage: wmake -f [path\]Makefile.wcc [DEBUG=Y] [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] !ifdef %PDCURSES_SRCDIR PDCURSES_SRCDIR = $(%PDCURSES_SRCDIR) !else PDCURSES_SRCDIR = .. !endif !include $(PDCURSES_SRCDIR)\version.mif osdir = $(PDCURSES_SRCDIR)\os2 CC = wcc386 TARGET = os2v2 CFLAGS = /bt=$(TARGET) /wx /s /zq /i=$(PDCURSES_SRCDIR) !ifeq DEBUG Y CFLAGS += /d2 /DPDCDEBUG LDFLAGS = D A op q sys $(TARGET) !else CFLAGS += /oneatx LDFLAGS = op q sys $(TARGET) !endif LIBEXE = wlib /q /n /b /c /t !include $(PDCURSES_SRCDIR)\watcom.mif $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) $@ $(LIBOBJS) $(PDCOBJS) -copy $(LIBCURSES) panel.lib PLATFORM1 = Watcom C++ OS/2 PLATFORM2 = Open Watcom 1.6 for OS/2 ARCNAME = pdc$(VER)_wcc_os2 !include $(PDCURSES_SRCDIR)\makedist.mif curses-1.4.4/vendor/PDCurses/os2/README.md0000644000004100000410000000231014201713275020021 0ustar www-datawww-dataPDCurses for OS/2 ================= This directory contains PDCurses source code files specific to OS/2. Building -------- - Choose the appropriate makefile for your compiler: Makefile.bcc - Borland C++ 2.0 Makefile - EMX 0.9b+ iccos2.mak - C Set/2 Makefile.wcc - Open Watcom 1.8+ - Optionally, you can build in a different directory than the platform directory by setting PDCURSES_SRCDIR to point to the directory where you unpacked PDCurses, and changing to your target directory: set PDCURSES_SRCDIR=c:\pdcurses - Build it: make -f makefilename (For Watcom, use "wmake" instead of "make"; for MSVC or C Set/2, "nmake".) You'll get the libraries (pdcurses.lib or .a, depending on your compiler; and panel.lib or .a), the demos (*.exe), and a lot of object files. Note that the panel library is just a copy of the main library, provided for convenience; both panel and curses functions are in the main library. You can also use the optional parameter "DLL=Y" with EMX, to build the library as a DLL: make -f Makefile DLL=Y Distribution Status ------------------- The files in this directory are released to the Public Domain. curses-1.4.4/vendor/PDCurses/os2/pdckbd.c0000644000004100000410000003334014201713275020144 0ustar www-datawww-data/* Public Domain Curses */ #if defined(__EMX__) || defined(__WATCOMC__) || defined(__IBMC__) || \ defined(__TURBOC__) # define HAVE_SIGNAL # include #endif #include "pdcos2.h" /*man-start************************************************************** pdckbd ------ ### Synopsis unsigned long PDC_get_input_fd(void); ### Description PDC_get_input_fd() returns the file descriptor that PDCurses reads its input from. It can be used for select(). ### Portability X/Open BSD SYS V PDC_get_input_fd - - - **man-end****************************************************************/ #ifdef EMXVIDEO # include static int tahead = -1; #else static KBDINFO kbdinfo; /* default keyboard mode */ static HMOU mouse_handle = 0; static MOUSE_STATUS old_mouse_status; static USHORT old_shift = 0; static bool key_pressed = FALSE; static int mouse_events = 0; #endif /************************************************************************ * Table for key code translation of function keys in keypad mode * * These values are for strict IBM keyboard compatibles only * ************************************************************************/ static short key_table[] = { -1, ALT_ESC, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ALT_BKSP, KEY_BTAB, ALT_Q, ALT_W, ALT_E, ALT_R, ALT_T, ALT_Y, ALT_U, ALT_I, ALT_O, ALT_P, ALT_LBRACKET, ALT_RBRACKET, ALT_ENTER, -1, ALT_A, ALT_S, ALT_D, ALT_F, ALT_G, ALT_H, ALT_J, ALT_K, ALT_L, ALT_SEMICOLON, ALT_FQUOTE, ALT_BQUOTE, -1, ALT_BSLASH, ALT_Z, ALT_X, ALT_C, ALT_V, ALT_B, ALT_N, ALT_M, ALT_COMMA, ALT_STOP, ALT_FSLASH, -1, ALT_PADSTAR, -1, -1, -1, KEY_F(1), KEY_F(2), KEY_F(3), KEY_F(4), KEY_F(5), KEY_F(6), KEY_F(7), KEY_F(8), KEY_F(9), KEY_F(10), -1, -1, KEY_HOME, KEY_UP, KEY_PPAGE, ALT_PADMINUS, KEY_LEFT, KEY_B2, KEY_RIGHT, ALT_PADPLUS, KEY_END, KEY_DOWN, KEY_NPAGE, KEY_IC, KEY_DC, KEY_F(13), KEY_F(14), KEY_F(15), KEY_F(16), KEY_F(17), KEY_F(18), KEY_F(19), KEY_F(20), KEY_F(21), KEY_F(22), KEY_F(25), KEY_F(26), KEY_F(27), KEY_F(28), KEY_F(29), KEY_F(30), KEY_F(31), KEY_F(32), KEY_F(33), KEY_F(34), KEY_F(37), KEY_F(38), KEY_F(39), KEY_F(40), KEY_F(41), KEY_F(42), KEY_F(43), KEY_F(44), KEY_F(45), KEY_F(46), -1, CTL_LEFT, CTL_RIGHT, CTL_END, CTL_PGDN, CTL_HOME, ALT_1, ALT_2, ALT_3, ALT_4, ALT_5, ALT_6, ALT_7, ALT_8, ALT_9, ALT_0, ALT_MINUS, ALT_EQUAL, CTL_PGUP, KEY_F(11), KEY_F(12), KEY_F(23), KEY_F(24), KEY_F(35), KEY_F(36), KEY_F(47), KEY_F(48), CTL_UP, CTL_PADMINUS, CTL_PADCENTER, CTL_PADPLUS, CTL_DOWN, CTL_INS, CTL_DEL, CTL_TAB, CTL_PADSLASH, CTL_PADSTAR, ALT_HOME, ALT_UP, ALT_PGUP, -1, ALT_LEFT, -1, ALT_RIGHT, -1, ALT_END, ALT_DOWN, ALT_PGDN, ALT_INS, ALT_DEL, ALT_PADSLASH, ALT_TAB, ALT_PADENTER, -1 }; unsigned long pdc_key_modifiers = 0L; unsigned long PDC_get_input_fd(void) { PDC_LOG(("PDC_get_input_fd() - called\n")); return (unsigned long)fileno(stdin); } #ifndef EMXVIDEO void PDC_get_keyboard_info(void) { kbdinfo.cb = sizeof(kbdinfo); KbdGetStatus(&kbdinfo, 0); } void PDC_set_keyboard_default(void) { KbdSetStatus(&kbdinfo, 0); } #endif /* ifndef EMXVIDEO */ void PDC_set_keyboard_binary(bool on) { PDC_LOG(("PDC_set_keyboard_binary() - called\n")); #ifndef EMXVIDEO if (on) { kbdinfo.fsMask &= ~(KEYBOARD_ASCII_MODE); kbdinfo.fsMask |= KEYBOARD_BINARY_MODE; } else { kbdinfo.fsMask &= ~(KEYBOARD_BINARY_MODE); kbdinfo.fsMask |= KEYBOARD_ASCII_MODE; } KbdSetStatus(&kbdinfo, 0); #endif #ifdef HAVE_SIGNAL signal(SIGBREAK, on ? SIG_IGN : SIG_DFL); #endif } /* check if a key or mouse event is waiting */ bool PDC_check_key(void) { #if !defined(_MSC_VER) && !defined(EMXVIDEO) KBDKEYINFO keyInfo = {0}; #endif #ifdef EMXVIDEO if (tahead == -1) /* Nothing typed yet */ { tahead = _read_kbd(0, 0, 0); /* Read additional */ if (tahead == 0) tahead = _read_kbd(0, 1, 0) << 8; } return (tahead != -1); #else # ifndef _MSC_VER KbdGetStatus(&kbdinfo, 0); if (mouse_handle) { MOUQUEINFO queue; MouGetNumQueEl(&queue, mouse_handle); mouse_events = queue.cEvents; if (mouse_events) return TRUE; } if (old_shift && !kbdinfo.fsState) /* modifier released */ { if (!key_pressed && SP->return_key_modifiers) return TRUE; } else if (!old_shift && kbdinfo.fsState) /* modifier pressed */ key_pressed = FALSE; old_shift = kbdinfo.fsState; KbdPeek(&keyInfo, 0); /* peek at keyboard */ return (keyInfo.fbStatus != 0); # else return kbhit(); # endif #endif } #ifndef EMXVIDEO static int _process_mouse_events(void) { MOUEVENTINFO event; static const USHORT button_mask[] = {6, 96, 24}, move_mask[] = {2, 32, 8}, press_mask[] = {4, 64, 16}; USHORT count = 1; short shift_flags = 0; int i; MouReadEventQue(&event, &count, mouse_handle); mouse_events--; for (i = 0; i < 3; i++) { pdc_mouse_status.button[i] = ((event.fs & move_mask[i]) ? BUTTON_MOVED : 0) | ((event.fs & press_mask[i]) ? BUTTON_PRESSED : 0); /* PRESS events are sometimes mistakenly reported as MOVE events. A MOVE should always follow a PRESS, so treat a MOVE immediately after a RELEASE as a PRESS. */ if ((pdc_mouse_status.button[i] == BUTTON_MOVED) && (old_mouse_status.button[i] == BUTTON_RELEASED)) { pdc_mouse_status.button[i] = BUTTON_PRESSED; } if (pdc_mouse_status.button[i] == BUTTON_PRESSED && SP->mouse_wait) { /* Check for a click -- a PRESS followed immediately by a release */ if (!mouse_events) { MOUQUEINFO queue; napms(SP->mouse_wait); MouGetNumQueEl(&queue, mouse_handle); mouse_events = queue.cEvents; } if (mouse_events) { MouReadEventQue(&event, &count, mouse_handle); if (!(event.fs & button_mask[i])) pdc_mouse_status.button[i] = BUTTON_CLICKED; } } } pdc_mouse_status.x = event.col; pdc_mouse_status.y = event.row; pdc_mouse_status.changes = 0; for (i = 0; i < 3; i++) { if (old_mouse_status.button[i] != pdc_mouse_status.button[i]) pdc_mouse_status.changes |= (1 << i); if (pdc_mouse_status.button[i] == BUTTON_MOVED) { /* Discard non-moved "moves" */ if (pdc_mouse_status.x == old_mouse_status.x && pdc_mouse_status.y == old_mouse_status.y) return -1; /* Motion events always flag the button as changed */ pdc_mouse_status.changes |= (1 << i); pdc_mouse_status.changes |= PDC_MOUSE_MOVED; break; } } old_mouse_status = pdc_mouse_status; /* Treat click events as release events for comparison purposes */ for (i = 0; i < 3; i++) { if (old_mouse_status.button[i] == BUTTON_CLICKED) old_mouse_status.button[i] = BUTTON_RELEASED; } /* Check for SHIFT/CONTROL/ALT */ if (kbdinfo.fsState & KBDSTF_ALT) shift_flags |= BUTTON_ALT; if (kbdinfo.fsState & KBDSTF_CONTROL) shift_flags |= BUTTON_CONTROL; if (kbdinfo.fsState & (KBDSTF_LEFTSHIFT|KBDSTF_RIGHTSHIFT)) shift_flags |= BUTTON_SHIFT; if (shift_flags) { for (i = 0; i < 3; i++) { if (pdc_mouse_status.changes & (1 << i)) pdc_mouse_status.button[i] |= shift_flags; } } old_shift = kbdinfo.fsState; key_pressed = TRUE; SP->key_code = TRUE; return KEY_MOUSE; } #endif /* return the next available key or mouse event */ int PDC_get_key(void) { int key, scan; #ifndef EMXVIDEO KBDKEYINFO keyInfo = {0}; #endif #ifdef EMXVIDEO if (tahead == -1) { tahead = _read_kbd(0, 1, 0); /* Read additional */ if (tahead == 0) tahead = _read_kbd(0, 1, 0) << 8; } key = tahead & 0xff; scan = tahead >> 8; pdc_key_modifiers = 0L; tahead = -1; #else pdc_key_modifiers = 0L; if (mouse_handle && mouse_events) return _process_mouse_events(); if (old_shift && !kbdinfo.fsState) { key = -1; if (old_shift & KBDSTF_LEFTALT) { key = KEY_ALT_L; } else if (old_shift & KBDSTF_RIGHTALT) { key = KEY_ALT_R; } else if (old_shift & KBDSTF_LEFTCONTROL) { key = KEY_CONTROL_L; } else if (old_shift & KBDSTF_RIGHTCONTROL) { key = KEY_CONTROL_R; } else if (old_shift & KBDSTF_LEFTSHIFT) { key = KEY_SHIFT_L; } else if (old_shift & KBDSTF_RIGHTSHIFT) { key = KEY_SHIFT_R; } key_pressed = FALSE; old_shift = kbdinfo.fsState; SP->key_code = TRUE; return key; } KbdCharIn(&keyInfo, IO_WAIT, 0); /* get a character */ key = keyInfo.chChar; scan = keyInfo.chScan; if (SP->save_key_modifiers) { if (keyInfo.fsState & KBDSTF_ALT) pdc_key_modifiers |= PDC_KEY_MODIFIER_ALT; if (keyInfo.fsState & KBDSTF_CONTROL) pdc_key_modifiers |= PDC_KEY_MODIFIER_CONTROL; if (keyInfo.fsState & KBDSTF_NUMLOCK_ON) pdc_key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; if (keyInfo.fsState & (KBDSTF_LEFTSHIFT|KBDSTF_RIGHTSHIFT)) pdc_key_modifiers |= PDC_KEY_MODIFIER_SHIFT; } #endif if (scan == 0x1c && key == 0x0a) /* ^Enter */ key = CTL_ENTER; else if (scan == 0xe0 && key == 0x0d) /* PadEnter */ key = PADENTER; else if (scan == 0xe0 && key == 0x0a) /* ^PadEnter */ key = CTL_PADENTER; else if (scan == 0x37 && key == 0x2a) /* Star */ key = PADSTAR; else if (scan == 0x4a && key == 0x2d) /* Minus */ key = PADMINUS; else if (scan == 0x4e && key == 0x2b) /* Plus */ key = PADPLUS; else if (scan == 0xe0 && key == 0x2f) /* Slash */ key = PADSLASH; else if (key == 0x00 || (key == 0xe0 && scan > 53 && scan != 86)) key = (scan > 0xa7) ? -1 : key_table[scan]; if (keyInfo.fsState & (KBDSTF_LEFTSHIFT|KBDSTF_RIGHTSHIFT)) { switch (key) { case KEY_HOME: /* Shift Home */ key = KEY_SHOME; break; case KEY_UP: /* Shift Up */ key = KEY_SUP; break; case KEY_PPAGE: /* Shift PgUp */ key = KEY_SPREVIOUS; break; case KEY_LEFT: /* Shift Left */ key = KEY_SLEFT; break; case KEY_RIGHT: /* Shift Right */ key = KEY_SRIGHT; break; case KEY_END: /* Shift End */ key = KEY_SEND; break; case KEY_DOWN: /* Shift Down */ key = KEY_SDOWN; break; case KEY_NPAGE: /* Shift PgDn */ key = KEY_SNEXT; break; case KEY_IC: /* Shift Ins */ key = KEY_SIC; break; case KEY_DC: /* Shift Del */ key = KEY_SDC; } } key_pressed = TRUE; SP->key_code = ((unsigned)key >= 256); return key; } /* discard any pending keyboard or mouse input -- this is the core routine for flushinp() */ void PDC_flushinp(void) { PDC_LOG(("PDC_flushinp() - called\n")); #ifdef EMXVIDEO tcflush(0, TCIFLUSH); #else if (mouse_handle) MouFlushQue(mouse_handle); KbdFlushBuffer(0); #endif } int PDC_mouse_set(void) { #ifndef EMXVIDEO unsigned long mbe = SP->_trap_mbe; if (mbe && !mouse_handle) { memset(&old_mouse_status, 0, sizeof(MOUSE_STATUS)); MouOpen(NULL, &mouse_handle); if (mouse_handle) MouDrawPtr(mouse_handle); } else if (!mbe && mouse_handle) { MouClose(mouse_handle); mouse_handle = 0; } if (mbe && mouse_handle) { USHORT mask = ((mbe & (BUTTON1_PRESSED | BUTTON1_CLICKED | BUTTON1_MOVED)) ? 6 : 0) | ((mbe & (BUTTON3_PRESSED | BUTTON3_CLICKED | BUTTON3_MOVED)) ? 24 : 0) | ((mbe & (BUTTON2_PRESSED | BUTTON2_CLICKED | BUTTON2_MOVED)) ? 96 : 0); MouSetEventMask(&mask, mouse_handle); } #endif return OK; } int PDC_modifiers_set(void) { key_pressed = FALSE; return OK; } curses-1.4.4/vendor/PDCurses/os2/pdcsetsc.c0000644000004100000410000000534214201713275020526 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcos2.h" /*man-start************************************************************** pdcsetsc -------- ### Synopsis int PDC_set_blink(bool blinkon); void PDC_set_title(const char *title); ### Description PDC_set_blink() toggles whether the A_BLINK attribute sets an actual blink mode (TRUE), or sets the background color to high intensity (FALSE). The default is platform-dependent (FALSE in most cases). It returns OK if it could set the state to match the given parameter, ERR otherwise. Current platforms also adjust the value of COLORS according to this function -- 16 for FALSE, and 8 for TRUE. PDC_set_title() sets the title of the window in which the curses program is running. This function may not do anything on some platforms. (Currently it only works in Win32 and X11.) ### Portability X/Open BSD SYS V PDC_set_blink - - - PDC_set_title - - - **man-end****************************************************************/ int PDC_curs_set(int visibility) { #ifndef EMXVIDEO VIOCURSORINFO pvioCursorInfo; #endif int ret_vis, hidden = 0, start = 0, end = 0; PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); ret_vis = SP->visibility; SP->visibility = visibility; switch(visibility) { case 0: /* invisible */ #ifdef EMXVIDEO start = end = 0; #else start = pdc_font / 4; end = pdc_font; hidden = -1; #endif break; case 2: /* highly visible */ start = 2; /* almost full-height block */ end = pdc_font - 1; break; default: /* normal visibility */ start = (SP->orig_cursor >> 8) & 0xff; end = SP->orig_cursor & 0xff; } #ifdef EMXVIDEO if (!visibility) v_hidecursor(); else v_ctype(start, end); #else pvioCursorInfo.yStart = (USHORT)start; pvioCursorInfo.cEnd = (USHORT)end; pvioCursorInfo.cx = (USHORT)1; pvioCursorInfo.attr = hidden; VioSetCurType((PVIOCURSORINFO)&pvioCursorInfo, 0); #endif return ret_vis; } void PDC_set_title(const char *title) { PDC_LOG(("PDC_set_title() - called:<%s>\n", title)); } int PDC_set_blink(bool blinkon) { #ifndef EMXVIDEO USHORT statebuf[3], result; statebuf[0] = 6; /* length */ statebuf[1] = 2; /* blink/intensity */ statebuf[2] = !blinkon; result = VioSetState(&statebuf, 0); VioGetState(&statebuf, 0); /* needed? */ if (pdc_color_started) COLORS = statebuf[2] ? 16 : 8; return (result == 0) ? OK : ERR; #else if (pdc_color_started) COLORS = 16; return blinkon ? ERR : OK; #endif } curses-1.4.4/vendor/PDCurses/os2/pdcgetsc.c0000644000004100000410000000330114201713275020503 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcos2.h" /* return width of screen/viewport */ int PDC_get_columns(void) { #ifdef EMXVIDEO int rows = 0; #else VIOMODEINFO modeInfo = {0}; #endif int cols = 0; const char *env_cols; PDC_LOG(("PDC_get_columns() - called\n")); #ifdef EMXVIDEO v_dimen(&cols, &rows); #else modeInfo.cb = sizeof(modeInfo); VioGetMode(&modeInfo, 0); cols = modeInfo.col; #endif env_cols = getenv("COLS"); if (env_cols) cols = min(atoi(env_cols), cols); PDC_LOG(("PDC_get_columns() - returned: cols %d\n", cols)); return cols; } /* get the cursor size/shape */ int PDC_get_cursor_mode(void) { #ifdef EMXVIDEO int curstart = 0, curend = 0; #else VIOCURSORINFO cursorInfo; #endif PDC_LOG(("PDC_get_cursor_mode() - called\n")); #ifdef EMXVIDEO v_getctype(&curstart, &curend); return (curstart << 8) | curend; #else VioGetCurType (&cursorInfo, 0); return (cursorInfo.yStart << 8) | cursorInfo.cEnd; #endif } /* return number of screen rows */ int PDC_get_rows(void) { #ifdef EMXVIDEO int cols = 0; #else VIOMODEINFO modeInfo = {0}; #endif int rows = 0; const char *env_rows; PDC_LOG(("PDC_get_rows() - called\n")); /* use the value from LINES environment variable, if set. MH 10-Jun-92 */ /* and use the minimum of LINES and *ROWS. MH 18-Jun-92 */ #ifdef EMXVIDEO v_dimen(&cols, &rows); #else modeInfo.cb = sizeof(modeInfo); VioGetMode(&modeInfo, 0); rows = modeInfo.row; #endif env_rows = getenv("LINES"); if (env_rows) rows = min(atoi(env_rows), rows); PDC_LOG(("PDC_get_rows() - returned: rows %d\n", rows)); return rows; } curses-1.4.4/vendor/PDCurses/os2/pdcdisp.c0000644000004100000410000000443514201713275020346 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcos2.h" /* ACS definitions originally by jshumate@wrdis01.robins.af.mil -- these match code page 437 and compatible pages (CP850, CP852, etc.) */ #ifdef CHTYPE_LONG # define A(x) ((chtype)x | A_ALTCHARSET) chtype acs_map[128] = { A(0), A(1), A(2), A(3), A(4), A(5), A(6), A(7), A(8), A(9), A(10), A(11), A(12), A(13), A(14), A(15), A(16), A(17), A(18), A(19), A(20), A(21), A(22), A(23), A(24), A(25), A(26), A(27), A(28), A(29), A(30), A(31), ' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', A(0x1a), A(0x1b), A(0x18), A(0x19), '/', 0xdb, '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', A(0x04), 0xb1, 'b', 'c', 'd', 'e', 0xf8, 0xf1, 0xb0, A(0x0f), 0xd9, 0xbf, 0xda, 0xc0, 0xc5, 0x2d, 0x2d, 0xc4, 0x2d, 0x5f, 0xc3, 0xb4, 0xc1, 0xc2, 0xb3, 0xf3, 0xf2, 0xe3, 0xd8, 0x9c, 0xf9, A(127) }; # undef A #endif /* position hardware cursor at (y, x) */ void PDC_gotoyx(int row, int col) { PDC_LOG(("PDC_gotoyx() - called: row %d col %d\n", row, col)); #ifdef EMXVIDEO v_gotoxy(col, row); #else VioSetCurPos(row, col, 0); #endif } /* update the given physical line to look like the corresponding line in curscr */ void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) { /* this should be enough for the maximum width of a screen. */ struct {unsigned char text, attr;} temp_line[256]; int j; PDC_LOG(("PDC_transform_line() - called: line %d\n", lineno)); /* replace the attribute part of the chtype with the actual color value for each chtype in the line */ for (j = 0; j < len; j++) { chtype ch = srcp[j]; temp_line[j].attr = pdc_atrtab[ch >> PDC_ATTR_SHIFT]; #ifdef CHTYPE_LONG if (ch & A_ALTCHARSET && !(ch & 0xff80)) ch = acs_map[ch & 0x7f]; #endif temp_line[j].text = ch & 0xff; } #ifdef EMXVIDEO v_putline((char *)temp_line, x, lineno, len); #else VioWrtCellStr((PCH)temp_line, (USHORT)(len * sizeof(unsigned short)), (USHORT)lineno, (USHORT)x, 0); #endif } curses-1.4.4/vendor/PDCurses/os2/iccos2.lrf0000644000004100000410000000135114201713275020435 0ustar www-datawww-data-+addch.obj & -+addchstr.obj & -+addstr.obj & -+attr.obj & -+beep.obj & -+bkgd.obj & -+border.obj & -+clear.obj & -+color.obj & -+delch.obj & -+deleteln.obj & -+deprec.obj & -+getch.obj & -+getstr.obj & -+getyx.obj & -+inch.obj & -+inchstr.obj & -+initscr.obj & -+inopts.obj & -+insch.obj & -+insstr.obj & -+instr.obj & -+kernel.obj & -+keyname.obj & -+mouse.obj & -+move.obj & -+outopts.obj & -+overlay.obj & -+pad.obj & -+panel.obj & -+printw.obj & -+refresh.obj & -+scanw.obj & -+scr_dump.obj & -+scroll.obj & -+slk.obj & -+termattr.obj & -+terminfo.obj & -+touch.obj & -+util.obj & -+window.obj & -+debug.obj & -+pdcclip.obj & -+pdcdisp.obj & -+pdcgetsc.obj & -+pdckbd.obj & -+pdcscrn.obj & -+pdcsetsc.obj & -+pdcutil.obj & ,lib.map; curses-1.4.4/vendor/PDCurses/os2/pdcclip.c0000644000004100000410000001022114201713275020324 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcos2.h" /*man-start************************************************************** clipboard --------- ### Synopsis int PDC_getclipboard(char **contents, long *length); int PDC_setclipboard(const char *contents, long length); int PDC_freeclipboard(char *contents); int PDC_clearclipboard(void); ### Description PDC_getclipboard() gets the textual contents of the system's clipboard. This function returns the contents of the clipboard in the contents argument. It is the responsibilitiy of the caller to free the memory returned, via PDC_freeclipboard(). The length of the clipboard contents is returned in the length argument. PDC_setclipboard copies the supplied text into the system's clipboard, emptying the clipboard prior to the copy. PDC_clearclipboard() clears the internal clipboard. ### Return Values indicator of success/failure of call. PDC_CLIP_SUCCESS the call was successful PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for the clipboard contents PDC_CLIP_EMPTY the clipboard contains no text PDC_CLIP_ACCESS_ERROR no clipboard support ### Portability X/Open BSD SYS V PDC_getclipboard - - - PDC_setclipboard - - - PDC_freeclipboard - - - PDC_clearclipboard - - - **man-end****************************************************************/ int PDC_getclipboard(char **contents, long *length) { #ifndef EMXVIDEO HMQ hmq; HAB hab; PTIB ptib; PPIB ppib; ULONG ulRet; long len; int rc; #endif PDC_LOG(("PDC_getclipboard() - called\n")); #ifndef EMXVIDEO DosGetInfoBlocks(&ptib, &ppib); ppib->pib_ultype = 3; hab = WinInitialize(0); hmq = WinCreateMsgQueue(hab, 0); if (!WinOpenClipbrd(hab)) { WinDestroyMsgQueue(hmq); WinTerminate(hab); return PDC_CLIP_ACCESS_ERROR; } rc = PDC_CLIP_EMPTY; ulRet = WinQueryClipbrdData(hab, CF_TEXT); if (ulRet) { len = strlen((char *)ulRet); *contents = malloc(len + 1); if (!*contents) rc = PDC_CLIP_MEMORY_ERROR; else { strcpy((char *)*contents, (char *)ulRet); *length = len; rc = PDC_CLIP_SUCCESS; } } WinCloseClipbrd(hab); WinDestroyMsgQueue(hmq); WinTerminate(hab); return rc; #else return PDC_CLIP_ACCESS_ERROR; #endif } int PDC_setclipboard(const char *contents, long length) { #ifndef EMXVIDEO HAB hab; PTIB ptib; PPIB ppib; ULONG ulRC; PSZ szTextOut = NULL; int rc; #endif PDC_LOG(("PDC_setclipboard() - called\n")); #ifndef EMXVIDEO DosGetInfoBlocks(&ptib, &ppib); ppib->pib_ultype = 3; hab = WinInitialize(0); if (!WinOpenClipbrd(hab)) { WinTerminate(hab); return PDC_CLIP_ACCESS_ERROR; } rc = PDC_CLIP_MEMORY_ERROR; ulRC = DosAllocSharedMem((PVOID)&szTextOut, NULL, length + 1, PAG_WRITE | PAG_COMMIT | OBJ_GIVEABLE); if (ulRC == 0) { strcpy(szTextOut, contents); WinEmptyClipbrd(hab); if (WinSetClipbrdData(hab, (ULONG)szTextOut, CF_TEXT, CFI_POINTER)) rc = PDC_CLIP_SUCCESS; else { DosFreeMem(szTextOut); rc = PDC_CLIP_ACCESS_ERROR; } } WinCloseClipbrd(hab); WinTerminate(hab); return rc; #else return PDC_CLIP_ACCESS_ERROR; #endif } int PDC_freeclipboard(char *contents) { PDC_LOG(("PDC_freeclipboard() - called\n")); if (contents) free(contents); return PDC_CLIP_SUCCESS; } int PDC_clearclipboard(void) { #ifndef EMXVIDEO HAB hab; PTIB ptib; PPIB ppib; #endif PDC_LOG(("PDC_clearclipboard() - called\n")); #ifndef EMXVIDEO DosGetInfoBlocks(&ptib, &ppib); ppib->pib_ultype = 3; hab = WinInitialize(0); WinEmptyClipbrd(hab); WinCloseClipbrd(hab); WinTerminate(hab); return PDC_CLIP_SUCCESS; #else return PDC_CLIP_ACCESS_ERROR; #endif } curses-1.4.4/vendor/PDCurses/os2/Makefile.bcc0000644000004100000410000000364514201713275020744 0ustar www-datawww-data# Borland MAKE Makefile for PDCurses library - OS/2 BC++ 1.0+ # # Usage: make -f [path\]Makefile.bcc [DEBUG=] [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] O = obj !ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. !endif !include $(PDCURSES_SRCDIR)\version.mif !include $(PDCURSES_SRCDIR)\libobjs.mif osdir = $(PDCURSES_SRCDIR)\os2 CC = bcc !ifdef DEBUG CFLAGS = -N -v -y -DPDCDEBUG !else CFLAGS = -O !endif CPPFLAGS = -I$(PDCURSES_SRCDIR) BUILD = $(CC) -c $(CFLAGS) $(CPPFLAGS) LINK = tlink LIBEXE = tlib /C /E LIBCURSES = pdcurses.lib all: $(LIBCURSES) $(DEMOS) clean: -del *.obj -del *.lib -del *.exe demos: $(DEMOS) $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) -del $@ $(LIBEXE) $@ \ +addch.obj +addchstr.obj +addstr.obj +attr.obj +beep.obj +bkgd.obj \ +border.obj +clear.obj +color.obj +delch.obj +deleteln.obj +deprec.obj \ +getch.obj +getstr.obj +getyx.obj +inch.obj +inchstr.obj +initscr.obj \ +inopts.obj +insch.obj +insstr.obj +instr.obj +kernel.obj +keyname.obj \ +mouse.obj +move.obj +outopts.obj +overlay.obj +pad.obj +panel.obj \ +printw.obj +refresh.obj +scanw.obj +scr_dump.obj +scroll.obj +slk.obj \ +termattr.obj +terminfo.obj +touch.obj +util.obj +window.obj +debug.obj \ +pdcclip.obj +pdcdisp.obj +pdcgetsc.obj +pdckbd.obj +pdcscrn.obj \ +pdcsetsc.obj +pdcutil.obj ,lib.map -copy $(LIBCURSES) panel.lib .autodepend {$(srcdir)\}.c.obj: $(BUILD) $< {$(osdir)\}.c.obj: $(BUILD) $< {$(demodir)\}.c.obj: $(BUILD) $< .c.obj: $(BUILD) $< .obj.exe: $(CC) -e$@ $** $(LIBCURSES) tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES) $(CC) -e$@ $** tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(PDCURSES_CURSES_H) $(BUILD) -I$(demodir) $(demodir)\tui.c tuidemo.obj: $(demodir)\tuidemo.c $(PDCURSES_CURSES_H) $(BUILD) -I$(demodir) $(demodir)\tuidemo.c PLATFORM1 = Borland C++ OS/2 1.0 PLATFORM2 = Borland C/C++ OS/2 1.0 ARCNAME = pdc$(VER)bcos2 !include $(PDCURSES_SRCDIR)\makedist.mif curses-1.4.4/vendor/PDCurses/os2/pdcos2.h0000644000004100000410000000166514201713275020121 0ustar www-datawww-data/* Public Domain Curses */ #ifdef _MSC_VER # define USE_OS2_H 1 /* Use the os2.h for the compiler */ # define APIRET USHORT #endif #include #include #ifdef EMXVIDEO # include #else # define INCL_DOS # define INCL_DOSMISC # define INCL_WIN # define INCL_VIO # define INCL_KBD # define INCL_MOU # include #endif #include #ifdef CHTYPE_LONG # define PDC_ATTR_SHIFT 19 #else # define PDC_ATTR_SHIFT 8 #endif #ifdef __WATCOMC__ # define PDCTHUNK(x) ((ptr_16)(x)) # ifdef __386__ # define SEG16 _Seg16 # else # define SEG16 # endif typedef void * SEG16 ptr_16; #else # ifdef __EMX__ # ifdef __INNOTEK_LIBC__ # define PDCTHUNK(x) ((PCH)_libc_32to16(x)) # else # define PDCTHUNK(x) ((PCH)_emx_32to16(x)) # endif # endif #endif extern unsigned char *pdc_atrtab; extern int pdc_font; extern void PDC_get_keyboard_info(void); extern void PDC_set_keyboard_default(void); curses-1.4.4/vendor/PDCurses/os2/CMakeLists.txt0000644000004100000410000000263114201713275021310 0ustar www-datawww-datacmake_minimum_required(VERSION 3.11) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING "Choose the type of build, options are: Debug, Release, or MinSizeRel." FORCE) message(STATUS "No build type specified, defaulting to MinSizeRel.") endif() PROJECT(os2 VERSION "${PROJECT_VERSION}" LANGUAGES C) MESSAGE(STATUS "${PROJECT_NAME} version: ${PROJECT_VERSION}") include(project_common) if(WATCOM) # this requires using the following toolchainfile file # -DCMAKE_TOOLCHAIN_FILE={path}\watcom_open_os2vs_toolchain.cmake string(APPEND CMAKE_C_FLAGS " -wx") # warning level: to maximum setting string(APPEND CMAKE_C_FLAGS_RELEASE " -oneatx") string(APPEND CMAKE_C_FLAGS_MINSIZEREL " -oneatx") # optimization: # n -> allow numerically unstable optimizations # e -> expand user functions inline # a -> relax aliasing constraints # t -> favor execution time over code size in optimizations # x -> equivalent to -obmiler -s string(APPEND CMAKE_C_FLAGS_DEBUG " -d2") # full symbolic debugging info string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG " debug watcom all") endif() demo_app(../demos version) demo_app(../demos firework) demo_app(../demos ozdemo) demo_app(../demos newtest) demo_app(../demos ptest) demo_app(../demos rain) demo_app(../demos testcurs) demo_app(../demos worm) demo_app(../demos xmas) curses-1.4.4/vendor/PDCurses/os2/pdcutil.c0000644000004100000410000000165614201713275020366 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcos2.h" #if defined(OS2) && !defined(__EMX__) APIRET APIENTRY DosSleep(ULONG ulTime); #endif void PDC_beep(void) { PDC_LOG(("PDC_beep() - called\n")); #ifdef EMXVIDEO putchar('\007'); #else DosBeep(1380, 100); #endif } void PDC_napms(int ms) { PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); #ifdef __EMX__ _sleep2(ms); #else DosSleep(ms); #endif } const char *PDC_sysname(void) { return "OS/2"; } PDCEX PDC_version_info PDC_version = { PDC_PORT_OS2, PDC_VER_MAJOR, PDC_VER_MINOR, PDC_VER_CHANGE, sizeof( chtype), /* note that thus far, 'wide' and 'UTF8' versions exist */ /* only for SDL2, X11, Win32, and Win32a; elsewhere, */ /* these will be FALSE */ #ifdef PDC_WIDE TRUE, #else FALSE, #endif #ifdef PDC_FORCE_UTF8 TRUE, #else FALSE, #endif }; curses-1.4.4/vendor/PDCurses/os2/iccos2.mak0000644000004100000410000001470714201713275020433 0ustar www-datawww-data# NMAKE Makefile for PDCurses library - OS/2 C Set/2 # # Usage: nmake -f [path\]iccos2.mak [DEBUG=] [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] O = obj !ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. !endif !include $(PDCURSES_SRCDIR)\version.mif !include $(PDCURSES_SRCDIR)\libobjs.mif osdir = $(PDCURSES_SRCDIR)\os2 PDCURSES_OS2_H = $(osdir)\pdcos2.h CC = icc !ifdef DEBUG CFLAGS = /Sm /Ti+ /O- /Q+ /dPDCDEBUG LDFLAGS = /NOLOGO /NOE /SE:160 /DEBUG /PMTYPE:VIO !else CFLAGS = /Sm /Ti- /O+ /Q+ LDFLAGS = /NOLOGO /NOE /EXEPACK /PACKCODE /PACKDATA /PMTYPE:VIO !endif CPPFLAGS = -I$(PDCURSES_SRCDIR) BUILD = $(CC) -c $(CFLAGS) $(CPPFLAGS) LINK = link386 LIBEXE = lib LIBCURSES = pdcurses.lib all: $(LIBCURSES) $(DEMOS) clean: -del *.obj -del *.lib -del *.exe demos: $(DEMOS) $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) $@ @$(osdir)\iccos2.lrf -copy $(LIBCURSES) panel.lib addch.obj: $(srcdir)\addch.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\addch.c addchstr.obj: $(srcdir)\addchstr.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\addchstr.c addstr.obj: $(srcdir)\addstr.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\addstr.c attr.obj: $(srcdir)\attr.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\attr.c beep.obj: $(srcdir)\beep.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\beep.c bkgd.obj: $(srcdir)\bkgd.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\bkgd.c border.obj: $(srcdir)\border.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\border.c clear.obj: $(srcdir)\clear.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\clear.c color.obj: $(srcdir)\color.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\color.c delch.obj: $(srcdir)\delch.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\delch.c deleteln.obj: $(srcdir)\deleteln.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\deleteln.c deprec.obj: $(srcdir)\deprec.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\deprec.c getch.obj: $(srcdir)\getch.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\getch.c getstr.obj: $(srcdir)\getstr.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\getstr.c getyx.obj: $(srcdir)\getyx.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\getyx.c inch.obj: $(srcdir)\inch.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\inch.c inchstr.obj: $(srcdir)\inchstr.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\inchstr.c initscr.obj: $(srcdir)\initscr.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\initscr.c inopts.obj: $(srcdir)\inopts.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\inopts.c insch.obj: $(srcdir)\insch.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\insch.c insstr.obj: $(srcdir)\insstr.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\insstr.c instr.obj: $(srcdir)\instr.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\instr.c kernel.obj: $(srcdir)\kernel.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\kernel.c keyname.obj: $(srcdir)\keyname.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\keyname.c mouse.obj: $(srcdir)\mouse.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\mouse.c move.obj: $(srcdir)\move.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\move.c outopts.obj: $(srcdir)\outopts.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\outopts.c overlay.obj: $(srcdir)\overlay.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\overlay.c pad.obj: $(srcdir)\pad.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\pad.c panel.obj: $(srcdir)\panel.c $(PDCURSES_HEADERS) $(PANEL_HEADER) $(BUILD) $(srcdir)\panel.c printw.obj: $(srcdir)\printw.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\printw.c refresh.obj: $(srcdir)\refresh.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\refresh.c scanw.obj: $(srcdir)\scanw.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\scanw.c scr_dump.obj: $(srcdir)\scr_dump.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\scr_dump.c scroll.obj: $(srcdir)\scroll.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\scroll.c slk.obj: $(srcdir)\slk.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\slk.c termattr.obj: $(srcdir)\termattr.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\termattr.c terminfo.obj: $(srcdir)\terminfo.c $(PDCURSES_HEADERS) $(TERM_HEADER) $(BUILD) $(srcdir)\terminfo.c touch.obj: $(srcdir)\touch.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\touch.c util.obj: $(srcdir)\util.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\util.c window.obj: $(srcdir)\window.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\window.c debug.obj: $(srcdir)\debug.c $(PDCURSES_HEADERS) $(BUILD) $(srcdir)\debug.c pdcclip.obj: $(osdir)\pdcclip.c $(PDCURSES_HEADERS) $(PDCURSES_OS2_H) $(BUILD) $(osdir)\pdcclip.c pdcdisp.obj: $(osdir)\pdcdisp.c $(PDCURSES_HEADERS) $(PDCURSES_OS2_H) $(BUILD) $(osdir)\pdcdisp.c pdcgetsc.obj: $(osdir)\pdcgetsc.c $(PDCURSES_HEADERS) $(PDCURSES_OS2_H) $(BUILD) $(osdir)\pdcgetsc.c pdckbd.obj: $(osdir)\pdckbd.c $(PDCURSES_HEADERS) $(PDCURSES_OS2_H) $(BUILD) $(osdir)\pdckbd.c pdcscrn.obj: $(osdir)\pdcscrn.c $(PDCURSES_HEADERS) $(PDCURSES_OS2_H) $(BUILD) $(osdir)\pdcscrn.c pdcsetsc.obj: $(osdir)\pdcsetsc.c $(PDCURSES_HEADERS) $(PDCURSES_OS2_H) $(BUILD) $(osdir)\pdcsetsc.c pdcutil.obj: $(osdir)\pdcutil.c $(PDCURSES_HEADERS) $(PDCURSES_OS2_H) $(BUILD) $(osdir)\pdcutil.c firework.exe: firework.obj $(LIBCURSES) $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES); ozdemo.exe: ozdemo.obj $(LIBCURSES) $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES); ptest.exe: ptest.obj $(LIBCURSES) $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES); rain.exe: rain.obj $(LIBCURSES) $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES); testcurs.exe: testcurs.obj $(LIBCURSES) $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES); tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES) $(LINK) $(LDFLAGS) $*.obj+tui.obj,$*,,$(LIBCURSES); worm.exe: worm.obj $(LIBCURSES) $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES); xmas.exe: xmas.obj $(LIBCURSES) $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES); firework.obj: $(demodir)\firework.c $(PDCURSES_CURSES_H) $(BUILD) $(demodir)\firework.c ozdemo.obj: $(demodir)\ozdemo.c $(PDCURSES_CURSES_H) $(BUILD) $(demodir)\ozdemo.c ptest.obj: $(demodir)\ptest.c $(PANEL_HEADER) $(PDCURSES_CURSES_H) $(BUILD) $(demodir)\ptest.c rain.obj: $(demodir)\rain.c $(PDCURSES_CURSES_H) $(BUILD) $(demodir)\rain.c testcurs.obj: $(demodir)\testcurs.c $(PDCURSES_CURSES_H) $(BUILD) $(demodir)\testcurs.c tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(PDCURSES_CURSES_H) $(BUILD) $(demodir)\tui.c tuidemo.obj: $(demodir)\tuidemo.c $(PDCURSES_CURSES_H) $(BUILD) $(demodir)\tuidemo.c worm.obj: $(demodir)\worm.c $(PDCURSES_CURSES_H) $(BUILD) $(demodir)\worm.c xmas.obj: $(demodir)\xmas.c $(PDCURSES_CURSES_H) $(BUILD) $(demodir)\xmas.c PLATFORM1 = C Set/2 OS/2 PLATFORM2 = C Set/2 for OS/2 ARCNAME = pdc$(VER)_icc_os2 !include $(PDCURSES_SRCDIR)\makedist.mif curses-1.4.4/vendor/PDCurses/os2/pdcscrn.c0000644000004100000410000002321314201713275020347 0ustar www-datawww-data/* Public Domain Curses */ #include "pdcos2.h" #ifdef CHTYPE_LONG # define PDC_OFFSET 32 #else # define PDC_OFFSET 8 #endif /* COLOR_PAIR to attribute encoding table. */ unsigned char *pdc_atrtab = (unsigned char *)NULL; int pdc_font; /* default font size */ static short curstoreal[16], realtocurs[16] = { COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN, COLOR_RED, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE, COLOR_BLACK + 8, COLOR_BLUE + 8, COLOR_GREEN + 8, COLOR_CYAN + 8, COLOR_RED + 8, COLOR_MAGENTA + 8, COLOR_YELLOW + 8, COLOR_WHITE + 8 }; #ifdef EMXVIDEO static unsigned char *saved_screen = NULL; static int saved_lines = 0; static int saved_cols = 0; #else # ifdef PDCTHUNK # ifdef __EMX__ # define THUNKEDVIO VIOCOLORREG # else typedef struct { USHORT cb; USHORT type; USHORT firstcolorreg; USHORT numcolorregs; ptr_16 colorregaddr; } THUNKEDVIO; # endif # endif static PCH saved_screen = NULL; static USHORT saved_lines = 0; static USHORT saved_cols = 0; static VIOMODEINFO scrnmode; /* default screen mode */ static VIOMODEINFO saved_scrnmode[3]; static int saved_font[3]; static bool can_change = FALSE; /* special purpose function keys */ static int PDC_shutdown_key[PDC_MAX_FUNCTION_KEYS] = { 0, 0, 0, 0, 0 }; static int _get_font(void) { VIOMODEINFO modeInfo = {0}; modeInfo.cb = sizeof(modeInfo); VioGetMode(&modeInfo, 0); return (modeInfo.vres / modeInfo.row); } static void _set_font(int size) { VIOMODEINFO modeInfo = {0}; if (pdc_font != size) { modeInfo.cb = sizeof(modeInfo); /* set most parameters of modeInfo */ VioGetMode(&modeInfo, 0); modeInfo.cb = 8; /* ignore horiz an vert resolution */ modeInfo.row = modeInfo.vres / size; VioSetMode(&modeInfo, 0); } curs_set(SP->visibility); pdc_font = _get_font(); } #endif /* close the physical screen -- may restore the screen to its state before PDC_scr_open(); miscellaneous cleanup */ void PDC_scr_close(void) { PDC_LOG(("PDC_scr_close() - called\n")); if (saved_screen && getenv("PDC_RESTORE_SCREEN")) { #ifdef EMXVIDEO v_putline(saved_screen, 0, 0, saved_lines * saved_cols); #else VioWrtCellStr(saved_screen, saved_lines * saved_cols * 2, 0, 0, (HVIO)NULL); #endif free(saved_screen); saved_screen = NULL; } reset_shell_mode(); if (SP->visibility != 1) curs_set(1); /* Position cursor to the bottom left of the screen. */ PDC_gotoyx(PDC_get_rows() - 2, 0); } void PDC_scr_free(void) { if (SP) free(SP); if (pdc_atrtab) free(pdc_atrtab); pdc_atrtab = (unsigned char *)NULL; } /* open the physical screen -- allocate SP, miscellaneous intialization, and may save the existing screen for later restoration */ int PDC_scr_open(int argc, char **argv) { #ifdef EMXVIDEO int adapter; #else USHORT totchars; #endif int i; short r, g, b; PDC_LOG(("PDC_scr_open() - called\n")); SP = calloc(1, sizeof(SCREEN)); pdc_atrtab = calloc(PDC_COLOR_PAIRS * PDC_OFFSET, 1); if (!SP || !pdc_atrtab) return ERR; for (i = 0; i < 16; i++) curstoreal[realtocurs[i]] = i; #ifdef EMXVIDEO v_init(); #endif SP->orig_attr = FALSE; #ifdef EMXVIDEO adapter = v_hardware(); SP->mono = (adapter == V_MONOCHROME); pdc_font = SP->mono ? 14 : (adapter == V_COLOR_8) ? 8 : 12; #else VioGetMode(&scrnmode, 0); PDC_get_keyboard_info(); pdc_font = _get_font(); #endif SP->lines = PDC_get_rows(); SP->cols = PDC_get_columns(); SP->mouse_wait = PDC_CLICK_PERIOD; SP->audible = TRUE; /* This code for preserving the current screen */ if (getenv("PDC_RESTORE_SCREEN")) { saved_lines = SP->lines; saved_cols = SP->cols; saved_screen = malloc(2 * saved_lines * saved_cols); if (!saved_screen) { SP->_preserve = FALSE; return OK; } #ifdef EMXVIDEO v_getline(saved_screen, 0, 0, saved_lines * saved_cols); #else totchars = saved_lines * saved_cols * 2; VioReadCellStr((PCH)saved_screen, &totchars, 0, 0, (HVIO)NULL); #endif } SP->_preserve = (getenv("PDC_PRESERVE_SCREEN") != NULL); can_change = (PDC_color_content(0, &r, &g, &b) == OK); return OK; } /* the core of resize_term() */ int PDC_resize_screen(int nlines, int ncols) { #ifndef EMXVIDEO VIOMODEINFO modeInfo = {0}; USHORT result; #endif PDC_LOG(("PDC_resize_screen() - called. Lines: %d Cols: %d\n", nlines, ncols)); if( !stdscr) /* window hasn't been created yet; we're */ { /* specifying its size before doing so */ return OK; /* ...which doesn't work (yet) on Win32 */ } #ifdef EMXVIDEO return ERR; #else modeInfo.cb = sizeof(modeInfo); /* set most parameters of modeInfo */ VioGetMode(&modeInfo, 0); modeInfo.fbType = 1; modeInfo.row = nlines; modeInfo.col = ncols; result = VioSetMode(&modeInfo, 0); LINES = PDC_get_rows(); COLS = PDC_get_columns(); return (result == 0) ? OK : ERR; #endif } void PDC_reset_prog_mode(void) { PDC_LOG(("PDC_reset_prog_mode() - called.\n")); #ifndef EMXVIDEO PDC_set_keyboard_binary(TRUE); #endif } void PDC_reset_shell_mode(void) { PDC_LOG(("PDC_reset_shell_mode() - called.\n")); #ifndef EMXVIDEO PDC_set_keyboard_default(); #endif } #ifndef EMXVIDEO static bool _screen_mode_equals(VIOMODEINFO *oldmode) { VIOMODEINFO current = {0}; VioGetMode(¤t, 0); return ((current.cb == oldmode->cb) && (current.fbType == oldmode->fbType) && (current.color == oldmode->color) && (current.col == oldmode->col) && (current.row == oldmode->row) && (current.hres == oldmode->vres) && (current.vres == oldmode->vres)); } #endif void PDC_restore_screen_mode(int i) { #ifndef EMXVIDEO if (i >= 0 && i <= 2) { pdc_font = _get_font(); _set_font(saved_font[i]); if (!_screen_mode_equals(&saved_scrnmode[i])) if (VioSetMode(&saved_scrnmode[i], 0) != 0) { pdc_font = _get_font(); scrnmode = saved_scrnmode[i]; LINES = PDC_get_rows(); COLS = PDC_get_columns(); } } #endif } void PDC_save_screen_mode(int i) { #ifndef EMXVIDEO if (i >= 0 && i <= 2) { saved_font[i] = pdc_font; saved_scrnmode[i] = scrnmode; } #endif } void PDC_init_pair(short pair, short fg, short bg) { unsigned char att, temp_bg; chtype i; fg = curstoreal[fg]; bg = curstoreal[bg]; for (i = 0; i < PDC_OFFSET; i++) { att = fg | (bg << 4); if (i & (A_REVERSE >> PDC_ATTR_SHIFT)) att = bg | (fg << 4); if (i & (A_UNDERLINE >> PDC_ATTR_SHIFT)) att = 1; if (i & (A_INVIS >> PDC_ATTR_SHIFT)) { temp_bg = att >> 4; att = temp_bg << 4 | temp_bg; } if (i & (A_BOLD >> PDC_ATTR_SHIFT)) att |= 8; if (i & (A_BLINK >> PDC_ATTR_SHIFT)) att |= 128; pdc_atrtab[pair * PDC_OFFSET + i] = att; } } int PDC_pair_content(short pair, short *fg, short *bg) { *fg = realtocurs[pdc_atrtab[pair * PDC_OFFSET] & 0x0F]; *bg = realtocurs[(pdc_atrtab[pair * PDC_OFFSET] & 0xF0) >> 4]; return OK; } bool PDC_can_change_color(void) { return can_change; } int PDC_color_content(short color, short *red, short *green, short *blue) { #ifdef PDCTHUNK THUNKEDVIO vcr; USHORT palbuf[4]; unsigned char pal[3]; int rc; /* Read single DAC register */ palbuf[0] = 8; palbuf[1] = 0; palbuf[2] = curstoreal[color]; rc = VioGetState(&palbuf, 0); if (rc) return ERR; vcr.cb = sizeof(vcr); vcr.type = 3; vcr.firstcolorreg = palbuf[3]; vcr.numcolorregs = 1; vcr.colorregaddr = PDCTHUNK(pal); rc = VioGetState(&vcr, 0); if (rc) return ERR; /* Scale and store */ *red = DIVROUND((unsigned)(pal[0]) * 1000, 63); *green = DIVROUND((unsigned)(pal[1]) * 1000, 63); *blue = DIVROUND((unsigned)(pal[2]) * 1000, 63); return OK; #else return ERR; #endif } int PDC_init_color(short color, short red, short green, short blue) { #ifdef PDCTHUNK THUNKEDVIO vcr; USHORT palbuf[4]; unsigned char pal[3]; int rc; /* Scale */ pal[0] = DIVROUND((unsigned)red * 63, 1000); pal[1] = DIVROUND((unsigned)green * 63, 1000); pal[2] = DIVROUND((unsigned)blue * 63, 1000); /* Set single DAC register */ palbuf[0] = 8; palbuf[1] = 0; palbuf[2] = curstoreal[color]; rc = VioGetState(&palbuf, 0); if (rc) return ERR; vcr.cb = sizeof(vcr); vcr.type = 3; vcr.firstcolorreg = palbuf[3]; vcr.numcolorregs = 1; vcr.colorregaddr = PDCTHUNK(pal); rc = VioSetState(&vcr, 0); return rc ? ERR : OK; #else return ERR; #endif } /* Does nothing in the DOS (or OS/2 or Win32 console) flavors of PDCurses, which lack user resizing. See X11 or Win32a versions of this function for details of what it does on platforms that do support user resizing. */ void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines, const int new_min_cols, const int new_max_cols) { } /* PDC_set_function_key() does nothing on this platform */ int PDC_set_function_key( const unsigned function, const int new_key) { int old_key = -1; if( function < PDC_MAX_FUNCTION_KEYS) { old_key = PDC_shutdown_key[function]; PDC_shutdown_key[function] = new_key; } return( old_key); } curses-1.4.4/vendor/PDCurses/vt/0000755000004100000410000000000014201713275016474 5ustar www-datawww-datacurses-1.4.4/vendor/PDCurses/vt/Makefile0000644000004100000410000000505114201713275020135 0ustar www-datawww-data# Makefile for PDCurses library for VT # # Usage: [g]make [DEBUG=Y] [WIDE=Y] [UTF8=Y] [target] # # where target can be any of: # [all|demos|libpdcurses.a|testcurs]... O = o ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. endif include $(PDCURSES_SRCDIR)/libobjs.mif osdir = $(PDCURSES_SRCDIR)/vt # If your system doesn't have these, remove the defines here SFLAGS = -DHAVE_VSNPRINTF -DHAVE_VSSCANF ifeq ($(DEBUG),Y) CFLAGS = -g -Wall -DPDCDEBUG else CFLAGS = -O2 -Wall endif ifeq ($(DOS),Y) CFLAGS += -DDOS EXE = .exe else CFLAGS += -fPIC endif ifeq ($(WIDE),Y) CFLAGS += -DPDC_WIDE endif ifeq ($(UTF8),Y) CFLAGS += -DPDC_FORCE_UTF8 endif ifdef CHTYPE_32 CFLAGS += -DCHTYPE_32 endif ifdef CHTYPE_16 CFLAGS += -DCHTYPE_16 endif ifdef _w64 PREFIX = x86_64-w64-mingw32- EXE = .exe endif ifdef _w32 PREFIX = i686-w64-mingw32- EXE = .exe endif CC = $(PREFIX)gcc AR = $(PREFIX)ar STRIP = $(PREFIX)strip BUILD = $(CC) $(CFLAGS) -I$(PDCURSES_SRCDIR) LINK = $(CC) LDFLAGS = $(LIBCURSES) RANLIB = ranlib LIBCURSES = libpdcurses.a DEMOS = firework$(EXE) ozdemo$(EXE) newtest$(EXE) ptest$(EXE) rain$(EXE) \ testcurs$(EXE) tuidemo$(EXE) worm$(EXE) xmas$(EXE) .PHONY: all libs clean demos all: libs demos libs: $(LIBCURSES) clean: -rm -rf *.o trace $(LIBCURSES) $(DEMOS) demos: $(DEMOS) ifneq ($(DEBUG),Y) strip $(DEMOS) endif $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) ar rv $@ $? -$(RANLIB) $@ $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) tui.o tuidemo.o : $(PDCURSES_CURSES_H) terminfo.o: $(TERM_HEADER) panel.o ptest: $(PANEL_HEADER) $(LIBOBJS) : %.o: $(srcdir)/%.c $(BUILD) $(SFLAGS) -c $< $(PDCOBJS) : %.o: $(osdir)/%.c $(BUILD) $(SFLAGS) -c $< firework$(EXE) : $(demodir)/firework.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) ozdemo$(EXE) : $(demodir)/ozdemo.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) newtest$(EXE) : $(demodir)/newtest.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) ptest$(EXE) : $(demodir)/ptest.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) rain$(EXE) : $(demodir)/rain.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) testcurs$(EXE) : $(demodir)/testcurs.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) tuidemo$(EXE) : tuidemo.o tui.o $(LINK) tui.o tuidemo.o -o $@ $(LDFLAGS) worm$(EXE) : $(demodir)/worm.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) xmas$(EXE) : $(demodir)/xmas.c $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) tui.o: $(demodir)/tui.c $(demodir)/tui.h $(BUILD) -c $(DEMOFLAGS) $(demodir)/tui.c tuidemo.o: $(demodir)/tuidemo.c $(BUILD) -c $(DEMOFLAGS) $(demodir)/tuidemo.c curses-1.4.4/vendor/PDCurses/vt/Makefile.wcc0000644000004100000410000000471114201713275020712 0ustar www-datawww-data# Watcom WMAKE Makefile for PDCurses library - DOS (16 bit) or DOS/4GW Watcom C/C++ 10.6+ # # Usage: wmake -f [path/]Makefile.wcc [DEBUG=Y] [MODEL=c|h|l|m|s|f] # [CROSS=Y|N] [CHTYPE=[-DCHTYPE_16|-DCHTYPE_32]] [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] # # and MODEL specifies the memory model (16-bit compact/huge/large/medium/ # small, or 32-bit flat) # # and CROSS=Y (CROSS=N) means to assume we are (are not) cross-compiling # (default is to auto-detect) # # and CHTYPE is an optional compiler flag to set the size of chtype (default # is 64 bits) # Change the memory MODEL here, if desired !ifndef MODEL MODEL = l !endif !ifdef %PDCURSES_SRCDIR PDCURSES_SRCDIR = $(%PDCURSES_SRCDIR) !else PDCURSES_SRCDIR = .. !endif !include $(PDCURSES_SRCDIR)/version.mif !ifndef CROSS !ifeq %SHELL /bin/bash # assume we are cross-compiling CROSS = Y !endif !ifeq %SHELL /bin/sh CROSS = Y !endif !ifeq %SHELL /bin/csh CROSS = Y !endif !ifeq %SHELL /bin/dash CROSS = Y !endif !endif osdir = $(PDCURSES_SRCDIR)/vt # Open Watcom README strongly recommends setting WATCOM environment variable... !ifeq CROSS Y !ifdef %WATCOM watcomdir = $(%WATCOM) !else watcomdir = "`which wcc | xargs realpath | xargs dirname`"/.. !endif !endif !ifneq MODEL f CC = wcc TARGET = dos !else CC = wcc386 TARGET = dos4g !endif CFLAGS = -bt=$(TARGET) -zq -wx -m$(MODEL) -i=$(PDCURSES_SRCDIR) CFLAGS += $(CHTYPE) -DDOS # the README also recommends setting INCLUDE; if absent, we need an extra -i= !ifndef %INCLUDE CFLAGS += -i=$(watcomdir)/h !endif !ifeq DEBUG Y CFLAGS += -d2 -DPDCDEBUG LDFLAGS = D W A op q sys $(TARGET) !else CFLAGS += -oneatx LDFLAGS = op q sys $(TARGET) !ifeq CROSS Y !ifneq MODEL f LDFLAGS += libp $(watcomdir)/lib286/dos\;$(watcomdir)/lib286 !else LDFLAGS += libp $(watcomdir)/lib386/dos\;$(watcomdir)/lib386 !endif !endif !endif LIBEXE = wlib -q -n -t !include $(PDCURSES_SRCDIR)/watcom.mif $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) %write wccvt.lrf $(LIBOBJS) $(PDCOBJS) $(LIBEXE) $@ @wccvt.lrf -$(DEL) wccvt.lrf -$(COPY) $(LIBCURSES) panel.lib !ifneq MODEL f PLATFORM1 = Watcom C++ 16-bit DOS/VT PLATFORM2 = Open Watcom 1.6 for 16-bit DOS/VT ARCNAME = pdc$(VER)16w !else PLATFORM1 = Watcom C++ 32-bit DOS/VT PLATFORM2 = Open Watcom 1.6 for 32-bit DOS/VT ARCNAME = pdc$(VER)32w !endif !include $(PDCURSES_SRCDIR)/makedist.mif curses-1.4.4/vendor/PDCurses/vt/README.md0000644000004100000410000000417014201713275017755 0ustar www-datawww-dataPDCurses for VT ================ This directory contains source code to support PDCurses using a mix of VT-100, VT-200, and ANSI escape sequences to set colors, position the cursor, etc. Note that the name is misleading; it uses an olio of control sequences from https://www.gnu.org/software/screen/manual/html_node/Control-Sequences.html which may, or may not, work on your terminal (I've tested urxvt, xterm, and QTerminal). It assumes that 256 colors are available, but it can use full RGB on terminals that support it. This is a first pass; it mostly works, but some work remains to be done (see 'Caveats' below). Building -------- In Linux, run `make` or `make WIDE=Y`. In *BSD, use `gmake` or `gmake WIDE=Y`. In theory, this could be tweaked to work in Windows 10, which now has some VT emulation. I do Windows as little as possible, so don't rely on me for that part. Caveats ------- As currently set up, this is a bare-bones implementation. It relies on a terminal that supports at least 256 colors. RGB colors get remapped to the 6x6x6 color cube. If your terminal supports full RGB coloring (QTerminal and modern xterm, for example), you can set `PDC_VT=RGB` `export PDC_VT` This will eventually be expanded so one can explain to PDCurses the capabilities of the terminal, e.g., `PDC_VT=RGB BOLD ITALIC BLINK` to say that the underlying terminal supports built-in bold, italic, and blinking text. (And/or the code may dig around in the terminfo database, as ncurses does. That would be the Right Way of doing it. Or at the very least, look at the TERM and COLORTERM environment variables.) Arrow keys and some function keys are recognized (see the `tbl` array in `pdckey.c`). Some mouse input is recognized. Shift, Ctrl, and Alt function keys and arrows are (mostly) not correctly identified; I've not figured out how those keys are supposed to be detected yet. Or if they can be. Test routines have been run on rxvt, xterm, and QTerminal only, on one Xubuntu box, plus some testing on TrueOS. Distribution Status ------------------- The files in this directory are released to the Public Domain. curses-1.4.4/vendor/PDCurses/vt/pdckbd.c0000644000004100000410000002722214201713275020074 0ustar www-datawww-data#include #include #include #if defined( _WIN32) || defined( DOS) #include #define USE_CONIO #else #include #include #endif #include "curspriv.h" #if defined( __BORLANDC__) || defined( DOS) #define WINDOWS_VERSION_OF_KBHIT kbhit #else #define WINDOWS_VERSION_OF_KBHIT _kbhit #endif /* Modified from the accepted answer at https://stackoverflow.com/questions/33025599/move-the-cursor-in-a-c-program _kbhit( ) returns -1 if no key has been hit, and the keycode if one has been hit. You can just loop on it until the return value is >= 0. Hitting a function or arrow or similar key will cause 27 (escape) to be returned, followed by cryptic codes that depend on what terminal emulation is in place. Further info on VT100/ANSI control sequences is at https://www.gnu.org/software/screen/manual/html_node/Control-Sequences.html */ extern bool PDC_resize_occurred; static bool check_key( int *c) { bool rval; #ifndef USE_CONIO const int STDIN = 0; struct timeval timeout; fd_set rdset; if( PDC_resize_occurred) return( TRUE); FD_ZERO( &rdset); FD_SET( STDIN, &rdset); timeout.tv_sec = 0; timeout.tv_usec = 0; if( select( STDIN + 1, &rdset, NULL, NULL, &timeout) > 0) { rval = TRUE; if( c) *c = getchar( ); } else rval = FALSE; #else if( WINDOWS_VERSION_OF_KBHIT( )) { rval = TRUE; if( c) *c = _getch( ); } else rval = FALSE; #endif return( rval); } bool PDC_check_key( void) { return( check_key( NULL)); } void PDC_flushinp( void) { int thrown_away_char; while( check_key( &thrown_away_char)) ; } #ifdef USE_CONIO static int xlate_vt_codes_for_dos( const int key1, const int key2) { static const int tbl[] = { KEY_UP, 72, KEY_DOWN, 80, KEY_LEFT, 75, KEY_RIGHT, 77, KEY_F(11), 133, KEY_F(12), 134, KEY_IC, 82, KEY_DC, 83, KEY_PPAGE, 73, KEY_NPAGE, 81, KEY_HOME, 2, '[', 'H', KEY_END, 2, 'O', 'F', KEY_F(1), 59, KEY_F(2), 60, KEY_F(3), 61, KEY_F(4), 62, KEY_F(5), 63, KEY_F(6), 64, KEY_F(7), 65, KEY_F(8), 66, KEY_F(9), 67, KEY_F(10), 68, 0, 0 }; int i, rval = 0; for( i = 0; tbl[i] && !rval; i += 2) if( key2 == tbl[i + 1]) rval = tbl[i]; return( rval); } #endif /* Mouse events include six bytes. First three are ESC [ M Next byte is 96 for mouse wheel up, 97 for down, or (for more "traditional" mouse events) 32 plus : 0 for button 1 1 for button 2 2 for button 3 3 for release 4 if Shift is pressed 8 if Alt (Meta) is pressed 16 if Ctrl is pressed Note that 'release' doesn't tell you _which_ is released. If only one has been pressed (the usual case), it's presumably the one you released. If two or more buttons are pressed simultaneously, the "releases" are reported in the numerical order of the buttons, not the order in which they're actually released (which we don't know). My tilt mouse reports 'tilt left' as a left button (1) and 'tilt right' as a middle button press. Wheel events get shift, alt, ctrl added in (but that doesn't seem to be getting through in PDCurses... to be fixed). Button events only get Ctrl (though I think you might get the other events on some terminals). "Correct" mouse handling will require that we detect a button-down, then hold off for SP->mouse_wait to see if we get a release event. */ static int xlate_vt_codes( const int *c, const int count) { static const int tbl[] = { KEY_UP, 2, '[', 'A', KEY_DOWN, 2, '[', 'B', KEY_LEFT, 2, '[', 'D', KEY_RIGHT,2, '[', 'C', KEY_HOME, 2, 'O', 'H', KEY_HOME, 2, '[', 'H', KEY_END, 2, 'O', 'F', KEY_END, 2, '[', 'F', KEY_B2, 2, '[', 'E', KEY_IC, 3, '[', '2', '~', KEY_DC, 3, '[', '3', '~', KEY_PPAGE, 3, '[', '5', '~', KEY_NPAGE, 3, '[', '6', '~', CTL_LEFT, 5, '[', '1', ';', '5', 'D', CTL_RIGHT, 5, '[', '1', ';', '5', 'C', CTL_UP, 5, '[', '1', ';', '5', 'A', CTL_DOWN, 5, '[', '1', ';', '5', 'B', ALT_PGUP, 5, '[', '5', ';', '3', '~', ALT_PGDN, 5, '[', '6', ';', '3', '~', KEY_F(1), 3, '[', '[', 'A', /* Linux console */ KEY_F(2), 3, '[', '[', 'B', KEY_F(3), 3, '[', '[', 'C', KEY_F(4), 3, '[', '[', 'D', KEY_F(5), 3, '[', '[', 'E', KEY_END, 3, '[', '4', '~', KEY_HOME, 3, '[', '1', '~', KEY_F(1), 2, 'O', 'P', KEY_F(1), 4, '[', '1', '1', '~', KEY_F(2), 2, 'O', 'Q', KEY_F(2), 4, '[', '1', '2', '~', KEY_F(3), 2, 'O', 'R', KEY_F(3), 4, '[', '1', '3', '~', KEY_F(4), 2, 'O', 'S', KEY_F(4), 4, '[', '1', '4', '~', KEY_F(5), 4, '[', '1', '5', '~', KEY_F(6), 4, '[', '1', '7', '~', KEY_F(7), 4, '[', '1', '8', '~', KEY_F(8), 4, '[', '1', '9', '~', KEY_F(9), 4, '[', '2', '0', '~', KEY_F(10), 4, '[', '2', '1', '~', KEY_F(11), 4, '[', '2', '3', '~', KEY_F(12), 4, '[', '2', '4', '~', KEY_F(13), 5, '[', '1', ';', '2', 'P', /* shift-f1 */ KEY_F(14), 5, '[', '1', ';', '2', 'Q', KEY_F(15), 5, '[', '1', ';', '2', 'R', KEY_F(16), 5, '[', '1', ';', '2', 'S', KEY_F(17), 6, '[', '1', '5', ';', '2', '~', /* shift-f5 */ KEY_F(18), 6, '[', '1', '7', ';', '2', '~', KEY_F(19), 6, '[', '1', '8', ';', '2', '~', KEY_F(20), 6, '[', '1', '9', ';', '2', '~', KEY_F(21), 6, '[', '2', '0', ';', '2', '~', KEY_F(22), 6, '[', '2', '1', ';', '2', '~', KEY_F(23), 6, '[', '2', '3', ';', '2', '~', /* shift-f11 */ KEY_F(24), 6, '[', '2', '4', ';', '2', '~', 27, 0, 0 }; int i, rval = -1; const int *tptr; if( count == 1) { if( c[0] >= 'a' && c[0] <= 'z') rval = ALT_A + c[0] - 'a'; if( c[0] >= '0' && c[0] <= '9') rval = ALT_0 + c[0] - '0'; } else if( count == 5 && c[0] == '[' && c[1] == 'M') rval = KEY_MOUSE; for( tptr = tbl; rval == -1 && *tptr; tptr += 2 + tptr[1]) if( count == tptr[1]) { i = 0; while( tptr[i + 2] == c[i] && i < count) i++; if( i == count) rval = tptr[0]; } return( rval); } int PDC_get_key( void) { int rval = -1; if( PDC_resize_occurred) { PDC_resize_occurred = FALSE; return( KEY_RESIZE); } if( check_key( &rval)) { int c[13]; #ifdef USE_CONIO SP->key_code = (rval == 0 || rval == 224); if( SP->key_code) { int key2; while( !check_key( &key2)) ; rval = xlate_vt_codes_for_dos( rval, key2); return( rval); } #endif SP->key_code = (rval == 27); if( rval == 27) { int count = 0; while( count < 6 && check_key( &c[count]) && (rval = xlate_vt_codes( c, count + 1)) == -1) count++; if( rval == KEY_MOUSE) { int idx = (c[2] & 3), flags = 0, i; const bool release = (idx == 3); static int held = 0; if( c[2] & 4) flags |= PDC_BUTTON_SHIFT; if( c[2] & 8) flags |= PDC_BUTTON_ALT; if( c[2] & 16) flags |= PDC_BUTTON_CONTROL; if( (c[2] & 0x60) == 0x40) /* mouse move */ { int report_event = 0; if( idx == 0 && (SP->_trap_mbe & BUTTON1_MOVED)) report_event |= 1; if( idx == 1 && (SP->_trap_mbe & BUTTON2_MOVED)) report_event |= 2; if( idx == 2 && (SP->_trap_mbe & BUTTON3_MOVED)) report_event |= 4; if( report_event) report_event |= PDC_MOUSE_MOVED; else if( SP->_trap_mbe & REPORT_MOUSE_POSITION) report_event = PDC_MOUSE_POSITION; pdc_mouse_status.changes = report_event; for( i = 0; i < 3; i++) pdc_mouse_status.button[i] = (i == idx ? BUTTON_MOVED : 0); idx = 3; } else if( idx == 3) /* it's a release */ { idx = 0; while( idx < 3 && !((held >> idx) & 1)) idx++; held ^= (1 << idx); } if( idx < 3) { memset(&pdc_mouse_status, 0, sizeof(MOUSE_STATUS)); pdc_mouse_status.button[idx] = (release ? BUTTON_RELEASED : BUTTON_PRESSED); if( (c[2] & 0x60) == 0x60) /* actually mouse wheel event */ pdc_mouse_status.changes = (idx ? PDC_MOUSE_WHEEL_DOWN : PDC_MOUSE_WHEEL_UP); else /* "normal" mouse button */ pdc_mouse_status.changes = (1 << idx); if( !release && !(c[2] & 64)) /* wait for a possible release */ { int n_events = 0; while( n_events < 5) { PDC_napms( SP->mouse_wait); if( check_key( c)) { count = 0; while( count < 5 && check_key( &c[count])) count++; n_events++; } else break; } if( !n_events) /* just a click, no release(s) */ held ^= (1 << idx); else if( n_events == 1) pdc_mouse_status.button[idx] = BUTTON_CLICKED; else if( n_events <= 3) pdc_mouse_status.button[idx] = BUTTON_DOUBLE_CLICKED; else if( n_events <= 5) pdc_mouse_status.button[idx] = BUTTON_TRIPLE_CLICKED; } } for( i = 0; i < 3; i++) pdc_mouse_status.button[i] |= flags; pdc_mouse_status.x = (unsigned char)( c[3] - ' ' - 1); pdc_mouse_status.y = (unsigned char)( c[4] - ' ' - 1); } } else if( (rval & 0xc0) == 0xc0) /* start of UTF-8 */ { check_key( &c[0]); assert( (c[0] & 0xc0) == 0x80); c[0] &= 0x3f; if( !(rval & 0x20)) /* two-byte : U+0080 to U+07ff */ rval = c[0] | ((rval & 0x1f) << 6); else if( !(rval & 0x10)) /* three-byte : U+0800 - U+ffff */ { check_key( &c[1]); assert( (c[1] & 0xc0) == 0x80); c[1] &= 0x3f; rval = (c[1] | (c[0] << 6) | ((rval & 0xf) << 12)); } /* Else... four-byte SMP char */ } else if( rval == 127) rval = 8; } return( rval); } int PDC_modifiers_set( void) { return( OK); } int PDC_mouse_set( void) { return( OK); } void PDC_set_keyboard_binary( bool on) { return; } unsigned long PDC_get_input_fd( void) { return( 0); } curses-1.4.4/vendor/PDCurses/vt/pdcsetsc.c0000644000004100000410000000154414201713275020454 0ustar www-datawww-data#include #include #include "pdcvt.h" #define CURSOR_ON "\033[?25h" #define CURSOR_OFF "\033[?25l" int PDC_curs_set( int visibility) { int ret_vis; PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); ret_vis = SP->visibility; SP->visibility = visibility; printf( visibility ? CURSOR_ON : CURSOR_OFF); return ret_vis; } int PDC_really_blinking = FALSE; void PDC_show_changes( const short pair, const short idx, const chtype attr); int PDC_set_blink(bool blinkon) { if( PDC_really_blinking != blinkon) { PDC_really_blinking = blinkon; PDC_show_changes( -1, -1, A_BLINK); } return OK; } void PDC_set_title( const char *title) { PDC_LOG(("PDC_set_title() - called:<%s>\n", title)); #ifndef DOS if( !PDC_is_ansi) printf( "\033]2;%s\a", title); #endif } curses-1.4.4/vendor/PDCurses/vt/Makefile.vc0000644000004100000410000000615014201713275020545 0ustar www-datawww-data# Visual C++ & Intel(R) NMakefile for PDCurses library - Windows VT-like VC++ 2.0+ # # Usage: nmake -f [path\]Makefile.vc [DEBUG=] [DLL=] [WIDE=] [UTF8=] # [ICC=] [CHTYPE_32=] [IX86=] [CHTYPE_16=] [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] # CHTYPE_## is used to override the default 64-bit chtypes in favor # of "traditional" 32- or 16-bit chtypes. (Untested for VT) # IX86 is used to build 32-bit code instead of 64-bit # ICC is used to invoke Intel (R) tools icl.exe and xilink.exe, instead of # MS tools cl.exe and link.exe O = obj !ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. !endif !ifdef IX86 PLATFORM=IX86 !else PLATFORM=X64 !endif !include $(PDCURSES_SRCDIR)\version.mif !include $(PDCURSES_SRCDIR)\libobjs.mif osdir = $(PDCURSES_SRCDIR)\vt PDCURSES_WIN_H = $(osdir)\pdcvt.h !ifdef ICC CC = icl.exe -nologo LINK = xilink.exe -nologo !else CC = cl.exe -nologo LINK = link.exe -nologo !endif !ifdef DEBUG CFLAGS = -Z7 -DPDCDEBUG LDFLAGS = -debug -pdb:none !else CFLAGS = -O1 LDFLAGS = !endif !ifdef WIDE WIDEOPT = -DPDC_WIDE !endif !ifdef UTF8 UTF8OPT = -DPDC_FORCE_UTF8 !endif !ifdef CHTYPE_32 CHTYPE_FLAGS= -DCHTYPE_32 !endif !ifdef CHTYPE_16 CHTYPE_FLAGS= -DCHTYPE_16 !endif SHL_LD = link $(LDFLAGS) /NOLOGO /DLL /MACHINE:$(PLATFORM) /OUT:pdcurses.dll CCLIBS = user32.lib advapi32.lib # may need to add msvcrt.lib for VC 2.x, VC 5.0 doesn't want it #CCLIBS = msvcrt.lib user32.lib advapi32.lib LIBEXE = lib -nologo LIBCURSES = pdcurses.lib CURSESDLL = pdcurses.dll !ifdef DLL DLLOPT = -DPDC_DLL_BUILD PDCLIBS = $(CURSESDLL) !else PDCLIBS = $(LIBCURSES) !endif BUILD = $(CC) -I$(PDCURSES_SRCDIR) -c $(CFLAGS) $(CHTYPE_FLAGS) $(DLLOPT) \ $(WIDEOPT) $(UTF8OPT) all: $(PDCLIBS) clean: -del *.obj -del *.lib -del *.exe -del *.dll -del *.exp -del *.res demos: $(DEMOS) DEMOOBJS = $(DEMOS:.exe=.obj) tui.obj $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_WIN_H) $(DEMOOBJS) : $(PDCURSES_CURSES_H) $(DEMOS) : $(LIBCURSES) panel.obj : $(PANEL_HEADER) terminfo.obj: $(TERM_HEADER) !ifndef DLL $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) -out:$@ $(LIBOBJS) $(PDCOBJS) !endif $(CURSESDLL) : $(LIBOBJS) $(PDCOBJS) pdcurses.obj $(SHL_LD) $(LIBOBJS) $(PDCOBJS) pdcurses.obj $(CCLIBS) pdcurses.res pdcurses.obj: $(osdir)\pdcurses.rc $(osdir)\pdcurses.ico rc /r /fopdcurses.res $(osdir)\pdcurses.rc cvtres /MACHINE:$(PLATFORM) /NOLOGO /OUT:pdcurses.obj pdcurses.res {$(srcdir)\}.c{}.obj:: $(BUILD) $< {$(osdir)\}.c{}.obj:: $(BUILD) $< {$(demodir)\}.c{}.obj:: $(BUILD) $< .obj.exe: $(LINK) $(LDFLAGS) $< $(LIBCURSES) $(CCLIBS) tuidemo.exe: tuidemo.obj tui.obj $(LINK) $(LDFLAGS) $*.obj tui.obj $(LIBCURSES) $(CCLIBS) tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(BUILD) -I$(demodir) $(demodir)\tui.c tuidemo.obj: $(demodir)\tuidemo.c $(BUILD) -I$(demodir) $(demodir)\tuidemo.c PLATFORM1 = Visual C++ PLATFORM2 = Microsoft Visual C/C++ for Windows VT ARCNAME = pdc$(VER)_vc_vt !include $(PDCURSES_SRCDIR)\makedist.mif curses-1.4.4/vendor/PDCurses/vt/pdcgetsc.c0000644000004100000410000000063514201713275020440 0ustar www-datawww-data/* Public Domain Curses */ #include int PDC_get_cursor_mode(void) { PDC_LOG(("PDC_get_cursor_mode() - called\n")); return SP->visibility; } int PDC_get_columns(void) { extern int PDC_cols; PDC_LOG(("PDC_get_columns() - called\n")); return( PDC_cols); } int PDC_get_rows(void) { extern int PDC_rows; PDC_LOG(("PDC_get_rows() - called\n")); return( PDC_rows); } curses-1.4.4/vendor/PDCurses/vt/pdcdisp.c0000644000004100000410000002116614201713275020274 0ustar www-datawww-data#define USE_UNICODE_ACS_CHARS 1 #include #include #define USE_UNICODE_ACS_CHARS 1 #include "curses.h" #include "pdcvt.h" #include "acs_defs.h" void PDC_gotoyx(int y, int x) { printf( "\033[%d;%dH", y + 1, x + 1); } #define STANDOUT_ON "\033[3m" #define STANDOUT_OFF "\033[23m" #define UNDERLINE_ON "\033[4m" #define UNDERLINE_OFF "\033[24m" #define BLINK_ON "\033[5m" #define BLINK_OFF "\033[25m" #define BOLD_ON "\033[1m" #define BOLD_OFF "\033[22m" #define DIM_ON "\033[2m" #define DIM_OFF "\033[22m" #define STDOUT 0 const chtype MAX_UNICODE = 0x110000; /* see 'addch.c' for an explanation of how combining chars are handled. */ #if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2 && defined( PDC_WIDE) #define USING_COMBINING_CHARACTER_SCHEME int PDC_expand_combined_characters( const cchar_t c, cchar_t *added); /* addch.c */ #endif extern int PDC_really_blinking; extern chtype PDC_capabilities; /* This function 'intensifies' a color by shifting it toward white. */ /* It used to average the input color with white. Then it did a */ /* weighted average: 2/3 of the input color, 1/3 white, for a */ /* lower "intensification" level. */ /* Then Mark Hessling suggested that the output level should */ /* remap zero to 85 (= 255 / 3, so one-third intensity), and input */ /* of 192 or greater should be remapped to 255 (full intensity). */ /* Assuming we want a linear response between zero and 192, that */ /* leads to output = 85 + input * (255-85)/192. */ /* This should lead to proper handling of bold text in legacy */ /* apps, where "bold" means "high intensity". */ static PACKED_RGB intensified_color( PACKED_RGB ival) { int rgb, i; PACKED_RGB oval = 0; for( i = 0; i < 3; i++, ival >>= 8) { rgb = (int)( ival & 0xff); if( rgb >= 192) rgb = 255; else rgb = 85 + rgb * (255 - 85) / 192; oval |= ((PACKED_RGB)rgb << (i * 8)); } return( oval); } /* For use in adjusting colors for A_DIMmed characters. Just */ /* knocks down the intensity of R, G, and B by 1/3. */ static PACKED_RGB dimmed_color( PACKED_RGB ival) { unsigned i; PACKED_RGB oval = 0; for( i = 0; i < 3; i++, ival >>= 8) { unsigned rgb = (unsigned)( ival & 0xff); rgb -= (rgb / 3); oval |= ((PACKED_RGB)rgb << (i * 8)); } return( oval); } /* PDC_get_rgb_values(), extract_packed_rgb(), intensified_component(), */ /* intensified_color(), and dimmed_color() each exist in x11/x11.c, */ /* win32a/pdcdisp.c, and sdl2/pdcdisp.c in forms slightly modified for */ /* each platform. But they all look pretty much alike. */ /* PDCurses stores RGBs in fifteen bits, five bits each */ /* for red, green, blue. A PACKED_RGB uses eight bits per */ /* channel. Hence the following. */ #if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2 static PACKED_RGB extract_packed_rgb( const chtype color) { const int red = (int)( (color << 3) & 0xf8); const int green = (int)( (color >> 2) & 0xf8); const int blue = (int)( (color >> 7) & 0xf8); return( PACK_RGB( red, green, blue)); } #endif void PDC_get_rgb_values( const chtype srcp, PACKED_RGB *foreground_rgb, PACKED_RGB *background_rgb) { const int color = (int)(( srcp & A_COLOR) >> PDC_COLOR_SHIFT); bool reverse_colors = ((srcp & A_REVERSE) ? TRUE : FALSE); bool intensify_backgnd = FALSE; #if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2 if( srcp & A_RGB_COLOR) { /* Extract RGB from 30 bits of the color field */ *background_rgb = extract_packed_rgb( srcp >> PDC_COLOR_SHIFT); *foreground_rgb = extract_packed_rgb( srcp >> (PDC_COLOR_SHIFT + 15)); } else #endif { extern PACKED_RGB *pdc_rgbs; short foreground_index, background_index; PDC_pair_content( (short)color, &foreground_index, &background_index); *foreground_rgb = pdc_rgbs[foreground_index]; *background_rgb = pdc_rgbs[background_index]; } if( srcp & A_BLINK) { extern int PDC_really_blinking; /* see 'pdcsetsc.c' */ if( !PDC_really_blinking) /* convert 'blinking' to 'bold' */ intensify_backgnd = TRUE; } if( reverse_colors) { const PACKED_RGB temp = *foreground_rgb; *foreground_rgb = *background_rgb; *background_rgb = temp; } if( srcp & A_BOLD) *foreground_rgb = intensified_color( *foreground_rgb); if( intensify_backgnd) *background_rgb = intensified_color( *background_rgb); if( srcp & A_DIM) *foreground_rgb = dimmed_color( *foreground_rgb); if( srcp & A_DIM) *background_rgb = dimmed_color( *background_rgb); } static char *color_string( char *otext, const PACKED_RGB rgb) { if( PDC_capabilities & A_RGB_COLOR) sprintf( otext, "2;%d;%d;%dm", Get_RValue( rgb), Get_GValue( rgb), Get_BValue( rgb)); else { const int red = Get_RValue( rgb); const int green = Get_GValue( rgb); const int blue = Get_BValue( rgb); int idx; if( red == green && red == blue) /* gray scale: indices from */ { if( red < 27) /* this would underflow; remap to black */ idx = COLOR_BLACK; else if( red >= 243) /* this would overflow */ idx = COLOR_WHITE; else idx = (red - 3) / 10 + 232; /* 232 to 255 */ } else idx = ((blue - 35) / 40) + ((green - 35) / 40) * 6 + ((red - 35) / 40) * 36 + 16; sprintf( otext, "5;%dm", idx); } return( otext); } static int get_sixteen_color_idx( const PACKED_RGB rgb) { int rval = 0; if( rgb & 0x800000) /* red value >= 128 */ rval = 1; if( rgb & 0x8000) /* green value >= 128 */ rval |= 2; if( rgb & 0x80) /* blue value >= 128 */ rval |= 4; return( rval); } static void reset_color( const chtype ch) { static PACKED_RGB prev_bg = (PACKED_RGB)-1; static PACKED_RGB prev_fg = (PACKED_RGB)-1; PACKED_RGB bg, fg; char txt[20]; PDC_get_rgb_values( ch, &fg, &bg); if( bg != prev_bg) { if( COLORS == 16) printf( "\033[4%dm", get_sixteen_color_idx( bg)); else printf( "\033[48;%s", color_string( txt, bg)); prev_bg = bg; } if( fg != prev_fg) { if( COLORS == 16) printf( "\033[3%dm", get_sixteen_color_idx( fg)); else printf( "\033[38;%s", color_string( txt, fg)); prev_fg = fg; } } void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) { static chtype prev_ch = 0; assert( x >= 0); assert( len <= SP->cols - x); assert( lineno >= 0); assert( lineno < SP->lines); assert( len > 0); PDC_gotoyx( lineno, x); while( len--) { int ch = (int)( *srcp & A_CHARTEXT); chtype changes = *srcp ^ prev_ch; if( (*srcp & A_ALTCHARSET) && ch < 0x80) ch = acs_map[ch & 0x7f]; if( ch < (int)' ' || (ch >= 0x80 && ch <= 0x9f)) ch = ' '; if( changes & A_BOLD) printf( (*srcp & A_BOLD) ? BOLD_ON : BOLD_OFF); if( changes & A_UNDERLINE) printf( (*srcp & A_UNDERLINE) ? UNDERLINE_ON : UNDERLINE_OFF); if( changes & A_STANDOUT) printf( (*srcp & A_STANDOUT) ? STANDOUT_ON : STANDOUT_OFF); if( PDC_really_blinking && ( changes & A_BLINK)) printf( (*srcp & A_BLINK) ? BLINK_ON : BLINK_OFF); if( changes & (A_COLOR | A_STANDOUT | A_BLINK)) reset_color( *srcp); #ifdef PDC_WIDE if( ch < 128) printf( "%c", (char)ch); else if( ch < (int)MAX_UNICODE) printf( "%lc", (wchar_t)ch); #else printf( "%c", (char)ch); #endif #ifdef USING_COMBINING_CHARACTER_SCHEME else if( ch > (int)MAX_UNICODE) /* chars & fullwidth supported */ { cchar_t root, newchar; root = ch; while( (root = PDC_expand_combined_characters( root, &newchar)) > MAX_UNICODE) ; printf( "%lc", (wchar_t)root); root = ch; while( (root = PDC_expand_combined_characters( root, &newchar)) > MAX_UNICODE) printf( "%lc", (wchar_t)newchar); printf( "%lc", (wchar_t)newchar); } #endif prev_ch = *srcp++; } } curses-1.4.4/vendor/PDCurses/vt/pdcvt.h0000644000004100000410000000107614201713275017771 0ustar www-datawww-data#define PACKED_RGB uint32_t #ifndef DIVROUND #define DIVROUND( A, B) ((A + B / 2) / B) #endif #define PACK_RGB( R, G, B) (((uint32_t)(R) << 16) | ((uint32_t)(G) << 8) \ | (uint32_t)(B)) #define Get_RValue( rgb) ((int)( (rgb) >> 16)) #define Get_GValue( rgb) ((int)( (rgb) >> 8) & 0xff) #define Get_BValue( rgb) ((int)((rgb) & 0xff)) int PDC_pair_content( short pair, short *fg, short *bg); /* If the following is TRUE, only a limited subset of control codes will actually work. Happens in older Windows and DOS. */ extern bool PDC_is_ansi; curses-1.4.4/vendor/PDCurses/vt/pdcclip.c0000644000004100000410000000040314201713275020253 0ustar www-datawww-dataint PDC_clearclipboard( void) { return( 0); } int PDC_freeclipboard( char *contents) { return( 0); } int PDC_getclipboard( char **contents, long *length) { return( 0); } int PDC_setclipboard( const char *contents, long length) { return( 0); } curses-1.4.4/vendor/PDCurses/vt/Makefile.dmc0000644000004100000410000001177614201713275020712 0ustar www-datawww-data# Makefile for PDCurses library - DOS Digital Mars # # Usage: make -f Makefile.dmc [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] PDCURSES_SRCDIR = .. PDCURSES_CURSES_H = $(PDCURSES_SRCDIR)\curses.h PDCURSES_CURSPRIV_H = $(PDCURSES_SRCDIR)\curspriv.h PDCURSES_HEADERS = $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H) PANEL_HEADER = $(PDCURSES_SRCDIR)\panel.h TERM_HEADER = $(PDCURSES_SRCDIR)\term.h srcdir = $(PDCURSES_SRCDIR)\pdcurses osdir = $(PDCURSES_SRCDIR)\vt demodir = $(PDCURSES_SRCDIR)\demos PDCURSES_VT_H = $(osdir)\pdcvt.h CC = dmc CHTYPE = -DCHTYPE_32 CFLAGS = -c -o+space -Nc -mx -DDOS # CFLAGS = -c -o+space -Nc -mld -DDOS CPPFLAGS = -I$(PDCURSES_SRCDIR) -msd $(CHTYPE) LINK = dmc LIBEXE = lib LIBCURSES = pdcurses.lib BUILD = $(CC) $(CFLAGS) $(CPPFLAGS) DEMOS = testcurs.exe ozdemo.exe newtest.exe xmas.exe \ tuidemo.exe firework.exe ptest.exe rain.exe worm.exe all: $(LIBCURSES) $(DEMOS) clean: -del *.obj -del *.lib -del *.exe -del *.map -del advapi32.def LIBOBJS = addch.obj addchstr.obj addstr.obj attr.obj beep.obj bkgd.obj \ border.obj clear.obj color.obj delch.obj deleteln.obj deprec.obj getch.obj \ getstr.obj getyx.obj inch.obj inchstr.obj initscr.obj inopts.obj \ insch.obj insstr.obj instr.obj kernel.obj keyname.obj mouse.obj move.obj \ outopts.obj overlay.obj pad.obj panel.obj printw.obj refresh.obj \ scanw.obj scr_dump.obj scroll.obj slk.obj termattr.obj terminfo.obj \ touch.obj util.obj window.obj debug.obj PDCOBJS = pdcclip.obj pdcdisp.obj pdcgetsc.obj pdckbd.obj pdcscrn.obj \ pdcsetsc.obj pdcutil.obj DEMOOBJS = testcurs.obj ozdemo.obj newtest.obj xmas.obj tuidemo.obj \ tui.obj firework.obj ptest.obj rain.obj worm.obj $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_VT_H) panel.obj ptest.obj: $(PANEL_HEADER) terminfo.obj: $(TERM_HEADER) $(DEMOOBJS) : $(PDCURSES_CURSES_H) $(DEMOS) : $(LIBCURSES) $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) -c $@ $(LIBOBJS) $(PDCOBJS) SRCBUILD = $(BUILD) $(srcdir)\$*.c OSBUILD = $(BUILD) $(osdir)\$*.c DEMOBUILD = $(LINK) $(CPPFLAGS) -o+space $@ $** addch.obj: $(srcdir)\addch.c $(SRCBUILD) addchstr.obj: $(srcdir)\addchstr.c $(SRCBUILD) addstr.obj: $(srcdir)\addstr.c $(SRCBUILD) attr.obj: $(srcdir)\attr.c $(SRCBUILD) beep.obj: $(srcdir)\beep.c $(SRCBUILD) bkgd.obj: $(srcdir)\bkgd.c $(SRCBUILD) border.obj: $(srcdir)\border.c $(SRCBUILD) clear.obj: $(srcdir)\clear.c $(SRCBUILD) color.obj: $(srcdir)\color.c $(SRCBUILD) delch.obj: $(srcdir)\delch.c $(SRCBUILD) deleteln.obj: $(srcdir)\deleteln.c $(SRCBUILD) deprec.obj: $(srcdir)\deprec.c $(SRCBUILD) getch.obj: $(srcdir)\getch.c $(SRCBUILD) getstr.obj: $(srcdir)\getstr.c $(SRCBUILD) getyx.obj: $(srcdir)\getyx.c $(SRCBUILD) inch.obj: $(srcdir)\inch.c $(SRCBUILD) inchstr.obj: $(srcdir)\inchstr.c $(SRCBUILD) initscr.obj: $(srcdir)\initscr.c $(SRCBUILD) inopts.obj: $(srcdir)\inopts.c $(SRCBUILD) insch.obj: $(srcdir)\insch.c $(SRCBUILD) insstr.obj: $(srcdir)\insstr.c $(SRCBUILD) instr.obj: $(srcdir)\instr.c $(SRCBUILD) kernel.obj: $(srcdir)\kernel.c $(SRCBUILD) keyname.obj: $(srcdir)\keyname.c $(SRCBUILD) mouse.obj: $(srcdir)\mouse.c $(SRCBUILD) move.obj: $(srcdir)\move.c $(SRCBUILD) outopts.obj: $(srcdir)\outopts.c $(SRCBUILD) overlay.obj: $(srcdir)\overlay.c $(SRCBUILD) pad.obj: $(srcdir)\pad.c $(SRCBUILD) panel.obj: $(srcdir)\panel.c $(SRCBUILD) printw.obj: $(srcdir)\printw.c $(SRCBUILD) refresh.obj: $(srcdir)\refresh.c $(SRCBUILD) scanw.obj: $(srcdir)\scanw.c $(SRCBUILD) scr_dump.obj: $(srcdir)\scr_dump.c $(SRCBUILD) scroll.obj: $(srcdir)\scroll.c $(SRCBUILD) slk.obj: $(srcdir)\slk.c $(SRCBUILD) termattr.obj: $(srcdir)\termattr.c $(SRCBUILD) terminfo.obj: $(srcdir)\terminfo.c $(SRCBUILD) touch.obj: $(srcdir)\touch.c $(SRCBUILD) util.obj: $(srcdir)\util.c $(SRCBUILD) window.obj: $(srcdir)\window.c $(SRCBUILD) debug.obj: $(srcdir)\debug.c $(SRCBUILD) pdcclip.obj: $(osdir)\pdcclip.c $(OSBUILD) pdcdisp.obj: $(osdir)\pdcdisp.c $(OSBUILD) pdcgetsc.obj: $(osdir)\pdcgetsc.c $(OSBUILD) pdckbd.obj: $(osdir)\pdckbd.c $(OSBUILD) pdcscrn.obj: $(osdir)\pdcscrn.c $(OSBUILD) pdcsetsc.obj: $(osdir)\pdcsetsc.c $(OSBUILD) pdcutil.obj: $(osdir)\pdcutil.c $(OSBUILD) firework.exe: $(demodir)\firework.c $(DEMOBUILD) ozdemo.exe: $(demodir)\ozdemo.c $(DEMOBUILD) newtest.exe: $(demodir)\newtest.c $(DEMOBUILD) ptest.exe: $(demodir)\ptest.c $(DEMOBUILD) rain.exe: $(demodir)\rain.c $(DEMOBUILD) testcurs.exe: $(demodir)\testcurs.c $(DEMOBUILD) advapi32.lib tuidemo.exe: tuidemo.obj tui.obj $(DEMOBUILD) worm.exe: $(demodir)\worm.c $(DEMOBUILD) xmas.exe: $(demodir)\xmas.c $(DEMOBUILD) tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(BUILD) -I$(demodir) $(demodir)\$*.c tuidemo.obj: $(demodir)\tuidemo.c $(BUILD) -I$(demodir) $(demodir)\$*.c curses-1.4.4/vendor/PDCurses/vt/Makefile.bcc0000644000004100000410000000361314201713275020665 0ustar www-datawww-data# Borland MAKE Makefile for PDCurses library - Windows console BC++ 7.0+ # # Usage: make -f [path\]Makefile.bcc [DEBUG=] [WIDE=] [UTF8=] # [INFOEX=N] [target] # # where target can be any of: # [all|demos|pdcurses.lib|testcurs.exe...] O = obj E = .exe RM = del !ifndef PDCURSES_SRCDIR PDCURSES_SRCDIR = .. !endif !include $(PDCURSES_SRCDIR)\version.mif !include $(PDCURSES_SRCDIR)\libobjs.mif osdir = $(PDCURSES_SRCDIR)\vt !ifdef OLD_BCC CC = bcc32 -q -DNO_STDINT_H !else CC = bcc32c -q -Xdriver -Wno-deprecated-declarations !endif !ifdef DEBUG CFLAGS = -N -v -y -DPDCDEBUG !else CFLAGS = -O -DCHTYPE_32 !endif !ifdef CHTYPE_32 CFLAGS = $(CFLAGS) -DCHTYPE_32 !endif !ifdef CHTYPE_16 CFLAGS = $(CFLAGS) -DCHTYPE_16 !endif !ifdef WIDE WIDEOPT = -DPDC_WIDE !endif !ifdef UTF8 UTF8OPT = -DPDC_FORCE_UTF8 !endif !ifdef INFOEX INFOPT = -DHAVE_NO_INFOEX !endif !ifdef OLD_BCC BUILD = $(CC) -I$(PDCURSES_SRCDIR) -c -Tpe $(CFLAGS) \ -w32 -w-par \ $(WIDEOPT) $(UTF8OPT) $(INFOPT) !else BUILD = $(CC) -I$(PDCURSES_SRCDIR) -c -Tpe $(CFLAGS) \ $(WIDEOPT) $(UTF8OPT) !endif LIBEXE = tlib /C /E /0 /a LIBCURSES = pdcurses.lib all: $(LIBCURSES) clean: -$(RM) *.obj -$(RM) *.lib -$(RM) *.tds -$(RM) *.exe demos: $(DEMOS) $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) -$(RM) $@ $(LIBEXE) $@ $(LIBOBJS) $(PDCOBJS) .autodepend {$(srcdir)\}.c.obj: $(BUILD) $< {$(osdir)\}.c.obj: $(BUILD) $< {$(demodir)\}.c.obj: $(BUILD) $< .c.obj: $(BUILD) $< .obj.exe: $(CC) -e$@ $** $(LIBCURSES) tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES) $(CC) -e$@ $** tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(PDCURSES_CURSES_H) $(BUILD) -I$(demodir) $(demodir)\tui.c tuidemo.obj: $(demodir)\tuidemo.c $(PDCURSES_CURSES_H) $(BUILD) -I$(demodir) $(demodir)\tuidemo.c PLATFORM1 = Borland C++ Wincon PLATFORM2 = Borland C/C++ 7.2 for Windows console ARCNAME = pdc$(VER)_bcc_vt !include $(PDCURSES_SRCDIR)\makedist.mif curses-1.4.4/vendor/PDCurses/vt/CMakeLists.txt0000644000004100000410000000140714201713275021236 0ustar www-datawww-datacmake_minimum_required(VERSION 3.11) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING "Choose the type of build, options are: Debug, Release, or MinSizeRel." FORCE) message(STATUS "No build type specified, defaulting to MinSizeRel.") endif() PROJECT(vt VERSION "${PROJECT_VERSION}" LANGUAGES C) INCLUDE(project_common) demo_app(../demos firework) demo_app(../demos ozdemo) demo_app(../demos newtest) demo_app(../demos ptest) demo_app(../demos rain) demo_app(../demos testcurs) demo_app(../demos tuidemo) demo_app(../demos worm) demo_app(../demos xmas) IF(WIN32) SET_TARGET_PROPERTIES(${PROJECT_NAME}_newtest PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS") ENDIF(WIN32) SET(CPACK_COMPONENTS_ALL applications) curses-1.4.4/vendor/PDCurses/vt/pdcutil.c0000644000004100000410000000110714201713275020303 0ustar www-datawww-data#ifdef _WIN32 #include #undef MOUSE_MOVED #else #include #endif #include "curses.h" void PDC_beep(void) { } void PDC_napms(int ms) { #ifdef _WIN32 Sleep(ms); #else #ifndef DOS usleep(1000 * ms); #endif #endif } const char *PDC_sysname(void) { return( "VTx00"); } PDC_version_info PDC_version = { PDC_PORT_VT, PDC_VER_MAJOR, PDC_VER_MINOR, PDC_VER_CHANGE, sizeof( chtype), #ifdef PDC_WIDE TRUE, #else FALSE, #endif #ifdef PDC_FORCE_UTF8 TRUE, #else FALSE, #endif }; curses-1.4.4/vendor/PDCurses/vt/pdcscrn.c0000644000004100000410000003156514201713275020306 0ustar www-datawww-data#include #include #include #include #if !defined( _WIN32) && !defined( DOS) #define USE_TERMIOS #include #include #include static struct termios orig_term; #endif #include #include "curspriv.h" #include "pdcvt.h" #ifdef DOS bool PDC_is_ansi = TRUE; #else bool PDC_is_ansi = FALSE; #endif #ifdef _WIN32 #include #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 #endif #ifndef ENABLE_VIRTUAL_TERMINAL_INPUT #define ENABLE_VIRTUAL_TERMINAL_INPUT 0x0200 #endif #ifndef DISABLE_NEWLINE_AUTO_RETURN #define DISABLE_NEWLINE_AUTO_RETURN 0x0008 #endif /* In DOS/Windows, we have two possible modes of operation. If we can successfully use SetConsoleMode to ENABLE_VIRTUAL_TERMINAL_INPUT, we have access to most of what we'd use on xterm. If not, we can only use what ANSI.SYS or ANSI.COM (or their NANSI or NNANSI variants) support. We'll get sixteen colors, no mouse events, no resizable windows, etc. So we check the return value from SetConsoleMode and set PDC_is_ansi accordingly. (In DOS, PDC_is_ansi is always true -- there's no xterm-like support there. On non-MS platforms, PDC_is_ansi is always false... though that should be revisited for the Linux console, and probably elsewhere.) */ static int set_win10_for_vt_codes( const bool setting_mode) { const HANDLE hIn = GetStdHandle( STD_INPUT_HANDLE); HANDLE hOut; DWORD dwMode = 0; static DWORD old_input_mode; const DWORD out_mask = ENABLE_VIRTUAL_TERMINAL_PROCESSING | DISABLE_NEWLINE_AUTO_RETURN; if( hIn == INVALID_HANDLE_VALUE) return GetLastError( ); PDC_is_ansi = TRUE; if( setting_mode) { GetConsoleMode( hIn, &old_input_mode); dwMode = ENABLE_VIRTUAL_TERMINAL_INPUT; } else /* restoring initial mode */ dwMode = old_input_mode; if( !SetConsoleMode( hIn, dwMode)) return GetLastError( ); /* Set output mode to handle virtual terminal sequences */ hOut = GetStdHandle( STD_OUTPUT_HANDLE); if( hOut == INVALID_HANDLE_VALUE) return GetLastError( ); if( !GetConsoleMode( hOut, &dwMode)) return GetLastError( ); if( setting_mode) dwMode |= out_mask; else /* clearing VT mode, not setting it */ dwMode &= ~out_mask; if( !SetConsoleMode( hOut, dwMode)) return GetLastError( ); /* If we've gotten this far, the terminal has been */ /* set up to process xterm-like sequences : */ PDC_is_ansi = FALSE; return( 0); } #endif int PDC_rows = -1, PDC_cols = -1; bool PDC_resize_occurred = FALSE; const int STDIN = 0; chtype PDC_capabilities = 0; /* COLOR_PAIR to attribute encoding table. */ static short *color_pair_indices = (short *)NULL; PACKED_RGB *pdc_rgbs = (PACKED_RGB *)NULL; unsigned long pdc_key_modifiers = 0L; void PDC_reset_prog_mode( void) { } void PDC_reset_shell_mode( void) { } static int initial_PDC_rows, initial_PDC_cols; int PDC_resize_screen(int nlines, int ncols) { if( PDC_rows == -1) /* initscr( ) hasn't been called; we're just */ { /* setting desired size at startup */ initial_PDC_rows = nlines; initial_PDC_cols = ncols; } else if( nlines > 1 && ncols > 1 && !PDC_is_ansi) { printf( "\033[8;%d;%dt", nlines, ncols); PDC_rows = nlines; PDC_cols = ncols; } return( 0); } void PDC_restore_screen_mode(int i) { } void PDC_save_screen_mode(int i) { } void PDC_scr_close( void) { printf( "\0338"); /* restore cursor & attribs (VT100) */ printf( "\033[m"); /* set default screen attributes */ printf( "\033[?47l"); /* restore screen */ PDC_gotoyx( PDC_cols - 1, 0); printf( "\033[?1000l"); /* turn off mouse events */ #ifdef _WIN32 set_win10_for_vt_codes( FALSE); #else #if !defined( DOS) tcsetattr( STDIN, TCSANOW, &orig_term); #endif #endif return; } void PDC_scr_free( void) { if (SP) free(SP); SP = (SCREEN *)NULL; if (color_pair_indices) free(color_pair_indices); color_pair_indices = (short *)NULL; if (pdc_rgbs) free(pdc_rgbs); pdc_rgbs = (PACKED_RGB *)NULL; } #ifdef USE_TERMIOS static void sigwinchHandler( int sig) { struct winsize ws; if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) != -1) if( PDC_rows != ws.ws_row || PDC_cols != ws.ws_col) { PDC_rows = ws.ws_row; PDC_cols = ws.ws_col; PDC_resize_occurred = TRUE; } } #endif #define MAX_LINES 1000 #define MAX_COLUMNS 1000 int PDC_scr_open(int argc, char **argv) { int i, r, g, b, n_colors; char *capabilities = getenv( "PDC_VT"); const char *colorterm = getenv( "COLORTERM"); #ifdef USE_TERMIOS struct sigaction sa; struct termios term; #endif #ifdef _WIN32 set_win10_for_vt_codes( TRUE); #endif PDC_LOG(("PDC_scr_open called\n")); if( colorterm && !strcmp( colorterm, "truecolor")) PDC_capabilities |= A_RGB_COLOR; if( capabilities) /* these should really come from terminfo! */ { if( strstr( capabilities, "RGB")) PDC_capabilities |= A_RGB_COLOR; if( strstr( capabilities, "UND")) PDC_capabilities |= A_UNDERLINE; if( strstr( capabilities, "BLI")) PDC_capabilities |= A_BLINK; if( strstr( capabilities, "DIM")) PDC_capabilities |= A_DIM; if( strstr( capabilities, "STA")) PDC_capabilities |= A_STANDOUT; } SP = calloc(1, sizeof(SCREEN)); color_pair_indices = (short *)calloc( PDC_COLOR_PAIRS * 2, sizeof( short)); n_colors = (PDC_is_ansi ? 16 : 256); pdc_rgbs = (PACKED_RGB *)calloc( n_colors, sizeof( PACKED_RGB)); assert( SP && color_pair_indices && pdc_rgbs); if (!SP || !color_pair_indices || !pdc_rgbs) return ERR; COLORS = n_colors; /* should give this a try and see if it works! */ for( i = 0; i < 16 && i < n_colors; i++) { const int intensity = ((i & 8) ? 0xff : 0xc0); pdc_rgbs[i] = PACK_RGB( ((i & COLOR_RED) ? intensity : 0), ((i & COLOR_GREEN) ? intensity : 0), ((i & COLOR_BLUE) ? intensity : 0)); } /* 256-color xterm extended palette: 216 colors in a 6x6x6 color cube, plus 24 (not 50) shades of gray */ for( r = 0; r < 6; r++) for( g = 0; g < 6; g++) for( b = 0; b < 6; b++) if( i < n_colors) pdc_rgbs[i++] = PACK_RGB( r ? r * 40 + 55 : 0, g ? g * 40 + 55 : 0, b ? b * 40 + 55 : 0); for( i = 0; i < 24; i++) if( i + 232 < n_colors) pdc_rgbs[i + 232] = PACK_RGB( i * 10 + 8, i * 10 + 8, i * 10 + 8); setbuf( stdin, NULL); setbuf( stdout, NULL); #ifdef USE_TERMIOS sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sa.sa_handler = sigwinchHandler; if (sigaction(SIGWINCH, &sa, NULL) == -1) { fprintf( stderr, "Sigaction failed\n"); return( -1); } sigwinchHandler( 0); #else { const char *env = getenv("PDC_LINES"); PDC_rows = (env ? atoi( env) : 25); env = getenv( "PDC_COLS"); PDC_cols = (env ? atoi( env) : 80); } #endif SP->mouse_wait = PDC_CLICK_PERIOD; SP->visibility = 0; /* no cursor, by default */ SP->curscol = SP->cursrow = 0; SP->audible = TRUE; SP->mono = FALSE; while( PDC_get_rows( ) < 1 && PDC_get_columns( ) < 1) ; /* wait for screen to be drawn and size determined */ if( initial_PDC_rows > 1 && initial_PDC_cols > 1) { PDC_resize_screen( initial_PDC_rows, initial_PDC_cols); while( PDC_get_rows( ) != initial_PDC_rows && PDC_get_columns( ) != initial_PDC_rows) ; } SP->lines = PDC_get_rows(); SP->cols = PDC_get_columns(); if (SP->lines < 2 || SP->lines > MAX_LINES || SP->cols < 2 || SP->cols > MAX_COLUMNS) { fprintf(stderr, "LINES value must be >= 2 and <= %d: got %d\n", MAX_LINES, SP->lines); fprintf(stderr, "COLS value must be >= 2 and <= %d: got %d\n", MAX_COLUMNS, SP->cols); return ERR; } #ifdef USE_TERMIOS tcgetattr( STDIN, &orig_term); memcpy( &term, &orig_term, sizeof( term)); term.c_lflag &= ~(ICANON | ECHO); tcsetattr( STDIN, TCSANOW, &term); #endif printf( "\033[?47h"); /* Save screen */ if( !PDC_is_ansi) printf( "\033[?1000h"); /* enable mouse events, at least on xterm */ /* NOTE: could send 1003h to get mouse motion events as well */ printf( "\0337"); /* save cursor & attribs (VT100) */ PDC_resize_occurred = FALSE; PDC_LOG(("PDC_scr_open exit\n")); /* PDC_reset_prog_mode(); doesn't do anything anyway */ return( 0); } int PDC_set_function_key( const unsigned function, const int new_key) { return( 0); } void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines, const int new_min_cols, const int new_max_cols) { return; } /* PDC_init_color(), PDC_init_pair(), and PDC_set_blink() all share a common issue : after adjusting the display characteristic in question, all relevant text should be redrawn. Call PDC_init_pair( 3, ...), and all text using color pair 3 should be redrawn; call PDC_init_color( 5, ...) and all text using color index 5 for either foreground or background should be redrawn; turn "real blinking" on/off, and all blinking text should be redrawn. (On platforms where blinking text is controlled by a timer and redrawn every half second or so, such as X11, SDLx, and Win32a, this function can be used for that purpose as well.) PDC_show_changes( ) will look for relevant chains of text and redraw them. For speed/simplicity, the code looks for the first and last character in each line that would be affected, then draws those in between. Often -- perhaps usually -- this will be zero characters, i.e., no text on that particular line happens to have an attribute requiring redrawing. */ static short get_pair( const chtype ch) { return( (short)( (ch & A_COLOR) >> PDC_COLOR_SHIFT) & (COLOR_PAIRS - 1)); } static int color_used_for_this_char( const chtype c, const int idx) { const int color = get_pair( c); const int rval = (color_pair_indices[color] == idx || color_pair_indices[color + PDC_COLOR_PAIRS] == idx); return( rval); } void PDC_show_changes( const short pair, const short idx, const chtype attr) { if( curscr && curscr->_y) { int i; for( i = 0; i < SP->lines - 1; i++) if( curscr->_y[i]) { int j = 0, n_chars; chtype *line = curscr->_y[i]; /* skip over starting text that isn't changed : */ while( j < SP->cols && get_pair( *line) != pair && !color_used_for_this_char( *line, idx) && !(attr & *line)) { j++; line++; } n_chars = SP->cols - j; /* then skip over text at the end that's not the right color: */ while( n_chars && get_pair( line[n_chars - 1]) != pair && !color_used_for_this_char( line[n_chars - 1], idx) && !(attr & line[n_chars - 1])) n_chars--; assert( n_chars >= 0); if( n_chars) PDC_transform_line( i, j, n_chars, line); } } } void PDC_init_pair( short pair, short fg, short bg) { if( color_pair_indices[pair] != fg || color_pair_indices[pair + PDC_COLOR_PAIRS] != bg) { color_pair_indices[pair] = fg; color_pair_indices[pair + PDC_COLOR_PAIRS] = bg; PDC_show_changes( pair, -1, 0); } } int PDC_pair_content( short pair, short *fg, short *bg) { *fg = color_pair_indices[pair]; *bg = color_pair_indices[pair + PDC_COLOR_PAIRS]; return OK; } bool PDC_can_change_color(void) { return TRUE; } int PDC_color_content( short color, short *red, short *green, short *blue) { PACKED_RGB col = pdc_rgbs[color]; *red = DIVROUND( Get_RValue(col) * 1000, 255); *green = DIVROUND( Get_GValue(col) * 1000, 255); *blue = DIVROUND( Get_BValue(col) * 1000, 255); return OK; } int PDC_init_color( short color, short red, short green, short blue) { const PACKED_RGB new_rgb = PACK_RGB(DIVROUND(red * 255, 1000), DIVROUND(green * 255, 1000), DIVROUND(blue * 255, 1000)); if( pdc_rgbs[color] != new_rgb) { pdc_rgbs[color] = new_rgb; PDC_show_changes( -1, color, 0); } return OK; } curses-1.4.4/vendor/PDCurses/curspriv.h0000644000004100000410000000737214201713275020102 0ustar www-datawww-data/* Public Domain Curses */ /* Private definitions and declarations for use within PDCurses. These should generally not be referenced by applications. */ #ifndef __CURSES_INTERNALS__ #define __CURSES_INTERNALS__ 1 #define CURSES_LIBRARY #include #if defined(__TURBOC__) || defined(__EMX__) || defined(__DJGPP__) || \ defined(__CYGWIN__) || defined(__MINGW32__) || \ defined(__WATCOMC__) || defined(__PACIFIC__) # ifndef HAVE_VSSCANF # define HAVE_VSSCANF /* have vsscanf() */ # endif #endif #if defined(__CYGWIN__) || defined(__MINGW32__) || \ defined(__LCC__) || defined(__WATCOMC__) # ifndef HAVE_VSNPRINTF # define HAVE_VSNPRINTF /* have vsnprintf() */ # endif #endif #if defined(_MSC_VER) && defined(_WIN32) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE 1 /* kill nonsense warnings */ #endif /*----------------------------------------------------------------------*/ typedef struct /* structure for ripped off lines */ { int line; int (*init)(WINDOW *, int); } RIPPEDOFFLINE; /* Window properties */ #define _SUBWIN 0x01 /* window is a subwindow */ #define _PAD 0x10 /* X/Open Pad. */ #define _SUBPAD 0x20 /* X/Open subpad. */ /* Miscellaneous */ #define _NO_CHANGE -1 /* flags line edge unchanged */ #define _ECHAR 0x08 /* Erase char (^H) */ #define _DWCHAR 0x17 /* Delete Word char (^W) */ #define _DLCHAR 0x15 /* Delete Line char (^U) */ extern WINDOW *pdc_lastscr; extern FILE *pdc_dbfp; /* tracing file pointer (NULL = off) */ extern bool pdc_color_started; extern unsigned long pdc_key_modifiers; extern MOUSE_STATUS pdc_mouse_status; /*----------------------------------------------------------------------*/ /* Platform implementation functions */ void PDC_beep(void); bool PDC_can_change_color(void); int PDC_color_content(short, short *, short *, short *); bool PDC_check_key(void); int PDC_curs_set(int); void PDC_flushinp(void); int PDC_get_columns(void); int PDC_get_cursor_mode(void); int PDC_get_key(void); int PDC_get_rows(void); void PDC_gotoyx(int, int); int PDC_init_color(short, short, short, short); void PDC_init_pair(short, short, short); int PDC_modifiers_set(void); int PDC_mouse_set(void); void PDC_napms(int); int PDC_pair_content(short, short *, short *); void PDC_reset_prog_mode(void); void PDC_reset_shell_mode(void); int PDC_resize_screen(int, int); void PDC_restore_screen_mode(int); void PDC_save_screen_mode(int); void PDC_scr_close(void); void PDC_scr_free(void); int PDC_scr_open(int, char **); void PDC_set_keyboard_binary(bool); void PDC_transform_line(int, int, int, const chtype *); const char *PDC_sysname(void); /* Internal cross-module functions */ void PDC_init_atrtab(void); WINDOW *PDC_makelines(WINDOW *); WINDOW *PDC_makenew(int, int, int, int); int PDC_mouse_in_slk(int, int); void PDC_slk_free(void); void PDC_slk_initialize(void); void PDC_sync(WINDOW *); #ifdef PDC_WIDE int PDC_mbtowc(wchar_t *, const char *, size_t); size_t PDC_mbstowcs(wchar_t *, const char *, size_t); size_t PDC_wcstombs(char *, const wchar_t *, size_t); #endif #ifdef PDCDEBUG # define PDC_LOG(x) if (pdc_dbfp) PDC_debug x #else # define PDC_LOG(x) #endif /* Internal macros for attributes */ #ifdef CHTYPE_LONG # define PDC_COLOR_PAIRS 256 #else # define PDC_COLOR_PAIRS 32 #endif #ifndef max # define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min # define min(a,b) (((a) < (b)) ? (a) : (b)) #endif #define DIVROUND(num, divisor) (((num) + ((divisor) >> 1)) / (divisor)) #define PDC_CLICK_PERIOD 150 /* time to wait for a click, if not set by mouseinterval() */ #endif /* __CURSES_INTERNALS__*/ curses-1.4.4/vendor/PDCurses/term.h0000644000004100000410000000253214201713275017165 0ustar www-datawww-data/* Public Domain Curses */ /* PDCurses doesn't operate with terminfo, but we need these functions for compatibility, to allow some things (notably, interface libraries for other languages) to be compiled. Anyone who tries to actually _use_ them will be disappointed, since they only return ERR. */ #ifndef __PDCURSES_TERM_H__ #define __PDCURSES_TERM_H__ 1 #include #if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS) extern "C" { #endif typedef struct { const char *_termname; } TERMINAL; /* PDCEX is defined in curses.h */ PDCEX TERMINAL *cur_term; int del_curterm(TERMINAL *); int putp(const char *); int restartterm(const char *, int, int *); TERMINAL *set_curterm(TERMINAL *); int setterm(const char *); int setupterm(const char *, int, int *); int tgetent(char *, const char *); int tgetflag(const char *); int tgetnum(const char *); char *tgetstr(const char *, char **); char *tgoto(const char *, int, int); int tigetflag(const char *); int tigetnum(const char *); char *tigetstr(const char *); char *tparm(const char *, long, long, long, long, long, long, long, long, long); int tputs(const char *, int, int (*)(int)); #if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS) } #endif #endif /* __PDCURSES_TERM_H__ */ curses-1.4.4/vendor/PDCurses/panel.h0000644000004100000410000000277314201713275017324 0ustar www-datawww-data/* Public Domain Curses */ /*----------------------------------------------------------------------* * Panels for PDCurses * *----------------------------------------------------------------------*/ #ifndef __PDCURSES_PANEL_H__ #define __PDCURSES_PANEL_H__ 1 #include #if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS) extern "C" { #endif typedef struct panelobs { struct panelobs *above; struct panel *pan; } PANELOBS; typedef struct panel { WINDOW *win; int wstarty; int wendy; int wstartx; int wendx; struct panel *below; struct panel *above; const void *user; struct panelobs *obscure; } PANEL; PDCEX int bottom_panel(PANEL *pan); PDCEX int del_panel(PANEL *pan); PDCEX int hide_panel(PANEL *pan); PDCEX int move_panel(PANEL *pan, int starty, int startx); PDCEX PANEL *new_panel(WINDOW *win); PDCEX PANEL *panel_above(const PANEL *pan); PDCEX PANEL *panel_below(const PANEL *pan); PDCEX int panel_hidden(const PANEL *pan); PDCEX const void *panel_userptr(const PANEL *pan); PDCEX WINDOW *panel_window(const PANEL *pan); PDCEX int replace_panel(PANEL *pan, WINDOW *win); PDCEX int set_panel_userptr(PANEL *pan, const void *uptr); PDCEX int show_panel(PANEL *pan); PDCEX int top_panel(PANEL *pan); PDCEX void update_panels(void); #if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS) } #endif #endif /* __PDCURSES_PANEL_H__ */ curses-1.4.4/Gemfile0000644000004100000410000000010514201713275014345 0ustar www-datawww-data# frozen_string_literal: true source "https://rubygems.org" gemspec curses-1.4.4/.gitmodules0000644000004100000410000000014314201713275015231 0ustar www-datawww-data[submodule "vendor/PDCurses"] path = vendor/PDCurses url = https://github.com/shugo/PDCurses.git curses-1.4.4/History.md0000644000004100000410000001006514201713275015043 0ustar www-datawww-data### 1.4.4 / 2022-02-03 Bug fixes: * Define Curses.colors even if COLORS is a macro. Issue #69 by dvarrui. * Use require instead of require_relative. Pull request #68 by dvarrui. ### 1.4.3 / 2022-01-06 New features: * Added flushinp, menu mark, fore and back functions. Pull request #66 by Isty001. ### 1.4.2 / 2021-06-14 New features: * Added samples for addch, attron, mouse tracking and colors. Pull request #62 by coezbek. ### 1.4.1 / 2021-05-22 Bug fixes: * Use chtype instead of char to support attributes * Fixes for Ruby 3.1. ### 1.4.0 / 2020-12-10 New features: * Remove fat binary support for newer versions of Ruby ### 1.3.2 / 2019-12-20 Bug fixes: * Drop rb_safe_level check for Ruby 2.7 by Eric Wong. * Try libtinfow first. Issue #52 by Marco Sirabella. ### 1.3.1 / 2019-04-21 Bug fixes: * Check whether sizeof(WINDOW) is available to avoid build failures on macOS. Issue #48 reported by chdiza. ### 1.3.0 / 2019-04-16 New features: * Add Curses::Form and Curses::Field. Bug fixes: * Fix TravisCI issues by amatsuda and znz. * Fix typo in sample/menu.rb by binford2k. * Ctrl-/ should return ^_ on Windows. * Workaround for new Windows console. https://github.com/Bill-Gray/PDCurses/pull/108 ### 1.2.7 / 2019-01-10 Bug fixes: * Add curses.so for Ruby 2.5/2.6 on x86-mingw32. ### 1.2.6 / 2019-01-09 New features: * Add Curses::Menu and Curses::Item. Bug fixes: * Link PDCurses statically to avoid LoadError on mingw. * Use https for documentation link. Pull request #43 by stomar. * Fix typo in example code. Pull request #44 by stomar. ### 1.2.5 / 2018-10-16 New features: * Add mvderwin and derwin methods to Window. Pull request #37 by meschbach. * Add documentation link. Pull request #39 by atshakil. Bug fixes: * Favor ncursesw over curses. Pull request #40 by DivineDominion. ### 1.2.4 / 2017-09-13 New features: * Update PDCurses. Bug fixes: * Fix the path of pdcurses.dll for i386-mingw. (Issue #36) Documentation: * Include reference to ncurses dependency. Pull request #34 by qume. ### 1.2.3 / 2017-07-03 Bug fixes: * Fixes for mswin. Pull requests #30, #31, #32 and #33 by unak. ### 1.2.2 / 2017-04-22 New features: * Add Curses.get_key_modifiers, Curses.return_key_modifiers, and Curses.save_key_modifiers. * Support mswin native build. Pull request #29 by usa. ### 1.2.1 / 2017-03-27 New features: * Add touch, untouch, touched?, touch_line, and line_touched?. Bug fixes: * Fix Pad#subpad to use subpad(3). (Issue #23) * Fix build issues on macOS. Pull requests #24, #25, #26, #27 and #28 by nobu. ### 1.2.0 / 2017-02-19 New features: * Add Curses.assume_default_colors. Bug fixes: * Curses.unget_char should use String#ord even if unget_wch() is not available. * The default value of keyboard_encoding should be ASCII-8BIT if get_wch() is not available. * NUM2ULONG() should be used in Window#bkgd etc. ### 1.1.3 / 2017-02-08 Bug fixes: * Update PDCurses to handle extended keys. ### 1.1.2 / 2017-02-06 Bug fixes: * Use the left-alt-fix branch of https://github.com/shugo/PDCurses.git to get ALT + < etc. ### 1.1.1 / 2017-01-25 Bug fixes: * Add -DPDC_WIDE to CPPFLAGS when compiling with PDCurses. ### 1.1.0 / 2017-01-24 New features: * Use bundler instead of hoe. Pull request #18 by hsbt. * Enable appveyor. Pull request #19 by hsbt. * Add badges for build status to README.md. Pull request #20 by hsbt. * Add Curses.erase and Curses::Window.erase. * Add Curses::Window.redraw. * Add Curses.unget_char, Curses.get_char, and Curses::Window.get_char for multibyte characters. * Add Curses.keyboard_encoding and Curses.terminal_encoding. * Support cross compilation for mingw32. Bug fixes: * Fix error in attron/attroff documentation. Pull request #14 by stomar. * Improve code samples. Pull request #15 by stomar. ### 1.0.2 / 2016-03-15 Bug fixes: * Fix ncursesw support. Pull request #16 by peter50216, patch by eTM. Issue #6 by Jean Lazarou. ### 1.0.1 / 2014-03-26 Bug fixes: * Curses install is a no-op on ruby with bundled curses. Pull request #4 tiredpixel. ### 1.0.0 / 2013-12-10 Birthday! curses-1.4.4/.github/0000755000004100000410000000000014201713275014416 5ustar www-datawww-datacurses-1.4.4/.github/workflows/0000755000004100000410000000000014201713275016453 5ustar www-datawww-datacurses-1.4.4/.github/workflows/ubuntu.yml0000644000004100000410000000113014201713275020513 0ustar www-datawww-dataname: ubuntu on: [push] jobs: test: strategy: matrix: ruby: [ head, 3.1, 2.7, 2.6 ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - name: Install dependencies run: | sudo apt install libncursesw5-dev gem install bundler --no-document bundle install - name: Build package run: bundle exec rake build - name: Install package run: | gem install pkg/curses-*.gem ruby -r curses -e 'puts Curses::VERSION' curses-1.4.4/.github/workflows/windows.yml0000644000004100000410000000104614201713275020671 0ustar www-datawww-dataname: windows on: [push] jobs: build: runs-on: windows-latest strategy: matrix: ruby: [ 'mingw', 'mswin', '2.7', '2.6' ] steps: - uses: actions/checkout@v2 with: submodules: true - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - name: Build package run: bundle exec rake build - name: Install package run: | gem install pkg/curses-*.gem ruby -r curses -e 'puts Curses::VERSION' curses-1.4.4/.github/workflows/macos.yml0000644000004100000410000000062714201713275020305 0ustar www-datawww-dataname: macos on: [push] jobs: build: runs-on: macos-latest steps: - uses: actions/checkout@v2 - name: Install dependencies run: | gem install bundler --no-document bundle install - name: Build package run: bundle exec rake build - name: Install package run: | gem install pkg/curses-*.gem ruby -r curses -e 'puts Curses::VERSION' curses-1.4.4/BSDL0000644000004100000410000000240214201713275013523 0ustar www-datawww-dataCopyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. curses-1.4.4/ext/0000755000004100000410000000000014201713275013656 5ustar www-datawww-datacurses-1.4.4/ext/curses/0000755000004100000410000000000014201713275015162 5ustar www-datawww-datacurses-1.4.4/ext/curses/depend0000644000004100000410000000022214201713275016340 0ustar www-datawww-data$(OBJS): $(HDRS) $(ruby_headers) \ $(hdrdir)/ruby/io.h \ $(hdrdir)/ruby/encoding.h \ $(hdrdir)/ruby/oniguruma.h \ $(hdrdir)/ruby/thread.h curses-1.4.4/ext/curses/curses.c0000644000004100000410000046246014201713275016646 0ustar www-datawww-data/* -*- C -*- * $Id$ * * ext/curses/curses.c * * by MAEDA Shugo (ender@pic-internet.or.jp) * modified by Yukihiro Matsumoto (matz@netlab.co.jp), * Toki Yoshinori, * Hitoshi Takahashi, * and Takaaki Tateishi (ttate@kt.jaist.ac.jp) * * maintainers: * - Takaaki Tateishi (ttate@kt.jaist.ac.jp) * * documentation: * - Vincent Batts (vbatts@hashbangbash.com) */ #include "ruby.h" #include "ruby/io.h" #include "ruby/thread.h" #if defined(HAVE_PDCURSES_H) # include #elif defined(HAVE_NCURSESW_CURSES_H) # include #elif defined(HAVE_NCURSES_CURSES_H) # include #elif defined(HAVE_NCURSES_H) # include #elif defined(HAVE_CURSES_COLR_CURSES_H) # ifdef HAVE_STDARG_PROTOTYPES # include # else # include # endif # include #else # include # if defined(__bsdi__) || defined(__NetBSD__) || defined(__APPLE__) # if !defined(_maxx) # define _maxx maxx # endif # if !defined(_maxy) # define _maxy maxy # endif # if !defined(_begx) # define _begx begx # endif # if !defined(_begy) # define _begy begy # endif # endif #endif #if defined(HAVE_NCURSESW_MENU_H) # include #elif defined(HAVE_NCURSES_MENU_H) # include #elif defined(HAVE_CURSES_MENU_H) # include #elif defined(HAVE_MENU_H) # include #endif #if defined(HAVE_NCURSESW_FORM_H) # include #elif defined(HAVE_NCURSES_FORM_H) # include #elif defined(HAVE_CURSES_FORM_H) # include #elif defined(HAVE_FORM_H) # include #endif #ifdef HAVE_INIT_COLOR # define USE_COLOR 1 #endif /* supports only ncurses mouse routines */ #ifdef NCURSES_MOUSE_VERSION # define USE_MOUSE 1 #endif #define OBJ2CHTYPE rb_obj2chtype_inline static inline chtype rb_obj2chtype_inline(VALUE x) { if (RB_TYPE_P(x, RUBY_T_STRING)) { ID id_ord; CONST_ID(id_ord, "ord"); x = rb_funcall(x, id_ord, 0); } return NUM2CHTYPE(x); } static VALUE mCurses; static VALUE mKey; static VALUE cWindow; static VALUE cPad; #ifdef USE_MOUSE static VALUE cMouseEvent; #endif #ifdef HAVE_MENU static VALUE cItem; static VALUE cMenu; #endif #ifdef HAVE_FORM static VALUE cField; static VALUE cForm; #endif static VALUE eError; static VALUE eSystemError; static VALUE eBadArgumentError; static VALUE ePostedError; static VALUE eConnectedError; static VALUE eBadStateError; static VALUE eNoRoomError; static VALUE eNotPostedError; static VALUE eUnknownCommandError; static VALUE eNoMatchError; static VALUE eNotSelectableError; static VALUE eNotConnectedError; static VALUE eRequestDeniedError; static VALUE eInvalidFieldError; static VALUE eCurrentError; static VALUE rb_stdscr; static rb_encoding *keyboard_encoding; static rb_encoding *terminal_encoding; #ifndef E_OK #define E_OK 0 #endif static void check_curses_error(int error) { switch (error) { case E_OK: break; #ifdef E_SYSTEM_ERROR case E_SYSTEM_ERROR: rb_raise(eSystemError, "A system error occurred"); break; #endif #ifdef E_BAD_ARGUMENT case E_BAD_ARGUMENT: rb_raise(eBadArgumentError, "Incorrect or out-of-range argument"); break; #endif #ifdef E_POSTED case E_POSTED: rb_raise(ePostedError, "The menu has already been posted"); break; #endif #ifdef E_CONNECTED case E_CONNECTED: rb_raise(eConnectedError, "The field is already connected to a form"); break; #endif #ifdef E_BAD_STATE case E_BAD_STATE: rb_raise(eBadStateError, "Called from an initialization or termination function"); break; #endif #ifdef E_NO_ROOM case E_NO_ROOM: rb_raise(eNoRoomError, "Form is too large for its window"); break; #endif #ifdef E_NOT_POSTED case E_NOT_POSTED: rb_raise(eNotPostedError, "The menu has not been posted"); break; #endif #ifdef E_UNKNOWN_COMMAND case E_UNKNOWN_COMMAND: rb_raise(eUnknownCommandError, "Unknown command"); break; #endif #ifdef E_NO_MATCH case E_NO_MATCH: rb_raise(eNoMatchError, "Character failed to match"); break; #endif #ifdef E_NOT_SELECTABLE case E_NOT_SELECTABLE: rb_raise(eNotSelectableError, "The designated item cannot be selected"); break; #endif #ifdef E_NOT_CONNECTED case E_NOT_CONNECTED: rb_raise(eNotConnectedError, "No fields or items are connected"); break; #endif #ifdef E_REQUEST_DENIED case E_REQUEST_DENIED: rb_raise(eRequestDeniedError, "The request could not be processed"); break; #endif #ifdef E_INVALID_FIELD case E_INVALID_FIELD: rb_raise(eInvalidFieldError, "Contents of a field is not valid"); break; #endif #ifdef E_CURRENT case E_CURRENT: rb_raise(eCurrentError, "The field is the current field"); break; #endif default: rb_raise(eError, "Unknown error"); break; } } struct windata { WINDOW *window; }; static VALUE window_attroff(VALUE obj, VALUE attrs); static VALUE window_attron(VALUE obj, VALUE attrs); static VALUE window_attrset(VALUE obj, VALUE attrs); NORETURN(static void no_window(void)); static void no_window(void) { rb_raise(rb_eRuntimeError, "already closed window"); } #define GetWINDOW(obj, winp) do {\ TypedData_Get_Struct((obj), struct windata, &windata_type, (winp));\ if ((winp)->window == 0) no_window();\ } while (0) static void window_free(void *p) { struct windata *winp = p; if (winp->window && winp->window != stdscr) delwin(winp->window); winp->window = 0; xfree(winp); } static size_t window_memsize(const void *p) { const struct windata *winp = p; size_t size = sizeof(*winp); if (!winp) return 0; if (winp->window && winp->window != stdscr) size += CURSES_SIZEOF_WINDOW; return size; } static const rb_data_type_t windata_type = { "windata", {0, window_free, window_memsize,} }; static VALUE prep_window(VALUE class, WINDOW *window) { VALUE obj; struct windata *winp; if (window == NULL) { rb_raise(rb_eRuntimeError, "failed to create window"); } obj = rb_obj_alloc(class); TypedData_Get_Struct(obj, struct windata, &windata_type, winp); winp->window = window; return obj; } #if (defined(HAVE_ADDNWSTR) || defined(HAVE_WADDNWSTR)) && defined(_WIN32) static inline rb_encoding * get_wide_encoding(void) { static rb_encoding *utf16le = NULL; if (!utf16le) { utf16le = rb_enc_find("utf-16le"); } return utf16le; } #endif /*-------------------------- module Curses --------------------------*/ static void curses_finalize(VALUE); /* * Document-method: Curses.init_screen * * Initialize a standard screen * * see also Curses.stdscr */ static VALUE curses_init_screen(VALUE self) { if (rb_stdscr) return rb_stdscr; initscr(); if (stdscr == 0) { rb_raise(rb_eRuntimeError, "can't initialize curses"); } rb_set_end_proc(curses_finalize, 0); clear(); rb_stdscr = prep_window(cWindow, stdscr); return rb_stdscr; } /* * Document-method: Curses.stdscr * * The Standard Screen. * * Upon initializing curses, a default window called stdscr, * which is the size of the terminal screen, is created. * * Many curses functions use this window. */ #define curses_stdscr() curses_init_screen(Qnil) /* * Document-method: Curses.close_screen * * A program should always call Curses.close_screen before exiting or * escaping from curses mode temporarily. This routine * restores tty modes, moves the cursor to the lower * left-hand corner of the screen and resets the terminal * into the proper non-visual mode. * * Calling Curses.refresh or Curses.doupdate after a temporary * escape causes the program to resume visual mode. * */ static VALUE curses_close_screen(VALUE self) { curses_stdscr(); #ifdef HAVE_ISENDWIN if (!isendwin()) #endif endwin(); rb_stdscr = 0; return Qnil; } /* * This is no runtime method, * but a function called before the proc ends * * Similar to Curses.close_screen, except that it also * garbage collects/unregisters the Curses.stdscr */ static void curses_finalize(VALUE dummy) { if (stdscr #ifdef HAVE_ISENDWIN && !isendwin() #endif ) endwin(); rb_stdscr = 0; rb_gc_unregister_address(&rb_stdscr); } #ifdef HAVE_ISENDWIN /* * Document-method: Curses.closed? * * Returns +true+ if the window/screen has been closed, * without any subsequent Curses.refresh calls, * returns +false+ otherwise. */ static VALUE curses_closed(VALUE self) { curses_stdscr(); if (isendwin()) { return Qtrue; } return Qfalse; } #else #define curses_closed rb_f_notimplement #endif /* * Document-method: Curses.clear * * Clears every position on the screen completely, * so that a subsequent call by Curses.refresh for the screen/window * will be repainted from scratch. */ static VALUE curses_clear(VALUE obj) { curses_stdscr(); wclear(stdscr); return Qnil; } #ifdef HAVE_WERASE /* * Document-method: Curses.erase * * Erase the screen. */ static VALUE curses_erase(VALUE obj) { curses_stdscr(); werase(stdscr); return Qnil; } #else #define curses_erase rb_f_notimplement #endif /* * Document-method: Curses.clrtoeol * * Clears to the end of line, that the cursor is currently on. */ static VALUE curses_clrtoeol(VALUE self) { curses_stdscr(); clrtoeol(); return Qnil; } /* * Document-method: Curses.refresh * * Refreshes the windows and lines. * */ static VALUE curses_refresh(VALUE obj) { curses_stdscr(); refresh(); return Qnil; } /* * Document-method: Curses.doupdate * * Refreshes the windows and lines. * * Curses.doupdate allows multiple updates with * more efficiency than Curses.refresh alone. */ static VALUE curses_doupdate(VALUE obj) { curses_stdscr(); #ifdef HAVE_DOUPDATE doupdate(); #else refresh(); #endif return Qnil; } /* * Document-method: Curses.echo * * Enables characters typed by the user * to be echoed by Curses.getch as they are typed. */ static VALUE curses_echo(VALUE obj) { curses_stdscr(); echo(); return Qnil; } /* * Document-method: Curses.noecho * * Disables characters typed by the user * to be echoed by Curses.getch as they are typed. */ static VALUE curses_noecho(VALUE obj) { curses_stdscr(); noecho(); return Qnil; } /* * Document-method: Curses.raw * * Put the terminal into raw mode. * * Raw mode is similar to Curses.cbreak mode, in that characters typed * are immediately passed through to the user program. * * The differences are that in raw mode, the interrupt, quit, * suspend, and flow control characters are all passed through * uninterpreted, instead of generating a signal. The behavior * of the BREAK key depends on other bits in the tty driver * that are not set by curses. */ static VALUE curses_raw(VALUE obj) { curses_stdscr(); raw(); return Qnil; } /* * Document-method: Curses.noraw * * Put the terminal out of raw mode. * * see Curses.raw for more detail */ static VALUE curses_noraw(VALUE obj) { curses_stdscr(); noraw(); return Qnil; } /* * Document-method: Curses.cbreak * * Put the terminal into cbreak mode. * * Normally, the tty driver buffers typed characters until * a newline or carriage return is typed. The Curses.cbreak * routine disables line buffering and erase/kill * character-processing (interrupt and flow control characters * are unaffected), making characters typed by the user * immediately available to the program. * * The Curses.nocbreak routine returns the terminal to normal (cooked) mode. * * Initially the terminal may or may not be in cbreak mode, * as the mode is inherited; therefore, a program should * call Curses.cbreak or Curses.nocbreak explicitly. * Most interactive programs using curses set the cbreak mode. * Note that Curses.cbreak overrides Curses.raw. * * see also Curses.raw */ static VALUE curses_cbreak(VALUE obj) { curses_stdscr(); cbreak(); return Qnil; } /* * Document-method: Curses.nocbreak * * Put the terminal into normal mode (out of cbreak mode). * * See Curses.cbreak for more detail. */ static VALUE curses_nocbreak(VALUE obj) { curses_stdscr(); nocbreak(); return Qnil; } /* * Document-method: Curses.nl * * Enable the underlying display device to translate * the return key into newline on input, and whether it * translates newline into return and line-feed on output * (in either case, the call Curses.addch('\n') does the * equivalent of return and line feed on the virtual screen). * * Initially, these translations do occur. If you disable * them using Curses.nonl, curses will be able to make better use * of the line-feed capability, resulting in faster cursor * motion. Also, curses will then be able to detect the return key. */ static VALUE curses_nl(VALUE obj) { curses_stdscr(); nl(); return Qnil; } /* * Document-method: Curses.nl * * Disable the underlying display device to translate * the return key into newline on input * * See Curses.nl for more detail */ static VALUE curses_nonl(VALUE obj) { curses_stdscr(); nonl(); return Qnil; } /* * Document-method: Curses.flushinp * * The flushinp routine throws away any typeahead that has been * typed by the user and has not yet been read by the program. */ static VALUE curses_flushinp(VALUE obj) { curses_stdscr(); flushinp(); return Qnil; } /* * Document-method: Curses.beep * * Sounds an audible alarm on the terminal, if possible; * otherwise it flashes the screen (visual bell). * * see also Curses.flash */ static VALUE curses_beep(VALUE obj) { #ifdef HAVE_BEEP curses_stdscr(); beep(); #endif return Qnil; } /* * Document-method: Curses.flash * * Flashes the screen, for visual alarm on the terminal, if possible; * otherwise it sounds the alert. * * see also Curses.beep */ static VALUE curses_flash(VALUE obj) { #ifdef HAVE_FLASH curses_stdscr(); flash(); #endif return Qnil; } static int curses_char(VALUE c) { if (FIXNUM_P(c)) { return NUM2INT(c); } else { int cc; StringValue(c); if (RSTRING_LEN(c) == 0 || RSTRING_LEN(c) > 1) { rb_raise(rb_eArgError, "string not corresponding a character"); } cc = RSTRING_PTR(c)[0]; if (cc > 0x7f) { rb_raise(rb_eArgError, "no multibyte string supported (yet)"); } return cc; } } #ifdef HAVE_UNGETCH /* * Document-method: Curses.ungetch * call-seq: ungetch(ch) * * Places +ch+ back onto the input queue to be returned by * the next call to Curses.getch. * * There is just one input queue for all windows. */ static VALUE curses_ungetch(VALUE obj, VALUE ch) { int c = curses_char(ch); curses_stdscr(); ungetch(c); return Qnil; } #else #define curses_ungetch rb_f_notimplement #endif /* * Document-method: Curses.setpos * call-seq: setpos(y, x) * * A setter for the position of the cursor, * using coordinates +x+ and +y+ * */ static VALUE curses_setpos(VALUE obj, VALUE y, VALUE x) { curses_stdscr(); move(NUM2INT(y), NUM2INT(x)); return Qnil; } /* * Document-method: Curses.standout * * Enables the best highlighting mode of the terminal. * * This is equivalent to Curses:Window.attron(A_STANDOUT) * * see also Curses::Window.attrset additional information */ static VALUE curses_standout(VALUE obj) { curses_stdscr(); standout(); return Qnil; } /* * Document-method: Curses.standend * * Enables the Normal display (no highlight) * * This is equivalent to Curses.attron(A_NORMAL) * * see also Curses::Window.attrset for additional information. */ static VALUE curses_standend(VALUE obj) { curses_stdscr(); standend(); return Qnil; } /* * Document-method: Curses.inch * * Returns the character at the current position. */ static VALUE curses_inch(VALUE obj) { curses_stdscr(); return CHTYPE2NUM(inch()); } /* * Document-method: Curses.addch * call-seq: addch(ch) * * Add a character +ch+, with attributes, then advance the cursor. * * see also the system manual for curs_addch(3) */ static VALUE curses_addch(VALUE obj, VALUE ch) { curses_stdscr(); addch(OBJ2CHTYPE(ch)); return Qnil; } /* * Document-method: Curses.insch * call-seq: insch(ch) * * Insert a character +ch+, before the cursor. * */ static VALUE curses_insch(VALUE obj, VALUE ch) { curses_stdscr(); insch(OBJ2CHTYPE(ch)); return Qnil; } /* * Document-method: Curses.addstr * call-seq: addstr(str) * * add a string of characters +str+, to the window and advance cursor * */ static VALUE curses_addstr(VALUE obj, VALUE str) { StringValue(str); #if defined(HAVE_ADDNWSTR) && defined(_WIN32) str = rb_str_export_to_enc(str, get_wide_encoding()); curses_stdscr(); if (!NIL_P(str)) { addnwstr((wchar_t *)RSTRING_PTR(str), RSTRING_LEN(str) / sizeof(wchar_t)); } #else str = rb_str_export_to_enc(str, terminal_encoding); curses_stdscr(); if (!NIL_P(str)) { addstr(StringValueCStr(str)); } #endif return Qnil; } static void * getch_func(void *arg) { int *ip = (int *)arg; *ip = getch(); return 0; } /* * Document-method: Curses.getch * * Read and returns a character from the window. * * See Curses::Key to all the function KEY_* available * */ static VALUE curses_getch(VALUE obj) { int c; curses_stdscr(); rb_thread_call_without_gvl(getch_func, &c, RUBY_UBF_IO, 0); if (c == EOF) return Qnil; if (rb_isprint(c)) { char ch = (char)c; return rb_external_str_new_with_enc(&ch, 1, keyboard_encoding); } return UINT2NUM(c); } /* This should be big enough.. I hope */ #define GETSTR_BUF_SIZE 1024 static void * getstr_func(void *arg) { char *rtn = (char *)arg; #if defined(HAVE_GETNSTR) getnstr(rtn,GETSTR_BUF_SIZE-1); #else getstr(rtn); #endif return 0; } /* * Document-method: Curses.getstr * * This is equivalent to a series of Curses::Window.getch calls * */ static VALUE curses_getstr(VALUE obj) { char rtn[GETSTR_BUF_SIZE]; curses_stdscr(); rb_thread_call_without_gvl(getstr_func, rtn, RUBY_UBF_IO, 0); return rb_external_str_new_with_enc(rtn, strlen(rtn), keyboard_encoding); } /* * Document-method: Curses.delch * * Delete the character under the cursor * */ static VALUE curses_delch(VALUE obj) { curses_stdscr(); delch(); return Qnil; } /* * Document-method: Curses.deleteln * * Delete the line under the cursor. * */ static VALUE curses_deleteln(VALUE obj) { curses_stdscr(); #if defined(HAVE_DELETELN) || defined(deleteln) deleteln(); #endif return Qnil; } /* * Document-method: Curses.insertln * * Inserts a line above the cursor, and the bottom line is lost * */ static VALUE curses_insertln(VALUE obj) { curses_stdscr(); #if defined(HAVE_INSERTLN) || defined(insertln) insertln(); #endif return Qnil; } /* * Document-method: Curses.keyname * call-seq: keyname(c) * * Returns the character string corresponding to key +c+ */ static VALUE curses_keyname(VALUE obj, VALUE c) { #ifdef HAVE_KEYNAME int cc = curses_char(c); const char *name; curses_stdscr(); name = keyname(cc); if (name) { return rb_str_new_cstr(name); } else { return Qnil; } #else return Qnil; #endif } /* * Document-method: Curses.lines * * Returns the number of lines on the screen */ static VALUE curses_lines(VALUE self) { return INT2FIX(LINES); } /* * Document-method: Curses.cols * * Returns the number of columns on the screen */ static VALUE curses_cols(VALUE self) { return INT2FIX(COLS); } /* * Document-method: Curses.curs_set * call-seq: curs_set(visibility) * * Sets Cursor Visibility. * 0: invisible * 1: visible * 2: very visible */ static VALUE curses_curs_set(VALUE obj, VALUE visibility) { #ifdef HAVE_CURS_SET int n; curses_stdscr(); return (n = curs_set(NUM2INT(visibility)) != ERR) ? INT2FIX(n) : Qnil; #else return Qnil; #endif } /* * Document-method: Curses.scrl * call-seq: scrl(num) * * Scrolls the current window Fixnum +num+ lines. * The current cursor position is not changed. * * For positive +num+, it scrolls up. * * For negative +num+, it scrolls down. * */ static VALUE curses_scrl(VALUE obj, VALUE n) { /* may have to raise exception on ERR */ #ifdef HAVE_SCRL curses_stdscr(); return (scrl(NUM2INT(n)) == OK) ? Qtrue : Qfalse; #else return Qfalse; #endif } /* * Document-method: Curses.setscrreg * * call-seq: * setscrreg(top, bottom) * * Set a software scrolling region in a window. * +top+ and +bottom+ are lines numbers of the margin. * * If this option and Curses.scrollok are enabled, an attempt to move off * the bottom margin line causes all lines in the scrolling region * to scroll one line in the direction of the first line. * Only the text of the window is scrolled. * */ static VALUE curses_setscrreg(VALUE obj, VALUE top, VALUE bottom) { /* may have to raise exception on ERR */ #ifdef HAVE_SETSCRREG curses_stdscr(); return (setscrreg(NUM2INT(top), NUM2INT(bottom)) == OK) ? Qtrue : Qfalse; #else return Qfalse; #endif } /* * Document-method: Curses.attroff * call-seq: attroff(attrs) * * Turns off the named attributes +attrs+ * without affecting any others. * * See also Curses::Window.attrset for additional information. */ static VALUE curses_attroff(VALUE obj, VALUE attrs) { curses_stdscr(); return window_attroff(rb_stdscr,attrs); /* return INT2FIX(attroff(NUM2INT(attrs))); */ } /* * Document-method: Curses.attron * call-seq: attron(attrs) * * Turns on the named attributes +attrs+ * without turning any other attributes on or off. * * See also Curses::Window.attrset for additional information. */ static VALUE curses_attron(VALUE obj, VALUE attrs) { curses_stdscr(); return window_attron(rb_stdscr,attrs); /* return INT2FIX(attroff(NUM2INT(attrs))); */ } /* * Document-method: Curses.attrset * call-seq: attrset(attrs) * * Sets the current attributes of the given window to +attrs+. * * see also Curses::Window.attrset * */ static VALUE curses_attrset(VALUE obj, VALUE attrs) { curses_stdscr(); return window_attrset(rb_stdscr,attrs); /* return INT2FIX(attroff(NUM2INT(attrs))); */ } /* * Document-method: Curses.bkgdset * call-seq: bkgdset(ch) * * Manipulate the background of the named window * with character Integer +ch+ * * The background becomes a property of the character * and moves with the character through any scrolling * and insert/delete line/character operations. * * see also the system manual for curs_bkgd(3) */ static VALUE curses_bkgdset(VALUE obj, VALUE ch) { #ifdef HAVE_BKGDSET curses_stdscr(); bkgdset(OBJ2CHTYPE(ch)); #endif return Qnil; } /* * call-seq: bkgd(ch) * * Window background manipulation routines. * * Set the background property of the current * and then apply the character Integer +ch+ setting * to every character position in that window. * * see also the system manual for curs_bkgd(3) */ static VALUE curses_bkgd(VALUE obj, VALUE ch) { #ifdef HAVE_BKGD curses_stdscr(); return (bkgd(OBJ2CHTYPE(ch)) == OK) ? Qtrue : Qfalse; #else return Qfalse; #endif } #if defined(HAVE_USE_DEFAULT_COLORS) /* * tells the curses library to use terminal's default colors. * * see also the system manual for default_colors(3) */ static VALUE curses_use_default_colors(VALUE obj) { curses_stdscr(); use_default_colors(); return Qnil; } #else #define curses_use_default_colors rb_f_notimplement #endif #if defined(HAVE_ASSUME_DEFAULT_COLORS) /* * tells which colors to paint for color pair 0. * * see also the system manual for default_colors(3) */ static VALUE curses_assume_default_colors(VALUE obj, VALUE fg, VALUE bg) { curses_stdscr(); assume_default_colors(NUM2INT(fg), NUM2INT(bg)); return Qnil; } #else #define curses_assume_default_colors rb_f_notimplement #endif #if defined(HAVE_TABSIZE) /* * Document-method: Curses.TABSIZE= * call-seq: TABSIZE=(value) * * Sets the TABSIZE to Integer +value+ */ static VALUE curses_tabsize_set(VALUE obj, VALUE val) { TABSIZE = NUM2INT(val); return INT2NUM(TABSIZE); } #else #define curses_tabsize_set rb_f_notimplement #endif #if defined(HAVE_TABSIZE) /* * Returns the number of positions in a tab. */ static VALUE curses_tabsize_get(VALUE ojb) { return INT2NUM(TABSIZE); } #else #define curses_tabsize_get rb_f_notimplement #endif #if defined(HAVE_ESCDELAY) /* * call-seq: Curses.ESCDELAY=(value) * * Sets the ESCDELAY to Integer +value+ */ static VALUE curses_escdelay_set(VALUE obj, VALUE val) { ESCDELAY = NUM2INT(val); return INT2NUM(ESCDELAY); } #else #define curses_escdelay_set rb_f_notimplement #endif #if defined(HAVE_ESCDELAY) /* * Returns the total time, in milliseconds, for which * curses will await a character sequence, e.g., a function key */ static VALUE curses_escdelay_get(VALUE obj) { return INT2NUM(ESCDELAY); } #else #define curses_escdelay_get rb_f_notimplement #endif /* * Document-method: Curses.resize * call-seq: resize(lines, cols) * * alias for Curses.resizeterm * */ /* * Document-method: Curses.resizeterm * call-seq: resizeterm(lines, cols) * * Resize the current term to Fixnum +lines+ and Fixnum +cols+ * */ static VALUE curses_resizeterm(VALUE obj, VALUE lin, VALUE col) { #if defined(HAVE_RESIZETERM) curses_stdscr(); return (resizeterm(NUM2INT(lin),NUM2INT(col)) == OK) ? Qtrue : Qfalse; #else return Qnil; #endif } #ifdef USE_COLOR /* * Document-method: Curses.start_color * * Initializes the color attributes, for terminals that support it. * * This must be called, in order to use color attributes. * It is good practice to call it just after Curses.init_screen */ static VALUE curses_start_color(VALUE obj) { /* may have to raise exception on ERR */ curses_stdscr(); return (start_color() == OK) ? Qtrue : Qfalse; } /* * Document-method: Curses.init_pair * call-seq: init_pair(pair, f, b) * * Changes the definition of a color-pair. * * It takes three arguments: the number of the color-pair to be changed +pair+, * the foreground color number +f+, and the background color number +b+. * * If the color-pair was previously initialized, the screen is * refreshed and all occurrences of that color-pair are changed * to the new definition. * */ static VALUE curses_init_pair(VALUE obj, VALUE pair, VALUE f, VALUE b) { /* may have to raise exception on ERR */ curses_stdscr(); return (init_pair(NUM2INT(pair),NUM2INT(f),NUM2INT(b)) == OK) ? Qtrue : Qfalse; } /* * Document-method: Curses.init_color * call-seq: init_color(color, r, g, b) * * Changes the definition of a color. It takes four arguments: * * the number of the color to be changed, +color+ * * the amount of red, +r+ * * the amount of green, +g+ * * the amount of blue, +b+ * * The value of the first argument must be between 0 and COLORS. * (See the section Colors for the default color index.) Each * of the last three arguments must be a value between 0 and 1000. * When Curses.init_color is used, all occurrences of that color * on the screen immediately change to the new definition. */ static VALUE curses_init_color(VALUE obj, VALUE color, VALUE r, VALUE g, VALUE b) { /* may have to raise exception on ERR */ curses_stdscr(); return (init_color(NUM2INT(color),NUM2INT(r), NUM2INT(g),NUM2INT(b)) == OK) ? Qtrue : Qfalse; } /* * Document-method: Curses.has_colors? * * Returns +true+ or +false+ depending on whether the terminal has color capabilities. */ static VALUE curses_has_colors(VALUE obj) { curses_stdscr(); return has_colors() ? Qtrue : Qfalse; } /* * Document-method: Curses.can_change_color? * * Returns +true+ or +false+ depending on whether the terminal can change color attributes */ static VALUE curses_can_change_color(VALUE obj) { curses_stdscr(); return can_change_color() ? Qtrue : Qfalse; } #if defined(HAVE_COLORS) || defined(COLORS) /* * Document-method: Curses.colors * * returns COLORS */ static VALUE curses_colors(VALUE obj) { return INT2FIX(COLORS); } #else #define curses_colors rb_f_notimplement #endif /* * Document-method: Curses.color_content * call-seq: color_content(color) * * Returns an 3 item Array of the RGB values in +color+ */ static VALUE curses_color_content(VALUE obj, VALUE color) { short r,g,b; curses_stdscr(); color_content(NUM2INT(color),&r,&g,&b); return rb_ary_new3(3,INT2FIX(r),INT2FIX(g),INT2FIX(b)); } #if defined(HAVE_COLOR_PAIRS) || defined(COLOR_PAIRS) /* * Document-method: Curses.color_pairs * * Returns the COLOR_PAIRS available, if the curses library supports it. */ static VALUE curses_color_pairs(VALUE obj) { return INT2FIX(COLOR_PAIRS); } #else #define curses_color_pairs rb_f_notimplement #endif /* * Document-method: Curses.pair_content * call-seq: pair_content(pair) * * Returns a 2 item Array, with the foreground and * background color, in +pair+ */ static VALUE curses_pair_content(VALUE obj, VALUE pair) { short f,b; curses_stdscr(); pair_content(NUM2INT(pair),&f,&b); return rb_ary_new3(2,INT2FIX(f),INT2FIX(b)); } /* * Document-method: Curses.color_pair * call-seq: color_pair(attrs) * * Sets the color pair attributes to +attrs+. * * This should be equivalent to Curses.attrset(COLOR_PAIR(+attrs+)) * * TODO: validate that equivalency */ static VALUE curses_color_pair(VALUE obj, VALUE attrs) { return INT2FIX(COLOR_PAIR(NUM2INT(attrs))); } /* * Document-method: Curses.pair_number * call-seq: pair_number(attrs) * * Returns the Fixnum color pair number of attributes +attrs+. */ static VALUE curses_pair_number(VALUE obj, VALUE attrs) { curses_stdscr(); return INT2FIX(PAIR_NUMBER(NUM2LONG(attrs))); } #endif /* USE_COLOR */ #ifdef USE_MOUSE struct mousedata { MEVENT *mevent; }; NORETURN(static void no_mevent(void)); static void no_mevent(void) { rb_raise(rb_eRuntimeError, "no such mouse event"); } #define GetMOUSE(obj, data) do {\ TypedData_Get_Struct((obj), struct mousedata, &mousedata_type, (data));\ if ((data)->mevent == 0) no_mevent();\ } while (0) static void curses_mousedata_free(void *p) { struct mousedata *mdata = p; if (mdata->mevent) xfree(mdata->mevent); } static size_t curses_mousedata_memsize(const void *p) { const struct mousedata *mdata = p; size_t size = sizeof(*mdata); if (!mdata) return 0; if (mdata->mevent) size += CURSES_SIZEOF_MEVENT; return size; } static const rb_data_type_t mousedata_type = { "mousedata", {0, curses_mousedata_free, curses_mousedata_memsize,} }; /* * Document-method: Curses.getmouse * * Returns coordinates of the mouse. * * This will read and pop the mouse event data off the queue * * See the BUTTON*, ALL_MOUSE_EVENTS and REPORT_MOUSE_POSITION constants, to examine the mask of the event */ static VALUE curses_getmouse(VALUE obj) { struct mousedata *mdata; VALUE val; curses_stdscr(); val = TypedData_Make_Struct(cMouseEvent,struct mousedata, &mousedata_type,mdata); mdata->mevent = (MEVENT*)xmalloc(sizeof(MEVENT)); return (getmouse(mdata->mevent) == OK) ? val : Qnil; } /* * Document-method: Curses.ungetmouse * * It pushes a KEY_MOUSE event onto the input queue, and associates with that * event the given state data and screen-relative character-cell coordinates. * * The Curses.ungetmouse function behaves analogously to Curses.ungetch. */ static VALUE curses_ungetmouse(VALUE obj, VALUE mevent) { struct mousedata *mdata; curses_stdscr(); GetMOUSE(mevent,mdata); return (ungetmouse(mdata->mevent) == OK) ? Qtrue : Qfalse; } /* * Document-method: Curses.mouseinterval * call-seq: mouseinterval(interval) * * The Curses.mouseinterval function sets the maximum time * (in thousands of a second) that can elapse between press * and release events for them to be recognized as a click. * * Use Curses.mouseinterval(0) to disable click resolution. * This function returns the previous interval value. * * Use Curses.mouseinterval(-1) to obtain the interval without * altering it. * * The default is one sixth of a second. */ static VALUE curses_mouseinterval(VALUE obj, VALUE interval) { curses_stdscr(); return mouseinterval(NUM2INT(interval)) ? Qtrue : Qfalse; } /* * Document-method: Curses.mousemask * call-seq: mousemask(mask) * * Returns the +mask+ of the reportable events */ static VALUE curses_mousemask(VALUE obj, VALUE mask) { curses_stdscr(); return ULONG2NUM(mousemask(NUM2UINT(mask),NULL)); } #define DEFINE_MOUSE_GET_MEMBER(func_name,mem) \ static VALUE func_name (VALUE mouse) \ { \ struct mousedata *mdata; \ GetMOUSE(mouse, mdata); \ return (UINT2NUM(mdata->mevent -> mem)); \ } /* * Document-method: Curses::MouseEvent.eid * * Returns the current mouse id */ DEFINE_MOUSE_GET_MEMBER(curs_mouse_id, id) /* * Document-method: Curses::MouseEvent.x * * Returns the current mouse's X coordinate */ DEFINE_MOUSE_GET_MEMBER(curs_mouse_x, x) /* * Document-method: Curses::MouseEvent.y * * Returns the current mouse's Y coordinate */ DEFINE_MOUSE_GET_MEMBER(curs_mouse_y, y) /* * Document-method: Curses::MouseEvent.z * * Returns the current mouse's Z coordinate */ DEFINE_MOUSE_GET_MEMBER(curs_mouse_z, z) /* * Document-method: Curses::MouseEvent.bstate * * Returns the current mouse's button state. Use this with the button state * constants to determine which buttons were pressed. */ static VALUE curs_mouse_bstate(VALUE mouse) { struct mousedata *mdata; GetMOUSE(mouse, mdata); return ULONG2NUM(mdata->mevent->bstate); } #undef define_curs_mouse_member #endif /* USE_MOUSE */ #ifdef HAVE_TIMEOUT /* * Document-method: Curses.timeout= * call-seq: timeout=(delay) * * Sets block and non-blocking reads for the window. * - If delay is negative, blocking read is used (i.e., waits indefinitely for input). * - If delay is zero, then non-blocking read is used (i.e., read returns ERR if no input is waiting). * - If delay is positive, then read blocks for delay milliseconds, and returns ERR if there is still no input. * */ static VALUE curses_timeout(VALUE obj, VALUE delay) { curses_stdscr(); timeout(NUM2INT(delay)); return Qnil; } #else #define curses_timeout rb_f_notimplement #endif #ifdef HAVE_DEF_PROG_MODE /* * Document-method: Curses.def_prog_mode * * Save the current terminal modes as the "program" * state for use by the Curses.reset_prog_mode * * This is done automatically by Curses.init_screen */ static VALUE curses_def_prog_mode(VALUE obj) { curses_stdscr(); return def_prog_mode() == OK ? Qtrue : Qfalse; } #else #define curses_def_prog_mode rb_f_notimplement #endif #ifdef HAVE_RESET_PROG_MODE /* * Document-method: Curses.reset_prog_mode * * Reset the current terminal modes to the saved state * by the Curses.def_prog_mode * * This is done automatically by Curses.close_screen */ static VALUE curses_reset_prog_mode(VALUE obj) { curses_stdscr(); return reset_prog_mode() == OK ? Qtrue : Qfalse; } #else #define curses_reset_prog_mode rb_f_notimplement #endif /*-------------------------- class Window --------------------------*/ /* returns a Curses::Window object */ static VALUE window_s_allocate(VALUE class) { struct windata *winp; return TypedData_Make_Struct(class, struct windata, &windata_type, winp); } /* * Document-method: Curses::Window.new * call-seq: new(height, width, top, left) * * Construct a new Curses::Window with constraints of * +height+ lines, +width+ columns, begin at +top+ line, and begin +left+ most column. * * A new window using full screen is called as * Curses::Window.new(0,0,0,0) * */ static VALUE window_initialize(VALUE obj, VALUE h, VALUE w, VALUE top, VALUE left) { struct windata *winp; WINDOW *window; curses_init_screen(Qnil); TypedData_Get_Struct(obj, struct windata, &windata_type, winp); if (winp->window) delwin(winp->window); window = newwin(NUM2INT(h), NUM2INT(w), NUM2INT(top), NUM2INT(left)); wclear(window); winp->window = window; return obj; } /* * Document-method: Curses::Window.subwin * call-seq: subwin(height, width, top, left) * * Construct a new subwindow with constraints of * +height+ lines, +width+ columns, begin at +top+ line, and begin +left+ most column. * */ static VALUE window_subwin(VALUE obj, VALUE height, VALUE width, VALUE top, VALUE left) { struct windata *winp; WINDOW *window; VALUE win; int h, w, t, l; h = NUM2INT(height); w = NUM2INT(width); t = NUM2INT(top); l = NUM2INT(left); GetWINDOW(obj, winp); window = subwin(winp->window, h, w, t, l); win = prep_window(rb_obj_class(obj), window); return win; } #ifdef HAVE_DERWIN /* * Document-method: Curses::Window.derwin * call-seq: derwin(height, width, relative_top, relative_left) * * Construct a new subwindow with constraints of * +height+ lines, +width+ columns, begin at +top+ line, and begin +left+ most column * relative to the parent window. * */ static VALUE window_derwin(VALUE obj, VALUE height, VALUE width, VALUE top, VALUE left) { struct windata *winp; WINDOW *window; VALUE win; int h, w, t, l; h = NUM2INT(height); w = NUM2INT(width); t = NUM2INT(top); l = NUM2INT(left); GetWINDOW(obj, winp); window = derwin(winp->window, h, w, t, l); win = prep_window(rb_obj_class(obj), window); return win; } #else #define window_derwin rb_f_notimplement #endif /* * Document-method: Curses::Window.close * * Deletes the window, and frees the memory */ static VALUE window_close(VALUE obj) { struct windata *winp; GetWINDOW(obj, winp); delwin(winp->window); winp->window = 0; return Qnil; } /* * Document-method: Curses::Window.clear * * Clear the window. */ static VALUE window_clear(VALUE obj) { struct windata *winp; GetWINDOW(obj, winp); wclear(winp->window); return Qnil; } #ifdef HAVE_WERASE /* * Document-method: Curses::Window.erase * * Erase the window. */ static VALUE window_erase(VALUE obj) { struct windata *winp; GetWINDOW(obj, winp); werase(winp->window); return Qnil; } #else #define curses_erase rb_f_notimplement #endif /* * Document-method: Curses::Window.clrtoeol * * Clear the window to the end of line, that the cursor is currently on. */ static VALUE window_clrtoeol(VALUE obj) { struct windata *winp; GetWINDOW(obj, winp); wclrtoeol(winp->window); return Qnil; } /* * Document-method: Curses::Window.refresh * * Refreshes the windows and lines. * */ static VALUE window_refresh(VALUE obj) { struct windata *winp; GetWINDOW(obj, winp); wrefresh(winp->window); return Qnil; } /* * Document-method: Curses::Window.noutrefresh * * Refreshes the windows and lines. * * Curses::Window.noutrefresh allows multiple updates with * more efficiency than Curses::Window.refresh alone. */ static VALUE window_noutrefresh(VALUE obj) { struct windata *winp; GetWINDOW(obj, winp); #ifdef HAVE_DOUPDATE wnoutrefresh(winp->window); #else wrefresh(winp->window); #endif return Qnil; } #ifdef HAVE_REDRAWWIN /* * Document-method: Curses::Window.redraw * * Redraws the entire window. */ static VALUE window_redraw(VALUE obj) { struct windata *winp; GetWINDOW(obj, winp); redrawwin(winp->window); return Qnil; } #else #define window_redraw rb_f_notimplement #endif #ifdef HAVE_TOUCHWIN /* * Document-method: Curses::Window.touch * * Treat the window as if it has been modified since the last call of refresh. */ static VALUE window_touch(VALUE obj) { struct windata *winp; GetWINDOW(obj, winp); touchwin(winp->window); return Qnil; } #else #define window_touch rb_f_notimplement #endif #ifdef HAVE_UNTOUCHWIN /* * Document-method: Curses::Window.untouch * * Treat the window as if it has not been modified since the last call of * refresh. */ static VALUE window_untouch(VALUE obj) { struct windata *winp; GetWINDOW(obj, winp); untouchwin(winp->window); return Qnil; } #else #define window_touch rb_f_notimplement #endif #ifdef HAVE_IS_WINTOUCHED /* * Document-method: Curses::Window.touched? * * Return true if the window has been modified since the last call of refresh. */ static VALUE window_touched(VALUE obj) { struct windata *winp; GetWINDOW(obj, winp); return is_wintouched(winp->window) ? Qtrue : Qfalse; } #else #define window_touched rb_f_notimplement #endif #ifdef HAVE_WTOUCHLN /* * Document-method: Curses::Window.touch_line * call-seq: touch_line(y, n, changed = true) * * Make n lines from line y look as if they have (changed = true) or have not * (changed = false) been modified since the last call of refresh. */ static VALUE window_touch_line(int argc, VALUE *argv, VALUE obj) { struct windata *winp; VALUE y, n, changed; int result; rb_scan_args(argc, argv, "12", &y, &n, &changed); if (argc < 2) { n = INT2NUM(1); } if (argc < 3) { changed = Qtrue; } GetWINDOW(obj, winp); result = wtouchln(winp->window, NUM2INT(y), NUM2INT(n), RTEST(changed)); if (result == ERR) { rb_raise(rb_eRangeError, "Out of window"); } return Qnil; } #else #define window_touch_line rb_f_notimplement #endif #ifdef HAVE_IS_LINETOUCHED /* * Document-method: Curses::Window.line_touched? * call-seq: line_touched?(line) * * Return true if the specified line has been modified since the last call of * refresh. */ static VALUE window_line_touched(VALUE obj, VALUE line) { struct windata *winp; int result, n; GetWINDOW(obj, winp); n = NUM2INT(line); result = is_linetouched(winp->window, n); if (result == ERR) { rb_raise(rb_eArgError, "Invalid line %d", n); } return result ? Qtrue : Qfalse; } #else #define window_line_touched rb_f_notimplement #endif /* * Document-method: Curses::Window.move * call-seq: move(y,x) * * Moves the window so that the upper left-hand corner is at position (+y+, +x+) */ static VALUE window_move(VALUE obj, VALUE y, VALUE x) { struct windata *winp; GetWINDOW(obj, winp); mvwin(winp->window, NUM2INT(y), NUM2INT(x)); return Qnil; } #ifdef HAVE_MVDERWIN /* * Document-method: Curses::Window.move_relative * call-seq: move_relative(x,y) * * Moves the derived or subwindow inside its parent window. The screen-relative * parameters of the window are not changed. */ static VALUE window_move_relative(VALUE obj, VALUE y, VALUE x) { struct windata *winp; GetWINDOW(obj, winp); mvderwin(winp->window, NUM2INT(y), NUM2INT(x)); return Qnil; } #else #define window_move_relative rb_f_notimplement #endif /* * Document-method: Curses::Window.setpos * call-seq: setpos(y, x) * * A setter for the position of the cursor * in the current window, * using coordinates +x+ and +y+ * */ static VALUE window_setpos(VALUE obj, VALUE y, VALUE x) { struct windata *winp; GetWINDOW(obj, winp); wmove(winp->window, NUM2INT(y), NUM2INT(x)); return Qnil; } /* * Document-method: Curses::Window.cury * * A getter for the current line (Y coord) of the window */ static VALUE window_cury(VALUE obj) { struct windata *winp; int RB_UNUSED_VAR(x), y; GetWINDOW(obj, winp); getyx(winp->window, y, x); return INT2FIX(y); } /* * Document-method: Curses::Window.curx * * A getter for the current column (X coord) of the window */ static VALUE window_curx(VALUE obj) { struct windata *winp; int x, RB_UNUSED_VAR(y); GetWINDOW(obj, winp); getyx(winp->window, y, x); return INT2FIX(x); } /* * Document-method: Curses::Window.maxy * * A getter for the maximum lines for the window */ static VALUE window_maxy(VALUE obj) { struct windata *winp; GetWINDOW(obj, winp); #if defined(getmaxy) return INT2FIX(getmaxy(winp->window)); #elif defined(getmaxyx) { int RB_UNUSED_VAR(x), y; getmaxyx(winp->window, y, x); return INT2FIX(y); } #else return INT2FIX(winp->window->_maxy+1); #endif } /* * Document-method: Curses::Window.maxx * * A getter for the maximum columns for the window */ static VALUE window_maxx(VALUE obj) { struct windata *winp; GetWINDOW(obj, winp); #if defined(getmaxx) return INT2FIX(getmaxx(winp->window)); #elif defined(getmaxyx) { int x, RB_UNUSED_VAR(y); getmaxyx(winp->window, y, x); return INT2FIX(x); } #else return INT2FIX(winp->window->_maxx+1); #endif } /* * Document-method: Curses::Window.begy * * A getter for the beginning line (Y coord) of the window */ static VALUE window_begy(VALUE obj) { struct windata *winp; int RB_UNUSED_VAR(x), y; GetWINDOW(obj, winp); #ifdef getbegyx getbegyx(winp->window, y, x); #else y = winp->window->_begy; #endif return INT2FIX(y); } /* * Document-method: Curses::Window.begx * * A getter for the beginning column (X coord) of the window */ static VALUE window_begx(VALUE obj) { struct windata *winp; int x, RB_UNUSED_VAR(y); GetWINDOW(obj, winp); #ifdef getbegyx getbegyx(winp->window, y, x); #else x = winp->window->_begx; #endif return INT2FIX(x); } /* * Document-method: Curses::Window.box * call-seq: box(vert = nil, hor = nil, corn = nil) * * set the characters to frame the window in. * The vertical +vert+ and horizontal +hor+ character. * * win = Curses::Window.new(5,5,5,5) * win.box(?|, ?-) * */ static VALUE window_box(int argc, VALUE *argv, VALUE self) { struct windata *winp; VALUE vert, hor, corn; rb_scan_args(argc, argv, "03", &vert, &hor, &corn); GetWINDOW(self, winp); box(winp->window, NIL_P(vert) ? 0 : OBJ2CHTYPE(vert), NIL_P(hor) ? 0 : OBJ2CHTYPE(hor)); if (!NIL_P(corn)) { int cur_x, cur_y, x, y; chtype c; c = OBJ2CHTYPE(corn); getyx(winp->window, cur_y, cur_x); x = NUM2INT(window_maxx(self)) - 1; y = NUM2INT(window_maxy(self)) - 1; wmove(winp->window, 0, 0); waddch(winp->window, c); wmove(winp->window, y, 0); waddch(winp->window, c); wmove(winp->window, y, x); waddch(winp->window, c); wmove(winp->window, 0, x); waddch(winp->window, c); wmove(winp->window, cur_y, cur_x); } return Qnil; } /* * Document-method: Curses::Window.standout * * Enables the best highlighting mode of the terminal. * * This is equivalent to Curses::Window.attron(A_STANDOUT) * * see also Curses::Window.attrset */ static VALUE window_standout(VALUE obj) { struct windata *winp; GetWINDOW(obj, winp); wstandout(winp->window); return Qnil; } /* * Document-method: Curses::Window.standend * * Enables the Normal display (no highlight) * * This is equivalent to Curses::Window.attron(A_NORMAL) * * see also Curses::Window.attrset */ static VALUE window_standend(VALUE obj) { struct windata *winp; GetWINDOW(obj, winp); wstandend(winp->window); return Qnil; } /* * Document-method: Curses::Window.inch * * Returns the character at the current position of the window. */ static VALUE window_inch(VALUE obj) { struct windata *winp; GetWINDOW(obj, winp); return CHTYPE2NUM(winch(winp->window)); } /* * Document-method: Curses::Window.addch * call-seq: addch(ch) * * Add a character +ch+, with attributes, to the window, then advance the cursor. * * see also the system manual for curs_addch(3) */ static VALUE window_addch(VALUE obj, VALUE ch) { struct windata *winp; GetWINDOW(obj, winp); waddch(winp->window, OBJ2CHTYPE(ch)); return Qnil; } /* * Document-method: Curses::Window.insch * call-seq: insch(ch) * * Insert a character +ch+, before the cursor, in the current window * */ static VALUE window_insch(VALUE obj, VALUE ch) { struct windata *winp; GetWINDOW(obj, winp); winsch(winp->window, OBJ2CHTYPE(ch)); return Qnil; } /* * Document-method: Curses::Window.addstr * call-seq: addstr(str) * * add a string of characters +str+, to the window and advance cursor * */ static VALUE window_addstr(VALUE obj, VALUE str) { if (!NIL_P(str)) { struct windata *winp; StringValue(str); #if defined(HAVE_WADDNWSTR) && defined(_WIN32) str = rb_str_export_to_enc(str, get_wide_encoding()); GetWINDOW(obj, winp); waddnwstr(winp->window, (wchar_t *)RSTRING_PTR(str), RSTRING_LEN(str) / sizeof(wchar_t)); #else str = rb_str_export_to_enc(str, terminal_encoding); GetWINDOW(obj, winp); waddstr(winp->window, StringValueCStr(str)); #endif } return Qnil; } /* * Document-method: Curses::Window.<< * * call-seq: * <<(str) * * Add String +str+ to the current string. * * See also Curses::Window.addstr */ static VALUE window_addstr2(VALUE obj, VALUE str) { window_addstr(obj, str); return obj; } struct wgetch_arg { WINDOW *win; int c; }; static void * wgetch_func(void *_arg) { struct wgetch_arg *arg = (struct wgetch_arg *)_arg; arg->c = wgetch(arg->win); return 0; } /* * Document-method: Curses::Window.getch * * Read and returns a character from the window. * * See Curses::Key to all the function KEY_* available * */ static VALUE window_getch(VALUE obj) { struct windata *winp; struct wgetch_arg arg; int c; GetWINDOW(obj, winp); arg.win = winp->window; rb_thread_call_without_gvl(wgetch_func, (void *)&arg, RUBY_UBF_IO, 0); c = arg.c; if (c == EOF) return Qnil; if (rb_isprint(c)) { char ch = (char)c; return rb_external_str_new_with_enc(&ch, 1, keyboard_encoding); } return UINT2NUM(c); } struct wgetstr_arg { WINDOW *win; char rtn[GETSTR_BUF_SIZE]; }; static void * wgetstr_func(void *_arg) { struct wgetstr_arg *arg = (struct wgetstr_arg *)_arg; #if defined(HAVE_WGETNSTR) wgetnstr(arg->win, arg->rtn, GETSTR_BUF_SIZE-1); #else wgetstr(arg->win, arg->rtn); #endif return 0; } /* * Document-method: Curses::Window.getstr * * This is equivalent to a series of Curses::Window.getch calls * */ static VALUE window_getstr(VALUE obj) { struct windata *winp; struct wgetstr_arg arg; GetWINDOW(obj, winp); arg.win = winp->window; rb_thread_call_without_gvl(wgetstr_func, (void *)&arg, RUBY_UBF_IO, 0); return rb_external_str_new_with_enc(arg.rtn, strlen(arg.rtn), keyboard_encoding); } /* * Document-method: Curses::Window.delch * * Delete the character under the cursor * */ static VALUE window_delch(VALUE obj) { struct windata *winp; GetWINDOW(obj, winp); wdelch(winp->window); return Qnil; } /* * Document-method: Curses::Window.deleteln * * Delete the line under the cursor. * */ static VALUE window_deleteln(VALUE obj) { #if defined(HAVE_WDELETELN) || defined(wdeleteln) struct windata *winp; GetWINDOW(obj, winp); wdeleteln(winp->window); #endif return Qnil; } /* * Document-method: Curses::Window.insertln * * Inserts a line above the cursor, and the bottom line is lost * */ static VALUE window_insertln(VALUE obj) { #if defined(HAVE_WINSERTLN) || defined(winsertln) struct windata *winp; GetWINDOW(obj, winp); winsertln(winp->window); #endif return Qnil; } /* * Document-method: Curses::Window.scrollok * call-seq: scrollok(bool) * * Controls what happens when the cursor of a window * is moved off the edge of the window or scrolling region, * either as a result of a newline action on the bottom line, * or typing the last character of the last line. * * If disabled, (+bool+ is false), the cursor is left on the bottom line. * * If enabled, (+bool+ is true), the window is scrolled up one line * (Note that to get the physical scrolling effect on the terminal, * it is also necessary to call Curses::Window.idlok) */ static VALUE window_scrollok(VALUE obj, VALUE bf) { struct windata *winp; GetWINDOW(obj, winp); scrollok(winp->window, RTEST(bf) ? TRUE : FALSE); return Qnil; } /* * Document-method: Curses::Window.idlok * call-seq: idlok(bool) * * If +bool+ is +true+ curses considers using the hardware insert/delete * line feature of terminals so equipped. * * If +bool+ is +false+, disables use of line insertion and deletion. * This option should be enabled only if the application needs insert/delete * line, for example, for a screen editor. * * It is disabled by default because insert/delete line tends to be visually * annoying when used in applications where it is not really needed. * If insert/delete line cannot be used, curses redraws the changed portions of all lines. * */ static VALUE window_idlok(VALUE obj, VALUE bf) { struct windata *winp; GetWINDOW(obj, winp); idlok(winp->window, RTEST(bf) ? TRUE : FALSE); return Qnil; } /* * Document-method: Curses::Window.setscrreg * call-seq: * setscrreg(top, bottom) * * Set a software scrolling region in a window. * +top+ and +bottom+ are lines numbers of the margin. * * If this option and Curses::Window.scrollok are enabled, an attempt to move * off the bottom margin line causes all lines in the scrolling region to * scroll one line in the direction of the first line. Only the text of the * window is scrolled. * */ static VALUE window_setscrreg(VALUE obj, VALUE top, VALUE bottom) { #ifdef HAVE_WSETSCRREG struct windata *winp; int res; GetWINDOW(obj, winp); res = wsetscrreg(winp->window, NUM2INT(top), NUM2INT(bottom)); /* may have to raise exception on ERR */ return (res == OK) ? Qtrue : Qfalse; #else return Qfalse; #endif } #if defined(USE_COLOR) && defined(HAVE_WCOLOR_SET) /* * Document-method: Curses::Window.color_set * call-seq: color_set(col) * * Sets the current color of the given window to the * foreground/background combination described by the Fixnum +col+. */ static VALUE window_color_set(VALUE obj, VALUE col) { struct windata *winp; int res; GetWINDOW(obj, winp); res = wcolor_set(winp->window, NUM2INT(col), NULL); return (res == OK) ? Qtrue : Qfalse; } #endif /* defined(USE_COLOR) && defined(HAVE_WCOLOR_SET) */ /* * Document-method: Curses::Window.scroll * * Scrolls the current window up one line. */ static VALUE window_scroll(VALUE obj) { struct windata *winp; GetWINDOW(obj, winp); /* may have to raise exception on ERR */ return (scroll(winp->window) == OK) ? Qtrue : Qfalse; } /* * Document-method: Curses::Window.scrl * call-seq: scrl(num) * * Scrolls the current window Fixnum +num+ lines. * The current cursor position is not changed. * * For positive +num+, it scrolls up. * * For negative +num+, it scrolls down. * */ static VALUE window_scrl(VALUE obj, VALUE n) { #ifdef HAVE_WSCRL struct windata *winp; GetWINDOW(obj, winp); /* may have to raise exception on ERR */ return (wscrl(winp->window,NUM2INT(n)) == OK) ? Qtrue : Qfalse; #else return Qfalse; #endif } /* * Document-method: Curses::Window.attroff * call-seq: attroff(attrs) * * Turns off the named attributes +attrs+ * without affecting any others. * * See also Curses::Window.attrset */ static VALUE window_attroff(VALUE obj, VALUE attrs) { #ifdef HAVE_WATTROFF struct windata *winp; GetWINDOW(obj,winp); return INT2FIX(wattroff(winp->window,NUM2INT(attrs))); #else return Qtrue; #endif } /* * Document-method: Curses::Window.attron * call-seq: attron(attrs) * * Turns on the named attributes +attrs+ * without turning any other attributes on or off. * * See also Curses::Window.attrset */ static VALUE window_attron(VALUE obj, VALUE attrs) { #ifdef HAVE_WATTRON struct windata *winp; VALUE val; GetWINDOW(obj,winp); val = INT2FIX(wattron(winp->window,NUM2INT(attrs))); if (rb_block_given_p()) { rb_yield(val); wattroff(winp->window,NUM2INT(attrs)); return val; } else{ return val; } #else return Qtrue; #endif } /* * Document-method: Curses::Window.attrset * call-seq: attrset(attrs) * * Sets the current attributes of the given window to +attrs+. * * The following video attributes, defined in , can * be passed to the routines Curses::Window.attron, Curses::Window.attroff, * and Curses::Window.attrset, or OR'd with the characters passed to addch. * A_NORMAL Normal display (no highlight) * A_STANDOUT Best highlighting mode of the terminal. * A_UNDERLINE Underlining * A_REVERSE Reverse video * A_BLINK Blinking * A_DIM Half bright * A_BOLD Extra bright or bold * A_PROTECT Protected mode * A_INVIS Invisible or blank mode * A_ALTCHARSET Alternate character set * A_CHARTEXT Bit-mask to extract a character * COLOR_PAIR(n) Color-pair number n * * TODO: provide some examples here. * * see also system manual curs_attr(3) */ static VALUE window_attrset(VALUE obj, VALUE attrs) { #ifdef HAVE_WATTRSET struct windata *winp; GetWINDOW(obj,winp); return INT2FIX(wattrset(winp->window,NUM2INT(attrs))); #else return Qtrue; #endif } /* * Document-method: Curses::Window.bkgdset * call-seq: bkgdset(ch) * * Manipulate the background of the current window * with character Integer +ch+ * * see also Curses.bkgdset */ static VALUE window_bkgdset(VALUE obj, VALUE ch) { #ifdef HAVE_WBKGDSET struct windata *winp; GetWINDOW(obj,winp); wbkgdset(winp->window, OBJ2CHTYPE(ch)); #endif return Qnil; } /* * Document-method: Curses::Window.bkgd * call-seq: bkgd(ch) * * Set the background of the current window * and apply character Integer +ch+ to every character. * * see also Curses.bkgd */ static VALUE window_bkgd(VALUE obj, VALUE ch) { #ifdef HAVE_WBKGD struct windata *winp; GetWINDOW(obj,winp); return (wbkgd(winp->window, OBJ2CHTYPE(ch)) == OK) ? Qtrue : Qfalse; #else return Qfalse; #endif } /* * Document-method: Curses::Window.getbkgd * * Returns an Integer (+ch+) for the character property in the current window. */ static VALUE window_getbkgd(VALUE obj) { #ifdef HAVE_WGETBKGD chtype c; struct windata *winp; GetWINDOW(obj,winp); return (c = getbkgd(winp->window) != ERR) ? ULONG2NUM(c) : Qnil; #else return Qnil; #endif } /* * Document-method: Curses::Window.resize * call-seq: resize(lines, cols) * * Resize the current window to Fixnum +lines+ and Fixnum +cols+ * */ static VALUE window_resize(VALUE obj, VALUE lin, VALUE col) { #if defined(HAVE_WRESIZE) struct windata *winp; GetWINDOW(obj,winp); return wresize(winp->window, NUM2INT(lin), NUM2INT(col)) == OK ? Qtrue : Qfalse; #else return Qnil; #endif } #ifdef HAVE_KEYPAD /* * Document-method: Curses::Window.keypad= * call-seq: * keypad=(bool) * * See Curses::Window.keypad */ /* * Document-method: Curses::Window.keypad * call-seq: * keypad(bool) * * Enables the keypad of the user's terminal. * * If enabled (+bool+ is +true+), the user can press a function key * (such as an arrow key) and wgetch returns a single value representing * the function key, as in KEY_LEFT. If disabled (+bool+ is +false+), * curses does not treat function keys specially and the program has to * interpret the escape sequences itself. If the keypad in the terminal * can be turned on (made to transmit) and off (made to work locally), * turning on this option causes the terminal keypad to be turned on when * Curses::Window.getch is called. * * The default value for keypad is false. * */ static VALUE window_keypad(VALUE obj, VALUE val) { struct windata *winp; GetWINDOW(obj,winp); /* keypad() of NetBSD's libcurses returns no value */ #if defined(__NetBSD__) && !defined(NCURSES_VERSION) keypad(winp->window,(RTEST(val) ? TRUE : FALSE)); return Qnil; #else /* may have to raise exception on ERR */ return (keypad(winp->window,RTEST(val) ? TRUE : FALSE)) == OK ? Qtrue : Qfalse; #endif } #else #define window_keypad rb_f_notimplement #endif #ifdef HAVE_NODELAY /* * Document-method: Curses::Window.nodelay * call-seq: * window.nodelay = bool * * When in no-delay mode Curses::Window#getch is a non-blocking call. If no * input is ready #getch returns ERR. * * When in delay mode (+bool+ is +false+ which is the default), * Curses::Window#getch blocks until a key is pressed. * */ static VALUE window_nodelay(VALUE obj, VALUE val) { struct windata *winp; GetWINDOW(obj,winp); /* nodelay() of NetBSD's libcurses returns no value */ #if defined(__NetBSD__) && !defined(NCURSES_VERSION) nodelay(winp->window, RTEST(val) ? TRUE : FALSE); return Qnil; #else return nodelay(winp->window,RTEST(val) ? TRUE : FALSE) == OK ? Qtrue : Qfalse; #endif } #else #define window_nodelay rb_f_notimplement #endif #ifdef HAVE_WTIMEOUT /* * Document-method: Curses::Window.timeout= * call-seq: timeout=(delay) * * Sets block and non-blocking reads for the window. * - If delay is negative, blocking read is used (i.e., waits indefinitely for input). * - If delay is zero, then non-blocking read is used (i.e., read returns ERR if no input is waiting). * - If delay is positive, then read blocks for delay milliseconds, and returns ERR if there is still no input. * */ static VALUE window_timeout(VALUE obj, VALUE delay) { struct windata *winp; GetWINDOW(obj,winp); wtimeout(winp->window,NUM2INT(delay)); return Qnil; } #else #define window_timeout rb_f_notimplement #endif /*--------------------------- class Pad ----------------------------*/ #ifdef HAVE_NEWPAD /* * Document-method: Curses::Pad.new * * call-seq: * new(height, width) * * Construct a new Curses::Pad with constraints of +height+ lines, +width+ * columns * */ static VALUE pad_initialize(VALUE obj, VALUE h, VALUE w) { struct windata *padp; WINDOW *window; curses_init_screen(Qnil); TypedData_Get_Struct(obj, struct windata, &windata_type, padp); if (padp->window) delwin(padp->window); window = newpad(NUM2INT(h), NUM2INT(w)); wclear(window); padp->window = window; return obj; } /* * Document-method: Curses::Pad.subpad * call-seq: * subpad(height, width, begin_x, begin_y) * * Construct a new subpad with constraints of +height+ lines, +width+ columns, * begin at +begin_x+ line, and +begin_y+ columns on the pad. * */ static VALUE pad_subpad(VALUE obj, VALUE height, VALUE width, VALUE begin_x, VALUE begin_y) { struct windata *padp; WINDOW *sub_pad; VALUE pad; int h, w, x, y; h = NUM2INT(height); w = NUM2INT(width); x = NUM2INT(begin_x); y = NUM2INT(begin_y); GetWINDOW(obj, padp); sub_pad = subpad(padp->window, h, w, x, y); pad = prep_window(rb_obj_class(obj), sub_pad); return pad; } /* * Document-method: Curses::Pad.refresh * * call-seq: * pad.refresh(pad_minrow, pad_mincol, screen_minrow, screen_mincol, screen_maxrow, screen_maxcol) * * Refreshes the pad. +pad_minrow+ and pad_mincol+ define the upper-left * corner of the rectangle to be displayed. +screen_minrow+, +screen_mincol+, * +screen_maxrow+, +screen_maxcol+ define the edges of the rectangle to be * displayed on the screen. * */ static VALUE pad_refresh(VALUE obj, VALUE pminrow, VALUE pmincol, VALUE sminrow, VALUE smincol, VALUE smaxrow, VALUE smaxcol) { struct windata *padp; int pmr, pmc, smr, smc, sxr, sxc; pmr = NUM2INT(pminrow); pmc = NUM2INT(pmincol); smr = NUM2INT(sminrow); smc = NUM2INT(smincol); sxr = NUM2INT(smaxrow); sxc = NUM2INT(smaxcol); GetWINDOW(obj, padp); prefresh(padp->window, pmr, pmc, smr, smc, sxr, sxc); return Qnil; } /* * Document-method: Curses::Pad.noutrefresh * * call-seq: * pad.noutrefresh(pad_minrow, pad_mincol, screen_minrow, screen_mincol, screen_maxrow, screen_maxcol) * * Refreshes the pad. +pad_minrow+ and pad_mincol+ define the upper-left * corner of the rectangle to be displayed. +screen_minrow+, +screen_mincol+, * +screen_maxrow+, +screen_maxcol+ define the edges of the rectangle to be * displayed on the screen. * */ static VALUE pad_noutrefresh(VALUE obj, VALUE pminrow, VALUE pmincol, VALUE sminrow, VALUE smincol, VALUE smaxrow, VALUE smaxcol) { struct windata *padp; int pmr, pmc, smr, smc, sxr, sxc; pmr = NUM2INT(pminrow); pmc = NUM2INT(pmincol); smr = NUM2INT(sminrow); smc = NUM2INT(smincol); sxr = NUM2INT(smaxrow); sxc = NUM2INT(smaxcol); GetWINDOW(obj, padp); #ifdef HAVE_DOUPDATE pnoutrefresh(padp->window, pmr, pmc, smr, smc, sxr, sxc); #else prefresh(padp->window, pmr, pmc, smr, smc, sxr, sxc); #endif return Qnil; } #endif /* HAVE_NEWPAD */ #ifdef HAVE_MENU /*--------------------------- class Item ----------------------------*/ struct itemdata { ITEM *item; }; static void no_item(void) { rb_raise(rb_eRuntimeError, "already deleted item"); } #define GetITEM(obj, itemp) do {\ TypedData_Get_Struct((obj), struct itemdata, &itemdata_type, (itemp));\ if ((itemp)->item == 0) no_item();\ } while (0) static void item_free(void *p) { struct itemdata *itemp = p; if (itemp->item) free_item(itemp->item); itemp->item = 0; xfree(itemp); } static size_t item_memsize(const void *p) { const struct itemdata *itemp = p; size_t size = sizeof(*itemp); if (!itemp) return 0; if (itemp->item) size += CURSES_SIZEOF_ITEM; return size; } static const rb_data_type_t itemdata_type = { "itemdata", {0, item_free, item_memsize,} }; /* returns a Curses::Item object */ static VALUE item_s_allocate(VALUE class) { struct itemdata *itemp; return TypedData_Make_Struct(class, struct itemdata, &itemdata_type, itemp); } /* * Document-method: Curses::Item.new * * call-seq: * new(name, description) * * Construct a new Curses::Item. */ static VALUE item_initialize(VALUE obj, VALUE name, VALUE description) { struct itemdata *itemp; curses_init_screen(Qnil); TypedData_Get_Struct(obj, struct itemdata, &itemdata_type, itemp); if (itemp->item) { rb_raise(rb_eRuntimeError, "already initialized item"); } name = rb_str_export_to_enc(name, terminal_encoding); description = rb_str_export_to_enc(description, terminal_encoding); itemp->item = new_item(StringValueCStr(name), StringValueCStr(description)); if (itemp->item == NULL) { check_curses_error(errno); } return obj; } static VALUE item_new(ITEM *item) { VALUE obj = item_s_allocate(cItem); struct itemdata *itemp; TypedData_Get_Struct(obj, struct itemdata, &itemdata_type, itemp); itemp->item = item; return obj; } static VALUE item_eq(VALUE obj, VALUE other) { struct itemdata *item1, *item2; GetITEM(obj, item1); GetITEM(other, item2); return item1->item == item2->item ? Qtrue : Qfalse; } static VALUE item_name_m(VALUE obj) { struct itemdata *itemp; const char *name; GetITEM(obj, itemp); name = item_name(itemp->item); return rb_external_str_new_with_enc(name, strlen(name), terminal_encoding); } static VALUE item_description_m(VALUE obj) { struct itemdata *itemp; const char *desc; GetITEM(obj, itemp); desc = item_description(itemp->item); return rb_external_str_new_with_enc(desc, strlen(desc), terminal_encoding); } /* * Document-method: Curses::Item#set_opts * * call-seq: * set_opts(opts) * * Set the option bits of the item. */ static VALUE item_set_opts(VALUE obj, VALUE opts) { struct itemdata *itemp; int error; GetITEM(obj, itemp); error = set_item_opts(itemp->item, NUM2INT(opts)); check_curses_error(error); return obj; } /* * Document-method: Curses::Item#opts_on * * call-seq: * opts_on(opts) * * Turn on the option bits of the item. */ static VALUE item_opts_on_m(VALUE obj, VALUE opts) { struct itemdata *itemp; int error; GetITEM(obj, itemp); error = item_opts_on(itemp->item, NUM2INT(opts)); check_curses_error(error); return obj; } /* * Document-method: Curses::Item#opts_off * * call-seq: * opts_off(opts) * * Turn off the option bits of the item. */ static VALUE item_opts_off_m(VALUE obj, VALUE opts) { struct itemdata *itemp; int error; GetITEM(obj, itemp); error = item_opts_off(itemp->item, NUM2INT(opts)); check_curses_error(error); return obj; } /* * Document-method: Curses::Item#opts * * call-seq: * opts * * Get the current option bits of the item. */ static VALUE item_opts_m(VALUE obj, VALUE opts) { struct itemdata *itemp; GetITEM(obj, itemp); return INT2NUM(item_opts(itemp->item)); } struct menudata { MENU *menu; VALUE items; }; static void no_menu(void) { rb_raise(rb_eRuntimeError, "already deleted menu"); } #define GetMENU(obj, menup) do {\ TypedData_Get_Struct((obj), struct menudata, &menudata_type, (menup));\ if ((menup)->menu == 0) no_menu();\ } while (0) static void menu_gc_mark(void *p) { struct menudata *menup = p; rb_gc_mark(menup->items); } static void menu_free(void *p) { struct menudata *menup = p; ITEM **items = menu_items(menup->menu); if (menup->menu) free_menu(menup->menu); xfree(items); menup->menu = 0; menup->items = Qnil; xfree(menup); } static size_t menu_memsize(const void *p) { const struct menudata *menup = p; size_t size = sizeof(*menup); if (!menup) return 0; if (menup->menu) size += CURSES_SIZEOF_MENU; return size; } static const rb_data_type_t menudata_type = { "menudata", {menu_gc_mark, menu_free, menu_memsize,} }; /* returns a Curses::Menu object */ static VALUE menu_s_allocate(VALUE class) { struct menudata *menup; return TypedData_Make_Struct(class, struct menudata, &menudata_type, menup); } /* * Document-method: Curses::Menu.new * * call-seq: * new(items) * * Construct a new Curses::Menu. */ static VALUE menu_initialize(VALUE obj, VALUE items) { struct menudata *menup; ITEM **menu_items; int i; ID id_new; Check_Type(items, T_ARRAY); curses_init_screen(Qnil); TypedData_Get_Struct(obj, struct menudata, &menudata_type, menup); if (menup->menu) { rb_raise(rb_eRuntimeError, "already initialized menu"); } menup->items = rb_ary_new(); menu_items = ALLOC_N(ITEM *, RARRAY_LEN(items) + 1); CONST_ID(id_new, "new"); for (i = 0; i < RARRAY_LEN(items); i++) { VALUE item = RARRAY_AREF(items, i); struct itemdata *itemp; if (RB_TYPE_P(item, T_ARRAY)) { item = rb_apply(cItem, id_new, item); } GetITEM(item, itemp); menu_items[i] = itemp->item; rb_ary_push(menup->items, item); } menu_items[RARRAY_LEN(items)] = NULL; menup->menu = new_menu(menu_items); if (menup->menu == NULL) { check_curses_error(errno); } return obj; } /* * Document-method: Curses::Menu#post * * call-seq: * post * * Post the menu. */ static VALUE menu_post(VALUE obj) { struct menudata *menup; int error; GetMENU(obj, menup); error = post_menu(menup->menu); check_curses_error(error); return obj; } /* * Document-method: Curses::Menu#unpost * * call-seq: * unpost * * Unpost the menu. */ static VALUE menu_unpost(VALUE obj) { struct menudata *menup; int error; GetMENU(obj, menup); error = unpost_menu(menup->menu); check_curses_error(error); return obj; } /* * Document-method: Curses::Menu#driver * * call-seq: * driver(command) * * Perform the command on the menu. */ static VALUE menu_driver_m(VALUE obj, VALUE command) { struct menudata *menup; int error; GetMENU(obj, menup); error = menu_driver(menup->menu, NUM2INT(command)); check_curses_error(error); return obj; } /* * Document-method: Curses::Menu#item_count * * call-seq: * item_count * * Returns the count of items in the menu. */ static VALUE menu_item_count(VALUE obj) { struct menudata *menup; GetMENU(obj, menup); return INT2NUM(item_count(menup->menu)); } /* * Document-method: Curses::Menu#items * * call-seq: * items * * Returns the items of the menu. */ static VALUE menu_get_items(VALUE obj) { struct menudata *menup; ITEM **items; int count, i; VALUE ary; GetMENU(obj, menup); items = menu_items(menup->menu); if (items == NULL) { return Qnil; } count = item_count(menup->menu); ary = rb_ary_new(); for (i = 0; i < count; i++) { rb_ary_push(ary, item_new(items[i])); } return ary; } /* * Document-method: Curses::Menu#items= * * call-seq: * items=(items) * * Returns the items of the menu. */ static VALUE menu_set_items(VALUE obj, VALUE items) { struct menudata *menup; ITEM **old_items, **new_items; int i, error; Check_Type(items, T_ARRAY); GetMENU(obj, menup); old_items = menu_items(menup->menu); new_items = ALLOC_N(ITEM*, RARRAY_LEN(items) + 1); for (i = 0; i < RARRAY_LEN(items); i++) { struct itemdata *itemp; GetITEM(RARRAY_AREF(items, i), itemp); new_items[i] = itemp->item; } new_items[RARRAY_LEN(items)] = NULL; error = set_menu_items(menup->menu, new_items); if (error != E_OK) { xfree(new_items); check_curses_error(error); return items; } xfree(old_items); menup->items = rb_ary_dup(items); return items; } /* * Document-method: Curses::Menu#current_item * * call-seq: * current_item * * Returns the current item. */ static VALUE menu_get_current_item(VALUE obj) { struct menudata *menup; ITEM *item; GetMENU(obj, menup); item = current_item(menup->menu); if (item == NULL) { return Qnil; } return item_new(item); } /* * Document-method: Curses::Menu#current_item= * * call-seq: * current_item=(item) * * Sets the current item. */ static VALUE menu_set_current_item(VALUE obj, VALUE item) { struct menudata *menup; struct itemdata *itemp; GetMENU(obj, menup); GetITEM(item, itemp); set_current_item(menup->menu, itemp->item); return item; } /* * Document-method: Curses::Menu#set_win * * call-seq: * set_win=(win) * * Set the window of the menu. */ static VALUE menu_set_win(VALUE obj, VALUE win) { struct menudata *menup; struct windata *winp; GetMENU(obj, menup); GetWINDOW(win, winp); set_menu_win(menup->menu, winp->window); return win; } /* * Document-method: Curses::Menu#set_sub * * call-seq: * set_sub=(win) * * Set the subwindow of the menu. */ static VALUE menu_set_sub(VALUE obj, VALUE win) { struct menudata *menup; struct windata *winp; GetMENU(obj, menup); GetWINDOW(win, winp); set_menu_sub(menup->menu, winp->window); return win; } /* * Document-method: Curses::Menu#scale * * call-seq: * scale * * Return the minimum rows and columns required for the subwindow of the menu. */ static VALUE menu_scale(VALUE obj) { struct menudata *menup; int error, rows, columns; GetMENU(obj, menup); error = scale_menu(menup->menu, &rows, &columns); check_curses_error(error); return rb_assoc_new(INT2NUM(rows), INT2NUM(columns)); } /* * Document-method: Curses::Menu#set_format * * call-seq: * set_format(rows, cols) * * Set the maximum size of the menu. */ static VALUE menu_set_format(VALUE obj, VALUE rows, VALUE cols) { struct menudata *menup; int error; GetMENU(obj, menup); error = set_menu_format(menup->menu, NUM2INT(rows), NUM2INT(cols)); check_curses_error(error); return obj; } /* * Document-method: Curses::Menu#mark= * * call-seq: * mark=(str) * * Set the mark string to distinguish the selected items */ static VALUE menu_set_mark(VALUE obj, VALUE mark) { struct menudata *menup; GetMENU(obj, menup); set_menu_mark(menup->menu, StringValueCStr(mark)); return obj; } /* * Document-method: Curses::Menu#mark * * call-seq: * mark * * Get the Menu's mark string */ static VALUE menu_get_mark(VALUE obj) { struct menudata *menup; const char *mark; GetMENU(obj, menup); mark = menu_mark(menup->menu); return rb_external_str_new_with_enc(mark, strlen(mark), terminal_encoding); } /* * Document-method: Curses::Menu#fore= * * call-seq: * fore=(attr) * * Sets the foreground attribute of menu. * This is the highlight used for selected menu items. */ static VALUE menu_set_fore(VALUE obj, VALUE attr) { struct menudata *menup; GetMENU(obj, menup); set_menu_fore(menup->menu, NUM2CHTYPE(attr)); return attr; } /* * Document-method: Curses::Menu#fore * * call-seq: * fore * * Sets the foreground attribute of menu. * This is the highlight used for selected menu items. */ static VALUE menu_get_fore(VALUE obj, VALUE attr) { struct menudata *menup; GetMENU(obj, menup); return CHTYPE2NUM(menu_fore(menup->menu)); } /* * Document-method: Curses::Menu#set_back * * call-seq: * set_back(attr) * * Get the background attribute of menu. */ static VALUE menu_set_back(VALUE obj, VALUE attr) { struct menudata *menup; GetMENU(obj, menup); CHTYPE2NUM(set_menu_back(menup->menu, NUM2CHTYPE(attr))); return attr; } /* * Document-method: Curses::Menu#back * * call-seq: * back * * Get the background attribute of menu. */ static VALUE menu_get_back(VALUE obj, VALUE attr) { struct menudata *menup; GetMENU(obj, menup); return CHTYPE2NUM(menu_back(menup->menu)); } /* * Document-method: Curses::Menu#format * * call-seq: * format * * Get the maximum size of the menu. */ static VALUE menu_format_m(VALUE obj) { struct menudata *menup; int rows, cols; GetMENU(obj, menup); menu_format(menup->menu, &rows, &cols); return rb_assoc_new(INT2NUM(rows), INT2NUM(cols)); } /* * Document-method: Curses::Menu#set_opts * * call-seq: * set_opts(opts) * * Set the option bits of the menu. */ static VALUE menu_set_opts(VALUE obj, VALUE opts) { struct menudata *menup; int error; GetMENU(obj, menup); error = set_menu_opts(menup->menu, NUM2INT(opts)); check_curses_error(error); return obj; } /* * Document-method: Curses::Menu#opts_on * * call-seq: * opts_on(opts) * * Turn on the option bits of the menu. */ static VALUE menu_opts_on_m(VALUE obj, VALUE opts) { struct menudata *menup; int error; GetMENU(obj, menup); error = menu_opts_on(menup->menu, NUM2INT(opts)); check_curses_error(error); return obj; } /* * Document-method: Curses::Menu#opts_off * * call-seq: * opts_off(opts) * * Turn off the option bits of the menu. */ static VALUE menu_opts_off_m(VALUE obj, VALUE opts) { struct menudata *menup; int error; GetMENU(obj, menup); error = menu_opts_off(menup->menu, NUM2INT(opts)); check_curses_error(error); return obj; } /* * Document-method: Curses::Menu#opts * * call-seq: * opts * * Get the current option bits of the menu. */ static VALUE menu_opts_m(VALUE obj, VALUE opts) { struct menudata *menup; GetMENU(obj, menup); return INT2NUM(menu_opts(menup->menu)); } #endif /* HAVE_MENU */ #ifdef HAVE_FORM struct fielddata { FIELD *field; }; NORETURN(static void no_field(void)); static void no_field(void) { rb_raise(rb_eRuntimeError, "already deleted field"); } #define GetFIELD(obj, fieldp) do {\ TypedData_Get_Struct((obj), struct fielddata, &fielddata_type, (fieldp));\ if ((fieldp)->field == 0) no_field();\ } while (0) static void field_free(void *p) { struct fielddata *fieldp = p; if (fieldp->field) free_field(fieldp->field); fieldp->field = 0; xfree(fieldp); } static size_t field_memsize(const void *p) { const struct fielddata *fieldp = p; size_t size = sizeof(*fieldp); if (!fieldp) return 0; if (fieldp->field) size += CURSES_SIZEOF_FIELD; return size; } static const rb_data_type_t fielddata_type = { "fielddata", {0, field_free, field_memsize,} }; /* returns a Curses::Menu object */ static VALUE field_s_allocate(VALUE class) { struct fielddata *fieldp; return TypedData_Make_Struct(class, struct fielddata, &fielddata_type, fieldp); } /* * Document-method: Curses::Field.new * * call-seq: * new(height, width, toprow, leftcol, offscreen, nbuffers) * * Construct a new Curses::Field. */ static VALUE field_initialize(VALUE obj, VALUE height, VALUE width, VALUE toprow, VALUE leftcol, VALUE offscreen, VALUE nbuffers) { struct fielddata *fieldp; curses_init_screen(Qnil); TypedData_Get_Struct(obj, struct fielddata, &fielddata_type, fieldp); if (fieldp->field) { rb_raise(rb_eRuntimeError, "already initialized field"); } fieldp->field = new_field(NUM2INT(height), NUM2INT(width), NUM2INT(toprow), NUM2INT(leftcol), NUM2INT(offscreen), NUM2INT(nbuffers)); if (fieldp->field == NULL) { check_curses_error(errno); } return obj; } /* * Document-method: Curses::Field#set_buffer * * call-seq: * set_buffer(buf, value) * * Set the numbered buffer of the field. */ static VALUE field_set_buffer(VALUE obj, VALUE buf, VALUE value) { struct fielddata *fieldp; GetFIELD(obj, fieldp); value = rb_str_export_to_enc(value, terminal_encoding); set_field_buffer(fieldp->field, NUM2INT(buf), StringValueCStr(value)); return obj; } /* * Document-method: Curses::Field#buffer * * call-seq: * buffer(buf) * * Get the numbered buffer of the field. */ static VALUE field_buffer_m(VALUE obj, VALUE buf) { struct fielddata *fieldp; char *s; GetFIELD(obj, fieldp); s = field_buffer(fieldp->field, NUM2INT(buf)); return rb_external_str_new_with_enc(s, strlen(s), terminal_encoding); } /* * Document-method: Curses::Field#set_fore * * call-seq: * set_fore(attr) * * Set the foreground attribute of the field. */ static VALUE field_set_fore(VALUE obj, VALUE attr) { struct fielddata *fieldp; GetFIELD(obj, fieldp); set_field_fore(fieldp->field, NUM2CHTYPE(attr)); return attr; } /* * Document-method: Curses::Field#fore * * call-seq: * fore * * Get the foreground attribute of the field. */ static VALUE field_get_fore(VALUE obj) { struct fielddata *fieldp; GetFIELD(obj, fieldp); return CHTYPE2NUM(field_fore(fieldp->field)); } /* * Document-method: Curses::Field#set_back * * call-seq: * set_back(attr) * * Set the background attribute of the field. */ static VALUE field_set_back(VALUE obj, VALUE attr) { struct fielddata *fieldp; GetFIELD(obj, fieldp); set_field_back(fieldp->field, NUM2CHTYPE(attr)); return attr; } /* * Document-method: Curses::Field#back * * call-seq: * back * * Get the background attribute of the field. */ static VALUE field_get_back(VALUE obj) { struct fielddata *fieldp; GetFIELD(obj, fieldp); return CHTYPE2NUM(field_back(fieldp->field)); } /* * Document-method: Curses::Field#opts_on * * call-seq: * opts_on(opts) * * Turn on the given option bits. */ static VALUE field_opts_on_m(VALUE obj, VALUE opts) { struct fielddata *fieldp; GetFIELD(obj, fieldp); field_opts_on(fieldp->field, NUM2INT(opts)); return opts; } /* * Document-method: Curses::Field#opts_off * * call-seq: * opts_off(opts) * * Turn off the given option bits. */ static VALUE field_opts_off_m(VALUE obj, VALUE opts) { struct fielddata *fieldp; GetFIELD(obj, fieldp); field_opts_off(fieldp->field, NUM2INT(opts)); return opts; } /* * Document-method: Curses::Field#opts * * call-seq: * opts * * Get the current option bits. */ static VALUE field_opts_m(VALUE obj) { struct fielddata *fieldp; GetFIELD(obj, fieldp); return INT2NUM(field_opts(fieldp->field)); } static VALUE field_height(VALUE obj) { struct fielddata *fieldp; int error, val; GetFIELD(obj, fieldp); error = field_info(fieldp->field, &val, NULL, NULL, NULL, NULL, NULL); check_curses_error(error); return INT2NUM(val); } static VALUE field_width(VALUE obj) { struct fielddata *fieldp; int error, val; GetFIELD(obj, fieldp); error = field_info(fieldp->field, NULL, &val, NULL, NULL, NULL, NULL); check_curses_error(error); return INT2NUM(val); } static VALUE field_toprow(VALUE obj) { struct fielddata *fieldp; int error, val; GetFIELD(obj, fieldp); error = field_info(fieldp->field, NULL, NULL, &val, NULL, NULL, NULL); check_curses_error(error); return INT2NUM(val); } static VALUE field_leftcol(VALUE obj) { struct fielddata *fieldp; int error, val; GetFIELD(obj, fieldp); error = field_info(fieldp->field, NULL, NULL, NULL, &val, NULL, NULL); check_curses_error(error); return INT2NUM(val); } static VALUE field_offscreen(VALUE obj) { struct fielddata *fieldp; int error, val; GetFIELD(obj, fieldp); error = field_info(fieldp->field, NULL, NULL, NULL, NULL, &val, NULL); check_curses_error(error); return INT2NUM(val); } static VALUE field_nbuffers(VALUE obj) { struct fielddata *fieldp; int error, val; GetFIELD(obj, fieldp); error = field_info(fieldp->field, NULL, NULL, NULL, NULL, NULL, &val); check_curses_error(error); return INT2NUM(val); } static VALUE field_dynamic_height(VALUE obj) { struct fielddata *fieldp; int error, val; GetFIELD(obj, fieldp); error = dynamic_field_info(fieldp->field, &val, NULL, NULL); check_curses_error(error); return INT2NUM(val); } static VALUE field_dynamic_width(VALUE obj) { struct fielddata *fieldp; int error, val; GetFIELD(obj, fieldp); error = dynamic_field_info(fieldp->field, NULL, &val, NULL); check_curses_error(error); return INT2NUM(val); } static VALUE field_max(VALUE obj) { struct fielddata *fieldp; int error, val; GetFIELD(obj, fieldp); error = dynamic_field_info(fieldp->field, NULL, NULL, &val); check_curses_error(error); return INT2NUM(val); } static VALUE field_set_max(VALUE obj, VALUE max) { struct fielddata *fieldp; int error; GetFIELD(obj, fieldp); error = set_max_field(fieldp->field, NUM2INT(max)); check_curses_error(error); return max; } #define TYPE_CODE_ALPHA 1 #define TYPE_CODE_ALNUM 2 #define TYPE_CODE_ENUM 3 #define TYPE_CODE_INTEGER 4 #define TYPE_CODE_NUMERIC 5 #define TYPE_CODE_REGEXP 6 static VALUE field_set_type(int argc, VALUE *argv, VALUE obj) { struct fielddata *fieldp; VALUE type; int type_code; int error; if (argc < 1) { rb_raise(rb_eArgError, "wrong number of arguments (given %d, expected 1)", argc); } type_code = NUM2INT(argv[0]); GetFIELD(obj, fieldp); switch (type_code) { case TYPE_CODE_ALPHA: { VALUE width; rb_scan_args(argc, argv, "11", &type, &width); error = set_field_type(fieldp->field, TYPE_ALPHA, NIL_P(width) ? 0 : NUM2INT(width)); } break; case TYPE_CODE_ALNUM: { VALUE width; rb_scan_args(argc, argv, "11", &type, &width); error = set_field_type(fieldp->field, TYPE_ALNUM, NIL_P(width) ? 0 : NUM2INT(width)); } break; #if 0 case TYPE_CODE_ENUM: { /* TODO: consider how valuelist should be allocated? */ } break; #endif case TYPE_CODE_INTEGER: { VALUE padding, vmin, vmax; rb_scan_args(argc, argv, "13", &type, &padding, &vmin, &vmax); error = set_field_type(fieldp->field, TYPE_INTEGER, NIL_P(padding) ? 0 : NUM2INT(padding), NIL_P(vmin) ? INT_MIN : NUM2INT(vmin), NIL_P(vmax) ? INT_MAX : NUM2INT(vmax)); } break; case TYPE_CODE_NUMERIC: { VALUE padding, vmin, vmax; rb_scan_args(argc, argv, "13", &type, &padding, &vmin, &vmax); error = set_field_type(fieldp->field, TYPE_INTEGER, NIL_P(padding) ? 0 : NUM2INT(padding), NIL_P(vmin) ? INT_MIN : NUM2INT(vmin), NIL_P(vmax) ? INT_MAX : NUM2INT(vmax)); } break; #if 0 case TYPE_CODE_REGEXP: { /* TODO: consider how regexp should be allocated? */ } break; #endif default: rb_raise(rb_eArgError, "unknwon type: %d", type_code); break; } check_curses_error(error); return obj; } struct formdata { FORM *form; VALUE fields; }; NORETURN(static void no_form(void)); static void no_form(void) { rb_raise(rb_eRuntimeError, "already deleted form"); } #define GetFORM(obj, formp) do {\ TypedData_Get_Struct((obj), struct formdata, &formdata_type, (formp));\ if ((formp)->form == 0) no_form();\ } while (0) static void form_gc_mark(void *p) { struct formdata *formp = p; rb_gc_mark(formp->fields); } static void form_free(void *p) { struct formdata *formp = p; FIELD **fields = form_fields(formp->form); if (formp->form) free_form(formp->form); xfree(fields); formp->form = 0; formp->fields = Qnil; xfree(formp); } static size_t form_memsize(const void *p) { const struct formdata *formp = p; size_t size = sizeof(*formp); if (!formp) return 0; if (formp->form) size += CURSES_SIZEOF_FORM; return size; } static const rb_data_type_t formdata_type = { "formdata", {form_gc_mark, form_free, form_memsize,} }; /* returns a Curses::Form object */ static VALUE form_s_allocate(VALUE class) { struct formdata *formp; return TypedData_Make_Struct(class, struct formdata, &formdata_type, formp); } /* * Document-method: Curses::Form.new * * call-seq: * new(fields) * * Construct a new Curses::Form. */ static VALUE form_initialize(VALUE obj, VALUE fields) { struct formdata *formp; FIELD **form_fields; int i; Check_Type(fields, T_ARRAY); curses_init_screen(Qnil); TypedData_Get_Struct(obj, struct formdata, &formdata_type, formp); if (formp->form) { rb_raise(rb_eRuntimeError, "already initialized form"); } formp->fields = rb_ary_new(); form_fields = ALLOC_N(FIELD *, RARRAY_LEN(fields) + 1); for (i = 0; i < RARRAY_LEN(fields); i++) { VALUE field = RARRAY_AREF(fields, i); struct fielddata *fieldp; GetFIELD(field, fieldp); form_fields[i] = fieldp->field; rb_ary_push(formp->fields, field); } form_fields[RARRAY_LEN(fields)] = NULL; formp->form = new_form(form_fields); if (formp->form == NULL) { check_curses_error(errno); } return obj; } /* * Document-method: Curses::Form#post * * call-seq: * post * * Post the form. */ static VALUE form_post(VALUE obj) { struct formdata *formp; int error; GetFORM(obj, formp); error = post_form(formp->form); check_curses_error(error); return obj; } /* * Document-method: Curses::Form#unpost * * call-seq: * unpost * * Unpost the form. */ static VALUE form_unpost(VALUE obj) { struct formdata *formp; int error; GetFORM(obj, formp); error = unpost_form(formp->form); check_curses_error(error); return obj; } /* * Document-method: Curses::Form#driver * * call-seq: * driver(command) * * Perform the command on the form. */ static VALUE form_driver_m(VALUE obj, VALUE command) { struct formdata *formp; int error, c; GetFORM(obj, formp); if (FIXNUM_P(command)) { c = NUM2INT(command); } else { ID id_ord; StringValue(command); CONST_ID(id_ord, "ord"); c = NUM2INT(rb_funcall(command, id_ord, 0)); } #ifdef HAVE_FORM_DRIVER_W error = form_driver_w(formp->form, FIXNUM_P(command) ? KEY_CODE_YES : OK, c); #else error = form_driver(formp->form, c); #endif check_curses_error(error); return obj; } /* * Document-method: Curses::Form#set_win * * call-seq: * set_win=(win) * * Set the window of the form. */ static VALUE form_set_win(VALUE obj, VALUE win) { struct formdata *formp; struct windata *winp; GetFORM(obj, formp); GetWINDOW(win, winp); set_form_win(formp->form, winp->window); return win; } /* * Document-method: Curses::Form#set_sub * * call-seq: * set_sub=(win) * * Set the subwindow of the form. */ static VALUE form_set_sub(VALUE obj, VALUE win) { struct formdata *formp; struct windata *winp; GetFORM(obj, formp); GetWINDOW(win, winp); set_form_sub(formp->form, winp->window); return win; } /* * Document-method: Curses::Form#scale * * call-seq: * scale * * Return the minimum rows and columns required for the subwindow of the form. */ static VALUE form_scale(VALUE obj) { struct formdata *formp; int error, rows, columns; GetFORM(obj, formp); error = scale_form(formp->form, &rows, &columns); check_curses_error(error); return rb_assoc_new(INT2NUM(rows), INT2NUM(columns)); } #endif /* HAVE_FORM */ /* * Document-method: Curses.keyboard_encoding * call-seq: Curses.keyboard_encoding * * Returns the encoding for keyboard input. */ static VALUE curses_get_keyboard_encoding(VALUE obj) { return rb_enc_from_encoding(keyboard_encoding); } /* * Document-method: Curses.keyboard_encoding= * call-seq: Curses.keyboard_encoding = encoding * * Sets the encoding for keyboard input. */ static VALUE curses_set_keyboard_encoding(VALUE obj, VALUE enc) { keyboard_encoding = rb_to_encoding(enc); return enc; } /* * Document-method: Curses.terminal_encoding * call-seq: Curses.terminal_encoding * * Returns the encoding for terminal output. */ static VALUE curses_get_terminal_encoding(VALUE obj) { return rb_enc_from_encoding(terminal_encoding); } /* * Document-method: Curses.terminal_encoding= * call-seq: Curses.terminal_encoding = encoding * * Sets the encoding for terminal output. */ static VALUE curses_set_terminal_encoding(VALUE obj, VALUE enc) { terminal_encoding = rb_to_encoding(enc); return enc; } /* * Document-method: Curses.unget_char * call-seq: unget_char(ch) * * Places +ch+ back onto the input queue to be returned by * the next call to Curses.get_char etc. * * There is just one input queue for all windows. */ static VALUE curses_unget_char(VALUE obj, VALUE ch) { ID id_ord; unsigned int c; curses_stdscr(); if (FIXNUM_P(ch)) { ungetch(NUM2UINT(ch)); } else { StringValue(ch); CONST_ID(id_ord, "ord"); c = NUM2UINT(rb_funcall(ch, id_ord, 0)); #ifdef HAVE_UNGET_WCH unget_wch(c); #else if (c > 0xff) { rb_raise(rb_eRangeError, "Out of range: %u", c); } ungetch(c); #endif } return Qnil; } static VALUE keyboard_uint_chr(unsigned int ch) { return rb_enc_uint_chr(ch, keyboard_encoding); } #if defined(HAVE_GET_WCH) || defined(HAVE_WGET_WCH) static VALUE key_code_value(unsigned int ch) { #ifdef CTL_FSLASH if (ch == CTL_FSLASH) { return keyboard_uint_chr(0x1F); } #endif return UINT2NUM(ch); } #endif #ifdef HAVE_GET_WCH struct get_wch_arg { int retval; wint_t ch; }; static void * get_wch_func(void *_arg) { struct get_wch_arg *arg = (struct get_wch_arg *) _arg; arg->retval = get_wch(&arg->ch); return 0; } #endif /* * Document-method: Curses.get_char * * Read and returns a character or function key from the window. * A single or multibyte character is represented by a String, and * a function key is represented by an Integer. * Returns nil if no input is ready. * * See Curses::Key to all the function KEY_* available * */ static VALUE curses_get_char(VALUE obj) { #ifdef HAVE_GET_WCH struct get_wch_arg arg; curses_stdscr(); rb_thread_call_without_gvl(get_wch_func, &arg, RUBY_UBF_IO, 0); switch (arg.retval) { case OK: return keyboard_uint_chr(arg.ch); case KEY_CODE_YES: return key_code_value(arg.ch); } return Qnil; #else int c; curses_stdscr(); rb_thread_call_without_gvl(getch_func, &c, RUBY_UBF_IO, 0); if (c > 0xff) { return INT2NUM(c); } else if (c >= 0) { return keyboard_uint_chr(c); } else { return Qnil; } #endif } #ifdef HAVE_WGET_WCH struct wget_wch_arg { WINDOW *win; int retval; wint_t ch; }; static void * wget_wch_func(void *_arg) { struct wget_wch_arg *arg = (struct wget_wch_arg *) _arg; arg->retval = wget_wch(arg->win, &arg->ch); return 0; } #endif /* * Document-method: Curses::Window.get_char * * Read and returns a character or function key from the window. * A single or multibyte character is represented by a String, and * a function key is represented by an Integer. * Returns nil if no input is ready. * * See Curses::Key to all the function KEY_* available * */ static VALUE window_get_char(VALUE obj) { #ifdef HAVE_WGET_WCH struct windata *winp; struct wget_wch_arg arg; GetWINDOW(obj, winp); arg.win = winp->window; rb_thread_call_without_gvl(wget_wch_func, &arg, RUBY_UBF_IO, 0); switch (arg.retval) { case OK: return keyboard_uint_chr(arg.ch); case KEY_CODE_YES: return key_code_value(arg.ch); } return Qnil; #else struct windata *winp; struct wgetch_arg arg; GetWINDOW(obj, winp); arg.win = winp->window; rb_thread_call_without_gvl(wgetch_func, (void *)&arg, RUBY_UBF_IO, 0); if (arg.c > 0xff) { return INT2NUM(arg.c); } else if (arg.c >= 0) { return keyboard_uint_chr(arg.c); } else { return Qnil; } #endif } #ifdef HAVE_PDC_GET_KEY_MODIFIERS static VALUE curses_get_key_modifiers(VALUE obj) { return ULONG2NUM(PDC_get_key_modifiers()); } static VALUE curses_return_key_modifiers(VALUE obj, VALUE flag) { return INT2NUM(PDC_return_key_modifiers(RTEST(flag))); } static VALUE curses_save_key_modifiers(VALUE obj, VALUE flag) { return INT2NUM(PDC_save_key_modifiers(RTEST(flag))); } #endif /*------------------------- Initialization -------------------------*/ /* * Document-module: Curses * * == Description * An implementation of the CRT screen handling and optimization library. * * == Structures and such * * === Classes * * * Curses::Window - class with the means to draw a window or box * * Curses::MouseEvent - class for collecting mouse events * * === Modules * * Curses:: The curses implementation * Curses::Key:: Collection of constants for keypress events * * == Examples * * * hello.rb * :include: sample/hello.rb * * * * rain.rb * :include: sample/rain.rb * * */ void Init_curses(void) { #ifdef HAVE_GET_WCH keyboard_encoding = rb_locale_encoding(); #else keyboard_encoding = rb_ascii8bit_encoding(); #endif terminal_encoding = rb_locale_encoding(); mCurses = rb_define_module("Curses"); /* * Document-module: Curses::Key * * * a container for the KEY_* values. * * See also system manual for getch(3) * */ mKey = rb_define_module_under(mCurses, "Key"); rb_gc_register_address(&rb_stdscr); #ifdef USE_MOUSE /* * Document-class: Curses::MouseEvent * * == Description * * Curses::MouseEvent * * == Example * * * mouse.rb * :include: sample/mouse.rb * */ cMouseEvent = rb_define_class_under(mCurses,"MouseEvent",rb_cObject); rb_undef_method(CLASS_OF(cMouseEvent),"new"); rb_define_method(cMouseEvent, "eid", curs_mouse_id, 0); rb_define_method(cMouseEvent, "x", curs_mouse_x, 0); rb_define_method(cMouseEvent, "y", curs_mouse_y, 0); rb_define_method(cMouseEvent, "z", curs_mouse_z, 0); rb_define_method(cMouseEvent, "bstate", curs_mouse_bstate, 0); #endif /* USE_MOUSE */ rb_define_module_function(mCurses, "ESCDELAY=", curses_escdelay_set, 1); rb_define_module_function(mCurses, "ESCDELAY", curses_escdelay_get, 0); rb_define_module_function(mCurses, "TABSIZE", curses_tabsize_get, 0); rb_define_module_function(mCurses, "TABSIZE=", curses_tabsize_set, 1); rb_define_module_function(mCurses, "use_default_colors", curses_use_default_colors, 0); rb_define_module_function(mCurses, "assume_default_colors", curses_assume_default_colors, 2); rb_define_module_function(mCurses, "init_screen", curses_init_screen, 0); rb_define_module_function(mCurses, "close_screen", curses_close_screen, 0); rb_define_module_function(mCurses, "closed?", curses_closed, 0); rb_define_module_function(mCurses, "stdscr", curses_init_screen, 0); rb_define_module_function(mCurses, "refresh", curses_refresh, 0); rb_define_module_function(mCurses, "doupdate", curses_doupdate, 0); rb_define_module_function(mCurses, "clear", curses_clear, 0); rb_define_module_function(mCurses, "erase", curses_erase, 0); rb_define_module_function(mCurses, "clrtoeol", curses_clrtoeol, 0); rb_define_module_function(mCurses, "echo", curses_echo, 0); rb_define_module_function(mCurses, "noecho", curses_noecho, 0); rb_define_module_function(mCurses, "raw", curses_raw, 0); rb_define_module_function(mCurses, "noraw", curses_noraw, 0); rb_define_module_function(mCurses, "cbreak", curses_cbreak, 0); rb_define_module_function(mCurses, "nocbreak", curses_nocbreak, 0); rb_define_module_function(mCurses, "crmode", curses_cbreak, 0); rb_define_module_function(mCurses, "nocrmode", curses_nocbreak, 0); rb_define_module_function(mCurses, "nl", curses_nl, 0); rb_define_module_function(mCurses, "nonl", curses_nonl, 0); rb_define_module_function(mCurses, "flushinp", curses_flushinp, 0); rb_define_module_function(mCurses, "beep", curses_beep, 0); rb_define_module_function(mCurses, "flash", curses_flash, 0); rb_define_module_function(mCurses, "ungetch", curses_ungetch, 1); rb_define_module_function(mCurses, "setpos", curses_setpos, 2); rb_define_module_function(mCurses, "standout", curses_standout, 0); rb_define_module_function(mCurses, "standend", curses_standend, 0); rb_define_module_function(mCurses, "inch", curses_inch, 0); rb_define_module_function(mCurses, "addch", curses_addch, 1); rb_define_module_function(mCurses, "insch", curses_insch, 1); rb_define_module_function(mCurses, "addstr", curses_addstr, 1); rb_define_module_function(mCurses, "getch", curses_getch, 0); rb_define_module_function(mCurses, "getstr", curses_getstr, 0); rb_define_module_function(mCurses, "delch", curses_delch, 0); rb_define_module_function(mCurses, "deleteln", curses_deleteln, 0); rb_define_module_function(mCurses, "insertln", curses_insertln, 0); rb_define_module_function(mCurses, "keyname", curses_keyname, 1); rb_define_module_function(mCurses, "lines", curses_lines, 0); rb_define_module_function(mCurses, "cols", curses_cols, 0); rb_define_module_function(mCurses, "curs_set", curses_curs_set, 1); rb_define_module_function(mCurses, "scrl", curses_scrl, 1); rb_define_module_function(mCurses, "setscrreg", curses_setscrreg, 2); rb_define_module_function(mCurses, "attroff", curses_attroff, 1); rb_define_module_function(mCurses, "attron", curses_attron, 1); rb_define_module_function(mCurses, "attrset", curses_attrset, 1); rb_define_module_function(mCurses, "bkgdset", curses_bkgdset, 1); rb_define_module_function(mCurses, "bkgd", curses_bkgd, 1); rb_define_module_function(mCurses, "resizeterm", curses_resizeterm, 2); rb_define_module_function(mCurses, "resize", curses_resizeterm, 2); #ifdef USE_COLOR rb_define_module_function(mCurses, "start_color", curses_start_color, 0); rb_define_module_function(mCurses, "init_pair", curses_init_pair, 3); rb_define_module_function(mCurses, "init_color", curses_init_color, 4); rb_define_module_function(mCurses, "has_colors?", curses_has_colors, 0); rb_define_module_function(mCurses, "can_change_color?", curses_can_change_color, 0); rb_define_module_function(mCurses, "colors", curses_colors, 0); rb_define_module_function(mCurses, "color_content", curses_color_content, 1); rb_define_module_function(mCurses, "color_pairs", curses_color_pairs, 0); rb_define_module_function(mCurses, "pair_content", curses_pair_content, 1); rb_define_module_function(mCurses, "color_pair", curses_color_pair, 1); rb_define_module_function(mCurses, "pair_number", curses_pair_number, 1); #endif /* USE_COLOR */ #ifdef USE_MOUSE rb_define_module_function(mCurses, "getmouse", curses_getmouse, 0); rb_define_module_function(mCurses, "ungetmouse", curses_ungetmouse, 1); rb_define_module_function(mCurses, "mouseinterval", curses_mouseinterval, 1); rb_define_module_function(mCurses, "mousemask", curses_mousemask, 1); #endif /* USE_MOUSE */ rb_define_module_function(mCurses, "timeout=", curses_timeout, 1); rb_define_module_function(mCurses, "def_prog_mode", curses_def_prog_mode, 0); rb_define_module_function(mCurses, "reset_prog_mode", curses_reset_prog_mode, 0); rb_define_module_function(mCurses, "keyboard_encoding", curses_get_keyboard_encoding, 0); rb_define_module_function(mCurses, "keyboard_encoding=", curses_set_keyboard_encoding, 1); rb_define_module_function(mCurses, "terminal_encoding", curses_get_terminal_encoding, 0); rb_define_module_function(mCurses, "terminal_encoding=", curses_set_terminal_encoding, 1); rb_define_module_function(mCurses, "unget_char", curses_unget_char, 1); rb_define_module_function(mCurses, "get_char", curses_get_char, 0); #ifdef HAVE_PDC_GET_KEY_MODIFIERS rb_define_module_function(mCurses, "get_key_modifiers", curses_get_key_modifiers, 0); rb_define_module_function(mCurses, "return_key_modifiers", curses_return_key_modifiers, 1); rb_define_module_function(mCurses, "save_key_modifiers", curses_save_key_modifiers, 1); #endif { VALUE version; #if defined(HAVE_FUNC_CURSES_VERSION) /* ncurses and PDcurses */ version = rb_str_new2(curses_version()); #elif defined(HAVE_VAR_CURSES_VERSION) /* SVR4 curses has an undocumented and undeclared variable, curses_version. * It contains a string, "SVR4". */ RUBY_EXTERN char *curses_version; version = rb_sprintf("curses (%s)", curses_version); #else /* BSD curses, perhaps. NetBSD 5 still use it. */ version = rb_str_new2("curses (unknown)"); #endif /* * Identifies curses library version. * * - "ncurses 5.9.20110404" * - "PDCurses 3.4 - Public Domain 2008" * - "curses (SVR4)" (System V curses) * - "curses (unknown)" (The original BSD curses? NetBSD maybe.) * */ rb_define_const(mCurses, "VERSION", version); } /* * Document-class: Curses::Window * * == Description * * The means by which to create and manage frames or windows. * While there may be more than one window at a time, only one window * will receive input. * * == Usage * * require "curses" * * Curses.init_screen * * my_str = "LOOK! PONIES!" * * height, width = 12, my_str.length + 10 * top, left = (Curses.lines - height) / 2, (Curses.cols - width) / 2 * bwin = Curses::Window.new(height, width, top, left) * bwin.box("\\", "/") * bwin.refresh * * win = bwin.subwin(height - 4, width - 4, top + 2, left + 2) * win.setpos(2, 3) * win.addstr(my_str) * # or even * win << "\nOH REALLY?" * win << "\nYES!! " + my_str * win.refresh * win.getch * win.close * */ cWindow = rb_define_class_under(mCurses, "Window", rb_cObject); rb_define_alloc_func(cWindow, window_s_allocate); rb_define_method(cWindow, "initialize", window_initialize, 4); rb_define_method(cWindow, "subwin", window_subwin, 4); rb_define_method(cWindow, "derwin", window_derwin, 4); rb_define_method(cWindow, "close", window_close, 0); rb_define_method(cWindow, "clear", window_clear, 0); rb_define_method(cWindow, "erase", window_erase, 0); rb_define_method(cWindow, "clrtoeol", window_clrtoeol, 0); rb_define_method(cWindow, "refresh", window_refresh, 0); rb_define_method(cWindow, "noutrefresh", window_noutrefresh, 0); rb_define_method(cWindow, "redraw", window_redraw, 0); rb_define_method(cWindow, "touch", window_touch, 0); rb_define_method(cWindow, "untouch", window_untouch, 0); rb_define_method(cWindow, "touched?", window_touched, 0); rb_define_method(cWindow, "touch_line", window_touch_line, -1); rb_define_method(cWindow, "line_touched?", window_line_touched, 1); rb_define_method(cWindow, "box", window_box, -1); rb_define_method(cWindow, "move", window_move, 2); rb_define_method(cWindow, "move_relative", window_move_relative, 2); rb_define_method(cWindow, "setpos", window_setpos, 2); #if defined(USE_COLOR) && defined(HAVE_WCOLOR_SET) rb_define_method(cWindow, "color_set", window_color_set, 1); #endif /* USE_COLOR && HAVE_WCOLOR_SET */ rb_define_method(cWindow, "cury", window_cury, 0); rb_define_method(cWindow, "curx", window_curx, 0); rb_define_method(cWindow, "maxy", window_maxy, 0); rb_define_method(cWindow, "maxx", window_maxx, 0); rb_define_method(cWindow, "begy", window_begy, 0); rb_define_method(cWindow, "begx", window_begx, 0); rb_define_method(cWindow, "standout", window_standout, 0); rb_define_method(cWindow, "standend", window_standend, 0); rb_define_method(cWindow, "inch", window_inch, 0); rb_define_method(cWindow, "addch", window_addch, 1); rb_define_method(cWindow, "insch", window_insch, 1); rb_define_method(cWindow, "addstr", window_addstr, 1); rb_define_method(cWindow, "<<", window_addstr2, 1); rb_define_method(cWindow, "getch", window_getch, 0); rb_define_method(cWindow, "getstr", window_getstr, 0); rb_define_method(cWindow, "delch", window_delch, 0); rb_define_method(cWindow, "deleteln", window_deleteln, 0); rb_define_method(cWindow, "insertln", window_insertln, 0); rb_define_method(cWindow, "scroll", window_scroll, 0); rb_define_method(cWindow, "scrollok", window_scrollok, 1); rb_define_method(cWindow, "idlok", window_idlok, 1); rb_define_method(cWindow, "setscrreg", window_setscrreg, 2); rb_define_method(cWindow, "scrl", window_scrl, 1); rb_define_method(cWindow, "resize", window_resize, 2); rb_define_method(cWindow, "keypad", window_keypad, 1); rb_define_method(cWindow, "keypad=", window_keypad, 1); rb_define_method(cWindow, "attroff", window_attroff, 1); rb_define_method(cWindow, "attron", window_attron, 1); rb_define_method(cWindow, "attrset", window_attrset, 1); rb_define_method(cWindow, "bkgdset", window_bkgdset, 1); rb_define_method(cWindow, "bkgd", window_bkgd, 1); rb_define_method(cWindow, "getbkgd", window_getbkgd, 0); rb_define_method(cWindow, "nodelay=", window_nodelay, 1); rb_define_method(cWindow, "timeout=", window_timeout, 1); rb_define_method(cWindow, "get_char", window_get_char, 0); #ifdef HAVE_NEWPAD /* * Document-class: Curses::Pad * * == Description * * A Pad is like a Window but allows for scrolling of contents that cannot * fit on the screen. Pads do not refresh automatically, use Pad#refresh * or Pad#noutrefresh instead. * */ cPad = rb_define_class_under(mCurses, "Pad", cWindow); /* inherits alloc_func from cWindow */ rb_define_method(cPad, "initialize", pad_initialize, 2); rb_define_method(cPad, "subpad", pad_subpad, 4); rb_define_method(cPad, "refresh", pad_refresh, 6); rb_define_method(cPad, "noutrefresh", pad_noutrefresh, 6); rb_undef_method(cPad, "subwin"); #endif #ifdef HAVE_MENU cItem = rb_define_class_under(mCurses, "Item", rb_cObject); rb_define_alloc_func(cItem, item_s_allocate); rb_define_method(cItem, "initialize", item_initialize, 2); rb_define_method(cItem, "==", item_eq, 1); rb_define_method(cItem, "name", item_name_m, 0); rb_define_method(cItem, "description", item_description_m, 0); rb_define_method(cItem, "set_opts", item_set_opts, 1); rb_define_method(cItem, "opts_on", item_opts_on_m, 1); rb_define_method(cItem, "opts_off", item_opts_off_m, 1); rb_define_method(cItem, "opts", item_opts_m, 0); cMenu = rb_define_class_under(mCurses, "Menu", rb_cObject); rb_define_alloc_func(cMenu, menu_s_allocate); rb_define_method(cMenu, "initialize", menu_initialize, 1); rb_define_method(cMenu, "post", menu_post, 0); rb_define_method(cMenu, "unpost", menu_unpost, 0); rb_define_method(cMenu, "driver", menu_driver_m, 1); rb_define_method(cMenu, "item_count", menu_item_count, 0); rb_define_method(cMenu, "items", menu_get_items, 0); rb_define_method(cMenu, "items=", menu_set_items, 1); rb_define_method(cMenu, "current_item", menu_get_current_item, 0); rb_define_method(cMenu, "current_item=", menu_set_current_item, 1); rb_define_method(cMenu, "set_win", menu_set_win, 1); rb_define_method(cMenu, "set_sub", menu_set_sub, 1); rb_define_method(cMenu, "scale", menu_scale, 0); rb_define_method(cMenu, "set_format", menu_set_format, 2); rb_define_method(cMenu, "format", menu_format_m, 0); rb_define_method(cMenu, "mark=", menu_set_mark, 1); rb_define_method(cMenu, "mark", menu_get_mark, 0); rb_define_method(cMenu, "fore=", menu_set_fore, 1); rb_define_method(cMenu, "fore", menu_get_fore, 0); rb_define_method(cMenu, "back=", menu_set_back, 1); rb_define_method(cMenu, "back", menu_get_back, 0); rb_define_method(cMenu, "set_opts", menu_set_opts, 1); rb_define_method(cMenu, "opts_on", menu_opts_on_m, 1); rb_define_method(cMenu, "opts_off", menu_opts_off_m, 1); rb_define_method(cMenu, "opts", menu_opts_m, 0); #endif #ifdef HAVE_FORM cField = rb_define_class_under(mCurses, "Field", rb_cObject); rb_define_alloc_func(cField, field_s_allocate); rb_define_method(cField, "initialize", field_initialize, 6); rb_define_method(cField, "set_buffer", field_set_buffer, 2); rb_define_method(cField, "buffer", field_buffer_m, 1); rb_define_method(cField, "set_fore", field_set_fore, 1); rb_define_method(cField, "fore=", field_set_fore, 1); rb_define_method(cField, "fore", field_get_fore, 0); rb_define_method(cField, "set_back", field_set_back, 1); rb_define_method(cField, "back=", field_set_back, 1); rb_define_method(cField, "back", field_get_back, 0); rb_define_method(cField, "opts_on", field_opts_on_m, 1); rb_define_method(cField, "opts_off", field_opts_off_m, 1); rb_define_method(cField, "opts", field_opts_m, 0); rb_define_method(cField, "height", field_height, 0); rb_define_method(cField, "width", field_width, 0); rb_define_method(cField, "toprow", field_toprow, 0); rb_define_method(cField, "leftcol", field_leftcol, 0); rb_define_method(cField, "offscreen", field_offscreen, 0); rb_define_method(cField, "nbuffers", field_nbuffers, 0); rb_define_method(cField, "dynamic_height", field_dynamic_height, 0); rb_define_method(cField, "dynamic_width", field_dynamic_width, 0); rb_define_method(cField, "max", field_max, 0); rb_define_method(cField, "set_max", field_set_max, 1); rb_define_method(cField, "max=", field_set_max, 1); rb_define_method(cField, "set_type", field_set_type, -1); cForm = rb_define_class_under(mCurses, "Form", rb_cObject); rb_define_alloc_func(cForm, form_s_allocate); rb_define_method(cForm, "initialize", form_initialize, 1); rb_define_method(cForm, "post", form_post, 0); rb_define_method(cForm, "unpost", form_unpost, 0); rb_define_method(cForm, "driver", form_driver_m, 1); rb_define_method(cForm, "set_win", form_set_win, 1); rb_define_method(cForm, "set_sub", form_set_sub, 1); rb_define_method(cForm, "scale", form_scale, 0); #endif #define rb_curses_define_error(c) do { \ e##c = rb_define_class_under(mCurses, #c, eError); \ } while (0) eError = rb_define_class_under(mCurses, "Error", rb_eStandardError); rb_curses_define_error(SystemError); rb_curses_define_error(BadArgumentError); rb_curses_define_error(PostedError); rb_curses_define_error(ConnectedError); rb_curses_define_error(BadStateError); rb_curses_define_error(NoRoomError); rb_curses_define_error(NotPostedError); rb_curses_define_error(UnknownCommandError); rb_curses_define_error(NoMatchError); rb_curses_define_error(NotSelectableError); rb_curses_define_error(NotConnectedError); rb_curses_define_error(RequestDeniedError); rb_curses_define_error(InvalidFieldError); rb_curses_define_error(CurrentError); #define rb_curses_define_const(c) rb_define_const(mCurses,#c,CHTYPE2NUM(c)) #ifdef USE_COLOR /* Document-const: A_ATTRIBUTES * * Character attribute mask: * Bit-mask to extract attributes * * See Curses.inch or Curses::Window.inch */ rb_curses_define_const(A_ATTRIBUTES); #ifdef A_NORMAL /* Document-const: A_NORMAL * * Attribute mask: * Normal display (no highlight) * * See Curses.attrset */ rb_curses_define_const(A_NORMAL); #endif /* Document-const: A_STANDOUT * * Attribute mask: * Best highlighting mode of the terminal. * * See Curses.attrset */ rb_curses_define_const(A_STANDOUT); /* Document-const: A_UNDERLINE * * Attribute mask: * Underlining * * See Curses.attrset */ rb_curses_define_const(A_UNDERLINE); /* Document-const: A_REVERSE * * Attribute mask: * Reverse video * * See Curses.attrset */ rb_curses_define_const(A_REVERSE); /* Document-const: A_BLINK * * Attribute mask: * Blinking * * See Curses.attrset */ rb_curses_define_const(A_BLINK); /* Document-const: A_DIM * * Attribute mask: * Half bright * * See Curses.attrset */ rb_curses_define_const(A_DIM); /* Document-const: A_BOLD * * Attribute mask: * Extra bright or bold * * See Curses.attrset */ rb_curses_define_const(A_BOLD); /* Document-const: A_PROTECT * * Attribute mask: * Protected mode * * See Curses.attrset */ rb_curses_define_const(A_PROTECT); #ifdef A_INVIS /* for NetBSD */ /* Document-const: A_INVIS * * Attribute mask: * Invisible or blank mode * * See Curses.attrset */ rb_curses_define_const(A_INVIS); #endif /* Document-const: A_ALTCHARSET * * Attribute mask: * Alternate character set * * See Curses.attrset */ rb_curses_define_const(A_ALTCHARSET); /* Document-const: A_CHARTEXT * * Attribute mask: * Bit-mask to extract a character * * See Curses.attrset */ rb_curses_define_const(A_CHARTEXT); #ifdef A_HORIZONTAL /* Document-const: A_HORIZONTAL * * Attribute mask: * horizontal highlight * * Check system curs_attr(3x) for support */ rb_curses_define_const(A_HORIZONTAL); #endif #ifdef A_LEFT /* Document-const: A_LEFT * * Attribute mask: * left highlight * * Check system curs_attr(3x) for support */ rb_curses_define_const(A_LEFT); #endif #ifdef A_LOW /* Document-const: A_LOW * * Attribute mask: * low highlight * * Check system curs_attr(3x) for support */ rb_curses_define_const(A_LOW); #endif #ifdef A_RIGHT /* Document-const: A_RIGHT * * Attribute mask: * right highlight * * Check system curs_attr(3x) for support */ rb_curses_define_const(A_RIGHT); #endif #ifdef A_TOP /* Document-const: A_TOP * * Attribute mask: * top highlight * * Check system curs_attr(3x) for support */ rb_curses_define_const(A_TOP); #endif #ifdef A_VERTICAL /* Document-const: A_VERTICAL * * Attribute mask: * vertical highlight * * Check system curs_attr(3x) for support */ rb_curses_define_const(A_VERTICAL); #endif /* Document-const: A_COLOR * * Character attribute mask: * Bit-mask to extract color-pair field information * * See Curses.inch or Curses::Window.inch */ rb_curses_define_const(A_COLOR); #ifdef COLORS /* * Document-const: Curses::COLORS * * Number of the colors available */ rb_curses_define_const(COLORS); #endif /* * Document-const: Curses::COLOR_BLACK * * Value of the color black */ rb_curses_define_const(COLOR_BLACK); /* * Document-const: COLOR_RED * * Value of the color red */ rb_curses_define_const(COLOR_RED); /* * Document-const: COLOR_GREEN * * Value of the color green */ rb_curses_define_const(COLOR_GREEN); /* * Document-const: COLOR_YELLOW * * Value of the color yellow */ rb_curses_define_const(COLOR_YELLOW); /* * Document-const: COLOR_BLUE * * Value of the color blue */ rb_curses_define_const(COLOR_BLUE); /* * Document-const: COLOR_MAGENTA * * Value of the color magenta */ rb_curses_define_const(COLOR_MAGENTA); /* * Document-const: COLOR_CYAN * * Value of the color cyan */ rb_curses_define_const(COLOR_CYAN); /* * Document-const: COLOR_WHITE * * Value of the color white */ rb_curses_define_const(COLOR_WHITE); #endif /* USE_COLOR */ #ifdef USE_MOUSE #ifdef BUTTON1_PRESSED /* Document-const: BUTTON1_PRESSED * * Mouse event mask: * mouse button 1 down * * See Curses.getmouse */ rb_curses_define_const(BUTTON1_PRESSED); #endif #ifdef BUTTON1_RELEASED /* Document-const: BUTTON1_RELEASED * * Mouse event mask: * mouse button 1 up * * See Curses.getmouse */ rb_curses_define_const(BUTTON1_RELEASED); #endif #ifdef BUTTON1_CLICKED /* Document-const: BUTTON1_CLICKED * * Mouse event mask: * mouse button 1 clicked * * See Curses.getmouse */ rb_curses_define_const(BUTTON1_CLICKED); #endif #ifdef BUTTON1_DOUBLE_CLICKED /* Document-const: BUTTON1_DOUBLE_CLICKED * * Mouse event mask: * mouse button 1 double clicked * * See Curses.getmouse */ rb_curses_define_const(BUTTON1_DOUBLE_CLICKED); #endif #ifdef BUTTON1_TRIPLE_CLICKED /* Document-const: BUTTON1_TRIPLE_CLICKED * * Mouse event mask: * mouse button 1 triple clicked * * See Curses.getmouse */ rb_curses_define_const(BUTTON1_TRIPLE_CLICKED); #endif #ifdef BUTTON2_PRESSED /* Document-const: BUTTON2_PRESSED * * Mouse event mask: * mouse button 2 down * * See Curses.getmouse */ rb_curses_define_const(BUTTON2_PRESSED); #endif #ifdef BUTTON2_RELEASED /* Document-const: BUTTON2_RELEASED * * Mouse event mask: * mouse button 2 up * * See Curses.getmouse */ rb_curses_define_const(BUTTON2_RELEASED); #endif #ifdef BUTTON2_CLICKED /* Document-const: BUTTON2_CLICKED * * Mouse event mask: * mouse button 2 clicked * * See Curses.getmouse */ rb_curses_define_const(BUTTON2_CLICKED); #endif #ifdef BUTTON2_DOUBLE_CLICKED /* Document-const: BUTTON2_DOUBLE_CLICKED * * Mouse event mask: * mouse button 2 double clicked * * See Curses.getmouse */ rb_curses_define_const(BUTTON2_DOUBLE_CLICKED); #endif #ifdef BUTTON2_TRIPLE_CLICKED /* Document-const: BUTTON2_TRIPLE_CLICKED * * Mouse event mask: * mouse button 2 triple clicked * * See Curses.getmouse */ rb_curses_define_const(BUTTON2_TRIPLE_CLICKED); #endif #ifdef BUTTON3_PRESSED /* Document-const: BUTTON3_PRESSED * * Mouse event mask: * mouse button 3 down * * See Curses.getmouse */ rb_curses_define_const(BUTTON3_PRESSED); #endif #ifdef BUTTON3_RELEASED /* Document-const: BUTTON3_RELEASED * * Mouse event mask: * mouse button 3 up * * See Curses.getmouse */ rb_curses_define_const(BUTTON3_RELEASED); #endif #ifdef BUTTON3_CLICKED /* Document-const: BUTTON3_CLICKED * * Mouse event mask: * mouse button 3 clicked * * See Curses.getmouse */ rb_curses_define_const(BUTTON3_CLICKED); #endif #ifdef BUTTON3_DOUBLE_CLICKED /* Document-const: BUTTON3_DOUBLE_CLICKED * * Mouse event mask: * mouse button 3 double clicked * * See Curses.getmouse */ rb_curses_define_const(BUTTON3_DOUBLE_CLICKED); #endif #ifdef BUTTON3_TRIPLE_CLICKED /* Document-const: BUTTON3_TRIPLE_CLICKED * * Mouse event mask: * mouse button 3 triple clicked * * See Curses.getmouse */ rb_curses_define_const(BUTTON3_TRIPLE_CLICKED); #endif #ifdef BUTTON4_PRESSED /* Document-const: BUTTON4_PRESSED * * Mouse event mask: * mouse button 4 down * * See Curses.getmouse */ rb_curses_define_const(BUTTON4_PRESSED); #endif #ifdef BUTTON4_RELEASED /* Document-const: BUTTON4_RELEASED * * Mouse event mask: * mouse button 4 up * * See Curses.getmouse */ rb_curses_define_const(BUTTON4_RELEASED); #endif #ifdef BUTTON4_CLICKED /* Document-const: BUTTON4_CLICKED * * Mouse event mask: * mouse button 4 clicked * * See Curses.getmouse */ rb_curses_define_const(BUTTON4_CLICKED); #endif #ifdef BUTTON4_DOUBLE_CLICKED /* Document-const: BUTTON4_DOUBLE_CLICKED * * Mouse event mask: * mouse button 4 double clicked * * See Curses.getmouse */ rb_curses_define_const(BUTTON4_DOUBLE_CLICKED); #endif #ifdef BUTTON4_TRIPLE_CLICKED /* Document-const: BUTTON4_TRIPLE_CLICKED * * Mouse event mask: * mouse button 4 triple clicked * * See Curses.getmouse */ rb_curses_define_const(BUTTON4_TRIPLE_CLICKED); #endif #ifdef BUTTON_SHIFT /* Document-const: BUTTON_SHIFT * * Mouse event mask: * shift was down during button state change * * See Curses.getmouse */ rb_curses_define_const(BUTTON_SHIFT); #endif #ifdef BUTTON_CTRL /* Document-const: BUTTON_CTRL * * Mouse event mask: * control was down during button state change * * See Curses.getmouse */ rb_curses_define_const(BUTTON_CTRL); #endif #ifdef BUTTON_ALT /* Document-const: BUTTON_ALT * * Mouse event mask: * alt was down during button state change * * See Curses.getmouse */ rb_curses_define_const(BUTTON_ALT); #endif #ifdef ALL_MOUSE_EVENTS /* Document-const: ALL_MOUSE_EVENTS * * Mouse event mask: * report all button state changes * * See Curses.getmouse */ rb_curses_define_const(ALL_MOUSE_EVENTS); #endif #ifdef REPORT_MOUSE_POSITION /* Document-const: REPORT_MOUSE_POSITION * * Mouse event mask: * report mouse movement * * See Curses.getmouse */ rb_curses_define_const(REPORT_MOUSE_POSITION); #endif #endif /* USE_MOUSE */ #if defined(KEY_MOUSE) && defined(USE_MOUSE) /* Document-const: KEY_MOUSE * Mouse event read */ /* Document-const: MOUSE * Mouse event read */ rb_curses_define_const(KEY_MOUSE); rb_define_const(mKey, "MOUSE", INT2NUM(KEY_MOUSE)); #endif #ifdef KEY_MIN /* Document-const: KEY_MIN * The minimum allowed curses key value. */ /* Document-const: MIN * The minimum allowed curses key value. */ rb_curses_define_const(KEY_MIN); rb_define_const(mKey, "MIN", INT2NUM(KEY_MIN)); #endif #ifdef KEY_BREAK /* Document-const: KEY_BREAK * Break key */ /* Document-const: BREAK * Break key */ rb_curses_define_const(KEY_BREAK); rb_define_const(mKey, "BREAK", INT2NUM(KEY_BREAK)); #endif #ifdef KEY_DOWN /* Document-const: KEY_DOWN * the down arrow key */ /* Document-const: DOWN * the down arrow key */ rb_curses_define_const(KEY_DOWN); rb_define_const(mKey, "DOWN", INT2NUM(KEY_DOWN)); #endif #ifdef KEY_UP /* Document-const: KEY_UP * the up arrow key */ /* Document-const: UP * the up arrow key */ rb_curses_define_const(KEY_UP); rb_define_const(mKey, "UP", INT2NUM(KEY_UP)); #endif #ifdef KEY_LEFT /* Document-const: KEY_LEFT * the left arrow key */ /* Document-const: LEFT * the left arrow key */ rb_curses_define_const(KEY_LEFT); rb_define_const(mKey, "LEFT", INT2NUM(KEY_LEFT)); #endif #ifdef KEY_RIGHT /* Document-const: KEY_RIGHT * the right arrow key */ /* Document-const: RIGHT * the right arrow key */ rb_curses_define_const(KEY_RIGHT); rb_define_const(mKey, "RIGHT", INT2NUM(KEY_RIGHT)); #endif #ifdef KEY_HOME /* Document-const: KEY_HOME * Home key (upward+left arrow) */ /* Document-const: HOME * Home key (upward+left arrow) */ rb_curses_define_const(KEY_HOME); rb_define_const(mKey, "HOME", INT2NUM(KEY_HOME)); #endif #ifdef KEY_BACKSPACE /* Document-const: KEY_BACKSPACE * Backspace */ /* Document-const: BACKSPACE * Backspace */ rb_curses_define_const(KEY_BACKSPACE); rb_define_const(mKey, "BACKSPACE", INT2NUM(KEY_BACKSPACE)); #endif #ifdef KEY_F /* KEY_F(n) : 0 <= n <= 63 */ { int i; char c[8]; for (i=0; i<64; i++) { sprintf(c, "KEY_F%d", i); rb_define_const(mCurses, c, INT2NUM(KEY_F(i))); sprintf(c, "F%d", i); rb_define_const(mKey, c, INT2NUM(KEY_F(i))); } } #endif #ifdef KEY_DL /* Document-const: KEY_DL * Delete line */ /* Document-const: DL * Delete line */ rb_curses_define_const(KEY_DL); rb_define_const(mKey, "DL", INT2NUM(KEY_DL)); #endif #ifdef KEY_IL /* Document-const: KEY_IL * Insert line */ /* Document-const: IL * Insert line */ rb_curses_define_const(KEY_IL); rb_define_const(mKey, "IL", INT2NUM(KEY_IL)); #endif #ifdef KEY_DC /* Document-const: KEY_DC * Delete character */ /* Document-const: DC * Delete character */ rb_curses_define_const(KEY_DC); rb_define_const(mKey, "DC", INT2NUM(KEY_DC)); #endif #ifdef KEY_IC /* Document-const: KEY_IC * Insert char or enter insert mode */ /* Document-const: IC * Insert char or enter insert mode */ rb_curses_define_const(KEY_IC); rb_define_const(mKey, "IC", INT2NUM(KEY_IC)); #endif #ifdef KEY_EIC /* Document-const: KEY_EIC * Enter insert char mode */ /* Document-const: EIC * Enter insert char mode */ rb_curses_define_const(KEY_EIC); rb_define_const(mKey, "EIC", INT2NUM(KEY_EIC)); #endif #ifdef KEY_CLEAR /* Document-const: KEY_CLEAR * Clear Screen */ /* Document-const: CLEAR * Clear Screen */ rb_curses_define_const(KEY_CLEAR); rb_define_const(mKey, "CLEAR", INT2NUM(KEY_CLEAR)); #endif #ifdef KEY_EOS /* Document-const: KEY_EOS * Clear to end of screen */ /* Document-const: EOS * Clear to end of screen */ rb_curses_define_const(KEY_EOS); rb_define_const(mKey, "EOS", INT2NUM(KEY_EOS)); #endif #ifdef KEY_EOL /* Document-const: KEY_EOL * Clear to end of line */ /* Document-const: EOL * Clear to end of line */ rb_curses_define_const(KEY_EOL); rb_define_const(mKey, "EOL", INT2NUM(KEY_EOL)); #endif #ifdef KEY_SF /* Document-const: KEY_SF * Scroll 1 line forward */ /* Document-const: SF * Scroll 1 line forward */ rb_curses_define_const(KEY_SF); rb_define_const(mKey, "SF", INT2NUM(KEY_SF)); #endif #ifdef KEY_SR /* Document-const: KEY_SR * Scroll 1 line backward (reverse) */ /* Document-const: SR * Scroll 1 line backward (reverse) */ rb_curses_define_const(KEY_SR); rb_define_const(mKey, "SR", INT2NUM(KEY_SR)); #endif #ifdef KEY_NPAGE /* Document-const: KEY_NPAGE * Next page */ /* Document-const: NPAGE * Next page */ rb_curses_define_const(KEY_NPAGE); rb_define_const(mKey, "NPAGE", INT2NUM(KEY_NPAGE)); #endif #ifdef KEY_PPAGE /* Document-const: KEY_PPAGE * Previous page */ /* Document-const: PPAGE * Previous page */ rb_curses_define_const(KEY_PPAGE); rb_define_const(mKey, "PPAGE", INT2NUM(KEY_PPAGE)); #endif #ifdef KEY_STAB /* Document-const: KEY_STAB * Set tab */ /* Document-const: STAB * Set tab */ rb_curses_define_const(KEY_STAB); rb_define_const(mKey, "STAB", INT2NUM(KEY_STAB)); #endif #ifdef KEY_CTAB /* Document-const: KEY_CTAB * Clear tab */ /* Document-const: CTAB * Clear tab */ rb_curses_define_const(KEY_CTAB); rb_define_const(mKey, "CTAB", INT2NUM(KEY_CTAB)); #endif #ifdef KEY_CATAB /* Document-const: KEY_CATAB * Clear all tabs */ /* Document-const: CATAB * Clear all tabs */ rb_curses_define_const(KEY_CATAB); rb_define_const(mKey, "CATAB", INT2NUM(KEY_CATAB)); #endif #ifdef KEY_ENTER /* Document-const: KEY_ENTER * Enter or send */ /* Document-const: ENTER * Enter or send */ rb_curses_define_const(KEY_ENTER); rb_define_const(mKey, "ENTER", INT2NUM(KEY_ENTER)); #endif #ifdef KEY_SRESET /* Document-const: KEY_SRESET * Soft (partial) reset */ /* Document-const: SRESET * Soft (partial) reset */ rb_curses_define_const(KEY_SRESET); rb_define_const(mKey, "SRESET", INT2NUM(KEY_SRESET)); #endif #ifdef KEY_RESET /* Document-const: KEY_RESET * Reset or hard reset */ /* Document-const: RESET * Reset or hard reset */ rb_curses_define_const(KEY_RESET); rb_define_const(mKey, "RESET", INT2NUM(KEY_RESET)); #endif #ifdef KEY_PRINT /* Document-const: KEY_PRINT * Print or copy */ /* Document-const: PRINT * Print or copy */ rb_curses_define_const(KEY_PRINT); rb_define_const(mKey, "PRINT", INT2NUM(KEY_PRINT)); #endif #ifdef KEY_LL /* Document-const: KEY_LL * Home down or bottom (lower left) */ /* Document-const: LL * Home down or bottom (lower left) */ rb_curses_define_const(KEY_LL); rb_define_const(mKey, "LL", INT2NUM(KEY_LL)); #endif #ifdef KEY_A1 /* Document-const: KEY_A1 * Upper left of keypad */ /* Document-const: A1 * Upper left of keypad */ rb_curses_define_const(KEY_A1); rb_define_const(mKey, "A1", INT2NUM(KEY_A1)); #endif #ifdef KEY_A3 /* Document-const: KEY_A3 * Upper right of keypad */ /* Document-const: A3 * Upper right of keypad */ rb_curses_define_const(KEY_A3); rb_define_const(mKey, "A3", INT2NUM(KEY_A3)); #endif #ifdef KEY_B2 /* Document-const: KEY_B2 * Center of keypad */ /* Document-const: B2 * Center of keypad */ rb_curses_define_const(KEY_B2); rb_define_const(mKey, "B2", INT2NUM(KEY_B2)); #endif #ifdef KEY_C1 /* Document-const: KEY_C1 * Lower left of keypad */ /* Document-const: C1 * Lower left of keypad */ rb_curses_define_const(KEY_C1); rb_define_const(mKey, "C1", INT2NUM(KEY_C1)); #endif #ifdef KEY_C3 /* Document-const: KEY_C3 * Lower right of keypad */ /* Document-const: C3 * Lower right of keypad */ rb_curses_define_const(KEY_C3); rb_define_const(mKey, "C3", INT2NUM(KEY_C3)); #endif #ifdef KEY_BTAB /* Document-const: BTAB * Back tab key */ /* Document-const: KEY_BTAB * Back tab key */ rb_curses_define_const(KEY_BTAB); rb_define_const(mKey, "BTAB", INT2NUM(KEY_BTAB)); #endif #ifdef KEY_BEG /* Document-const: KEY_BEG * Beginning key */ /* Document-const: BEG * Beginning key */ rb_curses_define_const(KEY_BEG); rb_define_const(mKey, "BEG", INT2NUM(KEY_BEG)); #endif #ifdef KEY_CANCEL /* Document-const: KEY_CANCEL * Cancel key */ /* Document-const: CANCEL * Cancel key */ rb_curses_define_const(KEY_CANCEL); rb_define_const(mKey, "CANCEL", INT2NUM(KEY_CANCEL)); #endif #ifdef KEY_CLOSE /* Document-const: KEY_CLOSE * Close key */ /* Document-const: CLOSE * Close key */ rb_curses_define_const(KEY_CLOSE); rb_define_const(mKey, "CLOSE", INT2NUM(KEY_CLOSE)); #endif #ifdef KEY_COMMAND /* Document-const: KEY_COMMAND * Cmd (command) key */ /* Document-const: COMMAND * Cmd (command) key */ rb_curses_define_const(KEY_COMMAND); rb_define_const(mKey, "COMMAND", INT2NUM(KEY_COMMAND)); #endif #ifdef KEY_COPY /* Document-const: KEY_COPY * Copy key */ /* Document-const: COPY * Copy key */ rb_curses_define_const(KEY_COPY); rb_define_const(mKey, "COPY", INT2NUM(KEY_COPY)); #endif #ifdef KEY_CREATE /* Document-const: KEY_CREATE * Create key */ /* Document-const: CREATE * Create key */ rb_curses_define_const(KEY_CREATE); rb_define_const(mKey, "CREATE", INT2NUM(KEY_CREATE)); #endif #ifdef KEY_END /* Document-const: KEY_END * End key */ /* Document-const: END * End key */ rb_curses_define_const(KEY_END); rb_define_const(mKey, "END", INT2NUM(KEY_END)); #endif #ifdef KEY_EXIT /* Document-const: KEY_EXIT * Exit key */ /* Document-const: EXIT * Exit key */ rb_curses_define_const(KEY_EXIT); rb_define_const(mKey, "EXIT", INT2NUM(KEY_EXIT)); #endif #ifdef KEY_FIND /* Document-const: KEY_FIND * Find key */ /* Document-const: FIND * Find key */ rb_curses_define_const(KEY_FIND); rb_define_const(mKey, "FIND", INT2NUM(KEY_FIND)); #endif #ifdef KEY_HELP /* Document-const: KEY_HELP * Help key */ /* Document-const: HELP * Help key */ rb_curses_define_const(KEY_HELP); rb_define_const(mKey, "HELP", INT2NUM(KEY_HELP)); #endif #ifdef KEY_MARK /* Document-const: KEY_MARK * Mark key */ /* Document-const: MARK * Mark key */ rb_curses_define_const(KEY_MARK); rb_define_const(mKey, "MARK", INT2NUM(KEY_MARK)); #endif #ifdef KEY_MESSAGE /* Document-const: KEY_MESSAGE * Message key */ /* Document-const: MESSAGE * Message key */ rb_curses_define_const(KEY_MESSAGE); rb_define_const(mKey, "MESSAGE", INT2NUM(KEY_MESSAGE)); #endif #ifdef KEY_MOVE /* Document-const: KEY_MOVE * Move key */ /* Document-const: MOVE * Move key */ rb_curses_define_const(KEY_MOVE); rb_define_const(mKey, "MOVE", INT2NUM(KEY_MOVE)); #endif #ifdef KEY_NEXT /* Document-const: KEY_NEXT * Next object key */ /* Document-const: NEXT * Next object key */ rb_curses_define_const(KEY_NEXT); rb_define_const(mKey, "NEXT", INT2NUM(KEY_NEXT)); #endif #ifdef KEY_OPEN /* Document-const: KEY_OPEN * Open key */ /* Document-const: OPEN * Open key */ rb_curses_define_const(KEY_OPEN); rb_define_const(mKey, "OPEN", INT2NUM(KEY_OPEN)); #endif #ifdef KEY_OPTIONS /* Document-const: KEY_OPTIONS * Options key */ /* Document-const: OPTIONS * Options key */ rb_curses_define_const(KEY_OPTIONS); rb_define_const(mKey, "OPTIONS", INT2NUM(KEY_OPTIONS)); #endif #ifdef KEY_PREVIOUS /* Document-const: KEY_PREVIOUS * Previous object key */ /* Document-const: PREVIOUS * Previous object key */ rb_curses_define_const(KEY_PREVIOUS); rb_define_const(mKey, "PREVIOUS", INT2NUM(KEY_PREVIOUS)); #endif #ifdef KEY_REDO /* Document-const: KEY_REDO * Redo key */ /* Document-const: REDO * Redo key */ rb_curses_define_const(KEY_REDO); rb_define_const(mKey, "REDO", INT2NUM(KEY_REDO)); #endif #ifdef KEY_REFERENCE /* Document-const: KEY_REFERENCE * Reference key */ /* Document-const: REFERENCE * Reference key */ rb_curses_define_const(KEY_REFERENCE); rb_define_const(mKey, "REFERENCE", INT2NUM(KEY_REFERENCE)); #endif #ifdef KEY_REFRESH /* Document-const: KEY_REFRESH * Refresh key */ /* Document-const: REFRESH * Refresh key */ rb_curses_define_const(KEY_REFRESH); rb_define_const(mKey, "REFRESH", INT2NUM(KEY_REFRESH)); #endif #ifdef KEY_REPLACE /* Document-const: KEY_REPLACE * Replace key */ /* Document-const: REPLACE * Replace key */ rb_curses_define_const(KEY_REPLACE); rb_define_const(mKey, "REPLACE", INT2NUM(KEY_REPLACE)); #endif #ifdef KEY_RESTART /* Document-const: KEY_RESTART * Restart key */ /* Document-const: RESTART * Restart key */ rb_curses_define_const(KEY_RESTART); rb_define_const(mKey, "RESTART", INT2NUM(KEY_RESTART)); #endif #ifdef KEY_RESUME /* Document-const: KEY_RESUME * Resume key */ /* Document-const: RESUME * Resume key */ rb_curses_define_const(KEY_RESUME); rb_define_const(mKey, "RESUME", INT2NUM(KEY_RESUME)); #endif #ifdef KEY_SAVE /* Document-const: KEY_SAVE * Save key */ /* Document-const: SAVE * Save key */ rb_curses_define_const(KEY_SAVE); rb_define_const(mKey, "SAVE", INT2NUM(KEY_SAVE)); #endif #ifdef KEY_SBEG /* Document-const: KEY_SBEG * Shifted beginning key */ /* Document-const: SBEG * Shifted beginning key */ rb_curses_define_const(KEY_SBEG); rb_define_const(mKey, "SBEG", INT2NUM(KEY_SBEG)); #endif #ifdef KEY_SCANCEL /* Document-const: KEY_SCANCEL * Shifted cancel key */ /* Document-const: SCANCEL * Shifted cancel key */ rb_curses_define_const(KEY_SCANCEL); rb_define_const(mKey, "SCANCEL", INT2NUM(KEY_SCANCEL)); #endif #ifdef KEY_SCOMMAND /* Document-const: KEY_SCOMMAND * Shifted command key */ /* Document-const: SCOMMAND * Shifted command key */ rb_curses_define_const(KEY_SCOMMAND); rb_define_const(mKey, "SCOMMAND", INT2NUM(KEY_SCOMMAND)); #endif #ifdef KEY_SCOPY /* Document-const: KEY_SCOPY * Shifted copy key */ /* Document-const: SCOPY * Shifted copy key */ rb_curses_define_const(KEY_SCOPY); rb_define_const(mKey, "SCOPY", INT2NUM(KEY_SCOPY)); #endif #ifdef KEY_SCREATE /* Document-const: KEY_SCREATE * Shifted create key */ /* Document-const: SCREATE * Shifted create key */ rb_curses_define_const(KEY_SCREATE); rb_define_const(mKey, "SCREATE", INT2NUM(KEY_SCREATE)); #endif #ifdef KEY_SDC /* Document-const: KEY_SDC * Shifted delete char key */ /* Document-const: SDC * Shifted delete char key */ rb_curses_define_const(KEY_SDC); rb_define_const(mKey, "SDC", INT2NUM(KEY_SDC)); #endif #ifdef KEY_SDL /* Document-const: KEY_SDL * Shifted delete line key */ /* Document-const: SDL * Shifted delete line key */ rb_curses_define_const(KEY_SDL); rb_define_const(mKey, "SDL", INT2NUM(KEY_SDL)); #endif #ifdef KEY_SELECT /* Document-const: KEY_SELECT * Select key */ /* Document-const: SELECT * Select key */ rb_curses_define_const(KEY_SELECT); rb_define_const(mKey, "SELECT", INT2NUM(KEY_SELECT)); #endif #ifdef KEY_SEND /* Document-const: KEY_SEND * Shifted end key */ /* Document-const: SEND * Shifted end key */ rb_curses_define_const(KEY_SEND); rb_define_const(mKey, "SEND", INT2NUM(KEY_SEND)); #endif #ifdef KEY_SEOL /* Document-const: KEY_SEOL * Shifted clear line key */ /* Document-const: SEOL * Shifted clear line key */ rb_curses_define_const(KEY_SEOL); rb_define_const(mKey, "SEOL", INT2NUM(KEY_SEOL)); #endif #ifdef KEY_SEXIT /* Document-const: KEY_SEXIT * Shifted exit key */ /* Document-const: SEXIT * Shifted exit key */ rb_curses_define_const(KEY_SEXIT); rb_define_const(mKey, "SEXIT", INT2NUM(KEY_SEXIT)); #endif #ifdef KEY_SFIND /* Document-const: KEY_SFIND * Shifted find key */ /* Document-const: SFIND * Shifted find key */ rb_curses_define_const(KEY_SFIND); rb_define_const(mKey, "SFIND", INT2NUM(KEY_SFIND)); #endif #ifdef KEY_SHELP /* Document-const: KEY_SHELP * Shifted help key */ /* Document-const: SHELP * Shifted help key */ rb_curses_define_const(KEY_SHELP); rb_define_const(mKey, "SHELP", INT2NUM(KEY_SHELP)); #endif #ifdef KEY_SHOME /* Document-const: KEY_SHOME * Shifted home key */ /* Document-const: SHOME * Shifted home key */ rb_curses_define_const(KEY_SHOME); rb_define_const(mKey, "SHOME", INT2NUM(KEY_SHOME)); #endif #ifdef KEY_SIC /* Document-const: KEY_SIC * Shifted input key */ /* Document-const: SIC * Shifted input key */ rb_curses_define_const(KEY_SIC); rb_define_const(mKey, "SIC", INT2NUM(KEY_SIC)); #endif #ifdef KEY_SLEFT /* Document-const: KEY_SLEFT * Shifted left arrow key */ /* Document-const: SLEFT * Shifted left arrow key */ rb_curses_define_const(KEY_SLEFT); rb_define_const(mKey, "SLEFT", INT2NUM(KEY_SLEFT)); #endif #ifdef KEY_SMESSAGE /* Document-const: KEY_SMESSAGE * Shifted message key */ /* Document-const: SMESSAGE * Shifted message key */ rb_curses_define_const(KEY_SMESSAGE); rb_define_const(mKey, "SMESSAGE", INT2NUM(KEY_SMESSAGE)); #endif #ifdef KEY_SMOVE /* Document-const: KEY_SMOVE * Shifted move key */ /* Document-const: SMOVE * Shifted move key */ rb_curses_define_const(KEY_SMOVE); rb_define_const(mKey, "SMOVE", INT2NUM(KEY_SMOVE)); #endif #ifdef KEY_SNEXT /* Document-const: KEY_SNEXT * Shifted next key */ /* Document-const: SNEXT * Shifted next key */ rb_curses_define_const(KEY_SNEXT); rb_define_const(mKey, "SNEXT", INT2NUM(KEY_SNEXT)); #endif #ifdef KEY_SOPTIONS /* Document-const: KEY_SOPTIONS * Shifted options key */ /* Document-const: SOPTIONS * Shifted options key */ rb_curses_define_const(KEY_SOPTIONS); rb_define_const(mKey, "SOPTIONS", INT2NUM(KEY_SOPTIONS)); #endif #ifdef KEY_SPREVIOUS /* Document-const: KEY_SPREVIOUS * Shifted previous key */ /* Document-const: SPREVIOUS * Shifted previous key */ rb_curses_define_const(KEY_SPREVIOUS); rb_define_const(mKey, "SPREVIOUS", INT2NUM(KEY_SPREVIOUS)); #endif #ifdef KEY_SPRINT /* Document-const: KEY_SPRINT * Shifted print key */ /* Document-const: SPRINT * Shifted print key */ rb_curses_define_const(KEY_SPRINT); rb_define_const(mKey, "SPRINT", INT2NUM(KEY_SPRINT)); #endif #ifdef KEY_SREDO /* Document-const: KEY_SREDO * Shifted redo key */ /* Document-const: SREDO * Shifted redo key */ rb_curses_define_const(KEY_SREDO); rb_define_const(mKey, "SREDO", INT2NUM(KEY_SREDO)); #endif #ifdef KEY_SREPLACE /* Document-const: KEY_SREPLACE * Shifted replace key */ /* Document-const: SREPLACE * Shifted replace key */ rb_curses_define_const(KEY_SREPLACE); rb_define_const(mKey, "SREPLACE", INT2NUM(KEY_SREPLACE)); #endif #ifdef KEY_SRIGHT /* Document-const: KEY_SRIGHT * Shifted right arrow key */ /* Document-const: SRIGHT * Shifted right arrow key */ rb_curses_define_const(KEY_SRIGHT); rb_define_const(mKey, "SRIGHT", INT2NUM(KEY_SRIGHT)); #endif #ifdef KEY_SRSUME /* Document-const: KEY_SRSUME * Shifted resume key */ /* Document-const: SRSUME * Shifted resume key */ rb_curses_define_const(KEY_SRSUME); rb_define_const(mKey, "SRSUME", INT2NUM(KEY_SRSUME)); #endif #ifdef KEY_SSAVE /* Document-const: KEY_SSAVE * Shifted save key */ /* Document-const: SSAVE * Shifted save key */ rb_curses_define_const(KEY_SSAVE); rb_define_const(mKey, "SSAVE", INT2NUM(KEY_SSAVE)); #endif #ifdef KEY_SSUSPEND /* Document-const: KEY_SSUSPEND * Shifted suspend key */ /* Document-const: SSUSPEND * Shifted suspend key */ rb_curses_define_const(KEY_SSUSPEND); rb_define_const(mKey, "SSUSPEND", INT2NUM(KEY_SSUSPEND)); #endif #ifdef KEY_SUNDO /* Document-const: KEY_SUNDO * Shifted undo key */ /* Document-const: SUNDO * Shifted undo key */ rb_curses_define_const(KEY_SUNDO); rb_define_const(mKey, "SUNDO", INT2NUM(KEY_SUNDO)); #endif #ifdef KEY_SUSPEND /* Document-const: KEY_SUSPEND * Suspend key */ /* Document-const: SUSPEND * Suspend key */ rb_curses_define_const(KEY_SUSPEND); rb_define_const(mKey, "SUSPEND", INT2NUM(KEY_SUSPEND)); #endif #ifdef KEY_UNDO /* Document-const: KEY_UNDO * Undo key */ /* Document-const: UNDO * Undo key */ rb_curses_define_const(KEY_UNDO); rb_define_const(mKey, "UNDO", INT2NUM(KEY_UNDO)); #endif #ifdef KEY_RESIZE /* Document-const: KEY_RESIZE * Screen Resized */ /* Document-const: RESIZE * Screen Resized */ rb_curses_define_const(KEY_RESIZE); rb_define_const(mKey, "RESIZE", INT2NUM(KEY_RESIZE)); #endif #ifdef KEY_MAX /* Document-const: KEY_MAX * The maximum allowed curses key value. */ /* Document-const: MAX * The maximum allowed curses key value. */ rb_curses_define_const(KEY_MAX); rb_define_const(mKey, "MAX", INT2NUM(KEY_MAX)); #endif { int c; char name[] = "KEY_CTRL_x"; for (c = 'A'; c <= 'Z'; c++) { name[sizeof(name) - 2] = c; rb_define_const(mCurses, name, INT2FIX(c - 'A' + 1)); } } #ifdef PDC_KEY_MODIFIER_SHIFT /* PDCurses-specific keys */ rb_curses_define_const(ALT_0); rb_curses_define_const(ALT_1); rb_curses_define_const(ALT_2); rb_curses_define_const(ALT_3); rb_curses_define_const(ALT_4); rb_curses_define_const(ALT_5); rb_curses_define_const(ALT_6); rb_curses_define_const(ALT_7); rb_curses_define_const(ALT_8); rb_curses_define_const(ALT_9); rb_curses_define_const(ALT_A); rb_curses_define_const(ALT_B); rb_curses_define_const(ALT_C); rb_curses_define_const(ALT_D); rb_curses_define_const(ALT_E); rb_curses_define_const(ALT_F); rb_curses_define_const(ALT_G); rb_curses_define_const(ALT_H); rb_curses_define_const(ALT_I); rb_curses_define_const(ALT_J); rb_curses_define_const(ALT_K); rb_curses_define_const(ALT_L); rb_curses_define_const(ALT_M); rb_curses_define_const(ALT_N); rb_curses_define_const(ALT_O); rb_curses_define_const(ALT_P); rb_curses_define_const(ALT_Q); rb_curses_define_const(ALT_R); rb_curses_define_const(ALT_S); rb_curses_define_const(ALT_T); rb_curses_define_const(ALT_U); rb_curses_define_const(ALT_V); rb_curses_define_const(ALT_W); rb_curses_define_const(ALT_X); rb_curses_define_const(ALT_Y); rb_curses_define_const(ALT_Z); rb_curses_define_const(PDC_KEY_MODIFIER_SHIFT); rb_curses_define_const(PDC_KEY_MODIFIER_CONTROL); rb_curses_define_const(PDC_KEY_MODIFIER_ALT); rb_curses_define_const(PDC_KEY_MODIFIER_NUMLOCK); #endif #ifdef HAVE_MENU rb_curses_define_const(O_ONEVALUE); rb_curses_define_const(O_SHOWDESC); rb_curses_define_const(O_ROWMAJOR); rb_curses_define_const(O_IGNORECASE); rb_curses_define_const(O_SHOWMATCH); rb_curses_define_const(O_NONCYCLIC); #ifdef O_MOUSE_MENU rb_curses_define_const(O_MOUSE_MENU); #endif rb_curses_define_const(O_SELECTABLE); rb_curses_define_const(REQ_LEFT_ITEM); rb_curses_define_const(REQ_RIGHT_ITEM); rb_curses_define_const(REQ_UP_ITEM); rb_curses_define_const(REQ_DOWN_ITEM); rb_curses_define_const(REQ_SCR_ULINE); rb_curses_define_const(REQ_SCR_DLINE); rb_curses_define_const(REQ_SCR_DPAGE); rb_curses_define_const(REQ_SCR_UPAGE); rb_curses_define_const(REQ_FIRST_ITEM); rb_curses_define_const(REQ_LAST_ITEM); rb_curses_define_const(REQ_NEXT_ITEM); rb_curses_define_const(REQ_PREV_ITEM); rb_curses_define_const(REQ_TOGGLE_ITEM); rb_curses_define_const(REQ_CLEAR_PATTERN); rb_curses_define_const(REQ_BACK_PATTERN); rb_curses_define_const(REQ_NEXT_MATCH); rb_curses_define_const(REQ_PREV_MATCH); #endif #ifdef HAVE_FORM rb_curses_define_const(O_VISIBLE); rb_curses_define_const(O_ACTIVE); rb_curses_define_const(O_PUBLIC); rb_curses_define_const(O_EDIT); rb_curses_define_const(O_WRAP); rb_curses_define_const(O_BLANK); rb_curses_define_const(O_AUTOSKIP); rb_curses_define_const(O_NULLOK); rb_curses_define_const(O_PASSOK); rb_curses_define_const(O_STATIC); #ifdef O_DYNAMIC_JUSTIFY rb_curses_define_const(O_DYNAMIC_JUSTIFY); #endif #ifdef O_NO_LEFT_STRIP rb_curses_define_const(O_NO_LEFT_STRIP); #endif rb_define_const(mCurses, "TYPE_ALPHA", INT2NUM(TYPE_CODE_ALPHA)); rb_define_const(mCurses, "TYPE_ALNUM", INT2NUM(TYPE_CODE_ALNUM)); rb_define_const(mCurses, "TYPE_ENUM", INT2NUM(TYPE_CODE_ENUM)); rb_define_const(mCurses, "TYPE_INTEGER", INT2NUM(TYPE_CODE_INTEGER)); rb_define_const(mCurses, "TYPE_NUMERIC", INT2NUM(TYPE_CODE_NUMERIC)); rb_define_const(mCurses, "TYPE_REGEXP", INT2NUM(TYPE_CODE_REGEXP)); rb_curses_define_const(REQ_NEXT_PAGE); rb_curses_define_const(REQ_PREV_PAGE); rb_curses_define_const(REQ_FIRST_PAGE); rb_curses_define_const(REQ_LAST_PAGE); rb_curses_define_const(REQ_NEXT_FIELD); rb_curses_define_const(REQ_PREV_FIELD); rb_curses_define_const(REQ_FIRST_FIELD); rb_curses_define_const(REQ_LAST_FIELD); rb_curses_define_const(REQ_SNEXT_FIELD); rb_curses_define_const(REQ_SPREV_FIELD); rb_curses_define_const(REQ_SFIRST_FIELD); rb_curses_define_const(REQ_SLAST_FIELD); rb_curses_define_const(REQ_LEFT_FIELD); rb_curses_define_const(REQ_RIGHT_FIELD); rb_curses_define_const(REQ_UP_FIELD); rb_curses_define_const(REQ_DOWN_FIELD); rb_curses_define_const(REQ_NEXT_CHAR); rb_curses_define_const(REQ_PREV_CHAR); rb_curses_define_const(REQ_NEXT_LINE); rb_curses_define_const(REQ_PREV_LINE); rb_curses_define_const(REQ_NEXT_WORD); rb_curses_define_const(REQ_PREV_WORD); rb_curses_define_const(REQ_BEG_FIELD); rb_curses_define_const(REQ_END_FIELD); rb_curses_define_const(REQ_BEG_LINE); rb_curses_define_const(REQ_END_LINE); rb_curses_define_const(REQ_LEFT_CHAR); rb_curses_define_const(REQ_RIGHT_CHAR); rb_curses_define_const(REQ_UP_CHAR); rb_curses_define_const(REQ_DOWN_CHAR); rb_curses_define_const(REQ_NEW_LINE); rb_curses_define_const(REQ_INS_CHAR); rb_curses_define_const(REQ_INS_LINE); rb_curses_define_const(REQ_DEL_CHAR); rb_curses_define_const(REQ_DEL_PREV); rb_curses_define_const(REQ_DEL_LINE); rb_curses_define_const(REQ_DEL_WORD); rb_curses_define_const(REQ_CLR_EOL); rb_curses_define_const(REQ_CLR_EOF); rb_curses_define_const(REQ_CLR_FIELD); rb_curses_define_const(REQ_OVL_MODE); rb_curses_define_const(REQ_INS_MODE); rb_curses_define_const(REQ_SCR_FLINE); rb_curses_define_const(REQ_SCR_BLINE); rb_curses_define_const(REQ_SCR_FPAGE); rb_curses_define_const(REQ_SCR_BPAGE); rb_curses_define_const(REQ_SCR_FHPAGE); rb_curses_define_const(REQ_SCR_BHPAGE); rb_curses_define_const(REQ_SCR_FCHAR); rb_curses_define_const(REQ_SCR_BCHAR); rb_curses_define_const(REQ_SCR_HFLINE); rb_curses_define_const(REQ_SCR_HBLINE); rb_curses_define_const(REQ_SCR_HFHALF); rb_curses_define_const(REQ_SCR_HBHALF); rb_curses_define_const(REQ_VALIDATION); rb_curses_define_const(REQ_NEXT_CHOICE); rb_curses_define_const(REQ_PREV_CHOICE); #endif #undef rb_curses_define_const } curses-1.4.4/ext/curses/extconf.rb0000644000004100000410000002077714201713275017172 0ustar www-datawww-datarequire 'mkmf' require 'shellwords' require 'fileutils' def have_all(*args) old_libs = $libs.dup old_defs = $defs.dup result = [] begin args.each {|arg| r = arg.call(*result) if !r return nil end result << r } result ensure if result.length != args.length $libs = old_libs $defs = old_defs end end end def exec_command(cmd) puts "> #{cmd}" if !system(cmd) STDERR.puts("External command failed") exit 1 end end $library_candidates = [ ["ncursesw/curses.h", ["ncursesw"]], ["ncurses.h", ["ncursesw", "ncurses"]], ["ncurses/curses.h", ["ncurses"]], ["curses_colr/curses.h", ["cur_colr"]], ["curses.h", ["curses", "pdcurses"]], # ["xcurses.h", ["XCurses"]], # XCurses (PDCurses for X11) ] $mingw = /mingw/ =~ RUBY_PLATFORM $mswin = /mswin/ =~ RUBY_PLATFORM $windows = $mingw || $mswin $x64 = /x64/ =~ RUBY_PLATFORM $use_system_libs = arg_config('--use-system-libraries', ENV.key?("CURSES_USE_SYSTEM_LIBRARIES")) $idefault = nil $ldefault = nil $pdcurses_wide_default = nil $pdcurses_dll_default = nil $curses_version_default = nil $use_bundled_pdcurses = !$use_system_libs && /mingw|mswin/ =~ RUBY_PLATFORM if $use_bundled_pdcurses $pdcurses_wide_default = true $curses_version_default = "function" pdcurses_dir = File.expand_path("../../vendor/PDCurses", __dir__) $idefault = $ldefault = pdcurses_dir wincon_dir = File.expand_path("wincon", pdcurses_dir) old_dir = Dir.pwd Dir.chdir(wincon_dir) begin if $mswin exec_command "nmake -f Makefile.vc clean all WIDE=Y DLL=Y" FileUtils.cp("pdcurses.dll", pdcurses_dir) FileUtils.cp("pdcurses.lib", pdcurses_dir) $pdcurses_dll_default = true else if $x64 exec_command "make -f Makefile.mng clean all _w64=1 WIDE=Y DLL=N" else exec_command "make -f Makefile.mng clean all WIDE=Y DLL=N" end FileUtils.cp("pdcurses.a", File.expand_path("libpdcurses.a", pdcurses_dir)) end ensure Dir.chdir(old_dir) end FileUtils.cp(File.expand_path("curses.h", pdcurses_dir), File.expand_path("pdcurses.h", pdcurses_dir)) $library_candidates = [ ["pdcurses.h", ["pdcurses"]] ] end dir_config('curses', $idefault, $ldefault) dir_config('ncurses') dir_config('termcap') have_library("mytinfo", "tgetent") if /bow/ =~ RUBY_PLATFORM have_library("tinfow", "tgetent") || have_library("tinfo", "tgetent") || have_library("termcap", "tgetent") header_library = nil $library_candidates.each {|hdr, libs| header_library = have_all( lambda { have_header(hdr) && hdr }, lambda {|h| libs.find {|lib| have_library(lib, "initscr", h) } }) if header_library break; end } if header_library header, library = header_library puts "header: #{header}" puts "library: #{library}" curses = [header] if header == 'curses_colr/curses.h' curses.unshift("varargs.h") end for f in %w(beep bkgd bkgdset curs_set deleteln doupdate flash getbkgd getnstr init isendwin keyname keypad resizeterm scrl set setscrreg ungetch addnwstr wattroff wattron wattrset wbkgd wbkgdset wdeleteln wgetnstr wresize wscrl wsetscrreg werase redrawwin waddnwstr mvderwin derwin touchwin untouchwin wtouchln is_linetouched is_wintouched def_prog_mode reset_prog_mode timeout wtimeout nodelay init_color wcolor_set use_default_colors assume_default_colors newpad unget_wch get_wch wget_wch PDC_get_key_modifiers) have_func(f) || (have_macro(f, curses) && $defs.push(format("-DHAVE_%s", f.upcase))) end convertible_int('chtype', [["#undef MOUSE_MOVED\n"]]+curses) or abort flag = "-D_XOPEN_SOURCE_EXTENDED" if checking_for("_XOPEN_SOURCE_EXTENDED") { try_compile(cpp_include(%w[stdio.h stdlib.h]+curses), flag, :werror => true) } $defs << flag end have_var("ESCDELAY", curses) have_var("TABSIZE", curses) have_var("COLORS", curses) have_var("COLOR_PAIRS", curses) # SVR4 curses has a (undocumented) variable char *curses_version. # ncurses and PDcurses has a function char *curses_version(). # Note that the original BSD curses doesn't provide version information. # # configure option: # --with-curses-version=function for SVR4 # --with-curses-version=variable for ncurses and PDcurses # (not given) automatically determined with_curses_version = with_config("curses-version", $curses_version_default) case with_curses_version when "function" $defs << '-DHAVE_FUNC_CURSES_VERSION' when "variable" $defs << '-DHAVE_VAR_CURSES_VERSION' when nil func_test_program = cpp_include(curses) + <<-"End" int main(int argc, char *argv[]) { curses_version(); return EXIT_SUCCESS; } End var_test_program = cpp_include(curses) + <<-"End" extern char *curses_version; int main(int argc, char *argv[]) { int i = 0; for (i = 0; i < 100; i++) { if (curses_version[i] == 0) return 0 < i ? EXIT_SUCCESS : EXIT_FAILURE; if (curses_version[i] & 0x80) return EXIT_FAILURE; } return EXIT_FAILURE; } End try = method(CROSS_COMPILING ? :try_link : :try_run) function_p = checking_for(checking_message('function curses_version', curses)) { try[func_test_program] } variable_p = checking_for(checking_message('variable curses_version', curses)) { try[var_test_program] } if function_p and variable_p if [header, library].grep(/ncurses|pdcurses|xcurses/i) variable_p = false else warn "found curses_version but cannot determine whether it is a" warn "function or a variable, so assume a variable in old SVR4" warn "ncurses." function_p = false end end $defs << '-DHAVE_FUNC_CURSES_VERSION' if function_p $defs << '-DHAVE_VAR_CURSES_VERSION' if variable_p else warn "unexpected value for --with-curses-version: #{with_curses_version}" end if enable_config("pdcurses-wide", $pdcurses_wide_default) $defs << '-DPDC_WIDE' end if enable_config("pdcurses-dll", $pdcurses_dll_default) $defs << '-DPDC_DLL_BUILD' end if !$use_bundled_pdcurses && (have_header("ncursesw/menu.h") || have_header("ncurses/menu.h") || have_header("curses/menu.h") || have_header("menu.h")) && (have_library("menuw", "new_menu") || have_library("menu", "new_menu")) $defs << '-DHAVE_MENU' end if !$use_bundled_pdcurses && (have_header("ncursesw/form.h") || have_header("ncurses/form.h") || have_header("curses/form.h") || have_header("form.h")) && (have_library("formw", "new_form") || have_library("form", "new_form")) $defs << '-DHAVE_FORM' have_func("form_driver_w") end ["WINDOW", "MEVENT", "ITEM", "MENU", "FIELD", "FORM"].each do |type| checking_for("sizeof(#{type}) is available") { if try_compile(< #elif defined(HAVE_NCURSESW_CURSES_H) # include #elif defined(HAVE_NCURSES_CURSES_H) # include #elif defined(HAVE_NCURSES_H) # include #elif defined(HAVE_CURSES_COLR_CURSES_H) # ifdef HAVE_STDARG_PROTOTYPES # include # else # include # endif # include #else # include #endif #if defined(HAVE_NCURSESW_MENU_H) # include #elif defined(HAVE_NCURSES_MENU_H) # include #elif defined(HAVE_CURSES_MENU_H) # include #elif defined(HAVE_MENU_H) # include #endif #if defined(HAVE_NCURSESW_FORM_H) # include #elif defined(HAVE_NCURSES_FORM_H) # include #elif defined(HAVE_CURSES_FORM_H) # include #elif defined(HAVE_FORM_H) # include #endif const int sizeof_#{type} = (int) sizeof(#{type}); EOF $defs << "-DCURSES_SIZEOF_#{type}=sizeof(#{type})" true else $defs << "-DCURSES_SIZEOF_#{type}=0" false end } end if RUBY_VERSION >= '2.1' create_header create_makefile("curses") else # curses is part of ruby-core pre-2.1.0, so this gem is not required. But # make pre-2.1.0 a no-op rather than failing or listing as unsupported, to # aid gems offering multi-version Ruby support. File.open("Makefile", 'w') do |f| f.puts dummy_makefile("curses").join end end end curses-1.4.4/sample/0000755000004100000410000000000014201713275014337 5ustar www-datawww-datacurses-1.4.4/sample/menu.rb0000644000004100000410000000102614201713275015627 0ustar www-datawww-datarequire "curses" Curses.init_screen Curses.cbreak Curses.noecho Curses.stdscr.keypad = true at_exit do Curses.close_screen end menu = Curses::Menu.new([ Curses::Item.new("Apple", "Red fruit"), Curses::Item.new("Orange", "Orange fruit"), Curses::Item.new("Banana", "Yellow fruit") ]) menu.post while ch = Curses.getch begin case ch when Curses::KEY_UP, ?k menu.up_item when Curses::KEY_DOWN, ?j menu.down_item else break end rescue Curses::RequestDeniedError end end menu.unpost curses-1.4.4/sample/hello.rb0000755000004100000410000000107614201713275015776 0ustar www-datawww-data#!/usr/bin/env ruby require "curses" def show_message(message) height = 5 width = message.length + 6 top = (Curses.lines - height) / 2 left = (Curses.cols - width) / 2 win = Curses::Window.new(height, width, top, left) win.box("|", "-") win.setpos(2, 3) win.addstr(message) win.refresh win.getch win.close end Curses.init_screen begin Curses.crmode Curses.setpos((Curses.lines - 1) / 2, (Curses.cols - 11) / 2) Curses.addstr("Hit any key") Curses.refresh Curses.getch show_message("Hello, World!") ensure Curses.close_screen end curses-1.4.4/sample/colors.rb0000644000004100000410000000070214201713275016164 0ustar www-datawww-datarequire "curses" include Curses begin init_screen if !Curses.has_colors? addstr "This Terminal does not support colors!" else start_color addstr "This Terminal supports #{colors} colors.\n" Curses.colors.times { |i| Curses.init_pair(i, i, 0) attrset(color_pair(i)) addstr("#{i.to_s.rjust(3)} ") addstr("\n") if i == 15 || (i > 16 && (i - 15) % 36 == 0) } end getch ensure close_screen endcurses-1.4.4/sample/mouse.rb0000755000004100000410000000210114201713275016011 0ustar www-datawww-data#!/usr/bin/env ruby require "curses" include Curses def show_message(*msgs) message = msgs.join height, width = 5, message.length + 6 top, left = (lines - height) / 2, (cols - width) / 2 win = Window.new(height, width, top, left) win.keypad = true win.attron(color_pair(COLOR_RED)) do win.box("|", "-", "+") end win.setpos(2, 3) win.addstr(message) win.refresh win.getch win.close end init_screen start_color init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_WHITE) init_pair(COLOR_RED, COLOR_RED, COLOR_WHITE) crmode noecho stdscr.keypad(true) begin mousemask(BUTTON1_CLICKED|BUTTON2_CLICKED|BUTTON3_CLICKED|BUTTON4_CLICKED) setpos((lines - 1) / 2, (cols - 5) / 2) attron(color_pair(COLOR_BLUE)|A_BOLD) do addstr("click") end refresh loop do c = getch case c when KEY_MOUSE m = getmouse if m show_message("getch = #{c.inspect}, ", "mouse event = #{'0x%x' % m.bstate}, ", "axis = (#{m.x},#{m.y},#{m.z})") end break end end refresh ensure close_screen end curses-1.4.4/sample/addch.rb0000755000004100000410000000060014201713275015726 0ustar www-datawww-data#!/usr/bin/env ruby # require_relative "../lib/curses" require 'curses' include Curses init_screen begin addstr("The following letter A should be BOLD and UNDERLINED by using addch:\n") addch('A'.ord | A_BOLD | A_UNDERLINE) addstr("\nIt should look the same as when using attron and addstr:\n") attron(A_BOLD | A_UNDERLINE) addstr("A") getch ensure close_screen end curses-1.4.4/sample/form.rb0000644000004100000410000000205314201713275015627 0ustar www-datawww-datarequire "curses" Curses.init_screen Curses.cbreak Curses.noecho Curses.stdscr.keypad = true at_exit do Curses.close_screen end fields = [ Curses::Field.new(1, 10, 4, 18, 0, 0), Curses::Field.new(1, 10, 6, 18, 0, 0) ] fields.each do |field| field.set_back(Curses::A_UNDERLINE) field.opts_off(Curses::O_AUTOSKIP) end form = Curses::Form.new(fields) form.post Curses.setpos(4, 10) Curses.addstr("Value 1:") Curses.setpos(6, 10) Curses.addstr("Value 2:") while ch = Curses.get_char begin case ch when Curses::KEY_F1 break when Curses::KEY_DOWN form.driver(Curses::REQ_NEXT_FIELD) form.driver(Curses::REQ_END_LINE) when Curses::KEY_UP form.driver(Curses::REQ_PREV_FIELD) form.driver(Curses::REQ_END_LINE) when Curses::KEY_RIGHT form.driver(Curses::REQ_NEXT_CHAR) when Curses::KEY_LEFT form.driver(Curses::REQ_PREV_CHAR) when Curses::KEY_BACKSPACE form.driver(Curses::REQ_DEL_PREV) else form.driver(ch) end rescue Curses::RequestDeniedError end end form.unpost curses-1.4.4/sample/rain.rb0000755000004100000410000000276614201713275015633 0ustar www-datawww-data#!/usr/bin/env ruby require "curses" def onsig(signal) Curses.close_screen exit signal end def place_string(y, x, string) Curses.setpos(y, x) Curses.addstr(string) end def cycle_index(index) (index + 1) % 5 end %w[HUP INT QUIT TERM].each do |sig| unless trap(sig, "IGNORE") == "IGNORE" # previous handler trap(sig) {|s| onsig(s) } end end Curses.init_screen Curses.nl Curses.noecho Curses.curs_set 0 srand xpos, ypos = {}, {} x_range = 2..(Curses.cols - 3) y_range = 2..(Curses.lines - 3) (0..4).each do |i| xpos[i], ypos[i] = rand(x_range), rand(y_range) end i = 0 loop do x, y = rand(x_range), rand(y_range) place_string(y, x, ".") place_string(ypos[i], xpos[i], "o") i = cycle_index(i) place_string(ypos[i], xpos[i], "O") i = cycle_index(i) place_string(ypos[i] - 1, xpos[i], "-") place_string(ypos[i], xpos[i] - 1, "|.|") place_string(ypos[i] + 1, xpos[i], "-") i = cycle_index(i) place_string(ypos[i] - 2, xpos[i], "-") place_string(ypos[i] - 1, xpos[i] - 1, "/ \\") place_string(ypos[i], xpos[i] - 2, "| O |") place_string(ypos[i] + 1, xpos[i] - 1, "\\ /") place_string(ypos[i] + 2, xpos[i], "-") i = cycle_index(i) place_string(ypos[i] - 2, xpos[i], " ") place_string(ypos[i] - 1, xpos[i] - 1, " ") place_string(ypos[i], xpos[i] - 2, " ") place_string(ypos[i] + 1, xpos[i] - 1, " ") place_string(ypos[i] + 2, xpos[i], " ") xpos[i], ypos[i] = x, y Curses.refresh sleep(0.5) end curses-1.4.4/sample/attr_demo.rb0000644000004100000410000000142114201713275016640 0ustar www-datawww-datarequire "curses" include Curses init_screen begin attrs = { A_NORMAL => 'Normal display (no highlight)', A_STANDOUT => 'Best highlighting mode of the terminal', A_UNDERLINE => 'Underlining', A_REVERSE => 'Reverse video', A_BLINK => 'Blinking', A_DIM => 'Half bright', A_BOLD => 'Extra bright or bold', A_PROTECT => 'Protected mode', A_INVIS => 'Invisible or blank mode', A_ALTCHARSET => 'Alternate character set', } longest_description = attrs.values.map(&:size).max attrs.each { |attribute, description| attrset(A_NORMAL) addstr("#{description.ljust(longest_description)}: ") attrset(attribute) addstr([*('a'..'z'), *('0'..'9')].join + "\n") } getch ensure close_screen endcurses-1.4.4/sample/mouse_move.rb0000755000004100000410000000274614201713275017056 0ustar www-datawww-data#!/usr/bin/env ruby # # Mouse movement tracking using CSI 1003 and 1006 (SGR). Will print a cursor that moves with the mouse. # require "curses" include Curses @positions = [] def draw_cursor(y, x, button, state) # Keep a trail of 10 previous positions visible on the screen if @positions.size >= 10 y_old, x_old = @positions.shift setpos(y_old, x_old) addstr(" ") end setpos(2, 1) addstr("Mouse is at y=#{y.to_s.ljust(3)} x=#{x.to_s.ljust(3)} button=#{button.to_s.ljust(3)} #{'%08b' % button}") setpos(y, x) addstr("+") @positions << [y, x] end init_screen crmode noecho stdscr.box('|', "-") setpos(1,1) addstr("Please move your mouse. Press 'q' to close.") begin # Switch on mouse continous position reporting print("\x1b[?1003h") # Also enable SGR extended reporting, because otherwise we can only # receive values up to 160x94. Everything else confuses Ruby Curses. print("\x1b[?1006h") loop do c = get_char case c when "q" return when "\e" # ESC case get_char when '[' csi = "" loop do d = get_char csi += d if d.ord >= 0x40 && d.ord <= 0x7E break end end if /<(\d+);(\d+);(\d+)(m|M)/ =~ csi button = $1.to_i x = $2.to_i y = $3.to_i state = $4 draw_cursor(y, x, button, state) end end end end ensure print("\x1b[?1003l") print("\x1b[?1006l") close_screen end curses-1.4.4/sample/view.rb0000755000004100000410000000175214201713275015646 0ustar www-datawww-data#!/usr/bin/env ruby require "curses" include Curses unless ARGV.size == 1 puts "usage: #{$0} file" exit end begin data_lines = File.readlines(ARGV[0]) rescue raise "cannot open file: #{ARGV[0]}" end init_screen #keypad(stdscr, true) nonl cbreak noecho #scrollok(stdscr, true) lptr = 0 loop do lines.times do |i| setpos(i, 0) #clrtoeol addstr(data_lines[lptr + i] || "") end refresh explicit = false n = 0 c = nil loop do c = getch if c =~ /[0-9]/ n = 10 * n + c.to_i explicit = true else break end end n = 1 if !explicit && n == 0 case c when "n" #when KEY_DOWN i = 0 n.times do if lptr + lines < data_lines.size lptr += 1 else break end i += 1 end #wscrl(i) when "p" #when KEY_UP i = 0 n.times do if lptr > 0 lptr -= 1 else break end i += 1 end #wscrl(-i) when "q" break end end close_screen curses-1.4.4/sample/view2.rb0000755000004100000410000000564114201713275015731 0ustar www-datawww-data#!/usr/bin/env ruby require "curses" # A curses based file viewer. class FileViewer # Create a new FileViewer and view the file. def initialize(filename) @data_lines = [] @screen = nil @top = nil init_curses load_file(filename) interact end # Perform the curses setup. def init_curses Curses.init_screen Curses.nonl Curses.cbreak Curses.noecho @screen = Curses.stdscr @screen.scrollok(true) #@screen.keypad(true) end # Load the file into memory and # put the first part on the curses display. def load_file(filename) @data_lines = File.readlines(filename).map(&:chomp) @top = 0 @data_lines[0..@screen.maxy-1].each_with_index do |line, idx| @screen.setpos(idx, 0) @screen.addstr(line) end @screen.setpos(0, 0) @screen.refresh rescue raise "cannot open file '#{filename}' for reading" end # Scroll the display up by one line. def scroll_up if @top > 0 @screen.scrl(-1) @top -= 1 str = @data_lines[@top] if str @screen.setpos(0, 0) @screen.addstr(str) end return true else return false end end # Scroll the display down by one line. def scroll_down if @top + @screen.maxy < @data_lines.length @screen.scrl(1) @top += 1 str = @data_lines[@top + @screen.maxy - 1] if str @screen.setpos(@screen.maxy - 1, 0) @screen.addstr(str) end return true else return false end end # Allow the user to interact with the display. # This uses Emacs-like keybindings, and also # vi-like keybindings as well, except that left # and right move to the beginning and end of the # file, respectively. def interact loop do result = true c = Curses.getch case c when Curses::KEY_DOWN, Curses::KEY_CTRL_N, "j" result = scroll_down when Curses::KEY_UP, Curses::KEY_CTRL_P, "k" result = scroll_up when Curses::KEY_NPAGE, " " (@screen.maxy - 1).times do |i| if !scroll_down && i == 0 result = false break end end when Curses::KEY_PPAGE (@screen.maxy - 1).times do |i| if !scroll_up && i == 0 result = false break end end when Curses::KEY_LEFT, Curses::KEY_CTRL_T, "h" while scroll_up end when Curses::KEY_RIGHT, Curses::KEY_CTRL_B, "l" while scroll_down end when "q" break else @screen.setpos(0, 0) @screen.addstr("[unknown key `#{Curses.keyname(c)}'=#{c}] ") end if !result Curses.beep end @screen.setpos(0, 0) end Curses.close_screen end end # If we are being run as a main program... if __FILE__ == $0 unless ARGV.size == 1 puts "usage: #{$0} file" exit end viewer = FileViewer.new(ARGV[0]) end curses-1.4.4/curses.gemspec0000644000004100000410000000151614201713275015732 0ustar www-datawww-dataGem::Specification.new { |s| s.name = "curses" s.version = "1.4.4" s.author = ["Shugo Maeda", 'Eric Hodel'] s.email = ["shugo@ruby-lang.org", 'drbrain@segment7.net'] s.homepage = "https://github.com/ruby/curses" s.platform = Gem::Platform::RUBY s.summary = "A Ruby binding for curses, ncurses, and PDCurses. curses is an extension library for text UI applications. Formerly part of the Ruby standard library, [curses was removed and placed in this gem][1] with the release of Ruby 2.1.0. (see [ruby/ruby@9c5b2fd][2])" s.files = `git ls-files --recurse-submodules -z`.split("\x0") s.extensions = ["ext/curses/extconf.rb"] s.require_path = "lib" s.required_ruby_version = Gem::Requirement.new('>= 2.6.0') s.licenses = ['Ruby', 'BSD-2-Clause'] s.add_development_dependency 'bundler' s.add_development_dependency 'rake' }